From 0a87f5501e84a3b3346ecda41829f999c2a63a3c Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sun, 22 Feb 2026 10:49:55 +0800 Subject: [PATCH] updated sdui, fix img imports --- embd_res/kcpp_sdui.embd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embd_res/kcpp_sdui.embd b/embd_res/kcpp_sdui.embd index 01e6e5d7d..82a965f0d 100644 --- a/embd_res/kcpp_sdui.embd +++ b/embd_res/kcpp_sdui.embd @@ -70,7 +70,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,l){function g(u,h){if(!i[u]){if(!r[u]){var c=typeof Ql=="function"&&Ql;if(!h&&c)return c(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=i[u]={exports:{}};r[u][0].call(s.exports,function(d){var v=r[u][1][d];return g(v||d)},s,s.exports,n,r,i,l)}return i[u].exports}for(var o=typeof Ql=="function"&&Ql,a=0;a>2,s=(3&u)<<4|h>>4,d=1<_?(15&h)<<2|c>>6:64,v=2<_?63&c:64,m.push(o.charAt(f)+o.charAt(s)+o.charAt(d)+o.charAt(v));return m.join("")},i.decode=function(a){var u,h,c,f,s,d,v=0,m=0,y="data:";if(a.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var b,_=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&_--,a.charAt(a.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=g.uint8array?new Uint8Array(0|_):new Array(0|_);v>4,h=(15&f)<<4|(s=o.indexOf(a.charAt(v++)))>>2,c=(3&s)<<6|(d=o.indexOf(a.charAt(v++))),b[m++]=u,s!==64&&(b[m++]=h),d!==64&&(b[m++]=c);return b}},{"./support":30,"./utils":32}],2:[function(n,r,i){var l=n("./external"),g=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),a=n("./stream/DataLengthProbe");function u(h,c,f,s,d){this.compressedSize=h,this.uncompressedSize=c,this.crc32=f,this.compression=s,this.compressedContent=d}u.prototype={getContentWorker:function(){var h=new g(l.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),c=this;return h.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new g(l.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,c,f){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(c.compressWorker(f)).pipe(new a("compressedSize")).withStreamInfo("compression",c)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var l=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new l("STORE compression")},uncompressWorker:function(){return new l("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var l=n("./utils"),g=function(){for(var o,a=[],u=0;u<256;u++){o=u;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[u]=o}return a}();r.exports=function(o,a){return o!==void 0&&o.length?l.getTypeOf(o)!=="string"?function(u,h,c,f){var s=g,d=f+c;u^=-1;for(var v=f;v>>8^s[255&(u^h[v])];return-1^u}(0|a,o,o.length,0):function(u,h,c,f){var s=g,d=f+c;u^=-1;for(var v=f;v>>8^s[255&(u^h.charCodeAt(v))];return-1^u}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var l=null;l=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:l}},{lie:37}],7:[function(n,r,i){var l=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=n("pako"),o=n("./utils"),a=n("./stream/GenericWorker"),u=l?"uint8array":"array";function h(c,f){a.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,c.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(f){c.push({data:f,meta:c.meta})}},i.compressWorker=function(c){return new h("Deflate",c)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function l(s,d){var v,m="";for(v=0;v>>=8;return m}function g(s,d,v,m,y,b){var _,w,S=s.file,x=s.compression,T=b!==u.utf8encode,E=o.transformTo("string",b(S.name)),A=o.transformTo("string",u.utf8encode(S.name)),D=S.comment,N=o.transformTo("string",b(D)),R=o.transformTo("string",u.utf8encode(D)),B=A.length!==S.name.length,O=R.length!==D.length,U="",ne="",Q="",ue=S.dir,I=S.date,z={crc32:0,compressedSize:0,uncompressedSize:0};d&&!v||(z.crc32=s.crc32,z.compressedSize=s.compressedSize,z.uncompressedSize=s.uncompressedSize);var M=0;d&&(M|=8),T||!B&&!O||(M|=2048);var L=0,J=0;ue&&(L|=16),y==="UNIX"?(J=798,L|=function(P,q){var Z=P;return P||(Z=q?16893:33204),(65535&Z)<<16}(S.unixPermissions,ue)):(J=20,L|=function(P){return 63&(P||0)}(S.dosPermissions)),_=I.getUTCHours(),_<<=6,_|=I.getUTCMinutes(),_<<=5,_|=I.getUTCSeconds()/2,w=I.getUTCFullYear()-1980,w<<=4,w|=I.getUTCMonth()+1,w<<=5,w|=I.getUTCDate(),B&&(ne=l(1,1)+l(h(E),4)+A,U+="up"+l(ne.length,2)+ne),O&&(Q=l(1,1)+l(h(N),4)+R,U+="uc"+l(Q.length,2)+Q);var V="";return V+=` \0`,V+=l(M,2),V+=x.magic,V+=l(_,2),V+=l(w,2),V+=l(z.crc32,4),V+=l(z.compressedSize,4),V+=l(z.uncompressedSize,4),V+=l(E.length,2),V+=l(U.length,2),{fileRecord:c.LOCAL_FILE_HEADER+V+E+U,dirRecord:c.CENTRAL_FILE_HEADER+l(J,2)+V+l(N.length,2)+"\0\0\0\0"+l(L,4)+l(m,4)+E+U+N}}var o=n("../utils"),a=n("../stream/GenericWorker"),u=n("../utf8"),h=n("../crc32"),c=n("../signature");function f(s,d,v,m){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=v,this.encodeFileName=m,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,a),f.prototype.push=function(s){var d=s.meta.percent||0,v=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,a.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:v?(d+100*(v-m-1))/v:100}}))},f.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var d=this.streamFiles&&!s.file.dir;if(d){var v=g(s,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(s){this.accumulate=!1;var d=this.streamFiles&&!s.file.dir,v=g(s,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),d)this.push({data:function(m){return c.DATA_DESCRIPTOR+l(m.crc32,4)+l(m.compressedSize,4)+l(m.uncompressedSize,4)}(s),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var s=this.bytesWritten,d=0;d=this.index;a--)u=(u<<8)+this.byteAt(a);return this.index+=o,u},readString:function(o){return l.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=g},{"../utils":32}],19:[function(n,r,i){var l=n("./Uint8ArrayReader");function g(o){l.call(this,o)}n("../utils").inherits(g,l),g.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var l=n("./DataReader");function g(o){l.call(this,o)}n("../utils").inherits(g,l),g.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},g.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},g.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},g.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=g},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var l=n("./ArrayReader");function g(o){l.call(this,o)}n("../utils").inherits(g,l),g.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var l=n("../utils"),g=n("../support"),o=n("./ArrayReader"),a=n("./StringReader"),u=n("./NodeBufferReader"),h=n("./Uint8ArrayReader");r.exports=function(c){var f=l.getTypeOf(c);return l.checkSupport(f),f!=="string"||g.uint8array?f==="nodebuffer"?new u(c):g.uint8array?new h(l.transformTo("uint8array",c)):new o(l.transformTo("array",c)):new a(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var l=n("./GenericWorker"),g=n("../utils");function o(a){l.call(this,"ConvertWorker to "+a),this.destType=a}g.inherits(o,l),o.prototype.processChunk=function(a){this.push({data:g.transformTo(this.destType,a.data),meta:a.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var l=n("./GenericWorker"),g=n("../crc32");function o(){l.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,l),o.prototype.processChunk=function(a){this.streamInfo.crc32=g(a.data,this.streamInfo.crc32||0),this.push(a)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var l=n("../utils"),g=n("./GenericWorker");function o(a){g.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}l.inherits(o,g),o.prototype.processChunk=function(a){if(a){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+a.data.length}g.prototype.processChunk.call(this,a)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var l=n("../utils"),g=n("./GenericWorker");function o(a){g.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=l.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}l.inherits(o,g),o.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,l.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(l.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,u);break;case"uint8array":a=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":a=this.data.slice(this.index,u)}return this.index=u,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function l(g){this.name=g||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}l.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,o){return this._listeners[g].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,o){if(this._listeners[g])for(var a=0;a "+g:g}},r.exports=l},{}],29:[function(n,r,i){var l=n("../utils"),g=n("./ConvertWorker"),o=n("./GenericWorker"),a=n("../base64"),u=n("../support"),h=n("../external"),c=null;if(u.nodestream)try{c=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,v){return new h.Promise(function(m,y){var b=[],_=d._internalType,w=d._outputType,S=d._mimeType;d.on("data",function(x,T){b.push(x),v&&v(T)}).on("error",function(x){b=[],y(x)}).on("end",function(){try{var x=function(T,E,A){switch(T){case"blob":return l.newBlob(l.transformTo("arraybuffer",E),A);case"base64":return a.encode(E);default:return l.transformTo(T,E)}}(w,function(T,E){var A,D=0,N=null,R=0;for(A=0;A"u")i.blob=!1;else{var l=new ArrayBuffer(0);try{i.blob=new Blob([l],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(l),i.blob=g.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var l=n("./utils"),g=n("./support"),o=n("./nodejsUtils"),a=n("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function c(){a.call(this,"utf-8 decode"),this.leftOver=null}function f(){a.call(this,"utf-8 encode")}i.utf8encode=function(s){return g.nodebuffer?o.newBufferFrom(s,"utf-8"):function(d){var v,m,y,b,_,w=d.length,S=0;for(b=0;b>>6:(m<65536?v[_++]=224|m>>>12:(v[_++]=240|m>>>18,v[_++]=128|m>>>12&63),v[_++]=128|m>>>6&63),v[_++]=128|63&m);return v}(s)},i.utf8decode=function(s){return g.nodebuffer?l.transformTo("nodebuffer",s).toString("utf-8"):function(d){var v,m,y,b,_=d.length,w=new Array(2*_);for(v=m=0;v<_;)if((y=d[v++])<128)w[m++]=y;else if(4<(b=u[y]))w[m++]=65533,v+=b-1;else{for(y&=b===2?31:b===3?15:7;1>10&1023,w[m++]=56320|1023&y)}return w.length!==m&&(w.subarray?w=w.subarray(0,m):w.length=m),l.applyFromCharCode(w)}(s=l.transformTo(g.uint8array?"uint8array":"array",s))},l.inherits(c,a),c.prototype.processChunk=function(s){var d=l.transformTo(g.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var v=d;(d=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),d.set(v,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var m=function(b,_){var w;for((_=_||b.length)>b.length&&(_=b.length),w=_-1;0<=w&&(192&b[w])==128;)w--;return w<0||w===0?_:w+u[b[w]]>_?w:_}(d),y=d;m!==d.length&&(g.uint8array?(y=d.subarray(0,m),this.leftOver=d.subarray(m,d.length)):(y=d.slice(0,m),this.leftOver=d.slice(m,d.length))),this.push({data:i.utf8decode(y),meta:s.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=c,l.inherits(f,a),f.prototype.processChunk=function(s){this.push({data:i.utf8encode(s.data),meta:s.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var l=n("./support"),g=n("./base64"),o=n("./nodejsUtils"),a=n("./external");function u(v){return v}function h(v,m){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=l(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var d,v,m,y=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4>>6:(s<65536?f[m++]=224|s>>>12:(f[m++]=240|s>>>18,f[m++]=128|s>>>12&63),f[m++]=128|s>>>6&63),f[m++]=128|63&s);return f},i.buf2binstring=function(c){return h(c,c.length)},i.binstring2buf=function(c){for(var f=new l.Buf8(c.length),s=0,d=f.length;s>10&1023,b[d++]=56320|1023&v)}return h(b,d)},i.utf8border=function(c,f){var s;for((f=f||c.length)>c.length&&(f=c.length),s=f-1;0<=s&&(192&c[s])==128;)s--;return s<0||s===0?f:s+a[c[s]]>f?s:f}},{"./common":41}],43:[function(n,r,i){r.exports=function(l,g,o,a){for(var u=65535&l|0,h=l>>>16&65535|0,c=0;o!==0;){for(o-=c=2e3>>1:g>>>1;o[a]=g}return o}();r.exports=function(g,o,a,u){var h=l,c=u+a;g^=-1;for(var f=u;f>>8^h[255&(g^o[f])];return-1^g}},{}],46:[function(n,r,i){var l,g=n("../utils/common"),o=n("./trees"),a=n("./adler32"),u=n("./crc32"),h=n("./messages"),c=0,f=4,s=0,d=-2,v=-1,m=4,y=2,b=8,_=9,w=286,S=30,x=19,T=2*w+1,E=15,A=3,D=258,N=D+A+1,R=42,B=113,O=1,U=2,ne=3,Q=4;function ue(k,X){return k.msg=h[X],X}function I(k){return(k<<1)-(4k.avail_out&&(W=k.avail_out),W!==0&&(g.arraySet(k.output,X.pending_buf,X.pending_out,W,k.next_out),k.next_out+=W,X.pending_out+=W,k.total_out+=W,k.avail_out-=W,X.pending-=W,X.pending===0&&(X.pending_out=0))}function L(k,X){o._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,X),k.block_start=k.strstart,M(k.strm)}function J(k,X){k.pending_buf[k.pending++]=X}function V(k,X){k.pending_buf[k.pending++]=X>>>8&255,k.pending_buf[k.pending++]=255&X}function P(k,X){var W,$,F=k.max_chain_length,K=k.strstart,de=k.prev_length,se=k.nice_match,G=k.strstart>k.w_size-N?k.strstart-(k.w_size-N):0,me=k.window,ae=k.w_mask,te=k.prev,be=k.strstart+D,Ce=me[K+de-1],xe=me[K+de];k.prev_length>=k.good_match&&(F>>=2),se>k.lookahead&&(se=k.lookahead);do if(me[(W=X)+de]===xe&&me[W+de-1]===Ce&&me[W]===me[K]&&me[++W]===me[K+1]){K+=2,W++;do;while(me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&KG&&--F!=0);return de<=k.lookahead?de:k.lookahead}function q(k){var X,W,$,F,K,de,se,G,me,ae,te=k.w_size;do{if(F=k.window_size-k.lookahead-k.strstart,k.strstart>=te+(te-N)){for(g.arraySet(k.window,k.window,te,te,0),k.match_start-=te,k.strstart-=te,k.block_start-=te,X=W=k.hash_size;$=k.head[--X],k.head[X]=te<=$?$-te:0,--W;);for(X=W=te;$=k.prev[--X],k.prev[X]=te<=$?$-te:0,--W;);F+=te}if(k.strm.avail_in===0)break;if(de=k.strm,se=k.window,G=k.strstart+k.lookahead,me=F,ae=void 0,ae=de.avail_in,me=A)for(K=k.strstart-k.insert,k.ins_h=k.window[K],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if($=o._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(F=k.strstart+k.lookahead-A,$=o._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=F&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(W=k.pending_buf_size-5);;){if(k.lookahead<=1){if(q(k),k.lookahead===0&&X===c)return O;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var $=k.block_start+W;if((k.strstart===0||k.strstart>=$)&&(k.lookahead=k.strstart-$,k.strstart=$,L(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-N&&(L(k,!1),k.strm.avail_out===0))return O}return k.insert=0,X===f?(L(k,!0),k.strm.avail_out===0?ne:Q):(k.strstart>k.block_start&&(L(k,!1),k.strm.avail_out),O)}),new pe(4,4,8,4,Z),new pe(4,5,16,8,Z),new pe(4,6,32,32,Z),new pe(4,4,16,16,ie),new pe(8,16,32,32,ie),new pe(8,16,128,128,ie),new pe(8,32,128,256,ie),new pe(32,128,258,1024,ie),new pe(32,258,258,4096,ie)],i.deflateInit=function(k,X){return Y(k,X,b,15,8,0)},i.deflateInit2=Y,i.deflateReset=H,i.deflateResetKeep=ye,i.deflateSetHeader=function(k,X){return k&&k.state?k.state.wrap!==2?d:(k.state.gzhead=X,s):d},i.deflate=function(k,X){var W,$,F,K;if(!k||!k.state||5>8&255),J($,$.gzhead.time>>16&255),J($,$.gzhead.time>>24&255),J($,$.level===9?2:2<=$.strategy||$.level<2?4:0),J($,255&$.gzhead.os),$.gzhead.extra&&$.gzhead.extra.length&&(J($,255&$.gzhead.extra.length),J($,$.gzhead.extra.length>>8&255)),$.gzhead.hcrc&&(k.adler=u(k.adler,$.pending_buf,$.pending,0)),$.gzindex=0,$.status=69):(J($,0),J($,0),J($,0),J($,0),J($,0),J($,$.level===9?2:2<=$.strategy||$.level<2?4:0),J($,3),$.status=B);else{var de=b+($.w_bits-8<<4)<<8;de|=(2<=$.strategy||$.level<2?0:$.level<6?1:$.level===6?2:3)<<6,$.strstart!==0&&(de|=32),de+=31-de%31,$.status=B,V($,de),$.strstart!==0&&(V($,k.adler>>>16),V($,65535&k.adler)),k.adler=1}if($.status===69)if($.gzhead.extra){for(F=$.pending;$.gzindex<(65535&$.gzhead.extra.length)&&($.pending!==$.pending_buf_size||($.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),M(k),F=$.pending,$.pending!==$.pending_buf_size));)J($,255&$.gzhead.extra[$.gzindex]),$.gzindex++;$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),$.gzindex===$.gzhead.extra.length&&($.gzindex=0,$.status=73)}else $.status=73;if($.status===73)if($.gzhead.name){F=$.pending;do{if($.pending===$.pending_buf_size&&($.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),M(k),F=$.pending,$.pending===$.pending_buf_size)){K=1;break}K=$.gzindex<$.gzhead.name.length?255&$.gzhead.name.charCodeAt($.gzindex++):0,J($,K)}while(K!==0);$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),K===0&&($.gzindex=0,$.status=91)}else $.status=91;if($.status===91)if($.gzhead.comment){F=$.pending;do{if($.pending===$.pending_buf_size&&($.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),M(k),F=$.pending,$.pending===$.pending_buf_size)){K=1;break}K=$.gzindex<$.gzhead.comment.length?255&$.gzhead.comment.charCodeAt($.gzindex++):0,J($,K)}while(K!==0);$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),K===0&&($.status=103)}else $.status=103;if($.status===103&&($.gzhead.hcrc?($.pending+2>$.pending_buf_size&&M(k),$.pending+2<=$.pending_buf_size&&(J($,255&k.adler),J($,k.adler>>8&255),k.adler=0,$.status=B)):$.status=B),$.pending!==0){if(M(k),k.avail_out===0)return $.last_flush=-1,s}else if(k.avail_in===0&&I(X)<=I(W)&&X!==f)return ue(k,-5);if($.status===666&&k.avail_in!==0)return ue(k,-5);if(k.avail_in!==0||$.lookahead!==0||X!==c&&$.status!==666){var se=$.strategy===2?function(G,me){for(var ae;;){if(G.lookahead===0&&(q(G),G.lookahead===0)){if(me===c)return O;break}if(G.match_length=0,ae=o._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,ae&&(L(G,!1),G.strm.avail_out===0))return O}return G.insert=0,me===f?(L(G,!0),G.strm.avail_out===0?ne:Q):G.last_lit&&(L(G,!1),G.strm.avail_out===0)?O:U}($,X):$.strategy===3?function(G,me){for(var ae,te,be,Ce,xe=G.window;;){if(G.lookahead<=D){if(q(G),G.lookahead<=D&&me===c)return O;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=A&&0G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=A?(ae=o._tr_tally(G,1,G.match_length-A),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(ae=o._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),ae&&(L(G,!1),G.strm.avail_out===0))return O}return G.insert=0,me===f?(L(G,!0),G.strm.avail_out===0?ne:Q):G.last_lit&&(L(G,!1),G.strm.avail_out===0)?O:U}($,X):l[$.level].func($,X);if(se!==ne&&se!==Q||($.status=666),se===O||se===ne)return k.avail_out===0&&($.last_flush=-1),s;if(se===U&&(X===1?o._tr_align($):X!==5&&(o._tr_stored_block($,0,0,!1),X===3&&(z($.head),$.lookahead===0&&($.strstart=0,$.block_start=0,$.insert=0))),M(k),k.avail_out===0))return $.last_flush=-1,s}return X!==f?s:$.wrap<=0?1:($.wrap===2?(J($,255&k.adler),J($,k.adler>>8&255),J($,k.adler>>16&255),J($,k.adler>>24&255),J($,255&k.total_in),J($,k.total_in>>8&255),J($,k.total_in>>16&255),J($,k.total_in>>24&255)):(V($,k.adler>>>16),V($,65535&k.adler)),M(k),0<$.wrap&&($.wrap=-$.wrap),$.pending!==0?s:1)},i.deflateEnd=function(k){var X;return k&&k.state?(X=k.state.status)!==R&&X!==69&&X!==73&&X!==91&&X!==103&&X!==B&&X!==666?ue(k,d):(k.state=null,X===B?ue(k,-3):s):d},i.deflateSetDictionary=function(k,X){var W,$,F,K,de,se,G,me,ae=X.length;if(!k||!k.state||(K=(W=k.state).wrap)===2||K===1&&W.status!==R||W.lookahead)return d;for(K===1&&(k.adler=a(k.adler,X,ae,0)),W.wrap=0,ae>=W.w_size&&(K===0&&(z(W.head),W.strstart=0,W.block_start=0,W.insert=0),me=new g.Buf8(W.w_size),g.arraySet(me,X,ae-W.w_size,W.w_size,0),X=me,ae=W.w_size),de=k.avail_in,se=k.next_in,G=k.input,k.avail_in=ae,k.next_in=0,k.input=X,q(W);W.lookahead>=A;){for($=W.strstart,F=W.lookahead-(A-1);W.ins_h=(W.ins_h<>>=A=E>>>24,_-=A,(A=E>>>16&255)===0)U[h++]=65535&E;else{if(!(16&A)){if((64&A)==0){E=w[(65535&E)+(b&(1<>>=A,_-=A),_<15&&(b+=O[a++]<<_,_+=8,b+=O[a++]<<_,_+=8),E=S[b&T];n:for(;;){if(b>>>=A=E>>>24,_-=A,!(16&(A=E>>>16&255))){if((64&A)==0){E=S[(65535&E)+(b&(1<>>=A,_-=A,(A=h-c)>3,b&=(1<<(_-=D<<3))-1,l.next_in=a,l.next_out=h,l.avail_in=a>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new l.Buf16(320),this.work=new l.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(R){var B;return R&&R.state?(B=R.state,R.total_in=R.total_out=B.total=0,R.msg="",B.wrap&&(R.adler=1&B.wrap),B.mode=d,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new l.Buf32(v),B.distcode=B.distdyn=new l.Buf32(m),B.sane=1,B.back=-1,f):s}function w(R){var B;return R&&R.state?((B=R.state).wsize=0,B.whave=0,B.wnext=0,_(R)):s}function S(R,B){var O,U;return R&&R.state?(U=R.state,B<0?(O=0,B=-B):(O=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=Q.wsize?(l.arraySet(Q.window,B,O-Q.wsize,Q.wsize,0),Q.wnext=0,Q.whave=Q.wsize):(U<(ne=Q.wsize-Q.wnext)&&(ne=U),l.arraySet(Q.window,B,O-U,ne,Q.wnext),(U-=ne)?(l.arraySet(Q.window,B,O-U,U,0),Q.wnext=U,Q.whave=Q.wsize):(Q.wnext+=ne,Q.wnext===Q.wsize&&(Q.wnext=0),Q.whave>>8&255,O.check=o(O.check,K,2,0),L=M=0,O.mode=2;break}if(O.flags=0,O.head&&(O.head.done=!1),!(1&O.wrap)||(((255&M)<<8)+(M>>8))%31){R.msg="incorrect header check",O.mode=30;break}if((15&M)!=8){R.msg="unknown compression method",O.mode=30;break}if(L-=4,k=8+(15&(M>>>=4)),O.wbits===0)O.wbits=k;else if(k>O.wbits){R.msg="invalid window size",O.mode=30;break}O.dmax=1<>8&1),512&O.flags&&(K[0]=255&M,K[1]=M>>>8&255,O.check=o(O.check,K,2,0)),L=M=0,O.mode=3;case 3:for(;L<32;){if(I===0)break e;I--,M+=U[Q++]<>>8&255,K[2]=M>>>16&255,K[3]=M>>>24&255,O.check=o(O.check,K,4,0)),L=M=0,O.mode=4;case 4:for(;L<16;){if(I===0)break e;I--,M+=U[Q++]<>8),512&O.flags&&(K[0]=255&M,K[1]=M>>>8&255,O.check=o(O.check,K,2,0)),L=M=0,O.mode=5;case 5:if(1024&O.flags){for(;L<16;){if(I===0)break e;I--,M+=U[Q++]<>>8&255,O.check=o(O.check,K,2,0)),L=M=0}else O.head&&(O.head.extra=null);O.mode=6;case 6:if(1024&O.flags&&(I<(P=O.length)&&(P=I),P&&(O.head&&(k=O.head.extra_len-O.length,O.head.extra||(O.head.extra=new Array(O.head.extra_len)),l.arraySet(O.head.extra,U,Q,P,k)),512&O.flags&&(O.check=o(O.check,U,P,Q)),I-=P,Q+=P,O.length-=P),O.length))break e;O.length=0,O.mode=7;case 7:if(2048&O.flags){if(I===0)break e;for(P=0;k=U[Q+P++],O.head&&k&&O.length<65536&&(O.head.name+=String.fromCharCode(k)),k&&P>9&1,O.head.done=!0),R.adler=O.check=0,O.mode=12;break;case 10:for(;L<32;){if(I===0)break e;I--,M+=U[Q++]<>>=7&L,L-=7&L,O.mode=27;break}for(;L<3;){if(I===0)break e;I--,M+=U[Q++]<>>=1)){case 0:O.mode=14;break;case 1:if(D(O),O.mode=20,B!==6)break;M>>>=2,L-=2;break e;case 2:O.mode=17;break;case 3:R.msg="invalid block type",O.mode=30}M>>>=2,L-=2;break;case 14:for(M>>>=7&L,L-=7&L;L<32;){if(I===0)break e;I--,M+=U[Q++]<>>16^65535)){R.msg="invalid stored block lengths",O.mode=30;break}if(O.length=65535&M,L=M=0,O.mode=15,B===6)break e;case 15:O.mode=16;case 16:if(P=O.length){if(I>>=5,L-=5,O.ndist=1+(31&M),M>>>=5,L-=5,O.ncode=4+(15&M),M>>>=4,L-=4,286>>=3,L-=3}for(;O.have<19;)O.lens[de[O.have++]]=0;if(O.lencode=O.lendyn,O.lenbits=7,W={bits:O.lenbits},X=u(0,O.lens,0,19,O.lencode,0,O.work,W),O.lenbits=W.bits,X){R.msg="invalid code lengths set",O.mode=30;break}O.have=0,O.mode=19;case 19:for(;O.have>>16&255,ge=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>>=ie,L-=ie,O.lens[O.have++]=ge;else{if(ge===16){for($=ie+2;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=ie,L-=ie,O.have===0){R.msg="invalid bit length repeat",O.mode=30;break}k=O.lens[O.have-1],P=3+(3&M),M>>>=2,L-=2}else if(ge===17){for($=ie+3;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=ie)),M>>>=3,L-=3}else{for($=ie+7;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=ie)),M>>>=7,L-=7}if(O.have+P>O.nlen+O.ndist){R.msg="invalid bit length repeat",O.mode=30;break}for(;P--;)O.lens[O.have++]=k}}if(O.mode===30)break;if(O.lens[256]===0){R.msg="invalid code -- missing end-of-block",O.mode=30;break}if(O.lenbits=9,W={bits:O.lenbits},X=u(h,O.lens,0,O.nlen,O.lencode,0,O.work,W),O.lenbits=W.bits,X){R.msg="invalid literal/lengths set",O.mode=30;break}if(O.distbits=6,O.distcode=O.distdyn,W={bits:O.distbits},X=u(c,O.lens,O.nlen,O.ndist,O.distcode,0,O.work,W),O.distbits=W.bits,X){R.msg="invalid distances set",O.mode=30;break}if(O.mode=20,B===6)break e;case 20:O.mode=21;case 21:if(6<=I&&258<=z){R.next_out=ue,R.avail_out=z,R.next_in=Q,R.avail_in=I,O.hold=M,O.bits=L,a(R,V),ue=R.next_out,ne=R.output,z=R.avail_out,Q=R.next_in,U=R.input,I=R.avail_in,M=O.hold,L=O.bits,O.mode===12&&(O.back=-1);break}for(O.back=0;pe=(F=O.lencode[M&(1<>>16&255,ge=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>ye)])>>>16&255,ge=65535&F,!(ye+(ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>>=ye,L-=ye,O.back+=ye}if(M>>>=ie,L-=ie,O.back+=ie,O.length=ge,pe===0){O.mode=26;break}if(32&pe){O.back=-1,O.mode=12;break}if(64&pe){R.msg="invalid literal/length code",O.mode=30;break}O.extra=15&pe,O.mode=22;case 22:if(O.extra){for($=O.extra;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=O.extra,L-=O.extra,O.back+=O.extra}O.was=O.length,O.mode=23;case 23:for(;pe=(F=O.distcode[M&(1<>>16&255,ge=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>ye)])>>>16&255,ge=65535&F,!(ye+(ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[Q++]<>>=ye,L-=ye,O.back+=ye}if(M>>>=ie,L-=ie,O.back+=ie,64&pe){R.msg="invalid distance code",O.mode=30;break}O.offset=ge,O.extra=15&pe,O.mode=24;case 24:if(O.extra){for($=O.extra;L<$;){if(I===0)break e;I--,M+=U[Q++]<>>=O.extra,L-=O.extra,O.back+=O.extra}if(O.offset>O.dmax){R.msg="invalid distance too far back",O.mode=30;break}O.mode=25;case 25:if(z===0)break e;if(P=V-z,O.offset>P){if((P=O.offset-P)>O.whave&&O.sane){R.msg="invalid distance too far back",O.mode=30;break}q=P>O.wnext?(P-=O.wnext,O.wsize-P):O.wnext-P,P>O.length&&(P=O.length),Z=O.window}else Z=ne,q=ue-O.offset,P=O.length;for(zT?(A=q[Z+m[B]],L[J+m[B]]):(A=96,0),b=1<>ue)+(_-=b)]=E<<24|A<<16|D|0,_!==0;);for(b=1<>=1;if(b!==0?(M&=b-1,M+=b):M=0,B++,--V[R]==0){if(R===U)break;R=c[f+m[B]]}if(ne>>7)]}function J(F,K){F.pending_buf[F.pending++]=255&K,F.pending_buf[F.pending++]=K>>>8&255}function V(F,K,de){F.bi_valid>y-de?(F.bi_buf|=K<>y-F.bi_valid,F.bi_valid+=de-y):(F.bi_buf|=K<>>=1,de<<=1,0<--K;);return de>>>1}function Z(F,K,de){var se,G,me=new Array(m+1),ae=0;for(se=1;se<=m;se++)me[se]=ae=ae+de[se-1]<<1;for(G=0;G<=K;G++){var te=F[2*G+1];te!==0&&(F[2*G]=q(me[te]++,te))}}function ie(F){var K;for(K=0;K>1;1<=de;de--)ye(F,me,de);for(G=be;de=F.heap[1],F.heap[1]=F.heap[F.heap_len--],ye(F,me,1),se=F.heap[1],F.heap[--F.heap_max]=de,F.heap[--F.heap_max]=se,me[2*G]=me[2*de]+me[2*se],F.depth[G]=(F.depth[de]>=F.depth[se]?F.depth[de]:F.depth[se])+1,me[2*de+1]=me[2*se+1]=G,F.heap[1]=G++,ye(F,me,1),2<=F.heap_len;);F.heap[--F.heap_max]=F.heap[1],function(xe,Ie){var ve,Se,Me,Le,ot,mt,st=Ie.dyn_tree,Xt=Ie.max_code,Jt=Ie.stat_desc.static_tree,Pr=Ie.stat_desc.has_stree,mn=Ie.stat_desc.extra_bits,xn=Ie.stat_desc.extra_base,ut=Ie.stat_desc.max_length,Qt=0;for(Le=0;Le<=m;Le++)xe.bl_count[Le]=0;for(st[2*xe.heap[xe.heap_max]+1]=0,ve=xe.heap_max+1;ve>=7;G>>=1)if(1&Ce&&te.dyn_ltree[2*be]!==0)return g;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return o;for(be=32;be>>3,(me=F.static_len+3+7>>>3)<=G&&(G=me)):G=me=de+5,de+4<=G&&K!==-1?$(F,K,de,se):F.strategy===4||me===G?(V(F,2+(se?1:0),3),H(F,N,R)):(V(F,4+(se?1:0),3),function(te,be,Ce,xe){var Ie;for(V(te,be-257,5),V(te,Ce-1,5),V(te,xe-4,4),Ie=0;Ie>>8&255,F.pending_buf[F.d_buf+2*F.last_lit+1]=255&K,F.pending_buf[F.l_buf+F.last_lit]=255&de,F.last_lit++,K===0?F.dyn_ltree[2*de]++:(F.matches++,K--,F.dyn_ltree[2*(O[de]+c+1)]++,F.dyn_dtree[2*L(K)]++),F.last_lit===F.lit_bufsize-1},i._tr_align=function(F){V(F,2,3),P(F,_,N),function(K){K.bi_valid===16?(J(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)}(F)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(l){(function(g,o){if(!g.setImmediate){var a,u,h,c,f=1,s={},d=!1,v=g.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(g);m=m&&m.setTimeout?m:g,a={}.toString.call(g.process)==="[object process]"?function(w){process.nextTick(function(){b(w)})}:function(){if(g.postMessage&&!g.importScripts){var w=!0,S=g.onmessage;return g.onmessage=function(){w=!1},g.postMessage("","*"),g.onmessage=S,w}}()?(c="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",_,!1):g.attachEvent("onmessage",_),function(w){g.postMessage(c+w,"*")}):g.MessageChannel?((h=new MessageChannel).port1.onmessage=function(w){b(w.data)},function(w){h.port2.postMessage(w)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(w){var S=v.createElement("script");S.onreadystatechange=function(){b(w),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(w){setTimeout(b,0,w)},m.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var S=new Array(arguments.length-1),x=0;x"u"?l===void 0?this:l:self)}).call(this,typeof Hl<"u"?Hl:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Ww);var ih=function(e,t){return ih=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},ih(e,t)};function Gp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ih(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function oU(e,t,n,r){function i(l){return l instanceof n?l:new n(function(g){g(l)})}return new(n||(n=Promise))(function(l,g){function o(h){try{u(r.next(h))}catch(c){g(c)}}function a(h){try{u(r.throw(h))}catch(c){g(c)}}function u(h){h.done?l(h.value):i(h.value).then(o,a)}u((r=r.apply(e,t||[])).next())})}function Yw(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,i,l,g;return g={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function o(u){return function(h){return a([u,h])}}function a(u){if(r)throw new TypeError("Generator is already executing.");for(;g&&(g=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(l=u[0]&2?i.return:u[0]?i.throw||((l=i.return)&&l.call(i),0):i.next)&&!(l=l.call(i,u[1])).done)return l;switch(i=0,l&&(u=[u[0]&2,l.value]),u[0]){case 0:case 1:l=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!l||u[1]>l[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ac(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,l=[],g;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)l.push(i.value)}catch(o){g={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(g)throw g.error}}return l}function oc(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,l;r1||o(f,s)})})}function o(f,s){try{a(r[f](s))}catch(d){c(l[0][3],d)}}function a(f){f.value instanceof ao?Promise.resolve(f.value.v).then(u,h):c(l[0][2],f)}function u(f){o("next",f)}function h(f){o("throw",f)}function c(f,s){f(s),l.shift(),l.length&&o(l[0][0],l[0][1])}}function lU(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Qs=="function"?Qs(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(l){n[l]=e[l]&&function(g){return new Promise(function(o,a){g=e[l](g),i(o,a,g.done,g.value)})}}function i(l,g,o,a){Promise.resolve(a).then(function(u){l({value:u,done:o})},g)}}function Zt(e){return typeof e=="function"}function uU(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Af=uU(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription: `+n.map(function(r,i){return i+1+") "+r.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=n}});function k0(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var qp=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,l;if(!this.closed){this.closed=!0;var g=this._parentage;if(g)if(this._parentage=null,Array.isArray(g))try{for(var o=Qs(g),a=o.next();!a.done;a=o.next()){var u=a.value;u.remove(this)}}catch(v){t={error:v}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}else g.remove(this);var h=this.initialTeardown;if(Zt(h))try{h()}catch(v){l=v instanceof Af?v.errors:[v]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var f=Qs(c),s=f.next();!s.done;s=f.next()){var d=s.value;try{E0(d)}catch(v){l=l!=null?l:[],v instanceof Af?l=oc(oc([],ac(l)),ac(v.errors)):l.push(v)}}}catch(v){r={error:v}}finally{try{s&&!s.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(l)throw new Af(l)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)E0(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&k0(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&k0(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();qp.EMPTY;function Xw(e){return e instanceof qp||e&&"closed"in e&&Zt(e.remove)&&Zt(e.add)&&Zt(e.unsubscribe)}function E0(e){Zt(e)?e():e.unsubscribe()}var Vc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ah={setTimeout:function(e,t){for(var n=[],r=2;rn.value=i,error:t==null?void 0:t.onError});return BU(()=>{r.unsubscribe()}),n}function zU(e,t,n){const r=oe(n==null?void 0:n.initialValue),i=Kp(e);let l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError})}),ni(()=>{l.unsubscribe()}),r}const Ca=xo("outputs",()=>{const e=FU(DU(Kp(()=>Lt.outputs.count())),{initialValue:0}),t=oe(1),n=Pn("sortOutputsBy","Oldest"),r=Pn("currentImagesLayout","dynamic"),i=oe("all"),l=zU(()=>{const s=Gt();let d;return i.value==="all"?d=Lt.outputs:i.value==="favourited"?d=Lt.outputs.where("starred").equals(1):i.value==="unfavourited"?d=Lt.outputs.where("starred").equals(0):d=Lt.outputs.where("rated").equals(0),n.value==="Newest"&&(d=d.reverse()),s.pageless==="Enabled"?d.toArray():d.offset((t.value-1)*s.pageSize).limit(s.pageSize).toArray()},[Cn(Gt(),"pageless"),Cn(Gt(),"pageSize"),t,n,i],{initialValue:[]});async function g(){if(navigator.storage&&navigator.storage.persist){const s=await navigator.storage.persist();console.log(`Persisted storage granted: ${s}`)}}async function o(){const s=localStorage.getItem("outputs");!s||(a(JSON.parse(s)),localStorage.removeItem("outputs"))}g(),o();async function a(s){const d=s.map(y=>{const{id:b,..._}=y;return _}),v=JSON.parse(JSON.stringify(d));console.log("Inserting outputs into database",v);const m=await Lt.outputs.bulkAdd(v,void 0,{allKeys:!0});return Lt.outputs.bulkGet(m)}async function u(s){const d=$t();if(!s.raw)return;if(!s.raw.type.includes("zip")){d.raiseError("Uploaded file needs to be a ZIP!",!1);return}const{files:v}=await Ww.exports.loadAsync(s.raw);let m=0,y=0;Di({message:"Loading images...",type:"info"});const b=[];for(const[w,S]of Object.entries(v)){const x=w.split("."),T=x.slice(-1).join("."),E=x.slice(0,-1).join(".");(T==="webp"||T==="png"||T==="gif"||T==="jpg"||T==="jpeg")&&b.push(new Promise(A=>{S.async("base64").then(async D=>{if(!v[E+".json"])return y++,A(null);const N=JSON.parse(await v[E+".json"].async("text"));m++,A({id:-1,image:`data:image/webp;base64,${D}`,...N,rated:N.rated?1:0,starred:N.starred?1:0})}).catch(D=>(d.raiseError(`Error while importing image: ${D}`,!1),y++,A(null)))}))}const _=await Promise.all(b);a(_.filter(w=>w!==null)),Di({message:`Successfully imported ${m}/${m+y} images!`,type:"success"})}async function h(s){const d=await Lt.outputs.get(s);return Lt.outputs.update(s,{starred:d!=null&&d.starred?0:1})}function c(s){return Lt.outputs.delete(s)}async function f(s){const d=$t();return d.selected=[],d.multiSelect=!1,s===await Lt.outputs.toCollection().primaryKeys()?Lt.outputs.clear():Lt.outputs.bulkDelete(s)}return{outputsLength:e,sortBy:n,filterBy:i,currentPage:t,currentOutputs:l,currentLayout:r,deleteOutput:c,deleteMultipleOutputs:f,toggleStarred:h,pushOutputs:a,importFromZip:u}}),$t=xo("ui",()=>{const e=oe(!1),t=oe([]),n=oe(["1"]),r=oe(-1),i=oe(!1),l=oe(!1);function g(f,s){console.error(f),Di({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Di({type:"warning",message:f,duration:s?0:void 0,showClose:s})}function a(){e.value=!e.value,!e.value&&(t.value=[])}function u(f){if(t.value.includes(f)){const s=t.value.indexOf(f);t.value.splice(s,1),t.value.length===0&&(e.value=!1);return}t.value.push(f)}async function h(){const f=Ca(),s=Gt(),d=f.currentOutputs.findIndex(m=>m.id===r.value),v=f.currentOutputs[d+1];if(v){r.value=v.id;return}if(f.currentPage<=Math.floor(f.outputsLength/s.pageSize)){const m=f.sortBy==="Newest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage++,r.value=(m==null?void 0:m.id)||r.value;return}}async function c(){const f=Ca(),s=f.currentOutputs.findIndex(v=>v.id===r.value),d=f.currentOutputs[s-1];if(f.currentPage>1&&!d){const v=f.sortBy==="Oldest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage--,r.value=(v==null?void 0:v.id)||r.value;return}if(d){r.value=d.id;return}}return{multiSelect:e,selected:t,activeCollapse:n,activeModal:r,showGeneratorBadge:i,showGeneratedImages:l,raiseError:g,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:h,openModalToLeft:c}}),Yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},NU={},jU={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},VU=re("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),UU=[VU];function HU(e,t){return j(),ce("svg",jU,UU)}const WU=Yt(NU,[["render",HU]]),Yo=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(j(),we(C(Ep),{index:e.index},{default:he(()=>[Te(t.$slots,"icon"),e.isMobile?_e("",!0):Te(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const YU="modulepreload",XU=function(e,t){return new URL(e,t).href},I0={},If=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=XU(l,r),l in I0)return;I0[l]=!0;const g=l.endsWith(".css"),o=g?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const c=i[h];if(c.href===l&&(!g||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=g?"stylesheet":YU,g||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),g)return new Promise((h,c)=>{u.addEventListener("load",h),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const KU={},GU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},qU=re("path",{d:"M7 14c-1.66 0-3 1.34-3 3c0 1.31-1.16 2-2 2c.92 1.22 2.49 2 4 2c2.21 0 4-1.79 4-4c0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34a.996.996 0 0 0-1.41 0L9 12.25L11.75 15l8.96-8.96a.996.996 0 0 0 0-1.41z",fill:"currentColor"},null,-1),ZU=[qU];function JU(e,t){return j(),ce("svg",GU,ZU)}const u2=Yt(KU,[["render",JU]]),QU={},eH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},tH=re("path",{d:"M24 14a5.99 5.99 0 0 0-4.885 9.471L14 28.586L15.414 30l5.115-5.115A5.997 5.997 0 1 0 24 14zm0 10a4 4 0 1 1 4-4a4.005 4.005 0 0 1-4 4z",fill:"currentColor"},null,-1),nH=re("path",{d:"M17 12a3 3 0 1 0-3-3a3.003 3.003 0 0 0 3 3zm0-4a1 1 0 1 1-1 1a1 1 0 0 1 1-1z",fill:"currentColor"},null,-1),rH=re("path",{d:"M12 24H4v-6.003L9 13l5.586 5.586L16 17.168l-5.586-5.585a2 2 0 0 0-2.828 0L4 15.168V4h20v6h2V4a2.002 2.002 0 0 0-2-2H4a2.002 2.002 0 0 0-2 2v20a2.002 2.002 0 0 0 2 2h8z",fill:"currentColor"},null,-1),iH=[tH,nH,rH];function aH(e,t){return j(),ce("svg",eH,iH)}const oH=Yt(QU,[["render",aH]]);function c2(){const e=oe("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return ni(()=>{clearInterval(t)}),{ellipsis:e}}const f2=e=>(Qr("data-v-dc223229"),e=e(),ei(),e),sH={style:{"text-align":"center"}},lH=f2(()=>re("br",null,null,-1)),uH={class:"gen-text"},cH={key:0},fH={key:1},dH=f2(()=>re("br",null,null,-1)),hH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null},emits:["showGenerated"],setup(e){const{ellipsis:t}=c2();return(n,r)=>{var i,l;return j(),ce("div",sH,[le(C(ow),{type:"circle",percentage:100*((i=e.generated)!=null?i:0)/((l=e.total)!=null?l:1),width:200},{default:he(()=>[re("span",null,Ae(e.generated)+" / "+Ae(e.total),1),lH]),_:1},8,["percentage"]),re("div",uH,[e.generated===e.total?(j(),ce("span",cH,"All done!")):(j(),ce("span",fH,[Ne("Generating"+Ae(C(t))+Ae("\xA0".repeat(3-C(t).length)),1),dH,re("sup",null,Ae(e.elapsed),1)]))]),e.generated?(j(),ce("div",{key:0,onClick:r[0]||(r[0]=g=>n.$emit("showGenerated")),class:"view-images"},[re("span",null,"View image"+Ae(e.total===1?"":"s"),1),le(C(De),null,{default:he(()=>[le(C(IO))]),_:1})])):_e("",!0)])}}});const pH=Yt(hH,[["__scopeId","data-v-dc223229"]]);const mH={style:{width:"200px"}},gH=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(j(),we(C(Or),{trigger:e.trigger},{content:he(()=>[re("div",mH,[Te(t.$slots,"default",{},()=>[Ne(Ae(e.info),1)])])]),default:he(()=>[le(C(De),{size:e.size},{default:he(()=>[le(C(Wh))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),vH={key:0,class:"align-vertical",style:{"margin-left":"5px"}},yH=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(j(),ce("span",{class:"align-vertical",style:Fe(e.labelStyle||"height: 100%;")},[Te(t.$slots,"default",{},()=>[Ne(Ae(e.label),1)],!0),e.info?(j(),ce("div",vH,[le(gH,{info:e.info,size:15},null,8,["info"])])):_e("",!0)],4))}});const xl=Yt(yH,[["__scopeId","data-v-ec7e7ec1"]]),bH={key:0,style:{width:"100%"}},_H={key:1,style:{display:"flex","flex-direction":"column",gap:"8px",width:"100%"}},En=Ee({__name:"FormSlider",props:{label:null,modelValue:null,prop:null,min:null,max:null,step:null,info:null,disabled:{type:Boolean},labelStyle:null,multiple:{type:Boolean}},emits:["update:modelValue","change","onAdd","onRemove"],setup(e,{emit:t}){const n=e,i=up(lp).smallerOrEqual("md");function l(h,c){var s;if(n.multiple&&Array.isArray(n.modelValue)){c=c||0;const d=(s=Array.isArray(h)?h[0]:h)!=null?s:n.min;let v=n.modelValue;v[c]=d,t("update:modelValue",v),t("change",v);return}const f=h!=null?h:n.min;t("update:modelValue",f),t("change",f)}function g(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.min;t("update:modelValue",[...n.modelValue,h]),t("onAdd",h)}function o(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.modelValue,c=h.pop();t("update:modelValue",h),t("onRemove",c)}const a=ee(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=ee(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(h,c)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(h.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[!e.multiple||!Array.isArray(e.modelValue)?(j(),ce("div",bH,[C(i)?_e("",!0):(j(),we(C(a0),{key:0,"model-value":C(u),min:e.min,max:e.max,step:e.step,onInput:l,disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":C(u),min:e.min,max:e.max,step:e.step,onChange:l,disabled:e.disabled},null,8,["model-value","min","max","step","disabled"])):_e("",!0)])):(j(),ce("div",_H,[(j(!0),ce(ze,null,Dt(C(a),f=>(j(),ce("div",{key:f},[C(i)?_e("",!0):(j(),we(C(a0),{key:0,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onInput:s=>l(s,f),disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","onInput","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onChange:s=>l(s,f),disabled:e.disabled},null,8,["model-value","min","max","step","onChange","disabled"])):_e("",!0)]))),128)),re("div",null,[le(C(lt),{icon:C(Xh),onClick:c[0]||(c[0]=()=>g())},null,8,["icon"]),le(C(lt),{icon:C(e_),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),Te(h.$slots,"inline")]),_:3},8,["prop"]))}});const Au=Ee({__name:"FormSelect",props:{label:null,modelValue:null,prop:null,options:null,multiple:{type:Boolean},info:null,filterable:{type:Boolean},labelStyle:null,placement:null},emits:["update:modelValue","change"],setup(e,{emit:t}){function n(r){t("update:modelValue",r),t("change",r)}return(r,i)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(r.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(iw),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:he(()=>[(j(!0),ce(ze,null,Dt(e.options,l=>(j(),we(C(aw),{key:l,label:l.label!==void 0?l.label:l,value:l.value!==void 0?l.value:l,disabled:l.disabled!==void 0?l.disabled:!1},null,8,["label","value","disabled"]))),128))]),_:1},8,["model-value","filterable","multiple","placement"]),Te(r.$slots,"inline")]),_:3},8,["prop"]))}}),sh=Ee({__name:"FormInput",props:{label:null,modelValue:null,prop:null,type:null,resize:null,placeholder:null,autosize:{type:[Boolean,Object]},info:null,labelStyle:null,change:null,clearable:{type:Boolean},clearIcon:null},emits:["update:modelValue","focus","blur"],setup(e,{emit:t}){const n=e;function r(i){t("update:modelValue",i),n.change&&n.change(i)}return(i,l)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(Ra),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,clearable:e.clearable,"clear-icon":e.clearIcon,onFocus:l[0]||(l[0]=g=>i.$emit("focus")),onBlur:l[1]||(l[1]=g=>i.$emit("blur"))},{append:he(()=>[Te(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder","clearable","clear-icon"]),Te(i.$slots,"inline")]),_:3},8,["prop"]))}});const Wa=Ee({__name:"FormSwitch",props:{label:null,modelValue:{type:Boolean},prop:null,disabled:{type:Boolean},disabledText:null,defaultValue:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(i){const l=!!i;t("update:modelValue",l),n.change&&n.change(l)}return Jy(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[e.disabledText&&e.disabled?(j(),we(C(Or),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:he(()=>[le(C(o0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(j(),we(C(o0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),Te(i.$slots,"inline")]),_:3},8,["prop"]))}}),wH=e=>(Qr("data-v-cf07eac2"),e=e(),ei(),e),CH=wH(()=>re("div",null,"Prompt",-1)),SH=Ee({__name:"FormPromptInput",setup(e){const t=en();return(n,r)=>(j(),we(sh,{prop:"prompt",modelValue:C(t).prompt,"onUpdate:modelValue":r[0]||(r[0]=i=>C(t).prompt=i),autosize:{minRows:2,maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter prompt here","label-position":"top","label-style":"justify-content: space-between; width: 100%;"},{label:he(()=>[CH]),_:1},8,["modelValue"]))}});const xH=Yt(SH,[["__scopeId","data-v-cf07eac2"]]);const TH=e=>(Qr("data-v-a260b725"),e=e(),ei(),e),kH={style:{position:"relative",height:"100%",width:"100%"}},EH=TH(()=>re("span",null,"Back to generation status",-1)),OH={class:"carousel-container"},AH=["src"],PH={class:"carousel-footer"},IH={style:{display:"flex","justify-content":"center"}},MH={style:{"white-space":"nowrap"}},LH=Ee({__name:"GeneratedCarousel",setup(e){const t=en(),n=$t(),r=Gt(),i=oe(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function g(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(j(),ce("div",kH,[C(t).generating?(j(),ce("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(De),null,{default:he(()=>[le(C(Gb))]),_:1}),EH])):_e("",!0),re("div",OH,[le(C(o$),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:he(()=>[(j(!0),ce(ze,null,Dt(C(t).outputs,(u,h)=>(j(),we(C(s$),{key:h,style:{display:"flex","justify-content":"center"}},{default:he(()=>[u.type==="video"?(j(),ce("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,AH)):_e("",!0),u.type==="image"?(j(),we(C(Tp),{key:1,src:u.output.image,style:{width:"100%",height:"100%"},fit:"scale-down",onClick:()=>C(n).activeModal=u.output.id},null,8,["src","onClick"])):_e("",!0)]),_:2},1024))),128))]),_:1},8,["autoplay"])]),re("div",PH,[le(C(NB)),re("div",IH,[le(C(p1),null,{default:he(()=>[re("div",MH,[le(J2,{imageData:C(t).outputs[i.value].output,"on-delete":g,"show-dismiss":!0},null,8,["imageData"])])]),_:1})])])]))}});const RH=Yt(LH,[["__scopeId","data-v-a260b725"]]);var Jn={};const DH={},$H=Object.freeze(Object.defineProperty({__proto__:null,default:DH},Symbol.toStringTag,{value:"Module"})),Mf=ND($H);(function(e){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var t=t||{version:"5.2.4"};if(e.fabric=t,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(""),t.window=window;else{var n=Mf,r=new n.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;t.document=r.document,t.jsdomImplForWrapper=Mf.implForWrapper,t.nodeCanvas=Mf.Canvas,t.window=r,DOMParser=t.window.DOMParser}t.isTouchSupported="ontouchstart"in t.window||"ontouchstart"in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",t.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],t.DPI=96,t.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",t.commaWsp="(?:\\s+,?\\s*|,\\s*)",t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS="http://www.w3.org/2000/svg",t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){if(t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize))return console.log("max texture size: "+t.maxTextureSize),new t.WebglFilterBackend({tileSize:t.textureSize});if(t.Canvas2dFilterBackend)return new t.Canvas2dFilterBackend},typeof document<"u"&&typeof window<"u"&&(window.fabric=t),function(){function o(s,d){if(!!this.__eventListeners[s]){var v=this.__eventListeners[s];d?v[v.indexOf(d)]=!1:t.util.array.fill(v,!1)}}function a(s,d){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var v in s)this.on(v,s[v]);else this.__eventListeners[s]||(this.__eventListeners[s]=[]),this.__eventListeners[s].push(d);return this}function u(s,d){var v=function(){d.apply(this,arguments),this.off(s,v)}.bind(this);this.on(s,v)}function h(s,d){if(arguments.length===1)for(var v in s)u.call(this,v,s[v]);else u.call(this,s,d);return this}function c(s,d){if(!this.__eventListeners)return this;if(arguments.length===0)for(s in this.__eventListeners)o.call(this,s);else if(arguments.length===1&&typeof arguments[0]=="object")for(var v in s)o.call(this,v,s[v]);else o.call(this,s,d);return this}function f(s,d){if(!this.__eventListeners)return this;var v=this.__eventListeners[s];if(!v)return this;for(var m=0,y=v.length;m"u"?this._objects.concat():this._objects.filter(function(a){return a.type===o})},item:function(o){return this._objects[o]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(o,a){return this._objects.indexOf(o)>-1?!0:a?this._objects.some(function(u){return typeof u.contains=="function"&&u.contains(o,!0)}):!1},complexity:function(){return this._objects.reduce(function(o,a){return o+=a.complexity?a.complexity():0,o},0)}},t.CommonMethods={_setOptions:function(o){for(var a in o)this.set(a,o[a])},_initGradient:function(o,a){o&&o.colorStops&&!(o instanceof t.Gradient)&&this.set(a,new t.Gradient(o))},_initPattern:function(o,a,u){o&&o.source&&!(o instanceof t.Pattern)?this.set(a,new t.Pattern(o,u)):u&&u()},_setObject:function(o){for(var a in o)this._set(a,o[a])},set:function(o,a){return typeof o=="object"?this._setObject(o):this._set(o,a),this},_set:function(o,a){this[o]=a},toggle:function(o){var a=this.get(o);return typeof a=="boolean"&&this.set(o,!a),this},get:function(o){return this[o]}},function(o){var a=Math.sqrt,u=Math.atan2,h=Math.pow,c=Math.PI/180,f=Math.PI/2;t.util={cos:function(s){if(s===0)return 1;s<0&&(s=-s);var d=s/f;switch(d){case 1:case 3:return 0;case 2:return-1}return Math.cos(s)},sin:function(s){if(s===0)return 0;var d=s/f,v=1;switch(s<0&&(v=-1),d){case 1:return v;case 2:return 0;case 3:return-v}return Math.sin(s)},removeFromArray:function(s,d){var v=s.indexOf(d);return v!==-1&&s.splice(v,1),s},getRandomInt:function(s,d){return Math.floor(Math.random()*(d-s+1))+s},degreesToRadians:function(s){return s*c},radiansToDegrees:function(s){return s/c},rotatePoint:function(s,d,v){var m=new t.Point(s.x-d.x,s.y-d.y),y=t.util.rotateVector(m,v);return new t.Point(y.x,y.y).addEquals(d)},rotateVector:function(s,d){var v=t.util.sin(d),m=t.util.cos(d),y=s.x*m-s.y*v,b=s.x*v+s.y*m;return{x:y,y:b}},createVector:function(s,d){return new t.Point(d.x-s.x,d.y-s.y)},calcAngleBetweenVectors:function(s,d){return Math.acos((s.x*d.x+s.y*d.y)/(Math.hypot(s.x,s.y)*Math.hypot(d.x,d.y)))},getHatVector:function(s){return new t.Point(s.x,s.y).multiply(1/Math.hypot(s.x,s.y))},getBisector:function(s,d,v){var m=t.util.createVector(s,d),y=t.util.createVector(s,v),b=t.util.calcAngleBetweenVectors(m,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(m,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(m,w)),angle:b}},projectStrokeOnPoints:function(s,d,v){var m=[],y=d.strokeWidth/2,b=d.strokeUniform?new t.Point(1/d.scaleX,1/d.scaleY):new t.Point(1,1),_=function(w){var S=y/Math.hypot(w.x,w.y);return new t.Point(w.x*S*b.x,w.y*S*b.y)};return s.length<=1||s.forEach(function(w,S){var x=new t.Point(w.x,w.y),T,E;S===0?(E=s[S+1],T=v?_(t.util.createVector(E,x)).addEquals(x):s[s.length-1]):S===s.length-1?(T=s[S-1],E=v?_(t.util.createVector(T,x)).addEquals(x):s[0]):(T=s[S-1],E=s[S+1]);var A=t.util.getBisector(x,T,E),D=A.vector,N=A.angle,R,B;if(d.strokeLineJoin==="miter"&&(R=-y/Math.sin(N/2),B=new t.Point(D.x*R*b.x,D.y*R*b.y),Math.hypot(B.x,B.y)/y<=d.strokeMiterLimit)){m.push(x.add(B)),m.push(x.subtract(B));return}R=-y*Math.SQRT2,B=new t.Point(D.x*R*b.x,D.y*R*b.y),m.push(x.add(B)),m.push(x.subtract(B))}),m},transformPoint:function(s,d,v){return v?new t.Point(d[0]*s.x+d[2]*s.y,d[1]*s.x+d[3]*s.y):new t.Point(d[0]*s.x+d[2]*s.y+d[4],d[1]*s.x+d[3]*s.y+d[5])},makeBoundingBoxFromPoints:function(s,d){if(d)for(var v=0;v"u"?1:s.scaleX,v=typeof s.scaleY>"u"?1:s.scaleY,m=[s.flipX?-d:d,0,0,s.flipY?-v:v,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(m=y(m,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(m=y(m,[1,Math.tan(b(s.skewY)),0,1],!0)),m},composeMatrix:function(s){var d=[1,0,0,1,s.translateX||0,s.translateY||0],v=t.util.multiplyTransformMatrices;return s.angle&&(d=v(d,t.util.calcRotateMatrix(s))),(s.scaleX!==1||s.scaleY!==1||s.skewX||s.skewY||s.flipX||s.flipY)&&(d=v(d,t.util.calcDimensionsMatrix(s))),d},resetObjectTransform:function(s){s.scaleX=1,s.scaleY=1,s.skewX=0,s.skewY=0,s.flipX=!1,s.flipY=!1,s.rotate(0)},saveObjectTransform:function(s){return{scaleX:s.scaleX,scaleY:s.scaleY,skewX:s.skewX,skewY:s.skewY,angle:s.angle,left:s.left,flipX:s.flipX,flipY:s.flipY,top:s.top}},isTransparent:function(s,d,v,m){m>0&&(d>m?d-=m:d=0,v>m?v-=m:v=0);var y=!0,b,_,w=s.getImageData(d,v,m*2||1,m*2||1),S=w.data.length;for(b=3;bn.value=i,error:t==null?void 0:t.onError});return BU(()=>{r.unsubscribe()}),n}function zU(e,t,n){const r=oe(n==null?void 0:n.initialValue),i=Kp(e);let l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError})}),ni(()=>{l.unsubscribe()}),r}const Ca=xo("outputs",()=>{const e=FU(DU(Kp(()=>Lt.outputs.count())),{initialValue:0}),t=oe(1),n=Pn("sortOutputsBy","Oldest"),r=Pn("currentImagesLayout","dynamic"),i=oe("all"),l=zU(()=>{const s=Gt();let d;return i.value==="all"?d=Lt.outputs:i.value==="favourited"?d=Lt.outputs.where("starred").equals(1):i.value==="unfavourited"?d=Lt.outputs.where("starred").equals(0):d=Lt.outputs.where("rated").equals(0),n.value==="Newest"&&(d=d.reverse()),s.pageless==="Enabled"?d.toArray():d.offset((t.value-1)*s.pageSize).limit(s.pageSize).toArray()},[Cn(Gt(),"pageless"),Cn(Gt(),"pageSize"),t,n,i],{initialValue:[]});async function g(){if(navigator.storage&&navigator.storage.persist){const s=await navigator.storage.persist();console.log(`Persisted storage granted: ${s}`)}}async function o(){const s=localStorage.getItem("outputs");!s||(a(JSON.parse(s)),localStorage.removeItem("outputs"))}g(),o();async function a(s){const d=s.map(y=>{const{id:b,..._}=y;return _}),v=50,m=[];for(let y=0;y{S.async("base64").then(async D=>{if(!v[E+".json"])return y++,A(null);const N=JSON.parse(await v[E+".json"].async("text"));m++,A({id:-1,image:`data:image/webp;base64,${D}`,...N,rated:N.rated?1:0,starred:N.starred?1:0})}).catch(D=>(d.raiseError(`Error while importing image: ${D}`,!1),y++,A(null)))}))}const _=await Promise.all(b);a(_.filter(w=>w!==null)),Di({message:`Successfully imported ${m}/${m+y} images!`,type:"success"})}async function h(s){const d=await Lt.outputs.get(s);return Lt.outputs.update(s,{starred:d!=null&&d.starred?0:1})}function c(s){return Lt.outputs.delete(s)}async function f(s){const d=$t();return d.selected=[],d.multiSelect=!1,s===await Lt.outputs.toCollection().primaryKeys()?Lt.outputs.clear():Lt.outputs.bulkDelete(s)}return{outputsLength:e,sortBy:n,filterBy:i,currentPage:t,currentOutputs:l,currentLayout:r,deleteOutput:c,deleteMultipleOutputs:f,toggleStarred:h,pushOutputs:a,importFromZip:u}}),$t=xo("ui",()=>{const e=oe(!1),t=oe([]),n=oe(["1"]),r=oe(-1),i=oe(!1),l=oe(!1);function g(f,s){console.error(f),Di({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Di({type:"warning",message:f,duration:s?0:void 0,showClose:s})}function a(){e.value=!e.value,!e.value&&(t.value=[])}function u(f){if(t.value.includes(f)){const s=t.value.indexOf(f);t.value.splice(s,1),t.value.length===0&&(e.value=!1);return}t.value.push(f)}async function h(){const f=Ca(),s=Gt(),d=f.currentOutputs.findIndex(m=>m.id===r.value),v=f.currentOutputs[d+1];if(v){r.value=v.id;return}if(f.currentPage<=Math.floor(f.outputsLength/s.pageSize)){const m=f.sortBy==="Newest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage++,r.value=(m==null?void 0:m.id)||r.value;return}}async function c(){const f=Ca(),s=f.currentOutputs.findIndex(v=>v.id===r.value),d=f.currentOutputs[s-1];if(f.currentPage>1&&!d){const v=f.sortBy==="Oldest"?await Lt.outputs.where(":id").below(r.value).last():await Lt.outputs.where(":id").above(r.value).first();f.currentPage--,r.value=(v==null?void 0:v.id)||r.value;return}if(d){r.value=d.id;return}}return{multiSelect:e,selected:t,activeCollapse:n,activeModal:r,showGeneratorBadge:i,showGeneratedImages:l,raiseError:g,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:h,openModalToLeft:c}}),Yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},NU={},jU={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},VU=re("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),UU=[VU];function HU(e,t){return j(),ce("svg",jU,UU)}const WU=Yt(NU,[["render",HU]]),Yo=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(j(),we(C(Ep),{index:e.index},{default:he(()=>[Te(t.$slots,"icon"),e.isMobile?_e("",!0):Te(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const YU="modulepreload",XU=function(e,t){return new URL(e,t).href},I0={},If=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=XU(l,r),l in I0)return;I0[l]=!0;const g=l.endsWith(".css"),o=g?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const c=i[h];if(c.href===l&&(!g||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=g?"stylesheet":YU,g||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),g)return new Promise((h,c)=>{u.addEventListener("load",h),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const KU={},GU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},qU=re("path",{d:"M7 14c-1.66 0-3 1.34-3 3c0 1.31-1.16 2-2 2c.92 1.22 2.49 2 4 2c2.21 0 4-1.79 4-4c0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34a.996.996 0 0 0-1.41 0L9 12.25L11.75 15l8.96-8.96a.996.996 0 0 0 0-1.41z",fill:"currentColor"},null,-1),ZU=[qU];function JU(e,t){return j(),ce("svg",GU,ZU)}const u2=Yt(KU,[["render",JU]]),QU={},eH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},tH=re("path",{d:"M24 14a5.99 5.99 0 0 0-4.885 9.471L14 28.586L15.414 30l5.115-5.115A5.997 5.997 0 1 0 24 14zm0 10a4 4 0 1 1 4-4a4.005 4.005 0 0 1-4 4z",fill:"currentColor"},null,-1),nH=re("path",{d:"M17 12a3 3 0 1 0-3-3a3.003 3.003 0 0 0 3 3zm0-4a1 1 0 1 1-1 1a1 1 0 0 1 1-1z",fill:"currentColor"},null,-1),rH=re("path",{d:"M12 24H4v-6.003L9 13l5.586 5.586L16 17.168l-5.586-5.585a2 2 0 0 0-2.828 0L4 15.168V4h20v6h2V4a2.002 2.002 0 0 0-2-2H4a2.002 2.002 0 0 0-2 2v20a2.002 2.002 0 0 0 2 2h8z",fill:"currentColor"},null,-1),iH=[tH,nH,rH];function aH(e,t){return j(),ce("svg",eH,iH)}const oH=Yt(QU,[["render",aH]]);function c2(){const e=oe("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return ni(()=>{clearInterval(t)}),{ellipsis:e}}const f2=e=>(Qr("data-v-dc223229"),e=e(),ei(),e),sH={style:{"text-align":"center"}},lH=f2(()=>re("br",null,null,-1)),uH={class:"gen-text"},cH={key:0},fH={key:1},dH=f2(()=>re("br",null,null,-1)),hH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null},emits:["showGenerated"],setup(e){const{ellipsis:t}=c2();return(n,r)=>{var i,l;return j(),ce("div",sH,[le(C(ow),{type:"circle",percentage:100*((i=e.generated)!=null?i:0)/((l=e.total)!=null?l:1),width:200},{default:he(()=>[re("span",null,Ae(e.generated)+" / "+Ae(e.total),1),lH]),_:1},8,["percentage"]),re("div",uH,[e.generated===e.total?(j(),ce("span",cH,"All done!")):(j(),ce("span",fH,[Ne("Generating"+Ae(C(t))+Ae("\xA0".repeat(3-C(t).length)),1),dH,re("sup",null,Ae(e.elapsed),1)]))]),e.generated?(j(),ce("div",{key:0,onClick:r[0]||(r[0]=g=>n.$emit("showGenerated")),class:"view-images"},[re("span",null,"View image"+Ae(e.total===1?"":"s"),1),le(C(De),null,{default:he(()=>[le(C(IO))]),_:1})])):_e("",!0)])}}});const pH=Yt(hH,[["__scopeId","data-v-dc223229"]]);const mH={style:{width:"200px"}},gH=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(j(),we(C(Or),{trigger:e.trigger},{content:he(()=>[re("div",mH,[Te(t.$slots,"default",{},()=>[Ne(Ae(e.info),1)])])]),default:he(()=>[le(C(De),{size:e.size},{default:he(()=>[le(C(Wh))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),vH={key:0,class:"align-vertical",style:{"margin-left":"5px"}},yH=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(j(),ce("span",{class:"align-vertical",style:Fe(e.labelStyle||"height: 100%;")},[Te(t.$slots,"default",{},()=>[Ne(Ae(e.label),1)],!0),e.info?(j(),ce("div",vH,[le(gH,{info:e.info,size:15},null,8,["info"])])):_e("",!0)],4))}});const xl=Yt(yH,[["__scopeId","data-v-ec7e7ec1"]]),bH={key:0,style:{width:"100%"}},_H={key:1,style:{display:"flex","flex-direction":"column",gap:"8px",width:"100%"}},En=Ee({__name:"FormSlider",props:{label:null,modelValue:null,prop:null,min:null,max:null,step:null,info:null,disabled:{type:Boolean},labelStyle:null,multiple:{type:Boolean}},emits:["update:modelValue","change","onAdd","onRemove"],setup(e,{emit:t}){const n=e,i=up(lp).smallerOrEqual("md");function l(h,c){var s;if(n.multiple&&Array.isArray(n.modelValue)){c=c||0;const d=(s=Array.isArray(h)?h[0]:h)!=null?s:n.min;let v=n.modelValue;v[c]=d,t("update:modelValue",v),t("change",v);return}const f=h!=null?h:n.min;t("update:modelValue",f),t("change",f)}function g(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.min;t("update:modelValue",[...n.modelValue,h]),t("onAdd",h)}function o(){if(!n.multiple||!Array.isArray(n.modelValue))return;const h=n.modelValue,c=h.pop();t("update:modelValue",h),t("onRemove",c)}const a=ee(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=ee(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(h,c)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(h.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[!e.multiple||!Array.isArray(e.modelValue)?(j(),ce("div",bH,[C(i)?_e("",!0):(j(),we(C(a0),{key:0,"model-value":C(u),min:e.min,max:e.max,step:e.step,onInput:l,disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":C(u),min:e.min,max:e.max,step:e.step,onChange:l,disabled:e.disabled},null,8,["model-value","min","max","step","disabled"])):_e("",!0)])):(j(),ce("div",_H,[(j(!0),ce(ze,null,Dt(C(a),f=>(j(),ce("div",{key:f},[C(i)?_e("",!0):(j(),we(C(a0),{key:0,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onInput:s=>l(s,f),disabled:e.disabled,"show-input":""},null,8,["model-value","min","max","step","onInput","disabled"])),C(i)?(j(),we(C(Ld),{key:1,"model-value":e.modelValue[f],min:e.min,max:e.max,step:e.step,onChange:s=>l(s,f),disabled:e.disabled},null,8,["model-value","min","max","step","onChange","disabled"])):_e("",!0)]))),128)),re("div",null,[le(C(lt),{icon:C(Xh),onClick:c[0]||(c[0]=()=>g())},null,8,["icon"]),le(C(lt),{icon:C(e_),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),Te(h.$slots,"inline")]),_:3},8,["prop"]))}});const Au=Ee({__name:"FormSelect",props:{label:null,modelValue:null,prop:null,options:null,multiple:{type:Boolean},info:null,filterable:{type:Boolean},labelStyle:null,placement:null},emits:["update:modelValue","change"],setup(e,{emit:t}){function n(r){t("update:modelValue",r),t("change",r)}return(r,i)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(r.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(iw),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:he(()=>[(j(!0),ce(ze,null,Dt(e.options,l=>(j(),we(C(aw),{key:l,label:l.label!==void 0?l.label:l,value:l.value!==void 0?l.value:l,disabled:l.disabled!==void 0?l.disabled:!1},null,8,["label","value","disabled"]))),128))]),_:1},8,["model-value","filterable","multiple","placement"]),Te(r.$slots,"inline")]),_:3},8,["prop"]))}}),sh=Ee({__name:"FormInput",props:{label:null,modelValue:null,prop:null,type:null,resize:null,placeholder:null,autosize:{type:[Boolean,Object]},info:null,labelStyle:null,change:null,clearable:{type:Boolean},clearIcon:null},emits:["update:modelValue","focus","blur"],setup(e,{emit:t}){const n=e;function r(i){t("update:modelValue",i),n.change&&n.change(i)}return(i,l)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(Ra),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,clearable:e.clearable,"clear-icon":e.clearIcon,onFocus:l[0]||(l[0]=g=>i.$emit("focus")),onBlur:l[1]||(l[1]=g=>i.$emit("blur"))},{append:he(()=>[Te(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder","clearable","clear-icon"]),Te(i.$slots,"inline")]),_:3},8,["prop"]))}});const Wa=Ee({__name:"FormSwitch",props:{label:null,modelValue:{type:Boolean},prop:null,disabled:{type:Boolean},disabledText:null,defaultValue:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(i){const l=!!i;t("update:modelValue",l),n.change&&n.change(l)}return Jy(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(j(),we(C(Ti),{prop:e.prop},{label:he(()=>[le(xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[Te(i.$slots,"label",{},()=>[Ne(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[e.disabledText&&e.disabled?(j(),we(C(Or),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:he(()=>[le(C(o0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(j(),we(C(o0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),Te(i.$slots,"inline")]),_:3},8,["prop"]))}}),wH=e=>(Qr("data-v-cf07eac2"),e=e(),ei(),e),CH=wH(()=>re("div",null,"Prompt",-1)),SH=Ee({__name:"FormPromptInput",setup(e){const t=en();return(n,r)=>(j(),we(sh,{prop:"prompt",modelValue:C(t).prompt,"onUpdate:modelValue":r[0]||(r[0]=i=>C(t).prompt=i),autosize:{minRows:2,maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter prompt here","label-position":"top","label-style":"justify-content: space-between; width: 100%;"},{label:he(()=>[CH]),_:1},8,["modelValue"]))}});const xH=Yt(SH,[["__scopeId","data-v-cf07eac2"]]);const TH=e=>(Qr("data-v-a260b725"),e=e(),ei(),e),kH={style:{position:"relative",height:"100%",width:"100%"}},EH=TH(()=>re("span",null,"Back to generation status",-1)),OH={class:"carousel-container"},AH=["src"],PH={class:"carousel-footer"},IH={style:{display:"flex","justify-content":"center"}},MH={style:{"white-space":"nowrap"}},LH=Ee({__name:"GeneratedCarousel",setup(e){const t=en(),n=$t(),r=Gt(),i=oe(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function g(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(j(),ce("div",kH,[C(t).generating?(j(),ce("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(De),null,{default:he(()=>[le(C(Gb))]),_:1}),EH])):_e("",!0),re("div",OH,[le(C(o$),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:he(()=>[(j(!0),ce(ze,null,Dt(C(t).outputs,(u,h)=>(j(),we(C(s$),{key:h,style:{display:"flex","justify-content":"center"}},{default:he(()=>[u.type==="video"?(j(),ce("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,AH)):_e("",!0),u.type==="image"?(j(),we(C(Tp),{key:1,src:u.output.image,style:{width:"100%",height:"100%"},fit:"scale-down",onClick:()=>C(n).activeModal=u.output.id},null,8,["src","onClick"])):_e("",!0)]),_:2},1024))),128))]),_:1},8,["autoplay"])]),re("div",PH,[le(C(NB)),re("div",IH,[le(C(p1),null,{default:he(()=>[re("div",MH,[le(J2,{imageData:C(t).outputs[i.value].output,"on-delete":g,"show-dismiss":!0},null,8,["imageData"])])]),_:1})])])]))}});const RH=Yt(LH,[["__scopeId","data-v-a260b725"]]);var Jn={};const DH={},$H=Object.freeze(Object.defineProperty({__proto__:null,default:DH},Symbol.toStringTag,{value:"Module"})),Mf=ND($H);(function(e){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var t=t||{version:"5.2.4"};if(e.fabric=t,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(""),t.window=window;else{var n=Mf,r=new n.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;t.document=r.document,t.jsdomImplForWrapper=Mf.implForWrapper,t.nodeCanvas=Mf.Canvas,t.window=r,DOMParser=t.window.DOMParser}t.isTouchSupported="ontouchstart"in t.window||"ontouchstart"in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",t.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],t.DPI=96,t.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",t.commaWsp="(?:\\s+,?\\s*|,\\s*)",t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS="http://www.w3.org/2000/svg",t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){if(t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize))return console.log("max texture size: "+t.maxTextureSize),new t.WebglFilterBackend({tileSize:t.textureSize});if(t.Canvas2dFilterBackend)return new t.Canvas2dFilterBackend},typeof document<"u"&&typeof window<"u"&&(window.fabric=t),function(){function o(s,d){if(!!this.__eventListeners[s]){var v=this.__eventListeners[s];d?v[v.indexOf(d)]=!1:t.util.array.fill(v,!1)}}function a(s,d){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var v in s)this.on(v,s[v]);else this.__eventListeners[s]||(this.__eventListeners[s]=[]),this.__eventListeners[s].push(d);return this}function u(s,d){var v=function(){d.apply(this,arguments),this.off(s,v)}.bind(this);this.on(s,v)}function h(s,d){if(arguments.length===1)for(var v in s)u.call(this,v,s[v]);else u.call(this,s,d);return this}function c(s,d){if(!this.__eventListeners)return this;if(arguments.length===0)for(s in this.__eventListeners)o.call(this,s);else if(arguments.length===1&&typeof arguments[0]=="object")for(var v in s)o.call(this,v,s[v]);else o.call(this,s,d);return this}function f(s,d){if(!this.__eventListeners)return this;var v=this.__eventListeners[s];if(!v)return this;for(var m=0,y=v.length;m"u"?this._objects.concat():this._objects.filter(function(a){return a.type===o})},item:function(o){return this._objects[o]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(o,a){return this._objects.indexOf(o)>-1?!0:a?this._objects.some(function(u){return typeof u.contains=="function"&&u.contains(o,!0)}):!1},complexity:function(){return this._objects.reduce(function(o,a){return o+=a.complexity?a.complexity():0,o},0)}},t.CommonMethods={_setOptions:function(o){for(var a in o)this.set(a,o[a])},_initGradient:function(o,a){o&&o.colorStops&&!(o instanceof t.Gradient)&&this.set(a,new t.Gradient(o))},_initPattern:function(o,a,u){o&&o.source&&!(o instanceof t.Pattern)?this.set(a,new t.Pattern(o,u)):u&&u()},_setObject:function(o){for(var a in o)this._set(a,o[a])},set:function(o,a){return typeof o=="object"?this._setObject(o):this._set(o,a),this},_set:function(o,a){this[o]=a},toggle:function(o){var a=this.get(o);return typeof a=="boolean"&&this.set(o,!a),this},get:function(o){return this[o]}},function(o){var a=Math.sqrt,u=Math.atan2,h=Math.pow,c=Math.PI/180,f=Math.PI/2;t.util={cos:function(s){if(s===0)return 1;s<0&&(s=-s);var d=s/f;switch(d){case 1:case 3:return 0;case 2:return-1}return Math.cos(s)},sin:function(s){if(s===0)return 0;var d=s/f,v=1;switch(s<0&&(v=-1),d){case 1:return v;case 2:return 0;case 3:return-v}return Math.sin(s)},removeFromArray:function(s,d){var v=s.indexOf(d);return v!==-1&&s.splice(v,1),s},getRandomInt:function(s,d){return Math.floor(Math.random()*(d-s+1))+s},degreesToRadians:function(s){return s*c},radiansToDegrees:function(s){return s/c},rotatePoint:function(s,d,v){var m=new t.Point(s.x-d.x,s.y-d.y),y=t.util.rotateVector(m,v);return new t.Point(y.x,y.y).addEquals(d)},rotateVector:function(s,d){var v=t.util.sin(d),m=t.util.cos(d),y=s.x*m-s.y*v,b=s.x*v+s.y*m;return{x:y,y:b}},createVector:function(s,d){return new t.Point(d.x-s.x,d.y-s.y)},calcAngleBetweenVectors:function(s,d){return Math.acos((s.x*d.x+s.y*d.y)/(Math.hypot(s.x,s.y)*Math.hypot(d.x,d.y)))},getHatVector:function(s){return new t.Point(s.x,s.y).multiply(1/Math.hypot(s.x,s.y))},getBisector:function(s,d,v){var m=t.util.createVector(s,d),y=t.util.createVector(s,v),b=t.util.calcAngleBetweenVectors(m,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(m,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(m,w)),angle:b}},projectStrokeOnPoints:function(s,d,v){var m=[],y=d.strokeWidth/2,b=d.strokeUniform?new t.Point(1/d.scaleX,1/d.scaleY):new t.Point(1,1),_=function(w){var S=y/Math.hypot(w.x,w.y);return new t.Point(w.x*S*b.x,w.y*S*b.y)};return s.length<=1||s.forEach(function(w,S){var x=new t.Point(w.x,w.y),T,E;S===0?(E=s[S+1],T=v?_(t.util.createVector(E,x)).addEquals(x):s[s.length-1]):S===s.length-1?(T=s[S-1],E=v?_(t.util.createVector(T,x)).addEquals(x):s[0]):(T=s[S-1],E=s[S+1]);var A=t.util.getBisector(x,T,E),D=A.vector,N=A.angle,R,B;if(d.strokeLineJoin==="miter"&&(R=-y/Math.sin(N/2),B=new t.Point(D.x*R*b.x,D.y*R*b.y),Math.hypot(B.x,B.y)/y<=d.strokeMiterLimit)){m.push(x.add(B)),m.push(x.subtract(B));return}R=-y*Math.SQRT2,B=new t.Point(D.x*R*b.x,D.y*R*b.y),m.push(x.add(B)),m.push(x.subtract(B))}),m},transformPoint:function(s,d,v){return v?new t.Point(d[0]*s.x+d[2]*s.y,d[1]*s.x+d[3]*s.y):new t.Point(d[0]*s.x+d[2]*s.y+d[4],d[1]*s.x+d[3]*s.y+d[5])},makeBoundingBoxFromPoints:function(s,d){if(d)for(var v=0;v"u"?1:s.scaleX,v=typeof s.scaleY>"u"?1:s.scaleY,m=[s.flipX?-d:d,0,0,s.flipY?-v:v,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(m=y(m,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(m=y(m,[1,Math.tan(b(s.skewY)),0,1],!0)),m},composeMatrix:function(s){var d=[1,0,0,1,s.translateX||0,s.translateY||0],v=t.util.multiplyTransformMatrices;return s.angle&&(d=v(d,t.util.calcRotateMatrix(s))),(s.scaleX!==1||s.scaleY!==1||s.skewX||s.skewY||s.flipX||s.flipY)&&(d=v(d,t.util.calcDimensionsMatrix(s))),d},resetObjectTransform:function(s){s.scaleX=1,s.scaleY=1,s.skewX=0,s.skewY=0,s.flipX=!1,s.flipY=!1,s.rotate(0)},saveObjectTransform:function(s){return{scaleX:s.scaleX,scaleY:s.scaleY,skewX:s.skewX,skewY:s.skewY,angle:s.angle,left:s.left,flipX:s.flipX,flipY:s.flipY,top:s.top}},isTransparent:function(s,d,v,m){m>0&&(d>m?d-=m:d=0,v>m?v-=m:v=0);var y=!0,b,_,w=s.getImageData(d,v,m*2||1,m*2||1),S=w.data.length;for(b=3;b0?be-=2*q:V===1&&be<0&&(be+=2*q);for(var Ce=Math.ceil(Math.abs(be/q*2)),xe=[],Ie=be/Ce,ve=8/3*Math.sin(Ie/4)*Math.sin(Ie/4)/Math.sin(Ie/2),Se=te+Ie,Me=0;Me=J?V-J:2*Math.PI-(J-V)}function s(I,z,M,L,J,V,P,q){var Z;if(t.cachesBoundsOfCurve&&(Z=o.call(arguments),t.boundsOfCurveCache[Z]))return t.boundsOfCurveCache[Z];var ie=Math.sqrt,pe=Math.min,ge=Math.max,ye=Math.abs,H=[],Y=[[],[]],k,X,W,$,F,K,de,se;X=6*I-12*M+6*J,k=-3*I+9*M-9*J+3*P,W=3*M-3*I;for(var G=0;G<2;++G){if(G>0&&(X=6*z-12*L+6*V,k=-3*z+9*L-9*V+3*q,W=3*L-3*z),ye(k)<1e-12){if(ye(X)<1e-12)continue;$=-W/X,0<$&&$<1&&H.push($);continue}de=X*X-4*W*k,!(de<0)&&(se=ie(de),F=(-X+se)/(2*k),01e-4;)P=J(M),pe=M,q=m(V.x,V.y,P.x,P.y),q+L>z?(M-=Z,Z/=2):(V=P,M+=Z,L+=q);return P.angle=ie(pe),P}function O(I){for(var z=0,M=I.length,L,J=0,V=0,P=0,q=0,Z=[],ie,pe,ge,ye=0;ye0&&Lde)for(var G=1,me=k.length;G2;for(z=z||0,ie&&(q=I[2].xI[L-2].x?1:J.x===I[L-2].x?0:-1,Z=J.y>I[L-2].y?1:J.y===I[L-2].y?0:-1),M.push(["L",J.x+q*z,J.y+Z*z]),M}function ue(I,z,M){return M&&(z=t.util.multiplyTransformMatrices(z,[1,0,0,1,-M.x,-M.y])),I.map(function(L){for(var J=L.slice(0),V={},P=1;P=m})}function h(s,d){return f(s,d,function(v,m){return v/g,">")}function h(f){var s=0,d,v=[];for(s=0,d;s57343)return f.charAt(s);if(55296<=d&&d<=56319){if(f.length<=s+1)throw"High surrogate without following low surrogate";var v=f.charCodeAt(s+1);if(56320>v||v>57343)throw"High surrogate without following low surrogate";return f.charAt(s)+f.charAt(s+1)}if(s===0)throw"Low surrogate without preceding high surrogate";var m=f.charCodeAt(s-1);if(55296>m||m>56319)throw"Low surrogate without preceding high surrogate";return!1}t.util.string={camelize:o,capitalize:a,escapeXml:u,graphemeSplit:h}}(),function(){var o=Array.prototype.slice,a=function(){},u=function(){for(var d in{toString:1})if(d==="toString")return!1;return!0}(),h=function(d,v,m){for(var y in v)y in d.prototype&&typeof d.prototype[y]=="function"&&(v[y]+"").indexOf("callSuper")>-1?d.prototype[y]=function(b){return function(){var _=this.constructor.superclass;this.constructor.superclass=m;var w=v[b].apply(this,arguments);if(this.constructor.superclass=_,b!=="initialize")return w}}(y):d.prototype[y]=v[y],u&&(v.toString!==Object.prototype.toString&&(d.prototype.toString=v.toString),v.valueOf!==Object.prototype.valueOf&&(d.prototype.valueOf=v.valueOf))};function c(){}function f(d){for(var v=null,m=this;m.constructor.superclass;){var y=m.constructor.superclass.prototype[d];if(m[d]!==y){v=y;break}m=m.constructor.superclass.prototype}return v?arguments.length>1?v.apply(this,o.call(arguments,1)):v.call(this):console.log("tried to callSuper "+d+", method not found in prototype chain",this)}function s(){var d=null,v=o.call(arguments,0);typeof v[0]=="function"&&(d=v.shift());function m(){this.initialize.apply(this,arguments)}m.superclass=d,m.subclasses=[],d&&(c.prototype=d.prototype,m.prototype=new c,d.subclasses.push(m));for(var y=0,b=v.length;y-1||h.pointerType==="touch"}}(),function(){function o(s,d){var v=s.style;if(!v)return s;if(typeof d=="string")return s.style.cssText+=";"+d,d.indexOf("opacity")>-1?f(s,d.match(/opacity:\s*(\d?\.?\d*)/)[1]):s;for(var m in d)if(m==="opacity")f(s,d[m]);else{var y=m==="float"||m==="cssFloat"?typeof v.styleFloat>"u"?"cssFloat":"styleFloat":m;v.setProperty(y,d[m])}return s}var a=t.document.createElement("div"),u=typeof a.style.opacity=="string",h=typeof a.style.filter=="string",c=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,f=function(s){return s};u?f=function(s,d){return s.style.opacity=d,s}:h&&(f=function(s,d){var v=s.style;return s.currentStyle&&!s.currentStyle.hasLayout&&(v.zoom=1),c.test(v.filter)?(d=d>=.9999?"":"alpha(opacity="+d*100+")",v.filter=v.filter.replace(c,d)):v.filter+=" alpha(opacity="+d*100+")",s}),t.util.setStyle=o}(),function(){var o=Array.prototype.slice;function a(w){return typeof w=="string"?t.document.getElementById(w):w}var u,h=function(w){return o.call(w,0)};try{u=h(t.document.childNodes)instanceof Array}catch{}u||(h=function(w){for(var S=new Array(w.length),x=w.length;x--;)S[x]=w[x];return S});function c(w,S){var x=t.document.createElement(w);for(var T in S)T==="class"?x.className=S[T]:T==="for"?x.htmlFor=S[T]:x.setAttribute(T,S[T]);return x}function f(w,S){w&&(" "+w.className+" ").indexOf(" "+S+" ")===-1&&(w.className+=(w.className?" ":"")+S)}function s(w,S,x){return typeof S=="string"&&(S=c(S,x)),w.parentNode&&w.parentNode.replaceChild(S,w),S.appendChild(w),S}function d(w){for(var S=0,x=0,T=t.document.documentElement,E=t.document.body||{scrollLeft:0,scrollTop:0};w&&(w.parentNode||w.host)&&(w=w.parentNode||w.host,w===t.document?(S=E.scrollLeft||T.scrollLeft||0,x=E.scrollTop||T.scrollTop||0):(S+=w.scrollLeft||0,x+=w.scrollTop||0),!(w.nodeType===1&&w.style.position==="fixed")););return{left:S,top:x}}function v(w){var S,x=w&&w.ownerDocument,T={left:0,top:0},E={left:0,top:0},A,D={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!x)return E;for(var N in D)E[D[N]]+=parseInt(m(w,N),10)||0;return S=x.documentElement,typeof w.getBoundingClientRect<"u"&&(T=w.getBoundingClientRect()),A=d(w),{left:T.left+A.left-(S.clientLeft||0)+E.left,top:T.top+A.top-(S.clientTop||0)+E.top}}var m;t.document.defaultView&&t.document.defaultView.getComputedStyle?m=function(w,S){var x=t.document.defaultView.getComputedStyle(w,null);return x?x[S]:void 0}:m=function(w,S){var x=w.style[S];return!x&&w.currentStyle&&(x=w.currentStyle[S]),x},function(){var w=t.document.documentElement.style,S="userSelect"in w?"userSelect":"MozUserSelect"in w?"MozUserSelect":"WebkitUserSelect"in w?"WebkitUserSelect":"KhtmlUserSelect"in w?"KhtmlUserSelect":"";function x(E){return typeof E.onselectstart<"u"&&(E.onselectstart=t.util.falseFunction),S?E.style[S]="none":typeof E.unselectable=="string"&&(E.unselectable="on"),E}function T(E){return typeof E.onselectstart<"u"&&(E.onselectstart=null),S?E.style[S]="":typeof E.unselectable=="string"&&(E.unselectable=""),E}t.util.makeElementUnselectable=x,t.util.makeElementSelectable=T}();function y(w){var S=t.jsdomImplForWrapper(w);return S._canvas||S._image}function b(w){if(!!t.isLikelyNode){var S=t.jsdomImplForWrapper(w);S&&(S._image=null,S._canvas=null,S._currentSrc=null,S._attributes=null,S._classList=null)}}function _(w,S){w.imageSmoothingEnabled=w.imageSmoothingEnabled||w.webkitImageSmoothingEnabled||w.mozImageSmoothingEnabled||w.msImageSmoothingEnabled||w.oImageSmoothingEnabled,w.imageSmoothingEnabled=S}t.util.setImageSmoothing=_,t.util.getById=a,t.util.toArray=h,t.util.addClass=f,t.util.makeElement=c,t.util.wrapElement=s,t.util.getScrollLeftTop=d,t.util.getElementOffset=v,t.util.getNodeCanvas=y,t.util.cleanUpJsdomNode=b}(),function(){function o(h,c){return h+(/\?/.test(h)?"&":"?")+c}function a(){}function u(h,c){c||(c={});var f=c.method?c.method.toUpperCase():"GET",s=c.onComplete||function(){},d=new t.window.XMLHttpRequest,v=c.body||c.parameters;return d.onreadystatechange=function(){d.readyState===4&&(s(d),d.onreadystatechange=a)},f==="GET"&&(v=null,typeof c.parameters=="string"&&(h=o(h,c.parameters))),d.open(f,h,!0),(f==="POST"||f==="PUT")&&d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.send(v),d}t.util.request=u}(),t.log=console.log,t.warn=console.warn,function(){var o=t.util.object.extend,a=t.util.object.clone,u=[];t.util.object.extend(u,{cancelAll:function(){var y=this.splice(0);return y.forEach(function(b){b.cancel()}),y},cancelByCanvas:function(y){if(!y)return[];var b=this.filter(function(_){return typeof _.target=="object"&&_.target.canvas===y});return b.forEach(function(_){_.cancel()}),b},cancelByTarget:function(y){var b=this.findAnimationsByTarget(y);return b.forEach(function(_){_.cancel()}),b},findAnimationIndex:function(y){return this.indexOf(this.findAnimation(y))},findAnimation:function(y){return this.find(function(b){return b.cancel===y})},findAnimationsByTarget:function(y){return y?this.filter(function(b){return b.target===y}):[]}});function h(){return!1}function c(y,b,_,w){return-_*Math.cos(y/w*(Math.PI/2))+_+b}function f(y){y||(y={});var b=!1,_,w=function(){var S=t.runningAnimations.indexOf(_);return S>-1&&t.runningAnimations.splice(S,1)[0]};return _=o(a(y),{cancel:function(){return b=!0,w()},currentValue:"startValue"in y?y.startValue:0,completionRate:0,durationRate:0}),t.runningAnimations.push(_),v(function(S){var x=S||+new Date,T=y.duration||500,E=x+T,A,D=y.onChange||h,N=y.abort||h,R=y.onComplete||h,B=y.easing||c,O="startValue"in y?y.startValue.length>0:!1,U="startValue"in y?y.startValue:0,ne="endValue"in y?y.endValue:100,Q=y.byValue||(O?U.map(function(ue,I){return ne[I]-U[I]}):ne-U);y.onStart&&y.onStart(),function ue(I){A=I||+new Date;var z=A>E?T:A-x,M=z/T,L=O?U.map(function(V,P){return B(z,U[P],Q[P],T)}):B(z,U,Q,T),J=Math.abs(O?(L[0]-U[0])/Q[0]:(L-U)/Q);if(_.currentValue=O?L.slice():L,_.completionRate=J,_.durationRate=M,!b){if(N(L,J,M)){w();return}if(A>E){_.currentValue=O?ne.slice():ne,_.completionRate=1,_.durationRate=1,D(O?ne.slice():ne,1,1),R(ne,1,1),w();return}else D(L,J,M),v(ue)}}(x)}),_.cancel}var s=t.window.requestAnimationFrame||t.window.webkitRequestAnimationFrame||t.window.mozRequestAnimationFrame||t.window.oRequestAnimationFrame||t.window.msRequestAnimationFrame||function(y){return t.window.setTimeout(y,1e3/60)},d=t.window.cancelAnimationFrame||t.window.clearTimeout;function v(){return s.apply(t.window,arguments)}function m(){return d.apply(t.window,arguments)}t.util.animate=f,t.util.requestAnimFrame=v,t.util.cancelAnimFrame=m,t.runningAnimations=u}(),function(){function o(u,h,c){var f="rgba("+parseInt(u[0]+c*(h[0]-u[0]),10)+","+parseInt(u[1]+c*(h[1]-u[1]),10)+","+parseInt(u[2]+c*(h[2]-u[2]),10);return f+=","+(u&&h?parseFloat(u[3]+c*(h[3]-u[3])):1),f+=")",f}function a(u,h,c,f){var s=new t.Color(u).getSource(),d=new t.Color(h).getSource(),v=f.onComplete,m=f.onChange;return f=f||{},t.util.animate(t.util.object.extend(f,{duration:c||500,startValue:s,endValue:d,byValue:d,easing:function(y,b,_,w){var S=f.colorEasing?f.colorEasing(y,w):1-Math.cos(y/w*(Math.PI/2));return o(b,_,S)},onComplete:function(y,b,_){if(v)return v(o(d,d,0),b,_)},onChange:function(y,b,_){if(m){if(Array.isArray(y))return m(o(y,y,0),b,_);m(y,b,_)}}}))}t.util.animateColor=a}(),function(){function o(I,z,M,L){return I-1&&ye>-1&&ye-1)&&(P="stroke")}else{if(V==="href"||V==="xlink:href"||V==="font")return P;if(V==="imageSmoothing")return P==="optimizeQuality";pe=ie?P.map(f):f(P,Z)}}return!ie&&isNaN(pe)?P:pe}function E(V){return new RegExp("^("+V.join("|")+")\\b","i")}function A(V){for(var P in _)if(!(typeof V[_[P]]>"u"||V[P]==="")){if(typeof V[P]>"u"){if(!a.Object.prototype[P])continue;V[P]=a.Object.prototype[P]}if(V[P].indexOf("url(")!==0){var q=new a.Color(V[P]);V[P]=q.setAlpha(c(q.getAlpha()*V[_[P]],2)).toRgba()}}return V}function D(V,P){var q,Z=[],ie,pe,ge;for(pe=0,ge=P.length;pe1;)ae.shift(),te=a.util.multiplyTransformMatrices(te,ae[0]);return te}}();function N(V,P){var q,Z;V.replace(/;\s*$/,"").split(";").forEach(function(ie){var pe=ie.split(":");q=pe[0].trim().toLowerCase(),Z=pe[1].trim(),P[q]=Z})}function R(V,P){var q,Z;for(var ie in V)typeof V[ie]>"u"||(q=ie.toLowerCase(),Z=V[ie],P[q]=Z)}function B(V,P){var q={};for(var Z in a.cssRules[P])if(O(V,Z.split(" ")))for(var ie in a.cssRules[P][Z])q[ie]=a.cssRules[P][Z][ie];return q}function O(V,P){var q,Z=!0;return q=ne(V,P.pop()),q&&P.length&&(Z=U(V,P)),q&&Z&&P.length===0}function U(V,P){for(var q,Z=!0;V.parentNode&&V.parentNode.nodeType===1&&P.length;)Z&&(q=P.pop()),V=V.parentNode,Z=ne(V,q);return P.length===0}function ne(V,P){var q=V.nodeName,Z=V.getAttribute("class"),ie=V.getAttribute("id"),pe,ge;if(pe=new RegExp("^"+q,"i"),P=P.replace(pe,""),ie&&P.length&&(pe=new RegExp("#"+ie+"(?![a-zA-Z\\-]+)","i"),P=P.replace(pe,"")),Z&&P.length)for(Z=Z.split(" "),ge=Z.length;ge--;)pe=new RegExp("\\."+Z[ge]+"(?![a-zA-Z\\-]+)","i"),P=P.replace(pe,"");return P.length===0}function Q(V,P){var q;if(V.getElementById&&(q=V.getElementById(P)),q)return q;var Z,ie,pe,ge=V.getElementsByTagName("*");for(ie=0,pe=ge.length;ieZ?Z:q),F.meetOrSlice==="slice"&&(Z=q=q>Z?q:Z),ae=G.width-ge*q,te=G.height-ye*q,F.alignX==="Mid"&&(ae/=2),F.alignY==="Mid"&&(te/=2),F.alignX==="Min"&&(ae=0),F.alignY==="Min"&&(te=0)),q===1&&Z===1&&ie===0&&pe===0&&W===0&&$===0)return G;if((W||$)&&V.parentNode.nodeName!=="#document"&&(me=" translate("+f(W)+" "+f($)+") "),H=me+" matrix("+q+" 0 0 "+Z+" "+(ie*q+ae)+" "+(pe*Z+te)+") ",V.nodeName==="svg"){for(Y=V.ownerDocument.createElementNS(a.svgNS,"g");V.firstChild;)Y.appendChild(V.firstChild);V.appendChild(Y)}else Y=V,Y.removeAttribute("x"),Y.removeAttribute("y"),H=Y.getAttribute("transform")+H;return Y.setAttribute("transform",H),G}function M(V,P){for(;V&&(V=V.parentNode);)if(V.nodeName&&P.test(V.nodeName.replace("svg:",""))&&!V.getAttribute("instantiated_by_use"))return!0;return!1}a.parseSVGDocument=function(V,P,q,Z){if(!!V){ue(V);var ie=a.Object.__uid++,pe,ge,ye=z(V),H=a.util.toArray(V.getElementsByTagName("*"));if(ye.crossOrigin=Z&&Z.crossOrigin,ye.svgUid=ie,H.length===0&&a.isLikelyNode){H=V.selectNodes('//*[name(.)!="svg"]');var Y=[];for(pe=0,ge=H.length;pe"u"&&(q=V.getAttribute("svgUid")),V.parentNode&&a.svgValidParentsRegEx.test(V.parentNode.nodeName)&&(ie=a.parseAttributes(V.parentNode,P,q));var ye=P.reduce(function(F,K){return Z=V.getAttribute(K),Z&&(F[K]=Z),F},{}),H=u(B(V,q),a.parseStyleAttribute(V));ye=u(ye,H),H[S]&&V.setAttribute(S,H[S]),pe=ge=ie.fontSize||a.Text.DEFAULT_SVG_FONT_SIZE,ye[w]&&(ye[w]=pe=f(ye[w],ge));var Y,k,X={};for(var W in ye)Y=x(W),k=T(Y,ye[W],ie,pe),X[Y]=k;X&&X.font&&a.parseFontDeclaration(X.font,X);var $=u(ie,X);return a.svgValidParentsRegEx.test(V.nodeName)?$:A($)}},parseElements:function(V,P,q,Z,ie){new a.ElementsParser(V,P,q,Z,ie).parse()},parseStyleAttribute:function(V){var P={},q=V.getAttribute("style");return q&&(typeof q=="string"?N(q,P):R(q,P)),P},parsePointsAttribute:function(V){if(!V)return null;V=V.replace(/,/g," ").trim(),V=V.split(/\s+/);var P=[],q,Z;for(q=0,Z=V.length;qh.x&&this.y>h.y},gte:function(h){return this.x>=h.x&&this.y>=h.y},lerp:function(h,c){return typeof c>"u"&&(c=.5),c=Math.max(Math.min(1,c),0),new u(this.x+(h.x-this.x)*c,this.y+(h.y-this.y)*c)},distanceFrom:function(h){var c=this.x-h.x,f=this.y-h.y;return Math.sqrt(c*c+f*f)},midPointFrom:function(h){return this.lerp(h)},min:function(h){return new u(Math.min(this.x,h.x),Math.min(this.y,h.y))},max:function(h){return new u(Math.max(this.x,h.x),Math.max(this.y,h.y))},toString:function(){return this.x+","+this.y},setXY:function(h,c){return this.x=h,this.y=c,this},setX:function(h){return this.x=h,this},setY:function(h){return this.y=h,this},setFromPoint:function(h){return this.x=h.x,this.y=h.y,this},swap:function(h){var c=this.x,f=this.y;this.x=h.x,this.y=h.y,h.x=c,h.y=f},clone:function(){return new u(this.x,this.y)}}}(e),function(o){var a=o.fabric||(o.fabric={});if(a.Intersection){a.warn("fabric.Intersection is already defined");return}function u(h){this.status=h,this.points=[]}a.Intersection=u,a.Intersection.prototype={constructor:u,appendPoint:function(h){return this.points.push(h),this},appendPoints:function(h){return this.points=this.points.concat(h),this}},a.Intersection.intersectLineLine=function(h,c,f,s){var d,v=(s.x-f.x)*(h.y-f.y)-(s.y-f.y)*(h.x-f.x),m=(c.x-h.x)*(h.y-f.y)-(c.y-h.y)*(h.x-f.x),y=(s.y-f.y)*(c.x-h.x)-(s.x-f.x)*(c.y-h.y);if(y!==0){var b=v/y,_=m/y;0<=b&&b<=1&&0<=_&&_<=1?(d=new u("Intersection"),d.appendPoint(new a.Point(h.x+b*(c.x-h.x),h.y+b*(c.y-h.y)))):d=new u}else v===0||m===0?d=new u("Coincident"):d=new u("Parallel");return d},a.Intersection.intersectLinePolygon=function(h,c,f){var s=new u,d=f.length,v,m,y,b;for(b=0;b0&&(s.status="Intersection"),s},a.Intersection.intersectPolygonPolygon=function(h,c){var f=new u,s=h.length,d;for(d=0;d0&&(f.status="Intersection"),f},a.Intersection.intersectPolygonRectangle=function(h,c,f){var s=c.min(f),d=c.max(f),v=new a.Point(d.x,s.y),m=new a.Point(s.x,d.y),y=u.intersectLinePolygon(s,v,h),b=u.intersectLinePolygon(v,d,h),_=u.intersectLinePolygon(d,m,h),w=u.intersectLinePolygon(m,s,h),S=new u;return S.appendPoints(y.points),S.appendPoints(b.points),S.appendPoints(_.points),S.appendPoints(w.points),S.points.length>0&&(S.status="Intersection"),S}}(e),function(o){var a=o.fabric||(o.fabric={});if(a.Color){a.warn("fabric.Color is already defined.");return}function u(c){c?this._tryParsingColor(c):this.setSource([0,0,0,1])}a.Color=u,a.Color.prototype={_tryParsingColor:function(c){var f;c in u.colorNameMap&&(c=u.colorNameMap[c]),c==="transparent"&&(f=[255,255,255,0]),f||(f=u.sourceFromHex(c)),f||(f=u.sourceFromRgb(c)),f||(f=u.sourceFromHsl(c)),f||(f=[0,0,0,1]),f&&this.setSource(f)},_rgbToHsl:function(c,f,s){c/=255,f/=255,s/=255;var d,v,m,y=a.util.array.max([c,f,s]),b=a.util.array.min([c,f,s]);if(m=(y+b)/2,y===b)d=v=0;else{var _=y-b;switch(v=m>.5?_/(2-y-b):_/(y+b),y){case c:d=(f-s)/_+(f1&&(s-=1),s<1/6?c+(f-c)*6*s:s<1/2?f:s<2/3?c+(f-c)*(2/3-s)*6:c}a.Color.fromRgb=function(c){return u.fromSource(u.sourceFromRgb(c))},a.Color.sourceFromRgb=function(c){var f=c.match(u.reRGBa);if(f){var s=parseInt(f[1],10)/(/%$/.test(f[1])?100:1)*(/%$/.test(f[1])?255:1),d=parseInt(f[2],10)/(/%$/.test(f[2])?100:1)*(/%$/.test(f[2])?255:1),v=parseInt(f[3],10)/(/%$/.test(f[3])?100:1)*(/%$/.test(f[3])?255:1);return[parseInt(s,10),parseInt(d,10),parseInt(v,10),f[4]?parseFloat(f[4]):1]}},a.Color.fromRgba=u.fromRgb,a.Color.fromHsl=function(c){return u.fromSource(u.sourceFromHsl(c))},a.Color.sourceFromHsl=function(c){var f=c.match(u.reHSLa);if(!!f){var s=(parseFloat(f[1])%360+360)%360/360,d=parseFloat(f[2])/(/%$/.test(f[2])?100:1),v=parseFloat(f[3])/(/%$/.test(f[3])?100:1),m,y,b;if(d===0)m=y=b=v;else{var _=v<=.5?v*(d+1):v+d-v*d,w=v*2-_;m=h(w,_,s+1/3),y=h(w,_,s),b=h(w,_,s-1/3)}return[Math.round(m*255),Math.round(y*255),Math.round(b*255),f[4]?parseFloat(f[4]):1]}},a.Color.fromHsla=u.fromHsl,a.Color.fromHex=function(c){return u.fromSource(u.sourceFromHex(c))},a.Color.sourceFromHex=function(c){if(c.match(u.reHex)){var f=c.slice(c.indexOf("#")+1),s=f.length===3||f.length===4,d=f.length===8||f.length===4,v=s?f.charAt(0)+f.charAt(0):f.substring(0,2),m=s?f.charAt(1)+f.charAt(1):f.substring(2,4),y=s?f.charAt(2)+f.charAt(2):f.substring(4,6),b=d?s?f.charAt(3)+f.charAt(3):f.substring(6,8):"FF";return[parseInt(v,16),parseInt(m,16),parseInt(y,16),parseFloat((parseInt(b,16)/255).toFixed(2))]}},a.Color.fromSource=function(c){var f=new u;return f.setSource(c),f}}(e),function(o){var a=o.fabric||(o.fabric={}),u=["e","se","s","sw","w","nw","n","ne","e"],h=["ns","nesw","ew","nwse"],c={},f="left",s="top",d="right",v="bottom",m="center",y={top:v,bottom:s,left:d,right:f,center:m},b=a.util.radiansToDegrees,_=Math.sign||function(Y){return(Y>0)-(Y<0)||+Y};function w(Y,k){var X=Y.angle+b(Math.atan2(k.y,k.x))+360;return Math.round(X%360/45)}function S(Y,k){var X=k.transform.target,W=X.canvas,$=a.util.object.clone(k);$.target=X,W&&W.fire("object:"+Y,$),X.fire(Y,k)}function x(Y,k){var X=k.canvas,W=X.uniScaleKey,$=Y[W];return X.uniformScaling&&!$||!X.uniformScaling&&$}function T(Y){return Y.originX===m&&Y.originY===m}function E(Y,k,X){var W=Y.lockScalingX,$=Y.lockScalingY;return!!(W&&$||!k&&(W||$)&&X||W&&k==="x"||$&&k==="y")}function A(Y,k,X){var W="not-allowed",$=x(Y,X),F="";if(k.x!==0&&k.y===0?F="x":k.x===0&&k.y!==0&&(F="y"),E(X,F,$))return W;var K=w(X,k);return u[K]+"-resize"}function D(Y,k,X){var W="not-allowed";if(k.x!==0&&X.lockSkewingY||k.y!==0&&X.lockSkewingX)return W;var $=w(X,k)%4;return h[$]+"-resize"}function N(Y,k,X){return Y[X.canvas.altActionKey]?c.skewCursorStyleHandler(Y,k,X):c.scaleCursorStyleHandler(Y,k,X)}function R(Y,k,X){var W=Y[X.canvas.altActionKey];if(k.x===0)return W?"skewX":"scaleY";if(k.y===0)return W?"skewY":"scaleX"}function B(Y,k,X){return X.lockRotation?"not-allowed":k.cursorStyle}function O(Y,k,X,W){return{e:Y,transform:k,pointer:{x:X,y:W}}}function U(Y){return function(k,X,W,$){var F=X.target,K=F.getCenterPoint(),de=F.translateToOriginPoint(K,X.originX,X.originY),se=Y(k,X,W,$);return F.setPositionByOrigin(de,X.originX,X.originY),se}}function ne(Y,k){return function(X,W,$,F){var K=k(X,W,$,F);return K&&S(Y,O(X,W,$,F)),K}}function Q(Y,k,X,W,$){var F=Y.target,K=F.controls[Y.corner],de=F.canvas.getZoom(),se=F.padding/de,G=F.toLocalPoint(new a.Point(W,$),k,X);return G.x>=se&&(G.x-=se),G.x<=-se&&(G.x+=se),G.y>=se&&(G.y-=se),G.y<=se&&(G.y+=se),G.x-=K.offsetX,G.y-=K.offsetY,G}function ue(Y){return Y.flipX!==Y.flipY}function I(Y,k,X,W,$){if(Y[k]!==0){var F=Y._getTransformedDimensions()[W],K=$/F*Y[X];Y.set(X,K)}}function z(Y,k,X,W){var $=k.target,F=$._getTransformedDimensions(0,$.skewY),K=Q(k,k.originX,k.originY,X,W),de=Math.abs(K.x*2)-F.x,se=$.skewX,G;de<2?G=0:(G=b(Math.atan2(de/$.scaleX,F.y/$.scaleY)),k.originX===f&&k.originY===v&&(G=-G),k.originX===d&&k.originY===s&&(G=-G),ue($)&&(G=-G));var me=se!==G;if(me){var ae=$._getTransformedDimensions().y;$.set("skewX",G),I($,"skewY","scaleY","y",ae)}return me}function M(Y,k,X,W){var $=k.target,F=$._getTransformedDimensions($.skewX,0),K=Q(k,k.originX,k.originY,X,W),de=Math.abs(K.y*2)-F.y,se=$.skewY,G;de<2?G=0:(G=b(Math.atan2(de/$.scaleY,F.x/$.scaleX)),k.originX===f&&k.originY===v&&(G=-G),k.originX===d&&k.originY===s&&(G=-G),ue($)&&(G=-G));var me=se!==G;if(me){var ae=$._getTransformedDimensions().x;$.set("skewY",G),I($,"skewX","scaleX","x",ae)}return me}function L(Y,k,X,W){var $=k.target,F=$.skewX,K,de=k.originY;if($.lockSkewingX)return!1;if(F===0){var se=Q(k,m,m,X,W);se.x>0?K=f:K=d}else F>0&&(K=de===s?f:d),F<0&&(K=de===s?d:f),ue($)&&(K=K===f?d:f);k.originX=K;var G=ne("skewing",U(z));return G(Y,k,X,W)}function J(Y,k,X,W){var $=k.target,F=$.skewY,K,de=k.originX;if($.lockSkewingY)return!1;if(F===0){var se=Q(k,m,m,X,W);se.y>0?K=s:K=v}else F>0&&(K=de===f?s:v),F<0&&(K=de===f?v:s),ue($)&&(K=K===s?v:s);k.originY=K;var G=ne("skewing",U(M));return G(Y,k,X,W)}function V(Y,k,X,W){var $=k,F=$.target,K=F.translateToOriginPoint(F.getCenterPoint(),$.originX,$.originY);if(F.lockRotation)return!1;var de=Math.atan2($.ey-K.y,$.ex-K.x),se=Math.atan2(W-K.y,X-K.x),G=b(se-de+$.theta),me=!0;if(F.snapAngle>0){var ae=F.snapAngle,te=F.snapThreshold||ae,be=Math.ceil(G/ae)*ae,Ce=Math.floor(G/ae)*ae;Math.abs(G-Ce)_?(A=b,s.scale(1,_/b),E=v*b/_):_>b?(A=_,s.scale(b/_,1),T=d*_/b):A=b,s.lineWidth=1,s.beginPath(),s.arc(T,E,A/2,0,2*Math.PI,!1),s[S](),x&&s.stroke(),s.restore()}function f(s,d,v,m,y){m=m||{};var b=this.sizeX||m.cornerSize||y.cornerSize,_=this.sizeY||m.cornerSize||y.cornerSize,w=typeof m.transparentCorners<"u"?m.transparentCorners:y.transparentCorners,S=w?"stroke":"fill",x=!w&&(m.cornerStrokeColor||y.cornerStrokeColor),T=b/2,E=_/2;s.save(),s.fillStyle=m.cornerColor||y.cornerColor,s.strokeStyle=m.cornerStrokeColor||y.cornerStrokeColor,s.lineWidth=1,s.translate(d,v),s.rotate(u(y.angle)),s[S+"Rect"](-T,-E,b,_),x&&s.strokeRect(-T,-E,b,_),s.restore()}h.renderCircleControl=c,h.renderSquareControl=f}(e),function(o){var a=o.fabric||(o.fabric={});function u(h){for(var c in h)this[c]=h[c]}a.Control=u,a.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(h,c){return c.cursorStyle},getActionName:function(h,c){return c.actionName},getVisibility:function(h,c){var f=h._controlsVisibility;return f&&typeof f[c]<"u"?f[c]:this.visible},setVisibility:function(h){this.visible=h},positionHandler:function(h,c){var f=a.util.transformPoint({x:this.x*h.x+this.offsetX,y:this.y*h.y+this.offsetY},c);return f},calcCornerCoords:function(h,c,f,s,d){var v,m,y,b,_=d?this.touchSizeX:this.sizeX,w=d?this.touchSizeY:this.sizeY;if(_&&w&&_!==w){var S=Math.atan2(w,_),x=Math.sqrt(_*_+w*w)/2,T=S-a.util.degreesToRadians(h),E=Math.PI/2-S-a.util.degreesToRadians(h);v=x*a.util.cos(T),m=x*a.util.sin(T),y=x*a.util.cos(E),b=x*a.util.sin(E)}else{var A=_&&w?_:c;x=A*.7071067812;var T=a.util.degreesToRadians(45-h);v=y=x*a.util.cos(T),m=b=x*a.util.sin(T)}return{tl:{x:f-b,y:s-y},tr:{x:f+v,y:s-m},bl:{x:f-v,y:s+m},br:{x:f+b,y:s+y}}},render:function(h,c,f,s,d){switch(s=s||{},s.cornerStyle||d.cornerStyle){case"circle":a.controlsUtils.renderCircleControl.call(this,h,c,f,s,d);break;default:a.controlsUtils.renderSquareControl.call(this,h,c,f,s,d)}}}}(e),function(){function o(f,s){var d=f.getAttribute("style"),v=f.getAttribute("offset")||0,m,y,b,_;if(v=parseFloat(v)/(/%$/.test(v)?100:1),v=v<0?0:v>1?1:v,d){var w=d.split(/\s*;\s*/);for(w[w.length-1]===""&&w.pop(),_=w.length;_--;){var S=w[_].split(/\s*:\s*/),x=S[0].trim(),T=S[1].trim();x==="stop-color"?m=T:x==="stop-opacity"&&(b=T)}}return m||(m=f.getAttribute("stop-color")||"rgb(0,0,0)"),b||(b=f.getAttribute("stop-opacity")),m=new t.Color(m),y=m.getAlpha(),b=isNaN(parseFloat(b))?1:parseFloat(b),b*=y*s,{offset:v,color:m.toRgb(),opacity:b}}function a(f){return{x1:f.getAttribute("x1")||0,y1:f.getAttribute("y1")||0,x2:f.getAttribute("x2")||"100%",y2:f.getAttribute("y2")||0}}function u(f){return{x1:f.getAttribute("fx")||f.getAttribute("cx")||"50%",y1:f.getAttribute("fy")||f.getAttribute("cy")||"50%",r1:0,x2:f.getAttribute("cx")||"50%",y2:f.getAttribute("cy")||"50%",r2:f.getAttribute("r")||"50%"}}var h=t.util.object.clone;t.Gradient=t.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(f){f||(f={}),f.coords||(f.coords={});var s,d=this;Object.keys(f).forEach(function(v){d[v]=f[v]}),this.id?this.id+="_"+t.Object.__uid++:this.id=t.Object.__uid++,s={x1:f.coords.x1||0,y1:f.coords.y1||0,x2:f.coords.x2||0,y2:f.coords.y2||0},this.type==="radial"&&(s.r1=f.coords.r1||0,s.r2=f.coords.r2||0),this.coords=s,this.colorStops=f.colorStops.slice()},addColorStop:function(f){for(var s in f){var d=new t.Color(f[s]);this.colorStops.push({offset:parseFloat(s),color:d.toRgb(),opacity:d.getAlpha()})}return this},toObject:function(f){var s={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return t.util.populateWithProperties(this,s,f),s},toSVG:function(f,y){var d=h(this.coords,!0),v,m,y=y||{},b,_,w=h(this.colorStops,!0),S=d.r1>d.r2,x=this.gradientTransform?this.gradientTransform.concat():t.iMatrix.concat(),T=-this.offsetX,E=-this.offsetY,A=!!y.additionalTransform,D=this.gradientUnits==="pixels"?"userSpaceOnUse":"objectBoundingBox";if(w.sort(function(U,ne){return U.offset-ne.offset}),D==="objectBoundingBox"?(T/=f.width,E/=f.height):(T+=f.width/2,E+=f.height/2),f.type==="path"&&this.gradientUnits!=="percentage"&&(T-=f.pathOffset.x,E-=f.pathOffset.y),x[4]-=T,x[5]-=E,_='id="SVGID_'+this.id+'" gradientUnits="'+D+'"',_+=' gradientTransform="'+(A?y.additionalTransform+" ":"")+t.util.matrixToSVG(x)+'" ',this.type==="linear"?b=[" `]:this.type==="radial"&&(b=["