From 798473d86770708c7d730bd61dfefcf2f39246ec Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Thu, 11 Dec 2025 11:43:40 +0800 Subject: [PATCH] updated sdui, fixed image import --- embd_res/kcpp_sdui.embd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embd_res/kcpp_sdui.embd b/embd_res/kcpp_sdui.embd index 3f26518dc..2e0880247 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 m(u,h){if(!i[u]){if(!r[u]){var c=typeof Jl=="function"&&Jl;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 m(v||d)},s,s.exports,n,r,i,l)}return i[u].exports}for(var o=typeof Jl=="function"&&Jl,a=0;a>2,s=(3&u)<<4|h>>4,d=1<_?(15&h)<<2|c>>6:64,v=2<_?63&c:64,g.push(o.charAt(f)+o.charAt(s)+o.charAt(d)+o.charAt(v));return g.join("")},i.decode=function(a){var u,h,c,f,s,d,v=0,g=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=m.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[g++]=u,s!==64&&(b[g++]=h),d!==64&&(b[g++]=c);return b}},{"./support":30,"./utils":32}],2:[function(n,r,i){var l=n("./external"),m=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 m(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 m(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"),m=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=m,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=m,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",m=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 m[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,g="";for(v=0;v>>=8;return g}function m(s,d,v,g,y,b){var _,w,S=s.file,x=s.compression,T=b!==u.utf8encode,O=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,E=R.length!==D.length,U="",ne="",ee="",se=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&&!E||(M|=2048);var L=0,Q=0;se&&(L|=16),y==="UNIX"?(Q=798,L|=function(P,q){var Z=P;return P||(Z=q?16893:33204),(65535&Z)<<16}(S.unixPermissions,se)):(Q=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(O),4)+A,U+="up"+l(ne.length,2)+ne),E&&(ee=l(1,1)+l(h(N),4)+R,U+="uc"+l(ee.length,2)+ee);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(O.length,2),V+=l(U.length,2),{fileRecord:c.LOCAL_FILE_HEADER+V+O+U,dirRecord:c.CENTRAL_FILE_HEADER+l(Q,2)+V+l(N.length,2)+"\0\0\0\0"+l(L,4)+l(g,4)+O+U+N}}var o=n("../utils"),a=n("../stream/GenericWorker"),u=n("../utf8"),h=n("../crc32"),c=n("../signature");function f(s,d,v,g){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=v,this.encodeFileName=g,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,g=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-g-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=m(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=m(s,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),d)this.push({data:function(g){return c.DATA_DESCRIPTOR+l(g.crc32,4)+l(g.compressedSize,4)+l(g.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=m},{"../utils":32}],19:[function(n,r,i){var l=n("./Uint8ArrayReader");function m(o){l.call(this,o)}n("../utils").inherits(m,l),m.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=m},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var l=n("./DataReader");function m(o){l.call(this,o)}n("../utils").inherits(m,l),m.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},m.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},m.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},m.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=m},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var l=n("./ArrayReader");function m(o){l.call(this,o)}n("../utils").inherits(m,l),m.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=m},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var l=n("../utils"),m=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"||m.uint8array?f==="nodebuffer"?new u(c):m.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"),m=n("../utils");function o(a){l.call(this,"ConvertWorker to "+a),this.destType=a}m.inherits(o,l),o.prototype.processChunk=function(a){this.push({data:m.transformTo(this.destType,a.data),meta:a.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var l=n("./GenericWorker"),m=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=m(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"),m=n("./GenericWorker");function o(a){m.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}l.inherits(o,m),o.prototype.processChunk=function(a){if(a){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+a.data.length}m.prototype.processChunk.call(this,a)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var l=n("../utils"),m=n("./GenericWorker");function o(a){m.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,m),o.prototype.cleanUp=function(){m.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!m.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(m){this.name=m||"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(m){this.emit("data",m)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(m){this.emit("error",m)}return!0},error:function(m){return!this.isFinished&&(this.isPaused?this.generatedError=m:(this.isFinished=!0,this.emit("error",m),this.previous&&this.previous.error(m),this.cleanUp()),!0)},on:function(m,o){return this._listeners[m].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(m,o){if(this._listeners[m])for(var a=0;a "+m:m}},r.exports=l},{}],29:[function(n,r,i){var l=n("../utils"),m=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(g,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,O,A){switch(T){case"blob":return l.newBlob(l.transformTo("arraybuffer",O),A);case"base64":return a.encode(O);default:return l.transformTo(T,O)}}(w,function(T,O){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 m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);m.append(l),i.blob=m.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"),m=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 m.nodebuffer?o.newBufferFrom(s,"utf-8"):function(d){var v,g,y,b,_,w=d.length,S=0;for(b=0;b>>6:(g<65536?v[_++]=224|g>>>12:(v[_++]=240|g>>>18,v[_++]=128|g>>>12&63),v[_++]=128|g>>>6&63),v[_++]=128|63&g);return v}(s)},i.utf8decode=function(s){return m.nodebuffer?l.transformTo("nodebuffer",s).toString("utf-8"):function(d){var v,g,y,b,_=d.length,w=new Array(2*_);for(v=g=0;v<_;)if((y=d[v++])<128)w[g++]=y;else if(4<(b=u[y]))w[g++]=65533,v+=b-1;else{for(y&=b===2?31:b===3?15:7;1>10&1023,w[g++]=56320|1023&y)}return w.length!==g&&(w.subarray?w=w.subarray(0,g):w.length=g),l.applyFromCharCode(w)}(s=l.transformTo(m.uint8array?"uint8array":"array",s))},l.inherits(c,a),c.prototype.processChunk=function(s){var d=l.transformTo(m.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(m.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 g=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;g!==d.length&&(m.uint8array?(y=d.subarray(0,g),this.leftOver=d.subarray(g,d.length)):(y=d.slice(0,g),this.leftOver=d.slice(g,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"),m=n("./base64"),o=n("./nodejsUtils"),a=n("./external");function u(v){return v}function h(v,g){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===m.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===m.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===m.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===m.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var d,v,g,y=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4>>6:(s<65536?f[g++]=224|s>>>12:(f[g++]=240|s>>>18,f[g++]=128|s>>>12&63),f[g++]=128|s>>>6&63),f[g++]=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,m,o,a){for(var u=65535&l|0,h=l>>>16&65535|0,c=0;o!==0;){for(o-=c=2e3>>1:m>>>1;o[a]=m}return o}();r.exports=function(m,o,a,u){var h=l,c=u+a;m^=-1;for(var f=u;f>>8^h[255&(m^o[f])];return-1^m}},{}],46:[function(n,r,i){var l,m=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,g=4,y=2,b=8,_=9,w=286,S=30,x=19,T=2*w+1,O=15,A=3,D=258,N=D+A+1,R=42,B=113,E=1,U=2,ne=3,ee=4;function se(k,X){return k.msg=h[X],X}function I(k){return(k<<1)-(4k.avail_out&&(W=k.avail_out),W!==0&&(m.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 Q(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,G=k.strstart,de=k.prev_length,ae=k.nice_match,J=k.strstart>k.w_size-N?k.strstart-(k.w_size-N):0,ge=k.window,K=k.w_mask,ce=k.prev,be=k.strstart+D,Ce=ge[G+de-1],Te=ge[G+de];k.prev_length>=k.good_match&&(F>>=2),ae>k.lookahead&&(ae=k.lookahead);do if(ge[(W=X)+de]===Te&&ge[W+de-1]===Ce&&ge[W]===ge[G]&&ge[++W]===ge[G+1]){G+=2,W++;do;while(ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&ge[++G]===ge[++W]&&GJ&&--F!=0);return de<=k.lookahead?de:k.lookahead}function q(k){var X,W,$,F,G,de,ae,J,ge,K,ce=k.w_size;do{if(F=k.window_size-k.lookahead-k.strstart,k.strstart>=ce+(ce-N)){for(m.arraySet(k.window,k.window,ce,ce,0),k.match_start-=ce,k.strstart-=ce,k.block_start-=ce,X=W=k.hash_size;$=k.head[--X],k.head[X]=ce<=$?$-ce:0,--W;);for(X=W=ce;$=k.prev[--X],k.prev[X]=ce<=$?$-ce:0,--W;);F+=ce}if(k.strm.avail_in===0)break;if(de=k.strm,ae=k.window,J=k.strstart+k.lookahead,ge=F,K=void 0,K=de.avail_in,ge=A)for(G=k.strstart-k.insert,k.ins_h=k.window[G],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 E;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 E}return k.insert=0,X===f?(L(k,!0),k.strm.avail_out===0?ne:ee):(k.strstart>k.block_start&&(L(k,!1),k.strm.avail_out),E)}),new he(4,4,8,4,Z),new he(4,5,16,8,Z),new he(4,6,32,32,Z),new he(4,4,16,16,ie),new he(8,16,32,32,ie),new he(8,16,128,128,ie),new he(8,32,128,256,ie),new he(32,128,258,1024,ie),new he(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=ve,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,G;if(!k||!k.state||5>8&255),Q($,$.gzhead.time>>16&255),Q($,$.gzhead.time>>24&255),Q($,$.level===9?2:2<=$.strategy||$.level<2?4:0),Q($,255&$.gzhead.os),$.gzhead.extra&&$.gzhead.extra.length&&(Q($,255&$.gzhead.extra.length),Q($,$.gzhead.extra.length>>8&255)),$.gzhead.hcrc&&(k.adler=u(k.adler,$.pending_buf,$.pending,0)),$.gzindex=0,$.status=69):(Q($,0),Q($,0),Q($,0),Q($,0),Q($,0),Q($,$.level===9?2:2<=$.strategy||$.level<2?4:0),Q($,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));)Q($,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)){G=1;break}G=$.gzindex<$.gzhead.name.length?255&$.gzhead.name.charCodeAt($.gzindex++):0,Q($,G)}while(G!==0);$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),G===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)){G=1;break}G=$.gzindex<$.gzhead.comment.length?255&$.gzhead.comment.charCodeAt($.gzindex++):0,Q($,G)}while(G!==0);$.gzhead.hcrc&&$.pending>F&&(k.adler=u(k.adler,$.pending_buf,$.pending-F,F)),G===0&&($.status=103)}else $.status=103;if($.status===103&&($.gzhead.hcrc?($.pending+2>$.pending_buf_size&&M(k),$.pending+2<=$.pending_buf_size&&(Q($,255&k.adler),Q($,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 se(k,-5);if($.status===666&&k.avail_in!==0)return se(k,-5);if(k.avail_in!==0||$.lookahead!==0||X!==c&&$.status!==666){var ae=$.strategy===2?function(J,ge){for(var K;;){if(J.lookahead===0&&(q(J),J.lookahead===0)){if(ge===c)return E;break}if(J.match_length=0,K=o._tr_tally(J,0,J.window[J.strstart]),J.lookahead--,J.strstart++,K&&(L(J,!1),J.strm.avail_out===0))return E}return J.insert=0,ge===f?(L(J,!0),J.strm.avail_out===0?ne:ee):J.last_lit&&(L(J,!1),J.strm.avail_out===0)?E:U}($,X):$.strategy===3?function(J,ge){for(var K,ce,be,Ce,Te=J.window;;){if(J.lookahead<=D){if(q(J),J.lookahead<=D&&ge===c)return E;if(J.lookahead===0)break}if(J.match_length=0,J.lookahead>=A&&0J.lookahead&&(J.match_length=J.lookahead)}if(J.match_length>=A?(K=o._tr_tally(J,1,J.match_length-A),J.lookahead-=J.match_length,J.strstart+=J.match_length,J.match_length=0):(K=o._tr_tally(J,0,J.window[J.strstart]),J.lookahead--,J.strstart++),K&&(L(J,!1),J.strm.avail_out===0))return E}return J.insert=0,ge===f?(L(J,!0),J.strm.avail_out===0?ne:ee):J.last_lit&&(L(J,!1),J.strm.avail_out===0)?E:U}($,X):l[$.level].func($,X);if(ae!==ne&&ae!==ee||($.status=666),ae===E||ae===ne)return k.avail_out===0&&($.last_flush=-1),s;if(ae===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?(Q($,255&k.adler),Q($,k.adler>>8&255),Q($,k.adler>>16&255),Q($,k.adler>>24&255),Q($,255&k.total_in),Q($,k.total_in>>8&255),Q($,k.total_in>>16&255),Q($,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?se(k,d):(k.state=null,X===B?se(k,-3):s):d},i.deflateSetDictionary=function(k,X){var W,$,F,G,de,ae,J,ge,K=X.length;if(!k||!k.state||(G=(W=k.state).wrap)===2||G===1&&W.status!==R||W.lookahead)return d;for(G===1&&(k.adler=a(k.adler,X,K,0)),W.wrap=0,K>=W.w_size&&(G===0&&(z(W.head),W.strstart=0,W.block_start=0,W.insert=0),ge=new m.Buf8(W.w_size),m.arraySet(ge,X,K-W.w_size,W.w_size,0),X=ge,K=W.w_size),de=k.avail_in,ae=k.next_in,J=k.input,k.avail_in=K,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=O>>>24,_-=A,(A=O>>>16&255)===0)U[h++]=65535&O;else{if(!(16&A)){if((64&A)==0){O=w[(65535&O)+(b&(1<>>=A,_-=A),_<15&&(b+=E[a++]<<_,_+=8,b+=E[a++]<<_,_+=8),O=S[b&T];n:for(;;){if(b>>>=A=O>>>24,_-=A,!(16&(A=O>>>16&255))){if((64&A)==0){O=S[(65535&O)+(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(g),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 E,U;return R&&R.state?(U=R.state,B<0?(E=0,B=-B):(E=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=ee.wsize?(l.arraySet(ee.window,B,E-ee.wsize,ee.wsize,0),ee.wnext=0,ee.whave=ee.wsize):(U<(ne=ee.wsize-ee.wnext)&&(ne=U),l.arraySet(ee.window,B,E-U,ne,ee.wnext),(U-=ne)?(l.arraySet(ee.window,B,E-U,U,0),ee.wnext=U,ee.whave=ee.wsize):(ee.wnext+=ne,ee.wnext===ee.wsize&&(ee.wnext=0),ee.whave>>8&255,E.check=o(E.check,G,2,0),L=M=0,E.mode=2;break}if(E.flags=0,E.head&&(E.head.done=!1),!(1&E.wrap)||(((255&M)<<8)+(M>>8))%31){R.msg="incorrect header check",E.mode=30;break}if((15&M)!=8){R.msg="unknown compression method",E.mode=30;break}if(L-=4,k=8+(15&(M>>>=4)),E.wbits===0)E.wbits=k;else if(k>E.wbits){R.msg="invalid window size",E.mode=30;break}E.dmax=1<>8&1),512&E.flags&&(G[0]=255&M,G[1]=M>>>8&255,E.check=o(E.check,G,2,0)),L=M=0,E.mode=3;case 3:for(;L<32;){if(I===0)break e;I--,M+=U[ee++]<>>8&255,G[2]=M>>>16&255,G[3]=M>>>24&255,E.check=o(E.check,G,4,0)),L=M=0,E.mode=4;case 4:for(;L<16;){if(I===0)break e;I--,M+=U[ee++]<>8),512&E.flags&&(G[0]=255&M,G[1]=M>>>8&255,E.check=o(E.check,G,2,0)),L=M=0,E.mode=5;case 5:if(1024&E.flags){for(;L<16;){if(I===0)break e;I--,M+=U[ee++]<>>8&255,E.check=o(E.check,G,2,0)),L=M=0}else E.head&&(E.head.extra=null);E.mode=6;case 6:if(1024&E.flags&&(I<(P=E.length)&&(P=I),P&&(E.head&&(k=E.head.extra_len-E.length,E.head.extra||(E.head.extra=new Array(E.head.extra_len)),l.arraySet(E.head.extra,U,ee,P,k)),512&E.flags&&(E.check=o(E.check,U,P,ee)),I-=P,ee+=P,E.length-=P),E.length))break e;E.length=0,E.mode=7;case 7:if(2048&E.flags){if(I===0)break e;for(P=0;k=U[ee+P++],E.head&&k&&E.length<65536&&(E.head.name+=String.fromCharCode(k)),k&&P>9&1,E.head.done=!0),R.adler=E.check=0,E.mode=12;break;case 10:for(;L<32;){if(I===0)break e;I--,M+=U[ee++]<>>=7&L,L-=7&L,E.mode=27;break}for(;L<3;){if(I===0)break e;I--,M+=U[ee++]<>>=1)){case 0:E.mode=14;break;case 1:if(D(E),E.mode=20,B!==6)break;M>>>=2,L-=2;break e;case 2:E.mode=17;break;case 3:R.msg="invalid block type",E.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[ee++]<>>16^65535)){R.msg="invalid stored block lengths",E.mode=30;break}if(E.length=65535&M,L=M=0,E.mode=15,B===6)break e;case 15:E.mode=16;case 16:if(P=E.length){if(I>>=5,L-=5,E.ndist=1+(31&M),M>>>=5,L-=5,E.ncode=4+(15&M),M>>>=4,L-=4,286>>=3,L-=3}for(;E.have<19;)E.lens[de[E.have++]]=0;if(E.lencode=E.lendyn,E.lenbits=7,W={bits:E.lenbits},X=u(0,E.lens,0,19,E.lencode,0,E.work,W),E.lenbits=W.bits,X){R.msg="invalid code lengths set",E.mode=30;break}E.have=0,E.mode=19;case 19:for(;E.have>>16&255,me=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[ee++]<>>=ie,L-=ie,E.lens[E.have++]=me;else{if(me===16){for($=ie+2;L<$;){if(I===0)break e;I--,M+=U[ee++]<>>=ie,L-=ie,E.have===0){R.msg="invalid bit length repeat",E.mode=30;break}k=E.lens[E.have-1],P=3+(3&M),M>>>=2,L-=2}else if(me===17){for($=ie+3;L<$;){if(I===0)break e;I--,M+=U[ee++]<>>=ie)),M>>>=3,L-=3}else{for($=ie+7;L<$;){if(I===0)break e;I--,M+=U[ee++]<>>=ie)),M>>>=7,L-=7}if(E.have+P>E.nlen+E.ndist){R.msg="invalid bit length repeat",E.mode=30;break}for(;P--;)E.lens[E.have++]=k}}if(E.mode===30)break;if(E.lens[256]===0){R.msg="invalid code -- missing end-of-block",E.mode=30;break}if(E.lenbits=9,W={bits:E.lenbits},X=u(h,E.lens,0,E.nlen,E.lencode,0,E.work,W),E.lenbits=W.bits,X){R.msg="invalid literal/lengths set",E.mode=30;break}if(E.distbits=6,E.distcode=E.distdyn,W={bits:E.distbits},X=u(c,E.lens,E.nlen,E.ndist,E.distcode,0,E.work,W),E.distbits=W.bits,X){R.msg="invalid distances set",E.mode=30;break}if(E.mode=20,B===6)break e;case 20:E.mode=21;case 21:if(6<=I&&258<=z){R.next_out=se,R.avail_out=z,R.next_in=ee,R.avail_in=I,E.hold=M,E.bits=L,a(R,V),se=R.next_out,ne=R.output,z=R.avail_out,ee=R.next_in,U=R.input,I=R.avail_in,M=E.hold,L=E.bits,E.mode===12&&(E.back=-1);break}for(E.back=0;he=(F=E.lencode[M&(1<>>16&255,me=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[ee++]<>ve)])>>>16&255,me=65535&F,!(ve+(ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[ee++]<>>=ve,L-=ve,E.back+=ve}if(M>>>=ie,L-=ie,E.back+=ie,E.length=me,he===0){E.mode=26;break}if(32&he){E.back=-1,E.mode=12;break}if(64&he){R.msg="invalid literal/length code",E.mode=30;break}E.extra=15&he,E.mode=22;case 22:if(E.extra){for($=E.extra;L<$;){if(I===0)break e;I--,M+=U[ee++]<>>=E.extra,L-=E.extra,E.back+=E.extra}E.was=E.length,E.mode=23;case 23:for(;he=(F=E.distcode[M&(1<>>16&255,me=65535&F,!((ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[ee++]<>ve)])>>>16&255,me=65535&F,!(ve+(ie=F>>>24)<=L);){if(I===0)break e;I--,M+=U[ee++]<>>=ve,L-=ve,E.back+=ve}if(M>>>=ie,L-=ie,E.back+=ie,64&he){R.msg="invalid distance code",E.mode=30;break}E.offset=me,E.extra=15&he,E.mode=24;case 24:if(E.extra){for($=E.extra;L<$;){if(I===0)break e;I--,M+=U[ee++]<>>=E.extra,L-=E.extra,E.back+=E.extra}if(E.offset>E.dmax){R.msg="invalid distance too far back",E.mode=30;break}E.mode=25;case 25:if(z===0)break e;if(P=V-z,E.offset>P){if((P=E.offset-P)>E.whave&&E.sane){R.msg="invalid distance too far back",E.mode=30;break}q=P>E.wnext?(P-=E.wnext,E.wsize-P):E.wnext-P,P>E.length&&(P=E.length),Z=E.window}else Z=ne,q=se-E.offset,P=E.length;for(zT?(A=q[Z+g[B]],L[Q+g[B]]):(A=96,0),b=1<>se)+(_-=b)]=O<<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+g[B]]}if(ne>>7)]}function Q(F,G){F.pending_buf[F.pending++]=255&G,F.pending_buf[F.pending++]=G>>>8&255}function V(F,G,de){F.bi_valid>y-de?(F.bi_buf|=G<>y-F.bi_valid,F.bi_valid+=de-y):(F.bi_buf|=G<>>=1,de<<=1,0<--G;);return de>>>1}function Z(F,G,de){var ae,J,ge=new Array(g+1),K=0;for(ae=1;ae<=g;ae++)ge[ae]=K=K+de[ae-1]<<1;for(J=0;J<=G;J++){var ce=F[2*J+1];ce!==0&&(F[2*J]=q(ge[ce]++,ce))}}function ie(F){var G;for(G=0;G>1;1<=de;de--)ve(F,ge,de);for(J=be;de=F.heap[1],F.heap[1]=F.heap[F.heap_len--],ve(F,ge,1),ae=F.heap[1],F.heap[--F.heap_max]=de,F.heap[--F.heap_max]=ae,ge[2*J]=ge[2*de]+ge[2*ae],F.depth[J]=(F.depth[de]>=F.depth[ae]?F.depth[de]:F.depth[ae])+1,ge[2*de+1]=ge[2*ae+1]=J,F.heap[1]=J++,ve(F,ge,1),2<=F.heap_len;);F.heap[--F.heap_max]=F.heap[1],function(Te,Ae){var ye,Se,Me,Re,dt,ht,ot=Ae.dyn_tree,Kt=Ae.max_code,Jt=Ae.stat_desc.static_tree,Ct=Ae.stat_desc.has_stree,Ft=Ae.stat_desc.extra_bits,Qt=Ae.stat_desc.extra_base,gn=Ae.stat_desc.max_length,Bn=0;for(Re=0;Re<=g;Re++)Te.bl_count[Re]=0;for(ot[2*Te.heap[Te.heap_max]+1]=0,ye=Te.heap_max+1;ye>=7;J>>=1)if(1&Ce&&ce.dyn_ltree[2*be]!==0)return m;if(ce.dyn_ltree[18]!==0||ce.dyn_ltree[20]!==0||ce.dyn_ltree[26]!==0)return o;for(be=32;be>>3,(ge=F.static_len+3+7>>>3)<=J&&(J=ge)):J=ge=de+5,de+4<=J&&G!==-1?$(F,G,de,ae):F.strategy===4||ge===J?(V(F,2+(ae?1:0),3),H(F,N,R)):(V(F,4+(ae?1:0),3),function(ce,be,Ce,Te){var Ae;for(V(ce,be-257,5),V(ce,Ce-1,5),V(ce,Te-4,4),Ae=0;Ae>>8&255,F.pending_buf[F.d_buf+2*F.last_lit+1]=255&G,F.pending_buf[F.l_buf+F.last_lit]=255&de,F.last_lit++,G===0?F.dyn_ltree[2*de]++:(F.matches++,G--,F.dyn_ltree[2*(E[de]+c+1)]++,F.dyn_dtree[2*L(G)]++),F.last_lit===F.lit_bufsize-1},i._tr_align=function(F){V(F,2,3),P(F,_,N),function(G){G.bi_valid===16?(Q(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.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(m,o){if(!m.setImmediate){var a,u,h,c,f=1,s={},d=!1,v=m.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(m);g=g&&g.setTimeout?g:m,a={}.toString.call(m.process)==="[object process]"?function(w){process.nextTick(function(){b(w)})}:function(){if(m.postMessage&&!m.importScripts){var w=!0,S=m.onmessage;return m.onmessage=function(){w=!1},m.postMessage("","*"),m.onmessage=S,w}}()?(c="setImmediate$"+Math.random()+"$",m.addEventListener?m.addEventListener("message",_,!1):m.attachEvent("onmessage",_),function(w){m.postMessage(c+w,"*")}):m.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)},g.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 Vl<"u"?Vl:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Bw);var ah=function(e,t){return ah=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])},ah(e,t)};function qp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ah(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function G7(e,t,n,r){function i(l){return l instanceof n?l:new n(function(m){m(l)})}return new(n||(n=Promise))(function(l,m){function o(h){try{u(r.next(h))}catch(c){m(c)}}function a(h){try{u(r.throw(h))}catch(c){m(c)}}function u(h){h.done?l(h.value):i(h.value).then(o,a)}u((r=r.apply(e,t||[])).next())})}function Fw(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,i,l,m;return m={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function o(u){return function(h){return a([u,h])}}function a(u){if(r)throw new TypeError("Generator is already executing.");for(;m&&(m=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 oc(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,l=[],m;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)l.push(i.value)}catch(o){m={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(m)throw m.error}}return l}function sc(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 no?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 Z7(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 Zs=="function"?Zs(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(m){return new Promise(function(o,a){m=e[l](m),i(o,a,m.done,m.value)})}}function i(l,m,o,a){Promise.resolve(a).then(function(u){l({value:u,done:o})},m)}}function Zt(e){return typeof e=="function"}function J7(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 Pf=J7(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 w0(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Zp=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 m=this._parentage;if(m)if(this._parentage=null,Array.isArray(m))try{for(var o=Zs(m),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 m.remove(this);var h=this.initialTeardown;if(Zt(h))try{h()}catch(v){l=v instanceof Pf?v.errors:[v]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var f=Zs(c),s=f.next();!s.done;s=f.next()){var d=s.value;try{C0(d)}catch(v){l=l!=null?l:[],v instanceof Pf?l=sc(sc([],oc(l)),oc(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 Pf(l)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)C0(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)&&w0(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&w0(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();Zp.EMPTY;function zw(e){return e instanceof Zp||e&&"closed"in e&&Zt(e.remove)&&Zt(e.add)&&Zt(e.unsubscribe)}function C0(e){Zt(e)?e():e.unsubscribe()}var Uc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},oh={setTimeout:function(e,t){for(var n=[],r=2;rn.value=i,error:t==null?void 0:t.onError});return kU(()=>{r.unsubscribe()}),n}function OU(e,t,n){const r=oe(n==null?void 0:n.initialValue),i=Gp(e);let l=i.subscribe({next:m=>r.value=m,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:m=>r.value=m,error:n==null?void 0:n.onError})}),ti(()=>{l.unsubscribe()}),r}const wa=Co("outputs",()=>{const e=EU(xU(Gp(()=>Lt.outputs.count())),{initialValue:0}),t=oe(1),n=zn("sortOutputsBy","Oldest"),r=zn("currentImagesLayout","dynamic"),i=oe("all"),l=OU(()=>{const s=rn();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(rn(),"pageless"),Cn(rn(),"pageSize"),t,n,i],{initialValue:[]});async function m(){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"))}m(),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 g=await Lt.outputs.bulkAdd(v,void 0,{allKeys:!0});return Lt.outputs.bulkGet(g)}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 Bw.exports.loadAsync(s.raw);let g=0,y=0;Ri({message:"Loading images...",type:"info"});const b=[];for(const[w,S]of Object.entries(v)){const x=w.split("."),T=x.slice(-1).join("."),O=x.slice(0,-1).join(".");T==="webp"&&b.push(new Promise(A=>{S.async("base64").then(async D=>{if(!v[O+".json"])return y++,A(null);const N=JSON.parse(await v[O+".json"].async("text"));g++,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)),Ri({message:`Successfully imported ${g}/${g+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=Co("ui",()=>{const e=oe(!1),t=oe([]),n=oe(["1"]),r=oe(-1),i=oe(!1),l=oe(!1);function m(f,s){console.error(f),Ri({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Ri({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=wa(),s=rn(),d=f.currentOutputs.findIndex(g=>g.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 g=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=(g==null?void 0:g.id)||r.value;return}}async function c(){const f=wa(),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:m,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:h,openModalToLeft:c}}),Xt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},AU={},PU={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},IU=re("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),MU=[IU];function LU(e,t){return j(),ue("svg",PU,MU)}const RU=Xt(AU,[["render",LU]]),Ho=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(j(),we(C(Op),{index:e.index},{default:pe(()=>[xe(t.$slots,"icon"),e.isMobile?_e("",!0):xe(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const DU="modulepreload",$U=function(e,t){return new URL(e,t).href},k0={},Mf=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=$U(l,r),l in k0)return;k0[l]=!0;const m=l.endsWith(".css"),o=m?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const c=i[h];if(c.href===l&&(!m||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=m?"stylesheet":DU,m||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),m)return new Promise((h,c)=>{u.addEventListener("load",h),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const BU={},FU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},zU=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),NU=[zU];function jU(e,t){return j(),ue("svg",FU,NU)}const t2=Xt(BU,[["render",jU]]),VU={},UU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},HU=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),WU=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),YU=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),XU=[HU,WU,YU];function KU(e,t){return j(),ue("svg",UU,XU)}const GU=Xt(VU,[["render",KU]]);function n2(){const e=oe("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return ti(()=>{clearInterval(t)}),{ellipsis:e}}const r2=e=>(Jr("data-v-dc223229"),e=e(),Qr(),e),qU={style:{"text-align":"center"}},ZU=r2(()=>re("br",null,null,-1)),JU={class:"gen-text"},QU={key:0},eH={key:1},tH=r2(()=>re("br",null,null,-1)),nH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null},emits:["showGenerated"],setup(e){const{ellipsis:t}=n2();return(n,r)=>{var i,l;return j(),ue("div",qU,[le(C(J1),{type:"circle",percentage:100*((i=e.generated)!=null?i:0)/((l=e.total)!=null?l:1),width:200},{default:pe(()=>[re("span",null,Pe(e.generated)+" / "+Pe(e.total),1),ZU]),_:1},8,["percentage"]),re("div",JU,[e.generated===e.total?(j(),ue("span",QU,"All done!")):(j(),ue("span",eH,[Ue("Generating"+Pe(C(t))+Pe("\xA0".repeat(3-C(t).length)),1),tH,re("sup",null,Pe(e.elapsed),1)]))]),e.generated?(j(),ue("div",{key:0,onClick:r[0]||(r[0]=m=>n.$emit("showGenerated")),class:"view-images"},[re("span",null,"View image"+Pe(e.total===1?"":"s"),1),le(C(De),null,{default:pe(()=>[le(C(mO))]),_:1})])):_e("",!0)])}}});const rH=Xt(nH,[["__scopeId","data-v-dc223229"]]);const iH={style:{width:"200px"}},aH=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(j(),we(C(kr),{trigger:e.trigger},{content:pe(()=>[re("div",iH,[xe(t.$slots,"default",{},()=>[Ue(Pe(e.info),1)])])]),default:pe(()=>[le(C(De),{size:e.size},{default:pe(()=>[le(C(Yh))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),oH={key:0,class:"align-vertical",style:{"margin-left":"5px"}},sH=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(j(),ue("span",{class:"align-vertical",style:Fe(e.labelStyle||"height: 100%;")},[xe(t.$slots,"default",{},()=>[Ue(Pe(e.label),1)],!0),e.info?(j(),ue("div",oH,[le(aH,{info:e.info,size:15},null,8,["info"])])):_e("",!0)],4))}});const Cl=Xt(sH,[["__scopeId","data-v-ec7e7ec1"]]),lH={key:0,style:{width:"100%"}},uH={key:1,style:{display:"flex","flex-direction":"column",gap:"8px",width:"100%"}},kn=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=cp(up).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 m(){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=te(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=te(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(h,c)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(h.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[!e.multiple||!Array.isArray(e.modelValue)?(j(),ue("div",lH,[C(i)?_e("",!0):(j(),we(C(e0),{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(Rd),{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(),ue("div",uH,[(j(!0),ue(ze,null,Dt(C(a),f=>(j(),ue("div",{key:f},[C(i)?_e("",!0):(j(),we(C(e0),{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(Rd),{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(st),{icon:C(Kh),onClick:c[0]||(c[0]=()=>m())},null,8,["icon"]),le(C(st),{icon:C(Gb),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),xe(h.$slots,"inline")]),_:3},8,["prop"]))}});const Pu=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(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(r.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(q1),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:pe(()=>[(j(!0),ue(ze,null,Dt(e.options,l=>(j(),we(C(Z1),{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"]),xe(r.$slots,"inline")]),_:3},8,["prop"]))}}),lh=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},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(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(i.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(La),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,onFocus:l[0]||(l[0]=m=>i.$emit("focus")),onBlur:l[1]||(l[1]=m=>i.$emit("blur"))},{append:pe(()=>[xe(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder"]),xe(i.$slots,"inline")]),_:3},8,["prop"]))}});const tu=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 Xy(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(i.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[e.disabledText&&e.disabled?(j(),we(C(kr),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(t0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(j(),we(C(t0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),xe(i.$slots,"inline")]),_:3},8,["prop"]))}}),cH=e=>(Jr("data-v-cf07eac2"),e=e(),Qr(),e),fH=cH(()=>re("div",null,"Prompt",-1)),dH=Ee({__name:"FormPromptInput",setup(e){const t=Pn();return(n,r)=>(j(),we(lh,{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:pe(()=>[fH]),_:1},8,["modelValue"]))}});const hH=Xt(dH,[["__scopeId","data-v-cf07eac2"]]);const pH=e=>(Jr("data-v-274da5ab"),e=e(),Qr(),e),gH={style:{position:"relative",height:"100%",width:"100%"}},mH=pH(()=>re("span",null,"Back to generation status",-1)),vH={class:"carousel-container"},yH=["src"],bH={class:"carousel-footer"},_H={style:{display:"flex","justify-content":"center"}},wH={style:{"white-space":"nowrap"}},CH=Ee({__name:"GeneratedCarousel",setup(e){const t=Pn(),n=$t(),r=rn(),i=oe(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function m(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(j(),ue("div",gH,[C(t).generating?(j(),ue("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(De),null,{default:pe(()=>[le(C(Hb))]),_:1}),mH])):_e("",!0),re("div",vH,[le(C(KD),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:pe(()=>[(j(!0),ue(ze,null,Dt(C(t).outputs,(u,h)=>(j(),we(C(GD),{key:h,style:{display:"flex","justify-content":"center"}},{default:pe(()=>[u.type==="video"?(j(),ue("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,yH)):_e("",!0),u.type==="image"?(j(),we(C(kp),{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",bH,[le(C(OB)),re("div",_H,[le(C(o1),null,{default:pe(()=>[re("div",wH,[le(H2,{imageData:C(t).outputs[i.value].output,"on-delete":m},null,8,["imageData"])])]),_:1})])])]))}});const SH=Xt(CH,[["__scopeId","data-v-274da5ab"]]);var Jn={};const xH={},TH=Object.freeze(Object.defineProperty({__proto__:null,default:xH},Symbol.toStringTag,{value:"Module"})),Lf=OD(TH);(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=Lf,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=Lf.implForWrapper,t.nodeCanvas=Lf.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 g=0,y=v.length;g"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 g=new t.Point(s.x-d.x,s.y-d.y),y=t.util.rotateVector(g,v);return new t.Point(y.x,y.y).addEquals(d)},rotateVector:function(s,d){var v=t.util.sin(d),g=t.util.cos(d),y=s.x*g-s.y*v,b=s.x*v+s.y*g;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 g=t.util.createVector(s,d),y=t.util.createVector(s,v),b=t.util.calcAngleBetweenVectors(g,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(g,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(g,w)),angle:b}},projectStrokeOnPoints:function(s,d,v){var g=[],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,O;S===0?(O=s[S+1],T=v?_(t.util.createVector(O,x)).addEquals(x):s[s.length-1]):S===s.length-1?(T=s[S-1],O=v?_(t.util.createVector(T,x)).addEquals(x):s[0]):(T=s[S-1],O=s[S+1]);var A=t.util.getBisector(x,T,O),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)){g.push(x.add(B)),g.push(x.subtract(B));return}R=-y*Math.SQRT2,B=new t.Point(D.x*R*b.x,D.y*R*b.y),g.push(x.add(B)),g.push(x.subtract(B))}),g},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,g=[s.flipX?-d:d,0,0,s.flipY?-v:v,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(g=y(g,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(g=y(g,[1,Math.tan(b(s.skewY)),0,1],!0)),g},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,g){g>0&&(d>g?d-=g:d=0,v>g?v-=g:v=0);var y=!0,b,_,w=s.getImageData(d,v,g*2||1,g*2||1),S=w.data.length;for(b=3;bn.value=i,error:t==null?void 0:t.onError});return kU(()=>{r.unsubscribe()}),n}function OU(e,t,n){const r=oe(n==null?void 0:n.initialValue),i=Gp(e);let l=i.subscribe({next:m=>r.value=m,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:m=>r.value=m,error:n==null?void 0:n.onError})}),ti(()=>{l.unsubscribe()}),r}const wa=Co("outputs",()=>{const e=EU(xU(Gp(()=>Lt.outputs.count())),{initialValue:0}),t=oe(1),n=zn("sortOutputsBy","Oldest"),r=zn("currentImagesLayout","dynamic"),i=oe("all"),l=OU(()=>{const s=rn();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(rn(),"pageless"),Cn(rn(),"pageSize"),t,n,i],{initialValue:[]});async function m(){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"))}m(),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 g=await Lt.outputs.bulkAdd(v,void 0,{allKeys:!0});return Lt.outputs.bulkGet(g)}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 Bw.exports.loadAsync(s.raw);let g=0,y=0;Ri({message:"Loading images...",type:"info"});const b=[];for(const[w,S]of Object.entries(v)){const x=w.split("."),T=x.slice(-1).join("."),O=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[O+".json"])return y++,A(null);const N=JSON.parse(await v[O+".json"].async("text"));g++,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)),Ri({message:`Successfully imported ${g}/${g+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=Co("ui",()=>{const e=oe(!1),t=oe([]),n=oe(["1"]),r=oe(-1),i=oe(!1),l=oe(!1);function m(f,s){console.error(f),Ri({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Ri({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=wa(),s=rn(),d=f.currentOutputs.findIndex(g=>g.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 g=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=(g==null?void 0:g.id)||r.value;return}}async function c(){const f=wa(),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:m,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:h,openModalToLeft:c}}),Xt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},AU={},PU={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},IU=re("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),MU=[IU];function LU(e,t){return j(),ue("svg",PU,MU)}const RU=Xt(AU,[["render",LU]]),Ho=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(j(),we(C(Op),{index:e.index},{default:pe(()=>[xe(t.$slots,"icon"),e.isMobile?_e("",!0):xe(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const DU="modulepreload",$U=function(e,t){return new URL(e,t).href},k0={},Mf=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=$U(l,r),l in k0)return;k0[l]=!0;const m=l.endsWith(".css"),o=m?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const c=i[h];if(c.href===l&&(!m||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=m?"stylesheet":DU,m||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),m)return new Promise((h,c)=>{u.addEventListener("load",h),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const BU={},FU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},zU=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),NU=[zU];function jU(e,t){return j(),ue("svg",FU,NU)}const t2=Xt(BU,[["render",jU]]),VU={},UU={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},HU=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),WU=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),YU=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),XU=[HU,WU,YU];function KU(e,t){return j(),ue("svg",UU,XU)}const GU=Xt(VU,[["render",KU]]);function n2(){const e=oe("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return ti(()=>{clearInterval(t)}),{ellipsis:e}}const r2=e=>(Jr("data-v-dc223229"),e=e(),Qr(),e),qU={style:{"text-align":"center"}},ZU=r2(()=>re("br",null,null,-1)),JU={class:"gen-text"},QU={key:0},eH={key:1},tH=r2(()=>re("br",null,null,-1)),nH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null},emits:["showGenerated"],setup(e){const{ellipsis:t}=n2();return(n,r)=>{var i,l;return j(),ue("div",qU,[le(C(J1),{type:"circle",percentage:100*((i=e.generated)!=null?i:0)/((l=e.total)!=null?l:1),width:200},{default:pe(()=>[re("span",null,Pe(e.generated)+" / "+Pe(e.total),1),ZU]),_:1},8,["percentage"]),re("div",JU,[e.generated===e.total?(j(),ue("span",QU,"All done!")):(j(),ue("span",eH,[Ue("Generating"+Pe(C(t))+Pe("\xA0".repeat(3-C(t).length)),1),tH,re("sup",null,Pe(e.elapsed),1)]))]),e.generated?(j(),ue("div",{key:0,onClick:r[0]||(r[0]=m=>n.$emit("showGenerated")),class:"view-images"},[re("span",null,"View image"+Pe(e.total===1?"":"s"),1),le(C(De),null,{default:pe(()=>[le(C(mO))]),_:1})])):_e("",!0)])}}});const rH=Xt(nH,[["__scopeId","data-v-dc223229"]]);const iH={style:{width:"200px"}},aH=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(j(),we(C(kr),{trigger:e.trigger},{content:pe(()=>[re("div",iH,[xe(t.$slots,"default",{},()=>[Ue(Pe(e.info),1)])])]),default:pe(()=>[le(C(De),{size:e.size},{default:pe(()=>[le(C(Yh))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),oH={key:0,class:"align-vertical",style:{"margin-left":"5px"}},sH=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(j(),ue("span",{class:"align-vertical",style:Fe(e.labelStyle||"height: 100%;")},[xe(t.$slots,"default",{},()=>[Ue(Pe(e.label),1)],!0),e.info?(j(),ue("div",oH,[le(aH,{info:e.info,size:15},null,8,["info"])])):_e("",!0)],4))}});const Cl=Xt(sH,[["__scopeId","data-v-ec7e7ec1"]]),lH={key:0,style:{width:"100%"}},uH={key:1,style:{display:"flex","flex-direction":"column",gap:"8px",width:"100%"}},kn=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=cp(up).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 m(){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=te(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=te(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(h,c)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(h.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[!e.multiple||!Array.isArray(e.modelValue)?(j(),ue("div",lH,[C(i)?_e("",!0):(j(),we(C(e0),{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(Rd),{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(),ue("div",uH,[(j(!0),ue(ze,null,Dt(C(a),f=>(j(),ue("div",{key:f},[C(i)?_e("",!0):(j(),we(C(e0),{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(Rd),{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(st),{icon:C(Kh),onClick:c[0]||(c[0]=()=>m())},null,8,["icon"]),le(C(st),{icon:C(Gb),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),xe(h.$slots,"inline")]),_:3},8,["prop"]))}});const Pu=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(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(r.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(q1),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:pe(()=>[(j(!0),ue(ze,null,Dt(e.options,l=>(j(),we(C(Z1),{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"]),xe(r.$slots,"inline")]),_:3},8,["prop"]))}}),lh=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},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(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(i.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(La),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,onFocus:l[0]||(l[0]=m=>i.$emit("focus")),onBlur:l[1]||(l[1]=m=>i.$emit("blur"))},{append:pe(()=>[xe(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder"]),xe(i.$slots,"inline")]),_:3},8,["prop"]))}});const tu=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 Xy(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(i.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[e.disabledText&&e.disabled?(j(),we(C(kr),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(t0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(j(),we(C(t0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),xe(i.$slots,"inline")]),_:3},8,["prop"]))}}),cH=e=>(Jr("data-v-cf07eac2"),e=e(),Qr(),e),fH=cH(()=>re("div",null,"Prompt",-1)),dH=Ee({__name:"FormPromptInput",setup(e){const t=Pn();return(n,r)=>(j(),we(lh,{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:pe(()=>[fH]),_:1},8,["modelValue"]))}});const hH=Xt(dH,[["__scopeId","data-v-cf07eac2"]]);const pH=e=>(Jr("data-v-274da5ab"),e=e(),Qr(),e),gH={style:{position:"relative",height:"100%",width:"100%"}},mH=pH(()=>re("span",null,"Back to generation status",-1)),vH={class:"carousel-container"},yH=["src"],bH={class:"carousel-footer"},_H={style:{display:"flex","justify-content":"center"}},wH={style:{"white-space":"nowrap"}},CH=Ee({__name:"GeneratedCarousel",setup(e){const t=Pn(),n=$t(),r=rn(),i=oe(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function m(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(j(),ue("div",gH,[C(t).generating?(j(),ue("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(De),null,{default:pe(()=>[le(C(Hb))]),_:1}),mH])):_e("",!0),re("div",vH,[le(C(KD),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:pe(()=>[(j(!0),ue(ze,null,Dt(C(t).outputs,(u,h)=>(j(),we(C(GD),{key:h,style:{display:"flex","justify-content":"center"}},{default:pe(()=>[u.type==="video"?(j(),ue("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,yH)):_e("",!0),u.type==="image"?(j(),we(C(kp),{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",bH,[le(C(OB)),re("div",_H,[le(C(o1),null,{default:pe(()=>[re("div",wH,[le(H2,{imageData:C(t).outputs[i.value].output,"on-delete":m},null,8,["imageData"])])]),_:1})])])]))}});const SH=Xt(CH,[["__scopeId","data-v-274da5ab"]]);var Jn={};const xH={},TH=Object.freeze(Object.defineProperty({__proto__:null,default:xH},Symbol.toStringTag,{value:"Module"})),Lf=OD(TH);(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=Lf,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=Lf.implForWrapper,t.nodeCanvas=Lf.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 g=0,y=v.length;g"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 g=new t.Point(s.x-d.x,s.y-d.y),y=t.util.rotateVector(g,v);return new t.Point(y.x,y.y).addEquals(d)},rotateVector:function(s,d){var v=t.util.sin(d),g=t.util.cos(d),y=s.x*g-s.y*v,b=s.x*v+s.y*g;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 g=t.util.createVector(s,d),y=t.util.createVector(s,v),b=t.util.calcAngleBetweenVectors(g,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(g,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(g,w)),angle:b}},projectStrokeOnPoints:function(s,d,v){var g=[],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,O;S===0?(O=s[S+1],T=v?_(t.util.createVector(O,x)).addEquals(x):s[s.length-1]):S===s.length-1?(T=s[S-1],O=v?_(t.util.createVector(T,x)).addEquals(x):s[0]):(T=s[S-1],O=s[S+1]);var A=t.util.getBisector(x,T,O),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)){g.push(x.add(B)),g.push(x.subtract(B));return}R=-y*Math.SQRT2,B=new t.Point(D.x*R*b.x,D.y*R*b.y),g.push(x.add(B)),g.push(x.subtract(B))}),g},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,g=[s.flipX?-d:d,0,0,s.flipY?-v:v,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(g=y(g,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(g=y(g,[1,Math.tan(b(s.skewY)),0,1],!0)),g},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,g){g>0&&(d>g?d-=g:d=0,v>g?v-=g:v=0);var y=!0,b,_,w=s.getImageData(d,v,g*2||1,g*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)),Te=[],Ae=be/Ce,ye=8/3*Math.sin(Ae/4)*Math.sin(Ae/4)/Math.sin(Ae/2),Se=ce+Ae,Me=0;Me=Q?V-Q:2*Math.PI-(Q-V)}function s(I,z,M,L,Q,V,P,q){var Z;if(t.cachesBoundsOfCurve&&(Z=o.call(arguments),t.boundsOfCurveCache[Z]))return t.boundsOfCurveCache[Z];var ie=Math.sqrt,he=Math.min,me=Math.max,ve=Math.abs,H=[],Y=[[],[]],k,X,W,$,F,G,de,ae;X=6*I-12*M+6*Q,k=-3*I+9*M-9*Q+3*P,W=3*M-3*I;for(var J=0;J<2;++J){if(J>0&&(X=6*z-12*L+6*V,k=-3*z+9*L-9*V+3*q,W=3*L-3*z),ve(k)<1e-12){if(ve(X)<1e-12)continue;$=-W/X,0<$&&$<1&&H.push($);continue}de=X*X-4*W*k,!(de<0)&&(ae=ie(de),F=(-X+ae)/(2*k),01e-4;)P=Q(M),he=M,q=g(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(he),P}function E(I){for(var z=0,M=I.length,L,Q=0,V=0,P=0,q=0,Z=[],ie,he,me,ve=0;ve0&&Lde)for(var J=1,ge=k.length;J2;for(z=z||0,ie&&(q=I[2].xI[L-2].x?1:Q.x===I[L-2].x?0:-1,Z=Q.y>I[L-2].y?1:Q.y===I[L-2].y?0:-1),M.push(["L",Q.x+q*z,Q.y+Z*z]),M}function se(I,z,M){return M&&(z=t.util.multiplyTransformMatrices(z,[1,0,0,1,-M.x,-M.y])),I.map(function(L){for(var Q=L.slice(0),V={},P=1;P=g})}function h(s,d){return f(s,d,function(v,g){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 g=f.charCodeAt(s-1);if(55296>g||g>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,g){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=g;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,g=this;g.constructor.superclass;){var y=g.constructor.superclass.prototype[d];if(g[d]!==y){v=y;break}g=g.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 g(){this.initialize.apply(this,arguments)}g.superclass=d,g.subclasses=[],d&&(c.prototype=d.prototype,g.prototype=new c,d.subclasses.push(g));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 g in d)if(g==="opacity")f(s,d[g]);else{var y=g==="float"||g==="cssFloat"?typeof v.styleFloat>"u"?"cssFloat":"styleFloat":g;v.setProperty(y,d[g])}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,O=t.document.body||{scrollLeft:0,scrollTop:0};w&&(w.parentNode||w.host)&&(w=w.parentNode||w.host,w===t.document?(S=O.scrollLeft||T.scrollLeft||0,x=O.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},O={left:0,top:0},A,D={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!x)return O;for(var N in D)O[D[N]]+=parseInt(g(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)+O.left,top:T.top+A.top-(S.clientTop||0)+O.top}}var g;t.document.defaultView&&t.document.defaultView.getComputedStyle?g=function(w,S){var x=t.document.defaultView.getComputedStyle(w,null);return x?x[S]:void 0}:g=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(O){return typeof O.onselectstart<"u"&&(O.onselectstart=t.util.falseFunction),S?O.style[S]="none":typeof O.unselectable=="string"&&(O.unselectable="on"),O}function T(O){return typeof O.onselectstart<"u"&&(O.onselectstart=null),S?O.style[S]="":typeof O.unselectable=="string"&&(O.unselectable=""),O}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,O=x+T,A,D=y.onChange||h,N=y.abort||h,R=y.onComplete||h,B=y.easing||c,E="startValue"in y?y.startValue.length>0:!1,U="startValue"in y?y.startValue:0,ne="endValue"in y?y.endValue:100,ee=y.byValue||(E?U.map(function(se,I){return ne[I]-U[I]}):ne-U);y.onStart&&y.onStart(),function se(I){A=I||+new Date;var z=A>O?T:A-x,M=z/T,L=E?U.map(function(V,P){return B(z,U[P],ee[P],T)}):B(z,U,ee,T),Q=Math.abs(E?(L[0]-U[0])/ee[0]:(L-U)/ee);if(_.currentValue=E?L.slice():L,_.completionRate=Q,_.durationRate=M,!b){if(N(L,Q,M)){w();return}if(A>O){_.currentValue=E?ne.slice():ne,_.completionRate=1,_.durationRate=1,D(E?ne.slice():ne,1,1),R(ne,1,1),w();return}else D(L,Q,M),v(se)}}(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 g(){return d.apply(t.window,arguments)}t.util.animate=f,t.util.requestAnimFrame=v,t.util.cancelAnimFrame=g,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,g=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(g){if(Array.isArray(y))return g(o(y,y,0),b,_);g(y,b,_)}}}))}t.util.animateColor=a}(),function(){function o(I,z,M,L){return I-1&&ve>-1&&ve-1)&&(P="stroke")}else{if(V==="href"||V==="xlink:href"||V==="font")return P;if(V==="imageSmoothing")return P==="optimizeQuality";he=ie?P.map(f):f(P,Z)}}return!ie&&isNaN(he)?P:he}function O(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,he,me;for(he=0,me=P.length;he1;)K.shift(),ce=a.util.multiplyTransformMatrices(ce,K[0]);return ce}}();function N(V,P){var q,Z;V.replace(/;\s*$/,"").split(";").forEach(function(ie){var he=ie.split(":");q=he[0].trim().toLowerCase(),Z=he[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(E(V,Z.split(" ")))for(var ie in a.cssRules[P][Z])q[ie]=a.cssRules[P][Z][ie];return q}function E(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"),he,me;if(he=new RegExp("^"+q,"i"),P=P.replace(he,""),ie&&P.length&&(he=new RegExp("#"+ie+"(?![a-zA-Z\\-]+)","i"),P=P.replace(he,"")),Z&&P.length)for(Z=Z.split(" "),me=Z.length;me--;)he=new RegExp("\\."+Z[me]+"(?![a-zA-Z\\-]+)","i"),P=P.replace(he,"");return P.length===0}function ee(V,P){var q;if(V.getElementById&&(q=V.getElementById(P)),q)return q;var Z,ie,he,me=V.getElementsByTagName("*");for(ie=0,he=me.length;ieZ?Z:q),F.meetOrSlice==="slice"&&(Z=q=q>Z?q:Z),K=J.width-me*q,ce=J.height-ve*q,F.alignX==="Mid"&&(K/=2),F.alignY==="Mid"&&(ce/=2),F.alignX==="Min"&&(K=0),F.alignY==="Min"&&(ce=0)),q===1&&Z===1&&ie===0&&he===0&&W===0&&$===0)return J;if((W||$)&&V.parentNode.nodeName!=="#document"&&(ge=" translate("+f(W)+" "+f($)+") "),H=ge+" matrix("+q+" 0 0 "+Z+" "+(ie*q+K)+" "+(he*Z+ce)+") ",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),J}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){se(V);var ie=a.Object.__uid++,he,me,ve=z(V),H=a.util.toArray(V.getElementsByTagName("*"));if(ve.crossOrigin=Z&&Z.crossOrigin,ve.svgUid=ie,H.length===0&&a.isLikelyNode){H=V.selectNodes('//*[name(.)!="svg"]');var Y=[];for(he=0,me=H.length;he"u"&&(q=V.getAttribute("svgUid")),V.parentNode&&a.svgValidParentsRegEx.test(V.parentNode.nodeName)&&(ie=a.parseAttributes(V.parentNode,P,q));var ve=P.reduce(function(F,G){return Z=V.getAttribute(G),Z&&(F[G]=Z),F},{}),H=u(B(V,q),a.parseStyleAttribute(V));ve=u(ve,H),H[S]&&V.setAttribute(S,H[S]),he=me=ie.fontSize||a.Text.DEFAULT_SVG_FONT_SIZE,ve[w]&&(ve[w]=he=f(ve[w],me));var Y,k,X={};for(var W in ve)Y=x(W),k=T(Y,ve[W],ie,he),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),g=(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,_=g/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||g===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,g,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),g=new a.Point(s.x,d.y),y=u.intersectLinePolygon(s,v,h),b=u.intersectLinePolygon(v,d,h),_=u.intersectLinePolygon(d,g,h),w=u.intersectLinePolygon(g,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,g,y=a.util.array.max([c,f,s]),b=a.util.array.min([c,f,s]);if(g=(y+b)/2,y===b)d=v=0;else{var _=y-b;switch(v=g>.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),g,y,b;if(d===0)g=y=b=v;else{var _=v<=.5?v*(d+1):v+d-v*d,w=v*2-_;g=h(w,_,s+1/3),y=h(w,_,s),b=h(w,_,s-1/3)}return[Math.round(g*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),g=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(g,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",g="center",y={top:v,bottom:s,left:d,right:f,center:g},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===g&&Y.originY===g}function O(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"),O(X,F,$))return W;var G=w(X,k);return u[G]+"-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 E(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,G=F.getCenterPoint(),de=F.translateToOriginPoint(G,X.originX,X.originY),ae=Y(k,X,W,$);return F.setPositionByOrigin(de,X.originX,X.originY),ae}}function ne(Y,k){return function(X,W,$,F){var G=k(X,W,$,F);return G&&S(Y,E(X,W,$,F)),G}}function ee(Y,k,X,W,$){var F=Y.target,G=F.controls[Y.corner],de=F.canvas.getZoom(),ae=F.padding/de,J=F.toLocalPoint(new a.Point(W,$),k,X);return J.x>=ae&&(J.x-=ae),J.x<=-ae&&(J.x+=ae),J.y>=ae&&(J.y-=ae),J.y<=ae&&(J.y+=ae),J.x-=G.offsetX,J.y-=G.offsetY,J}function se(Y){return Y.flipX!==Y.flipY}function I(Y,k,X,W,$){if(Y[k]!==0){var F=Y._getTransformedDimensions()[W],G=$/F*Y[X];Y.set(X,G)}}function z(Y,k,X,W){var $=k.target,F=$._getTransformedDimensions(0,$.skewY),G=ee(k,k.originX,k.originY,X,W),de=Math.abs(G.x*2)-F.x,ae=$.skewX,J;de<2?J=0:(J=b(Math.atan2(de/$.scaleX,F.y/$.scaleY)),k.originX===f&&k.originY===v&&(J=-J),k.originX===d&&k.originY===s&&(J=-J),se($)&&(J=-J));var ge=ae!==J;if(ge){var K=$._getTransformedDimensions().y;$.set("skewX",J),I($,"skewY","scaleY","y",K)}return ge}function M(Y,k,X,W){var $=k.target,F=$._getTransformedDimensions($.skewX,0),G=ee(k,k.originX,k.originY,X,W),de=Math.abs(G.y*2)-F.y,ae=$.skewY,J;de<2?J=0:(J=b(Math.atan2(de/$.scaleY,F.x/$.scaleX)),k.originX===f&&k.originY===v&&(J=-J),k.originX===d&&k.originY===s&&(J=-J),se($)&&(J=-J));var ge=ae!==J;if(ge){var K=$._getTransformedDimensions().x;$.set("skewY",J),I($,"skewX","scaleX","x",K)}return ge}function L(Y,k,X,W){var $=k.target,F=$.skewX,G,de=k.originY;if($.lockSkewingX)return!1;if(F===0){var ae=ee(k,g,g,X,W);ae.x>0?G=f:G=d}else F>0&&(G=de===s?f:d),F<0&&(G=de===s?d:f),se($)&&(G=G===f?d:f);k.originX=G;var J=ne("skewing",U(z));return J(Y,k,X,W)}function Q(Y,k,X,W){var $=k.target,F=$.skewY,G,de=k.originX;if($.lockSkewingY)return!1;if(F===0){var ae=ee(k,g,g,X,W);ae.y>0?G=s:G=v}else F>0&&(G=de===f?s:v),F<0&&(G=de===f?v:s),se($)&&(G=G===s?v:s);k.originY=G;var J=ne("skewing",U(M));return J(Y,k,X,W)}function V(Y,k,X,W){var $=k,F=$.target,G=F.translateToOriginPoint(F.getCenterPoint(),$.originX,$.originY);if(F.lockRotation)return!1;var de=Math.atan2($.ey-G.y,$.ex-G.x),ae=Math.atan2(W-G.y,X-G.x),J=b(ae-de+$.theta),ge=!0;if(F.snapAngle>0){var K=F.snapAngle,ce=F.snapThreshold||K,be=Math.ceil(J/K)*K,Ce=Math.floor(J/K)*K;Math.abs(J-Ce)_?(A=b,s.scale(1,_/b),O=v*b/_):_>b?(A=_,s.scale(b/_,1),T=d*_/b):A=b,s.lineWidth=1,s.beginPath(),s.arc(T,O,A/2,0,2*Math.PI,!1),s[S](),x&&s.stroke(),s.restore()}function f(s,d,v,g,y){g=g||{};var b=this.sizeX||g.cornerSize||y.cornerSize,_=this.sizeY||g.cornerSize||y.cornerSize,w=typeof g.transparentCorners<"u"?g.transparentCorners:y.transparentCorners,S=w?"stroke":"fill",x=!w&&(g.cornerStrokeColor||y.cornerStrokeColor),T=b/2,O=_/2;s.save(),s.fillStyle=g.cornerColor||y.cornerColor,s.strokeStyle=g.cornerStrokeColor||y.cornerStrokeColor,s.lineWidth=1,s.translate(d,v),s.rotate(u(y.angle)),s[S+"Rect"](-T,-O,b,_),x&&s.strokeRect(-T,-O,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,g,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),O=Math.PI/2-S-a.util.degreesToRadians(h);v=x*a.util.cos(T),g=x*a.util.sin(T),y=x*a.util.cos(O),b=x*a.util.sin(O)}else{var A=_&&w?_:c;x=A*.7071067812;var T=a.util.degreesToRadians(45-h);v=y=x*a.util.cos(T),g=b=x*a.util.sin(T)}return{tl:{x:f-b,y:s-y},tr:{x:f+v,y:s-g},bl:{x:f-v,y:s+g},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,g,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"?g=T:x==="stop-opacity"&&(b=T)}}return g||(g=f.getAttribute("stop-color")||"rgb(0,0,0)"),b||(b=f.getAttribute("stop-opacity")),g=new t.Color(g),y=g.getAlpha(),b=isNaN(parseFloat(b))?1:parseFloat(b),b*=y*s,{offset:v,color:g.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,g,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,O=-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,O/=f.height):(T+=f.width/2,O+=f.height/2),f.type==="path"&&this.gradientUnits!=="percentage"&&(T-=f.pathOffset.x,O-=f.pathOffset.y),x[4]-=T,x[5]-=O,_='id="SVGID_'+this.id+'" gradientUnits="'+D+'"',_+=' gradientTransform="'+(A?y.additionalTransform+" ":"")+t.util.matrixToSVG(x)+'" ',this.type==="linear"?b=[" `]:this.type==="radial"&&(b=[" @@ -506,7 +506,7 @@ gl_FragColor.rgb *= color.a; `?(s++,f[s]=0):f[s]++;f[0]>0&&(this.insertCharStyleObject(c.lineIndex,c.charIndex,f[0],h),h=h&&h.slice(f[0]+1)),s&&this.insertNewlineStyleObject(c.lineIndex,c.charIndex+f[0],s);for(var d=1;d0?this.insertCharStyleObject(c.lineIndex+d,0,f[d],h):h&&this.styles[c.lineIndex+d]&&h[0]&&(this.styles[c.lineIndex+d][0]=h[0]),h=h&&h.slice(f[d]+1);f[d]>0&&this.insertCharStyleObject(c.lineIndex+d,0,f[d],h)},setSelectionStartEndWithShift:function(a,u,h){h<=a?(u===a?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=a),this.selectionStart=h):h>a&&ha?this.selectionStart=a:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>a?this.selectionEnd=a:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(o){if(!!this.canvas){this.__newClickTime=+new Date;var a=o.pointer;this.isTripleClick(a)&&(this.fire("tripleclick",o),this._stopEvent(o.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=a,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(o){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===o.x&&this.__lastPointer.y===o.y},_stopEvent:function(o){o.preventDefault&&o.preventDefault(),o.stopPropagation&&o.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(o){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(o.e))},tripleClickHandler:function(o){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(o.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(o.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(o){if(this.__isMousedown=!1,!(!this.editable||this.group||o.transform&&o.transform.actionPerformed||o.e.button&&o.e.button!==1)){if(this.canvas){var a=this.canvas._activeObject;if(a&&a!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(o.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(o){var a=this.getSelectionStartFromPointer(o),u=this.selectionStart,h=this.selectionEnd;o.shiftKey?this.setSelectionStartEndWithShift(u,h,a):(this.selectionStart=a,this.selectionEnd=a),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(o){for(var a=this.getLocalPointer(o),u=0,h=0,c=0,f=0,s=0,d,v,g=0,y=this._textLines.length;g0&&(f+=this._textLines[g-1].length+this.missingNewlineOffset(g-1));d=this._getLineLeftOffset(s),h=d*this.scaleX,v=this._textLines[s],this.direction==="rtl"&&(a.x=this.width*this.scaleX-a.x+h);for(var b=0,_=v.length;b<_&&(u=h,h+=this.__charBounds[s][b].kernedWidth*this.scaleX,h<=a.x);b++)f++;return this._getNewSelectionStartFromOffset(a,u,h,f,_)},_getNewSelectionStartFromOffset:function(o,a,u,h,c){var f=o.x-a,s=u-o.x,d=s>f||s<0?0:1,v=h+d;return this.flipX&&(v=c-v),v>this._text.length&&(v=this._text.length),v}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var o=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+o.top+"; left: "+o.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+o.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(o){if(!!this.isEditing){var a=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(o.keyCode in a)this[a[o.keyCode]](o);else if(o.keyCode in this.ctrlKeysMapDown&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapDown[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),o.keyCode>=33&&o.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(o){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(o.keyCode in this.ctrlKeysMapUp&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapUp[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(o){var a=this.fromPaste;if(this.fromPaste=!1,o&&o.stopPropagation(),!!this.isEditing){var u=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,c=u.length,f,s,d=c-h,v=this.selectionStart,g=this.selectionEnd,y=v!==g,b,_,w;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var S=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),x=v>S.selectionStart;y?(f=this._text.slice(v,g),d+=g-v):c0&&(h=this.__charBounds[o][a-1],u+=h.left+h.width),u},getDownCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===this._textLines.length-1||o.metaKey||o.keyCode===34)return this._text.length-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c+1,s),v=this._textLines[c].slice(f);return v.length+d+1+this.missingNewlineOffset(c)},_getSelectionForOffset:function(o,a){return o.shiftKey&&this.selectionStart!==this.selectionEnd&&a?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===0||o.metaKey||o.keyCode===33)return-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c-1,s),v=this._textLines[c].slice(0,f),g=this.missingNewlineOffset(c-1);return-this._textLines[c-1].length+d-v.length+(1-g)},_getIndexOnLine:function(o,a){for(var u=this._textLines[o],h=this._getLineLeftOffset(o),c=h,f=0,s,d,v=0,g=u.length;va){d=!0;var y=c-s,b=c,_=Math.abs(y-a),w=Math.abs(b-a);f=w<_?v:v-1;break}return d||(f=u.length-1),f},moveCursorDown:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",o)},moveCursorUp:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",o)},_moveCursorUpOrDown:function(o,a){var u="get"+o+"CursorOffset",h=this[u](a,this._selectionDirection==="right");a.shiftKey?this.moveCursorWithShift(h):this.moveCursorWithoutShift(h),h!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(o){var a=this._selectionDirection==="left"?this.selectionStart+o:this.selectionEnd+o;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,a),o!==0},moveCursorWithoutShift:function(o){return o<0?(this.selectionStart+=o,this.selectionEnd=this.selectionStart):(this.selectionEnd+=o,this.selectionStart=this.selectionEnd),o!==0},moveCursorLeft:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",o)},_move:function(o,a,u){var h;if(o.altKey)h=this["findWordBoundary"+u](this[a]);else if(o.metaKey||o.keyCode===35||o.keyCode===36)h=this["findLineBoundary"+u](this[a]);else return this[a]+=u==="Left"?-1:1,!0;if(typeof h<"u"&&this[a]!==h)return this[a]=h,!0},_moveLeft:function(o,a){return this._move(o,a,"Left")},_moveRight:function(o,a){return this._move(o,a,"Right")},moveCursorLeftWithoutShift:function(o){var a=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(a=this._moveLeft(o,"selectionStart")),this.selectionEnd=this.selectionStart,a},moveCursorLeftWithShift:function(o){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(o,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(o,"selectionStart")},moveCursorRight:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",o)},_moveCursorLeftOrRight:function(o,a){var u="moveCursor"+o+"With";this._currentCursorOpacity=1,a.shiftKey?u+="Shift":u+="outShift",this[u](a)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(o){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(o,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(o,"selectionEnd")},moveCursorRightWithoutShift:function(o){var a=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(a=this._moveRight(o,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,a},removeChars:function(o,a){typeof a>"u"&&(a=o+1),this.removeStyleFromTo(o,a),this._text.splice(o,a-o),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(o,a,u,h){typeof h>"u"&&(h=u),h>u&&this.removeStyleFromTo(u,h);var c=t.util.string.graphemeSplit(o);this.insertNewStyleBlock(c,u,a),this._text=[].concat(this._text.slice(0,u),c,this._text.slice(h)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var o=t.util.toFixed,a=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var u=this._getSVGLeftTopOffsets(),h=this._getSVGTextAndBg(u.textTop,u.textLeft);return this._wrapSVGTextAndBg(h)},toSVG:function(u){return this._createBaseSVGMarkup(this._toSVG(),{reviver:u,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(u){var h=!0,c=this.getSvgTextDecoration(this);return[u.textBgRects.join(""),' ",u.textSpans.join(""),` `]},_getSVGTextAndBg:function(u,h){var c=[],f=[],s=u,d;this._setSVGBg(f);for(var v=0,g=this._textLines.length;v",t.util.string.escapeXml(u),""].join("")},_setSVGTextLineText:function(u,h,c,f){var s=this.getHeightOfLine(h),d=this.textAlign.indexOf("justify")!==-1,v,g,y="",b,_,w=0,S=this._textLines[h],x;f+=s*(1-this._fontSizeFraction)/this.lineHeight;for(var T=0,O=S.length-1;T<=O;T++)x=T===O||this.charSpacing,y+=S[T],b=this.__charBounds[h][T],w===0?(c+=b.kernedWidth-b.width,w+=b.width):w+=b.kernedWidth,d&&!x&&this._reSpaceAndTab.test(S[T])&&(x=!0),x||(v=v||this.getCompleteStyleDeclaration(h,T),g=this.getCompleteStyleDeclaration(h,T+1),x=t.util.hasStyleChanged(v,g,!0)),x&&(_=this._getStyleDeclaration(h,T)||{},u.push(this._createTextCharSpan(y,_,c,f)),y="",v=g,c+=w,w=0)},_pushTextBgRect:function(u,h,c,f,s,d){var v=t.Object.NUM_FRACTION_DIGITS;u.push(" `)},_setSVGTextLineBg:function(u,h,c,f){for(var s=this._textLines[h],d=this.getHeightOfLine(h)/this.lineHeight,v=0,g=0,y,b,_=this.getValueOfPropertyAt(h,0,"textBackgroundColor"),w=0,S=s.length;wthis.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(u){for(var h=0,c=0,f=0,s={},d=0;d0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return a.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,v=this._styleMap[u],g=this._styleMap[u+1];v&&(u=v.line,h=v.offset),g&&(c=g.line,d=c===u,f=g.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(v.push(g),g=[],s=S,O=!0):s+=A,!O&&!d&&g.push(w),g=g.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&v.push(g),T+D>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+D),v},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=oe({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=oe({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=te(()=>Pn().generatorType==="Inpainting"),i=te(()=>r.value?t.value:n.value),l=te(()=>Pn().currentImageProps),m=te({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),o=oe(512),a=oe(512),u=oe(!1),h=oe(30),c=oe(!1),f=new Jn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=oe("Erase"),d=oe("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function g(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:M=!1,draw:L=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await ee(z.path),z.visibleDrawPath=await ee(z.path),M?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=L?d.value:i.value.maskPathColor);let Q=await ee(z.drawPath);Q=Q.scale(i.value.imageScale),Q.left=Q.left+z.drawPath.left*(i.value.imageScale-1),Q.top=Q.top+z.drawPath.top*(i.value.imageScale-1),L?(i.value.imageLayer.add(Q),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(Q),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),v()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:m.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),m.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,v()}function S(z){i.value.canvas=new Jn.fabric.Canvas(z,{isDrawingMode:!1,width:o.value,height:a.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",se),v()}function x(z,M,L,Q){let V=Q,P=Q;return M>L?(z.scaleToWidth(Q),V=Q*(a.value/o.value)):(z.scaleToHeight(Q),P=Q*(o.value/a.value)),{newHeight:V,newWidth:P}}function T(z){const M=Pn();if(E(),z.selectable=!1,o.value=z.width,a.value=z.height,o.value>M.maxDimensions||a.value>M.maxDimensions){const{newHeight:Q,newWidth:V}=x(z,o.value,a.value,M.maxDimensions);o.value=V,a.value=Q}if(o.value{o.value>a.value?i.value.imageScale=o.value/L:i.value.imageScale=a.value/L,i.value.imageLayer=R({image:Q,layerHeight:Q.height,layerWidth:Q.width})}),z.cloneAsImage(Q=>{if(!i.value.canvas)return;if(o.value!==L||a.value!==L){const{newHeight:q,newWidth:Z}=x(Q,o.value,a.value,L);o.value=Z,a.value=q}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=B(),i.value.visibleImageLayer=B({image:Q}),i.value.drawLayer=R();const V=o.value*i.value.imageScale,P=a.value*i.value.imageScale;M.params.width=V-V%64,M.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,D(),O()})}function O(){const z=Pn();if(!i.value.imageLayer||!i.value.drawLayer)return;const M=i.value.imageLayer.getCenter().left-z.params.width/2,L=z.params.width,Q=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:M,top:Q,width:L,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||m.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function D(){if(!i.value.canvas)return;const z=Pn();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=B({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,D(),A=void 0},5e3))}function N(z,M){const L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Jn.fabric.Image.fromURL(L,Q=>{Q.set({height:z,width:M});const V=Q.toDataURL({format:"png"});l.value.sourceImage=V,m.value=!0,T(Q)})}function R({image:z,layerWidth:M,layerHeight:L}={}){const Q=new Jn.fabric.Canvas(null);return Q.selection=!1,Q.backgroundColor=i.value.maskBackgroundColor,Q.setHeight(L||a.value),Q.setWidth(M||o.value),z&&Q.add(z),Q}function B({image:z,layerWidth:M,layerHeight:L,fill:Q,abosolute:V}={}){const P=z||new Jn.fabric.Rect({width:M||o.value,height:L||a.value,left:0,top:0,fill:Q||"transparent",absolutePositioned:V||!0,selectable:!1});return new Jn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function U(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),m.value){const z=Pn();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=B(),i.value.drawLayer=R(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ne(){var M;O();const z=document.createElement("a");if(m.value){z.href="data:image/png;base64,"+((M=l.value.sourceImage)==null?void 0:M.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function ee(z){return new Promise((M,L)=>{try{z.clone(M)}catch(Q){L(Q)}})}async function se(z){const M={path:z.path};b({history:M,erase:u.value,draw:m.value}),i.value.redoHistory.push(M)}function I(z){if(!i.value.canvas)return;const M=i.value.canvas.getPointer(z.e);f.left=M.x,f.top=M.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),m.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:m,imageProps:i,updateCropPreview:D,createNewCanvas:S,downloadMask:ne,resetCanvas:E,resetDrawing:U,flipErase:g,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const kH={},EH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},OH=re("g",{fill:"none"},[re("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),AH=[OH];function PH(e,t){return j(),ue("svg",EH,AH)}const IH=Xt(kH,[["render",PH]]);async function MH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(m=>i.onload=m),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function LH(e,t){const n=e.split(";base64,"),r=t!=null?t:n[0].split(":")[1],i=window.atob(r===n[0].split(":")[1]?n[1]:(await MH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let m=0;m{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const tg=e=>(Jr("data-v-d200c279"),e=e(),Qr(),e),RH=tg(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),DH={key:0},$H=tg(()=>re("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),BH={class:"canvas-container"},FH=tg(()=>re("canvas",{id:"canvas"},null,-1)),zH={class:"action-buttons",style:{left:"10px",right:"unset"}},NH={class:"action-buttons"},jH=Ee({__name:"CustomCanvas",setup(e){const t=Pn(),n=$t(),r=ms(),i=oe();async function l(o){if(!o.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const a=await i2(o.raw);t.currentImageProps.sourceImage=a,r.drawing=!1,Jn.fabric.Image.fromURL(a,r.newImage)}function m(){t.currentImageProps.sourceImage="",r.resetCanvas()}return qe(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Jn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(o,a)=>(j(),ue(ze,null,[C(t).currentImageProps.sourceImage?_e("",!0):(j(),we(C(Ip),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ue("div",DH,[$H,re("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:a[0]||(a[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(De),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[le(t2)]),_:1}),Ue("draw something")])])):_e("",!0)]),default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Gh))]),_:1}),RH]),_:1},512)),gt(re("div",null,[re("div",BH,[FH,re("div",zH,[le(C(st),{onClick:a[1]||(a[1]=u=>C(r).undoAction()),icon:C(qb),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(st),{onClick:a[2]||(a[2]=u=>C(r).redoAction()),icon:C(Zb),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),re("div",NH,[le(C(st),{onClick:a[3]||(a[3]=u=>C(r).resetDrawing()),icon:C(wr),plain:""},null,8,["icon"]),le(C(st),{onClick:m,icon:C(Oc),plain:""},null,8,["icon"]),le(C(st),{onClick:a[4]||(a[4]=u=>C(r).downloadMask()),icon:C(Is),plain:""},null,8,["icon"]),le(C(st),{onClick:a[5]||(a[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(xE):IH,plain:""},null,8,["icon"]),C(r).drawing?(j(),we(C(aB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":a[6]||(a[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):_e("",!0)]),le(C(Tp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[le(kn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":a[7]||(a[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const E0=Xt(jH,[["__scopeId","data-v-d200c279"]]),VH={class:"centerIcons"},UH={class:"stackedIcons"},HH=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return sx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ue("div",VH,[re("div",UH,[le(C(De),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),we(bt(t.iconOne)))]),_:1},8,["size"]),le(C(De),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),we(bt(t.iconTwo)))]),_:1},8,["size"])])]))}});const WH=Xt(HH,[["__scopeId","data-v-74586a39"]]),YH={key:1,style:{width:"40px"}},nu=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),we(C(kr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(Op),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),we(WH,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ue("div",YH,[le(C(De),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),we(bt(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const XH=4,O0=0,A0=1,KH=2;function Lo(e){let t=e.length;for(;--t>=0;)e[t]=0}const GH=0,a2=1,qH=2,ZH=3,JH=258,ng=29,Sl=256,Js=Sl+1+ng,ro=30,rg=19,o2=2*Js+1,oa=15,Rf=16,QH=7,ig=256,s2=16,l2=17,u2=18,uh=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Iu=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),eW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),c2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tW=512,Fr=new Array((Js+2)*2);Lo(Fr);const vs=new Array(ro*2);Lo(vs);const Qs=new Array(tW);Lo(Qs);const el=new Array(JH-ZH+1);Lo(el);const ag=new Array(ng);Lo(ag);const lc=new Array(ro);Lo(lc);function Df(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let f2,d2,h2;function $f(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const p2=e=>e<256?Qs[e]:Qs[256+(e>>>7)],tl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},yn=(e,t,n)=>{e.bi_valid>Rf-n?(e.bi_buf|=t<>Rf-e.bi_valid,e.bi_valid+=n-Rf):(e.bi_buf|=t<{yn(e,n[t*2],n[t*2+1])},g2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},nW=e=>{e.bi_valid===16?(tl(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},rW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,m=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,h,c,f,s,d,v=0;for(f=0;f<=oa;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ua&&(f=a,v++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=o&&(s=m[h-o]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(v!==0){do{for(f=a-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[a]--,v-=2}while(v>0);for(f=a;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},m2=(e,t,n)=>{const r=new Array(oa+1);let i=0,l,m;for(l=1;l<=oa;l++)i=i+n[l-1]<<1,r[l]=i;for(m=0;m<=t;m++){let o=e[m*2+1];o!==0&&(e[m*2]=g2(r[o]++,o))}},iW=()=>{let e,t,n,r,i;const l=new Array(oa+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?tl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,m,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?gr(e,i,t):(m=el[i],gr(e,m+Sl+1,t),o=uh[m],o!==0&&(i-=ag[m],yn(e,i,o)),r--,m=p2(r),gr(e,m,n),o=Iu[m],o!==0&&(r-=lc[m],yn(e,r,o)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let m,o,a=-1,u;for(e.heap_len=0,e.heap_max=o2,m=0;m>1;m>=1;m--)Bf(e,n,m);u=l;do m=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Bf(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=m,e.heap[--e.heap_max]=o,n[u*2]=n[m*2]+n[o*2],e.depth[u]=(e.depth[m]>=e.depth[o]?e.depth[m]:e.depth[o])+1,n[m*2+1]=n[o*2+1]=u,e.heap[1]=u++,Bf(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],rW(e,t),m2(n,a,e.bl_count)},M0=(e,t,n)=>{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=m,m=t[(r+1)*2+1],!(++o{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),r=0;r<=n;r++)if(l=m,m=t[(r+1)*2+1],!(++o{let t;for(M0(e,e.dyn_ltree,e.l_desc.max_code),M0(e,e.dyn_dtree,e.d_desc.max_code),ch(e,e.bl_desc),t=rg-1;t>=3&&e.bl_tree[c2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},oW=(e,t,n,r)=>{let i;for(yn(e,t-257,5),yn(e,n-1,5),yn(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return O0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return A0;for(n=32;n{R0||(iW(),R0=!0),e.l_desc=new $f(e.dyn_ltree,f2),e.d_desc=new $f(e.dyn_dtree,d2),e.bl_desc=new $f(e.bl_tree,h2),e.bi_buf=0,e.bi_valid=0,v2(e)},b2=(e,t,n,r)=>{yn(e,(GH<<1)+(r?1:0),3),y2(e),tl(e,n),tl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},uW=e=>{yn(e,a2<<1,3),gr(e,ig,Fr),nW(e)},cW=(e,t,n,r)=>{let i,l,m=0;e.level>0?(e.strm.data_type===KH&&(e.strm.data_type=sW(e)),ch(e,e.l_desc),ch(e,e.d_desc),m=aW(e),i=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=i&&(i=l)):i=l=n+5,n+4<=i&&t!==-1?b2(e,t,n,r):e.strategy===XH||l===i?(yn(e,(a2<<1)+(r?1:0),3),I0(e,Fr,vs)):(yn(e,(qH<<1)+(r?1:0),3),oW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,m+1),I0(e,e.dyn_ltree,e.dyn_dtree)),v2(e),r&&y2(e)},fW=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(el[n]+Sl+1)*2]++,e.dyn_dtree[p2(t)*2]++),e.sym_next===e.sym_end);var dW=lW,hW=b2,pW=cW,gW=fW,mW=uW,vW={_tr_init:dW,_tr_stored_block:hW,_tr_flush_block:pW,_tr_tally:gW,_tr_align:mW};const yW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,m=0;for(;n!==0;){m=n>2e3?2e3:n,n-=m;do i=i+t[r++]|0,l=l+i|0;while(--m);i%=65521,l%=65521}return i|l<<16|0};var nl=yW;const bW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},_W=new Uint32Array(bW()),wW=(e,t,n,r)=>{const i=_W,l=r+n;e^=-1;for(let m=r;m>>8^i[(e^t[m])&255];return e^-1};var Ut=wW,Ca={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ro={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:CW,_tr_stored_block:fh,_tr_flush_block:SW,_tr_tally:Ti,_tr_align:xW}=vW,{Z_NO_FLUSH:ki,Z_PARTIAL_FLUSH:TW,Z_FULL_FLUSH:kW,Z_FINISH:jn,Z_BLOCK:D0,Z_OK:Gt,Z_STREAM_END:$0,Z_STREAM_ERROR:br,Z_DATA_ERROR:EW,Z_BUF_ERROR:Ff,Z_DEFAULT_COMPRESSION:OW,Z_FILTERED:AW,Z_HUFFMAN_ONLY:ru,Z_RLE:PW,Z_FIXED:IW,Z_DEFAULT_STRATEGY:MW,Z_UNKNOWN:LW,Z_DEFLATED:Hc}=Ro,RW=9,DW=15,$W=8,BW=29,FW=256,dh=FW+1+BW,zW=30,NW=19,jW=2*dh+1,VW=15,nt=3,wi=258,_r=wi+nt+1,UW=32,bo=42,og=57,hh=69,ph=73,gh=91,mh=103,sa=113,Zo=666,dn=1,Do=2,Sa=3,$o=4,HW=3,la=(e,t)=>(e.msg=Ca[t],t),B0=e=>e*2-(e>4?9:0),yi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},WW=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let YW=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Mn=(e,t)=>{SW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,En(e.strm)},ct=(e,t)=>{e.pending_buf[e.pending++]=t},Wo=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},vh=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=nl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Ut(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},_2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,m=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-_r?e.strstart-(e.w_size-_r):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+wi;let s=u[r+m-1],d=u[r+m];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+m]!==d||u[i+m-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rm){if(e.match_start=t,m=l,l>=o)break;s=u[r+m-1],d=u[r+m]}}while((t=c[t&h])>a&&--n!==0);return m<=e.lookahead?m:e.lookahead},_o=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-_r)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),WW(e),r+=t),e.strm.avail_in===0)break;if(n=vh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=nt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+nt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,m=0,o=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,En(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(vh(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(m===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(vh(e.strm,e.window,e.strstart,l),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.high_water>3,l=e.pending_buf_size-l>65535?65535:e.pending_buf_size-l,n=l>e.w_size?e.w_size:l,i=e.strstart-e.block_start,(i>=n||(i||t===jn)&&t!==ki&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,m=t===jn&&e.strm.avail_in===0&&r===i?1:0,fh(e,e.block_start,r,m),e.block_start+=r,En(e.strm)),m?Sa:dn)},zf=(e,t)=>{let n,r;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-_r&&(e.match_length=_2(e,n)),e.match_length>=nt)if(r=Ti(e,e.strstart-e.match_start,e.match_length-nt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=nt){e.match_length--;do e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else r=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Mn(e,!1),e.strm.avail_out===0))return dn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=nt-1,n!==0&&e.prev_length4096)&&(e.match_length=nt-1)),e.prev_length>=nt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-nt,r=Ti(e,e.strstart-1-e.prev_match,e.prev_length-nt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=nt-1,e.strstart++,r&&(Mn(e,!1),e.strm.avail_out===0))return dn}else if(e.match_available){if(r=Ti(e,0,e.window[e.strstart-1]),r&&Mn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return dn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ti(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const m=e.window;for(;;){if(e.lookahead<=wi){if(_o(e),e.lookahead<=wi&&t===ki)return dn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=nt&&e.strstart>0&&(i=e.strstart-1,r=m[i],r===m[++i]&&r===m[++i]&&r===m[++i])){l=e.strstart+wi;do;while(r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=nt?(n=Ti(e,1,e.match_length-nt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Mn(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Mn(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Mn(e,!1),e.strm.avail_out===0)?dn:Do},KW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(_o(e),e.lookahead===0)){if(t===ki)return dn;break}if(e.match_length=0,n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Mn(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Mn(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Mn(e,!1),e.strm.avail_out===0)?dn:Do};function fr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Jo=[new fr(0,0,0,0,w2),new fr(4,4,8,4,zf),new fr(4,5,16,8,zf),new fr(4,6,32,32,zf),new fr(4,4,16,16,Ua),new fr(8,16,32,32,Ua),new fr(8,16,128,128,Ua),new fr(8,32,128,256,Ua),new fr(32,128,258,1024,Ua),new fr(32,258,258,4096,Ua)],GW=e=>{e.window_size=2*e.w_size,yi(e.head),e.max_lazy_match=Jo[e.level].max_lazy,e.good_match=Jo[e.level].good_length,e.nice_match=Jo[e.level].nice_length,e.max_chain_length=Jo[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=nt-1,e.match_available=0,e.ins_h=0};function qW(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Hc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(jW*2),this.dyn_dtree=new Uint16Array((2*zW+1)*2),this.bl_tree=new Uint16Array((2*NW+1)*2),yi(this.dyn_ltree),yi(this.dyn_dtree),yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(VW+1),this.heap=new Uint16Array(2*dh+1),yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*dh+1),yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const xl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bo&&t.status!==og&&t.status!==hh&&t.status!==ph&&t.status!==gh&&t.status!==mh&&t.status!==sa&&t.status!==Zo?1:0},C2=e=>{if(xl(e))return la(e,br);e.total_in=e.total_out=0,e.data_type=LW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?og:t.wrap?bo:sa,e.adler=t.wrap===2?0:1,t.last_flush=-2,CW(t),Gt},S2=e=>{const t=C2(e);return t===Gt&&GW(e.state),t},ZW=(e,t)=>xl(e)||e.state.wrap!==2?br:(e.state.gzhead=t,Gt),x2=(e,t,n,r,i,l)=>{if(!e)return br;let m=1;if(t===OW&&(t=6),r<0?(m=0,r=-r):r>15&&(m=2,r-=16),i<1||i>RW||n!==Hc||r<8||r>15||t<0||t>9||l<0||l>IW||r===8&&m!==1)return la(e,br);r===8&&(r=9);const o=new qW;return e.state=o,o.strm=e,o.status=bo,o.wrap=m,o.gzhead=null,o.w_bits=r,o.w_size=1<x2(e,t,Hc,DW,$W,MW),QW=(e,t)=>{if(xl(e)||t>D0||t<0)return e?la(e,br):br;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Zo&&t!==jn)return la(e,e.avail_out===0?Ff:br);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(En(e),e.avail_out===0)return n.last_flush=-1,Gt}else if(e.avail_in===0&&B0(t)<=B0(r)&&t!==jn)return la(e,Ff);if(n.status===Zo&&e.avail_in!==0)return la(e,Ff);if(n.status===bo&&n.wrap===0&&(n.status=sa),n.status===bo){let i=Hc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=ru||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=UW),i+=31-i%31,Wo(n,i),n.strstart!==0&&(Wo(n,e.adler>>>16),Wo(n,e.adler&65535)),e.adler=1,n.status=sa,En(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===og){if(e.adler=0,ct(n,31),ct(n,139),ct(n,8),n.gzhead)ct(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ct(n,n.gzhead.time&255),ct(n,n.gzhead.time>>8&255),ct(n,n.gzhead.time>>16&255),ct(n,n.gzhead.time>>24&255),ct(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),ct(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ct(n,n.gzhead.extra.length&255),ct(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ut(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=hh;else if(ct(n,0),ct(n,0),ct(n,0),ct(n,0),ct(n,0),ct(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),ct(n,HW),n.status=sa,En(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===hh){if(n.gzhead.extra){let i=n.pending,l=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,En(e),n.pending!==0)return n.last_flush=-1,Gt;i=0,l-=o}let m=new Uint8Array(n.gzhead.extra);n.pending_buf.set(m.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=ph}if(n.status===ph){if(n.gzhead.name){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),En(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=gh}if(n.status===gh){if(n.gzhead.comment){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),En(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i))}n.status=mh}if(n.status===mh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(En(e),n.pending!==0))return n.last_flush=-1,Gt;ct(n,e.adler&255),ct(n,e.adler>>8&255),e.adler=0}if(n.status=sa,En(e),n.pending!==0)return n.last_flush=-1,Gt}if(e.avail_in!==0||n.lookahead!==0||t!==ki&&n.status!==Zo){let i=n.level===0?w2(n,t):n.strategy===ru?KW(n,t):n.strategy===PW?XW(n,t):Jo[n.level].func(n,t);if((i===Sa||i===$o)&&(n.status=Zo),i===dn||i===Sa)return e.avail_out===0&&(n.last_flush=-1),Gt;if(i===Do&&(t===TW?xW(n):t!==D0&&(fh(n,0,0,!1),t===kW&&(yi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),En(e),e.avail_out===0))return n.last_flush=-1,Gt}return t!==jn?Gt:n.wrap<=0?$0:(n.wrap===2?(ct(n,e.adler&255),ct(n,e.adler>>8&255),ct(n,e.adler>>16&255),ct(n,e.adler>>24&255),ct(n,e.total_in&255),ct(n,e.total_in>>8&255),ct(n,e.total_in>>16&255),ct(n,e.total_in>>24&255)):(Wo(n,e.adler>>>16),Wo(n,e.adler&65535)),En(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Gt:$0)},eY=e=>{if(xl(e))return br;const t=e.state.status;return e.state=null,t===sa?la(e,EW):Gt},tY=(e,t)=>{let n=t.length;if(xl(e))return br;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bo||r.lookahead)return br;if(i===1&&(e.adler=nl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(yi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(t.subarray(n-r.w_size,n),0),t=a,n=r.w_size}const l=e.avail_in,m=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,_o(r);r.lookahead>=nt;){let a=r.strstart,u=r.lookahead-(nt-1);do r.ins_h=Ei(r,r.ins_h,r.window[a+nt-1]),r.prev[a&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=a,a++;while(--u);r.strstart=a,r.lookahead=nt-1,_o(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=nt-1,r.match_available=0,e.next_in=m,e.input=o,e.avail_in=l,r.wrap=i,Gt};var nY=JW,rY=x2,iY=S2,aY=C2,oY=ZW,sY=QW,lY=eY,uY=tY,cY="pako deflate (from Nodeca project)",ys={deflateInit:nY,deflateInit2:rY,deflateReset:iY,deflateResetKeep:aY,deflateSetHeader:oY,deflate:sY,deflateEnd:lY,deflateSetDictionary:uY,deflateInfo:cY};const fY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var dY=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)fY(n,r)&&(e[r]=n[r])}}return e},hY=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;rl[254]=rl[254]=1;var pY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,m=e.length,o=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const gY=(e,t)=>{if(t<65534&&e.subarray&&T2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=o-1;continue}for(m&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}m<65536?l[i++]=m:(m-=65536,l[i++]=55296|m>>10&1023,l[i++]=56320|m&1023)}return gY(l,i)},vY=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+rl[e[n]]>t?n:t},il={string2buf:pY,buf2string:mY,utf8border:vY};function yY(){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}var k2=yY;const E2=Object.prototype.toString,{Z_NO_FLUSH:bY,Z_SYNC_FLUSH:_Y,Z_FULL_FLUSH:wY,Z_FINISH:CY,Z_OK:uc,Z_STREAM_END:SY,Z_DEFAULT_COMPRESSION:xY,Z_DEFAULT_STRATEGY:TY,Z_DEFLATED:kY}=Ro;function Tl(e){this.options=Wc.assign({level:xY,method:kY,chunkSize:16384,windowBits:15,memLevel:8,strategy:TY},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k2,this.strm.avail_out=0;let n=ys.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==uc)throw new Error(Ca[n]);if(t.header&&ys.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=il.string2buf(t.dictionary):E2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=ys.deflateSetDictionary(this.strm,r),n!==uc)throw new Error(Ca[n]);this._dict_set=!0}}Tl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,l;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?CY:bY,typeof e=="string"?n.input=il.string2buf(e):E2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(l===_Y||l===wY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=ys.deflate(n,l),i===SY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=ys.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===uc;if(n.avail_out===0){this.onData(n.output);continue}if(l>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Tl.prototype.onData=function(e){this.chunks.push(e)};Tl.prototype.onEnd=function(e){e===uc&&(this.result=Wc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function sg(e,t){const n=new Tl(t);if(n.push(e,!0),n.err)throw n.msg||Ca[n.err];return n.result}function EY(e,t){return t=t||{},t.raw=!0,sg(e,t)}function OY(e,t){return t=t||{},t.gzip=!0,sg(e,t)}var AY=Tl,PY=sg,IY=EY,MY=OY,LY=Ro,RY={Deflate:AY,deflate:PY,deflateRaw:IY,gzip:MY,constants:LY};const iu=16209,DY=16191;var $Y=function(t,n){let r,i,l,m,o,a,u,h,c,f,s,d,v,g,y,b,_,w,S,x,T,O,A,D;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,m=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,v=N.lencode,g=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,da){t.msg="invalid distance too far back",N.mode=iu;break e}if(s>>>=w,d-=w,w=l-m,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=iu;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)D[l++]=O[T++],D[l++]=O[T++],D[l++]=O[T++],S-=3;S&&(D[l++]=O[T++],S>1&&(D[l++]=O[T++]))}else{T=l-x;do D[l++]=D[T++],D[l++]=D[T++],D[l++]=D[T++],S-=3;while(S>2);S&&(D[l++]=D[T++],S>1&&(D[l++]=D[T++]))}}else if((w&64)===0){_=g[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const a=o.bits;let u=0,h=0,c=0,f=0,s=0,d=0,v=0,g=0,y=0,b=0,_,w,S,x,T,O=null,A;const D=new Uint16Array(Ha+1),N=new Uint16Array(Ha+1);let R=null,B,E,U;for(u=0;u<=Ha;u++)D[u]=0;for(h=0;h=1&&D[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,o.bits=1,0;for(c=1;c0&&(e===N0||f!==1))return-1;for(N[1]=0,u=1;uF0||e===j0&&y>z0)return 1;for(;;){B=u-v,m[h]+1=A?(E=R[m[h]-A],U=O[m[h]-A]):(E=32+64,U=0),_=1<>v)+w]=B<<24|E<<16|U|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--D[u]===0){if(u===f)break;u=t[n+m[h]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),T+=c,d=u-v,g=1<F0||e===j0&&y>z0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-v<<24|64<<16|0),o.bits=s,0};var bs=jY;const VY=0,O2=1,A2=2,{Z_FINISH:V0,Z_BLOCK:UY,Z_TREES:au,Z_OK:xa,Z_STREAM_END:HY,Z_NEED_DICT:WY,Z_STREAM_ERROR:Xn,Z_DATA_ERROR:P2,Z_MEM_ERROR:I2,Z_BUF_ERROR:YY,Z_DEFLATED:U0}=Ro,Yc=16180,H0=16181,W0=16182,Y0=16183,X0=16184,K0=16185,G0=16186,q0=16187,Z0=16188,J0=16189,cc=16190,Mr=16191,jf=16192,Q0=16193,Vf=16194,ey=16195,ty=16196,ny=16197,ry=16198,ou=16199,su=16200,iy=16201,ay=16202,oy=16203,sy=16204,ly=16205,Uf=16206,uy=16207,cy=16208,It=16209,M2=16210,L2=16211,XY=852,KY=592,GY=15,qY=GY,fy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function ZY(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Da=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeL2?1:0},R2=e=>{if(Da(e))return Xn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Yc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(XY),t.distcode=t.distdyn=new Int32Array(KY),t.sane=1,t.back=-1,xa},D2=e=>{if(Da(e))return Xn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,R2(e)},$2=(e,t)=>{let n;if(Da(e))return Xn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Xn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,D2(e))},B2=(e,t)=>{if(!e)return Xn;const n=new ZY;e.state=n,n.strm=e,n.window=null,n.mode=Yc;const r=$2(e,t);return r!==xa&&(e.state=null),r},JY=e=>B2(e,qY);let dy=!0,Hf,Wf;const QY=e=>{if(dy){Hf=new Int32Array(512),Wf=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(bs(O2,e.lens,0,288,Hf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;bs(A2,e.lens,0,32,Wf,0,e.work,{bits:5}),dy=!1}e.lencode=Hf,e.lenbits=9,e.distcode=Wf,e.distbits=5},F2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,m,o,a,u,h,c,f,s,d,v,g=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let D,N;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Da(e)||!e.output||!e.input&&e.avail_in!==0)return Xn;n=e.state,n.mode===Mr&&(n.mode=jf),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,c=o,f=a,O=xa;e:for(;;)switch(n.mode){case Yc:if(n.wrap===0){n.mode=jf;break}for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Ut(n.check,A,2,0),u=0,h=0,n.mode=H0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=It;break}if((u&15)!==U0){e.msg="unknown compression method",n.mode=It;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=It;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Ut(n.check,A,2,0)),u=0,h=0,n.mode=W0;case W0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Ut(n.check,A,4,0)),u=0,h=0,n.mode=Y0;case Y0:for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Ut(n.check,A,2,0)),u=0,h=0,n.mode=X0;case X0:if(n.flags&1024){for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Ut(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=K0;case K0:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Ut(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=G0;case G0:if(n.flags&2048){if(o===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Mr;break;case J0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Uf;break}for(;h<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=Q0;break;case 1:if(QY(n),n.mode=ou,t===au){u>>>=2,h-=2;break e}break;case 2:n.mode=ty;break;case 3:e.msg="invalid block type",n.mode=It}u>>>=2,h-=2;break;case Q0:for(u>>>=h&7,h-=h&7;h<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=It;break}if(n.length=u&65535,u=0,h=0,n.mode=Vf,t===au)break e;case Vf:n.mode=ey;case ey:if(s=n.length,s){if(s>o&&(s=o),s>a&&(s=a),s===0)break e;i.set(r.subarray(l,l+s),m),o-=s,l+=s,a-=s,m+=s,n.length-=s;break}n.mode=Mr;break;case ty:for(;h<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=It;break}n.have=0,n.mode=ny;case ny:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},O=bs(VY,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid code lengths set",n.mode=It;break}n.have=0,n.mode=ry;case ry:for(;n.have>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=It;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=It;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===It)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=It;break}if(n.lenbits=9,D={bits:n.lenbits},O=bs(O2,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid literal/lengths set",n.mode=It;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},O=bs(A2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,O){e.msg="invalid distances set",n.mode=It;break}if(n.mode=ou,t===au)break e;case ou:n.mode=su;case su:if(o>=6&&a>=258){e.next_out=m,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=h,$Y(e,f),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,n.mode===Mr&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=ly;break}if(b&32){n.back=-1,n.mode=Mr;break}if(b&64){e.msg="invalid literal/length code",n.mode=It;break}n.extra=b&15,n.mode=iy;case iy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ay;case ay:for(;g=n.distcode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=It;break}n.offset=_,n.extra=b&15,n.mode=oy;case oy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=It;break}n.mode=sy;case sy:if(a===0)break e;if(s=f-a,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=It;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,d=m-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[m++]=v[d++];while(--s);n.length===0&&(n.mode=su);break;case ly:if(a===0)break e;i[m++]=n.length,a--,n.mode=su;break;case Uf:if(n.wrap){for(;h<32;){if(o===0)break e;o--,u|=r[l++]<{if(Da(e))return Xn;let t=e.state;return t.window&&(t.window=null),e.state=null,xa},nX=(e,t)=>{if(Da(e))return Xn;const n=e.state;return(n.wrap&2)===0?Xn:(n.head=t,t.done=!1,xa)},rX=(e,t)=>{const n=t.length;let r,i,l;return Da(e)||(r=e.state,r.wrap!==0&&r.mode!==cc)?Xn:r.mode===cc&&(i=1,i=nl(i,t,n,0),i!==r.check)?P2:(l=F2(e,t,n,n),l?(r.mode=M2,I2):(r.havedict=1,xa))};var iX=D2,aX=$2,oX=R2,sX=JY,lX=B2,uX=eX,cX=tX,fX=nX,dX=rX,hX="pako inflate (from Nodeca project)",zr={inflateReset:iX,inflateReset2:aX,inflateResetKeep:oX,inflateInit:sX,inflateInit2:lX,inflate:uX,inflateEnd:cX,inflateGetHeader:fX,inflateSetDictionary:dX,inflateInfo:hX};function pX(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gX=pX;const z2=Object.prototype.toString,{Z_NO_FLUSH:mX,Z_FINISH:vX,Z_OK:al,Z_STREAM_END:Yf,Z_NEED_DICT:Xf,Z_STREAM_ERROR:yX,Z_DATA_ERROR:hy,Z_MEM_ERROR:bX}=Ro;function kl(e){this.options=Wc.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k2,this.strm.avail_out=0;let n=zr.inflateInit2(this.strm,t.windowBits);if(n!==al)throw new Error(Ca[n]);if(this.header=new gX,zr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=il.string2buf(t.dictionary):z2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=zr.inflateSetDictionary(this.strm,t.dictionary),n!==al)))throw new Error(Ca[n])}kl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,m,o;if(this.ended)return!1;for(t===~~t?m=t:m=t===!0?vX:mX,z2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),l=zr.inflate(n,m),l===Xf&&i&&(l=zr.inflateSetDictionary(n,i),l===al?l=zr.inflate(n,m):l===hy&&(l=Xf));n.avail_in>0&&l===Yf&&n.state.wrap>0&&e[n.next_in]!==0;)zr.inflateReset(n),l=zr.inflate(n,m);switch(l){case yX:case hy:case Xf:case bX:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===Yf))if(this.options.to==="string"){let a=il.utf8border(n.output,n.next_out),u=n.next_out-a,h=il.buf2string(n.output,a);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(a,a+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===al&&o===0)){if(l===Yf)return l=zr.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};kl.prototype.onData=function(e){this.chunks.push(e)};kl.prototype.onEnd=function(e){e===al&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function lg(e,t){const n=new kl(t);if(n.push(e),n.err)throw n.msg||Ca[n.err];return n.result}function _X(e,t){return t=t||{},t.raw=!0,lg(e,t)}var wX=kl,CX=lg,SX=_X,xX=lg,TX=Ro,kX={Inflate:wX,inflate:CX,inflateRaw:SX,ungzip:xX,constants:TX};const{Deflate:wG,deflate:CG,deflateRaw:EX,gzip:SG}=RY,{Inflate:xG,inflate:TG,inflateRaw:OX,ungzip:kG}=kX;var AX=EX,PX=OX;function py(e){const t=new Map;for(const n of e){const[r,i]=n.split("="),l=decodeURIComponent(i);t.set(r,l)}return t}const IX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=py(t);if(console.log("URL params:",n),n.get("share")){const l=PX(new Uint8Array(atob(n.get("share")).split("").map(m=>m.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=py(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||20),cfg_scale:Number(n.get("cfg_scale")||5),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0),frames:Number(n.get("frames")||1),scheduler:n.get("scheduler")||"default"};Pn().generateText2Img(r,!1)},MX=10;function yh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(m=>`${m[0]} - ${m[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const LX=Co("interrogate",()=>{const e=oe({}),t=oe(!1);async function n(m){$t().raiseError(m,!1),t.value=!1,e.value={}}async function r(){const m=rn(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!yh(a,u,200,"Failed to get interrogation",n)||(e.value.id=u.id,e.value.status=u.caption)}function i(){e.value={},t.value=!1}function l(){return e.value.status||!1}return{currentInterrogation:e,interrogating:t,interrogateImage:r,getFormStatus:l,resetInterrogation:i}}),ug=e=>(Jr("data-v-db184ac6"),e=e(),Qr(),e),RX={key:0,style:{"margin-top":"16px"}},DX=ug(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),$X={key:1,style:{"margin-top":"16px"}},BX={key:2},FX={style:{"margin-top":"8px"}},zX=ug(()=>re("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),NX={key:0},jX=ug(()=>re("h3",null,"Caption",-1)),VX={key:0},UX={key:1},HX=Ee({__name:"InterrogationView",setup(e){const t=LX(),n=Pn(),r=$t(),i=oe();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await i2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function m(){n.generateText2Img({prompt:o.value})}const o=te(()=>t.getFormStatus()),{ellipsis:a}=n2();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ue("div",BX,[re("div",FX,[le(C(st),{icon:C(os),onClick:C(t).resetInterrogation},{default:pe(()=>[Ue("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(j(),we(C(st),{key:0,icon:C(os),onClick:m,disabled:!C(o)},{default:pe(()=>[Ue("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):_e("",!0)]),zX,le(C(kp),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(j(),ue("div",NX,[jX,C(o)?(j(),ue("div",UX,[re("strong",null,Pe(C(o)),1)])):(j(),ue("div",VX,"Processing"+Pe(C(a)),1))])):_e("",!0)])):(j(),ue("div",$X,[re("strong",null,"Uploading image"+Pe(C(a)),1)])):(j(),ue("div",RX,[re("div",null,[le(C(Ip),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Gh))]),_:1}),DX]),_:1},512)])]))}});const WX=Xt(HX,[["__scopeId","data-v-db184ac6"]]);function YX(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),m=Math.floor(e%86400%3600%60),o=r>0?r+(t?"d":"days"):"",a=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=m>0?m+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(o),n!=null&&n.hours&&c.push(a),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const XX={class:"form"},KX={key:0,style:{"padding-bottom":"50px"}},GX=re("h1",{style:{margin:"0"}},"Interrogation",-1),qX=re("div",null,"Interrogate images to get their predicted descriptions.",-1),ZX={class:"sidebar"},JX=re("span",{style:{height:"100%","font-size":"14px"}},[Ue("Reference Image: "),re("br"),Ue("(Photomaker/Kontext) ")],-1),QX=re("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),eK={class:"main"},tK={class:"image center-horizontal"},nK={key:0},rK=Ee({__name:"GenerateView",setup(e){const n=cp(up).smallerOrEqual("md"),r=Pn(),i=$t(),l=ms(),m=rn();let o=[];const a=iI(async()=>{if(o.length===0)try{o=(await(await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/samplers`)).json()).map(g=>g.name)}catch{o=[]}return o.length===0?[]:c(o)}),u=["default","discrete","karras","exponential","ays","gits","sgm_uniform","simple","smoothstep"],h=wt({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function c(g){return!r.params||!r.params.sampler_name||g.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=g[0]),g}function f(g){return"Elapsed: "+YX(g,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function s(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function d(g){r.generatorType=g,s(),console.log(g)}function v(){l.showCropPreview=!0,l.updateCropPreview()}return s(),IX(),(g,y)=>(j(),ue(ze,null,[le(C(X1),{"default-active":C(r).generatorType,collapse:!0,onSelect:d,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[le(nu,{index:"Text2Img","icon-one":C(Wk),"icon-two":C($l),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Img2Img","icon-one":C($l),"icon-two":C($l),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Inpainting","icon-one":t2,"icon-two":C($l),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(nu,{index:"Interrogation","icon-one":GU,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),re("div",XX,[C(r).generatorType==="Interrogation"?(j(),ue("div",KX,[GX,qX,le(WX)])):(j(),we(C(Tp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:h,onSubmit:y[28]||(y[28]=Je(()=>{},["prevent"]))},{default:pe(()=>[re("div",ZX,[le(C(R$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":y[23]||(y[23]=b=>C(i).activeCollapse=b),style:{"margin-bottom":"24px"}},{default:pe(()=>[le(C(D$),{title:"Generation Options",name:"1"},{default:pe(()=>[le(hH),le(lh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":y[0]||(y[0]=b=>C(r).negativePrompt=b),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),le(lh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":y[2]||(y[2]=b=>C(r).params.seed=b),placeholder:"Enter seed here"},{append:pe(()=>[le(C(kr),{content:"Randomize!",placement:"top"},{default:pe(()=>[le(C(st),{icon:C(f3),onClick:y[1]||(y[1]=()=>C(r).params.seed=C(N2)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue"]),C(r).multiSelect.sampler.enabled?(j(),we(Pu,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":y[3]||(y[3]=b=>C(r).multiSelect.sampler.selected=b),options:C(a),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),we(Pu,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":y[4]||(y[4]=b=>C(r).params.sampler_name=b),options:C(a),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])),le(kn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":y[5]||(y[5]=b=>C(r).params.n=b),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),we(kn,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":y[6]||(y[6]=b=>C(r).multiSelect.steps.selected=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(kn,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":y[7]||(y[7]=b=>C(r).params.steps=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),le(kn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":y[8]||(y[8]=b=>C(r).params.width=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),le(kn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":y[9]||(y[9]=b=>C(r).params.height=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),we(kn,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":y[10]||(y[10]=b=>C(r).multiSelect.guidance.selected=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(kn,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":y[11]||(y[11]=b=>C(r).params.cfg_scale=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),we(kn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":y[12]||(y[12]=b=>C(r).multiSelect.clipSkip.selected=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(kn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":y[13]||(y[13]=b=>C(r).params.clip_skip=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),we(kn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":y[14]||(y[14]=b=>C(r).params.denoising_strength=b),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):_e("",!0),le(kn,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":y[15]||(y[15]=b=>C(r).params.frames=b),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). Max 80 frames, about 5 seconds of video."},null,8,["modelValue","min","max"]),le(Pu,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":y[16]||(y[16]=b=>C(r).params.scheduler=b),options:u,info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue"]),re("div",null,[JX,re("input",{class:"el-button",type:"file",id:"extra_image_input",onChange:y[17]||(y[17]=b=>C(r).setExtraImage(b)),accept:"image/*",multiple:""},null,32),re("button",{onClick:y[18]||(y[18]=b=>C(r).clearExtraImage()),class:"el-button"},"Clear Image")]),QX,le(C(vj),null,{default:pe(()=>[le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":y[19]||(y[19]=b=>C(r).multiSelect.sampler.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":y[20]||(y[20]=b=>C(r).multiSelect.guidance.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":y[21]||(y[21]=b=>C(r).multiSelect.clipSkip.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":y[22]||(y[22]=b=>C(r).multiSelect.steps.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),re("div",eK,[le(C(st),{onClick:y[24]||(y[24]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:pe(()=>[Ue("Reset")]),_:1}),le(C(st),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:y[25]||(y[25]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[re("span",null," Generate "+Pe(C(r).totalImageCount)+" image"+Pe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),we(C(st),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:y[26]||(y[26]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue()})},{default:pe(()=>[Ue("Cancel all")]),_:1},8,["disabled"])):_e("",!0)]),re("div",tK,[le(C($D),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ue("div",nK,[/Inpainting/.test(C(r).generatorType)?(j(),we(E0,{key:0})):_e("",!0),/Img2Img/.test(C(r).generatorType)?(j(),we(E0,{key:1})):_e("",!0)])):_e("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),we(rH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:f(C(r).timer.seconds),onShowGenerated:y[27]||(y[27]=b=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):_e("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),we(SH,{key:2})):_e("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const _s=MT({history:Gx("./"),routes:[{path:"/",name:"generate",component:rK},{path:"/images",name:"images",component:()=>Mf(()=>Promise.resolve().then(()=>JK),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>Mf(()=>Promise.resolve().then(()=>fG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>Mf(()=>Promise.resolve().then(()=>bG),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Kf(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,scheduler:"default"}}function N2(){return Math.floor(Math.random()*9999999)+1}const Pn=Co("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=oe("Text2Img"),r=oe(""),i=zn("promptHistory",[]),l=oe(""),m=zn("negativeLibrary",[]),o=oe(Kf()),a=oe({interval:0,seconds:0}),u=oe({sampler:{name:"Sampler",enabled:!1,selected:[o.value.sampler_name],noneMessage:"Failed to generate: No sampler selected.",mapToParam:K=>K.sampler_name},steps:{name:"Steps",enabled:!1,selected:[o.value.steps],noneMessage:"Failed to generate: No steps selected.",mapToParam:K=>K.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[o.value.cfg_scale],noneMessage:"Failed to generate: No guidance selected.",mapToParam:K=>K.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[o.value.clip_skip],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:K=>K.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=oe({...h(),sourceProcessing:"inpainting"}),f=oe({...h(),sourceProcessing:"img2img"}),s=K=>K==="Inpainting"?c.value:K==="Img2Img"?f.value:h(),d=te(()=>s(n.value)),v=oe(""),g=oe(!1),y=oe(!1),b=oe([]),_=oe([]),w=oe(64),S=te(()=>rn().allowLargerParams==="Enabled"?3072:1024),x=oe(1),T=oe(20),O=oe(1),A=te(()=>rn().allowLargerParams==="Enabled"?150:50),D=oe(1),N=oe(24),R=oe(.1),B=oe(1),E=oe(0),U=oe(10),ne=oe(1),ee=oe(80),se=(K,ce,be)=>Array.from({length:(ce-K+1)/be},(Ce,Te)=>(Te+K)*be),I=oe(se(E.value,U.value,1)),z=oe(se(D.value,N.value,.5)),M=te(()=>{const K=(Se,Me,Re=1)=>Se*(Me.enabled?Me.selected.length:Re),be=o.value.n*H().length,Ce=K(be,u.value.sampler),Te=K(Ce,u.value.steps),Ae=K(Te,u.value.guidance);return K(Ae,u.value.clipSkip)});function L(){return o.value=Kf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,Q(),!0}function Q(){_.value=[]}async function V(K){if(!e.includes(K))return[];if(r.value==="")return q("Failed to generate: No prompt submitted.");for(const Ct of Object.values(u.value))if(Ct.enabled&&Ct.selected.length===0)return q(Ct.noneMessage);const ce=ms(),be=$t();ce.saveImages();const{sourceImage:Ce,maskImage:Te,sourceProcessing:Ae}=s(K);F(r.value);const ye=[],Se=(Ct,Ft)=>Ct.enabled?Ct.selected:Ft,Me=H(),Re=Se(u.value.guidance,[o.value.cfg_scale]),dt=Se(u.value.steps,[o.value.steps]),ht=Se(u.value.clipSkip,[o.value.clip_skip]),ot=Se(u.value.sampler,[o.value.sampler_name]),Kt=[await X()];for(const Ct of Re)for(const Ft of dt)for(const Qt of ht)for(const gn of Me){const Bn=gn.split(" ### ");for(const W2 of ot){let Al=parseInt(o.value.seed.toString());(isNaN(Al)||Al<0)&&(Al=N2());for(let Kc=0;Kc0&&(Or.params.extra_images=ae),ye.push(Or)}}}g.value=!0,be.showGeneratedImages=!1;for(let Ct=0;Ct{a.value.seconds++},1e3);!_.value.every(Ct=>Ct.gathered||Ct.failed)&&!y.value;){const Ct=_.value.filter(Qt=>!Qt.gathered&&!Qt.failed),Ft=Jt(Ct);for(const[Qt,gn]of Ct.slice(0,Ft).entries()){if(y.value)break;gn.gathered=!0;try{const Bn=await Y(gn.params);if(!Bn){gn.failed=!0;continue}P([{...Bn,...gn}])}catch(Bn){gn.failed=!0,console.error("Error fetching image:",Bn)}}}}async function P(K){const ce=wa();console.log(K);const be=await Promise.all(K.map(async Ae=>{const ye=Ae.images[0],Me=!!Ae.animated?"gif":"png";return{id:-1,image:`data:image/${Me};base64,${ye}`,prompt:Ae.prompt,clip_skip:Ae.params.clip_skip,modelName:Ae.models[0],seed:Ae.params.seed,steps:Ae.params.steps,sampler_name:Ae.params.sampler_name,cfg_scale:Ae.params.cfg_scale,width:Ae.params.width,height:Ae.params.height,frames:Ae.params.frames,scheduler:Ae.params.scheduler}})),Ce=await ce.pushOutputs(be),Te=0;return b.value=[...Ce.map(Ae=>({type:"image",index:Te,output:Ae})),...b.value].sort((Ae,ye)=>Ae.index-ye.index),b.value.length===_.value.length&&(_.value=[],g.value=!1,$t().showGeneratedImages=!0,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),be}async function q(K){const ce=$t();return K&&ce.raiseError(K,!1),[]}function Z(K,ce,be,Ce){return ce<=be?ce:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${K}' to its default value instead of ${ce}.`,!0),Ce)}function ie(K,ce=!0){const be=Kf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,_s.push("/"),ce&&(K.width=K.width||be.width,K.height=K.height||be.height),K.prompt){const Ce=K.prompt.split(" ### ");r.value=Ce[0],l.value=Ce[1]||""}K.sampler_name&&(o.value.sampler_name=K.sampler_name),K.steps&&(o.value.steps=Z("steps",K.steps,A.value,be.steps)),K.cfg_scale&&(o.value.cfg_scale=K.cfg_scale),K.width&&(o.value.width=Z("width",K.width,S.value,be.width)),K.height&&(o.value.height=Z("height",K.height,S.value,be.height)),K.seed&&(o.value.seed=K.seed),K.clip_skip&&(o.value.clip_skip=Z("clip_skip",K.clip_skip,U.value,be.clip_skip)),K.scheduler&&(o.value.scheduler=K.scheduler),K.frames&&(o.value.frames=Z("frames",K.frames,ee.value,be.frames))}function he(K){const ce=ms();n.value="Img2Img",f.value.sourceImage=K,ce.drawing=!1,b.value=[],_s.push("/"),Jn.fabric.Image.fromURL(K,ce.newImage)}function me(K){const ce=ms();b.value=[],c.value.sourceImage=K,n.value="Inpainting",_s.push("/"),Jn.fabric.Image.fromURL(K,ce.newImage)}function ve(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function H(){const K=ve(),ce=K.match(/\{(.*?)\}/g)||[];if(ce.length===0)return[K];let be=[];return ce.forEach(Ce=>{const Te=[],Ae=Ce.replace("{","").replace("}","").split("|");be.length===0?Ae.forEach(ye=>{const Se=K.replace(Ce,ye);Te.push(Se)}):be.forEach(ye=>{Ae.forEach(Se=>{const Me=ye.replace(Ce,Se);Te.push(Me)})}),be=[...Te]}),be}async function Y(K){const ce=rn();try{const be=await fetch(`${ce.baseURL.length===0?".":ce.baseURL}/sdapi/v1/${K.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}),Ce=await be.json();return yh(be,Ce,200,"Failed to fetch",k)?Ce:!1}catch{return!1}}function k(K){return $t().raiseError(K,!1),y.value=!1,b.value=[],!1}async function X(){const K=rn(),ce=await fetch(`${K.baseURL.length===0?".":K.baseURL}/sdapi/v1/sd-models`),be=await ce.json();if(!!yh(ce,be,200,"Failed to get available models"))return be.length===0?"(No model loaded)":be[0].model_name}function W(K){m.value.indexOf(K)===-1&&(m.value=[...m.value,K])}function $(K){m.value=m.value.filter(ce=>ce!=K)}function F(K){if(i.value.findIndex(ce=>ce.prompt===K)===-1){if(i.value.length>=10+i.value.filter(ce=>ce.starred).length){const ce=i.value.filter(Ce=>!Ce.starred),be=i.value.findIndex(Ce=>Ce===ce[ce.length-1]);i.value.splice(be,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:K}]}}function G(K){i.value=i.value.filter(ce=>ce.prompt!=K&&ce!=K)}function de(){return!1}var ae=[];function J(K){let ce=K.target;if(ae=[],ce.files.length>0)for(let be=0;benew DataView(new ArrayBuffer(e)),$a=e=>new Uint8Array(e.buffer||e),qa=e=>new TextEncoder().encode(String(e));function iK(e,t){if(t===void 0||t instanceof Date||(t=new Date(t)),e instanceof File)return{t:t||new Date(e.lastModified),o:e.stream()};if(e instanceof Response)return{t:t||new Date(e.headers.get("Last-Modified")||Date.now()),o:e.body};if(t===void 0)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(typeof e=="string")return{t,o:qa(e)};if(e instanceof Blob)return{t,o:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{t,o:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{t,o:$a(e)};if(Symbol.asyncIterator in e)return{t,o:j2(e)};throw new TypeError("Unsupported input format.")}function j2(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=0;for(;n.desiredSize>r;){const i=await t.next();if(!i.value){n.close();break}{const l=aK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function aK(e){return typeof e=="string"?qa(e):e instanceof Uint8Array?e:$a(e)}function oK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=qa(t)),e instanceof File)return{i:t||qa(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),m=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||qa(m),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:qa(e).length}:e instanceof Blob?{i:t,A:e.size}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:t,A:e.byteLength}:{i:t,A:n}}var sK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:lK,m:uK}=sK.exports,cK=$a(uK).subarray(65536);function gy(e,t=0){for(const n of function*(r){for(;r.length>65536;)yield r.subarray(0,65536),r=r.subarray(65536);r.length&&(yield r)}(e))cK.set(n),t=lK(n.length,t);return t}function V2(e,t,n=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(n,r,1),t.setUint16(n+2,i,1)}function fK(e){const t=Xc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),V2(e.t,t,10),t.setUint16(26,e.i.length,1),$a(t)}async function*dK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=gy(t,0),e.A=t.length;else{e.A=0;const n=t.getReader();for(;;){const{value:r,done:i}=await n.read();if(i)break;e.u=gy(r,e.u),e.A+=r.length,yield r}}}function hK(e){const t=Xc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),$a(t)}function pK(e,t){const n=Xc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),V2(e.t,n,12),n.setUint32(16,e.u,1),n.setUint32(20,e.A,1),n.setUint32(24,e.A,1),n.setUint16(28,e.i.length,1),n.setUint16(40,33204,1),n.setUint32(42,t,1),$a(n)}function gK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function mK(e,t={}){const n={"Content-Type":"application/zip","Content-Disposition":"attachment"};return Number.isInteger(t.length)&&t.length>0&&(n["Content-Length"]=t.length),t.metadata&&(n["Content-Length"]=p(t.metadata)),new Response(j2(async function*(r){const i=[];let l=0,m=0;for await(const u of r)yield fK(u),yield u.i,yield*dK(u),yield hK(u),i.push(pK(u,l)),i.push(u.i),m++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=Xc(22);a.setUint32(0,1347093766),a.setUint16(8,m,1),a.setUint16(10,m,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield $a(a)}(async function*(r){for await(const i of r){const[l,m]=gK(i);yield Object.assign(iK(...m),oK(...l))}}(e))),{headers:n})}async function U2(e,t=!0,n){const r=rn();t&&Ri({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let o=0;o]/g,"").substring(0,128).trimEnd();r.imageDownloadType==="PNG"?i.push({name:f+".png",input:await aa(u,"image/png")}):r.imageDownloadType==="JPG"?i.push({name:f+".jpg",input:await aa(u,"image/jpeg")}):r.imageDownloadType==="GIF"?i.push({name:f+".gif",input:await aa(u,"image/gif")}):i.push({name:f+".webp",input:await aa(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await mK(i).blob(),m=document.createElement("a");m.href=URL.createObjectURL(l),m.download="stable_horde.zip",m.click()}async function vK(e,t){const n=rn(),r=document.createElement("a");let i;n.imageDownloadType==="PNG"?(i=await aa(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):n.imageDownloadType==="JPG"?(i=await aa(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):n.imageDownloadType==="GIF"?(i=await aa(e,"image/gif"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".gif"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const H2=Ee({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=Pn(),r=wa(),i=()=>{aw.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ri({type:"success",message:"Deleted Image"})})};async function l(m){const o=window.location.origin,a={prompt:m.prompt,width:m.width?m.width:void 0,height:m.height?m.height:void 0,steps:m.steps,cfg_scale:m.cfg_scale,sampler_name:m.sampler_name,model_name:m.modelName,seed:m.seed,clip_skip:m.clip_skip,frames:m.frames,scheduler:m.scheduler},u=window.location.pathname.replace("images","");let h=`${o}${u}?share=`,c="",f="";for(const[d,v]of Object.entries(a)){if(!v)continue;let g=v;typeof v=="string"?g=encodeURIComponent(v):Array.isArray(v)&&(g=JSON.stringify(v)),c+=`${f}${d}=${g}`,f="&"}h+=btoa(String.fromCharCode.apply(null,Array.from(AX(c)))),await navigator.clipboard.writeText(h),Ri({type:"success",message:"Copied shareable link to clipboard"})}return(m,o)=>(j(),ue(ze,null,[le(C(st),{onClick:i,type:"danger",icon:C(Oc),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(st),{onClick:o[0]||(o[0]=a=>C(vK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",icon:C(Is),plain:""},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"]),e.imageData.starred?_e("",!0):(j(),we(C(st),{key:0,onClick:o[1]||(o[1]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(zO),plain:""},{default:pe(()=>[Ue("Favourite")]),_:1},8,["icon"])),e.imageData.starred?(j(),we(C(st),{key:1,onClick:o[2]||(o[2]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(Jb),plain:""},{default:pe(()=>[Ue("Unfavourite")]),_:1},8,["icon"])):_e("",!0),le(C(st),{onClick:o[3]||(o[3]=a=>C(n).generateText2Img(e.imageData)),type:"success",icon:C(os),plain:""},{default:pe(()=>[Ue("Text2img")]),_:1},8,["icon"]),le(C(st),{onClick:o[4]||(o[4]=a=>C(n).generateImg2Img(e.imageData.image)),type:"success",icon:C(os),plain:""},{default:pe(()=>[Ue("Img2img")]),_:1},8,["icon"]),le(C(st),{onClick:o[5]||(o[5]=a=>C(n).generateInpainting(e.imageData.image)),type:"success",icon:C(os),plain:""},{default:pe(()=>[Ue("Inpainting")]),_:1},8,["icon"]),le(C(st),{onClick:o[6]||(o[6]=a=>l(e.imageData)),type:"success",icon:C(e3),plain:""},{default:pe(()=>[Ue("Copy Link")]),_:1},8,["icon"])],64))}}),yK={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},bK=["src"],_K={style:{"font-size":"18px","font-weight":"500"}},wK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},CK=Ee({__name:"ImageDialog",setup(e){const t=wa(),n=$t(),r=oe();II(r,{onSwipeEnd(o,a){a==="RIGHT"&&n.openModalToLeft(),a==="LEFT"&&n.openModalToRight()}});const i=te({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=oe(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const o=t.currentOutputs.find(a=>a.id===n.activeModal);if(o)return l.value=o;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function m(){i.value=!1}return(o,a)=>{var u;return j(),we(C(SB),{"model-value":C(i),width:(u=l.value)==null?void 0:u.width,class:"image-viewer",onClosed:m,"align-center":""},{default:pe(()=>{var h,c,f;return[re("div",{class:"main-output-container",ref_key:"target",ref:r},[re("div",yK,[(h=l.value)!=null&&h.image?(j(),ue("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,bK)):_e("",!0)])],512),re("div",_K,Pe(((c=l.value.prompt)==null?void 0:c.split("###")[0])||"Unkown Creation"),1),re("div",wK,[re("div",null,"Negative Prompt: "+Pe(((f=l.value.prompt)==null?void 0:f.split("###")[1])||"None"),1),re("span",null,"Model: "+Pe(l.value.modelName||"Unknown")+" - ",1),re("span",null,"Sampler: "+Pe(l.value.sampler_name||"Unknown")+" - ",1),re("span",null,"Seed: "+Pe(l.value.seed||"Unknown")+" - ",1),re("span",null,"Steps: "+Pe(l.value.steps||"Unknown")+" - ",1),re("span",null,"CFG Scale: "+Pe(l.value.cfg_scale||"Unknown")+" - ",1),re("span",null,"Clip Skip: "+Pe(l.value.clip_skip||"Unknown")+" - ",1),re("span",null,"Dimensions: "+Pe(l.value.width||"???")+"x"+Pe(l.value.height||"???")+" - ",1)]),re("div",null,[le(H2,{"image-data":l.value},null,8,["image-data"])])]}),_:1},8,["model-value","width"])}}});const SK=e=>(Jr("data-v-8f4d2380"),e=e(),Qr(),e),xK=SK(()=>re("div",{style:{"font-size":"20px"}},"Stable UI",-1)),TK={class:"generator-icons"},kK=Ee({__name:"App",setup(e){const n=cp(up).smallerOrEqual("md"),r=$t();rn();const i=RT(),l=oe();return ke(()=>i.path,m=>{l.value&&l.value.open(m)}),(m,o)=>(j(),ue(ze,null,[re("div",{class:fe({"menu-container":!C(n)})},[le(C(X1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?_e("",!0):(j(),we(C(Op),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[xK]),_:1})),le(Ho,{isMobile:C(n),index:"/"},{icon:pe(()=>[re("div",TK,[le(C(De),null,{default:pe(()=>[le(C(z3))]),_:1}),C(r).showGeneratorBadge?(j(),we(C(De),{key:0,class:"generator-badge",size:10},{default:pe(()=>[le(RU)]),_:1})):_e("",!0)])]),title:pe(()=>[Ue("Generate")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/images"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(v3))]),_:1})]),title:pe(()=>[Ue("Images")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/about"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Kb))]),_:1})]),title:pe(()=>[Ue("About")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/options"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(qO))]),_:1})]),title:pe(()=>[Ue("Options")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/return"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Hb))]),_:1})]),title:pe(()=>[Ue("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),re("div",{class:fe({view:!C(n)})},[le(C(Ub))],2),le(CK)],64))}});const EK=Xt(kK,[["__scopeId","data-v-8f4d2380"]]);const cg=xx(EK);cg.use(Ex());cg.use(_s);cg.mount("#app");_s.replace("/");const OK={key:1,class:"image-action"},AK=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=oe(null);uI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=oe(!1);PI(r,([{isIntersecting:m}])=>{m&&(i.value=m)},{rootMargin:"500px"});const l=te(()=>n.selected.includes(t.imageData.id));return(m,o)=>(j(),ue("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),we(C(kp),{key:0,class:"thumbnail",src:e.imageData.image,onClick:o[0]||(o[0]=a=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):_e("",!0),i.value?(j(),ue("div",OK,[e.imageData.starred?(j(),we(C(De),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[le(C(Jb))]),_:1})):_e("",!0),C(n).multiSelect?(j(),ue("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(De),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?_e("",!0):(j(),we(C(ul),{key:0})),C(l)?(j(),we(C(Yb),{key:1})):_e("",!0)]),_:1},8,["color"])])):_e("",!0)])):_e("",!0)],512))}});const my=Xt(AK,[["__scopeId","data-v-b9569bbd"]]);const PK={},IK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},MK=re("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),LK=[MK];function RK(e,t){return j(),ue("svg",IK,LK)}const DK=Xt(PK,[["render",RK]]),$K=e=>(Jr("data-v-301360a8"),e=e(),Qr(),e),BK={class:"images-top-bar"},FK={class:"options"},zK=["onClick"],NK=["onClick"],jK=["onClick"],VK={key:1,class:"center-both",style:{gap:"12px"}},UK={key:2},HK=$K(()=>re("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),WK=[HK],YK={key:0},XK={key:0,style:{display:"flex",gap:"8px"}},KK={key:1,class:"images"},GK={key:1},qK=Ee({__name:"ImagesView",setup(e){const{width:t}=NI(),n=wa(),r=rn(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function m(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function o(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function a(){i.selected=[],i.multiSelect=!1}const u=()=>{aw.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};Zm(["a","A","ArrowLeft"],i.openModalToLeft),Zm(["d","D","ArrowRight"],i.openModalToRight);async function h(){U2(i.selected)}const c=te(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ue(ze,null,[re("div",BK,[re("div",FK,[le(C(Yl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(OO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["Newest","Oldest"],d=>re("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Pe(d),11,zK)),64))]),_:1}),le(C(Yl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(PE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>re("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Pe(C(n).filterBy===d?"Showing":"Show")+" "+Pe(d),11,NK)),64))]),_:1}),le(C(Yl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(DK)]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>re("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Pe(d.label),11,jK)),64))]),_:1}),le(C(Yl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),we(C(Yb),{key:0})):(j(),we(C(ul),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ue("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ue("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ue("div",{key:2,class:"el-select-dropdown__item selected",onClick:a},"Deselect All")):(j(),ue("div",{key:3,class:"el-select-dropdown__item",onClick:m},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(v=>v.id).includes(d))?(j(),ue("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ue("div",{key:4,class:"el-select-dropdown__item selected",onClick:o},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),we(C(XN),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):_e("",!0),C(i).multiSelect?(j(),ue("div",VK,[re("div",null,Pe(C(i).selected.length)+" selected",1),le(C(st),{type:"danger",onClick:u,icon:C(Oc),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(st),{type:"success",onClick:h,icon:C(Is),plain:"",style:{margin:"0"}},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"])])):(j(),ue("div",UK,WK))]),C(n).outputsLength!=0?(j(),ue("div",YK,[C(n).currentLayout==="dynamic"?(j(),ue("div",XK,[(j(!0),ue(ze,null,Dt(C(c),(d,v)=>(j(),ue("div",{key:v,style:{flex:"1 1 0%"}},[(j(!0),ue(ze,null,Dt(d,g=>(j(),we(my,{key:g.id,"image-data":g,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):_e("",!0),C(n).currentLayout==="grid"?(j(),ue("div",KK,[(j(!0),ue(ze,null,Dt(C(n).currentOutputs,d=>(j(),we(my,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):_e("",!0)])):_e("",!0),C(n).outputsLength==0?(j(),ue("div",GK,[le(C(mF),{description:"No Images Found"})])):_e("",!0)],64))}});const ZK=Xt(qK,[["__scopeId","data-v-301360a8"]]),JK=Object.freeze(Object.defineProperty({__proto__:null,default:ZK},Symbol.toStringTag,{value:"Module"})),QK=["href"],eG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=ft("router-link");return j(),ue(ze,null,[e.router?_e("",!0):(j(),ue("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,QK)),e.router?(j(),we(r,{key:1,to:e.href},{default:pe(()=>[xe(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):_e("",!0)],64)}}});const tG=Xt(eG,[["__scopeId","data-v-17b53b7d"]]),El=e=>(Jr("data-v-ecc278c5"),e=e(),Qr(),e),nG={class:"about"},rG={class:"about-content"},iG=El(()=>re("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),aG=El(()=>re("div",null,[Ue("This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in "),re("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ue(".")],-1)),oG=El(()=>re("br",null,null,-1)),sG=El(()=>re("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),lG=El(()=>re("br",null,null,-1)),uG=Ee({__name:"AboutView",setup(e){return(t,n)=>(j(),ue("div",nG,[re("div",rG,[iG,aG,oG,sG,lG,re("div",null,[Ue("You can find the KoboldAI community and authors of this fork on the "),le(tG,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ue("KoboldAI Discord")]),_:1})])])]))}});const cG=Xt(uG,[["__scopeId","data-v-ecc278c5"]]),fG=Object.freeze(Object.defineProperty({__proto__:null,default:cG},Symbol.toStringTag,{value:"Module"}));const lu=Ee({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=te(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,m)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(l.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(c$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ue(ze,null,Dt(e.options,o=>(j(),we(C(f$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),Ol=e=>(Jr("data-v-d14e7594"),e=e(),Qr(),e),dG=Ol(()=>re("h1",null,"Options",-1)),hG=Ol(()=>re("h2",null,"Generation Options",-1)),pG=Ol(()=>re("h2",null,"Image Options",-1)),gG=Ol(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),mG=Ol(()=>re("h2",null,"General Options",-1)),vG=Ee({__name:"OptionsView",setup(e){const t=rn(),n=wa(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=oe([]),l=oe(),m=oe(!1),o=oe(0);async function a(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ri({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),m.value=!0,o.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await U2(h,!1,()=>{o.value++}),m.value=!1,o.value=0}return(h,c)=>(j(),ue(ze,null,[dG,le(C(Tp),{"label-position":"top",model:C(t).options,onSubmit:c[8]||(c[8]=Je(()=>{},["prevent"]))},{default:pe(()=>[le(C(y9),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[le(C(Cf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[hG,le(C(xi),{label:"Base URL"},{default:pe(()=>[le(C(La),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1}),le(lu,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).allowLargerParams=f),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Cf),{label:"\u{1F4F7} Images"},{default:pe(()=>[pG,le(kn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(lu,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(lu,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(lu,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[5]||(c[5]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(xi),{label:"Export Images (ZIP File)"},{default:pe(()=>[m.value?(j(),we(C(st),{key:1,icon:C(Is),disabled:""},{default:pe(()=>[Ue("Downloading... ("+Pe(o.value)+" / "+Pe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),we(C(st),{key:0,icon:C(Is),onClick:c[6]||(c[6]=f=>u())},{default:pe(()=>[Ue("Download "+Pe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(xi),{label:"Import Images (ZIP File)"},{default:pe(()=>[le(C(Ip),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:a,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Gh))]),_:1}),gG]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Cf),{label:"\u2699\uFE0F General"},{default:pe(()=>[mG,le(Pu,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[7]||(c[7]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const yG=Xt(vG,[["__scopeId","data-v-d14e7594"]]),bG=Object.freeze(Object.defineProperty({__proto__:null,default:yG},Symbol.toStringTag,{value:"Module"})); +`&&d>0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return a.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,v=this._styleMap[u],g=this._styleMap[u+1];v&&(u=v.line,h=v.offset),g&&(c=g.line,d=c===u,f=g.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(v.push(g),g=[],s=S,O=!0):s+=A,!O&&!d&&g.push(w),g=g.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&v.push(g),T+D>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+D),v},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=oe({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=oe({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=te(()=>Pn().generatorType==="Inpainting"),i=te(()=>r.value?t.value:n.value),l=te(()=>Pn().currentImageProps),m=te({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),o=oe(512),a=oe(512),u=oe(!1),h=oe(30),c=oe(!1),f=new Jn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=oe("Erase"),d=oe("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function g(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:M=!1,draw:L=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await ee(z.path),z.visibleDrawPath=await ee(z.path),M?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=L?d.value:i.value.maskPathColor);let Q=await ee(z.drawPath);Q=Q.scale(i.value.imageScale),Q.left=Q.left+z.drawPath.left*(i.value.imageScale-1),Q.top=Q.top+z.drawPath.top*(i.value.imageScale-1),L?(i.value.imageLayer.add(Q),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(Q),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),v()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:m.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),m.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,v()}function S(z){i.value.canvas=new Jn.fabric.Canvas(z,{isDrawingMode:!1,width:o.value,height:a.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",se),v()}function x(z,M,L,Q){let V=Q,P=Q;return M>L?(z.scaleToWidth(Q),V=Q*(a.value/o.value)):(z.scaleToHeight(Q),P=Q*(o.value/a.value)),{newHeight:V,newWidth:P}}function T(z){const M=Pn();if(E(),z.selectable=!1,o.value=z.width,a.value=z.height,o.value>M.maxDimensions||a.value>M.maxDimensions){const{newHeight:Q,newWidth:V}=x(z,o.value,a.value,M.maxDimensions);o.value=V,a.value=Q}if(o.value{o.value>a.value?i.value.imageScale=o.value/L:i.value.imageScale=a.value/L,i.value.imageLayer=R({image:Q,layerHeight:Q.height,layerWidth:Q.width})}),z.cloneAsImage(Q=>{if(!i.value.canvas)return;if(o.value!==L||a.value!==L){const{newHeight:q,newWidth:Z}=x(Q,o.value,a.value,L);o.value=Z,a.value=q}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=B(),i.value.visibleImageLayer=B({image:Q}),i.value.drawLayer=R();const V=o.value*i.value.imageScale,P=a.value*i.value.imageScale;M.params.width=V-V%64,M.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,D(),O()})}function O(){const z=Pn();if(!i.value.imageLayer||!i.value.drawLayer)return;const M=i.value.imageLayer.getCenter().left-z.params.width/2,L=z.params.width,Q=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:M,top:Q,width:L,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||m.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function D(){if(!i.value.canvas)return;const z=Pn();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=B({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,D(),A=void 0},5e3))}function N(z,M){const L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Jn.fabric.Image.fromURL(L,Q=>{Q.set({height:z,width:M});const V=Q.toDataURL({format:"png"});l.value.sourceImage=V,m.value=!0,T(Q)})}function R({image:z,layerWidth:M,layerHeight:L}={}){const Q=new Jn.fabric.Canvas(null);return Q.selection=!1,Q.backgroundColor=i.value.maskBackgroundColor,Q.setHeight(L||a.value),Q.setWidth(M||o.value),z&&Q.add(z),Q}function B({image:z,layerWidth:M,layerHeight:L,fill:Q,abosolute:V}={}){const P=z||new Jn.fabric.Rect({width:M||o.value,height:L||a.value,left:0,top:0,fill:Q||"transparent",absolutePositioned:V||!0,selectable:!1});return new Jn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function U(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),m.value){const z=Pn();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=B(),i.value.drawLayer=R(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ne(){var M;O();const z=document.createElement("a");if(m.value){z.href="data:image/png;base64,"+((M=l.value.sourceImage)==null?void 0:M.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function ee(z){return new Promise((M,L)=>{try{z.clone(M)}catch(Q){L(Q)}})}async function se(z){const M={path:z.path};b({history:M,erase:u.value,draw:m.value}),i.value.redoHistory.push(M)}function I(z){if(!i.value.canvas)return;const M=i.value.canvas.getPointer(z.e);f.left=M.x,f.top=M.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),m.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:m,imageProps:i,updateCropPreview:D,createNewCanvas:S,downloadMask:ne,resetCanvas:E,resetDrawing:U,flipErase:g,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const kH={},EH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},OH=re("g",{fill:"none"},[re("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),AH=[OH];function PH(e,t){return j(),ue("svg",EH,AH)}const IH=Xt(kH,[["render",PH]]);async function MH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(m=>i.onload=m),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function LH(e,t){const n=e.split(";base64,"),r=t!=null?t:n[0].split(":")[1],i=window.atob(r===n[0].split(":")[1]?n[1]:(await MH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let m=0;m{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const tg=e=>(Jr("data-v-d200c279"),e=e(),Qr(),e),RH=tg(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),DH={key:0},$H=tg(()=>re("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),BH={class:"canvas-container"},FH=tg(()=>re("canvas",{id:"canvas"},null,-1)),zH={class:"action-buttons",style:{left:"10px",right:"unset"}},NH={class:"action-buttons"},jH=Ee({__name:"CustomCanvas",setup(e){const t=Pn(),n=$t(),r=ms(),i=oe();async function l(o){if(!o.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const a=await i2(o.raw);t.currentImageProps.sourceImage=a,r.drawing=!1,Jn.fabric.Image.fromURL(a,r.newImage)}function m(){t.currentImageProps.sourceImage="",r.resetCanvas()}return qe(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Jn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(o,a)=>(j(),ue(ze,null,[C(t).currentImageProps.sourceImage?_e("",!0):(j(),we(C(Ip),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ue("div",DH,[$H,re("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:a[0]||(a[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(De),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[le(t2)]),_:1}),Ue("draw something")])])):_e("",!0)]),default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Gh))]),_:1}),RH]),_:1},512)),gt(re("div",null,[re("div",BH,[FH,re("div",zH,[le(C(st),{onClick:a[1]||(a[1]=u=>C(r).undoAction()),icon:C(qb),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(st),{onClick:a[2]||(a[2]=u=>C(r).redoAction()),icon:C(Zb),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),re("div",NH,[le(C(st),{onClick:a[3]||(a[3]=u=>C(r).resetDrawing()),icon:C(wr),plain:""},null,8,["icon"]),le(C(st),{onClick:m,icon:C(Oc),plain:""},null,8,["icon"]),le(C(st),{onClick:a[4]||(a[4]=u=>C(r).downloadMask()),icon:C(Is),plain:""},null,8,["icon"]),le(C(st),{onClick:a[5]||(a[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(xE):IH,plain:""},null,8,["icon"]),C(r).drawing?(j(),we(C(aB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":a[6]||(a[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):_e("",!0)]),le(C(Tp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[le(kn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":a[7]||(a[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const E0=Xt(jH,[["__scopeId","data-v-d200c279"]]),VH={class:"centerIcons"},UH={class:"stackedIcons"},HH=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return sx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ue("div",VH,[re("div",UH,[le(C(De),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),we(bt(t.iconOne)))]),_:1},8,["size"]),le(C(De),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),we(bt(t.iconTwo)))]),_:1},8,["size"])])]))}});const WH=Xt(HH,[["__scopeId","data-v-74586a39"]]),YH={key:1,style:{width:"40px"}},nu=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),we(C(kr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(Op),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),we(WH,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ue("div",YH,[le(C(De),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),we(bt(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const XH=4,O0=0,A0=1,KH=2;function Lo(e){let t=e.length;for(;--t>=0;)e[t]=0}const GH=0,a2=1,qH=2,ZH=3,JH=258,ng=29,Sl=256,Js=Sl+1+ng,ro=30,rg=19,o2=2*Js+1,oa=15,Rf=16,QH=7,ig=256,s2=16,l2=17,u2=18,uh=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Iu=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),eW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),c2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tW=512,Fr=new Array((Js+2)*2);Lo(Fr);const vs=new Array(ro*2);Lo(vs);const Qs=new Array(tW);Lo(Qs);const el=new Array(JH-ZH+1);Lo(el);const ag=new Array(ng);Lo(ag);const lc=new Array(ro);Lo(lc);function Df(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let f2,d2,h2;function $f(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const p2=e=>e<256?Qs[e]:Qs[256+(e>>>7)],tl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},yn=(e,t,n)=>{e.bi_valid>Rf-n?(e.bi_buf|=t<>Rf-e.bi_valid,e.bi_valid+=n-Rf):(e.bi_buf|=t<{yn(e,n[t*2],n[t*2+1])},g2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},nW=e=>{e.bi_valid===16?(tl(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},rW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,m=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,h,c,f,s,d,v=0;for(f=0;f<=oa;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ua&&(f=a,v++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=o&&(s=m[h-o]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(v!==0){do{for(f=a-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[a]--,v-=2}while(v>0);for(f=a;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},m2=(e,t,n)=>{const r=new Array(oa+1);let i=0,l,m;for(l=1;l<=oa;l++)i=i+n[l-1]<<1,r[l]=i;for(m=0;m<=t;m++){let o=e[m*2+1];o!==0&&(e[m*2]=g2(r[o]++,o))}},iW=()=>{let e,t,n,r,i;const l=new Array(oa+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?tl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,m,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?gr(e,i,t):(m=el[i],gr(e,m+Sl+1,t),o=uh[m],o!==0&&(i-=ag[m],yn(e,i,o)),r--,m=p2(r),gr(e,m,n),o=Iu[m],o!==0&&(r-=lc[m],yn(e,r,o)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let m,o,a=-1,u;for(e.heap_len=0,e.heap_max=o2,m=0;m>1;m>=1;m--)Bf(e,n,m);u=l;do m=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Bf(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=m,e.heap[--e.heap_max]=o,n[u*2]=n[m*2]+n[o*2],e.depth[u]=(e.depth[m]>=e.depth[o]?e.depth[m]:e.depth[o])+1,n[m*2+1]=n[o*2+1]=u,e.heap[1]=u++,Bf(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],rW(e,t),m2(n,a,e.bl_count)},M0=(e,t,n)=>{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=m,m=t[(r+1)*2+1],!(++o{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),r=0;r<=n;r++)if(l=m,m=t[(r+1)*2+1],!(++o{let t;for(M0(e,e.dyn_ltree,e.l_desc.max_code),M0(e,e.dyn_dtree,e.d_desc.max_code),ch(e,e.bl_desc),t=rg-1;t>=3&&e.bl_tree[c2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},oW=(e,t,n,r)=>{let i;for(yn(e,t-257,5),yn(e,n-1,5),yn(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return O0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return A0;for(n=32;n{R0||(iW(),R0=!0),e.l_desc=new $f(e.dyn_ltree,f2),e.d_desc=new $f(e.dyn_dtree,d2),e.bl_desc=new $f(e.bl_tree,h2),e.bi_buf=0,e.bi_valid=0,v2(e)},b2=(e,t,n,r)=>{yn(e,(GH<<1)+(r?1:0),3),y2(e),tl(e,n),tl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},uW=e=>{yn(e,a2<<1,3),gr(e,ig,Fr),nW(e)},cW=(e,t,n,r)=>{let i,l,m=0;e.level>0?(e.strm.data_type===KH&&(e.strm.data_type=sW(e)),ch(e,e.l_desc),ch(e,e.d_desc),m=aW(e),i=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=i&&(i=l)):i=l=n+5,n+4<=i&&t!==-1?b2(e,t,n,r):e.strategy===XH||l===i?(yn(e,(a2<<1)+(r?1:0),3),I0(e,Fr,vs)):(yn(e,(qH<<1)+(r?1:0),3),oW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,m+1),I0(e,e.dyn_ltree,e.dyn_dtree)),v2(e),r&&y2(e)},fW=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(el[n]+Sl+1)*2]++,e.dyn_dtree[p2(t)*2]++),e.sym_next===e.sym_end);var dW=lW,hW=b2,pW=cW,gW=fW,mW=uW,vW={_tr_init:dW,_tr_stored_block:hW,_tr_flush_block:pW,_tr_tally:gW,_tr_align:mW};const yW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,m=0;for(;n!==0;){m=n>2e3?2e3:n,n-=m;do i=i+t[r++]|0,l=l+i|0;while(--m);i%=65521,l%=65521}return i|l<<16|0};var nl=yW;const bW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},_W=new Uint32Array(bW()),wW=(e,t,n,r)=>{const i=_W,l=r+n;e^=-1;for(let m=r;m>>8^i[(e^t[m])&255];return e^-1};var Ut=wW,Ca={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ro={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:CW,_tr_stored_block:fh,_tr_flush_block:SW,_tr_tally:Ti,_tr_align:xW}=vW,{Z_NO_FLUSH:ki,Z_PARTIAL_FLUSH:TW,Z_FULL_FLUSH:kW,Z_FINISH:jn,Z_BLOCK:D0,Z_OK:Gt,Z_STREAM_END:$0,Z_STREAM_ERROR:br,Z_DATA_ERROR:EW,Z_BUF_ERROR:Ff,Z_DEFAULT_COMPRESSION:OW,Z_FILTERED:AW,Z_HUFFMAN_ONLY:ru,Z_RLE:PW,Z_FIXED:IW,Z_DEFAULT_STRATEGY:MW,Z_UNKNOWN:LW,Z_DEFLATED:Hc}=Ro,RW=9,DW=15,$W=8,BW=29,FW=256,dh=FW+1+BW,zW=30,NW=19,jW=2*dh+1,VW=15,nt=3,wi=258,_r=wi+nt+1,UW=32,bo=42,og=57,hh=69,ph=73,gh=91,mh=103,sa=113,Zo=666,dn=1,Do=2,Sa=3,$o=4,HW=3,la=(e,t)=>(e.msg=Ca[t],t),B0=e=>e*2-(e>4?9:0),yi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},WW=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let YW=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Mn=(e,t)=>{SW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,En(e.strm)},ct=(e,t)=>{e.pending_buf[e.pending++]=t},Wo=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},vh=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=nl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Ut(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},_2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,m=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-_r?e.strstart-(e.w_size-_r):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+wi;let s=u[r+m-1],d=u[r+m];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+m]!==d||u[i+m-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rm){if(e.match_start=t,m=l,l>=o)break;s=u[r+m-1],d=u[r+m]}}while((t=c[t&h])>a&&--n!==0);return m<=e.lookahead?m:e.lookahead},_o=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-_r)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),WW(e),r+=t),e.strm.avail_in===0)break;if(n=vh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=nt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+nt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,m=0,o=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,En(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(vh(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(m===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(vh(e.strm,e.window,e.strstart,l),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.high_water>3,l=e.pending_buf_size-l>65535?65535:e.pending_buf_size-l,n=l>e.w_size?e.w_size:l,i=e.strstart-e.block_start,(i>=n||(i||t===jn)&&t!==ki&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,m=t===jn&&e.strm.avail_in===0&&r===i?1:0,fh(e,e.block_start,r,m),e.block_start+=r,En(e.strm)),m?Sa:dn)},zf=(e,t)=>{let n,r;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-_r&&(e.match_length=_2(e,n)),e.match_length>=nt)if(r=Ti(e,e.strstart-e.match_start,e.match_length-nt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=nt){e.match_length--;do e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else r=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Mn(e,!1),e.strm.avail_out===0))return dn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead<_r){if(_o(e),e.lookahead<_r&&t===ki)return dn;if(e.lookahead===0)break}if(n=0,e.lookahead>=nt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=nt-1,n!==0&&e.prev_length4096)&&(e.match_length=nt-1)),e.prev_length>=nt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-nt,r=Ti(e,e.strstart-1-e.prev_match,e.prev_length-nt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+nt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=nt-1,e.strstart++,r&&(Mn(e,!1),e.strm.avail_out===0))return dn}else if(e.match_available){if(r=Ti(e,0,e.window[e.strstart-1]),r&&Mn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return dn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ti(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const m=e.window;for(;;){if(e.lookahead<=wi){if(_o(e),e.lookahead<=wi&&t===ki)return dn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=nt&&e.strstart>0&&(i=e.strstart-1,r=m[i],r===m[++i]&&r===m[++i]&&r===m[++i])){l=e.strstart+wi;do;while(r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=nt?(n=Ti(e,1,e.match_length-nt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Mn(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Mn(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Mn(e,!1),e.strm.avail_out===0)?dn:Do},KW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(_o(e),e.lookahead===0)){if(t===ki)return dn;break}if(e.match_length=0,n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Mn(e,!1),e.strm.avail_out===0))return dn}return e.insert=0,t===jn?(Mn(e,!0),e.strm.avail_out===0?Sa:$o):e.sym_next&&(Mn(e,!1),e.strm.avail_out===0)?dn:Do};function fr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Jo=[new fr(0,0,0,0,w2),new fr(4,4,8,4,zf),new fr(4,5,16,8,zf),new fr(4,6,32,32,zf),new fr(4,4,16,16,Ua),new fr(8,16,32,32,Ua),new fr(8,16,128,128,Ua),new fr(8,32,128,256,Ua),new fr(32,128,258,1024,Ua),new fr(32,258,258,4096,Ua)],GW=e=>{e.window_size=2*e.w_size,yi(e.head),e.max_lazy_match=Jo[e.level].max_lazy,e.good_match=Jo[e.level].good_length,e.nice_match=Jo[e.level].nice_length,e.max_chain_length=Jo[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=nt-1,e.match_available=0,e.ins_h=0};function qW(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Hc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(jW*2),this.dyn_dtree=new Uint16Array((2*zW+1)*2),this.bl_tree=new Uint16Array((2*NW+1)*2),yi(this.dyn_ltree),yi(this.dyn_dtree),yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(VW+1),this.heap=new Uint16Array(2*dh+1),yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*dh+1),yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const xl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bo&&t.status!==og&&t.status!==hh&&t.status!==ph&&t.status!==gh&&t.status!==mh&&t.status!==sa&&t.status!==Zo?1:0},C2=e=>{if(xl(e))return la(e,br);e.total_in=e.total_out=0,e.data_type=LW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?og:t.wrap?bo:sa,e.adler=t.wrap===2?0:1,t.last_flush=-2,CW(t),Gt},S2=e=>{const t=C2(e);return t===Gt&&GW(e.state),t},ZW=(e,t)=>xl(e)||e.state.wrap!==2?br:(e.state.gzhead=t,Gt),x2=(e,t,n,r,i,l)=>{if(!e)return br;let m=1;if(t===OW&&(t=6),r<0?(m=0,r=-r):r>15&&(m=2,r-=16),i<1||i>RW||n!==Hc||r<8||r>15||t<0||t>9||l<0||l>IW||r===8&&m!==1)return la(e,br);r===8&&(r=9);const o=new qW;return e.state=o,o.strm=e,o.status=bo,o.wrap=m,o.gzhead=null,o.w_bits=r,o.w_size=1<x2(e,t,Hc,DW,$W,MW),QW=(e,t)=>{if(xl(e)||t>D0||t<0)return e?la(e,br):br;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Zo&&t!==jn)return la(e,e.avail_out===0?Ff:br);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(En(e),e.avail_out===0)return n.last_flush=-1,Gt}else if(e.avail_in===0&&B0(t)<=B0(r)&&t!==jn)return la(e,Ff);if(n.status===Zo&&e.avail_in!==0)return la(e,Ff);if(n.status===bo&&n.wrap===0&&(n.status=sa),n.status===bo){let i=Hc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=ru||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=UW),i+=31-i%31,Wo(n,i),n.strstart!==0&&(Wo(n,e.adler>>>16),Wo(n,e.adler&65535)),e.adler=1,n.status=sa,En(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===og){if(e.adler=0,ct(n,31),ct(n,139),ct(n,8),n.gzhead)ct(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ct(n,n.gzhead.time&255),ct(n,n.gzhead.time>>8&255),ct(n,n.gzhead.time>>16&255),ct(n,n.gzhead.time>>24&255),ct(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),ct(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ct(n,n.gzhead.extra.length&255),ct(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ut(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=hh;else if(ct(n,0),ct(n,0),ct(n,0),ct(n,0),ct(n,0),ct(n,n.level===9?2:n.strategy>=ru||n.level<2?4:0),ct(n,HW),n.status=sa,En(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===hh){if(n.gzhead.extra){let i=n.pending,l=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,En(e),n.pending!==0)return n.last_flush=-1,Gt;i=0,l-=o}let m=new Uint8Array(n.gzhead.extra);n.pending_buf.set(m.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=ph}if(n.status===ph){if(n.gzhead.name){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),En(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=gh}if(n.status===gh){if(n.gzhead.comment){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i)),En(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Ut(e.adler,n.pending_buf,n.pending-i,i))}n.status=mh}if(n.status===mh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(En(e),n.pending!==0))return n.last_flush=-1,Gt;ct(n,e.adler&255),ct(n,e.adler>>8&255),e.adler=0}if(n.status=sa,En(e),n.pending!==0)return n.last_flush=-1,Gt}if(e.avail_in!==0||n.lookahead!==0||t!==ki&&n.status!==Zo){let i=n.level===0?w2(n,t):n.strategy===ru?KW(n,t):n.strategy===PW?XW(n,t):Jo[n.level].func(n,t);if((i===Sa||i===$o)&&(n.status=Zo),i===dn||i===Sa)return e.avail_out===0&&(n.last_flush=-1),Gt;if(i===Do&&(t===TW?xW(n):t!==D0&&(fh(n,0,0,!1),t===kW&&(yi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),En(e),e.avail_out===0))return n.last_flush=-1,Gt}return t!==jn?Gt:n.wrap<=0?$0:(n.wrap===2?(ct(n,e.adler&255),ct(n,e.adler>>8&255),ct(n,e.adler>>16&255),ct(n,e.adler>>24&255),ct(n,e.total_in&255),ct(n,e.total_in>>8&255),ct(n,e.total_in>>16&255),ct(n,e.total_in>>24&255)):(Wo(n,e.adler>>>16),Wo(n,e.adler&65535)),En(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Gt:$0)},eY=e=>{if(xl(e))return br;const t=e.state.status;return e.state=null,t===sa?la(e,EW):Gt},tY=(e,t)=>{let n=t.length;if(xl(e))return br;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bo||r.lookahead)return br;if(i===1&&(e.adler=nl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(yi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(t.subarray(n-r.w_size,n),0),t=a,n=r.w_size}const l=e.avail_in,m=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,_o(r);r.lookahead>=nt;){let a=r.strstart,u=r.lookahead-(nt-1);do r.ins_h=Ei(r,r.ins_h,r.window[a+nt-1]),r.prev[a&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=a,a++;while(--u);r.strstart=a,r.lookahead=nt-1,_o(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=nt-1,r.match_available=0,e.next_in=m,e.input=o,e.avail_in=l,r.wrap=i,Gt};var nY=JW,rY=x2,iY=S2,aY=C2,oY=ZW,sY=QW,lY=eY,uY=tY,cY="pako deflate (from Nodeca project)",ys={deflateInit:nY,deflateInit2:rY,deflateReset:iY,deflateResetKeep:aY,deflateSetHeader:oY,deflate:sY,deflateEnd:lY,deflateSetDictionary:uY,deflateInfo:cY};const fY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var dY=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)fY(n,r)&&(e[r]=n[r])}}return e},hY=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;rl[254]=rl[254]=1;var pY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,m=e.length,o=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const gY=(e,t)=>{if(t<65534&&e.subarray&&T2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=o-1;continue}for(m&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}m<65536?l[i++]=m:(m-=65536,l[i++]=55296|m>>10&1023,l[i++]=56320|m&1023)}return gY(l,i)},vY=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+rl[e[n]]>t?n:t},il={string2buf:pY,buf2string:mY,utf8border:vY};function yY(){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}var k2=yY;const E2=Object.prototype.toString,{Z_NO_FLUSH:bY,Z_SYNC_FLUSH:_Y,Z_FULL_FLUSH:wY,Z_FINISH:CY,Z_OK:uc,Z_STREAM_END:SY,Z_DEFAULT_COMPRESSION:xY,Z_DEFAULT_STRATEGY:TY,Z_DEFLATED:kY}=Ro;function Tl(e){this.options=Wc.assign({level:xY,method:kY,chunkSize:16384,windowBits:15,memLevel:8,strategy:TY},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k2,this.strm.avail_out=0;let n=ys.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==uc)throw new Error(Ca[n]);if(t.header&&ys.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=il.string2buf(t.dictionary):E2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=ys.deflateSetDictionary(this.strm,r),n!==uc)throw new Error(Ca[n]);this._dict_set=!0}}Tl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,l;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?CY:bY,typeof e=="string"?n.input=il.string2buf(e):E2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(l===_Y||l===wY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=ys.deflate(n,l),i===SY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=ys.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===uc;if(n.avail_out===0){this.onData(n.output);continue}if(l>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Tl.prototype.onData=function(e){this.chunks.push(e)};Tl.prototype.onEnd=function(e){e===uc&&(this.result=Wc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function sg(e,t){const n=new Tl(t);if(n.push(e,!0),n.err)throw n.msg||Ca[n.err];return n.result}function EY(e,t){return t=t||{},t.raw=!0,sg(e,t)}function OY(e,t){return t=t||{},t.gzip=!0,sg(e,t)}var AY=Tl,PY=sg,IY=EY,MY=OY,LY=Ro,RY={Deflate:AY,deflate:PY,deflateRaw:IY,gzip:MY,constants:LY};const iu=16209,DY=16191;var $Y=function(t,n){let r,i,l,m,o,a,u,h,c,f,s,d,v,g,y,b,_,w,S,x,T,O,A,D;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,m=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,v=N.lencode,g=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,da){t.msg="invalid distance too far back",N.mode=iu;break e}if(s>>>=w,d-=w,w=l-m,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=iu;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)D[l++]=O[T++],D[l++]=O[T++],D[l++]=O[T++],S-=3;S&&(D[l++]=O[T++],S>1&&(D[l++]=O[T++]))}else{T=l-x;do D[l++]=D[T++],D[l++]=D[T++],D[l++]=D[T++],S-=3;while(S>2);S&&(D[l++]=D[T++],S>1&&(D[l++]=D[T++]))}}else if((w&64)===0){_=g[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const a=o.bits;let u=0,h=0,c=0,f=0,s=0,d=0,v=0,g=0,y=0,b=0,_,w,S,x,T,O=null,A;const D=new Uint16Array(Ha+1),N=new Uint16Array(Ha+1);let R=null,B,E,U;for(u=0;u<=Ha;u++)D[u]=0;for(h=0;h=1&&D[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,o.bits=1,0;for(c=1;c0&&(e===N0||f!==1))return-1;for(N[1]=0,u=1;uF0||e===j0&&y>z0)return 1;for(;;){B=u-v,m[h]+1=A?(E=R[m[h]-A],U=O[m[h]-A]):(E=32+64,U=0),_=1<>v)+w]=B<<24|E<<16|U|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--D[u]===0){if(u===f)break;u=t[n+m[h]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),T+=c,d=u-v,g=1<F0||e===j0&&y>z0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-v<<24|64<<16|0),o.bits=s,0};var bs=jY;const VY=0,O2=1,A2=2,{Z_FINISH:V0,Z_BLOCK:UY,Z_TREES:au,Z_OK:xa,Z_STREAM_END:HY,Z_NEED_DICT:WY,Z_STREAM_ERROR:Xn,Z_DATA_ERROR:P2,Z_MEM_ERROR:I2,Z_BUF_ERROR:YY,Z_DEFLATED:U0}=Ro,Yc=16180,H0=16181,W0=16182,Y0=16183,X0=16184,K0=16185,G0=16186,q0=16187,Z0=16188,J0=16189,cc=16190,Mr=16191,jf=16192,Q0=16193,Vf=16194,ey=16195,ty=16196,ny=16197,ry=16198,ou=16199,su=16200,iy=16201,ay=16202,oy=16203,sy=16204,ly=16205,Uf=16206,uy=16207,cy=16208,It=16209,M2=16210,L2=16211,XY=852,KY=592,GY=15,qY=GY,fy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function ZY(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Da=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeL2?1:0},R2=e=>{if(Da(e))return Xn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Yc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(XY),t.distcode=t.distdyn=new Int32Array(KY),t.sane=1,t.back=-1,xa},D2=e=>{if(Da(e))return Xn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,R2(e)},$2=(e,t)=>{let n;if(Da(e))return Xn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Xn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,D2(e))},B2=(e,t)=>{if(!e)return Xn;const n=new ZY;e.state=n,n.strm=e,n.window=null,n.mode=Yc;const r=$2(e,t);return r!==xa&&(e.state=null),r},JY=e=>B2(e,qY);let dy=!0,Hf,Wf;const QY=e=>{if(dy){Hf=new Int32Array(512),Wf=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(bs(O2,e.lens,0,288,Hf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;bs(A2,e.lens,0,32,Wf,0,e.work,{bits:5}),dy=!1}e.lencode=Hf,e.lenbits=9,e.distcode=Wf,e.distbits=5},F2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,m,o,a,u,h,c,f,s,d,v,g=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let D,N;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Da(e)||!e.output||!e.input&&e.avail_in!==0)return Xn;n=e.state,n.mode===Mr&&(n.mode=jf),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,c=o,f=a,O=xa;e:for(;;)switch(n.mode){case Yc:if(n.wrap===0){n.mode=jf;break}for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Ut(n.check,A,2,0),u=0,h=0,n.mode=H0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=It;break}if((u&15)!==U0){e.msg="unknown compression method",n.mode=It;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=It;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Ut(n.check,A,2,0)),u=0,h=0,n.mode=W0;case W0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Ut(n.check,A,4,0)),u=0,h=0,n.mode=Y0;case Y0:for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Ut(n.check,A,2,0)),u=0,h=0,n.mode=X0;case X0:if(n.flags&1024){for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Ut(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=K0;case K0:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Ut(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=G0;case G0:if(n.flags&2048){if(o===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Mr;break;case J0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Uf;break}for(;h<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=Q0;break;case 1:if(QY(n),n.mode=ou,t===au){u>>>=2,h-=2;break e}break;case 2:n.mode=ty;break;case 3:e.msg="invalid block type",n.mode=It}u>>>=2,h-=2;break;case Q0:for(u>>>=h&7,h-=h&7;h<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=It;break}if(n.length=u&65535,u=0,h=0,n.mode=Vf,t===au)break e;case Vf:n.mode=ey;case ey:if(s=n.length,s){if(s>o&&(s=o),s>a&&(s=a),s===0)break e;i.set(r.subarray(l,l+s),m),o-=s,l+=s,a-=s,m+=s,n.length-=s;break}n.mode=Mr;break;case ty:for(;h<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=It;break}n.have=0,n.mode=ny;case ny:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},O=bs(VY,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid code lengths set",n.mode=It;break}n.have=0,n.mode=ry;case ry:for(;n.have>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=It;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=It;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===It)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=It;break}if(n.lenbits=9,D={bits:n.lenbits},O=bs(O2,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid literal/lengths set",n.mode=It;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},O=bs(A2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,O){e.msg="invalid distances set",n.mode=It;break}if(n.mode=ou,t===au)break e;case ou:n.mode=su;case su:if(o>=6&&a>=258){e.next_out=m,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=h,$Y(e,f),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,n.mode===Mr&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=ly;break}if(b&32){n.back=-1,n.mode=Mr;break}if(b&64){e.msg="invalid literal/length code",n.mode=It;break}n.extra=b&15,n.mode=iy;case iy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ay;case ay:for(;g=n.distcode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=It;break}n.offset=_,n.extra=b&15,n.mode=oy;case oy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=It;break}n.mode=sy;case sy:if(a===0)break e;if(s=f-a,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=It;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,d=m-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[m++]=v[d++];while(--s);n.length===0&&(n.mode=su);break;case ly:if(a===0)break e;i[m++]=n.length,a--,n.mode=su;break;case Uf:if(n.wrap){for(;h<32;){if(o===0)break e;o--,u|=r[l++]<{if(Da(e))return Xn;let t=e.state;return t.window&&(t.window=null),e.state=null,xa},nX=(e,t)=>{if(Da(e))return Xn;const n=e.state;return(n.wrap&2)===0?Xn:(n.head=t,t.done=!1,xa)},rX=(e,t)=>{const n=t.length;let r,i,l;return Da(e)||(r=e.state,r.wrap!==0&&r.mode!==cc)?Xn:r.mode===cc&&(i=1,i=nl(i,t,n,0),i!==r.check)?P2:(l=F2(e,t,n,n),l?(r.mode=M2,I2):(r.havedict=1,xa))};var iX=D2,aX=$2,oX=R2,sX=JY,lX=B2,uX=eX,cX=tX,fX=nX,dX=rX,hX="pako inflate (from Nodeca project)",zr={inflateReset:iX,inflateReset2:aX,inflateResetKeep:oX,inflateInit:sX,inflateInit2:lX,inflate:uX,inflateEnd:cX,inflateGetHeader:fX,inflateSetDictionary:dX,inflateInfo:hX};function pX(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gX=pX;const z2=Object.prototype.toString,{Z_NO_FLUSH:mX,Z_FINISH:vX,Z_OK:al,Z_STREAM_END:Yf,Z_NEED_DICT:Xf,Z_STREAM_ERROR:yX,Z_DATA_ERROR:hy,Z_MEM_ERROR:bX}=Ro;function kl(e){this.options=Wc.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k2,this.strm.avail_out=0;let n=zr.inflateInit2(this.strm,t.windowBits);if(n!==al)throw new Error(Ca[n]);if(this.header=new gX,zr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=il.string2buf(t.dictionary):z2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=zr.inflateSetDictionary(this.strm,t.dictionary),n!==al)))throw new Error(Ca[n])}kl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,m,o;if(this.ended)return!1;for(t===~~t?m=t:m=t===!0?vX:mX,z2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),l=zr.inflate(n,m),l===Xf&&i&&(l=zr.inflateSetDictionary(n,i),l===al?l=zr.inflate(n,m):l===hy&&(l=Xf));n.avail_in>0&&l===Yf&&n.state.wrap>0&&e[n.next_in]!==0;)zr.inflateReset(n),l=zr.inflate(n,m);switch(l){case yX:case hy:case Xf:case bX:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===Yf))if(this.options.to==="string"){let a=il.utf8border(n.output,n.next_out),u=n.next_out-a,h=il.buf2string(n.output,a);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(a,a+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===al&&o===0)){if(l===Yf)return l=zr.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};kl.prototype.onData=function(e){this.chunks.push(e)};kl.prototype.onEnd=function(e){e===al&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function lg(e,t){const n=new kl(t);if(n.push(e),n.err)throw n.msg||Ca[n.err];return n.result}function _X(e,t){return t=t||{},t.raw=!0,lg(e,t)}var wX=kl,CX=lg,SX=_X,xX=lg,TX=Ro,kX={Inflate:wX,inflate:CX,inflateRaw:SX,ungzip:xX,constants:TX};const{Deflate:wG,deflate:CG,deflateRaw:EX,gzip:SG}=RY,{Inflate:xG,inflate:TG,inflateRaw:OX,ungzip:kG}=kX;var AX=EX,PX=OX;function py(e){const t=new Map;for(const n of e){const[r,i]=n.split("="),l=decodeURIComponent(i);t.set(r,l)}return t}const IX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=py(t);if(console.log("URL params:",n),n.get("share")){const l=PX(new Uint8Array(atob(n.get("share")).split("").map(m=>m.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=py(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||20),cfg_scale:Number(n.get("cfg_scale")||5),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0),frames:Number(n.get("frames")||1),scheduler:n.get("scheduler")||"default"};Pn().generateText2Img(r,!1)},MX=10;function yh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(m=>`${m[0]} - ${m[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const LX=Co("interrogate",()=>{const e=oe({}),t=oe(!1);async function n(m){$t().raiseError(m,!1),t.value=!1,e.value={}}async function r(){const m=rn(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!yh(a,u,200,"Failed to get interrogation",n)||(e.value.id=u.id,e.value.status=u.caption)}function i(){e.value={},t.value=!1}function l(){return e.value.status||!1}return{currentInterrogation:e,interrogating:t,interrogateImage:r,getFormStatus:l,resetInterrogation:i}}),ug=e=>(Jr("data-v-db184ac6"),e=e(),Qr(),e),RX={key:0,style:{"margin-top":"16px"}},DX=ug(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),$X={key:1,style:{"margin-top":"16px"}},BX={key:2},FX={style:{"margin-top":"8px"}},zX=ug(()=>re("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),NX={key:0},jX=ug(()=>re("h3",null,"Caption",-1)),VX={key:0},UX={key:1},HX=Ee({__name:"InterrogationView",setup(e){const t=LX(),n=Pn(),r=$t(),i=oe();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await i2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function m(){n.generateText2Img({prompt:o.value})}const o=te(()=>t.getFormStatus()),{ellipsis:a}=n2();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ue("div",BX,[re("div",FX,[le(C(st),{icon:C(os),onClick:C(t).resetInterrogation},{default:pe(()=>[Ue("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(j(),we(C(st),{key:0,icon:C(os),onClick:m,disabled:!C(o)},{default:pe(()=>[Ue("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):_e("",!0)]),zX,le(C(kp),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(j(),ue("div",NX,[jX,C(o)?(j(),ue("div",UX,[re("strong",null,Pe(C(o)),1)])):(j(),ue("div",VX,"Processing"+Pe(C(a)),1))])):_e("",!0)])):(j(),ue("div",$X,[re("strong",null,"Uploading image"+Pe(C(a)),1)])):(j(),ue("div",RX,[re("div",null,[le(C(Ip),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Gh))]),_:1}),DX]),_:1},512)])]))}});const WX=Xt(HX,[["__scopeId","data-v-db184ac6"]]);function YX(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),m=Math.floor(e%86400%3600%60),o=r>0?r+(t?"d":"days"):"",a=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=m>0?m+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(o),n!=null&&n.hours&&c.push(a),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const XX={class:"form"},KX={key:0,style:{"padding-bottom":"50px"}},GX=re("h1",{style:{margin:"0"}},"Interrogation",-1),qX=re("div",null,"Interrogate images to get their predicted descriptions.",-1),ZX={class:"sidebar"},JX=re("span",{style:{height:"100%","font-size":"14px"}},[Ue("Reference Image: "),re("br"),Ue("(Photomaker/Kontext) ")],-1),QX=re("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),eK={class:"main"},tK={class:"image center-horizontal"},nK={key:0},rK=Ee({__name:"GenerateView",setup(e){const n=cp(up).smallerOrEqual("md"),r=Pn(),i=$t(),l=ms(),m=rn();let o=[];const a=iI(async()=>{if(o.length===0)try{o=(await(await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/samplers`)).json()).map(g=>g.name)}catch{o=[]}return o.length===0?[]:c(o)}),u=["default","discrete","karras","exponential","ays","gits","sgm_uniform","simple","smoothstep"],h=wt({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function c(g){return!r.params||!r.params.sampler_name||g.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=g[0]),g}function f(g){return"Elapsed: "+YX(g,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function s(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function d(g){r.generatorType=g,s(),console.log(g)}function v(){l.showCropPreview=!0,l.updateCropPreview()}return s(),IX(),(g,y)=>(j(),ue(ze,null,[le(C(X1),{"default-active":C(r).generatorType,collapse:!0,onSelect:d,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[le(nu,{index:"Text2Img","icon-one":C(Wk),"icon-two":C($l),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Img2Img","icon-one":C($l),"icon-two":C($l),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(nu,{index:"Inpainting","icon-one":t2,"icon-two":C($l),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(nu,{index:"Interrogation","icon-one":GU,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),re("div",XX,[C(r).generatorType==="Interrogation"?(j(),ue("div",KX,[GX,qX,le(WX)])):(j(),we(C(Tp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:h,onSubmit:y[28]||(y[28]=Je(()=>{},["prevent"]))},{default:pe(()=>[re("div",ZX,[le(C(R$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":y[23]||(y[23]=b=>C(i).activeCollapse=b),style:{"margin-bottom":"24px"}},{default:pe(()=>[le(C(D$),{title:"Generation Options",name:"1"},{default:pe(()=>[le(hH),le(lh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":y[0]||(y[0]=b=>C(r).negativePrompt=b),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),le(lh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":y[2]||(y[2]=b=>C(r).params.seed=b),placeholder:"Enter seed here"},{append:pe(()=>[le(C(kr),{content:"Randomize!",placement:"top"},{default:pe(()=>[le(C(st),{icon:C(f3),onClick:y[1]||(y[1]=()=>C(r).params.seed=C(N2)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue"]),C(r).multiSelect.sampler.enabled?(j(),we(Pu,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":y[3]||(y[3]=b=>C(r).multiSelect.sampler.selected=b),options:C(a),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),we(Pu,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":y[4]||(y[4]=b=>C(r).params.sampler_name=b),options:C(a),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])),le(kn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":y[5]||(y[5]=b=>C(r).params.n=b),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),we(kn,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":y[6]||(y[6]=b=>C(r).multiSelect.steps.selected=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(kn,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":y[7]||(y[7]=b=>C(r).params.steps=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),le(kn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":y[8]||(y[8]=b=>C(r).params.width=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),le(kn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":y[9]||(y[9]=b=>C(r).params.height=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),we(kn,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":y[10]||(y[10]=b=>C(r).multiSelect.guidance.selected=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(kn,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":y[11]||(y[11]=b=>C(r).params.cfg_scale=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),we(kn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":y[12]||(y[12]=b=>C(r).multiSelect.clipSkip.selected=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(kn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":y[13]||(y[13]=b=>C(r).params.clip_skip=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),we(kn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":y[14]||(y[14]=b=>C(r).params.denoising_strength=b),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):_e("",!0),le(kn,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":y[15]||(y[15]=b=>C(r).params.frames=b),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). Max 80 frames, about 5 seconds of video."},null,8,["modelValue","min","max"]),le(Pu,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":y[16]||(y[16]=b=>C(r).params.scheduler=b),options:u,info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue"]),re("div",null,[JX,re("input",{class:"el-button",type:"file",id:"extra_image_input",onChange:y[17]||(y[17]=b=>C(r).setExtraImage(b)),accept:"image/*",multiple:""},null,32),re("button",{onClick:y[18]||(y[18]=b=>C(r).clearExtraImage()),class:"el-button"},"Clear Image")]),QX,le(C(vj),null,{default:pe(()=>[le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":y[19]||(y[19]=b=>C(r).multiSelect.sampler.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":y[20]||(y[20]=b=>C(r).multiSelect.guidance.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":y[21]||(y[21]=b=>C(r).multiSelect.clipSkip.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Ul),{span:C(n)?24:12},{default:pe(()=>[le(tu,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":y[22]||(y[22]=b=>C(r).multiSelect.steps.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),re("div",eK,[le(C(st),{onClick:y[24]||(y[24]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:pe(()=>[Ue("Reset")]),_:1}),le(C(st),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:y[25]||(y[25]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[re("span",null," Generate "+Pe(C(r).totalImageCount)+" image"+Pe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),we(C(st),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:y[26]||(y[26]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue()})},{default:pe(()=>[Ue("Cancel all")]),_:1},8,["disabled"])):_e("",!0)]),re("div",tK,[le(C($D),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ue("div",nK,[/Inpainting/.test(C(r).generatorType)?(j(),we(E0,{key:0})):_e("",!0),/Img2Img/.test(C(r).generatorType)?(j(),we(E0,{key:1})):_e("",!0)])):_e("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),we(rH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:f(C(r).timer.seconds),onShowGenerated:y[27]||(y[27]=b=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):_e("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),we(SH,{key:2})):_e("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const _s=MT({history:Gx("./"),routes:[{path:"/",name:"generate",component:rK},{path:"/images",name:"images",component:()=>Mf(()=>Promise.resolve().then(()=>JK),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>Mf(()=>Promise.resolve().then(()=>fG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>Mf(()=>Promise.resolve().then(()=>bG),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Kf(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,scheduler:"default"}}function N2(){return Math.floor(Math.random()*9999999)+1}const Pn=Co("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=oe("Text2Img"),r=oe(""),i=zn("promptHistory",[]),l=oe(""),m=zn("negativeLibrary",[]),o=oe(Kf()),a=oe({interval:0,seconds:0}),u=oe({sampler:{name:"Sampler",enabled:!1,selected:[o.value.sampler_name],noneMessage:"Failed to generate: No sampler selected.",mapToParam:K=>K.sampler_name},steps:{name:"Steps",enabled:!1,selected:[o.value.steps],noneMessage:"Failed to generate: No steps selected.",mapToParam:K=>K.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[o.value.cfg_scale],noneMessage:"Failed to generate: No guidance selected.",mapToParam:K=>K.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[o.value.clip_skip],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:K=>K.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=oe({...h(),sourceProcessing:"inpainting"}),f=oe({...h(),sourceProcessing:"img2img"}),s=K=>K==="Inpainting"?c.value:K==="Img2Img"?f.value:h(),d=te(()=>s(n.value)),v=oe(""),g=oe(!1),y=oe(!1),b=oe([]),_=oe([]),w=oe(64),S=te(()=>rn().allowLargerParams==="Enabled"?3072:1024),x=oe(1),T=oe(20),O=oe(1),A=te(()=>rn().allowLargerParams==="Enabled"?150:50),D=oe(1),N=oe(24),R=oe(.1),B=oe(1),E=oe(0),U=oe(10),ne=oe(1),ee=oe(80),se=(K,ce,be)=>Array.from({length:(ce-K+1)/be},(Ce,Te)=>(Te+K)*be),I=oe(se(E.value,U.value,1)),z=oe(se(D.value,N.value,.5)),M=te(()=>{const K=(Se,Me,Re=1)=>Se*(Me.enabled?Me.selected.length:Re),be=o.value.n*H().length,Ce=K(be,u.value.sampler),Te=K(Ce,u.value.steps),Ae=K(Te,u.value.guidance);return K(Ae,u.value.clipSkip)});function L(){return o.value=Kf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,Q(),!0}function Q(){_.value=[]}async function V(K){if(!e.includes(K))return[];if(r.value==="")return q("Failed to generate: No prompt submitted.");for(const Ct of Object.values(u.value))if(Ct.enabled&&Ct.selected.length===0)return q(Ct.noneMessage);const ce=ms(),be=$t();ce.saveImages();const{sourceImage:Ce,maskImage:Te,sourceProcessing:Ae}=s(K);F(r.value);const ye=[],Se=(Ct,Ft)=>Ct.enabled?Ct.selected:Ft,Me=H(),Re=Se(u.value.guidance,[o.value.cfg_scale]),dt=Se(u.value.steps,[o.value.steps]),ht=Se(u.value.clipSkip,[o.value.clip_skip]),ot=Se(u.value.sampler,[o.value.sampler_name]),Kt=[await X()];for(const Ct of Re)for(const Ft of dt)for(const Qt of ht)for(const gn of Me){const Bn=gn.split(" ### ");for(const W2 of ot){let Al=parseInt(o.value.seed.toString());(isNaN(Al)||Al<0)&&(Al=N2());for(let Kc=0;Kc0&&(Or.params.extra_images=ae),ye.push(Or)}}}g.value=!0,be.showGeneratedImages=!1;for(let Ct=0;Ct{a.value.seconds++},1e3);!_.value.every(Ct=>Ct.gathered||Ct.failed)&&!y.value;){const Ct=_.value.filter(Qt=>!Qt.gathered&&!Qt.failed),Ft=Jt(Ct);for(const[Qt,gn]of Ct.slice(0,Ft).entries()){if(y.value)break;gn.gathered=!0;try{const Bn=await Y(gn.params);if(!Bn){gn.failed=!0;continue}P([{...Bn,...gn}])}catch(Bn){gn.failed=!0,console.error("Error fetching image:",Bn)}}}}async function P(K){const ce=wa();console.log(K);const be=await Promise.all(K.map(async Ae=>{const ye=Ae.images[0],Me=!!Ae.animated?"gif":"png";return{id:-1,image:`data:image/${Me};base64,${ye}`,prompt:Ae.prompt,clip_skip:Ae.params.clip_skip,modelName:Ae.models[0],seed:Ae.params.seed,steps:Ae.params.steps,sampler_name:Ae.params.sampler_name,cfg_scale:Ae.params.cfg_scale,width:Ae.params.width,height:Ae.params.height,frames:Ae.params.frames,scheduler:Ae.params.scheduler}})),Ce=await ce.pushOutputs(be),Te=0;return b.value=[...Ce.map(Ae=>({type:"image",index:Te,output:Ae})),...b.value].sort((Ae,ye)=>Ae.index-ye.index),b.value.length===_.value.length&&(_.value=[],g.value=!1,$t().showGeneratedImages=!0,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),be}async function q(K){const ce=$t();return K&&ce.raiseError(K,!1),[]}function Z(K,ce,be,Ce){return ce<=be?ce:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${K}' to its default value instead of ${ce}.`,!0),Ce)}function ie(K,ce=!0){const be=Kf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,_s.push("/"),ce&&(K.width=K.width||be.width,K.height=K.height||be.height),K.prompt){const Ce=K.prompt.split(" ### ");r.value=Ce[0],l.value=Ce[1]||""}K.sampler_name&&(o.value.sampler_name=K.sampler_name),K.steps&&(o.value.steps=Z("steps",K.steps,A.value,be.steps)),K.cfg_scale&&(o.value.cfg_scale=K.cfg_scale),K.width&&(o.value.width=Z("width",K.width,S.value,be.width)),K.height&&(o.value.height=Z("height",K.height,S.value,be.height)),K.seed&&(o.value.seed=K.seed),K.clip_skip&&(o.value.clip_skip=Z("clip_skip",K.clip_skip,U.value,be.clip_skip)),K.scheduler&&(o.value.scheduler=K.scheduler),K.frames&&(o.value.frames=Z("frames",K.frames,ee.value,be.frames))}function he(K){const ce=ms();n.value="Img2Img",f.value.sourceImage=K,ce.drawing=!1,b.value=[],_s.push("/"),Jn.fabric.Image.fromURL(K,ce.newImage)}function me(K){const ce=ms();b.value=[],c.value.sourceImage=K,n.value="Inpainting",_s.push("/"),Jn.fabric.Image.fromURL(K,ce.newImage)}function ve(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function H(){const K=ve(),ce=K.match(/\{(.*?)\}/g)||[];if(ce.length===0)return[K];let be=[];return ce.forEach(Ce=>{const Te=[],Ae=Ce.replace("{","").replace("}","").split("|");be.length===0?Ae.forEach(ye=>{const Se=K.replace(Ce,ye);Te.push(Se)}):be.forEach(ye=>{Ae.forEach(Se=>{const Me=ye.replace(Ce,Se);Te.push(Me)})}),be=[...Te]}),be}async function Y(K){const ce=rn();try{const be=await fetch(`${ce.baseURL.length===0?".":ce.baseURL}/sdapi/v1/${K.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}),Ce=await be.json();return yh(be,Ce,200,"Failed to fetch",k)?Ce:!1}catch{return!1}}function k(K){return $t().raiseError(K,!1),y.value=!1,b.value=[],!1}async function X(){const K=rn(),ce=await fetch(`${K.baseURL.length===0?".":K.baseURL}/sdapi/v1/sd-models`),be=await ce.json();if(!!yh(ce,be,200,"Failed to get available models"))return be.length===0?"(No model loaded)":be[0].model_name}function W(K){m.value.indexOf(K)===-1&&(m.value=[...m.value,K])}function $(K){m.value=m.value.filter(ce=>ce!=K)}function F(K){if(i.value.findIndex(ce=>ce.prompt===K)===-1){if(i.value.length>=10+i.value.filter(ce=>ce.starred).length){const ce=i.value.filter(Ce=>!Ce.starred),be=i.value.findIndex(Ce=>Ce===ce[ce.length-1]);i.value.splice(be,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:K}]}}function G(K){i.value=i.value.filter(ce=>ce.prompt!=K&&ce!=K)}function de(){return!1}var ae=[];function J(K){let ce=K.target;if(ae=[],ce.files.length>0)for(let be=0;benew DataView(new ArrayBuffer(e)),$a=e=>new Uint8Array(e.buffer||e),qa=e=>new TextEncoder().encode(String(e));function iK(e,t){if(t===void 0||t instanceof Date||(t=new Date(t)),e instanceof File)return{t:t||new Date(e.lastModified),o:e.stream()};if(e instanceof Response)return{t:t||new Date(e.headers.get("Last-Modified")||Date.now()),o:e.body};if(t===void 0)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(typeof e=="string")return{t,o:qa(e)};if(e instanceof Blob)return{t,o:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{t,o:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{t,o:$a(e)};if(Symbol.asyncIterator in e)return{t,o:j2(e)};throw new TypeError("Unsupported input format.")}function j2(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=0;for(;n.desiredSize>r;){const i=await t.next();if(!i.value){n.close();break}{const l=aK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function aK(e){return typeof e=="string"?qa(e):e instanceof Uint8Array?e:$a(e)}function oK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=qa(t)),e instanceof File)return{i:t||qa(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),m=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||qa(m),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:qa(e).length}:e instanceof Blob?{i:t,A:e.size}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:t,A:e.byteLength}:{i:t,A:n}}var sK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:lK,m:uK}=sK.exports,cK=$a(uK).subarray(65536);function gy(e,t=0){for(const n of function*(r){for(;r.length>65536;)yield r.subarray(0,65536),r=r.subarray(65536);r.length&&(yield r)}(e))cK.set(n),t=lK(n.length,t);return t}function V2(e,t,n=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(n,r,1),t.setUint16(n+2,i,1)}function fK(e){const t=Xc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),V2(e.t,t,10),t.setUint16(26,e.i.length,1),$a(t)}async function*dK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=gy(t,0),e.A=t.length;else{e.A=0;const n=t.getReader();for(;;){const{value:r,done:i}=await n.read();if(i)break;e.u=gy(r,e.u),e.A+=r.length,yield r}}}function hK(e){const t=Xc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),$a(t)}function pK(e,t){const n=Xc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),V2(e.t,n,12),n.setUint32(16,e.u,1),n.setUint32(20,e.A,1),n.setUint32(24,e.A,1),n.setUint16(28,e.i.length,1),n.setUint16(40,33204,1),n.setUint32(42,t,1),$a(n)}function gK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function mK(e,t={}){const n={"Content-Type":"application/zip","Content-Disposition":"attachment"};return Number.isInteger(t.length)&&t.length>0&&(n["Content-Length"]=t.length),t.metadata&&(n["Content-Length"]=p(t.metadata)),new Response(j2(async function*(r){const i=[];let l=0,m=0;for await(const u of r)yield fK(u),yield u.i,yield*dK(u),yield hK(u),i.push(pK(u,l)),i.push(u.i),m++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=Xc(22);a.setUint32(0,1347093766),a.setUint16(8,m,1),a.setUint16(10,m,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield $a(a)}(async function*(r){for await(const i of r){const[l,m]=gK(i);yield Object.assign(iK(...m),oK(...l))}}(e))),{headers:n})}async function U2(e,t=!0,n){const r=rn();t&&Ri({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let o=0;o]/g,"").substring(0,128).trimEnd();r.imageDownloadType==="PNG"?i.push({name:f+".png",input:await aa(u,"image/png")}):r.imageDownloadType==="JPG"?i.push({name:f+".jpg",input:await aa(u,"image/jpeg")}):r.imageDownloadType==="GIF"?i.push({name:f+".gif",input:await aa(u,"image/gif")}):i.push({name:f+".webp",input:await aa(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await mK(i).blob(),m=document.createElement("a");m.href=URL.createObjectURL(l),m.download="sdui_images.zip",m.click()}async function vK(e,t){const n=rn(),r=document.createElement("a");let i;n.imageDownloadType==="PNG"?(i=await aa(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):n.imageDownloadType==="JPG"?(i=await aa(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):n.imageDownloadType==="GIF"?(i=await aa(e,"image/gif"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".gif"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const H2=Ee({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=Pn(),r=wa(),i=()=>{aw.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ri({type:"success",message:"Deleted Image"})})};async function l(m){const o=window.location.origin,a={prompt:m.prompt,width:m.width?m.width:void 0,height:m.height?m.height:void 0,steps:m.steps,cfg_scale:m.cfg_scale,sampler_name:m.sampler_name,model_name:m.modelName,seed:m.seed,clip_skip:m.clip_skip,frames:m.frames,scheduler:m.scheduler},u=window.location.pathname.replace("images","");let h=`${o}${u}?share=`,c="",f="";for(const[d,v]of Object.entries(a)){if(!v)continue;let g=v;typeof v=="string"?g=encodeURIComponent(v):Array.isArray(v)&&(g=JSON.stringify(v)),c+=`${f}${d}=${g}`,f="&"}h+=btoa(String.fromCharCode.apply(null,Array.from(AX(c)))),await navigator.clipboard.writeText(h),Ri({type:"success",message:"Copied shareable link to clipboard"})}return(m,o)=>(j(),ue(ze,null,[le(C(st),{onClick:i,type:"danger",icon:C(Oc),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(st),{onClick:o[0]||(o[0]=a=>C(vK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",icon:C(Is),plain:""},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"]),e.imageData.starred?_e("",!0):(j(),we(C(st),{key:0,onClick:o[1]||(o[1]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(zO),plain:""},{default:pe(()=>[Ue("Favourite")]),_:1},8,["icon"])),e.imageData.starred?(j(),we(C(st),{key:1,onClick:o[2]||(o[2]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(Jb),plain:""},{default:pe(()=>[Ue("Unfavourite")]),_:1},8,["icon"])):_e("",!0),le(C(st),{onClick:o[3]||(o[3]=a=>C(n).generateText2Img(e.imageData)),type:"success",icon:C(os),plain:""},{default:pe(()=>[Ue("Text2img")]),_:1},8,["icon"]),le(C(st),{onClick:o[4]||(o[4]=a=>C(n).generateImg2Img(e.imageData.image)),type:"success",icon:C(os),plain:""},{default:pe(()=>[Ue("Img2img")]),_:1},8,["icon"]),le(C(st),{onClick:o[5]||(o[5]=a=>C(n).generateInpainting(e.imageData.image)),type:"success",icon:C(os),plain:""},{default:pe(()=>[Ue("Inpainting")]),_:1},8,["icon"]),le(C(st),{onClick:o[6]||(o[6]=a=>l(e.imageData)),type:"success",icon:C(e3),plain:""},{default:pe(()=>[Ue("Copy Link")]),_:1},8,["icon"])],64))}}),yK={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},bK=["src"],_K={style:{"font-size":"18px","font-weight":"500"}},wK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},CK=Ee({__name:"ImageDialog",setup(e){const t=wa(),n=$t(),r=oe();II(r,{onSwipeEnd(o,a){a==="RIGHT"&&n.openModalToLeft(),a==="LEFT"&&n.openModalToRight()}});const i=te({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=oe(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const o=t.currentOutputs.find(a=>a.id===n.activeModal);if(o)return l.value=o;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function m(){i.value=!1}return(o,a)=>{var u;return j(),we(C(SB),{"model-value":C(i),width:(u=l.value)==null?void 0:u.width,class:"image-viewer",onClosed:m,"align-center":""},{default:pe(()=>{var h,c,f;return[re("div",{class:"main-output-container",ref_key:"target",ref:r},[re("div",yK,[(h=l.value)!=null&&h.image?(j(),ue("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,bK)):_e("",!0)])],512),re("div",_K,Pe(((c=l.value.prompt)==null?void 0:c.split("###")[0])||"Unkown Creation"),1),re("div",wK,[re("div",null,"Negative Prompt: "+Pe(((f=l.value.prompt)==null?void 0:f.split("###")[1])||"None"),1),re("span",null,"Model: "+Pe(l.value.modelName||"Unknown")+" - ",1),re("span",null,"Sampler: "+Pe(l.value.sampler_name||"Unknown")+" - ",1),re("span",null,"Seed: "+Pe(l.value.seed||"Unknown")+" - ",1),re("span",null,"Steps: "+Pe(l.value.steps||"Unknown")+" - ",1),re("span",null,"CFG Scale: "+Pe(l.value.cfg_scale||"Unknown")+" - ",1),re("span",null,"Clip Skip: "+Pe(l.value.clip_skip||"Unknown")+" - ",1),re("span",null,"Dimensions: "+Pe(l.value.width||"???")+"x"+Pe(l.value.height||"???")+" - ",1)]),re("div",null,[le(H2,{"image-data":l.value},null,8,["image-data"])])]}),_:1},8,["model-value","width"])}}});const SK=e=>(Jr("data-v-8f4d2380"),e=e(),Qr(),e),xK=SK(()=>re("div",{style:{"font-size":"20px"}},"Stable UI",-1)),TK={class:"generator-icons"},kK=Ee({__name:"App",setup(e){const n=cp(up).smallerOrEqual("md"),r=$t();rn();const i=RT(),l=oe();return ke(()=>i.path,m=>{l.value&&l.value.open(m)}),(m,o)=>(j(),ue(ze,null,[re("div",{class:fe({"menu-container":!C(n)})},[le(C(X1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?_e("",!0):(j(),we(C(Op),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[xK]),_:1})),le(Ho,{isMobile:C(n),index:"/"},{icon:pe(()=>[re("div",TK,[le(C(De),null,{default:pe(()=>[le(C(z3))]),_:1}),C(r).showGeneratorBadge?(j(),we(C(De),{key:0,class:"generator-badge",size:10},{default:pe(()=>[le(RU)]),_:1})):_e("",!0)])]),title:pe(()=>[Ue("Generate")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/images"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(v3))]),_:1})]),title:pe(()=>[Ue("Images")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/about"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Kb))]),_:1})]),title:pe(()=>[Ue("About")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/options"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(qO))]),_:1})]),title:pe(()=>[Ue("Options")]),_:1},8,["isMobile"]),le(Ho,{isMobile:C(n),index:"/return"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Hb))]),_:1})]),title:pe(()=>[Ue("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),re("div",{class:fe({view:!C(n)})},[le(C(Ub))],2),le(CK)],64))}});const EK=Xt(kK,[["__scopeId","data-v-8f4d2380"]]);const cg=xx(EK);cg.use(Ex());cg.use(_s);cg.mount("#app");_s.replace("/");const OK={key:1,class:"image-action"},AK=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=oe(null);uI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=oe(!1);PI(r,([{isIntersecting:m}])=>{m&&(i.value=m)},{rootMargin:"500px"});const l=te(()=>n.selected.includes(t.imageData.id));return(m,o)=>(j(),ue("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),we(C(kp),{key:0,class:"thumbnail",src:e.imageData.image,onClick:o[0]||(o[0]=a=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):_e("",!0),i.value?(j(),ue("div",OK,[e.imageData.starred?(j(),we(C(De),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[le(C(Jb))]),_:1})):_e("",!0),C(n).multiSelect?(j(),ue("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(De),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?_e("",!0):(j(),we(C(ul),{key:0})),C(l)?(j(),we(C(Yb),{key:1})):_e("",!0)]),_:1},8,["color"])])):_e("",!0)])):_e("",!0)],512))}});const my=Xt(AK,[["__scopeId","data-v-b9569bbd"]]);const PK={},IK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},MK=re("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),LK=[MK];function RK(e,t){return j(),ue("svg",IK,LK)}const DK=Xt(PK,[["render",RK]]),$K=e=>(Jr("data-v-301360a8"),e=e(),Qr(),e),BK={class:"images-top-bar"},FK={class:"options"},zK=["onClick"],NK=["onClick"],jK=["onClick"],VK={key:1,class:"center-both",style:{gap:"12px"}},UK={key:2},HK=$K(()=>re("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),WK=[HK],YK={key:0},XK={key:0,style:{display:"flex",gap:"8px"}},KK={key:1,class:"images"},GK={key:1},qK=Ee({__name:"ImagesView",setup(e){const{width:t}=NI(),n=wa(),r=rn(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function m(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function o(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function a(){i.selected=[],i.multiSelect=!1}const u=()=>{aw.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};Zm(["a","A","ArrowLeft"],i.openModalToLeft),Zm(["d","D","ArrowRight"],i.openModalToRight);async function h(){U2(i.selected)}const c=te(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ue(ze,null,[re("div",BK,[re("div",FK,[le(C(Yl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(OO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["Newest","Oldest"],d=>re("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Pe(d),11,zK)),64))]),_:1}),le(C(Yl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(PE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>re("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Pe(C(n).filterBy===d?"Showing":"Show")+" "+Pe(d),11,NK)),64))]),_:1}),le(C(Yl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(DK)]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>re("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Pe(d.label),11,jK)),64))]),_:1}),le(C(Yl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(st),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),we(C(Yb),{key:0})):(j(),we(C(ul),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ue("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ue("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ue("div",{key:2,class:"el-select-dropdown__item selected",onClick:a},"Deselect All")):(j(),ue("div",{key:3,class:"el-select-dropdown__item",onClick:m},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(v=>v.id).includes(d))?(j(),ue("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ue("div",{key:4,class:"el-select-dropdown__item selected",onClick:o},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),we(C(XN),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):_e("",!0),C(i).multiSelect?(j(),ue("div",VK,[re("div",null,Pe(C(i).selected.length)+" selected",1),le(C(st),{type:"danger",onClick:u,icon:C(Oc),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(st),{type:"success",onClick:h,icon:C(Is),plain:"",style:{margin:"0"}},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"])])):(j(),ue("div",UK,WK))]),C(n).outputsLength!=0?(j(),ue("div",YK,[C(n).currentLayout==="dynamic"?(j(),ue("div",XK,[(j(!0),ue(ze,null,Dt(C(c),(d,v)=>(j(),ue("div",{key:v,style:{flex:"1 1 0%"}},[(j(!0),ue(ze,null,Dt(d,g=>(j(),we(my,{key:g.id,"image-data":g,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):_e("",!0),C(n).currentLayout==="grid"?(j(),ue("div",KK,[(j(!0),ue(ze,null,Dt(C(n).currentOutputs,d=>(j(),we(my,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):_e("",!0)])):_e("",!0),C(n).outputsLength==0?(j(),ue("div",GK,[le(C(mF),{description:"No Images Found"})])):_e("",!0)],64))}});const ZK=Xt(qK,[["__scopeId","data-v-301360a8"]]),JK=Object.freeze(Object.defineProperty({__proto__:null,default:ZK},Symbol.toStringTag,{value:"Module"})),QK=["href"],eG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=ft("router-link");return j(),ue(ze,null,[e.router?_e("",!0):(j(),ue("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,QK)),e.router?(j(),we(r,{key:1,to:e.href},{default:pe(()=>[xe(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):_e("",!0)],64)}}});const tG=Xt(eG,[["__scopeId","data-v-17b53b7d"]]),El=e=>(Jr("data-v-ecc278c5"),e=e(),Qr(),e),nG={class:"about"},rG={class:"about-content"},iG=El(()=>re("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),aG=El(()=>re("div",null,[Ue("This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in "),re("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ue(".")],-1)),oG=El(()=>re("br",null,null,-1)),sG=El(()=>re("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),lG=El(()=>re("br",null,null,-1)),uG=Ee({__name:"AboutView",setup(e){return(t,n)=>(j(),ue("div",nG,[re("div",rG,[iG,aG,oG,sG,lG,re("div",null,[Ue("You can find the KoboldAI community and authors of this fork on the "),le(tG,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ue("KoboldAI Discord")]),_:1})])])]))}});const cG=Xt(uG,[["__scopeId","data-v-ecc278c5"]]),fG=Object.freeze(Object.defineProperty({__proto__:null,default:cG},Symbol.toStringTag,{value:"Module"}));const lu=Ee({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=te(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,m)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Cl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(l.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(c$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ue(ze,null,Dt(e.options,o=>(j(),we(C(f$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),Ol=e=>(Jr("data-v-d14e7594"),e=e(),Qr(),e),dG=Ol(()=>re("h1",null,"Options",-1)),hG=Ol(()=>re("h2",null,"Generation Options",-1)),pG=Ol(()=>re("h2",null,"Image Options",-1)),gG=Ol(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),mG=Ol(()=>re("h2",null,"General Options",-1)),vG=Ee({__name:"OptionsView",setup(e){const t=rn(),n=wa(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=oe([]),l=oe(),m=oe(!1),o=oe(0);async function a(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ri({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),m.value=!0,o.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await U2(h,!1,()=>{o.value++}),m.value=!1,o.value=0}return(h,c)=>(j(),ue(ze,null,[dG,le(C(Tp),{"label-position":"top",model:C(t).options,onSubmit:c[8]||(c[8]=Je(()=>{},["prevent"]))},{default:pe(()=>[le(C(y9),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[le(C(Cf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[hG,le(C(xi),{label:"Base URL"},{default:pe(()=>[le(C(La),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1}),le(lu,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).allowLargerParams=f),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Cf),{label:"\u{1F4F7} Images"},{default:pe(()=>[pG,le(kn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(lu,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(lu,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(lu,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[5]||(c[5]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(xi),{label:"Export Images (ZIP File)"},{default:pe(()=>[m.value?(j(),we(C(st),{key:1,icon:C(Is),disabled:""},{default:pe(()=>[Ue("Downloading... ("+Pe(o.value)+" / "+Pe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),we(C(st),{key:0,icon:C(Is),onClick:c[6]||(c[6]=f=>u())},{default:pe(()=>[Ue("Download "+Pe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(xi),{label:"Import Images (ZIP File)"},{default:pe(()=>[le(C(Ip),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:a,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(Gh))]),_:1}),gG]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Cf),{label:"\u2699\uFE0F General"},{default:pe(()=>[mG,le(Pu,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[7]||(c[7]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const yG=Xt(vG,[["__scopeId","data-v-d14e7594"]]),bG=Object.freeze(Object.defineProperty({__proto__:null,default:yG},Symbol.toStringTag,{value:"Module"}));