diff --git a/embd_res/kcpp_sdui.embd b/embd_res/kcpp_sdui.embd index d6bc85f44..2cae75fea 100644 --- a/embd_res/kcpp_sdui.embd +++ b/embd_res/kcpp_sdui.embd @@ -70,7 +70,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,l){function g(u,d){if(!i[u]){if(!r[u]){var c=typeof Su=="function"&&Su;if(!d&&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(h){var v=r[u][1][h];return g(v||h)},s,s.exports,n,r,i,l)}return i[u].exports}for(var o=typeof Su=="function"&&Su,a=0;a>2,s=(3&u)<<4|d>>4,h=1<_?(15&d)<<2|c>>6:64,v=2<_?63&c:64,m.push(o.charAt(f)+o.charAt(s)+o.charAt(h)+o.charAt(v));return m.join("")},i.decode=function(a){var u,d,c,f,s,h,v=0,m=0,y="data:";if(a.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var b,_=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&_--,a.charAt(a.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=g.uint8array?new Uint8Array(0|_):new Array(0|_);v>4,d=(15&f)<<4|(s=o.indexOf(a.charAt(v++)))>>2,c=(3&s)<<6|(h=o.indexOf(a.charAt(v++))),b[m++]=u,s!==64&&(b[m++]=d),h!==64&&(b[m++]=c);return b}},{"./support":30,"./utils":32}],2:[function(n,r,i){var l=n("./external"),g=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),a=n("./stream/DataLengthProbe");function u(d,c,f,s,h){this.compressedSize=d,this.uncompressedSize=c,this.crc32=f,this.compression=s,this.compressedContent=h}u.prototype={getContentWorker:function(){var d=new g(l.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),c=this;return d.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new g(l.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,c,f){return d.pipe(new o).pipe(new a("uncompressedSize")).pipe(c.compressWorker(f)).pipe(new a("compressedSize")).withStreamInfo("compression",c)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var l=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new l("STORE compression")},uncompressWorker:function(){return new l("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var l=n("./utils"),g=function(){for(var o,a=[],u=0;u<256;u++){o=u;for(var d=0;d<8;d++)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,d,c,f){var s=g,h=f+c;u^=-1;for(var v=f;v>>8^s[255&(u^d[v])];return-1^u}(0|a,o,o.length,0):function(u,d,c,f){var s=g,h=f+c;u^=-1;for(var v=f;v>>8^s[255&(u^d.charCodeAt(v))];return-1^u}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var l=null;l=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:l}},{lie:37}],7:[function(n,r,i){var l=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=n("pako"),o=n("./utils"),a=n("./stream/GenericWorker"),u=l?"uint8array":"array";function d(c,f){a.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(d,a),d.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,c.data),!1)},d.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(f){c.push({data:f,meta:c.meta})}},i.compressWorker=function(c){return new d("Deflate",c)},i.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function l(s,h){var v,m="";for(v=0;v>>=8;return m}function g(s,h,v,m,y,b){var _,w,S=s.file,x=s.compression,k=b!==u.utf8encode,E=o.transformTo("string",b(S.name)),I=o.transformTo("string",u.utf8encode(S.name)),D=S.comment,N=o.transformTo("string",b(D)),L=o.transformTo("string",u.utf8encode(D)),B=I.length!==S.name.length,O=L.length!==D.length,V="",re="",J="",ue=S.dir,M=S.date,H={crc32:0,compressedSize:0,uncompressedSize:0};h&&!v||(H.crc32=s.crc32,H.compressedSize=s.compressedSize,H.uncompressedSize=s.uncompressedSize);var R=0;h&&(R|=8),k||!B&&!O||(R|=2048);var P=0,Q=0;ue&&(P|=16),y==="UNIX"?(Q=798,P|=function(A,q){var G=A;return A||(G=q?16893:33204),(65535&G)<<16}(S.unixPermissions,ue)):(Q=20,P|=function(A){return 63&(A||0)}(S.dosPermissions)),_=M.getUTCHours(),_<<=6,_|=M.getUTCMinutes(),_<<=5,_|=M.getUTCSeconds()/2,w=M.getUTCFullYear()-1980,w<<=4,w|=M.getUTCMonth()+1,w<<=5,w|=M.getUTCDate(),B&&(re=l(1,1)+l(d(E),4)+I,V+="up"+l(re.length,2)+re),O&&(J=l(1,1)+l(d(N),4)+L,V+="uc"+l(J.length,2)+J);var j="";return j+=` \0`,j+=l(R,2),j+=x.magic,j+=l(_,2),j+=l(w,2),j+=l(H.crc32,4),j+=l(H.compressedSize,4),j+=l(H.uncompressedSize,4),j+=l(E.length,2),j+=l(V.length,2),{fileRecord:c.LOCAL_FILE_HEADER+j+E+V,dirRecord:c.CENTRAL_FILE_HEADER+l(Q,2)+j+l(N.length,2)+"\0\0\0\0"+l(P,4)+l(m,4)+E+V+N}}var o=n("../utils"),a=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),c=n("../signature");function f(s,h,v,m){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=v,this.encodeFileName=m,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,a),f.prototype.push=function(s){var h=s.meta.percent||0,v=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,a.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:v?(h+100*(v-m-1))/v:100}}))},f.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var h=this.streamFiles&&!s.file.dir;if(h){var v=g(s,h,!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 h=this.streamFiles&&!s.file.dir,v=g(s,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),h)this.push({data:function(m){return c.DATA_DESCRIPTOR+l(m.crc32,4)+l(m.compressedSize,4)+l(m.uncompressedSize,4)}(s),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var s=this.bytesWritten,h=0;h=this.index;a--)u=(u<<8)+this.byteAt(a);return this.index+=o,u},readString:function(o){return l.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=g},{"../utils":32}],19:[function(n,r,i){var l=n("./Uint8ArrayReader");function g(o){l.call(this,o)}n("../utils").inherits(g,l),g.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var l=n("./DataReader");function g(o){l.call(this,o)}n("../utils").inherits(g,l),g.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},g.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},g.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},g.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=g},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var l=n("./ArrayReader");function g(o){l.call(this,o)}n("../utils").inherits(g,l),g.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},r.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var l=n("../utils"),g=n("../support"),o=n("./ArrayReader"),a=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(c){var f=l.getTypeOf(c);return l.checkSupport(f),f!=="string"||g.uint8array?f==="nodebuffer"?new u(c):g.uint8array?new d(l.transformTo("uint8array",c)):new o(l.transformTo("array",c)):new a(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var l=n("./GenericWorker"),g=n("../utils");function o(a){l.call(this,"ConvertWorker to "+a),this.destType=a}g.inherits(o,l),o.prototype.processChunk=function(a){this.push({data:g.transformTo(this.destType,a.data),meta:a.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var l=n("./GenericWorker"),g=n("../crc32");function o(){l.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,l),o.prototype.processChunk=function(a){this.streamInfo.crc32=g(a.data,this.streamInfo.crc32||0),this.push(a)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var l=n("../utils"),g=n("./GenericWorker");function o(a){g.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}l.inherits(o,g),o.prototype.processChunk=function(a){if(a){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+a.data.length}g.prototype.processChunk.call(this,a)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var l=n("../utils"),g=n("./GenericWorker");function o(a){g.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=l.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}l.inherits(o,g),o.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,l.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(l.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,u);break;case"uint8array":a=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":a=this.data.slice(this.index,u)}return this.index=u,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function l(g){this.name=g||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}l.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,o){return this._listeners[g].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,o){if(this._listeners[g])for(var a=0;a "+g:g}},r.exports=l},{}],29:[function(n,r,i){var l=n("../utils"),g=n("./ConvertWorker"),o=n("./GenericWorker"),a=n("../base64"),u=n("../support"),d=n("../external"),c=null;if(u.nodestream)try{c=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(h,v){return new d.Promise(function(m,y){var b=[],_=h._internalType,w=h._outputType,S=h._mimeType;h.on("data",function(x,k){b.push(x),v&&v(k)}).on("error",function(x){b=[],y(x)}).on("end",function(){try{var x=function(k,E,I){switch(k){case"blob":return l.newBlob(l.transformTo("arraybuffer",E),I);case"base64":return a.encode(E);default:return l.transformTo(k,E)}}(w,function(k,E){var I,D=0,N=null,L=0;for(I=0;I"u")i.blob=!1;else{var l=new ArrayBuffer(0);try{i.blob=new Blob([l],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(l),i.blob=g.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var l=n("./utils"),g=n("./support"),o=n("./nodejsUtils"),a=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function c(){a.call(this,"utf-8 decode"),this.leftOver=null}function f(){a.call(this,"utf-8 encode")}i.utf8encode=function(s){return g.nodebuffer?o.newBufferFrom(s,"utf-8"):function(h){var v,m,y,b,_,w=h.length,S=0;for(b=0;b>>6:(m<65536?v[_++]=224|m>>>12:(v[_++]=240|m>>>18,v[_++]=128|m>>>12&63),v[_++]=128|m>>>6&63),v[_++]=128|63&m);return v}(s)},i.utf8decode=function(s){return g.nodebuffer?l.transformTo("nodebuffer",s).toString("utf-8"):function(h){var v,m,y,b,_=h.length,w=new Array(2*_);for(v=m=0;v<_;)if((y=h[v++])<128)w[m++]=y;else if(4<(b=u[y]))w[m++]=65533,v+=b-1;else{for(y&=b===2?31:b===3?15:7;1>10&1023,w[m++]=56320|1023&y)}return w.length!==m&&(w.subarray?w=w.subarray(0,m):w.length=m),l.applyFromCharCode(w)}(s=l.transformTo(g.uint8array?"uint8array":"array",s))},l.inherits(c,a),c.prototype.processChunk=function(s){var h=l.transformTo(g.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var v=h;(h=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),h.set(v,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var m=function(b,_){var w;for((_=_||b.length)>b.length&&(_=b.length),w=_-1;0<=w&&(192&b[w])==128;)w--;return w<0||w===0?_:w+u[b[w]]>_?w:_}(h),y=h;m!==h.length&&(g.uint8array?(y=h.subarray(0,m),this.leftOver=h.subarray(m,h.length)):(y=h.slice(0,m),this.leftOver=h.slice(m,h.length))),this.push({data:i.utf8decode(y),meta:s.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=c,l.inherits(f,a),f.prototype.processChunk=function(s){this.push({data:i.utf8encode(s.data),meta:s.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var l=n("./support"),g=n("./base64"),o=n("./nodejsUtils"),a=n("./external");function u(v){return v}function d(v,m){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=l(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var h,v,m,y=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4>>6:(s<65536?f[m++]=224|s>>>12:(f[m++]=240|s>>>18,f[m++]=128|s>>>12&63),f[m++]=128|s>>>6&63),f[m++]=128|63&s);return f},i.buf2binstring=function(c){return d(c,c.length)},i.binstring2buf=function(c){for(var f=new l.Buf8(c.length),s=0,h=f.length;s>10&1023,b[h++]=56320|1023&v)}return d(b,h)},i.utf8border=function(c,f){var s;for((f=f||c.length)>c.length&&(f=c.length),s=f-1;0<=s&&(192&c[s])==128;)s--;return s<0||s===0?f:s+a[c[s]]>f?s:f}},{"./common":41}],43:[function(n,r,i){r.exports=function(l,g,o,a){for(var u=65535&l|0,d=l>>>16&65535|0,c=0;o!==0;){for(o-=c=2e3>>1:g>>>1;o[a]=g}return o}();r.exports=function(g,o,a,u){var d=l,c=u+a;g^=-1;for(var f=u;f>>8^d[255&(g^o[f])];return-1^g}},{}],46:[function(n,r,i){var l,g=n("../utils/common"),o=n("./trees"),a=n("./adler32"),u=n("./crc32"),d=n("./messages"),c=0,f=4,s=0,h=-2,v=-1,m=4,y=2,b=8,_=9,w=286,S=30,x=19,k=2*w+1,E=15,I=3,D=258,N=D+I+1,L=42,B=113,O=1,V=2,re=3,J=4;function ue(T,Y){return T.msg=d[Y],Y}function M(T){return(T<<1)-(4T.avail_out&&(W=T.avail_out),W!==0&&(g.arraySet(T.output,Y.pending_buf,Y.pending_out,W,T.next_out),T.next_out+=W,Y.pending_out+=W,T.total_out+=W,T.avail_out-=W,Y.pending-=W,Y.pending===0&&(Y.pending_out=0))}function P(T,Y){o._tr_flush_block(T,0<=T.block_start?T.block_start:-1,T.strstart-T.block_start,Y),T.block_start=T.strstart,R(T.strm)}function Q(T,Y){T.pending_buf[T.pending++]=Y}function j(T,Y){T.pending_buf[T.pending++]=Y>>>8&255,T.pending_buf[T.pending++]=255&Y}function A(T,Y){var W,$,F=T.max_chain_length,K=T.strstart,fe=T.prev_length,ie=T.nice_match,Z=T.strstart>T.w_size-N?T.strstart-(T.w_size-N):0,me=T.window,se=T.w_mask,ge=T.prev,we=T.strstart+D,Te=me[K+fe-1],Ae=me[K+fe];T.prev_length>=T.good_match&&(F>>=2),ie>T.lookahead&&(ie=T.lookahead);do if(me[(W=Y)+fe]===Ae&&me[W+fe-1]===Te&&me[W]===me[K]&&me[++W]===me[K+1]){K+=2,W++;do;while(me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&me[++K]===me[++W]&&KZ&&--F!=0);return fe<=T.lookahead?fe:T.lookahead}function q(T){var Y,W,$,F,K,fe,ie,Z,me,se,ge=T.w_size;do{if(F=T.window_size-T.lookahead-T.strstart,T.strstart>=ge+(ge-N)){for(g.arraySet(T.window,T.window,ge,ge,0),T.match_start-=ge,T.strstart-=ge,T.block_start-=ge,Y=W=T.hash_size;$=T.head[--Y],T.head[Y]=ge<=$?$-ge:0,--W;);for(Y=W=ge;$=T.prev[--Y],T.prev[Y]=ge<=$?$-ge:0,--W;);F+=ge}if(T.strm.avail_in===0)break;if(fe=T.strm,ie=T.window,Z=T.strstart+T.lookahead,me=F,se=void 0,se=fe.avail_in,me=I)for(K=T.strstart-T.insert,T.ins_h=T.window[K],T.ins_h=(T.ins_h<=I&&(T.ins_h=(T.ins_h<=I)if($=o._tr_tally(T,T.strstart-T.match_start,T.match_length-I),T.lookahead-=T.match_length,T.match_length<=T.max_lazy_match&&T.lookahead>=I){for(T.match_length--;T.strstart++,T.ins_h=(T.ins_h<=I&&(T.ins_h=(T.ins_h<=I&&T.match_length<=T.prev_length){for(F=T.strstart+T.lookahead-I,$=o._tr_tally(T,T.strstart-1-T.prev_match,T.prev_length-I),T.lookahead-=T.prev_length-1,T.prev_length-=2;++T.strstart<=F&&(T.ins_h=(T.ins_h<T.pending_buf_size-5&&(W=T.pending_buf_size-5);;){if(T.lookahead<=1){if(q(T),T.lookahead===0&&Y===c)return O;if(T.lookahead===0)break}T.strstart+=T.lookahead,T.lookahead=0;var $=T.block_start+W;if((T.strstart===0||T.strstart>=$)&&(T.lookahead=T.strstart-$,T.strstart=$,P(T,!1),T.strm.avail_out===0)||T.strstart-T.block_start>=T.w_size-N&&(P(T,!1),T.strm.avail_out===0))return O}return T.insert=0,Y===f?(P(T,!0),T.strm.avail_out===0?re:J):(T.strstart>T.block_start&&(P(T,!1),T.strm.avail_out),O)}),new ce(4,4,8,4,G),new ce(4,5,16,8,G),new ce(4,6,32,32,G),new ce(4,4,16,16,te),new ce(8,16,32,32,te),new ce(8,16,128,128,te),new ce(8,32,128,256,te),new ce(32,128,258,1024,te),new ce(32,258,258,4096,te)],i.deflateInit=function(T,Y){return X(T,Y,b,15,8,0)},i.deflateInit2=X,i.deflateReset=U,i.deflateResetKeep=ve,i.deflateSetHeader=function(T,Y){return T&&T.state?T.state.wrap!==2?h:(T.state.gzhead=Y,s):h},i.deflate=function(T,Y){var W,$,F,K;if(!T||!T.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&&(T.adler=u(T.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 fe=b+($.w_bits-8<<4)<<8;fe|=(2<=$.strategy||$.level<2?0:$.level<6?1:$.level===6?2:3)<<6,$.strstart!==0&&(fe|=32),fe+=31-fe%31,$.status=B,j($,fe),$.strstart!==0&&(j($,T.adler>>>16),j($,65535&T.adler)),T.adler=1}if($.status===69)if($.gzhead.extra){for(F=$.pending;$.gzindex<(65535&$.gzhead.extra.length)&&($.pending!==$.pending_buf_size||($.gzhead.hcrc&&$.pending>F&&(T.adler=u(T.adler,$.pending_buf,$.pending-F,F)),R(T),F=$.pending,$.pending!==$.pending_buf_size));)Q($,255&$.gzhead.extra[$.gzindex]),$.gzindex++;$.gzhead.hcrc&&$.pending>F&&(T.adler=u(T.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&&(T.adler=u(T.adler,$.pending_buf,$.pending-F,F)),R(T),F=$.pending,$.pending===$.pending_buf_size)){K=1;break}K=$.gzindex<$.gzhead.name.length?255&$.gzhead.name.charCodeAt($.gzindex++):0,Q($,K)}while(K!==0);$.gzhead.hcrc&&$.pending>F&&(T.adler=u(T.adler,$.pending_buf,$.pending-F,F)),K===0&&($.gzindex=0,$.status=91)}else $.status=91;if($.status===91)if($.gzhead.comment){F=$.pending;do{if($.pending===$.pending_buf_size&&($.gzhead.hcrc&&$.pending>F&&(T.adler=u(T.adler,$.pending_buf,$.pending-F,F)),R(T),F=$.pending,$.pending===$.pending_buf_size)){K=1;break}K=$.gzindex<$.gzhead.comment.length?255&$.gzhead.comment.charCodeAt($.gzindex++):0,Q($,K)}while(K!==0);$.gzhead.hcrc&&$.pending>F&&(T.adler=u(T.adler,$.pending_buf,$.pending-F,F)),K===0&&($.status=103)}else $.status=103;if($.status===103&&($.gzhead.hcrc?($.pending+2>$.pending_buf_size&&R(T),$.pending+2<=$.pending_buf_size&&(Q($,255&T.adler),Q($,T.adler>>8&255),T.adler=0,$.status=B)):$.status=B),$.pending!==0){if(R(T),T.avail_out===0)return $.last_flush=-1,s}else if(T.avail_in===0&&M(Y)<=M(W)&&Y!==f)return ue(T,-5);if($.status===666&&T.avail_in!==0)return ue(T,-5);if(T.avail_in!==0||$.lookahead!==0||Y!==c&&$.status!==666){var ie=$.strategy===2?function(Z,me){for(var se;;){if(Z.lookahead===0&&(q(Z),Z.lookahead===0)){if(me===c)return O;break}if(Z.match_length=0,se=o._tr_tally(Z,0,Z.window[Z.strstart]),Z.lookahead--,Z.strstart++,se&&(P(Z,!1),Z.strm.avail_out===0))return O}return Z.insert=0,me===f?(P(Z,!0),Z.strm.avail_out===0?re:J):Z.last_lit&&(P(Z,!1),Z.strm.avail_out===0)?O:V}($,Y):$.strategy===3?function(Z,me){for(var se,ge,we,Te,Ae=Z.window;;){if(Z.lookahead<=D){if(q(Z),Z.lookahead<=D&&me===c)return O;if(Z.lookahead===0)break}if(Z.match_length=0,Z.lookahead>=I&&0Z.lookahead&&(Z.match_length=Z.lookahead)}if(Z.match_length>=I?(se=o._tr_tally(Z,1,Z.match_length-I),Z.lookahead-=Z.match_length,Z.strstart+=Z.match_length,Z.match_length=0):(se=o._tr_tally(Z,0,Z.window[Z.strstart]),Z.lookahead--,Z.strstart++),se&&(P(Z,!1),Z.strm.avail_out===0))return O}return Z.insert=0,me===f?(P(Z,!0),Z.strm.avail_out===0?re:J):Z.last_lit&&(P(Z,!1),Z.strm.avail_out===0)?O:V}($,Y):l[$.level].func($,Y);if(ie!==re&&ie!==J||($.status=666),ie===O||ie===re)return T.avail_out===0&&($.last_flush=-1),s;if(ie===V&&(Y===1?o._tr_align($):Y!==5&&(o._tr_stored_block($,0,0,!1),Y===3&&(H($.head),$.lookahead===0&&($.strstart=0,$.block_start=0,$.insert=0))),R(T),T.avail_out===0))return $.last_flush=-1,s}return Y!==f?s:$.wrap<=0?1:($.wrap===2?(Q($,255&T.adler),Q($,T.adler>>8&255),Q($,T.adler>>16&255),Q($,T.adler>>24&255),Q($,255&T.total_in),Q($,T.total_in>>8&255),Q($,T.total_in>>16&255),Q($,T.total_in>>24&255)):(j($,T.adler>>>16),j($,65535&T.adler)),R(T),0<$.wrap&&($.wrap=-$.wrap),$.pending!==0?s:1)},i.deflateEnd=function(T){var Y;return T&&T.state?(Y=T.state.status)!==L&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==B&&Y!==666?ue(T,h):(T.state=null,Y===B?ue(T,-3):s):h},i.deflateSetDictionary=function(T,Y){var W,$,F,K,fe,ie,Z,me,se=Y.length;if(!T||!T.state||(K=(W=T.state).wrap)===2||K===1&&W.status!==L||W.lookahead)return h;for(K===1&&(T.adler=a(T.adler,Y,se,0)),W.wrap=0,se>=W.w_size&&(K===0&&(H(W.head),W.strstart=0,W.block_start=0,W.insert=0),me=new g.Buf8(W.w_size),g.arraySet(me,Y,se-W.w_size,W.w_size,0),Y=me,se=W.w_size),fe=T.avail_in,ie=T.next_in,Z=T.input,T.avail_in=se,T.next_in=0,T.input=Y,q(W);W.lookahead>=I;){for($=W.strstart,F=W.lookahead-(I-1);W.ins_h=(W.ins_h<>>=I=E>>>24,_-=I,(I=E>>>16&255)===0)V[d++]=65535&E;else{if(!(16&I)){if((64&I)==0){E=w[(65535&E)+(b&(1<>>=I,_-=I),_<15&&(b+=O[a++]<<_,_+=8,b+=O[a++]<<_,_+=8),E=S[b&k];n:for(;;){if(b>>>=I=E>>>24,_-=I,!(16&(I=E>>>16&255))){if((64&I)==0){E=S[(65535&E)+(b&(1<>>=I,_-=I,(I=d-c)>3,b&=(1<<(_-=D<<3))-1,l.next_in=a,l.next_out=d,l.avail_in=a>>24&255)+(L>>>8&65280)+((65280&L)<<8)+((255&L)<<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 _(L){var B;return L&&L.state?(B=L.state,L.total_in=L.total_out=B.total=0,L.msg="",B.wrap&&(L.adler=1&B.wrap),B.mode=h,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new l.Buf32(v),B.distcode=B.distdyn=new l.Buf32(m),B.sane=1,B.back=-1,f):s}function w(L){var B;return L&&L.state?((B=L.state).wsize=0,B.whave=0,B.wnext=0,_(L)):s}function S(L,B){var O,V;return L&&L.state?(V=L.state,B<0?(O=0,B=-B):(O=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=J.wsize?(l.arraySet(J.window,B,O-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(V<(re=J.wsize-J.wnext)&&(re=V),l.arraySet(J.window,B,O-V,re,J.wnext),(V-=re)?(l.arraySet(J.window,B,O-V,V,0),J.wnext=V,J.whave=J.wsize):(J.wnext+=re,J.wnext===J.wsize&&(J.wnext=0),J.whave>>8&255,O.check=o(O.check,K,2,0),P=R=0,O.mode=2;break}if(O.flags=0,O.head&&(O.head.done=!1),!(1&O.wrap)||(((255&R)<<8)+(R>>8))%31){L.msg="incorrect header check",O.mode=30;break}if((15&R)!=8){L.msg="unknown compression method",O.mode=30;break}if(P-=4,T=8+(15&(R>>>=4)),O.wbits===0)O.wbits=T;else if(T>O.wbits){L.msg="invalid window size",O.mode=30;break}O.dmax=1<>8&1),512&O.flags&&(K[0]=255&R,K[1]=R>>>8&255,O.check=o(O.check,K,2,0)),P=R=0,O.mode=3;case 3:for(;P<32;){if(M===0)break e;M--,R+=V[J++]<>>8&255,K[2]=R>>>16&255,K[3]=R>>>24&255,O.check=o(O.check,K,4,0)),P=R=0,O.mode=4;case 4:for(;P<16;){if(M===0)break e;M--,R+=V[J++]<>8),512&O.flags&&(K[0]=255&R,K[1]=R>>>8&255,O.check=o(O.check,K,2,0)),P=R=0,O.mode=5;case 5:if(1024&O.flags){for(;P<16;){if(M===0)break e;M--,R+=V[J++]<>>8&255,O.check=o(O.check,K,2,0)),P=R=0}else O.head&&(O.head.extra=null);O.mode=6;case 6:if(1024&O.flags&&(M<(A=O.length)&&(A=M),A&&(O.head&&(T=O.head.extra_len-O.length,O.head.extra||(O.head.extra=new Array(O.head.extra_len)),l.arraySet(O.head.extra,V,J,A,T)),512&O.flags&&(O.check=o(O.check,V,A,J)),M-=A,J+=A,O.length-=A),O.length))break e;O.length=0,O.mode=7;case 7:if(2048&O.flags){if(M===0)break e;for(A=0;T=V[J+A++],O.head&&T&&O.length<65536&&(O.head.name+=String.fromCharCode(T)),T&&A>9&1,O.head.done=!0),L.adler=O.check=0,O.mode=12;break;case 10:for(;P<32;){if(M===0)break e;M--,R+=V[J++]<>>=7&P,P-=7&P,O.mode=27;break}for(;P<3;){if(M===0)break e;M--,R+=V[J++]<>>=1)){case 0:O.mode=14;break;case 1:if(D(O),O.mode=20,B!==6)break;R>>>=2,P-=2;break e;case 2:O.mode=17;break;case 3:L.msg="invalid block type",O.mode=30}R>>>=2,P-=2;break;case 14:for(R>>>=7&P,P-=7&P;P<32;){if(M===0)break e;M--,R+=V[J++]<>>16^65535)){L.msg="invalid stored block lengths",O.mode=30;break}if(O.length=65535&R,P=R=0,O.mode=15,B===6)break e;case 15:O.mode=16;case 16:if(A=O.length){if(M>>=5,P-=5,O.ndist=1+(31&R),R>>>=5,P-=5,O.ncode=4+(15&R),R>>>=4,P-=4,286>>=3,P-=3}for(;O.have<19;)O.lens[fe[O.have++]]=0;if(O.lencode=O.lendyn,O.lenbits=7,W={bits:O.lenbits},Y=u(0,O.lens,0,19,O.lencode,0,O.work,W),O.lenbits=W.bits,Y){L.msg="invalid code lengths set",O.mode=30;break}O.have=0,O.mode=19;case 19:for(;O.have>>16&255,pe=65535&F,!((te=F>>>24)<=P);){if(M===0)break e;M--,R+=V[J++]<>>=te,P-=te,O.lens[O.have++]=pe;else{if(pe===16){for($=te+2;P<$;){if(M===0)break e;M--,R+=V[J++]<>>=te,P-=te,O.have===0){L.msg="invalid bit length repeat",O.mode=30;break}T=O.lens[O.have-1],A=3+(3&R),R>>>=2,P-=2}else if(pe===17){for($=te+3;P<$;){if(M===0)break e;M--,R+=V[J++]<>>=te)),R>>>=3,P-=3}else{for($=te+7;P<$;){if(M===0)break e;M--,R+=V[J++]<>>=te)),R>>>=7,P-=7}if(O.have+A>O.nlen+O.ndist){L.msg="invalid bit length repeat",O.mode=30;break}for(;A--;)O.lens[O.have++]=T}}if(O.mode===30)break;if(O.lens[256]===0){L.msg="invalid code -- missing end-of-block",O.mode=30;break}if(O.lenbits=9,W={bits:O.lenbits},Y=u(d,O.lens,0,O.nlen,O.lencode,0,O.work,W),O.lenbits=W.bits,Y){L.msg="invalid literal/lengths set",O.mode=30;break}if(O.distbits=6,O.distcode=O.distdyn,W={bits:O.distbits},Y=u(c,O.lens,O.nlen,O.ndist,O.distcode,0,O.work,W),O.distbits=W.bits,Y){L.msg="invalid distances set",O.mode=30;break}if(O.mode=20,B===6)break e;case 20:O.mode=21;case 21:if(6<=M&&258<=H){L.next_out=ue,L.avail_out=H,L.next_in=J,L.avail_in=M,O.hold=R,O.bits=P,a(L,j),ue=L.next_out,re=L.output,H=L.avail_out,J=L.next_in,V=L.input,M=L.avail_in,R=O.hold,P=O.bits,O.mode===12&&(O.back=-1);break}for(O.back=0;ce=(F=O.lencode[R&(1<>>16&255,pe=65535&F,!((te=F>>>24)<=P);){if(M===0)break e;M--,R+=V[J++]<>ve)])>>>16&255,pe=65535&F,!(ve+(te=F>>>24)<=P);){if(M===0)break e;M--,R+=V[J++]<>>=ve,P-=ve,O.back+=ve}if(R>>>=te,P-=te,O.back+=te,O.length=pe,ce===0){O.mode=26;break}if(32&ce){O.back=-1,O.mode=12;break}if(64&ce){L.msg="invalid literal/length code",O.mode=30;break}O.extra=15&ce,O.mode=22;case 22:if(O.extra){for($=O.extra;P<$;){if(M===0)break e;M--,R+=V[J++]<>>=O.extra,P-=O.extra,O.back+=O.extra}O.was=O.length,O.mode=23;case 23:for(;ce=(F=O.distcode[R&(1<>>16&255,pe=65535&F,!((te=F>>>24)<=P);){if(M===0)break e;M--,R+=V[J++]<>ve)])>>>16&255,pe=65535&F,!(ve+(te=F>>>24)<=P);){if(M===0)break e;M--,R+=V[J++]<>>=ve,P-=ve,O.back+=ve}if(R>>>=te,P-=te,O.back+=te,64&ce){L.msg="invalid distance code",O.mode=30;break}O.offset=pe,O.extra=15&ce,O.mode=24;case 24:if(O.extra){for($=O.extra;P<$;){if(M===0)break e;M--,R+=V[J++]<>>=O.extra,P-=O.extra,O.back+=O.extra}if(O.offset>O.dmax){L.msg="invalid distance too far back",O.mode=30;break}O.mode=25;case 25:if(H===0)break e;if(A=j-H,O.offset>A){if((A=O.offset-A)>O.whave&&O.sane){L.msg="invalid distance too far back",O.mode=30;break}q=A>O.wnext?(A-=O.wnext,O.wsize-A):O.wnext-A,A>O.length&&(A=O.length),G=O.window}else G=re,q=ue-O.offset,A=O.length;for(Hk?(I=q[G+m[B]],P[Q+m[B]]):(I=96,0),b=1<>ue)+(_-=b)]=E<<24|I<<16|D|0,_!==0;);for(b=1<>=1;if(b!==0?(R&=b-1,R+=b):R=0,B++,--j[L]==0){if(L===V)break;L=c[f+m[B]]}if(re>>7)]}function Q(F,K){F.pending_buf[F.pending++]=255&K,F.pending_buf[F.pending++]=K>>>8&255}function j(F,K,fe){F.bi_valid>y-fe?(F.bi_buf|=K<>y-F.bi_valid,F.bi_valid+=fe-y):(F.bi_buf|=K<>>=1,fe<<=1,0<--K;);return fe>>>1}function G(F,K,fe){var ie,Z,me=new Array(m+1),se=0;for(ie=1;ie<=m;ie++)me[ie]=se=se+fe[ie-1]<<1;for(Z=0;Z<=K;Z++){var ge=F[2*Z+1];ge!==0&&(F[2*Z]=q(me[ge]++,ge))}}function te(F){var K;for(K=0;K>1;1<=fe;fe--)ve(F,me,fe);for(Z=we;fe=F.heap[1],F.heap[1]=F.heap[F.heap_len--],ve(F,me,1),ie=F.heap[1],F.heap[--F.heap_max]=fe,F.heap[--F.heap_max]=ie,me[2*Z]=me[2*fe]+me[2*ie],F.depth[Z]=(F.depth[fe]>=F.depth[ie]?F.depth[fe]:F.depth[ie])+1,me[2*fe+1]=me[2*ie+1]=Z,F.heap[1]=Z++,ve(F,me,1),2<=F.heap_len;);F.heap[--F.heap_max]=F.heap[1],function(Ae,Fe){var _e,Se,De,Me,mt,_t,pt=Fe.dyn_tree,on=Fe.max_code,sn=Fe.stat_desc.static_tree,wi=Fe.stat_desc.has_stree,wn=Fe.stat_desc.extra_bits,Ut=Fe.stat_desc.extra_base,aa=Fe.stat_desc.max_length,ao=0;for(Me=0;Me<=m;Me++)Ae.bl_count[Me]=0;for(pt[2*Ae.heap[Ae.heap_max]+1]=0,_e=Ae.heap_max+1;_e>=7;Z>>=1)if(1&Te&&ge.dyn_ltree[2*we]!==0)return g;if(ge.dyn_ltree[18]!==0||ge.dyn_ltree[20]!==0||ge.dyn_ltree[26]!==0)return o;for(we=32;we>>3,(me=F.static_len+3+7>>>3)<=Z&&(Z=me)):Z=me=fe+5,fe+4<=Z&&K!==-1?$(F,K,fe,ie):F.strategy===4||me===Z?(j(F,2+(ie?1:0),3),U(F,N,L)):(j(F,4+(ie?1:0),3),function(ge,we,Te,Ae){var Fe;for(j(ge,we-257,5),j(ge,Te-1,5),j(ge,Ae-4,4),Fe=0;Fe>>8&255,F.pending_buf[F.d_buf+2*F.last_lit+1]=255&K,F.pending_buf[F.l_buf+F.last_lit]=255&fe,F.last_lit++,K===0?F.dyn_ltree[2*fe]++:(F.matches++,K--,F.dyn_ltree[2*(O[fe]+c+1)]++,F.dyn_dtree[2*P(K)]++),F.last_lit===F.lit_bufsize-1},i._tr_align=function(F){j(F,2,3),A(F,_,N),function(K){K.bi_valid===16?(Q(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)}(F)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(l){(function(g,o){if(!g.setImmediate){var a,u,d,c,f=1,s={},h=!1,v=g.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(g);m=m&&m.setTimeout?m:g,a={}.toString.call(g.process)==="[object process]"?function(w){process.nextTick(function(){b(w)})}:function(){if(g.postMessage&&!g.importScripts){var w=!0,S=g.onmessage;return g.onmessage=function(){w=!1},g.postMessage("","*"),g.onmessage=S,w}}()?(c="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",_,!1):g.attachEvent("onmessage",_),function(w){g.postMessage(c+w,"*")}):g.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){b(w.data)},function(w){d.port2.postMessage(w)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(w){var S=v.createElement("script");S.onreadystatechange=function(){b(w),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(w){setTimeout(b,0,w)},m.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var S=new Array(arguments.length-1),x=0;x"u"?l===void 0?this:l:self)}).call(this,typeof pu<"u"?pu:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(g2);var Lh=function(e,t){return Lh=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])},Lh(e,t)};function wm(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Lh(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function FU(e,t,n,r){function i(l){return l instanceof n?l:new n(function(g){g(l)})}return new(n||(n=Promise))(function(l,g){function o(d){try{u(r.next(d))}catch(c){g(c)}}function a(d){try{u(r.throw(d))}catch(c){g(c)}}function u(d){d.done?l(d.value):i(d.value).then(o,a)}u((r=r.apply(e,t||[])).next())})}function v2(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,i,l,g;return g={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function o(u){return function(d){return a([u,d])}}function a(u){if(r)throw new TypeError("Generator is already executing.");for(;g&&(g=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(l=u[0]&2?i.return:u[0]?i.throw||((l=i.return)&&l.call(i),0):i.next)&&!(l=l.call(i,u[1])).done)return l;switch(i=0,l&&(u=[u[0]&2,l.value]),u[0]){case 0:case 1:l=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!l||u[1]>l[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pc(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,l=[],g;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)l.push(i.value)}catch(o){g={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(g)throw g.error}}return l}function Ic(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(h){c(l[0][3],h)}}function a(f){f.value instanceof Ao?Promise.resolve(f.value.v).then(u,d):c(l[0][2],f)}function u(f){o("next",f)}function d(f){o("throw",f)}function c(f,s){f(s),l.shift(),l.length&&o(l[0][0],l[0][1])}}function NU(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 _l=="function"?_l(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(l){n[l]=e[l]&&function(g){return new Promise(function(o,a){g=e[l](g),i(o,a,g.done,g.value)})}}function i(l,g,o,a){Promise.resolve(a).then(function(u){l({value:u,done:o})},g)}}function dn(e){return typeof e=="function"}function jU(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 rd=jU(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 Q0(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Cm=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,l;if(!this.closed){this.closed=!0;var g=this._parentage;if(g)if(this._parentage=null,Array.isArray(g))try{for(var o=_l(g),a=o.next();!a.done;a=o.next()){var u=a.value;u.remove(this)}}catch(v){t={error:v}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}else g.remove(this);var d=this.initialTeardown;if(dn(d))try{d()}catch(v){l=v instanceof rd?v.errors:[v]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var f=_l(c),s=f.next();!s.done;s=f.next()){var h=s.value;try{ey(h)}catch(v){l=l!=null?l:[],v instanceof rd?l=Ic(Ic([],Pc(l)),Pc(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 rd(l)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ey(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)&&Q0(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Q0(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();Cm.EMPTY;function y2(e){return e instanceof Cm||e&&"closed"in e&&dn(e.remove)&&dn(e.add)&&dn(e.unsubscribe)}function ey(e){dn(e)?e():e.unsubscribe()}var pf={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Rh={setTimeout:function(e,t){for(var n=[],r=2;rn.value=i,error:t==null?void 0:t.onError});return mH(()=>{r.unsubscribe()}),n}function vH(e,t,n){const r=ae(n==null?void 0:n.initialValue),i=_m(e);let l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError})}),gi(()=>{l.unsubscribe()}),r}const Ua=Xo("outputs",()=>{const e=gH(hH(_m(()=>Vt.outputs.count())),{initialValue:0}),t=ae(1),n=ln("sortOutputsBy","Oldest"),r=ln("currentImagesLayout","dynamic"),i=ae("all"),l=vH(()=>{const s=At();let h;return i.value==="all"?h=Vt.outputs:i.value==="favourited"?h=Vt.outputs.where("starred").equals(1):i.value==="unfavourited"?h=Vt.outputs.where("starred").equals(0):h=Vt.outputs.where("rated").equals(0),n.value==="Newest"&&(h=h.reverse()),s.pageless==="Enabled"?h.toArray():h.offset((t.value-1)*s.pageSize).limit(s.pageSize).toArray()},[Bn(At(),"pageless"),Bn(At(),"pageSize"),t,n,i],{initialValue:[]});async function g(){if(navigator.storage&&navigator.storage.persist){const s=await navigator.storage.persist();console.log(`Persisted storage granted: ${s}`)}}async function o(){const s=localStorage.getItem("outputs");!s||(a(JSON.parse(s)),localStorage.removeItem("outputs"))}g(),o();async function a(s){const h=s.map(y=>{const{id:b,..._}=y;return _}),v=50,m=[];for(let y=0;y{S.async("base64").then(async D=>{if(!v[E+".json"])return y++,I(null);const N=JSON.parse(await v[E+".json"].async("text"));m++,I({id:-1,image:`data:image/webp;base64,${D}`,...N,rated:N.rated?1:0,starred:N.starred?1:0})}).catch(D=>(h.raiseError(`Error while importing image: ${D}`,!1),y++,I(null)))}))}const _=await Promise.all(b);a(_.filter(w=>w!==null)),Qi({message:`Successfully imported ${m}/${m+y} images!`,type:"success"})}async function d(s){const h=await Vt.outputs.get(s);return Vt.outputs.update(s,{starred:h!=null&&h.starred?0:1})}function c(s){return Vt.outputs.delete(s)}async function f(s){const h=Wt();return h.selected=[],h.multiSelect=!1,s===await Vt.outputs.toCollection().primaryKeys()?Vt.outputs.clear():Vt.outputs.bulkDelete(s)}return{outputsLength:e,sortBy:n,filterBy:i,currentPage:t,currentOutputs:l,currentLayout:r,deleteOutput:c,deleteMultipleOutputs:f,toggleStarred:d,pushOutputs:a,importFromZip:u}}),Wt=Xo("ui",()=>{const e=ae(!1),t=ae([]),n=ae(["1"]),r=ae(-1),i=ae(!1),l=ae(!1);function g(f,s){console.error(f),Qi({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Qi({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 d(){const f=Ua(),s=At(),h=f.currentOutputs.findIndex(m=>m.id===r.value),v=f.currentOutputs[h+1];if(v){r.value=v.id;return}if(f.currentPage<=Math.floor(f.outputsLength/s.pageSize)){const m=f.sortBy==="Newest"?await Vt.outputs.where(":id").below(r.value).last():await Vt.outputs.where(":id").above(r.value).first();f.currentPage++,r.value=(m==null?void 0:m.id)||r.value;return}}async function c(){const f=Ua(),s=f.currentOutputs.findIndex(v=>v.id===r.value),h=f.currentOutputs[s-1];if(f.currentPage>1&&!h){const v=f.sortBy==="Oldest"?await Vt.outputs.where(":id").below(r.value).last():await Vt.outputs.where(":id").above(r.value).first();f.currentPage--,r.value=(v==null?void 0:v.id)||r.value;return}if(h){r.value=h.id;return}}return{multiSelect:e,selected:t,activeCollapse:n,activeModal:r,showGeneratorBadge:i,showGeneratedImages:l,raiseError:g,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:d,openModalToLeft:c}}),Jt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},yH={},bH={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},_H=ne("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),wH=[_H];function CH(e,t){return z(),oe("svg",bH,wH)}const SH=Jt(yH,[["render",CH]]),ms=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(z(),be(C(Qp),{index:e.index},{default:he(()=>[xe(t.$slots,"icon"),e.isMobile?ye("",!0):xe(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const xH="modulepreload",kH=function(e,t){return new URL(e,t).href},iy={},ad=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=kH(l,r),l in iy)return;iy[l]=!0;const g=l.endsWith(".css"),o=g?'[rel="stylesheet"]':"";if(!!r)for(let d=i.length-1;d>=0;d--){const c=i[d];if(c.href===l&&(!g||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=g?"stylesheet":xH,g||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),g)return new Promise((d,c)=>{u.addEventListener("load",d),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const TH={},EH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},OH=ne("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),AH=[OH];function PH(e,t){return z(),oe("svg",EH,AH)}const R2=Jt(TH,[["render",PH]]),IH={},MH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},LH=ne("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),RH=ne("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),DH=ne("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),$H=[LH,RH,DH];function BH(e,t){return z(),oe("svg",MH,$H)}const FH=Jt(IH,[["render",BH]]);function D2(){const e=ae("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return gi(()=>{clearInterval(t)}),{ellipsis:e}}const zH=e=>(hi("data-v-0d7f01fd"),e=e(),pi(),e),NH={style:{"text-align":"center"}},jH={key:0,class:"batch-text"},VH={key:0,class:"step-text"},UH={key:1},HH={class:"gen-text"},WH={key:0},YH={key:1},XH={key:2},KH=zH(()=>ne("br",null,null,-1)),GH={key:2,class:"preview-container"},qH=["src"],ZH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null,progressPercentage:null,textInfo:null,currentStep:null,totalSteps:null,previewImage:null,generating:{type:Boolean}},emits:["showGenerated"],setup(e){const{ellipsis:t}=D2(),n=(r,i)=>r?r.length>i?r.slice(0,i)+"\u2026":r:"";return(r,i)=>{var l,g,o,a,u;return z(),oe("div",NH,[e.generating&&e.total&&e.total>1?(z(),oe("div",jH," Image "+Oe(((l=e.generated)!=null?l:0)+1)+" of "+Oe(e.total),1)):ye("",!0),le(C(Iw),{type:"circle",percentage:(a=e.progressPercentage)!=null?a:100*((g=e.generated)!=null?g:0)/((o=e.total)!=null?o:1),width:200},{default:he(()=>{var d,c,f,s;return[e.progressPercentage!==void 0&&e.progressPercentage>0?(z(),oe("span",VH,Oe((d=e.currentStep)!=null?d:0)+" / "+Oe((c=e.totalSteps)!=null?c:0),1)):(z(),oe("span",UH,Oe((f=e.generated)!=null?f:0)+" / "+Oe((s=e.total)!=null?s:1),1))]}),_:1},8,["percentage"]),e.generated?(z(),oe("div",{key:1,onClick:i[0]||(i[0]=d=>r.$emit("showGenerated")),class:"view-images"},[ne("span",null,"View image"+Oe(((u=e.total)!=null?u:1)===1?"":"s"),1),le(C(Le),null,{default:he(()=>[le(C(h4))]),_:1})])):ye("",!0),ne("div",HH,[e.generated!==void 0&&e.total!==void 0&&e.generated===e.total&&e.generated>0?(z(),oe("span",WH,"All done!")):e.textInfo?(z(),oe("span",YH,Oe(n(e.textInfo,60)),1)):(z(),oe("span",XH,[Ue("Generating"+Oe(C(t))+Oe("\xA0".repeat(3-C(t).length)),1),KH,ne("sup",null,Oe(e.elapsed),1)]))]),e.previewImage?(z(),oe("div",GH,[ne("img",{src:`data:image/png;base64,${e.previewImage}`,class:"preview-img",alt:"Generation Preview"},null,8,qH)])):ye("",!0)])}}});const JH=Jt(ZH,[["__scopeId","data-v-0d7f01fd"]]);const QH={style:{width:"200px"}},eW=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(z(),be(C(Wn),{trigger:e.trigger},{content:he(()=>[ne("div",QH,[xe(t.$slots,"default",{},()=>[Ue(Oe(e.info),1)])])]),default:he(()=>[le(C(Le),{size:e.size},{default:he(()=>[le(C(bp))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),tW={key:0,class:"align-vertical",style:{"margin-left":"5px"}},nW=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(z(),oe("span",{class:"align-vertical",style:ze(e.labelStyle||"height: 100%;")},[xe(t.$slots,"default",{},()=>[Ue(Oe(e.label),1)],!0),e.info?(z(),oe("div",tW,[le(eW,{info:e.info,size:15},null,8,["info"])])):ye("",!0)],4))}});const Kl=Jt(nW,[["__scopeId","data-v-ec7e7ec1"]]),rW={key:0,style:{width:"100%"}},iW={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=Bp($p).smallerOrEqual("md");function l(d,c){var s;if(n.multiple&&Array.isArray(n.modelValue)){c=c||0;const h=(s=Array.isArray(d)?d[0]:d)!=null?s:n.min;let v=n.modelValue;v[c]=h,t("update:modelValue",v),t("change",v);return}const f=d!=null?d:n.min;t("update:modelValue",f),t("change",f)}function g(){if(!n.multiple||!Array.isArray(n.modelValue))return;const d=n.min;t("update:modelValue",[...n.modelValue,d]),t("onAdd",d)}function o(){if(!n.multiple||!Array.isArray(n.modelValue))return;const d=n.modelValue,c=d.pop();t("update:modelValue",d),t("onRemove",c)}const a=ee(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=ee(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(d,c)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(d.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[!e.multiple||!Array.isArray(e.modelValue)?(z(),oe("div",rW,[C(i)?ye("",!0):(z(),be(C(M0),{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)?(z(),be(C(lh),{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"])):ye("",!0)])):(z(),oe("div",iW,[(z(!0),oe(Ne,null,Nt(C(a),f=>(z(),oe("div",{key:f},[C(i)?ye("",!0):(z(),be(C(M0),{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)?(z(),be(C(lh),{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"])):ye("",!0)]))),128)),ne("div",null,[le(C(at),{icon:C(wp),onClick:c[0]||(c[0]=()=>g())},null,8,["icon"]),le(C(at),{icon:C(O_),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),xe(d.$slots,"inline")]),_:3},8,["prop"]))}});const Co=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)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(r.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(Aw),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:he(()=>[(z(!0),oe(Ne,null,Nt(e.options,l=>(z(),be(C(Pw),{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"]))}}),$h=Ee({__name:"FormInput",props:{label:null,modelValue:null,prop:null,type:null,resize:null,placeholder:null,autosize:{type:[Boolean,Object]},info:null,labelStyle:null,change:null,clearable:{type:Boolean},clearIcon:null},emits:["update:modelValue","focus","blur"],setup(e,{emit:t}){const n=e;function r(i){t("update:modelValue",i),n.change&&n.change(i)}return(i,l)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(i.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(to),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,clearable:e.clearable,"clear-icon":e.clearIcon,onFocus:l[0]||(l[0]=g=>i.$emit("focus")),onBlur:l[1]||(l[1]=g=>i.$emit("blur"))},{append:he(()=>[xe(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder","clearable","clear-icon"]),xe(i.$slots,"inline")]),_:3},8,["prop"]))}});const od=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 kb(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(i.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[e.disabledText&&e.disabled?(z(),be(C(Wn),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:he(()=>[le(C(L0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(z(),be(C(L0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),xe(i.$slots,"inline")]),_:3},8,["prop"]))}}),aW=e=>(hi("data-v-cf07eac2"),e=e(),pi(),e),oW=aW(()=>ne("div",null,"Prompt",-1)),sW=Ee({__name:"FormPromptInput",setup(e){const t=nn();return(n,r)=>(z(),be($h,{prop:"prompt",modelValue:C(t).prompt,"onUpdate:modelValue":r[0]||(r[0]=i=>C(t).prompt=i),autosize:{minRows:2,maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter prompt here","label-position":"top","label-style":"justify-content: space-between; width: 100%;"},{label:he(()=>[oW]),_:1},8,["modelValue"]))}});const lW=Jt(sW,[["__scopeId","data-v-cf07eac2"]]);const uW=e=>(hi("data-v-a260b725"),e=e(),pi(),e),cW={style:{position:"relative",height:"100%",width:"100%"}},fW=uW(()=>ne("span",null,"Back to generation status",-1)),dW={class:"carousel-container"},hW=["src"],pW={class:"carousel-footer"},mW={style:{display:"flex","justify-content":"center"}},gW={style:{"white-space":"nowrap"}},vW=Ee({__name:"GeneratedCarousel",setup(e){const t=nn(),n=Wt(),r=At(),i=ae(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function g(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(z(),oe("div",cW,[C(t).generating?(z(),oe("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(Le),null,{default:he(()=>[le(C(S_))]),_:1}),fW])):ye("",!0),ne("div",dW,[le(C(U$),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:he(()=>[(z(!0),oe(Ne,null,Nt(C(t).outputs,(u,d)=>(z(),be(C(H$),{key:d,style:{display:"flex","justify-content":"center"}},{default:he(()=>[u.type==="video"?(z(),oe("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,hW)):ye("",!0),u.type==="image"?(z(),be(C(lf),{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"])):ye("",!0)]),_:2},1024))),128))]),_:1},8,["autoplay"])]),ne("div",pW,[le(C(fF)),ne("div",mW,[le(C(j1),null,{default:he(()=>[ne("div",gW,[le(SC,{imageData:C(t).outputs[i.value].output,"on-delete":g,"show-dismiss":!0},null,8,["imageData"])])]),_:1})])])]))}});const yW=Jt(vW,[["__scopeId","data-v-a260b725"]]);var er={};const bW={},_W=Object.freeze(Object.defineProperty({__proto__:null,default:bW},Symbol.toStringTag,{value:"Module"})),sd=S$(_W);(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=sd,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=sd.implForWrapper,t.nodeCanvas=sd.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,h){if(!!this.__eventListeners[s]){var v=this.__eventListeners[s];h?v[v.indexOf(h)]=!1:t.util.array.fill(v,!1)}}function a(s,h){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(h);return this}function u(s,h){var v=function(){h.apply(this,arguments),this.off(s,v)}.bind(this);this.on(s,v)}function d(s,h){if(arguments.length===1)for(var v in s)u.call(this,v,s[v]);else u.call(this,s,h);return this}function c(s,h){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,h);return this}function f(s,h){if(!this.__eventListeners)return this;var v=this.__eventListeners[s];if(!v)return this;for(var m=0,y=v.length;m"u"?this._objects.concat():this._objects.filter(function(a){return a.type===o})},item:function(o){return this._objects[o]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(o,a){return this._objects.indexOf(o)>-1?!0:a?this._objects.some(function(u){return typeof u.contains=="function"&&u.contains(o,!0)}):!1},complexity:function(){return this._objects.reduce(function(o,a){return o+=a.complexity?a.complexity():0,o},0)}},t.CommonMethods={_setOptions:function(o){for(var a in o)this.set(a,o[a])},_initGradient:function(o,a){o&&o.colorStops&&!(o instanceof t.Gradient)&&this.set(a,new t.Gradient(o))},_initPattern:function(o,a,u){o&&o.source&&!(o instanceof t.Pattern)?this.set(a,new t.Pattern(o,u)):u&&u()},_setObject:function(o){for(var a in o)this._set(a,o[a])},set:function(o,a){return typeof o=="object"?this._setObject(o):this._set(o,a),this},_set:function(o,a){this[o]=a},toggle:function(o){var a=this.get(o);return typeof a=="boolean"&&this.set(o,!a),this},get:function(o){return this[o]}},function(o){var a=Math.sqrt,u=Math.atan2,d=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 h=s/f;switch(h){case 1:case 3:return 0;case 2:return-1}return Math.cos(s)},sin:function(s){if(s===0)return 0;var h=s/f,v=1;switch(s<0&&(v=-1),h){case 1:return v;case 2:return 0;case 3:return-v}return Math.sin(s)},removeFromArray:function(s,h){var v=s.indexOf(h);return v!==-1&&s.splice(v,1),s},getRandomInt:function(s,h){return Math.floor(Math.random()*(h-s+1))+s},degreesToRadians:function(s){return s*c},radiansToDegrees:function(s){return s/c},rotatePoint:function(s,h,v){var m=new t.Point(s.x-h.x,s.y-h.y),y=t.util.rotateVector(m,v);return new t.Point(y.x,y.y).addEquals(h)},rotateVector:function(s,h){var v=t.util.sin(h),m=t.util.cos(h),y=s.x*m-s.y*v,b=s.x*v+s.y*m;return{x:y,y:b}},createVector:function(s,h){return new t.Point(h.x-s.x,h.y-s.y)},calcAngleBetweenVectors:function(s,h){return Math.acos((s.x*h.x+s.y*h.y)/(Math.hypot(s.x,s.y)*Math.hypot(h.x,h.y)))},getHatVector:function(s){return new t.Point(s.x,s.y).multiply(1/Math.hypot(s.x,s.y))},getBisector:function(s,h,v){var m=t.util.createVector(s,h),y=t.util.createVector(s,v),b=t.util.calcAngleBetweenVectors(m,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(m,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(m,w)),angle:b}},projectStrokeOnPoints:function(s,h,v){var m=[],y=h.strokeWidth/2,b=h.strokeUniform?new t.Point(1/h.scaleX,1/h.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),k,E;S===0?(E=s[S+1],k=v?_(t.util.createVector(E,x)).addEquals(x):s[s.length-1]):S===s.length-1?(k=s[S-1],E=v?_(t.util.createVector(k,x)).addEquals(x):s[0]):(k=s[S-1],E=s[S+1]);var I=t.util.getBisector(x,k,E),D=I.vector,N=I.angle,L,B;if(h.strokeLineJoin==="miter"&&(L=-y/Math.sin(N/2),B=new t.Point(D.x*L*b.x,D.y*L*b.y),Math.hypot(B.x,B.y)/y<=h.strokeMiterLimit)){m.push(x.add(B)),m.push(x.subtract(B));return}L=-y*Math.SQRT2,B=new t.Point(D.x*L*b.x,D.y*L*b.y),m.push(x.add(B)),m.push(x.subtract(B))}),m},transformPoint:function(s,h,v){return v?new t.Point(h[0]*s.x+h[2]*s.y,h[1]*s.x+h[3]*s.y):new t.Point(h[0]*s.x+h[2]*s.y+h[4],h[1]*s.x+h[3]*s.y+h[5])},makeBoundingBoxFromPoints:function(s,h){if(h)for(var v=0;v"u"?1:s.scaleX,v=typeof s.scaleY>"u"?1:s.scaleY,m=[s.flipX?-h:h,0,0,s.flipY?-v:v,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(m=y(m,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(m=y(m,[1,Math.tan(b(s.skewY)),0,1],!0)),m},composeMatrix:function(s){var h=[1,0,0,1,s.translateX||0,s.translateY||0],v=t.util.multiplyTransformMatrices;return s.angle&&(h=v(h,t.util.calcRotateMatrix(s))),(s.scaleX!==1||s.scaleY!==1||s.skewX||s.skewY||s.flipX||s.flipY)&&(h=v(h,t.util.calcDimensionsMatrix(s))),h},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,h,v,m){m>0&&(h>m?h-=m:h=0,v>m?v-=m:v=0);var y=!0,b,_,w=s.getImageData(h,v,m*2||1,m*2||1),S=w.data.length;for(b=3;bn.value=i,error:t==null?void 0:t.onError});return mH(()=>{r.unsubscribe()}),n}function vH(e,t,n){const r=ae(n==null?void 0:n.initialValue),i=_m(e);let l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError});return ke(t,()=>{l.unsubscribe(),l=i.subscribe({next:g=>r.value=g,error:n==null?void 0:n.onError})}),gi(()=>{l.unsubscribe()}),r}const Ua=Xo("outputs",()=>{const e=gH(hH(_m(()=>Vt.outputs.count())),{initialValue:0}),t=ae(1),n=ln("sortOutputsBy","Oldest"),r=ln("currentImagesLayout","dynamic"),i=ae("all"),l=vH(()=>{const s=At();let h;return i.value==="all"?h=Vt.outputs:i.value==="favourited"?h=Vt.outputs.where("starred").equals(1):i.value==="unfavourited"?h=Vt.outputs.where("starred").equals(0):h=Vt.outputs.where("rated").equals(0),n.value==="Newest"&&(h=h.reverse()),s.pageless==="Enabled"?h.toArray():h.offset((t.value-1)*s.pageSize).limit(s.pageSize).toArray()},[Bn(At(),"pageless"),Bn(At(),"pageSize"),t,n,i],{initialValue:[]});async function g(){if(navigator.storage&&navigator.storage.persist){const s=await navigator.storage.persist();console.log(`Persisted storage granted: ${s}`)}}async function o(){const s=localStorage.getItem("outputs");!s||(a(JSON.parse(s)),localStorage.removeItem("outputs"))}g(),o();async function a(s){const h=s.map(y=>{const{id:b,..._}=y;return _}),v=50,m=[];for(let y=0;y{S.async("base64").then(async D=>{if(!v[E+".json"])return y++,I(null);const N=JSON.parse(await v[E+".json"].async("text"));m++,I({id:-1,image:`data:image/webp;base64,${D}`,...N,rated:N.rated?1:0,starred:N.starred?1:0})}).catch(D=>(h.raiseError(`Error while importing image: ${D}`,!1),y++,I(null)))}))}const _=await Promise.all(b);a(_.filter(w=>w!==null)),Qi({message:`Successfully imported ${m}/${m+y} images!`,type:"success"})}async function d(s){const h=await Vt.outputs.get(s);return Vt.outputs.update(s,{starred:h!=null&&h.starred?0:1})}function c(s){return Vt.outputs.delete(s)}async function f(s){const h=Wt();return h.selected=[],h.multiSelect=!1,s===await Vt.outputs.toCollection().primaryKeys()?Vt.outputs.clear():Vt.outputs.bulkDelete(s)}return{outputsLength:e,sortBy:n,filterBy:i,currentPage:t,currentOutputs:l,currentLayout:r,deleteOutput:c,deleteMultipleOutputs:f,toggleStarred:d,pushOutputs:a,importFromZip:u}}),Wt=Xo("ui",()=>{const e=ae(!1),t=ae([]),n=ae(["1"]),r=ae(-1),i=ae(!1),l=ae(!1);function g(f,s){console.error(f),Qi({type:"error",message:f,duration:s?0:void 0,showClose:s})}function o(f,s){console.warn(f),Qi({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 d(){const f=Ua(),s=At(),h=f.currentOutputs.findIndex(m=>m.id===r.value),v=f.currentOutputs[h+1];if(v){r.value=v.id;return}if(f.currentPage<=Math.floor(f.outputsLength/s.pageSize)){const m=f.sortBy==="Newest"?await Vt.outputs.where(":id").below(r.value).last():await Vt.outputs.where(":id").above(r.value).first();f.currentPage++,r.value=(m==null?void 0:m.id)||r.value;return}}async function c(){const f=Ua(),s=f.currentOutputs.findIndex(v=>v.id===r.value),h=f.currentOutputs[s-1];if(f.currentPage>1&&!h){const v=f.sortBy==="Oldest"?await Vt.outputs.where(":id").below(r.value).last():await Vt.outputs.where(":id").above(r.value).first();f.currentPage--,r.value=(v==null?void 0:v.id)||r.value;return}if(h){r.value=h.id;return}}return{multiSelect:e,selected:t,activeCollapse:n,activeModal:r,showGeneratorBadge:i,showGeneratedImages:l,raiseError:g,raiseWarning:o,toggleMultiSelect:a,toggleSelection:u,openModalToRight:d,openModalToLeft:c}}),Jt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},yH={},bH={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},_H=ne("circle",{cy:"12",cx:"12",r:"12",stroke:"currentColor"},null,-1),wH=[_H];function CH(e,t){return z(),oe("svg",bH,wH)}const SH=Jt(yH,[["render",CH]]),ms=Ee({__name:"MainMenuItem",props:{index:null,isMobile:{type:Boolean}},setup(e){return(t,n)=>(z(),be(C(Qp),{index:e.index},{default:he(()=>[xe(t.$slots,"icon"),e.isMobile?ye("",!0):xe(t.$slots,"title",{key:0})]),_:3},8,["index"]))}});const xH="modulepreload",kH=function(e,t){return new URL(e,t).href},iy={},ad=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(l=>{if(l=kH(l,r),l in iy)return;iy[l]=!0;const g=l.endsWith(".css"),o=g?'[rel="stylesheet"]':"";if(!!r)for(let d=i.length-1;d>=0;d--){const c=i[d];if(c.href===l&&(!g||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const u=document.createElement("link");if(u.rel=g?"stylesheet":xH,g||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),g)return new Promise((d,c)=>{u.addEventListener("load",d),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>t())};const TH={},EH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},OH=ne("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),AH=[OH];function PH(e,t){return z(),oe("svg",EH,AH)}const R2=Jt(TH,[["render",PH]]),IH={},MH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},LH=ne("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),RH=ne("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),DH=ne("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),$H=[LH,RH,DH];function BH(e,t){return z(),oe("svg",MH,$H)}const FH=Jt(IH,[["render",BH]]);function D2(){const e=ae("..."),t=setInterval(()=>{e.value=e.value.length>=3?"":".".repeat(e.value.length+1)},1e3);return gi(()=>{clearInterval(t)}),{ellipsis:e}}const zH=e=>(hi("data-v-636f1d71"),e=e(),pi(),e),NH={style:{"text-align":"center"}},jH={key:0,class:"batch-text"},VH={key:0,class:"step-text"},UH={key:1},HH={class:"gen-text"},WH={key:0},YH={key:1},XH={key:2},KH=zH(()=>ne("br",null,null,-1)),GH={key:2,class:"preview-container"},qH=["src"],ZH=Ee({__name:"ImageProgress",props:{generated:null,total:null,elapsed:null,progressPercentage:null,textInfo:null,currentStep:null,totalSteps:null,previewImage:null,generating:{type:Boolean}},emits:["showGenerated"],setup(e){const{ellipsis:t}=D2(),n=(r,i)=>r?r.length>i?r.slice(0,i)+"\u2026":r:"";return(r,i)=>{var l,g,o,a,u;return z(),oe("div",NH,[e.generating&&e.total&&e.total>1?(z(),oe("div",jH," Image "+Oe(((l=e.generated)!=null?l:0)+1)+" of "+Oe(e.total),1)):ye("",!0),le(C(Iw),{type:"circle",percentage:(a=e.progressPercentage)!=null?a:100*((g=e.generated)!=null?g:0)/((o=e.total)!=null?o:1),width:200},{default:he(()=>{var d,c,f,s;return[e.progressPercentage!==void 0&&e.progressPercentage>0?(z(),oe("span",VH,Oe((d=e.currentStep)!=null?d:0)+" / "+Oe((c=e.totalSteps)!=null?c:0),1)):(z(),oe("span",UH,Oe((f=e.generated)!=null?f:0)+" / "+Oe((s=e.total)!=null?s:1),1))]}),_:1},8,["percentage"]),e.generated?(z(),oe("div",{key:1,onClick:i[0]||(i[0]=d=>r.$emit("showGenerated")),class:"view-images"},[ne("span",null,"View image"+Oe(((u=e.total)!=null?u:1)===1?"":"s"),1),le(C(Le),null,{default:he(()=>[le(C(h4))]),_:1})])):ye("",!0),ne("div",HH,[e.generated!==void 0&&e.total!==void 0&&e.generated===e.total&&e.generated>0?(z(),oe("span",WH,"All done!")):e.textInfo?(z(),oe("span",YH,Oe(n(e.textInfo,60)),1)):(z(),oe("span",XH,[Ue("Generating"+Oe(C(t))+Oe("\xA0".repeat(3-C(t).length)),1),KH,ne("sup",null,Oe(e.elapsed),1)]))]),e.previewImage?(z(),oe("div",GH,[ne("img",{src:`data:image/png;base64,${e.previewImage}`,class:"preview-img",alt:"Generation Preview"},null,8,qH)])):ye("",!0)])}}});const JH=Jt(ZH,[["__scopeId","data-v-636f1d71"]]);const QH={style:{width:"200px"}},eW=Ee({__name:"InfoTooltip",props:{info:null,size:null,trigger:null},setup(e){return(t,n)=>(z(),be(C(Wn),{trigger:e.trigger},{content:he(()=>[ne("div",QH,[xe(t.$slots,"default",{},()=>[Ue(Oe(e.info),1)])])]),default:he(()=>[le(C(Le),{size:e.size},{default:he(()=>[le(C(bp))]),_:1},8,["size"])]),_:3},8,["trigger"]))}}),tW={key:0,class:"align-vertical",style:{"margin-left":"5px"}},nW=Ee({__name:"FormLabel",props:{label:null,info:null,labelStyle:null},setup(e){return(t,n)=>(z(),oe("span",{class:"align-vertical",style:ze(e.labelStyle||"height: 100%;")},[xe(t.$slots,"default",{},()=>[Ue(Oe(e.label),1)],!0),e.info?(z(),oe("div",tW,[le(eW,{info:e.info,size:15},null,8,["info"])])):ye("",!0)],4))}});const Kl=Jt(nW,[["__scopeId","data-v-ec7e7ec1"]]),rW={key:0,style:{width:"100%"}},iW={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=Bp($p).smallerOrEqual("md");function l(d,c){var s;if(n.multiple&&Array.isArray(n.modelValue)){c=c||0;const h=(s=Array.isArray(d)?d[0]:d)!=null?s:n.min;let v=n.modelValue;v[c]=h,t("update:modelValue",v),t("change",v);return}const f=d!=null?d:n.min;t("update:modelValue",f),t("change",f)}function g(){if(!n.multiple||!Array.isArray(n.modelValue))return;const d=n.min;t("update:modelValue",[...n.modelValue,d]),t("onAdd",d)}function o(){if(!n.multiple||!Array.isArray(n.modelValue))return;const d=n.modelValue,c=d.pop();t("update:modelValue",d),t("onRemove",c)}const a=ee(()=>n.multiple&&Array.isArray(n.modelValue)?Array.from(Array(n.modelValue.length).keys()):[]),u=ee(()=>Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue);return(d,c)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(d.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[!e.multiple||!Array.isArray(e.modelValue)?(z(),oe("div",rW,[C(i)?ye("",!0):(z(),be(C(M0),{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)?(z(),be(C(lh),{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"])):ye("",!0)])):(z(),oe("div",iW,[(z(!0),oe(Ne,null,Nt(C(a),f=>(z(),oe("div",{key:f},[C(i)?ye("",!0):(z(),be(C(M0),{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)?(z(),be(C(lh),{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"])):ye("",!0)]))),128)),ne("div",null,[le(C(at),{icon:C(wp),onClick:c[0]||(c[0]=()=>g())},null,8,["icon"]),le(C(at),{icon:C(O_),onClick:c[1]||(c[1]=()=>o()),disabled:C(a).length<=1},null,8,["icon","disabled"])])])),xe(d.$slots,"inline")]),_:3},8,["prop"]))}});const Co=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)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(r.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(Aw),{"model-value":e.modelValue,filterable:e.filterable,multiple:e.multiple,placement:e.placement,onChange:n,placeholder:"Select"},{default:he(()=>[(z(!0),oe(Ne,null,Nt(e.options,l=>(z(),be(C(Pw),{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"]))}}),$h=Ee({__name:"FormInput",props:{label:null,modelValue:null,prop:null,type:null,resize:null,placeholder:null,autosize:{type:[Boolean,Object]},info:null,labelStyle:null,change:null,clearable:{type:Boolean},clearIcon:null},emits:["update:modelValue","focus","blur"],setup(e,{emit:t}){const n=e;function r(i){t("update:modelValue",i),n.change&&n.change(i)}return(i,l)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(i.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(to),{"model-value":e.modelValue,autosize:e.autosize,resize:e.resize,onInput:r,type:e.type,placeholder:e.placeholder,clearable:e.clearable,"clear-icon":e.clearIcon,onFocus:l[0]||(l[0]=g=>i.$emit("focus")),onBlur:l[1]||(l[1]=g=>i.$emit("blur"))},{append:he(()=>[xe(i.$slots,"append")]),_:3},8,["model-value","autosize","resize","type","placeholder","clearable","clear-icon"]),xe(i.$slots,"inline")]),_:3},8,["prop"]))}});const od=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 kb(()=>{n.disabled&&n.defaultValue!==void 0&&t("update:modelValue",n.defaultValue)}),(i,l)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(i.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[e.disabledText&&e.disabled?(z(),be(C(Wn),{key:0,content:e.disabledText,placement:"top",enterable:!1,"hide-after":100},{default:he(()=>[le(C(L0),{disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])]),_:1},8,["content"])):(z(),be(C(L0),{key:1,disabled:e.disabled,"model-value":e.modelValue,onChange:r},null,8,["disabled","model-value"])),xe(i.$slots,"inline")]),_:3},8,["prop"]))}}),aW=e=>(hi("data-v-cf07eac2"),e=e(),pi(),e),oW=aW(()=>ne("div",null,"Prompt",-1)),sW=Ee({__name:"FormPromptInput",setup(e){const t=nn();return(n,r)=>(z(),be($h,{prop:"prompt",modelValue:C(t).prompt,"onUpdate:modelValue":r[0]||(r[0]=i=>C(t).prompt=i),autosize:{minRows:2,maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter prompt here","label-position":"top","label-style":"justify-content: space-between; width: 100%;"},{label:he(()=>[oW]),_:1},8,["modelValue"]))}});const lW=Jt(sW,[["__scopeId","data-v-cf07eac2"]]);const uW=e=>(hi("data-v-a260b725"),e=e(),pi(),e),cW={style:{position:"relative",height:"100%",width:"100%"}},fW=uW(()=>ne("span",null,"Back to generation status",-1)),dW={class:"carousel-container"},hW=["src"],pW={class:"carousel-footer"},mW={style:{display:"flex","justify-content":"center"}},gW={style:{"white-space":"nowrap"}},vW=Ee({__name:"GeneratedCarousel",setup(e){const t=nn(),n=Wt(),r=At(),i=ae(0);function l(o){i.value=o,console.log(t.outputs[i.value])}function g(o){t.outputs.splice(t.outputs.findIndex(a=>a.output.id===o),1)}return(o,a)=>(z(),oe("div",cW,[C(t).generating?(z(),oe("div",{key:0,class:"back-to-generation",onClick:a[0]||(a[0]=u=>C(n).showGeneratedImages=!1)},[le(C(Le),null,{default:he(()=>[le(C(S_))]),_:1}),fW])):ye("",!0),ne("div",dW,[le(C(U$),{class:"carousel",autoplay:C(r).autoCarousel==="Enabled",trigger:"click","indicator-position":"outside",onChange:l},{default:he(()=>[(z(!0),oe(Ne,null,Nt(C(t).outputs,(u,d)=>(z(),be(C(H$),{key:d,style:{display:"flex","justify-content":"center"}},{default:he(()=>[u.type==="video"?(z(),oe("video",{key:0,src:u.output.image,controls:"",style:{"max-width":"100%",height:"100%"}},null,8,hW)):ye("",!0),u.type==="image"?(z(),be(C(lf),{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"])):ye("",!0)]),_:2},1024))),128))]),_:1},8,["autoplay"])]),ne("div",pW,[le(C(fF)),ne("div",mW,[le(C(j1),null,{default:he(()=>[ne("div",gW,[le(SC,{imageData:C(t).outputs[i.value].output,"on-delete":g,"show-dismiss":!0},null,8,["imageData"])])]),_:1})])])]))}});const yW=Jt(vW,[["__scopeId","data-v-a260b725"]]);var er={};const bW={},_W=Object.freeze(Object.defineProperty({__proto__:null,default:bW},Symbol.toStringTag,{value:"Module"})),sd=S$(_W);(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=sd,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=sd.implForWrapper,t.nodeCanvas=sd.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,h){if(!!this.__eventListeners[s]){var v=this.__eventListeners[s];h?v[v.indexOf(h)]=!1:t.util.array.fill(v,!1)}}function a(s,h){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(h);return this}function u(s,h){var v=function(){h.apply(this,arguments),this.off(s,v)}.bind(this);this.on(s,v)}function d(s,h){if(arguments.length===1)for(var v in s)u.call(this,v,s[v]);else u.call(this,s,h);return this}function c(s,h){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,h);return this}function f(s,h){if(!this.__eventListeners)return this;var v=this.__eventListeners[s];if(!v)return this;for(var m=0,y=v.length;m"u"?this._objects.concat():this._objects.filter(function(a){return a.type===o})},item:function(o){return this._objects[o]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(o,a){return this._objects.indexOf(o)>-1?!0:a?this._objects.some(function(u){return typeof u.contains=="function"&&u.contains(o,!0)}):!1},complexity:function(){return this._objects.reduce(function(o,a){return o+=a.complexity?a.complexity():0,o},0)}},t.CommonMethods={_setOptions:function(o){for(var a in o)this.set(a,o[a])},_initGradient:function(o,a){o&&o.colorStops&&!(o instanceof t.Gradient)&&this.set(a,new t.Gradient(o))},_initPattern:function(o,a,u){o&&o.source&&!(o instanceof t.Pattern)?this.set(a,new t.Pattern(o,u)):u&&u()},_setObject:function(o){for(var a in o)this._set(a,o[a])},set:function(o,a){return typeof o=="object"?this._setObject(o):this._set(o,a),this},_set:function(o,a){this[o]=a},toggle:function(o){var a=this.get(o);return typeof a=="boolean"&&this.set(o,!a),this},get:function(o){return this[o]}},function(o){var a=Math.sqrt,u=Math.atan2,d=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 h=s/f;switch(h){case 1:case 3:return 0;case 2:return-1}return Math.cos(s)},sin:function(s){if(s===0)return 0;var h=s/f,v=1;switch(s<0&&(v=-1),h){case 1:return v;case 2:return 0;case 3:return-v}return Math.sin(s)},removeFromArray:function(s,h){var v=s.indexOf(h);return v!==-1&&s.splice(v,1),s},getRandomInt:function(s,h){return Math.floor(Math.random()*(h-s+1))+s},degreesToRadians:function(s){return s*c},radiansToDegrees:function(s){return s/c},rotatePoint:function(s,h,v){var m=new t.Point(s.x-h.x,s.y-h.y),y=t.util.rotateVector(m,v);return new t.Point(y.x,y.y).addEquals(h)},rotateVector:function(s,h){var v=t.util.sin(h),m=t.util.cos(h),y=s.x*m-s.y*v,b=s.x*v+s.y*m;return{x:y,y:b}},createVector:function(s,h){return new t.Point(h.x-s.x,h.y-s.y)},calcAngleBetweenVectors:function(s,h){return Math.acos((s.x*h.x+s.y*h.y)/(Math.hypot(s.x,s.y)*Math.hypot(h.x,h.y)))},getHatVector:function(s){return new t.Point(s.x,s.y).multiply(1/Math.hypot(s.x,s.y))},getBisector:function(s,h,v){var m=t.util.createVector(s,h),y=t.util.createVector(s,v),b=t.util.calcAngleBetweenVectors(m,y),_=t.util.calcAngleBetweenVectors(t.util.rotateVector(m,b),y),w=b*(_===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(m,w)),angle:b}},projectStrokeOnPoints:function(s,h,v){var m=[],y=h.strokeWidth/2,b=h.strokeUniform?new t.Point(1/h.scaleX,1/h.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),k,E;S===0?(E=s[S+1],k=v?_(t.util.createVector(E,x)).addEquals(x):s[s.length-1]):S===s.length-1?(k=s[S-1],E=v?_(t.util.createVector(k,x)).addEquals(x):s[0]):(k=s[S-1],E=s[S+1]);var I=t.util.getBisector(x,k,E),D=I.vector,N=I.angle,L,B;if(h.strokeLineJoin==="miter"&&(L=-y/Math.sin(N/2),B=new t.Point(D.x*L*b.x,D.y*L*b.y),Math.hypot(B.x,B.y)/y<=h.strokeMiterLimit)){m.push(x.add(B)),m.push(x.subtract(B));return}L=-y*Math.SQRT2,B=new t.Point(D.x*L*b.x,D.y*L*b.y),m.push(x.add(B)),m.push(x.subtract(B))}),m},transformPoint:function(s,h,v){return v?new t.Point(h[0]*s.x+h[2]*s.y,h[1]*s.x+h[3]*s.y):new t.Point(h[0]*s.x+h[2]*s.y+h[4],h[1]*s.x+h[3]*s.y+h[5])},makeBoundingBoxFromPoints:function(s,h){if(h)for(var v=0;v"u"?1:s.scaleX,v=typeof s.scaleY>"u"?1:s.scaleY,m=[s.flipX?-h:h,0,0,s.flipY?-v:v,0,0],y=t.util.multiplyTransformMatrices,b=t.util.degreesToRadians;return s.skewX&&(m=y(m,[1,0,Math.tan(b(s.skewX)),1],!0)),s.skewY&&(m=y(m,[1,Math.tan(b(s.skewY)),0,1],!0)),m},composeMatrix:function(s){var h=[1,0,0,1,s.translateX||0,s.translateY||0],v=t.util.multiplyTransformMatrices;return s.angle&&(h=v(h,t.util.calcRotateMatrix(s))),(s.scaleX!==1||s.scaleY!==1||s.skewX||s.skewY||s.flipX||s.flipY)&&(h=v(h,t.util.calcDimensionsMatrix(s))),h},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,h,v,m){m>0&&(h>m?h-=m:h=0,v>m?v-=m:v=0);var y=!0,b,_,w=s.getImageData(h,v,m*2||1,m*2||1),S=w.data.length;for(b=3;b0?we-=2*q:j===1&&we<0&&(we+=2*q);for(var Te=Math.ceil(Math.abs(we/q*2)),Ae=[],Fe=we/Te,_e=8/3*Math.sin(Fe/4)*Math.sin(Fe/4)/Math.sin(Fe/2),Se=ge+Fe,De=0;De=Q?j-Q:2*Math.PI-(Q-j)}function s(M,H,R,P,Q,j,A,q){var G;if(t.cachesBoundsOfCurve&&(G=o.call(arguments),t.boundsOfCurveCache[G]))return t.boundsOfCurveCache[G];var te=Math.sqrt,ce=Math.min,pe=Math.max,ve=Math.abs,U=[],X=[[],[]],T,Y,W,$,F,K,fe,ie;Y=6*M-12*R+6*Q,T=-3*M+9*R-9*Q+3*A,W=3*R-3*M;for(var Z=0;Z<2;++Z){if(Z>0&&(Y=6*H-12*P+6*j,T=-3*H+9*P-9*j+3*q,W=3*P-3*H),ve(T)<1e-12){if(ve(Y)<1e-12)continue;$=-W/Y,0<$&&$<1&&U.push($);continue}fe=Y*Y-4*W*T,!(fe<0)&&(ie=te(fe),F=(-Y+ie)/(2*T),01e-4;)A=Q(R),ce=R,q=m(j.x,j.y,A.x,A.y),q+P>H?(R-=G,G/=2):(j=A,R+=G,P+=q);return A.angle=te(ce),A}function O(M){for(var H=0,R=M.length,P,Q=0,j=0,A=0,q=0,G=[],te,ce,pe,ve=0;ve0&&Pfe)for(var Z=1,me=T.length;Z2;for(H=H||0,te&&(q=M[2].xM[P-2].x?1:Q.x===M[P-2].x?0:-1,G=Q.y>M[P-2].y?1:Q.y===M[P-2].y?0:-1),R.push(["L",Q.x+q*H,Q.y+G*H]),R}function ue(M,H,R){return R&&(H=t.util.multiplyTransformMatrices(H,[1,0,0,1,-R.x,-R.y])),M.map(function(P){for(var Q=P.slice(0),j={},A=1;A=m})}function d(s,h){return f(s,h,function(v,m){return v/g,">")}function d(f){var s=0,h,v=[];for(s=0,h;s57343)return f.charAt(s);if(55296<=h&&h<=56319){if(f.length<=s+1)throw"High surrogate without following low surrogate";var v=f.charCodeAt(s+1);if(56320>v||v>57343)throw"High surrogate without following low surrogate";return f.charAt(s)+f.charAt(s+1)}if(s===0)throw"Low surrogate without preceding high surrogate";var m=f.charCodeAt(s-1);if(55296>m||m>56319)throw"Low surrogate without preceding high surrogate";return!1}t.util.string={camelize:o,capitalize:a,escapeXml:u,graphemeSplit:d}}(),function(){var o=Array.prototype.slice,a=function(){},u=function(){for(var h in{toString:1})if(h==="toString")return!1;return!0}(),d=function(h,v,m){for(var y in v)y in h.prototype&&typeof h.prototype[y]=="function"&&(v[y]+"").indexOf("callSuper")>-1?h.prototype[y]=function(b){return function(){var _=this.constructor.superclass;this.constructor.superclass=m;var w=v[b].apply(this,arguments);if(this.constructor.superclass=_,b!=="initialize")return w}}(y):h.prototype[y]=v[y],u&&(v.toString!==Object.prototype.toString&&(h.prototype.toString=v.toString),v.valueOf!==Object.prototype.valueOf&&(h.prototype.valueOf=v.valueOf))};function c(){}function f(h){for(var v=null,m=this;m.constructor.superclass;){var y=m.constructor.superclass.prototype[h];if(m[h]!==y){v=y;break}m=m.constructor.superclass.prototype}return v?arguments.length>1?v.apply(this,o.call(arguments,1)):v.call(this):console.log("tried to callSuper "+h+", method not found in prototype chain",this)}function s(){var h=null,v=o.call(arguments,0);typeof v[0]=="function"&&(h=v.shift());function m(){this.initialize.apply(this,arguments)}m.superclass=h,m.subclasses=[],h&&(c.prototype=h.prototype,m.prototype=new c,h.subclasses.push(m));for(var y=0,b=v.length;y-1||d.pointerType==="touch"}}(),function(){function o(s,h){var v=s.style;if(!v)return s;if(typeof h=="string")return s.style.cssText+=";"+h,h.indexOf("opacity")>-1?f(s,h.match(/opacity:\s*(\d?\.?\d*)/)[1]):s;for(var m in h)if(m==="opacity")f(s,h[m]);else{var y=m==="float"||m==="cssFloat"?typeof v.styleFloat>"u"?"cssFloat":"styleFloat":m;v.setProperty(y,h[m])}return s}var a=t.document.createElement("div"),u=typeof a.style.opacity=="string",d=typeof a.style.filter=="string",c=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,f=function(s){return s};u?f=function(s,h){return s.style.opacity=h,s}:d&&(f=function(s,h){var v=s.style;return s.currentStyle&&!s.currentStyle.hasLayout&&(v.zoom=1),c.test(v.filter)?(h=h>=.9999?"":"alpha(opacity="+h*100+")",v.filter=v.filter.replace(c,h)):v.filter+=" alpha(opacity="+h*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,d=function(w){return o.call(w,0)};try{u=d(t.document.childNodes)instanceof Array}catch{}u||(d=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 k in S)k==="class"?x.className=S[k]:k==="for"?x.htmlFor=S[k]:x.setAttribute(k,S[k]);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 h(w){for(var S=0,x=0,k=t.document.documentElement,E=t.document.body||{scrollLeft:0,scrollTop:0};w&&(w.parentNode||w.host)&&(w=w.parentNode||w.host,w===t.document?(S=E.scrollLeft||k.scrollLeft||0,x=E.scrollTop||k.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,k={left:0,top:0},E={left:0,top:0},I,D={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!x)return E;for(var N in D)E[D[N]]+=parseInt(m(w,N),10)||0;return S=x.documentElement,typeof w.getBoundingClientRect<"u"&&(k=w.getBoundingClientRect()),I=h(w),{left:k.left+I.left-(S.clientLeft||0)+E.left,top:k.top+I.top-(S.clientTop||0)+E.top}}var m;t.document.defaultView&&t.document.defaultView.getComputedStyle?m=function(w,S){var x=t.document.defaultView.getComputedStyle(w,null);return x?x[S]:void 0}:m=function(w,S){var x=w.style[S];return!x&&w.currentStyle&&(x=w.currentStyle[S]),x},function(){var w=t.document.documentElement.style,S="userSelect"in w?"userSelect":"MozUserSelect"in w?"MozUserSelect":"WebkitUserSelect"in w?"WebkitUserSelect":"KhtmlUserSelect"in w?"KhtmlUserSelect":"";function x(E){return typeof E.onselectstart<"u"&&(E.onselectstart=t.util.falseFunction),S?E.style[S]="none":typeof E.unselectable=="string"&&(E.unselectable="on"),E}function k(E){return typeof E.onselectstart<"u"&&(E.onselectstart=null),S?E.style[S]="":typeof E.unselectable=="string"&&(E.unselectable=""),E}t.util.makeElementUnselectable=x,t.util.makeElementSelectable=k}();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=d,t.util.addClass=f,t.util.makeElement=c,t.util.wrapElement=s,t.util.getScrollLeftTop=h,t.util.getElementOffset=v,t.util.getNodeCanvas=y,t.util.cleanUpJsdomNode=b}(),function(){function o(d,c){return d+(/\?/.test(d)?"&":"?")+c}function a(){}function u(d,c){c||(c={});var f=c.method?c.method.toUpperCase():"GET",s=c.onComplete||function(){},h=new t.window.XMLHttpRequest,v=c.body||c.parameters;return h.onreadystatechange=function(){h.readyState===4&&(s(h),h.onreadystatechange=a)},f==="GET"&&(v=null,typeof c.parameters=="string"&&(d=o(d,c.parameters))),h.open(f,d,!0),(f==="POST"||f==="PUT")&&h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.send(v),h}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 d(){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,k=y.duration||500,E=x+k,I,D=y.onChange||d,N=y.abort||d,L=y.onComplete||d,B=y.easing||c,O="startValue"in y?y.startValue.length>0:!1,V="startValue"in y?y.startValue:0,re="endValue"in y?y.endValue:100,J=y.byValue||(O?V.map(function(ue,M){return re[M]-V[M]}):re-V);y.onStart&&y.onStart(),function ue(M){I=M||+new Date;var H=I>E?k:I-x,R=H/k,P=O?V.map(function(j,A){return B(H,V[A],J[A],k)}):B(H,V,J,k),Q=Math.abs(O?(P[0]-V[0])/J[0]:(P-V)/J);if(_.currentValue=O?P.slice():P,_.completionRate=Q,_.durationRate=R,!b){if(N(P,Q,R)){w();return}if(I>E){_.currentValue=O?re.slice():re,_.completionRate=1,_.durationRate=1,D(O?re.slice():re,1,1),L(re,1,1),w();return}else D(P,Q,R),v(ue)}}(x)}),_.cancel}var s=t.window.requestAnimationFrame||t.window.webkitRequestAnimationFrame||t.window.mozRequestAnimationFrame||t.window.oRequestAnimationFrame||t.window.msRequestAnimationFrame||function(y){return t.window.setTimeout(y,1e3/60)},h=t.window.cancelAnimationFrame||t.window.clearTimeout;function v(){return s.apply(t.window,arguments)}function m(){return h.apply(t.window,arguments)}t.util.animate=f,t.util.requestAnimFrame=v,t.util.cancelAnimFrame=m,t.runningAnimations=u}(),function(){function o(u,d,c){var f="rgba("+parseInt(u[0]+c*(d[0]-u[0]),10)+","+parseInt(u[1]+c*(d[1]-u[1]),10)+","+parseInt(u[2]+c*(d[2]-u[2]),10);return f+=","+(u&&d?parseFloat(u[3]+c*(d[3]-u[3])):1),f+=")",f}function a(u,d,c,f){var s=new t.Color(u).getSource(),h=new t.Color(d).getSource(),v=f.onComplete,m=f.onChange;return f=f||{},t.util.animate(t.util.object.extend(f,{duration:c||500,startValue:s,endValue:h,byValue:h,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(h,h,0),b,_)},onChange:function(y,b,_){if(m){if(Array.isArray(y))return m(o(y,y,0),b,_);m(y,b,_)}}}))}t.util.animateColor=a}(),function(){function o(M,H,R,P){return M-1&&ve>-1&&ve-1)&&(A="stroke")}else{if(j==="href"||j==="xlink:href"||j==="font")return A;if(j==="imageSmoothing")return A==="optimizeQuality";ce=te?A.map(f):f(A,G)}}return!te&&isNaN(ce)?A:ce}function E(j){return new RegExp("^("+j.join("|")+")\\b","i")}function I(j){for(var A in _)if(!(typeof j[_[A]]>"u"||j[A]==="")){if(typeof j[A]>"u"){if(!a.Object.prototype[A])continue;j[A]=a.Object.prototype[A]}if(j[A].indexOf("url(")!==0){var q=new a.Color(j[A]);j[A]=q.setAlpha(c(q.getAlpha()*j[_[A]],2)).toRgba()}}return j}function D(j,A){var q,G=[],te,ce,pe;for(ce=0,pe=A.length;ce1;)se.shift(),ge=a.util.multiplyTransformMatrices(ge,se[0]);return ge}}();function N(j,A){var q,G;j.replace(/;\s*$/,"").split(";").forEach(function(te){var ce=te.split(":");q=ce[0].trim().toLowerCase(),G=ce[1].trim(),A[q]=G})}function L(j,A){var q,G;for(var te in j)typeof j[te]>"u"||(q=te.toLowerCase(),G=j[te],A[q]=G)}function B(j,A){var q={};for(var G in a.cssRules[A])if(O(j,G.split(" ")))for(var te in a.cssRules[A][G])q[te]=a.cssRules[A][G][te];return q}function O(j,A){var q,G=!0;return q=re(j,A.pop()),q&&A.length&&(G=V(j,A)),q&&G&&A.length===0}function V(j,A){for(var q,G=!0;j.parentNode&&j.parentNode.nodeType===1&&A.length;)G&&(q=A.pop()),j=j.parentNode,G=re(j,q);return A.length===0}function re(j,A){var q=j.nodeName,G=j.getAttribute("class"),te=j.getAttribute("id"),ce,pe;if(ce=new RegExp("^"+q,"i"),A=A.replace(ce,""),te&&A.length&&(ce=new RegExp("#"+te+"(?![a-zA-Z\\-]+)","i"),A=A.replace(ce,"")),G&&A.length)for(G=G.split(" "),pe=G.length;pe--;)ce=new RegExp("\\."+G[pe]+"(?![a-zA-Z\\-]+)","i"),A=A.replace(ce,"");return A.length===0}function J(j,A){var q;if(j.getElementById&&(q=j.getElementById(A)),q)return q;var G,te,ce,pe=j.getElementsByTagName("*");for(te=0,ce=pe.length;teG?G:q),F.meetOrSlice==="slice"&&(G=q=q>G?q:G),se=Z.width-pe*q,ge=Z.height-ve*q,F.alignX==="Mid"&&(se/=2),F.alignY==="Mid"&&(ge/=2),F.alignX==="Min"&&(se=0),F.alignY==="Min"&&(ge=0)),q===1&&G===1&&te===0&&ce===0&&W===0&&$===0)return Z;if((W||$)&&j.parentNode.nodeName!=="#document"&&(me=" translate("+f(W)+" "+f($)+") "),U=me+" matrix("+q+" 0 0 "+G+" "+(te*q+se)+" "+(ce*G+ge)+") ",j.nodeName==="svg"){for(X=j.ownerDocument.createElementNS(a.svgNS,"g");j.firstChild;)X.appendChild(j.firstChild);j.appendChild(X)}else X=j,X.removeAttribute("x"),X.removeAttribute("y"),U=X.getAttribute("transform")+U;return X.setAttribute("transform",U),Z}function R(j,A){for(;j&&(j=j.parentNode);)if(j.nodeName&&A.test(j.nodeName.replace("svg:",""))&&!j.getAttribute("instantiated_by_use"))return!0;return!1}a.parseSVGDocument=function(j,A,q,G){if(!!j){ue(j);var te=a.Object.__uid++,ce,pe,ve=H(j),U=a.util.toArray(j.getElementsByTagName("*"));if(ve.crossOrigin=G&&G.crossOrigin,ve.svgUid=te,U.length===0&&a.isLikelyNode){U=j.selectNodes('//*[name(.)!="svg"]');var X=[];for(ce=0,pe=U.length;ce"u"&&(q=j.getAttribute("svgUid")),j.parentNode&&a.svgValidParentsRegEx.test(j.parentNode.nodeName)&&(te=a.parseAttributes(j.parentNode,A,q));var ve=A.reduce(function(F,K){return G=j.getAttribute(K),G&&(F[K]=G),F},{}),U=u(B(j,q),a.parseStyleAttribute(j));ve=u(ve,U),U[S]&&j.setAttribute(S,U[S]),ce=pe=te.fontSize||a.Text.DEFAULT_SVG_FONT_SIZE,ve[w]&&(ve[w]=ce=f(ve[w],pe));var X,T,Y={};for(var W in ve)X=x(W),T=k(X,ve[W],te,ce),Y[X]=T;Y&&Y.font&&a.parseFontDeclaration(Y.font,Y);var $=u(te,Y);return a.svgValidParentsRegEx.test(j.nodeName)?$:I($)}},parseElements:function(j,A,q,G,te){new a.ElementsParser(j,A,q,G,te).parse()},parseStyleAttribute:function(j){var A={},q=j.getAttribute("style");return q&&(typeof q=="string"?N(q,A):L(q,A)),A},parsePointsAttribute:function(j){if(!j)return null;j=j.replace(/,/g," ").trim(),j=j.split(/\s+/);var A=[],q,G;for(q=0,G=j.length;qd.x&&this.y>d.y},gte:function(d){return this.x>=d.x&&this.y>=d.y},lerp:function(d,c){return typeof c>"u"&&(c=.5),c=Math.max(Math.min(1,c),0),new u(this.x+(d.x-this.x)*c,this.y+(d.y-this.y)*c)},distanceFrom:function(d){var c=this.x-d.x,f=this.y-d.y;return Math.sqrt(c*c+f*f)},midPointFrom:function(d){return this.lerp(d)},min:function(d){return new u(Math.min(this.x,d.x),Math.min(this.y,d.y))},max:function(d){return new u(Math.max(this.x,d.x),Math.max(this.y,d.y))},toString:function(){return this.x+","+this.y},setXY:function(d,c){return this.x=d,this.y=c,this},setX:function(d){return this.x=d,this},setY:function(d){return this.y=d,this},setFromPoint:function(d){return this.x=d.x,this.y=d.y,this},swap:function(d){var c=this.x,f=this.y;this.x=d.x,this.y=d.y,d.x=c,d.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(d){this.status=d,this.points=[]}a.Intersection=u,a.Intersection.prototype={constructor:u,appendPoint:function(d){return this.points.push(d),this},appendPoints:function(d){return this.points=this.points.concat(d),this}},a.Intersection.intersectLineLine=function(d,c,f,s){var h,v=(s.x-f.x)*(d.y-f.y)-(s.y-f.y)*(d.x-f.x),m=(c.x-d.x)*(d.y-f.y)-(c.y-d.y)*(d.x-f.x),y=(s.y-f.y)*(c.x-d.x)-(s.x-f.x)*(c.y-d.y);if(y!==0){var b=v/y,_=m/y;0<=b&&b<=1&&0<=_&&_<=1?(h=new u("Intersection"),h.appendPoint(new a.Point(d.x+b*(c.x-d.x),d.y+b*(c.y-d.y)))):h=new u}else v===0||m===0?h=new u("Coincident"):h=new u("Parallel");return h},a.Intersection.intersectLinePolygon=function(d,c,f){var s=new u,h=f.length,v,m,y,b;for(b=0;b0&&(s.status="Intersection"),s},a.Intersection.intersectPolygonPolygon=function(d,c){var f=new u,s=d.length,h;for(h=0;h0&&(f.status="Intersection"),f},a.Intersection.intersectPolygonRectangle=function(d,c,f){var s=c.min(f),h=c.max(f),v=new a.Point(h.x,s.y),m=new a.Point(s.x,h.y),y=u.intersectLinePolygon(s,v,d),b=u.intersectLinePolygon(v,h,d),_=u.intersectLinePolygon(h,m,d),w=u.intersectLinePolygon(m,s,d),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 h,v,m,y=a.util.array.max([c,f,s]),b=a.util.array.min([c,f,s]);if(m=(y+b)/2,y===b)h=v=0;else{var _=y-b;switch(v=m>.5?_/(2-y-b):_/(y+b),y){case c:h=(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),h=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(h,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,h=parseFloat(f[2])/(/%$/.test(f[2])?100:1),v=parseFloat(f[3])/(/%$/.test(f[3])?100:1),m,y,b;if(h===0)m=y=b=v;else{var _=v<=.5?v*(h+1):v+h-v*h,w=v*2-_;m=d(w,_,s+1/3),y=d(w,_,s),b=d(w,_,s-1/3)}return[Math.round(m*255),Math.round(y*255),Math.round(b*255),f[4]?parseFloat(f[4]):1]}},a.Color.fromHsla=u.fromHsl,a.Color.fromHex=function(c){return u.fromSource(u.sourceFromHex(c))},a.Color.sourceFromHex=function(c){if(c.match(u.reHex)){var f=c.slice(c.indexOf("#")+1),s=f.length===3||f.length===4,h=f.length===8||f.length===4,v=s?f.charAt(0)+f.charAt(0):f.substring(0,2),m=s?f.charAt(1)+f.charAt(1):f.substring(2,4),y=s?f.charAt(2)+f.charAt(2):f.substring(4,6),b=h?s?f.charAt(3)+f.charAt(3):f.substring(6,8):"FF";return[parseInt(v,16),parseInt(m,16),parseInt(y,16),parseFloat((parseInt(b,16)/255).toFixed(2))]}},a.Color.fromSource=function(c){var f=new u;return f.setSource(c),f}}(e),function(o){var a=o.fabric||(o.fabric={}),u=["e","se","s","sw","w","nw","n","ne","e"],d=["ns","nesw","ew","nwse"],c={},f="left",s="top",h="right",v="bottom",m="center",y={top:v,bottom:s,left:h,right:f,center:m},b=a.util.radiansToDegrees,_=Math.sign||function(X){return(X>0)-(X<0)||+X};function w(X,T){var Y=X.angle+b(Math.atan2(T.y,T.x))+360;return Math.round(Y%360/45)}function S(X,T){var Y=T.transform.target,W=Y.canvas,$=a.util.object.clone(T);$.target=Y,W&&W.fire("object:"+X,$),Y.fire(X,T)}function x(X,T){var Y=T.canvas,W=Y.uniScaleKey,$=X[W];return Y.uniformScaling&&!$||!Y.uniformScaling&&$}function k(X){return X.originX===m&&X.originY===m}function E(X,T,Y){var W=X.lockScalingX,$=X.lockScalingY;return!!(W&&$||!T&&(W||$)&&Y||W&&T==="x"||$&&T==="y")}function I(X,T,Y){var W="not-allowed",$=x(X,Y),F="";if(T.x!==0&&T.y===0?F="x":T.x===0&&T.y!==0&&(F="y"),E(Y,F,$))return W;var K=w(Y,T);return u[K]+"-resize"}function D(X,T,Y){var W="not-allowed";if(T.x!==0&&Y.lockSkewingY||T.y!==0&&Y.lockSkewingX)return W;var $=w(Y,T)%4;return d[$]+"-resize"}function N(X,T,Y){return X[Y.canvas.altActionKey]?c.skewCursorStyleHandler(X,T,Y):c.scaleCursorStyleHandler(X,T,Y)}function L(X,T,Y){var W=X[Y.canvas.altActionKey];if(T.x===0)return W?"skewX":"scaleY";if(T.y===0)return W?"skewY":"scaleX"}function B(X,T,Y){return Y.lockRotation?"not-allowed":T.cursorStyle}function O(X,T,Y,W){return{e:X,transform:T,pointer:{x:Y,y:W}}}function V(X){return function(T,Y,W,$){var F=Y.target,K=F.getCenterPoint(),fe=F.translateToOriginPoint(K,Y.originX,Y.originY),ie=X(T,Y,W,$);return F.setPositionByOrigin(fe,Y.originX,Y.originY),ie}}function re(X,T){return function(Y,W,$,F){var K=T(Y,W,$,F);return K&&S(X,O(Y,W,$,F)),K}}function J(X,T,Y,W,$){var F=X.target,K=F.controls[X.corner],fe=F.canvas.getZoom(),ie=F.padding/fe,Z=F.toLocalPoint(new a.Point(W,$),T,Y);return Z.x>=ie&&(Z.x-=ie),Z.x<=-ie&&(Z.x+=ie),Z.y>=ie&&(Z.y-=ie),Z.y<=ie&&(Z.y+=ie),Z.x-=K.offsetX,Z.y-=K.offsetY,Z}function ue(X){return X.flipX!==X.flipY}function M(X,T,Y,W,$){if(X[T]!==0){var F=X._getTransformedDimensions()[W],K=$/F*X[Y];X.set(Y,K)}}function H(X,T,Y,W){var $=T.target,F=$._getTransformedDimensions(0,$.skewY),K=J(T,T.originX,T.originY,Y,W),fe=Math.abs(K.x*2)-F.x,ie=$.skewX,Z;fe<2?Z=0:(Z=b(Math.atan2(fe/$.scaleX,F.y/$.scaleY)),T.originX===f&&T.originY===v&&(Z=-Z),T.originX===h&&T.originY===s&&(Z=-Z),ue($)&&(Z=-Z));var me=ie!==Z;if(me){var se=$._getTransformedDimensions().y;$.set("skewX",Z),M($,"skewY","scaleY","y",se)}return me}function R(X,T,Y,W){var $=T.target,F=$._getTransformedDimensions($.skewX,0),K=J(T,T.originX,T.originY,Y,W),fe=Math.abs(K.y*2)-F.y,ie=$.skewY,Z;fe<2?Z=0:(Z=b(Math.atan2(fe/$.scaleY,F.x/$.scaleX)),T.originX===f&&T.originY===v&&(Z=-Z),T.originX===h&&T.originY===s&&(Z=-Z),ue($)&&(Z=-Z));var me=ie!==Z;if(me){var se=$._getTransformedDimensions().x;$.set("skewY",Z),M($,"skewX","scaleX","x",se)}return me}function P(X,T,Y,W){var $=T.target,F=$.skewX,K,fe=T.originY;if($.lockSkewingX)return!1;if(F===0){var ie=J(T,m,m,Y,W);ie.x>0?K=f:K=h}else F>0&&(K=fe===s?f:h),F<0&&(K=fe===s?h:f),ue($)&&(K=K===f?h:f);T.originX=K;var Z=re("skewing",V(H));return Z(X,T,Y,W)}function Q(X,T,Y,W){var $=T.target,F=$.skewY,K,fe=T.originX;if($.lockSkewingY)return!1;if(F===0){var ie=J(T,m,m,Y,W);ie.y>0?K=s:K=v}else F>0&&(K=fe===f?s:v),F<0&&(K=fe===f?v:s),ue($)&&(K=K===s?v:s);T.originY=K;var Z=re("skewing",V(R));return Z(X,T,Y,W)}function j(X,T,Y,W){var $=T,F=$.target,K=F.translateToOriginPoint(F.getCenterPoint(),$.originX,$.originY);if(F.lockRotation)return!1;var fe=Math.atan2($.ey-K.y,$.ex-K.x),ie=Math.atan2(W-K.y,Y-K.x),Z=b(ie-fe+$.theta),me=!0;if(F.snapAngle>0){var se=F.snapAngle,ge=F.snapThreshold||se,we=Math.ceil(Z/se)*se,Te=Math.floor(Z/se)*se;Math.abs(Z-Te)_?(I=b,s.scale(1,_/b),E=v*b/_):_>b?(I=_,s.scale(b/_,1),k=h*_/b):I=b,s.lineWidth=1,s.beginPath(),s.arc(k,E,I/2,0,2*Math.PI,!1),s[S](),x&&s.stroke(),s.restore()}function f(s,h,v,m,y){m=m||{};var b=this.sizeX||m.cornerSize||y.cornerSize,_=this.sizeY||m.cornerSize||y.cornerSize,w=typeof m.transparentCorners<"u"?m.transparentCorners:y.transparentCorners,S=w?"stroke":"fill",x=!w&&(m.cornerStrokeColor||y.cornerStrokeColor),k=b/2,E=_/2;s.save(),s.fillStyle=m.cornerColor||y.cornerColor,s.strokeStyle=m.cornerStrokeColor||y.cornerStrokeColor,s.lineWidth=1,s.translate(h,v),s.rotate(u(y.angle)),s[S+"Rect"](-k,-E,b,_),x&&s.strokeRect(-k,-E,b,_),s.restore()}d.renderCircleControl=c,d.renderSquareControl=f}(e),function(o){var a=o.fabric||(o.fabric={});function u(d){for(var c in d)this[c]=d[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(d,c){return c.cursorStyle},getActionName:function(d,c){return c.actionName},getVisibility:function(d,c){var f=d._controlsVisibility;return f&&typeof f[c]<"u"?f[c]:this.visible},setVisibility:function(d){this.visible=d},positionHandler:function(d,c){var f=a.util.transformPoint({x:this.x*d.x+this.offsetX,y:this.y*d.y+this.offsetY},c);return f},calcCornerCoords:function(d,c,f,s,h){var v,m,y,b,_=h?this.touchSizeX:this.sizeX,w=h?this.touchSizeY:this.sizeY;if(_&&w&&_!==w){var S=Math.atan2(w,_),x=Math.sqrt(_*_+w*w)/2,k=S-a.util.degreesToRadians(d),E=Math.PI/2-S-a.util.degreesToRadians(d);v=x*a.util.cos(k),m=x*a.util.sin(k),y=x*a.util.cos(E),b=x*a.util.sin(E)}else{var I=_&&w?_:c;x=I*.7071067812;var k=a.util.degreesToRadians(45-d);v=y=x*a.util.cos(k),m=b=x*a.util.sin(k)}return{tl:{x:f-b,y:s-y},tr:{x:f+v,y:s-m},bl:{x:f-v,y:s+m},br:{x:f+b,y:s+y}}},render:function(d,c,f,s,h){switch(s=s||{},s.cornerStyle||h.cornerStyle){case"circle":a.controlsUtils.renderCircleControl.call(this,d,c,f,s,h);break;default:a.controlsUtils.renderSquareControl.call(this,d,c,f,s,h)}}}}(e),function(){function o(f,s){var h=f.getAttribute("style"),v=f.getAttribute("offset")||0,m,y,b,_;if(v=parseFloat(v)/(/%$/.test(v)?100:1),v=v<0?0:v>1?1:v,h){var w=h.split(/\s*;\s*/);for(w[w.length-1]===""&&w.pop(),_=w.length;_--;){var S=w[_].split(/\s*:\s*/),x=S[0].trim(),k=S[1].trim();x==="stop-color"?m=k:x==="stop-opacity"&&(b=k)}}return m||(m=f.getAttribute("stop-color")||"rgb(0,0,0)"),b||(b=f.getAttribute("stop-opacity")),m=new t.Color(m),y=m.getAlpha(),b=isNaN(parseFloat(b))?1:parseFloat(b),b*=y*s,{offset:v,color:m.toRgb(),opacity:b}}function a(f){return{x1:f.getAttribute("x1")||0,y1:f.getAttribute("y1")||0,x2:f.getAttribute("x2")||"100%",y2:f.getAttribute("y2")||0}}function u(f){return{x1:f.getAttribute("fx")||f.getAttribute("cx")||"50%",y1:f.getAttribute("fy")||f.getAttribute("cy")||"50%",r1:0,x2:f.getAttribute("cx")||"50%",y2:f.getAttribute("cy")||"50%",r2:f.getAttribute("r")||"50%"}}var d=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,h=this;Object.keys(f).forEach(function(v){h[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 h=new t.Color(f[s]);this.colorStops.push({offset:parseFloat(s),color:h.toRgb(),opacity:h.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 h=d(this.coords,!0),v,m,y=y||{},b,_,w=d(this.colorStops,!0),S=h.r1>h.r2,x=this.gradientTransform?this.gradientTransform.concat():t.iMatrix.concat(),k=-this.offsetX,E=-this.offsetY,I=!!y.additionalTransform,D=this.gradientUnits==="pixels"?"userSpaceOnUse":"objectBoundingBox";if(w.sort(function(V,re){return V.offset-re.offset}),D==="objectBoundingBox"?(k/=f.width,E/=f.height):(k+=f.width/2,E+=f.height/2),f.type==="path"&&this.gradientUnits!=="percentage"&&(k-=f.pathOffset.x,E-=f.pathOffset.y),x[4]-=k,x[5]-=E,_='id="SVGID_'+this.id+'" gradientUnits="'+D+'"',_+=' gradientTransform="'+(I?y.additionalTransform+" ":"")+t.util.matrixToSVG(x)+'" ',this.type==="linear"?b=[" `]:this.type==="radial"&&(b=[" @@ -508,7 +508,7 @@ gl_FragColor.rgb *= color.a; `)},_setSVGTextLineBg:function(u,d,c,f){for(var s=this._textLines[d],h=this.getHeightOfLine(d)/this.lineHeight,v=0,m=0,y,b,_=this.getValueOfPropertyAt(d,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 d=0,c=0,f=0,s={},h=0;h0?(c=0,f++,d++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&h>0&&(c++,f++),s[h]={line:d,offset:c},f+=u.graphemeLines[h].length,c+=u.graphemeLines[h].length;return s},styleHas:function(u,d){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[d];c&&(d=c.line)}return a.Text.prototype.styleHas.call(this,u,d)},isEmptyStyles:function(u){if(!this.styles)return!0;var d=0,c=u+1,f,s,h=!1,v=this._styleMap[u],m=this._styleMap[u+1];v&&(u=v.line,d=v.offset),m&&(c=m.line,h=c===u,f=m.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=d&&(!h||bc&&!E?(v.push(m),m=[],s=S,E=!0):s+=I,!E&&!h&&m.push(w),m=m.concat(b),x=h?0:this._measureWord([w],d,_),_++,E=!1,S>k&&(k=S);return N&&v.push(m),k+D>this.dynamicMinWidth&&(this.dynamicMinWidth=k-I+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 d=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(d.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=ae({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=ae({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>nn().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>nn().currentImageProps),g=ee({get:()=>i.value.drawing&&!r.value,set:P=>i.value.drawing=P}),o=ae(512),a=ae(512),u=ae(!1),d=ae(30),c=ae(!1),f=new er.fabric.Circle({radius:d.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=ae("Erase"),h=ae("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function m(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(P=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=P||i.value.brush.color,i.value.brush.width=d.value)}async function b({history:P,erase:Q=!1,draw:j=!1}={}){if(!P||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;P.path.selectable=!1,P.path.opacity=1,P.drawPath=await M(P.path),P.visibleDrawPath=await M(P.path),Q?(P.visibleDrawPath.globalCompositeOperation="destination-out",P.drawPath.stroke=i.value.maskBackgroundColor):(P.visibleDrawPath.globalCompositeOperation="source-over",P.drawPath.stroke=j?h.value:i.value.maskPathColor);let A=await M(P.drawPath);A=A.scale(i.value.imageScale),A.left=A.left+P.drawPath.left*(i.value.imageScale-1),A.top=A.top+P.drawPath.top*(i.value.imageScale-1),j?(i.value.imageLayer.add(A),i.value.visibleImageLayer.addWithUpdate(P.visibleDrawPath)):(i.value.drawLayer.add(A),i.value.visibleDrawLayer.addWithUpdate(P.visibleDrawPath)),i.value.canvas.remove(P.path),v()}function _(){if(i.value.undoHistory.length===0)return;const P=i.value.undoHistory.pop();b({history:P,erase:!1,draw:g.value}),i.value.redoHistory.push(P)}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 P=i.value.redoHistory.pop();i.value.undoHistory.push(P),g.value?(i.value.imageLayer.remove(P.drawPath),i.value.visibleImageLayer.remove(P.visibleDrawPath)):(i.value.drawLayer.remove(P.drawPath),i.value.visibleDrawLayer.remove(P.visibleDrawPath)),delete P.drawPath,delete P.visibleDrawPath,v()}function S(P){i.value.canvas=new er.fabric.Canvas(P,{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",R),i.value.canvas.on("path:created",H),v()}function x(P,Q,j,A){let q=A,G=A;return Q>j?(P.scaleToWidth(A),q=A*(a.value/o.value)):(P.scaleToHeight(A),G=A*(o.value/a.value)),{newHeight:q,newWidth:G}}function k(P){const Q=nn();if(re(),P.selectable=!1,o.value=P.width,a.value=P.height,o.value>Q.maxDimensions||a.value>Q.maxDimensions){const{newHeight:G,newWidth:te}=x(P,o.value,a.value,Q.maxDimensions);o.value=te,a.value=G}if(o.value{i.value.imageLayer=B({image:G,layerHeight:q,layerWidth:A})}),P.cloneAsImage(G=>{if(!i.value.canvas)return;if(o.value!==j||a.value!==j){const{newHeight:pe,newWidth:ve}=x(G,o.value,a.value,j);o.value=ve,a.value=pe}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=V(),i.value.visibleImageLayer=V({image:G}),i.value.drawLayer=B({layerHeight:q,layerWidth:A});const te=o.value*i.value.imageScale,ce=a.value*i.value.imageScale;Q.params.width=te-te%64,Q.params.height=ce-ce%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,N(),I()})}function E(P,Q,j,A,q,G){const te=G?G.width:P.width,ce=G?G.height:P.height;if(q==="Original")return P;const pe=document.createElement("canvas");pe.width=Q,pe.height=j;const ve=pe.getContext("2d");ve.fillStyle=A,ve.fillRect(0,0,pe.width,pe.height);let U=0,X=0,T=P.width,Y=P.height,W=0,$=0,F=pe.width,K=pe.height;switch(q){case"Stretch":break;case"ScaleAndCrop":{const fe=pe.width/te,ie=pe.height/ce;fe>ie?(Y=pe.height/fe,X=(P.height-Y)/2):(T=pe.width/ie,U=(P.width-T)/2);break}case"ScaleAndPad":{const fe=pe.width/te,ie=pe.height/ce;feQ?(T=Q,U=fe-Q/2):(F=te,W=Q/2-fe),ce>j?(Y=j,X=ie-j/2):(K=ce,$=j/2-ie);break}}return ve.drawImage(P,U,X,T,Y,W,$,F,K),pe}function I(){const P=nn(),Q=At();if(!i.value.imageLayer||!i.value.drawLayer)return;const j=P.params.width,A=P.params.height,q=i.value.imageLayer.backgroundColor||"#FFFFFF",G=Q.imageResizeMode,te=i.value.imageLayer.toCanvasElement(),ce=E(te,j,A,q,G,te);if(l.value.sourceImage=ce.toDataURL("image/jpeg",1),l.value.maskImage=void 0,i.value.redoHistory.length>0&&!g.value){const ve=i.value.drawLayer.toCanvasElement(),U=E(ve,j,A,q,G,te);l.value.maskImage=U.toDataURL("image/jpeg",1).split(",")[1]}}let D;function N(){if(!i.value.canvas)return;const P=nn();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=V({layerWidth:P.params.width/i.value.imageScale,layerHeight:P.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),D&&clearTimeout(D),D=setTimeout(()=>{c.value=!1,N(),D=void 0},5e3))}function L(P,Q){const j="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";er.fabric.Image.fromURL(j,A=>{A.set({height:P,width:Q});const q=A.toDataURL({format:"png"});l.value.sourceImage=q,g.value=!0,k(A)})}function B({image:P,layerWidth:Q,layerHeight:j}={}){const A=new er.fabric.Canvas(null);return A.selection=!1,A.backgroundColor=i.value.maskBackgroundColor,A.setHeight(j||a.value),A.setWidth(Q||o.value),P&&A.add(P),A}function O(){return i.value.imageLayer?{layerHeight:i.value.imageLayer.getHeight(),layerWidth:i.value.imageLayer.getWidth()}:{}}function V({image:P,layerWidth:Q,layerHeight:j,fill:A,abosolute:q}={}){const G=P||new er.fabric.Rect({width:Q||o.value,height:j||a.value,left:0,top:0,fill:A||"transparent",absolutePositioned:q||!0,selectable:!1});return new er.fabric.Group([G],{selectable:!1,absolutePositioned:q||!0})}function re(){!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 J(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),g.value){const P=nn();L(P.params.height||512,P.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=V(),i.value.drawLayer=B(O()),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ue(){var Q;I();const P=document.createElement("a");if(g.value){P.href="data:image/png;base64,"+((Q=l.value.sourceImage)==null?void 0:Q.split(",")[1]),P.download="image_drawing.png",P.click();return}P.href="data:image/png;base64,"+l.value.maskImage,P.download="image_mask.png",P.click()}async function M(P){return new Promise((Q,j)=>{try{P.clone(Q)}catch(A){j(A)}})}async function H(P){const Q={path:P.path};b({history:Q,erase:u.value,draw:g.value}),i.value.redoHistory.push(Q)}function R(P){if(!i.value.canvas)return;const Q=i.value.canvas.getPointer(P.e);f.left=Q.x,f.top=Q.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),g.value?(f.set("fill",h.value),y(h.value)):(f.set("fill","white"),y("white"))),f.set("radius",d.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:d,drawColor:h,drawing:g,imageProps:i,updateCropPreview:N,createNewCanvas:S,downloadMask:ue,resetCanvas:re,resetDrawing:J,flipErase:m,undoAction:w,redoAction:_,newImage:k,newBlankImage:L,setBrush:y,saveImages:I}});const wW={},CW={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},SW=ne("g",{fill:"none"},[ne("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),xW=[SW];function kW(e,t){return z(),oe("svg",CW,xW)}const TW=Jt(wW,[["render",kW]]);async function EW(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(g=>i.onload=g),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function OW(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 EW(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let g=0;g{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const Tm=e=>(hi("data-v-7dc3b5bb"),e=e(),pi(),e),AW=Tm(()=>ne("div",null,[Ue("Drop file here, paste an image OR "),ne("em",null,"click to upload")],-1)),PW={key:0},IW=Tm(()=>ne("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),MW={class:"canvas-container"},LW=Tm(()=>ne("canvas",{id:"canvas"},null,-1)),RW={class:"action-buttons",style:{left:"10px",right:"unset"}},DW={class:"action-buttons"},$W=Ee({__name:"CustomCanvas",setup(e){const t=nn(),n=Wt(),r=Ns(),i=ae();async function l(a){if(!a.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const u=await Mc(a.raw);t.currentImageProps.sourceImage=u,r.drawing=!1,er.fabric.Image.fromURL(u,r.newImage)}function g(){t.currentImageProps.sourceImage="",r.resetCanvas()}rt(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&er.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage),window.addEventListener("paste",o)}),Gt(()=>{window.removeEventListener("paste",o)});async function o(a){var d;const u=(d=a.clipboardData)==null?void 0:d.items;if(!!u)for(let c=0;c(z(),oe(Ne,null,[C(t).currentImageProps.sourceImage?ye("",!0):(z(),be(C(nm),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:he(()=>[C(t).generatorType==="Img2Img"?(z(),oe("div",PW,[IW,ne("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:u[0]||(u[0]=d=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(Le),{size:20,style:{"margin-right":"2px"}},{default:he(()=>[le(R2)]),_:1}),Ue("draw something")])])):ye("",!0)]),default:he(()=>[le(C(Le),{size:100},{default:he(()=>[le(C(Cp))]),_:1}),AW]),_:1},512)),Ot(ne("div",null,[ne("div",MW,[LW,ne("div",RW,[le(C(at),{onClick:u[1]||(u[1]=d=>C(r).undoAction()),icon:C(A_),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(at),{onClick:u[2]||(u[2]=d=>C(r).redoAction()),icon:C(P_),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),ne("div",DW,[le(C(at),{onClick:u[3]||(u[3]=d=>C(r).resetDrawing()),icon:C($r),plain:""},null,8,["icon"]),le(C(at),{onClick:g,icon:C(Dl),plain:""},null,8,["icon"]),le(C(at),{onClick:u[4]||(u[4]=d=>C(r).downloadMask()),icon:C(tl),plain:""},null,8,["icon"]),le(C(at),{onClick:u[5]||(u[5]=d=>C(r).flipErase()),icon:C(r).erasing?C(w3):TW,plain:""},null,8,["icon"]),C(r).drawing?(z(),be(C(VB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":u[6]||(u[6]=d=>C(r).drawColor=d),"show-alpha":""},null,8,["modelValue"])):ye("",!0)]),le(C(Zp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:he(()=>[le(kn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":u[7]||(u[7]=d=>C(r).brushSize=d),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Yt,C(t).currentImageProps.sourceImage]])],64))}});const ay=Jt($W,[["__scopeId","data-v-7dc3b5bb"]]),BW={class:"centerIcons"},FW={class:"stackedIcons"},zW=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return Qx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(z(),oe("div",BW,[ne("div",FW,[le(C(Le),{class:"firstIcon",size:e.size},{default:he(()=>[(z(),be(St(t.iconOne)))]),_:1},8,["size"]),le(C(Le),{class:"secondIcon",size:e.size},{default:he(()=>[(z(),be(St(t.iconTwo)))]),_:1},8,["size"])])]))}});const NW=Jt(zW,[["__scopeId","data-v-74586a39"]]),jW={key:1,style:{width:"40px"}},Tu=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(z(),be(C(Wn),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:he(()=>[le(C(Qp),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:he(()=>[e.iconTwo?(z(),be(NW,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(z(),oe("div",jW,[le(C(Le),{style:{width:"35px"},size:40},{default:he(()=>[(z(),be(St(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const VW=4,oy=0,sy=1,UW=2;function rs(e){let t=e.length;for(;--t>=0;)e[t]=0}const HW=0,$2=1,WW=2,YW=3,XW=258,Em=29,Gl=256,wl=Gl+1+Em,Po=30,Om=19,B2=2*wl+1,Oa=15,ld=16,KW=7,Am=256,F2=16,z2=17,N2=18,Bh=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]),ec=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]),GW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),j2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qW=512,Qr=new Array((wl+2)*2);rs(Qr);const js=new Array(Po*2);rs(js);const Cl=new Array(qW);rs(Cl);const Sl=new Array(XW-YW+1);rs(Sl);const Pm=new Array(Em);rs(Pm);const Lc=new Array(Po);rs(Lc);function ud(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 V2,U2,H2;function cd(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const W2=e=>e<256?Cl[e]:Cl[256+(e>>>7)],xl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},Ln=(e,t,n)=>{e.bi_valid>ld-n?(e.bi_buf|=t<>ld-e.bi_valid,e.bi_valid+=n-ld):(e.bi_buf|=t<{Ln(e,n[t*2],n[t*2+1])},Y2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},ZW=e=>{e.bi_valid===16?(xl(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)},JW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,g=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,d,c,f,s,h,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[d*2+1]=f,!(d>r)&&(e.bl_count[f]++,s=0,d>=o&&(s=g[d-o]),h=n[d*2],e.opt_len+=h*(f+s),l&&(e.static_len+=h*(i[d*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(d=e.bl_count[f];d!==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),d--)}},X2=(e,t,n)=>{const r=new Array(Oa+1);let i=0,l,g;for(l=1;l<=Oa;l++)i=i+n[l-1]<<1,r[l]=i;for(g=0;g<=t;g++){let o=e[g*2+1];o!==0&&(e[g*2]=Y2(r[o]++,o))}},QW=()=>{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?xl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},ly=(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,g,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?Ar(e,i,t):(g=Sl[i],Ar(e,g+Gl+1,t),o=Bh[g],o!==0&&(i-=Pm[g],Ln(e,i,o)),r--,g=W2(r),Ar(e,g,n),o=ec[g],o!==0&&(r-=Lc[g],Ln(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 g,o,a=-1,u;for(e.heap_len=0,e.heap_max=B2,g=0;g>1;g>=1;g--)fd(e,n,g);u=l;do g=e.heap[1],e.heap[1]=e.heap[e.heap_len--],fd(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=g,e.heap[--e.heap_max]=o,n[u*2]=n[g*2]+n[o*2],e.depth[u]=(e.depth[g]>=e.depth[o]?e.depth[g]:e.depth[o])+1,n[g*2+1]=n[o*2+1]=u,e.heap[1]=u++,fd(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],JW(e,t),X2(n,a,e.bl_count)},cy=(e,t,n)=>{let r,i=-1,l,g=t[0*2+1],o=0,a=7,u=4;for(g===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=g,g=t[(r+1)*2+1],!(++o{let r,i=-1,l,g=t[0*2+1],o=0,a=7,u=4;for(g===0&&(a=138,u=3),r=0;r<=n;r++)if(l=g,g=t[(r+1)*2+1],!(++o{let t;for(cy(e,e.dyn_ltree,e.l_desc.max_code),cy(e,e.dyn_dtree,e.d_desc.max_code),Fh(e,e.bl_desc),t=Om-1;t>=3&&e.bl_tree[j2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},tY=(e,t,n,r)=>{let i;for(Ln(e,t-257,5),Ln(e,n-1,5),Ln(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 oy;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return sy;for(n=32;n{dy||(QW(),dy=!0),e.l_desc=new cd(e.dyn_ltree,V2),e.d_desc=new cd(e.dyn_dtree,U2),e.bl_desc=new cd(e.bl_tree,H2),e.bi_buf=0,e.bi_valid=0,K2(e)},q2=(e,t,n,r)=>{Ln(e,(HW<<1)+(r?1:0),3),G2(e),xl(e,n),xl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},iY=e=>{Ln(e,$2<<1,3),Ar(e,Am,Qr),ZW(e)},aY=(e,t,n,r)=>{let i,l,g=0;e.level>0?(e.strm.data_type===UW&&(e.strm.data_type=nY(e)),Fh(e,e.l_desc),Fh(e,e.d_desc),g=eY(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?q2(e,t,n,r):e.strategy===VW||l===i?(Ln(e,($2<<1)+(r?1:0),3),uy(e,Qr,js)):(Ln(e,(WW<<1)+(r?1:0),3),tY(e,e.l_desc.max_code+1,e.d_desc.max_code+1,g+1),uy(e,e.dyn_ltree,e.dyn_dtree)),K2(e),r&&G2(e)},oY=(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[(Sl[n]+Gl+1)*2]++,e.dyn_dtree[W2(t)*2]++),e.sym_next===e.sym_end);var sY=rY,lY=q2,uY=aY,cY=oY,fY=iY,dY={_tr_init:sY,_tr_stored_block:lY,_tr_flush_block:uY,_tr_tally:cY,_tr_align:fY};const hY=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,g=0;for(;n!==0;){g=n>2e3?2e3:n,n-=g;do i=i+t[r++]|0,l=l+i|0;while(--g);i%=65521,l%=65521}return i|l<<16|0};var kl=hY;const pY=()=>{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},mY=new Uint32Array(pY()),gY=(e,t,n,r)=>{const i=mY,l=r+n;e^=-1;for(let g=r;g>>8^i[(e^t[g])&255];return e^-1};var tn=gY,Ha={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"},is={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:vY,_tr_stored_block:zh,_tr_flush_block:yY,_tr_tally:Hi,_tr_align:bY}=dY,{Z_NO_FLUSH:Wi,Z_PARTIAL_FLUSH:_Y,Z_FULL_FLUSH:wY,Z_FINISH:tr,Z_BLOCK:hy,Z_OK:un,Z_STREAM_END:py,Z_STREAM_ERROR:Rr,Z_DATA_ERROR:CY,Z_BUF_ERROR:dd,Z_DEFAULT_COMPRESSION:SY,Z_FILTERED:xY,Z_HUFFMAN_ONLY:Eu,Z_RLE:kY,Z_FIXED:TY,Z_DEFAULT_STRATEGY:EY,Z_UNKNOWN:OY,Z_DEFLATED:mf}=is,AY=9,PY=15,IY=8,MY=29,LY=256,Nh=LY+1+MY,RY=30,DY=19,$Y=2*Nh+1,BY=15,lt=3,Ni=258,Dr=Ni+lt+1,FY=32,Ho=42,Im=57,jh=69,Vh=73,Uh=91,Hh=103,Aa=113,Cs=666,En=1,as=2,Wa=3,os=4,zY=3,Pa=(e,t)=>(e.msg=Ha[t],t),my=e=>e*2-(e>4?9:0),Bi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},NY=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 jY=(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))},Xn=(e,t)=>{yY(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Vn(e.strm)},gt=(e,t)=>{e.pending_buf[e.pending++]=t},gs=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Wh=(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=kl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=tn(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Z2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,g=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-Dr?e.strstart-(e.w_size-Dr):0,u=e.window,d=e.w_mask,c=e.prev,f=e.strstart+Ni;let s=u[r+g-1],h=u[r+g];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+g]!==h||u[i+g-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]&&rg){if(e.match_start=t,g=l,l>=o)break;s=u[r+g-1],h=u[r+g]}}while((t=c[t&d])>a&&--n!==0);return g<=e.lookahead?g:e.lookahead},Wo=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Dr)&&(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),NY(e),r+=t),e.strm.avail_in===0)break;if(n=Wh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=lt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Yi(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Yi(e,e.ins_h,e.window[i+lt-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,g=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,Vn(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&&(Wh(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(g===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&&(Wh(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===tr)&&t!==Wi&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,g=t===tr&&e.strm.avail_in===0&&r===i?1:0,zh(e,e.block_start,r,g),e.block_start+=r,Vn(e.strm)),g?Wa:En)},hd=(e,t)=>{let n,r;for(;;){if(e.lookahead=lt&&(e.ins_h=Yi(e,e.ins_h,e.window[e.strstart+lt-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-Dr&&(e.match_length=Z2(e,n)),e.match_length>=lt)if(r=Hi(e,e.strstart-e.match_start,e.match_length-lt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=lt){e.match_length--;do e.strstart++,e.ins_h=Yi(e,e.ins_h,e.window[e.strstart+lt-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=Yi(e,e.ins_h,e.window[e.strstart+1]);else r=Hi(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Xn(e,!1),e.strm.avail_out===0))return En}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=lt&&(e.ins_h=Yi(e,e.ins_h,e.window[e.strstart+lt-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=lt-1,n!==0&&e.prev_length4096)&&(e.match_length=lt-1)),e.prev_length>=lt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-lt,r=Hi(e,e.strstart-1-e.prev_match,e.prev_length-lt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Yi(e,e.ins_h,e.window[e.strstart+lt-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=lt-1,e.strstart++,r&&(Xn(e,!1),e.strm.avail_out===0))return En}else if(e.match_available){if(r=Hi(e,0,e.window[e.strstart-1]),r&&Xn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return En}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Hi(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const g=e.window;for(;;){if(e.lookahead<=Ni){if(Wo(e),e.lookahead<=Ni&&t===Wi)return En;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=lt&&e.strstart>0&&(i=e.strstart-1,r=g[i],r===g[++i]&&r===g[++i]&&r===g[++i])){l=e.strstart+Ni;do;while(r===g[++i]&&r===g[++i]&&r===g[++i]&&r===g[++i]&&r===g[++i]&&r===g[++i]&&r===g[++i]&&r===g[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=lt?(n=Hi(e,1,e.match_length-lt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Hi(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Xn(e,!1),e.strm.avail_out===0))return En}return e.insert=0,t===tr?(Xn(e,!0),e.strm.avail_out===0?Wa:os):e.sym_next&&(Xn(e,!1),e.strm.avail_out===0)?En:as},UY=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Wo(e),e.lookahead===0)){if(t===Wi)return En;break}if(e.match_length=0,n=Hi(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Xn(e,!1),e.strm.avail_out===0))return En}return e.insert=0,t===tr?(Xn(e,!0),e.strm.avail_out===0?Wa:os):e.sym_next&&(Xn(e,!1),e.strm.avail_out===0)?En:as};function kr(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 Ss=[new kr(0,0,0,0,J2),new kr(4,4,8,4,hd),new kr(4,5,16,8,hd),new kr(4,6,32,32,hd),new kr(4,4,16,16,mo),new kr(8,16,32,32,mo),new kr(8,16,128,128,mo),new kr(8,32,128,256,mo),new kr(32,128,258,1024,mo),new kr(32,258,258,4096,mo)],HY=e=>{e.window_size=2*e.w_size,Bi(e.head),e.max_lazy_match=Ss[e.level].max_lazy,e.good_match=Ss[e.level].good_length,e.nice_match=Ss[e.level].nice_length,e.max_chain_length=Ss[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=lt-1,e.match_available=0,e.ins_h=0};function WY(){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=mf,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($Y*2),this.dyn_dtree=new Uint16Array((2*RY+1)*2),this.bl_tree=new Uint16Array((2*DY+1)*2),Bi(this.dyn_ltree),Bi(this.dyn_dtree),Bi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(BY+1),this.heap=new Uint16Array(2*Nh+1),Bi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Nh+1),Bi(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 ql=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ho&&t.status!==Im&&t.status!==jh&&t.status!==Vh&&t.status!==Uh&&t.status!==Hh&&t.status!==Aa&&t.status!==Cs?1:0},Q2=e=>{if(ql(e))return Pa(e,Rr);e.total_in=e.total_out=0,e.data_type=OY;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Im:t.wrap?Ho:Aa,e.adler=t.wrap===2?0:1,t.last_flush=-2,vY(t),un},eC=e=>{const t=Q2(e);return t===un&&HY(e.state),t},YY=(e,t)=>ql(e)||e.state.wrap!==2?Rr:(e.state.gzhead=t,un),tC=(e,t,n,r,i,l)=>{if(!e)return Rr;let g=1;if(t===SY&&(t=6),r<0?(g=0,r=-r):r>15&&(g=2,r-=16),i<1||i>AY||n!==mf||r<8||r>15||t<0||t>9||l<0||l>TY||r===8&&g!==1)return Pa(e,Rr);r===8&&(r=9);const o=new WY;return e.state=o,o.strm=e,o.status=Ho,o.wrap=g,o.gzhead=null,o.w_bits=r,o.w_size=1<tC(e,t,mf,PY,IY,EY),KY=(e,t)=>{if(ql(e)||t>hy||t<0)return e?Pa(e,Rr):Rr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Cs&&t!==tr)return Pa(e,e.avail_out===0?dd:Rr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Vn(e),e.avail_out===0)return n.last_flush=-1,un}else if(e.avail_in===0&&my(t)<=my(r)&&t!==tr)return Pa(e,dd);if(n.status===Cs&&e.avail_in!==0)return Pa(e,dd);if(n.status===Ho&&n.wrap===0&&(n.status=Aa),n.status===Ho){let i=mf+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=Eu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=FY),i+=31-i%31,gs(n,i),n.strstart!==0&&(gs(n,e.adler>>>16),gs(n,e.adler&65535)),e.adler=1,n.status=Aa,Vn(e),n.pending!==0)return n.last_flush=-1,un}if(n.status===Im){if(e.adler=0,gt(n,31),gt(n,139),gt(n,8),n.gzhead)gt(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)),gt(n,n.gzhead.time&255),gt(n,n.gzhead.time>>8&255),gt(n,n.gzhead.time>>16&255),gt(n,n.gzhead.time>>24&255),gt(n,n.level===9?2:n.strategy>=Eu||n.level<2?4:0),gt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(gt(n,n.gzhead.extra.length&255),gt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=tn(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=jh;else if(gt(n,0),gt(n,0),gt(n,0),gt(n,0),gt(n,0),gt(n,n.level===9?2:n.strategy>=Eu||n.level<2?4:0),gt(n,zY),n.status=Aa,Vn(e),n.pending!==0)return n.last_flush=-1,un}if(n.status===jh){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=tn(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,Vn(e),n.pending!==0)return n.last_flush=-1,un;i=0,l-=o}let g=new Uint8Array(n.gzhead.extra);n.pending_buf.set(g.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=tn(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Vh}if(n.status===Vh){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=tn(e.adler,n.pending_buf,n.pending-i,i)),Vn(e),n.pending!==0)return n.last_flush=-1,un;i=0}n.gzindexi&&(e.adler=tn(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Uh}if(n.status===Uh){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=tn(e.adler,n.pending_buf,n.pending-i,i)),Vn(e),n.pending!==0)return n.last_flush=-1,un;i=0}n.gzindexi&&(e.adler=tn(e.adler,n.pending_buf,n.pending-i,i))}n.status=Hh}if(n.status===Hh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Vn(e),n.pending!==0))return n.last_flush=-1,un;gt(n,e.adler&255),gt(n,e.adler>>8&255),e.adler=0}if(n.status=Aa,Vn(e),n.pending!==0)return n.last_flush=-1,un}if(e.avail_in!==0||n.lookahead!==0||t!==Wi&&n.status!==Cs){let i=n.level===0?J2(n,t):n.strategy===Eu?UY(n,t):n.strategy===kY?VY(n,t):Ss[n.level].func(n,t);if((i===Wa||i===os)&&(n.status=Cs),i===En||i===Wa)return e.avail_out===0&&(n.last_flush=-1),un;if(i===as&&(t===_Y?bY(n):t!==hy&&(zh(n,0,0,!1),t===wY&&(Bi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Vn(e),e.avail_out===0))return n.last_flush=-1,un}return t!==tr?un:n.wrap<=0?py:(n.wrap===2?(gt(n,e.adler&255),gt(n,e.adler>>8&255),gt(n,e.adler>>16&255),gt(n,e.adler>>24&255),gt(n,e.total_in&255),gt(n,e.total_in>>8&255),gt(n,e.total_in>>16&255),gt(n,e.total_in>>24&255)):(gs(n,e.adler>>>16),gs(n,e.adler&65535)),Vn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?un:py)},GY=e=>{if(ql(e))return Rr;const t=e.state.status;return e.state=null,t===Aa?Pa(e,CY):un},qY=(e,t)=>{let n=t.length;if(ql(e))return Rr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Ho||r.lookahead)return Rr;if(i===1&&(e.adler=kl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Bi(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,g=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Wo(r);r.lookahead>=lt;){let a=r.strstart,u=r.lookahead-(lt-1);do r.ins_h=Yi(r,r.ins_h,r.window[a+lt-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=lt-1,Wo(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=lt-1,r.match_available=0,e.next_in=g,e.input=o,e.avail_in=l,r.wrap=i,un};var ZY=XY,JY=tC,QY=eC,eX=Q2,tX=YY,nX=KY,rX=GY,iX=qY,aX="pako deflate (from Nodeca project)",Vs={deflateInit:ZY,deflateInit2:JY,deflateReset:QY,deflateResetKeep:eX,deflateSetHeader:tX,deflate:nX,deflateEnd:rX,deflateSetDictionary:iX,deflateInfo:aX};const oX=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var sX=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)oX(n,r)&&(e[r]=n[r])}}return e},lX=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;Tl[254]=Tl[254]=1;var uX=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,g=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 cX=(e,t)=>{if(t<65534&&e.subarray&&nC)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(g&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}g<65536?l[i++]=g:(g-=65536,l[i++]=55296|g>>10&1023,l[i++]=56320|g&1023)}return cX(l,i)},dX=(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+Tl[e[n]]>t?n:t},El={string2buf:uX,buf2string:fX,utf8border:dX};function hX(){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 rC=hX;const iC=Object.prototype.toString,{Z_NO_FLUSH:pX,Z_SYNC_FLUSH:mX,Z_FULL_FLUSH:gX,Z_FINISH:vX,Z_OK:Rc,Z_STREAM_END:yX,Z_DEFAULT_COMPRESSION:bX,Z_DEFAULT_STRATEGY:_X,Z_DEFLATED:wX}=is;function Zl(e){this.options=gf.assign({level:bX,method:wX,chunkSize:16384,windowBits:15,memLevel:8,strategy:_X},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 rC,this.strm.avail_out=0;let n=Vs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Rc)throw new Error(Ha[n]);if(t.header&&Vs.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=El.string2buf(t.dictionary):iC.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Vs.deflateSetDictionary(this.strm,r),n!==Rc)throw new Error(Ha[n]);this._dict_set=!0}}Zl.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?vX:pX,typeof e=="string"?n.input=El.string2buf(e):iC.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===mX||l===gX)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=Vs.deflate(n,l),i===yX)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Vs.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Rc;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};Zl.prototype.onData=function(e){this.chunks.push(e)};Zl.prototype.onEnd=function(e){e===Rc&&(this.result=gf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Mm(e,t){const n=new Zl(t);if(n.push(e,!0),n.err)throw n.msg||Ha[n.err];return n.result}function CX(e,t){return t=t||{},t.raw=!0,Mm(e,t)}function SX(e,t){return t=t||{},t.gzip=!0,Mm(e,t)}var xX=Zl,kX=Mm,TX=CX,EX=SX,OX=is,AX={Deflate:xX,deflate:kX,deflateRaw:TX,gzip:EX,constants:OX};const Ou=16209,PX=16191;var IX=function(t,n){let r,i,l,g,o,a,u,d,c,f,s,h,v,m,y,b,_,w,S,x,k,E,I,D;const N=t.state;r=t.next_in,I=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,g=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,d=N.whave,c=N.wnext,f=N.window,s=N.hold,h=N.bits,v=N.lencode,m=N.distcode,y=(1<>>24,s>>>=w,h-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(h>>=w,h-=w),h<15&&(s+=I[r++]<>>24,s>>>=w,h-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,ha){t.msg="invalid distance too far back",N.mode=Ou;break e}if(s>>>=w,h-=w,w=l-g,x>w){if(w=x-w,w>d&&N.sane){t.msg="invalid distance too far back",N.mode=Ou;break e}if(k=0,E=f,c===0){if(k+=u-w,w2;)D[l++]=E[k++],D[l++]=E[k++],D[l++]=E[k++],S-=3;S&&(D[l++]=E[k++],S>1&&(D[l++]=E[k++]))}else{k=l-x;do D[l++]=D[k++],D[l++]=D[k++],D[l++]=D[k++],S-=3;while(S>2);S&&(D[l++]=D[k++],S>1&&(D[l++]=D[k++]))}}else if((w&64)===0){_=m[(_&65535)+(s&(1<>3,r-=S,h-=S<<3,s&=(1<{const a=o.bits;let u=0,d=0,c=0,f=0,s=0,h=0,v=0,m=0,y=0,b=0,_,w,S,x,k,E=null,I;const D=new Uint16Array(go+1),N=new Uint16Array(go+1);let L=null,B,O,V;for(u=0;u<=go;u++)D[u]=0;for(d=0;d=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===yy||f!==1))return-1;for(N[1]=0,u=1;ugy||e===by&&y>vy)return 1;for(;;){B=u-v,g[d]+1=I?(O=L[g[d]-I],V=E[g[d]-I]):(O=32+64,V=0),_=1<>v)+w]=B<<24|O<<16|V|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,d++,--D[u]===0){if(u===f)break;u=t[n+g[d]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),k+=c,h=u-v,m=1<gy||e===by&&y>vy)return 1;S=b&x,i[S]=s<<24|h<<16|k-l|0}}return b!==0&&(i[k+b]=u-v<<24|64<<16|0),o.bits=s,0};var Us=$X;const BX=0,aC=1,oC=2,{Z_FINISH:_y,Z_BLOCK:FX,Z_TREES:Au,Z_OK:Ya,Z_STREAM_END:zX,Z_NEED_DICT:NX,Z_STREAM_ERROR:sr,Z_DATA_ERROR:sC,Z_MEM_ERROR:lC,Z_BUF_ERROR:jX,Z_DEFLATED:wy}=is,vf=16180,Cy=16181,Sy=16182,xy=16183,ky=16184,Ty=16185,Ey=16186,Oy=16187,Ay=16188,Py=16189,Dc=16190,Xr=16191,md=16192,Iy=16193,gd=16194,My=16195,Ly=16196,Ry=16197,Dy=16198,Pu=16199,Iu=16200,$y=16201,By=16202,Fy=16203,zy=16204,Ny=16205,vd=16206,jy=16207,Vy=16208,Ft=16209,uC=16210,cC=16211,VX=852,UX=592,HX=15,WX=HX,Uy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function YX(){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 ro=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modecC?1:0},fC=e=>{if(ro(e))return sr;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=vf,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(VX),t.distcode=t.distdyn=new Int32Array(UX),t.sane=1,t.back=-1,Ya},dC=e=>{if(ro(e))return sr;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,fC(e)},hC=(e,t)=>{let n;if(ro(e))return sr;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?sr:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,dC(e))},pC=(e,t)=>{if(!e)return sr;const n=new YX;e.state=n,n.strm=e,n.window=null,n.mode=vf;const r=hC(e,t);return r!==Ya&&(e.state=null),r},XX=e=>pC(e,WX);let Hy=!0,yd,bd;const KX=e=>{if(Hy){yd=new Int32Array(512),bd=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(Us(aC,e.lens,0,288,yd,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Us(oC,e.lens,0,32,bd,0,e.work,{bits:5}),Hy=!1}e.lencode=yd,e.lenbits=9,e.distcode=bd,e.distbits=5},mC=(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,g,o,a,u,d,c,f,s,h,v,m=0,y,b,_,w,S,x,k,E;const I=new Uint8Array(4);let D,N;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ro(e)||!e.output||!e.input&&e.avail_in!==0)return sr;n=e.state,n.mode===Xr&&(n.mode=md),g=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,d=n.bits,c=o,f=a,E=Ya;e:for(;;)switch(n.mode){case vf:if(n.wrap===0){n.mode=md;break}for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=tn(n.check,I,2,0),u=0,d=0,n.mode=Cy;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Ft;break}if((u&15)!==wy){e.msg="unknown compression method",n.mode=Ft;break}if(u>>>=4,d-=4,k=(u&15)+8,n.wbits===0&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=Ft;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(I[0]=u&255,I[1]=u>>>8&255,n.check=tn(n.check,I,2,0)),u=0,d=0,n.mode=Sy;case Sy:for(;d<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,I[2]=u>>>16&255,I[3]=u>>>24&255,n.check=tn(n.check,I,4,0)),u=0,d=0,n.mode=xy;case xy:for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(I[0]=u&255,I[1]=u>>>8&255,n.check=tn(n.check,I,2,0)),u=0,d=0,n.mode=ky;case ky:if(n.flags&1024){for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=tn(n.check,I,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=Ty;case Ty:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(k=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),k)),n.flags&512&&n.wrap&4&&(n.check=tn(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Ey;case Ey:if(n.flags&2048){if(o===0)break e;s=0;do k=r[l+s++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k));while(k&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Xr;break;case Py:for(;d<32;){if(o===0)break e;o--,u+=r[l++]<>>=d&7,d-=d&7,n.mode=vd;break}for(;d<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,d-=1,u&3){case 0:n.mode=Iy;break;case 1:if(KX(n),n.mode=Pu,t===Au){u>>>=2,d-=2;break e}break;case 2:n.mode=Ly;break;case 3:e.msg="invalid block type",n.mode=Ft}u>>>=2,d-=2;break;case Iy:for(u>>>=d&7,d-=d&7;d<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Ft;break}if(n.length=u&65535,u=0,d=0,n.mode=gd,t===Au)break e;case gd:n.mode=My;case My: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),g),o-=s,l+=s,a-=s,g+=s,n.length-=s;break}n.mode=Xr;break;case Ly:for(;d<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,d-=5,n.ndist=(u&31)+1,u>>>=5,d-=5,n.ncode=(u&15)+4,u>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Ft;break}n.have=0,n.mode=Ry;case Ry:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},E=Us(BX,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,E){e.msg="invalid code lengths set",n.mode=Ft;break}n.have=0,n.mode=Dy;case Dy:for(;n.have>>24,b=m>>>16&255,_=m&65535,!(y<=d);){if(o===0)break e;o--,u+=r[l++]<>>=y,d-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;d>>=y,d-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=Ft;break}k=n.lens[n.have-1],s=3+(u&3),u>>>=2,d-=2}else if(_===17){for(N=y+3;d>>=y,d-=y,k=0,s=3+(u&7),u>>>=3,d-=3}else{for(N=y+7;d>>=y,d-=y,k=0,s=11+(u&127),u>>>=7,d-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Ft;break}for(;s--;)n.lens[n.have++]=k}}if(n.mode===Ft)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Ft;break}if(n.lenbits=9,D={bits:n.lenbits},E=Us(aC,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,E){e.msg="invalid literal/lengths set",n.mode=Ft;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},E=Us(oC,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,E){e.msg="invalid distances set",n.mode=Ft;break}if(n.mode=Pu,t===Au)break e;case Pu:n.mode=Iu;case Iu:if(o>=6&&a>=258){e.next_out=g,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=d,IX(e,f),g=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,d=n.bits,n.mode===Xr&&(n.back=-1);break}for(n.back=0;m=n.lencode[u&(1<>>24,b=m>>>16&255,_=m&65535,!(y<=d);){if(o===0)break e;o--,u+=r[l++]<>w)],y=m>>>24,b=m>>>16&255,_=m&65535,!(w+y<=d);){if(o===0)break e;o--,u+=r[l++]<>>=w,d-=w,n.back+=w}if(u>>>=y,d-=y,n.back+=y,n.length=_,b===0){n.mode=Ny;break}if(b&32){n.back=-1,n.mode=Xr;break}if(b&64){e.msg="invalid literal/length code",n.mode=Ft;break}n.extra=b&15,n.mode=$y;case $y:if(n.extra){for(N=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=By;case By:for(;m=n.distcode[u&(1<>>24,b=m>>>16&255,_=m&65535,!(y<=d);){if(o===0)break e;o--,u+=r[l++]<>w)],y=m>>>24,b=m>>>16&255,_=m&65535,!(w+y<=d);){if(o===0)break e;o--,u+=r[l++]<>>=w,d-=w,n.back+=w}if(u>>>=y,d-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=Ft;break}n.offset=_,n.extra=b&15,n.mode=Fy;case Fy:if(n.extra){for(N=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Ft;break}n.mode=zy;case zy: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=Ft;break}s>n.wnext?(s-=n.wnext,h=n.wsize-s):h=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,h=g-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[g++]=v[h++];while(--s);n.length===0&&(n.mode=Iu);break;case Ny:if(a===0)break e;i[g++]=n.length,a--,n.mode=Iu;break;case vd:if(n.wrap){for(;d<32;){if(o===0)break e;o--,u|=r[l++]<{if(ro(e))return sr;let t=e.state;return t.window&&(t.window=null),e.state=null,Ya},ZX=(e,t)=>{if(ro(e))return sr;const n=e.state;return(n.wrap&2)===0?sr:(n.head=t,t.done=!1,Ya)},JX=(e,t)=>{const n=t.length;let r,i,l;return ro(e)||(r=e.state,r.wrap!==0&&r.mode!==Dc)?sr:r.mode===Dc&&(i=1,i=kl(i,t,n,0),i!==r.check)?sC:(l=mC(e,t,n,n),l?(r.mode=uC,lC):(r.havedict=1,Ya))};var QX=dC,eK=hC,tK=fC,nK=XX,rK=pC,iK=GX,aK=qX,oK=ZX,sK=JX,lK="pako inflate (from Nodeca project)",ei={inflateReset:QX,inflateReset2:eK,inflateResetKeep:tK,inflateInit:nK,inflateInit2:rK,inflate:iK,inflateEnd:aK,inflateGetHeader:oK,inflateSetDictionary:sK,inflateInfo:lK};function uK(){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 cK=uK;const gC=Object.prototype.toString,{Z_NO_FLUSH:fK,Z_FINISH:dK,Z_OK:Ol,Z_STREAM_END:_d,Z_NEED_DICT:wd,Z_STREAM_ERROR:hK,Z_DATA_ERROR:Wy,Z_MEM_ERROR:pK}=is;function Jl(e){this.options=gf.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 rC,this.strm.avail_out=0;let n=ei.inflateInit2(this.strm,t.windowBits);if(n!==Ol)throw new Error(Ha[n]);if(this.header=new cK,ei.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=El.string2buf(t.dictionary):gC.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ei.inflateSetDictionary(this.strm,t.dictionary),n!==Ol)))throw new Error(Ha[n])}Jl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,g,o;if(this.ended)return!1;for(t===~~t?g=t:g=t===!0?dK:fK,gC.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=ei.inflate(n,g),l===wd&&i&&(l=ei.inflateSetDictionary(n,i),l===Ol?l=ei.inflate(n,g):l===Wy&&(l=wd));n.avail_in>0&&l===_d&&n.state.wrap>0&&e[n.next_in]!==0;)ei.inflateReset(n),l=ei.inflate(n,g);switch(l){case hK:case Wy:case wd:case pK:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===_d))if(this.options.to==="string"){let a=El.utf8border(n.output,n.next_out),u=n.next_out-a,d=El.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(d)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===Ol&&o===0)){if(l===_d)return l=ei.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Jl.prototype.onData=function(e){this.chunks.push(e)};Jl.prototype.onEnd=function(e){e===Ol&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=gf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Lm(e,t){const n=new Jl(t);if(n.push(e),n.err)throw n.msg||Ha[n.err];return n.result}function mK(e,t){return t=t||{},t.raw=!0,Lm(e,t)}var gK=Jl,vK=Lm,yK=mK,bK=Lm,_K=is,wK={Inflate:gK,inflate:vK,inflateRaw:yK,ungzip:bK,constants:_K};const{Deflate:Bq,deflate:Fq,deflateRaw:CK,gzip:zq}=AX,{Inflate:Nq,inflate:jq,inflateRaw:SK,ungzip:Vq}=wK;var xK=CK,kK=SK;function Yy(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 TK=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=Yy(t);if(console.log("URL params:",n),n.get("share")){const l=kK(new Uint8Array(atob(n.get("share")).split("").map(g=>g.charCodeAt(0))),{to:"string"});if(!l){Wt().raiseError("Error when trying to decode share parameter!",!1);return}n=Yy(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),fps:Number(n.get("fps")||16),scheduler:n.get("scheduler")||"default"};nn().generateText2Img(r,!1)},EK=10,OK=!1;function tc(e,t,n,r,i=l=>Wt().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(g=>`${g[0]} - ${g[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}function Li(e,t){const n=e.trim().replace(/\/+$/,""),r=t.startsWith("/")?t:`/${t}`;return n.length===0?r:`${n}${r}`}const AK=Xo("interrogate",()=>{const e=ae({}),t=ae(!1);async function n(g){Wt().raiseError(g,!1),t.value=!1,e.value={}}async function r(){const g=At(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(Li(g.baseURL,"/sdapi/v1/interrogate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!tc(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}}),Rm=e=>(hi("data-v-db184ac6"),e=e(),pi(),e),PK={key:0,style:{"margin-top":"16px"}},IK=Rm(()=>ne("div",null,[Ue("Drop file here OR "),ne("em",null,"click to upload")],-1)),MK={key:1,style:{"margin-top":"16px"}},LK={key:2},RK={style:{"margin-top":"8px"}},DK=Rm(()=>ne("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),$K={key:0},BK=Rm(()=>ne("h3",null,"Caption",-1)),FK={key:0},zK={key:1},NK=Ee({__name:"InterrogationView",setup(e){const t=AK(),n=nn(),r=Wt(),i=ae();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 d=await Mc(u.raw);t.currentInterrogation.source_image=d,t.interrogateImage()}function g(){n.generateText2Img({prompt:o.value})}const o=ee(()=>t.getFormStatus()),{ellipsis:a}=D2();return(u,d)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(z(),oe("div",LK,[ne("div",RK,[le(C(at),{icon:C(Ug),onClick:C(t).resetInterrogation},{default:he(()=>[Ue("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(z(),be(C(at),{key:0,icon:C(Ug),onClick:g,disabled:!C(o)},{default:he(()=>[Ue("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):ye("",!0)]),DK,le(C(lf),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(z(),oe("div",$K,[BK,C(o)?(z(),oe("div",zK,[ne("strong",null,Oe(C(o)),1)])):(z(),oe("div",FK,"Processing"+Oe(C(a)),1))])):ye("",!0)])):(z(),oe("div",MK,[ne("strong",null,"Uploading image"+Oe(C(a)),1)])):(z(),oe("div",PK,[ne("div",null,[le(C(nm),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:he(()=>[le(C(Le),{size:100},{default:he(()=>[le(C(Cp))]),_:1}),IK]),_:1},512)])]))}});const jK=Jt(NK,[["__scopeId","data-v-db184ac6"]]);function VK(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),g=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"):"",d=g>0?g+(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(d),c.join(" ")}const UK={class:"form"},HK={key:0,style:{"padding-bottom":"50px"}},WK=ne("h1",{style:{margin:"0"}},"Interrogation",-1),YK=ne("div",null,"Interrogate images to get their predicted descriptions.",-1),XK={class:"sidebar"},KK={class:"reference-images-header"},GK=ne("span",{class:"reference-images-label"},"Reference Images",-1),qK={class:"reference-images-actions"},ZK={key:0,class:"reference-image-list"},JK={class:"reference-image-index"},QK=["title"],eG={class:"reference-image-controls"},tG={key:1,class:"reference-image-empty"},nG={class:"main"},rG={class:"image center-horizontal"},iG={key:0},aG=Ee({__name:"GenerateView",setup(e){const n=Bp($p).smallerOrEqual("md"),r=nn(),i=Wt(),l=Ns();At();const g=Ev(async()=>{const _=r.cacheVersion,S=(await r.getAvailableSamplers()).map(x=>x.name);return S.length===0?[]:u(S)},[]),o=Ev(async()=>{const _=r.cacheVersion,S=(await r.getAvailableSchedulers()).map(x=>x.name);return S.length===0?[]:d(S)},[]),a=bt({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function u(_){return!r.params||!r.params.sampler_name||_.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=_[0]),_}function d(_){return!r.params||!r.params.scheduler||_.indexOf(r.params.scheduler)===-1&&(r.params.scheduler=_[0]),_}function c(_){return"Elapsed: "+VK(_,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function f(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function s(_){r.generatorType=_,f(),console.log(_)}function h(){l.showCropPreview=!0,l.updateCropPreview()}function v(){var _;(_=document.getElementById("extra_image_input"))==null||_.click()}function m(_){var w;return(w=_.dataUrl)==null?void 0:w.startsWith("data:image")}function y(){return r.referenceImages.filter(m).map(_=>_.dataUrl)}function b(_){return r.referenceImages.slice(0,_).filter(m).length}return f(),TK(),(_,w)=>(z(),oe(Ne,null,[le(C(Tw),{"default-active":C(r).generatorType,collapse:!0,onSelect:s,mode:C(n)?"horizontal":"vertical",class:de(C(n)?"mobile-generator-types":"generator-types"),style:ze(C(n)?"overflow-x: auto":"")},{default:he(()=>[le(Tu,{index:"Text2Img","icon-one":C(VE),"icon-two":C(lu),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(Tu,{index:"Img2Img","icon-one":C(lu),"icon-two":C(lu),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(Tu,{index:"Inpainting","icon-one":R2,"icon-two":C(lu),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(Tu,{index:"Interrogation","icon-one":FH,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),ne("div",UK,[C(r).generatorType==="Interrogation"?(z(),oe("div",HK,[WK,YK,le(jK)])):(z(),be(C(Zp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:a,onSubmit:w[32]||(w[32]=et(()=>{},["prevent"]))},{default:he(()=>[ne("div",XK,[le(lW),le($h,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":w[0]||(w[0]=S=>C(r).negativePrompt=S),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($h,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":w[2]||(w[2]=S=>C(r).params.seed=S),placeholder:"Enter seed here",clearable:"","clear-icon":C(IE)},{append:he(()=>[le(C(Wn),{content:"Randomize!",placement:"top"},{default:he(()=>[le(C(at),{icon:C(lO),onClick:w[1]||(w[1]=()=>C(r).params.seed=C(vC)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue","clear-icon"]),(z(),be(C(P0),{key:0,gutter:10},{default:he(()=>[C(r).multiSelect.sampler.state==="Multiple"?(z(),be(C(co),{key:0,span:C(n)?24:12},{default:he(()=>[le(Co,{label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":w[3]||(w[3]=S=>C(r).multiSelect.sampler.selected=S),options:C(g),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])]),_:1},8,["span"])):ye("",!0),C(r).multiSelect.sampler.state==="Enabled"?(z(),be(C(co),{key:1,span:C(n)?24:12},{default:he(()=>[le(Co,{label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":w[4]||(w[4]=S=>C(r).params.sampler_name=S),options:C(g),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])]),_:1},8,["span"])):ye("",!0),C(r).multiSelect.scheduler.state==="Multiple"?(z(),be(C(co),{key:2,span:C(n)?24:12},{default:he(()=>[le(Co,{label:"Scheduler(s)",prop:"schedulers",modelValue:C(r).multiSelect.scheduler.selected,"onUpdate:modelValue":w[5]||(w[5]=S=>C(r).multiSelect.scheduler.selected=S),options:C(o),info:"Multi-select enabled. Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise.",multiple:""},null,8,["modelValue","options"])]),_:1},8,["span"])):ye("",!0),C(r).multiSelect.scheduler.state==="Enabled"?(z(),be(C(co),{key:3,span:C(n)?24:12},{default:he(()=>[le(Co,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":w[6]||(w[6]=S=>C(r).params.scheduler=S),options:C(o),info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue","options"])]),_:1},8,["span"])):ye("",!0)]),_:1})),le(kn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":w[7]||(w[7]=S=>C(r).params.n=S),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.state==="Multiple"?(z(),be(kn,{key:1,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":w[8]||(w[8]=S=>C(r).multiSelect.steps.selected=S),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"])):C(r).multiSelect.steps.state==="Enabled"?(z(),be(kn,{key:2,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":w[9]||(w[9]=S=>C(r).params.steps=S),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"])):ye("",!0),le(kn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":w[10]||(w[10]=S=>C(r).params.width=S),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:h},null,8,["modelValue","min","max"]),le(kn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":w[11]||(w[11]=S=>C(r).params.height=S),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:h},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.state==="Multiple"?(z(),be(kn,{key:3,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":w[12]||(w[12]=S=>C(r).multiSelect.guidance.selected=S),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"])):C(r).multiSelect.guidance.state==="Enabled"?(z(),be(kn,{key:4,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":w[13]||(w[13]=S=>C(r).params.cfg_scale=S),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"])):ye("",!0),C(r).multiSelect.eta.state==="Enabled"?(z(),be(kn,{key:5,label:"Eta",prop:"eta",modelValue:C(r).params.eta,"onUpdate:modelValue":w[14]||(w[14]=S=>C(r).params.eta=S),min:C(r).minEta,max:C(r).maxEta,step:.1,info:"Noise multiplier for ancestral samplers. 0 disables noise injection."},null,8,["modelValue","min","max","step"])):ye("",!0),C(r).multiSelect.clipSkip.state==="Multiple"?(z(),be(kn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":w[15]||(w[15]=S=>C(r).multiSelect.clipSkip.selected=S),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"])):C(r).multiSelect.clipSkip.state==="Enabled"?(z(),be(kn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":w[16]||(w[16]=S=>C(r).params.clip_skip=S),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"])):ye("",!0),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(z(),be(kn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":w[17]||(w[17]=S=>C(r).params.denoising_strength=S),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values. 0=unchanged, 1=fullychanged"},null,8,["modelValue","min","max","step"])):ye("",!0),le(kn,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":w[18]||(w[18]=S=>C(r).params.frames=S),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). More frames increases memory usage."},null,8,["modelValue","min","max"]),C(r).params.frames>1?(z(),be(kn,{key:9,label:"FPS",prop:"fps",modelValue:C(r).params.fps,"onUpdate:modelValue":w[19]||(w[19]=S=>C(r).params.fps=S),min:C(r).minFps,max:C(r).maxFps,disabled:C(r).params.frames<=1,info:"Frames per second for video generation."},null,8,["modelValue","min","max","disabled"])):ye("",!0),ne("div",{class:"reference-images",onDragover:w[22]||(w[22]=et(()=>{},["prevent"])),onDrop:w[23]||(w[23]=et(S=>C(r).setExtraImage(S),["prevent"]))},[ne("div",KK,[GK,ne("div",qK,[ne("input",{class:"reference-images-input",type:"file",id:"extra_image_input",onChange:w[20]||(w[20]=S=>C(r).setExtraImage(S)),accept:"image/*",multiple:""},null,32),le(C(at),{onClick:v},{default:he(()=>[Ue(" Select or Drag Files ")]),_:1}),le(C(at),{onClick:w[21]||(w[21]=S=>C(r).clearExtraImage()),disabled:C(r).referenceImages.length===0},{default:he(()=>[Ue(" Clear Images ")]),_:1},8,["disabled"])])]),C(r).referenceImages.length>0?(z(),oe("div",ZK,[(z(!0),oe(Ne,null,Nt(C(r).referenceImages,(S,x)=>(z(),oe("div",{class:de(["reference-image-item",{"reference-file-item":!m(S)}]),key:S.id},[ne("span",JK,Oe(x+1),1),m(S)?(z(),be(C(lf),{key:0,class:"reference-image-thumb",src:S.dataUrl,fit:"cover","preview-src-list":y(),"initial-index":b(x),"preview-teleported":""},null,8,["src","preview-src-list","initial-index"])):ye("",!0),ne("span",{class:"reference-image-name",title:S.name},Oe(S.name),9,QK),ne("div",eG,[le(C(Wn),{content:"Move up",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",icon:C(C_),disabled:x===0,onClick:k=>C(r).moveExtraImage(x,-1)},null,8,["icon","disabled","onClick"])]),_:2},1024),le(C(Wn),{content:"Move down",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",icon:C(Ml),disabled:x===C(r).referenceImages.length-1,onClick:k=>C(r).moveExtraImage(x,1)},null,8,["icon","disabled","onClick"])]),_:2},1024),le(C(Wn),{content:"Remove",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",type:"danger",icon:C(Dl),plain:"",onClick:k=>C(r).removeExtraImage(x)},null,8,["icon","onClick"])]),_:2},1024)])],2))),128))])):(z(),oe("div",tG," No reference images selected. "))],32),le(C(P0),null,{default:he(()=>[le(C(co),{span:C(n)?24:12},{default:he(()=>[le(od,{label:"ESRGAN Upscale",prop:"enable_hr",modelValue:C(r).params.enable_hr,"onUpdate:modelValue":w[24]||(w[24]=S=>C(r).params.enable_hr=S),info:"Enable upscale with ESRGAN."},null,8,["modelValue"])]),_:1},8,["span"]),le(C(co),{span:C(n)?24:12},{default:he(()=>[C(r).generatorType==="Img2Img"?(z(),be(od,{key:0,label:"Send as RefImg",prop:"send_as_refimg",modelValue:C(r).params.send_as_refimg,"onUpdate:modelValue":w[25]||(w[25]=S=>C(r).params.send_as_refimg=S),info:"Instead of regular Img2Img, send the image as a reference image for edit models."},null,8,["modelValue"])):ye("",!0),C(r).generatorType==="Img2Img"&&C(r).params.send_as_refimg&&C(r).params.frames>1?(z(),be(od,{key:1,label:"Reverse RefImg",prop:"reverse_refimg",modelValue:C(r).params.reverse_refimg,"onUpdate:modelValue":w[26]||(w[26]=S=>C(r).params.reverse_refimg=S),info:"Use the reference image as the final frame instead of the first frame."},null,8,["modelValue"])):ye("",!0)]),_:1},8,["span"])]),_:1})]),ne("div",nG,[le(C(at),{onClick:w[27]||(w[27]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:he(()=>[Ue("Reset")]),_:1}),le(C(at),{type:"primary",class:"generate-cancel-btn",style:ze(C(r).generating?"width: 55%;":""),onClick:w[28]||(w[28]=()=>C(r).generateImage(C(r).generatorType))},{default:he(()=>[ne("span",null," Generate "+Oe(C(r).totalImageCount)+" image"+Oe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(z(),be(C(at),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:w[29]||(w[29]=()=>{var S;(S=C(r).abortController)==null||S.abort(),C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue(),C(r).clearLastImageGenkey(),C(r).stopProgressPolling()})},{default:he(()=>[Ue("Cancel all")]),_:1},8,["disabled"])):ye("",!0)]),ne("div",rG,[le(C(I$),{class:"center-both generated-image"},{default:he(()=>{var S,x,k,E,I;return[!C(r).generating&&C(r).outputs.length==0?(z(),oe("div",iG,[/Inpainting/.test(C(r).generatorType)?(z(),be(ay,{key:0})):ye("",!0),/Img2Img/.test(C(r).generatorType)?(z(),be(ay,{key:1})):ye("",!0)])):ye("",!0),!C(i).showGeneratedImages&&C(r).generating?(z(),be(JH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:c(C(r).timer.seconds),"progress-percentage":(S=C(r).progressInfo)==null?void 0:S.percentage,"text-info":(x=C(r).progressInfo)==null?void 0:x.textInfo,"current-step":(k=C(r).progressInfo)==null?void 0:k.currentStep,"total-steps":(E=C(r).progressInfo)==null?void 0:E.totalSteps,"preview-image":(I=C(r).progressInfo)==null?void 0:I.previewImage,generating:C(r).generating,onShowGenerated:w[30]||(w[30]=D=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed","progress-percentage","text-info","current-step","total-steps","preview-image","generating"])):ye("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(z(),be(yW,{key:2})):ye("",!0)]}),_:1}),C(r).lastImageRecoveryAvailable?(z(),be(C(vN),{key:0,class:"last-image-recovery",href:C(r).lastImageRecoveryUrl,target:"_blank",type:"primary",onClick:w[31]||(w[31]=et(S=>C(r).openLastImageRecovery(),["prevent"]))},{default:he(()=>[Ue(" Recover last generated image ")]),_:1},8,["href"])):ye("",!0)])]),_:1},8,["model","rules"]))])],64))}});const Hs=xT({history:jk("./"),routes:[{path:"/",name:"generate",component:aG},{path:"/images",name:"images",component:()=>ad(()=>Promise.resolve().then(()=>fq),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>ad(()=>Promise.resolve().then(()=>xq),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>ad(()=>Promise.resolve().then(()=>Lq),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function oG(e){const t=[],n=/]+):([^>]+)>/g;return[e.replace(n,(i,l,g)=>{if(g.trim()==="")return"";const o=Number(g);if(isNaN(o))return"";let a=l,u=!1;const d="|high_noise|";return a.startsWith(d)&&(a=a.substring(d.length),u=!0),t.push({name:a,multiplier:o,...u?{is_high_noise:!0}:{}}),""}),t]}function Mu(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,eta:1,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,fps:16,enable_hr:!1,send_as_refimg:!0,reverse_refimg:!1,scheduler:"default"}}function vC(){return Math.floor(Math.random()*9999999)+1}function sG(){return Math.floor(Math.random()*9e5+1e5).toString()}const nn=Xo("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=ae("Text2Img"),r=ae(""),i=ln("promptHistory",[]),l=ae(""),g=ln("negativeLibrary",[]),o=ae(Mu()),a=ae({interval:0,seconds:0}),u=ae(null),d=ae(0),c=ae({sampler:{name:"Sampler",state:"Enabled",allowedStates:["Disabled","Enabled","Multiple"],selected:[o.value.sampler_name],mapToParam:Ce=>Ce.sampler_name},scheduler:{name:"Scheduler",state:"Enabled",allowedStates:["Disabled","Enabled","Multiple"],selected:[o.value.scheduler],mapToParam:Ce=>Ce.scheduler},steps:{name:"Steps",state:"Enabled",allowedStates:["Disabled","Enabled","Multiple"],selected:[o.value.steps],mapToParam:Ce=>Ce.steps},guidance:{name:"CFG Scale",state:"Enabled",allowedStates:["Disabled","Enabled","Multiple"],selected:[o.value.cfg_scale],mapToParam:Ce=>Ce.cfg_scale},clipSkip:{name:"Clip Skip",state:"Disabled",allowedStates:["Disabled","Enabled","Multiple"],selected:[o.value.clip_skip],mapToParam:Ce=>Ce.clip_skip},eta:{name:"Eta",state:"Disabled",allowedStates:["Disabled","Enabled"],selected:[o.value.eta],mapToParam:Ce=>Ce.eta}}),f=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),s=ae({...f(),sourceProcessing:"inpainting"}),h=ae({...f(),sourceProcessing:"img2img"}),v=Ce=>Ce==="Inpainting"?s.value:Ce==="Img2Img"?h.value:f(),m=ee(()=>v(n.value)),y=ae(""),b=ae(!1),_=ae(!1),w=ae([]),S=ae(null),x=ae([]),k=ln("lastImageGenkey",""),E=ee(()=>k.value?Li(At().baseURL,`/sdapi/v1/get_last.png?genkey=${encodeURIComponent(k.value)}`):""),I=ee(()=>E.value!==""&&!b.value);function D(){k.value=""}function N(){!E.value||(window.open(E.value,"_blank","noopener"),D())}const L=ae(64),B=ee(()=>At().allowLargerParams==="Enabled"?3072:1024),O=ae(1),V=ae(20),re=ae(1),J=ee(()=>At().allowLargerParams==="Enabled"?150:50),ue=ae(1),M=ae(24),H=ae(0),R=ae(1),P=ae(0),Q=ae(1),j=ae(0),A=ae(10),q=ae(1),G=ee(()=>At().allowLargerParams==="Enabled"?400:200),te=ae(16),ce=ee(()=>At().allowLargerParams==="Enabled"?32:24),pe=(Ce,Ve,je)=>Array.from({length:(Ve-Ce+1)/je},(tt,ht)=>(ht+Ce)*je),ve=ae(pe(j.value,A.value,1)),U=ae(pe(ue.value,M.value,.5)),X=ee(()=>{const Ce=(zn,hn,Ci=1)=>zn*(hn.state==="Multiple"&&hn.selected.length>0?hn.selected.length:Ci),je=o.value.n*we().length,tt=Ce(je,c.value.sampler),ht=Ce(tt,c.value.scheduler),Qe=Ce(ht,c.value.steps),jt=Ce(Qe,c.value.guidance);return Ce(jt,c.value.clipSkip)});function T(){return o.value=Mu(),s.value=f(),h.value=f(),w.value=[],Wt().showGeneratedImages=!1,Y(),D(),!0}function Y(){x.value=[]}function W(){w.value=[]}async function $(){const Ce=At(),Ve=await fetch(Li(Ce.baseURL,"/sdapi/v1/loras")),je=await Ve.json();return tc(Ve,je,200,"Failed to get available LoRAs")?je:[]}async function F(Ce){var zm;if(!e.includes(Ce))return[];if(r.value==="")return fe("Failed to generate: No prompt submitted.");const Ve=Ns(),je=Wt();Ve.saveImages();const{sourceImage:tt,maskImage:ht,sourceProcessing:Qe}=v(Ce);sn(r.value);const jt=[],zn=we().map(Je=>{const Ht=Je.split(" ### ");return{full_prompt:Je,prompt:Ht[0],negative_prompt:Ht[1]||""}}).map(Je=>{const[Ht,Ur]=oG(Je.prompt);return{...Je,prompt:Ht,extractedLoras:Ur}}),hn=zn.some(Je=>Je.extractedLoras.length>0)?await $():[],Ci=zn.map(({extractedLoras:Je,...Ht})=>{const Ur=Je.length>0&&hn.length>0?Je.map(ur=>{const oa=hn.find(sa=>sa.name===ur.name||sa.path===ur.name);return{path:oa?oa.path:ur.name,multiplier:ur.multiplier,...ur.is_high_noise?{is_high_noise:!0}:{}}}):[];return{...Ht,...Ur.length>0?{lora:Ur}:{}}}),{seed:Pn,cfg_scale:Cn,eta:$m,steps:Vr,clip_skip:AC,sampler_name:PC,scheduler:IC,n:MC,...eu}=o.value,Cf=parseInt(Pn.toString()),LC=isNaN(Cf)||Cf<0?vC():Cf,RC=Array.from({length:MC},(Je,Ht)=>LC+Ht),oo=(Je,Ht)=>Je.state==="Disabled"?[]:Je.state==="Enabled"?[Ht]:Je.state==="Multiple"&&Je.selected.length===0?[]:Je.selected,DC={promptVariant:Ci,seed:RC,cfg_scale:oo(c.value.guidance,Cn),eta:oo(c.value.eta,$m),steps:oo(c.value.steps,Vr),clip_skip:oo(c.value.clipSkip,AC),sampler_name:oo(c.value.sampler,PC),scheduler:oo(c.value.scheduler,IC)},$C=(Je=>Object.entries(Je).filter(([Ur,ur])=>ur.length>0).reduce((Ur,[ur,oa])=>{const sa=[];for(const en of Ur)for(const tu of oa)sa.push({...en,[ur]:tu});return sa},[{}]))(DC),BC=[await Fe()];for(const Je of $C){const{promptVariant:{full_prompt:Ht,...Ur},...ur}=Je,oa=Ce==="Img2Img"?eu.send_as_refimg:!1,sa=oa&&eu.frames>1?eu.reverse_refimg:!1;let en={prompt:Ht,params:{...eu,send_as_refimg:oa,reverse_refimg:sa,...ur,...Ur,init_images:tt?[tt.split(",")[1]]:[],mask:ht,inpainting_mask_invert:ht?0:null,inpainting_fill:ht?1:null},source_image:tt==null?void 0:tt.split(",")[1],source_mask:ht,source_processing:Qe,models:BC};en.params.sampler_name=="default"&&delete en.params.sampler_name,en.params.scheduler=="default"&&delete en.params.scheduler,!en.params.frames||en.params.frames<=1?(delete en.params.frames,delete en.params.fps):en.params.fps=Math.min(ce.value,Math.max(te.value,Math.round(Number(en.params.fps)||Mu().fps)));const tu=Ut.value.map(FC=>FC.base64);tu.length>0&&(en.params.extra_images=tu),At().alsoRequestAvi==="Enabled"&&en.params.frames&&en.params.frames>1&&(en.params.video_output_type=2),At().keepImageGenOnDisconnect==="Enabled"&&(en.params.kcpp_extra_args={keep_image_gen_on_disconnect:!0}),jt.push(en)}let Bm=!1;b.value||(Bm=!0,w.value=[]),b.value=!0,je.showGeneratedImages=!1;let Fm=x.value.filter(Je=>!Je.gathered&&!Je.failed).length;for(let Je=0;Je{a.value.seconds++},1e3),OC();!x.value.every(Je=>Je.gathered||Je.failed)&&!_.value;){const Je=x.value.find(Ht=>!Ht.gathered&&!Ht.failed);if(!Je)break;Je.gathered=!0;try{const Ht=await Te(Je.params,(zm=S.value)==null?void 0:zm.signal);if(!Ht){Je.failed=!0;continue}K([{...Ht,...Je}])}catch(Ht){Je.failed=!0,console.error("Error fetching image:",Ht)}}x.value.some(Je=>Je.failed)&&x.value.every(Je=>Je.gathered||Je.failed)&&(b.value=!1,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0,wf(),x.value=[])}}async function K(Ce){const Ve=Ua();console.log(Ce);const je=await Promise.all(Ce.map(async Qe=>{const jt=Qe.images[0],zn=!!Qe.animated?"gif":"png",hn=Qe.extra_data?`data:video/avi;base64,${Qe.extra_data}`:"",Ci=Qe.final_frame?`data:image/jpeg;base64,${Qe.final_frame}`:"";let Pn={id:-1,image:`data:image/${zn};base64,${jt}`,prompt:Qe.prompt,modelName:Qe.models[0],frames:Qe.params.frames,fps:Qe.params.fps,extra_avi:hn,final_frame:Ci,enable_hr:Qe.params.enable_hr,send_as_refimg:Qe.params.send_as_refimg,reverse_refimg:Qe.params.reverse_refimg,lora_meta:""};if(Qe.info&&typeof Qe.info=="string"&&Qe.info.trim()!=="")try{const Cn=JSON.parse(Qe.info);["seed","steps","sampler_name","cfg_scale","eta","width","height","clip_skip","fps"].forEach(Vr=>{Cn[Vr]!=null&&Cn[Vr]!=null?Pn[Vr]=Cn[Vr]:Qe.params[Vr]!=null&&(Pn[Vr]=Qe.params[Vr])}),Cn.extra_generation_params&&Cn.extra_generation_params["Schedule type"]?Pn.scheduler=Cn.extra_generation_params["Schedule type"]:Pn.scheduler=Qe.params.scheduler,Cn.lora_meta&&(Pn.lora_meta=Cn.lora_meta)}catch(Cn){console.warn("Failed to parse info JSON:",Cn)}return Pn})),tt=await Ve.pushOutputs(je),ht=0;return w.value=[...tt.map(Qe=>({type:"image",index:ht,output:Qe})),...w.value].sort((Qe,jt)=>Qe.index-jt.index),w.value.length===x.value.length&&(x.value=[],b.value=!1,Wt().showGeneratedImages=!0,D(),clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0,wf()),je}async function fe(Ce){const Ve=Wt();return Ce&&Ve.raiseError(Ce,!1),[]}function ie(Ce,Ve,je,tt){return Ve<=je?Ve:(Wt().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${Ce}' to its default value instead of ${Ve}.`,!0),tt)}async function Z(Ce,Ve=!0){const je=Mu();if(n.value="Text2Img",c.value.guidance.state="Enabled",c.value.sampler.state="Enabled",c.value.steps.state="Enabled",c.value.clipSkip.state="Disabled",c.value.scheduler.state="Enabled",Hs.push("/"),Ve&&(Ce.width=Ce.width||je.width,Ce.height=Ce.height||je.height),Ce.prompt){const tt=Ce.prompt.split(" ### ");r.value=tt[0],l.value=tt[1]||""}if(Ce.sampler_name){o.value.sampler_name=Ce.sampler_name;const ht=(await mt()).find(Qe=>Qe.aliases&&Qe.aliases.includes(Ce.sampler_name));ht&&(o.value.sampler_name=ht.name)}Ce.steps&&(o.value.steps=ie("steps",Ce.steps,J.value,je.steps)),Ce.cfg_scale&&(o.value.cfg_scale=Ce.cfg_scale),(Ce.eta||Ce.eta===0)&&(o.value.eta=Ce.eta),Ce.width&&(o.value.width=ie("width",Ce.width,B.value,je.width)),Ce.height&&(o.value.height=ie("height",Ce.height,B.value,je.height)),Ce.seed&&(o.value.seed=Ce.seed),Ce.clip_skip&&(o.value.clip_skip=ie("clip_skip",Ce.clip_skip,A.value,je.clip_skip)),Ce.scheduler&&(o.value.scheduler=Ce.scheduler),Ce.frames&&(o.value.frames=ie("frames",Ce.frames,G.value,je.frames)),Ce.fps&&(o.value.fps=Math.min(ce.value,Math.max(te.value,Math.round(ie("fps",Ce.fps,ce.value,je.fps)))))}function me(Ce){const Ve=Ns();n.value="Img2Img",h.value.sourceImage=Ce,Ve.drawing=!1,w.value=[],Hs.push("/"),er.fabric.Image.fromURL(Ce,Ve.newImage)}function se(Ce){const Ve=Ns();w.value=[],s.value.sourceImage=Ce,n.value="Inpainting",Hs.push("/"),er.fabric.Image.fromURL(Ce,Ve.newImage)}function ge(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function we(){const Ce=ge(),Ve=Ce.match(/\{(.*?)\}/g)||[];if(Ve.length===0)return[Ce];let je=[];return Ve.forEach(tt=>{const ht=[],Qe=tt.replace("{","").replace("}","").split("|");je.length===0?Qe.forEach(jt=>{const Qt=Ce.replace(tt,jt);ht.push(Qt)}):je.forEach(jt=>{Qe.forEach(Qt=>{const zn=jt.replace(tt,Qt);ht.push(zn)})}),je=[...ht]}),je}async function Te(Ce,Ve){const je=At();try{const tt=sG();k.value=tt;const ht={...Ce,genkey:tt},Qe=await fetch(Li(je.baseURL,`/sdapi/v1/${Ce.init_images.length>0?"img":"txt"}2img`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ht),signal:Ve}),jt=await Qe.json();return tc(Qe,jt,200,"Failed to fetch",Ae)?jt:!1}catch{return!1}}function Ae(Ce){return Wt().raiseError(Ce,!1),_.value=!1,w.value=[],!1}async function Fe(){const Ce=At(),Ve=await fetch(Li(Ce.baseURL,"/sdapi/v1/sd-models")),je=await Ve.json();if(!!tc(Ve,je,200,"Failed to get available models"))return je.length===0?"(No model loaded)":je[0].model_name}const _e=ae(0),Se=new Map;function De(){Se.clear(),_e.value++}ke(()=>At().baseURL,()=>{De()});async function Me(Ce){const Ve=At(),je=Li(Ve.baseURL,Ce);if(Se.has(je))return Se.get(je);const tt=(async()=>{try{const ht=await fetch(je);if(ht.ok)return await ht.json();console.error(`API Error: ${ht.status} ${ht.statusText} at ${je}`)}catch(ht){console.error(`Fetch error for ${je}:`,ht)}return Se.delete(je),null})();return Se.set(je,tt),tt}async function mt(){const Ce=await Me("/sdapi/v1/samplers");return Array.isArray(Ce)?Ce:[]}async function _t(){const Ce=await Me("/sdapi/v1/schedulers");return Array.isArray(Ce)?Ce:[]}function pt(Ce){g.value.indexOf(Ce)===-1&&(g.value=[...g.value,Ce])}function on(Ce){g.value=g.value.filter(Ve=>Ve!=Ce)}function sn(Ce){if(i.value.findIndex(Ve=>Ve.prompt===Ce)===-1){if(i.value.length>=10+i.value.filter(Ve=>Ve.starred).length){const Ve=i.value.filter(tt=>!tt.starred),je=i.value.findIndex(tt=>tt===Ve[Ve.length-1]);i.value.splice(je,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:Ce}]}}function wi(Ce){i.value=i.value.filter(Ve=>Ve.prompt!=Ce&&Ve!=Ce)}function wn(){return!1}const Ut=ae([]);async function aa(Ce){var Qe,jt;const Ve=Ce.target,je=(jt=Ve.files)!=null?jt:(Qe=Ce.dataTransfer)==null?void 0:Qe.files,tt=Array.from(je!=null?je:[]);if(tt.length===0)return;const ht=await Promise.all(tt.map(async(Qt,zn)=>{const hn=await Mc(Qt);return{id:`${Date.now()}-${zn}-${Qt.name}`,name:Qt.name,size:Qt.size,dataUrl:hn,base64:hn.includes("data:image")?hn.split(",")[1]:hn}}));Ut.value||(Ut.value=[]);for(let Qt=0;Qt=Ut.value.length)return;const tt=[...Ut.value],[ht]=tt.splice(Ce,1);tt.splice(je,0,ht),Ut.value=tt}function kC(){Ut.value=[];const Ce=document.getElementById("extra_image_input");Ce&&(Ce.value="")}const bf=ae(""),_f=ae(-1);async function TC(){var Ve,je,tt,ht,Qe,jt,Qt,zn,hn;const Ce=At();try{const Ci=await fetch(Li(Ce.baseURL,`/sdapi/v1/progress?skip_current_image=true&genkey=${encodeURIComponent(k.value)}`));if(!Ci.ok)return;const Pn=await Ci.json();u.value={percentage:Math.round(((Ve=Pn.progress)!=null?Ve:0)*100),textInfo:Pn.textinfo||null,currentStep:(tt=(je=Pn.state)==null?void 0:je.sampling_step)!=null?tt:0,totalSteps:(Qe=(ht=Pn.state)==null?void 0:ht.sampling_steps)!=null?Qe:0,previewImage:(Qt=(jt=u.value)==null?void 0:jt.previewImage)!=null?Qt:null},bf.value!=k.value&&(bf.value=k.value,_f.value=-1);const Cn=(hn=(zn=Pn.state)==null?void 0:zn.sampling_step)!=null?hn:0;_f.value!=Cn&&(_f.value=Cn,Ce.fetchGenerationProgress==="Image"&&EC())}catch{}}async function EC(){const Ce=At();try{const Ve=await fetch(Li(Ce.baseURL,`/sdapi/v1/progress?genkey=${encodeURIComponent(k.value)}`));if(!Ve.ok)return;const je=await Ve.json();je.current_image&&u.value&&(u.value.previewImage=je.current_image)}catch{}}function OC(){bf.value="",!d.value&&At().fetchGenerationProgress!=="Off"&&(u.value={percentage:0,textInfo:null,currentStep:0,totalSteps:0,previewImage:null},d.value=setInterval(TC,1e3))}function wf(){d.value&&(clearInterval(d.value),d.value=0),u.value=null}return{generatorType:n,prompt:r,params:o,outputs:w,inpainting:s,img2img:h,uploadDimensions:y,cancelled:_,abortController:S,multiSelect:c,referenceImages:Ut,negativePrompt:l,generating:b,negativePromptLibrary:g,minDimensions:L,maxDimensions:B,minImages:O,maxImages:V,minSteps:re,maxSteps:J,minCfgScale:ue,maxCfgScale:M,minDenoise:P,maxDenoise:Q,minClipSkip:j,maxClipSkip:A,minFrames:q,maxFrames:G,minFps:te,maxFps:ce,minEta:H,maxEta:R,clipSkipList:ve,cfgList:U,queue:x,promptHistory:i,timer:a,progressInfo:u,progressInterval:d,lastImageGenkey:k,lastImageRecoveryUrl:E,lastImageRecoveryAvailable:I,clearLastImageGenkey:D,openLastImageRecovery:N,validGeneratorTypes:e,sourceGeneratorTypes:t,currentImageProps:m,totalImageCount:X,generateImage:F,generateText2Img:Z,generateImg2Img:me,generateInpainting:se,getPrompt:wn,resetStore:T,clearQueue:Y,clearOutputs:W,stopProgressPolling:wf,pushToNegativeLibrary:pt,removeFromNegativeLibrary:on,pushToPromptHistory:sn,removeFromPromptHistory:wi,setExtraImage:aa,removeExtraImage:ao,moveExtraImage:xC,clearExtraImage:kC,getAvailableSamplers:mt,getAvailableSchedulers:_t,cacheVersion:_e,invalidateApiCaches:De,getCachedEndpoint:Me}});"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}});var yf=e=>new DataView(new ArrayBuffer(e)),io=e=>new Uint8Array(e.buffer||e),So=e=>new TextEncoder().encode(String(e));function lG(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:So(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:io(e)};if(Symbol.asyncIterator in e)return{t,o:yC(e)};throw new TypeError("Unsupported input format.")}function yC(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=uG(i.value);n.enqueue(l),r+=l.byteLength}}}})}function uG(e){return typeof e=="string"?So(e):e instanceof Uint8Array?e:io(e)}function cG(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=So(t)),e instanceof File)return{i:t||So(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(),g=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||So(g),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:So(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 fG=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:dG,m:hG}=fG.exports,pG=io(hG).subarray(65536);function Xy(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))pG.set(n),t=dG(n.length,t);return t}function bC(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 mG(e){const t=yf(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),bC(e.t,t,10),t.setUint16(26,e.i.length,1),io(t)}async function*gG(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=Xy(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=Xy(r,e.u),e.A+=r.length,yield r}}}function vG(e){const t=yf(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),io(t)}function yG(e,t){const n=yf(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),bC(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),io(n)}function bG(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function _G(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(yC(async function*(r){const i=[];let l=0,g=0;for await(const u of r)yield mG(u),yield u.i,yield*gG(u),yield vG(u),i.push(yG(u,l)),i.push(u.i),g++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=yf(22);a.setUint32(0,1347093766),a.setUint16(8,g,1),a.setUint16(10,g,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield io(a)}(async function*(r){for await(const i of r){const[l,g]=bG(i);yield Object.assign(lG(...g),cG(...l))}}(e))),{headers:n})}async function _C(e,t=!0,n){const r=At();t&&Qi({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let o=0;o]/g,"").substring(0,128).trimEnd();let s=r.imageDownloadType;u.startsWith("data:image/gif")&&(s="GIF"),s==="PNG"?i.push({name:f+".png",input:await Ea(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await Ea(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await Ea(u,"image/gif")}):i.push({name:f+".webp",input:await Ea(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await _G(i).blob(),g=document.createElement("a");g.href=URL.createObjectURL(l),g.download="sdui_images.zip",g.click()}async function wC(e,t){const n=At(),r=document.createElement("a");let i,l=n.imageDownloadType;e.startsWith("data:image/gif")&&(l="GIF"),l==="PNG"?(i=await Ea(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):l==="JPG"?(i=await Ea(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):l==="GIF"?(i=await Ea(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)}function CC(e,t){const n=e;if(!n)return;const r=atob(n),i=r.length,l=new Uint8Array(i);for(let u=0;u{Fw.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),Qi({type:"success",message:"Deleted Image"})})},l=a=>{if(a.extra_avi){const u=a.extra_avi.split(",")[1];if(!u)return;const d=`${a.seed}-${a.prompt}.avi`;CC(u,d);return}else wC(a.image,`${a.seed}-${a.prompt}`)},g=()=>{nn().clearOutputs(),Wt().showGeneratedImages=!1,nn().clearQueue()};async function o(a){const u=window.location.origin,d={prompt:a.prompt,width:a.width?a.width:void 0,height:a.height?a.height:void 0,steps:a.steps,cfg_scale:a.cfg_scale,sampler_name:a.sampler_name,model_name:a.modelName,seed:a.seed,clip_skip:a.clip_skip,frames:a.frames,fps:a.fps,scheduler:a.scheduler,extra_avi:a.extra_avi,final_frame:a.final_frame,enable_hr:a.enable_hr,send_as_refimg:a.send_as_refimg,reverse_refimg:a.reverse_refimg,lora_meta:a.lora_meta},c=window.location.pathname.replace("images","");let f=`${u}${c}?share=`,s="",h="";for(const[m,y]of Object.entries(d)){if(!y)continue;let b=y;typeof y=="string"?b=encodeURIComponent(y):Array.isArray(y)&&(b=JSON.stringify(y)),s+=`${h}${m}=${b}`,h="&"}f+=btoa(String.fromCharCode.apply(null,Array.from(xK(s)))),await navigator.clipboard.writeText(f),Qi({type:"success",message:"Copied shareable link to clipboard"})}return(a,u)=>(z(),oe(Ne,null,[le(C(at),{class:"compact-button",onClick:i,type:"danger",size:"small",icon:C(Dl),plain:""},{default:he(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(at),{class:"compact-button",onClick:u[0]||(u[0]=d=>l(e.imageData)),type:"success",size:"small",icon:C(tl),plain:""},{default:he(()=>[Ue("Download")]),_:1},8,["icon"]),e.imageData.starred?ye("",!0):(z(),be(C(at),{key:0,class:"compact-button",onClick:u[1]||(u[1]=d=>C(r).toggleStarred(e.imageData.id)),type:"warning",size:"small",icon:C($4),plain:""},{default:he(()=>[Ue("Star")]),_:1},8,["icon"])),e.imageData.starred?(z(),be(C(at),{key:1,class:"compact-button",onClick:u[2]||(u[2]=d=>C(r).toggleStarred(e.imageData.id)),type:"warning",size:"small",icon:C(I_),plain:""},{default:he(()=>[Ue("Unstar")]),_:1},8,["icon"])):ye("",!0),le(C(at),{class:"compact-button",onClick:u[3]||(u[3]=d=>C(n).generateText2Img(e.imageData)),type:"success",size:"small",plain:""},{default:he(()=>[Ue("Txt2img")]),_:1}),le(C(at),{class:"compact-button",onClick:u[4]||(u[4]=d=>C(n).generateImg2Img(e.imageData.image)),type:"success",size:"small",plain:""},{default:he(()=>[Ue("Img2img")]),_:1}),le(C(at),{class:"compact-button",onClick:u[5]||(u[5]=d=>C(n).generateInpainting(e.imageData.image)),type:"success",size:"small",plain:""},{default:he(()=>[Ue("Inpaint")]),_:1}),e.showDismiss?(z(),be(C(at),{key:2,class:"compact-button",onClick:u[6]||(u[6]=d=>g()),type:"success",size:"small",plain:""},{default:he(()=>[Ue("Dismiss")]),_:1})):ye("",!0),le(C(at),{class:"compact-button",onClick:u[7]||(u[7]=d=>o(e.imageData)),type:"success",icon:C(Z3),size:"small",plain:""},{default:he(()=>[Ue("Share")]),_:1},8,["icon"])],64))}});const SC=Jt(wG,[["__scopeId","data-v-663d89e3"]]),CG={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},SG=["src"],xG={style:{"font-size":"16px","font-weight":"500"}},kG={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},TG={key:0},EG={key:1},OG=ne("br",null,null,-1),AG={key:0},PG=["onClick"],IG={key:1},MG=["onClick"],LG={key:2},RG=["onClick"],DG=Ee({__name:"ImageDialog",setup(e){const t=Ua(),n=Wt(),r=ae();TM(r,{onSwipeEnd(d,c){c==="RIGHT"&&n.openModalToLeft(),c==="LEFT"&&n.openModalToRight()}});const i=ee({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=ae(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const d=t.currentOutputs.find(c=>c.id===n.activeModal);if(d)return l.value=d;l.value=await Vt.outputs.get(n.activeModal)||t.currentOutputs[0]});function g(){i.value=!1}function o(){var f;if(!((f=l.value)!=null&&f.final_frame))return;const d=l.value.final_frame;nn().generateImg2Img(d)}function a(){var d;!((d=l.value)!=null&&d.image)||wC(l.value.image,`${l.value.seed}-${l.value.prompt}`)}function u(){var f,s;if(!((f=l.value)!=null&&f.extra_avi))return;const d=l.value.extra_avi.split(",")[1];if(!d)return;const c=`output-${(s=l.value.id)!=null?s:"video"}.avi`;CC(d,c)}return(d,c)=>{var f;return z(),be(C(oF),{"model-value":C(i),width:(f=l.value)==null?void 0:f.width,class:"image-viewer",onClosed:g,"align-center":""},{footer:he(()=>[le(SC,{"image-data":l.value,"on-delete":g},null,8,["image-data"])]),default:he(()=>{var s,h,v,m;return[ne("div",{class:"main-output-container",ref_key:"target",ref:r},[ne("div",CG,[(s=l.value)!=null&&s.image?(z(),oe("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,SG)):ye("",!0)])],512),ne("div",xG,Oe(((h=l.value.prompt)==null?void 0:h.split("###")[0])||"Unknown Creation"),1),ne("div",kG,[ne("div",null,"Negative Prompt: "+Oe(((v=l.value.prompt)==null?void 0:v.split("###")[1])||"None"),1),ne("span",null,"Model: "+Oe(l.value.modelName||"Unknown")+" - ",1),ne("span",null,"Sampler: "+Oe(l.value.sampler_name||"Unknown")+" - ",1),ne("span",null,"Scheduler: "+Oe(l.value.scheduler||"Unknown")+" - ",1),ne("span",null,"Seed: "+Oe(l.value.seed||"Unknown")+" - ",1),ne("span",null,"Steps: "+Oe(l.value.steps||"Unknown")+" - ",1),ne("span",null,"CFG Scale: "+Oe(l.value.cfg_scale||"Unknown")+" - ",1),ne("span",null,"Clip Skip: "+Oe((m=l.value.clip_skip)!=null?m:"Unknown")+" - ",1),ne("span",null,"Dimensions: "+Oe(l.value.width||"???")+"x"+Oe(l.value.height||"???")+" - ",1),ne("span",null,"Frames: "+Oe(l.value.frames||"1"),1),l.value.frames&&l.value.frames>1?(z(),oe("span",TG," - FPS: "+Oe(l.value.fps||"Unknown"),1)):ye("",!0),l.value.lora_meta?(z(),oe("span",EG," - LoRA: "+Oe(l.value.lora_meta),1)):ye("",!0),OG,ne("b",null,[l.value.frames&&l.value.frames>1?(z(),oe("span",AG,[ne("a",{href:"#",onClick:et(a,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download GIF]",8,PG)])):ye("",!0),l.value.extra_avi?(z(),oe("span",IG,[Ue(" - "),ne("a",{href:"#",onClick:et(u,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download AVI]",8,MG)])):ye("",!0),l.value.final_frame?(z(),oe("span",LG,[Ue(" - "),ne("a",{href:"#",onClick:et(o,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Extend Video]",8,RG)])):ye("",!0)])])]}),_:1},8,["model-value","width"])}}});const $G=e=>(hi("data-v-8f4d2380"),e=e(),pi(),e),BG=$G(()=>ne("div",{style:{"font-size":"20px"}},"Stable UI",-1)),FG={class:"generator-icons"},zG=Ee({__name:"App",setup(e){const n=Bp($p).smallerOrEqual("md"),r=Wt();At();const i=TT(),l=ae();return ke(()=>i.path,g=>{l.value&&l.value.open(g)}),(g,o)=>(z(),oe(Ne,null,[ne("div",{class:de({"menu-container":!C(n)})},[le(C(Tw),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:de(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:he(()=>[C(n)?ye("",!0):(z(),be(C(Qp),{key:0,class:"remove-item-styling center-vertical"},{title:he(()=>[BG]),_:1})),le(ms,{isMobile:C(n),index:"/"},{icon:he(()=>[ne("div",FG,[le(C(Le),null,{default:he(()=>[le(C($O))]),_:1}),C(r).showGeneratorBadge?(z(),be(C(Le),{key:0,class:"generator-badge",size:10},{default:he(()=>[le(SH)]),_:1})):ye("",!0)])]),title:he(()=>[Ue("Generate")]),_:1},8,["isMobile"]),le(ms,{isMobile:C(n),index:"/images"},{icon:he(()=>[le(C(Le),null,{default:he(()=>[le(C(pO))]),_:1})]),title:he(()=>[Ue("Images")]),_:1},8,["isMobile"]),le(ms,{isMobile:C(n),index:"/about"},{icon:he(()=>[le(C(Le),null,{default:he(()=>[le(C(E_))]),_:1})]),title:he(()=>[Ue("About")]),_:1},8,["isMobile"]),le(ms,{isMobile:C(n),index:"/options"},{icon:he(()=>[le(C(Le),null,{default:he(()=>[le(C(X4))]),_:1})]),title:he(()=>[Ue("Options")]),_:1},8,["isMobile"]),le(ms,{isMobile:C(n),index:"/return"},{icon:he(()=>[le(C(Le),null,{default:he(()=>[le(C(S_))]),_:1})]),title:he(()=>[Ue("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),ne("div",{class:de({view:!C(n)})},[le(C(w_))],2),le(DG)],64))}});const NG=Jt(zG,[["__scopeId","data-v-8f4d2380"]]);const Dm=gk(NG);Dm.use(bk());Dm.use(Hs);Dm.mount("#app");Hs.replace("/");window.addEventListener("beforeunload",e=>{nn().generating&&(e.preventDefault(),e.returnValue="")});const jG={key:1,class:"image-action"},VG=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=Wt(),r=ae(null);rM(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=ae(!1);kM(r,([{isIntersecting:g}])=>{g&&(i.value=g)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(g,o)=>(z(),oe("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(z(),be(C(lf),{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:ze(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):ye("",!0),i.value?(z(),oe("div",jG,[e.imageData.starred?(z(),be(C(Le),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:he(()=>[le(C(I_))]),_:1})):ye("",!0),C(n).multiSelect?(z(),oe("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(Le),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:he(()=>[C(l)?ye("",!0):(z(),be(C(Rl),{key:0})),C(l)?(z(),be(C(k_),{key:1})):ye("",!0)]),_:1},8,["color"])])):ye("",!0)])):ye("",!0)],512))}});const Ky=Jt(VG,[["__scopeId","data-v-b9569bbd"]]);function UG({mobileWidth:e=768,hideAfterDistanceFromTop:t=100,hideAfterScroll:n=100}={}){const{width:r}=g1(),i=ee(()=>r.value<=e),l=ae(!0),{y:g}=xM(window);let o=g.value,a=0;return ke(g,u=>{if(!i.value)return;const d=u-o;if(o=u,d>0&&u>t){a+=d,a>=n&&(l.value=!1,a=0);return}d<0&&(a=0,l.value=!0)}),{isVisible:l,isMobile:i}}const HG={},WG={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},YG=ne("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),XG=[YG];function KG(e,t){return z(),oe("svg",WG,XG)}const GG=Jt(HG,[["render",KG]]),qG=e=>(hi("data-v-b39b47c5"),e=e(),pi(),e),ZG={class:"options"},JG=["onClick"],QG=["onClick"],eq=["onClick"],tq={key:1,class:"center-both",style:{gap:"12px"}},nq={key:2},rq=qG(()=>ne("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),iq=[rq],aq={key:0},oq={key:0,style:{display:"flex",gap:"8px"}},sq={key:1,class:"images"},lq={key:1},uq=Ee({__name:"ImagesView",setup(e){const{width:t}=g1(),{isVisible:n,isMobile:r}=UG(),i=Ua(),l=At(),g=Wt();function o(){g.selected=g.selected.filter(h=>!i.currentOutputs.map(v=>v.id).includes(h)),g.selected=[...g.selected,...i.currentOutputs.map(h=>h.id)],g.multiSelect=!0}async function a(){const h=await Vt.outputs.toCollection().primaryKeys();g.selected=h,g.multiSelect=!0}function u(){g.selected=g.selected.filter(h=>!i.currentOutputs.map(v=>v.id).includes(h)),g.selected.length===0&&(g.multiSelect=!1)}function d(){g.selected=[],g.multiSelect=!1}const c=()=>{Fw.confirm(`This action will permanently delete ${g.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{i.deleteMultipleOutputs(g.selected)})};Ov(["a","A","ArrowLeft"],g.openModalToLeft),Ov(["d","D","ArrowRight"],g.openModalToRight);async function f(){_C(g.selected)}const s=ee(()=>{let h=2;t.value>1440?h=6:t.value>1280?h=5:t.value>768?h=4:t.value>480&&(h=3);const v=[];for(let m=0;m(z(),oe(Ne,null,[ne("div",{class:de(["images-top-bar",{"mobile-hidden":C(r)&&!C(n)}])},[ne("div",ZG,[le(C(vu),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:he(()=>[le(C(at),{class:"btn-select"},{default:he(()=>[le(C(Le),{size:16},{default:he(()=>[le(C(k4))]),_:1})]),_:1})]),default:he(()=>[(z(),oe(Ne,null,Nt(["Newest","Oldest"],m=>ne("div",{key:m,onClick:()=>C(i).sortBy=m,class:de(`el-select-dropdown__item ${C(i).sortBy===m?"selected":""}`)},Oe(m),11,JG)),64))]),_:1}),le(C(vu),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:he(()=>[le(C(at),{class:"btn-select"},{default:he(()=>[le(C(Le),{size:16},{default:he(()=>[le(C(E3))]),_:1})]),_:1})]),default:he(()=>[(z(),oe(Ne,null,Nt(["all","favourited","unfavourited","unrated"],m=>ne("div",{key:m,onClick:()=>C(i).filterBy=m,class:de(`el-select-dropdown__item ${C(i).filterBy===m?"selected":""}`)},Oe(C(i).filterBy===m?"Showing":"Show")+" "+Oe(m),11,QG)),64))]),_:1}),le(C(vu),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:he(()=>[le(C(at),{class:"btn-select"},{default:he(()=>[le(C(Le),{size:16},{default:he(()=>[le(GG)]),_:1})]),_:1})]),default:he(()=>[(z(),oe(Ne,null,Nt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],m=>ne("div",{key:m.value,onClick:()=>C(i).currentLayout=m.value,class:de(`el-select-dropdown__item ${C(i).currentLayout===m.value?"selected":""}`)},Oe(m.label),11,eq)),64))]),_:1}),le(C(vu),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:he(()=>[le(C(at),{class:"btn-select"},{default:he(()=>[le(C(Le),{size:16},{default:he(()=>[C(g).multiSelect?(z(),be(C(k_),{key:0})):(z(),be(C(Rl),{key:1}))]),_:1})]),_:1})]),default:he(()=>[C(g).multiSelect?(z(),oe("div",{key:0,class:"el-select-dropdown__item selected",onClick:v[0]||(v[0]=(...m)=>C(g).toggleMultiSelect&&C(g).toggleMultiSelect(...m))},"Disable multi-select")):(z(),oe("div",{key:1,class:"el-select-dropdown__item",onClick:v[1]||(v[1]=(...m)=>C(g).toggleMultiSelect&&C(g).toggleMultiSelect(...m))},"Enable multi-select")),C(g).selected.length>0?(z(),oe("div",{key:2,class:"el-select-dropdown__item selected",onClick:d},"Deselect All")):(z(),oe("div",{key:3,class:"el-select-dropdown__item",onClick:a},"Select All")),C(g).selected.every(m=>!C(i).currentOutputs.map(y=>y.id).includes(m))?(z(),oe("div",{key:5,class:"el-select-dropdown__item",onClick:o},"Select Page")):(z(),oe("div",{key:4,class:"el-select-dropdown__item selected",onClick:u},"Deselect Page"))]),_:1})]),C(l).pageless==="Disabled"?(z(),be(C(B9),{key:0,layout:"prev, pager, next",total:C(i).outputsLength,"page-size":C(l).pageSize,"current-page":C(i).currentPage,"onUpdate:currentPage":v[2]||(v[2]=m=>C(i).currentPage=m),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):ye("",!0),C(g).multiSelect?(z(),oe("div",tq,[ne("div",null,Oe(C(g).selected.length)+" selected",1),le(C(at),{type:"danger",onClick:c,icon:C(Dl),plain:""},{default:he(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(at),{type:"success",onClick:f,icon:C(tl),plain:"",style:{margin:"0"}},{default:he(()=>[Ue("Download")]),_:1},8,["icon"])])):(z(),oe("div",nq,iq))],2),C(i).outputsLength!=0?(z(),oe("div",aq,[C(i).currentLayout==="dynamic"?(z(),oe("div",oq,[(z(!0),oe(Ne,null,Nt(C(s),(m,y)=>(z(),oe("div",{key:y,style:{flex:"1 1 0%"}},[(z(!0),oe(Ne,null,Nt(m,b=>(z(),be(Ky,{key:b.id,"image-data":b,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):ye("",!0),C(i).currentLayout==="grid"?(z(),oe("div",sq,[(z(!0),oe(Ne,null,Nt(C(i).currentOutputs,m=>(z(),be(Ky,{key:m.id,"image-data":m,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):ye("",!0)])):ye("",!0),C(i).outputsLength==0?(z(),oe("div",lq,[le(C(QF),{description:"No Images Found"})])):ye("",!0)],64))}});const cq=Jt(uq,[["__scopeId","data-v-b39b47c5"]]),fq=Object.freeze(Object.defineProperty({__proto__:null,default:cq},Symbol.toStringTag,{value:"Module"})),dq=["href"],hq=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=vt("router-link");return z(),oe(Ne,null,[e.router?ye("",!0):(z(),oe("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,dq)),e.router?(z(),be(r,{key:1,to:e.href},{default:he(()=>[xe(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):ye("",!0)],64)}}});const pq=Jt(hq,[["__scopeId","data-v-17b53b7d"]]),Ql=e=>(hi("data-v-ecc278c5"),e=e(),pi(),e),mq={class:"about"},gq={class:"about-content"},vq=Ql(()=>ne("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),yq=Ql(()=>ne("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 "),ne("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ue(".")],-1)),bq=Ql(()=>ne("br",null,null,-1)),_q=Ql(()=>ne("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)),wq=Ql(()=>ne("br",null,null,-1)),Cq=Ee({__name:"AboutView",setup(e){return(t,n)=>(z(),oe("div",mq,[ne("div",gq,[vq,yq,bq,_q,wq,ne("div",null,[Ue("You can find the KoboldAI community and authors of this fork on the "),le(pq,{href:"https://koboldai.org/discord"},{default:he(()=>[Ue("KoboldAI Discord")]),_:1})])])]))}});const Sq=Jt(Cq,[["__scopeId","data-v-ecc278c5"]]),xq=Object.freeze(Object.defineProperty({__proto__:null,default:Sq},Symbol.toStringTag,{value:"Module"}));const Ei=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=ee(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,g)=>(z(),be(C(Ui),{prop:e.prop},{label:he(()=>[le(Kl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(l.$slots,"label",{},()=>[Ue(Oe(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(aB),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:he(()=>[(z(!0),oe(Ne,null,Nt(e.options,o=>(z(),be(C(oB),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),ss=e=>(hi("data-v-363a7b08"),e=e(),pi(),e),kq=ss(()=>ne("h1",null,"Options",-1)),Tq=ss(()=>ne("h2",null,"Generation Options",-1)),Eq=ss(()=>ne("h3",null,"Parameter Controls",-1)),Oq=ss(()=>ne("h2",null,"Image Options",-1)),Aq=ss(()=>ne("div",null,[Ue("Drop file here OR "),ne("em",null,"click to upload")],-1)),Pq=ss(()=>ne("h2",null,"General Options",-1)),Iq=Ee({__name:"OptionsView",setup(e){const t=At(),n=Ua(),r=nn(),i=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],l=ae([]),g=ae(),o=ae(!1),a=ae(0);async function u(c){n.importFromZip(c),g.value.clearFiles()}async function d(){Qi({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),o.value=!0,a.value=0;const c=await Vt.outputs.toCollection().primaryKeys();await _C(c,!1,()=>{a.value++}),o.value=!1,a.value=0}return(c,f)=>(z(),oe(Ne,null,[kq,le(C(Zp),{"label-position":"top",model:C(t).options,onSubmit:f[12]||(f[12]=et(()=>{},["prevent"]))},{default:he(()=>[le(C(sV),{type:"border-card",style:{"min-height":"50vh"}},{default:he(()=>[le(C(Gf),{label:"\u{1F5A8}\uFE0F Generation"},{default:he(()=>[Tq,le(C(Ui),{label:"Base URL"},{default:he(()=>[le(C(to),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":f[0]||(f[0]=s=>C(t).baseURL=s)},null,8,["modelValue"])]),_:1}),Eq,(z(!0),oe(Ne,null,Nt(C(r).multiSelect,(s,h)=>{var v;return z(),oe("div",{key:h},[le(Ei,{label:s.name,prop:"pageless",modelValue:s.state,"onUpdate:modelValue":m=>s.state=m,options:(v=s.allowedStates)!=null?v:[]},null,8,["label","modelValue","onUpdate:modelValue","options"])])}),128)),le(Ei,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":f[1]||(f[1]=s=>C(t).allowLargerParams=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ei,{label:"Keep generation on disconnect",prop:"keepImageGenOnDisconnect",modelValue:C(t).keepImageGenOnDisconnect,"onUpdate:modelValue":f[2]||(f[2]=s=>C(t).keepImageGenOnDisconnect=s),options:["Enabled","Disabled"],info:"By default, a client disconnect or an abort action causes the ongoing generation to be interrupted as soon as possible and discarded. Enabling this option overrides that behavior, allowing the generation to finish, and making the image available to be downloaded by the UI when ready."},null,8,["modelValue"]),le(Ei,{label:"Fetch generation progres",prop:"fetchGenerationProgress",modelValue:C(t).fetchGenerationProgress,"onUpdate:modelValue":f[3]||(f[3]=s=>C(t).fetchGenerationProgress=s),options:["Off","Text","Image"],info:"Off: no progress polling. Text: fetch textual progress info only. Image: fetch textual info and live image preview."},null,8,["modelValue"]),le(Co,{label:"Image Resize Mode",prop:"imageResizeMode",modelValue:C(t).imageResizeMode,"onUpdate:modelValue":f[4]||(f[4]=s=>C(t).imageResizeMode=s),options:[{label:"No Scale",value:"NoScale"},{label:"Scale and Crop",value:"ScaleAndCrop"},{label:"Scale and Pad",value:"ScaleAndPad"},{label:"Stretch",value:"Stretch"},{label:"Original",value:"Original"}],info:"How to adapt input image dimensions to the requested image size. No Scale: do not scale, just crop or pad each dimension to fit (default behavior). Scale and Crop: scale to match the smaller dimension, preserving aspect ratio, then crop to fit. Scale and Pad: scale to match the larger dimension, preserving aspect ratio, then pad to fit. Stretch: stretch both dimensions to fit, possibly not preserving aspect ratio. Original: send the input image as-is to the server, with no scaling, cropping or padding."},null,8,["modelValue"]),le(Ei,{label:"Video Gen: Request AVI download",prop:"pageless",modelValue:C(t).alsoRequestAvi,"onUpdate:modelValue":f[5]||(f[5]=s=>C(t).alsoRequestAvi=s),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Gf),{label:"\u{1F4F7} Images"},{default:he(()=>[Oq,le(kn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":f[6]||(f[6]=s=>C(t).pageSize=s),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(Ei,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":f[7]||(f[7]=s=>C(t).pageless=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ei,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":f[8]||(f[8]=s=>C(t).autoCarousel=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(Ei,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":f[9]||(f[9]=s=>C(t).imageDownloadType=s),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(Ui),{label:"Export Images (ZIP File)"},{default:he(()=>[o.value?(z(),be(C(at),{key:1,icon:C(tl),disabled:""},{default:he(()=>[Ue("Downloading... ("+Oe(a.value)+" / "+Oe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(z(),be(C(at),{key:0,icon:C(tl),onClick:f[10]||(f[10]=s=>d())},{default:he(()=>[Ue("Download "+Oe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(Ui),{label:"Import Images (ZIP File)"},{default:he(()=>[le(C(nm),{drag:"",ref_key:"upload",ref:g,"auto-upload":!1,onChange:u,"file-list":l.value,limit:1,multiple:""},{default:he(()=>[le(C(Le),{size:100},{default:he(()=>[le(C(Cp))]),_:1}),Aq]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Gf),{label:"\u2699\uFE0F General"},{default:he(()=>[Pq,le(Co,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":f[11]||(f[11]=s=>C(t).options.colorMode=s),options:i},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const Mq=Jt(Iq,[["__scopeId","data-v-363a7b08"]]),Lq=Object.freeze(Object.defineProperty({__proto__:null,default:Mq},Symbol.toStringTag,{value:"Module"})); -