From 2f2ebefc35345bd496d7464a50ceaf5261d81ed2 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 1 Aug 2026 11:17:16 +0800 Subject: [PATCH] update lite and sdui --- embd_res/kcpp_sdui.embd | 2 +- embd_res/klite.embd | 101 +++++++++++++++++++++++++++------------- 2 files changed, 70 insertions(+), 33 deletions(-) diff --git a/embd_res/kcpp_sdui.embd b/embd_res/kcpp_sdui.embd index 903a7b939..09f7a0400 100644 --- a/embd_res/kcpp_sdui.embd +++ b/embd_res/kcpp_sdui.embd @@ -506,7 +506,7 @@ gl_FragColor.rgb *= color.a; `?(s++,f[s]=0):f[s]++;f[0]>0&&(this.insertCharStyleObject(c.lineIndex,c.charIndex,f[0],d),d=d&&d.slice(f[0]+1)),s&&this.insertNewlineStyleObject(c.lineIndex,c.charIndex+f[0],s);for(var h=1;h0?this.insertCharStyleObject(c.lineIndex+h,0,f[h],d):d&&this.styles[c.lineIndex+h]&&d[0]&&(this.styles[c.lineIndex+h][0]=d[0]),d=d&&d.slice(f[h]+1);f[h]>0&&this.insertCharStyleObject(c.lineIndex+h,0,f[h],d)},setSelectionStartEndWithShift:function(a,u,d){d<=a?(u===a?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=a),this.selectionStart=d):d>a&&da?this.selectionStart=a:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>a?this.selectionEnd=a:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(o){if(!!this.canvas){this.__newClickTime=+new Date;var a=o.pointer;this.isTripleClick(a)&&(this.fire("tripleclick",o),this._stopEvent(o.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=a,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(o){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===o.x&&this.__lastPointer.y===o.y},_stopEvent:function(o){o.preventDefault&&o.preventDefault(),o.stopPropagation&&o.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(o){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(o.e))},tripleClickHandler:function(o){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(o.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(o.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(o){if(this.__isMousedown=!1,!(!this.editable||this.group||o.transform&&o.transform.actionPerformed||o.e.button&&o.e.button!==1)){if(this.canvas){var a=this.canvas._activeObject;if(a&&a!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(o.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(o){var a=this.getSelectionStartFromPointer(o),u=this.selectionStart,d=this.selectionEnd;o.shiftKey?this.setSelectionStartEndWithShift(u,d,a):(this.selectionStart=a,this.selectionEnd=a),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(o){for(var a=this.getLocalPointer(o),u=0,d=0,c=0,f=0,s=0,h,v,m=0,y=this._textLines.length;m0&&(f+=this._textLines[m-1].length+this.missingNewlineOffset(m-1));h=this._getLineLeftOffset(s),d=h*this.scaleX,v=this._textLines[s],this.direction==="rtl"&&(a.x=this.width*this.scaleX-a.x+d);for(var b=0,_=v.length;b<_&&(u=d,d+=this.__charBounds[s][b].kernedWidth*this.scaleX,d<=a.x);b++)f++;return this._getNewSelectionStartFromOffset(a,u,d,f,_)},_getNewSelectionStartFromOffset:function(o,a,u,d,c){var f=o.x-a,s=u-o.x,h=s>f||s<0?0:1,v=d+h;return this.flipX&&(v=c-v),v>this._text.length&&(v=this._text.length),v}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var o=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+o.top+"; left: "+o.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+o.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(o){if(!!this.isEditing){var a=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(o.keyCode in a)this[a[o.keyCode]](o);else if(o.keyCode in this.ctrlKeysMapDown&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapDown[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),o.keyCode>=33&&o.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(o){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(o.keyCode in this.ctrlKeysMapUp&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapUp[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(o){var a=this.fromPaste;if(this.fromPaste=!1,o&&o.stopPropagation(),!!this.isEditing){var u=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,d=this._text.length,c=u.length,f,s,h=c-d,v=this.selectionStart,m=this.selectionEnd,y=v!==m,b,_,w;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var S=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),x=v>S.selectionStart;y?(f=this._text.slice(v,m),h+=m-v):c0&&(d=this.__charBounds[o][a-1],u+=d.left+d.width),u},getDownCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),d=this.get2DCursorLocation(u),c=d.lineIndex;if(c===this._textLines.length-1||o.metaKey||o.keyCode===34)return this._text.length-u;var f=d.charIndex,s=this._getWidthBeforeCursor(c,f),h=this._getIndexOnLine(c+1,s),v=this._textLines[c].slice(f);return v.length+h+1+this.missingNewlineOffset(c)},_getSelectionForOffset:function(o,a){return o.shiftKey&&this.selectionStart!==this.selectionEnd&&a?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),d=this.get2DCursorLocation(u),c=d.lineIndex;if(c===0||o.metaKey||o.keyCode===33)return-u;var f=d.charIndex,s=this._getWidthBeforeCursor(c,f),h=this._getIndexOnLine(c-1,s),v=this._textLines[c].slice(0,f),m=this.missingNewlineOffset(c-1);return-this._textLines[c-1].length+h-v.length+(1-m)},_getIndexOnLine:function(o,a){for(var u=this._textLines[o],d=this._getLineLeftOffset(o),c=d,f=0,s,h,v=0,m=u.length;va){h=!0;var y=c-s,b=c,_=Math.abs(y-a),w=Math.abs(b-a);f=w<_?v:v-1;break}return h||(f=u.length-1),f},moveCursorDown:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",o)},moveCursorUp:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",o)},_moveCursorUpOrDown:function(o,a){var u="get"+o+"CursorOffset",d=this[u](a,this._selectionDirection==="right");a.shiftKey?this.moveCursorWithShift(d):this.moveCursorWithoutShift(d),d!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(o){var a=this._selectionDirection==="left"?this.selectionStart+o:this.selectionEnd+o;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,a),o!==0},moveCursorWithoutShift:function(o){return o<0?(this.selectionStart+=o,this.selectionEnd=this.selectionStart):(this.selectionEnd+=o,this.selectionStart=this.selectionEnd),o!==0},moveCursorLeft:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",o)},_move:function(o,a,u){var d;if(o.altKey)d=this["findWordBoundary"+u](this[a]);else if(o.metaKey||o.keyCode===35||o.keyCode===36)d=this["findLineBoundary"+u](this[a]);else return this[a]+=u==="Left"?-1:1,!0;if(typeof d<"u"&&this[a]!==d)return this[a]=d,!0},_moveLeft:function(o,a){return this._move(o,a,"Left")},_moveRight:function(o,a){return this._move(o,a,"Right")},moveCursorLeftWithoutShift:function(o){var a=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(a=this._moveLeft(o,"selectionStart")),this.selectionEnd=this.selectionStart,a},moveCursorLeftWithShift:function(o){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(o,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(o,"selectionStart")},moveCursorRight:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",o)},_moveCursorLeftOrRight:function(o,a){var u="moveCursor"+o+"With";this._currentCursorOpacity=1,a.shiftKey?u+="Shift":u+="outShift",this[u](a)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(o){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(o,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(o,"selectionEnd")},moveCursorRightWithoutShift:function(o){var a=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(a=this._moveRight(o,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,a},removeChars:function(o,a){typeof a>"u"&&(a=o+1),this.removeStyleFromTo(o,a),this._text.splice(o,a-o),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(o,a,u,d){typeof d>"u"&&(d=u),d>u&&this.removeStyleFromTo(u,d);var c=t.util.string.graphemeSplit(o);this.insertNewStyleBlock(c,u,a),this._text=[].concat(this._text.slice(0,u),c,this._text.slice(d)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var o=t.util.toFixed,a=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var u=this._getSVGLeftTopOffsets(),d=this._getSVGTextAndBg(u.textTop,u.textLeft);return this._wrapSVGTextAndBg(d)},toSVG:function(u){return this._createBaseSVGMarkup(this._toSVG(),{reviver:u,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(u){var d=!0,c=this.getSvgTextDecoration(this);return[u.textBgRects.join(""),' ",u.textSpans.join(""),` `]},_getSVGTextAndBg:function(u,d){var c=[],f=[],s=u,h;this._setSVGBg(f);for(var v=0,m=this._textLines.length;v",t.util.string.escapeXml(u),""].join("")},_setSVGTextLineText:function(u,d,c,f){var s=this.getHeightOfLine(d),h=this.textAlign.indexOf("justify")!==-1,v,m,y="",b,_,w=0,S=this._textLines[d],x;f+=s*(1-this._fontSizeFraction)/this.lineHeight;for(var k=0,E=S.length-1;k<=E;k++)x=k===E||this.charSpacing,y+=S[k],b=this.__charBounds[d][k],w===0?(c+=b.kernedWidth-b.width,w+=b.width):w+=b.kernedWidth,h&&!x&&this._reSpaceAndTab.test(S[k])&&(x=!0),x||(v=v||this.getCompleteStyleDeclaration(d,k),m=this.getCompleteStyleDeclaration(d,k+1),x=t.util.hasStyleChanged(v,m,!0)),x&&(_=this._getStyleDeclaration(d,k)||{},u.push(this._createTextCharSpan(y,_,c,f)),y="",v=m,c+=w,w=0)},_pushTextBgRect:function(u,d,c,f,s,h){var v=t.Object.NUM_FRACTION_DIGITS;u.push(" `)},_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=oe({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=oe({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>en().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>en().currentImageProps),g=ee({get:()=>i.value.drawing&&!r.value,set:P=>i.value.drawing=P}),o=oe(512),a=oe(512),u=oe(!1),d=oe(30),c=oe(!1),f=new Qn.fabric.Circle({radius:d.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=oe("Erase"),h=oe("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 Qn.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=en();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=F({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=F({layerHeight:q,layerWidth:A});const te=o.value*i.value.imageScale,fe=a.value*i.value.imageScale;Q.params.width=te-te%64,Q.params.height=fe-fe%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,fe=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,Y=0,T=P.width,X=P.height,W=0,$=0,B=pe.width,K=pe.height;switch(q){case"Stretch":break;case"ScaleAndCrop":{const ce=pe.width/te,ie=pe.height/fe;ce>ie?(X=pe.height/ce,Y=(P.height-X)/2):(T=pe.width/ie,U=(P.width-T)/2);break}case"ScaleAndPad":{const ce=pe.width/te,ie=pe.height/fe;ceQ?(T=Q,U=ce-Q/2):(B=te,W=Q/2-ce),fe>j?(X=j,Y=ie-j/2):(K=fe,$=j/2-ie);break}}return ve.drawImage(P,U,Y,T,X,W,$,B,K),pe}function I(){const P=en(),Q=Rt();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(),fe=E(te,j,A,q,G,te);if(l.value.sourceImage=fe.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=en();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=";Qn.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 F({image:P,layerWidth:Q,layerHeight:j}={}){const A=new Qn.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 Qn.fabric.Rect({width:Q||o.value,height:j||a.value,left:0,top:0,fill:A||"transparent",absolutePositioned:q||!0,selectable:!1});return new Qn.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=en();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=F(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 sW={},lW={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},uW=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),cW=[uW];function fW(e,t){return z(),se("svg",lW,cW)}const dW=Zt(sW,[["render",fW]]);async function hW(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 pW(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 hW(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 Cm=e=>(hi("data-v-7dc3b5bb"),e=e(),pi(),e),mW=Cm(()=>ne("div",null,[je("Drop file here, paste an image OR "),ne("em",null,"click to upload")],-1)),gW={key:0},vW=Cm(()=>ne("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),yW={class:"canvas-container"},bW=Cm(()=>ne("canvas",{id:"canvas"},null,-1)),_W={class:"action-buttons",style:{left:"10px",right:"unset"}},wW={class:"action-buttons"},CW=Ee({__name:"CustomCanvas",setup(e){const t=en(),n=Ut(),r=zs(),i=oe();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 Ic(a.raw);t.currentImageProps.sourceImage=u,r.drawing=!1,Qn.fabric.Image.fromURL(u,r.newImage)}function g(){t.currentImageProps.sourceImage="",r.resetCanvas()}rt(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Qn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage),window.addEventListener("paste",o)}),Xt(()=>{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(),se(Ne,null,[C(t).currentImageProps.sourceImage?ye("",!0):(z(),be(C(Jp),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:he(()=>[C(t).generatorType==="Img2Img"?(z(),se("div",gW,[vW,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(Me),{size:20,style:{"margin-right":"2px"}},{default:he(()=>[le(P2)]),_:1}),je("draw something")])])):ye("",!0)]),default:he(()=>[le(C(Me),{size:100},{default:he(()=>[le(C(yp))]),_:1}),mW]),_:1},512)),Et(ne("div",null,[ne("div",yW,[bW,ne("div",_W,[le(C(at),{onClick:u[1]||(u[1]=d=>C(r).undoAction()),icon:C(k_),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(T_),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),ne("div",wW,[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(Rl),plain:""},null,8,["icon"]),le(C(at),{onClick:u[4]||(u[4]=d=>C(r).downloadMask()),icon:C(el),plain:""},null,8,["icon"]),le(C(at),{onClick:u[5]||(u[5]=d=>C(r).flipErase()),icon:C(r).erasing?C(h3):dW,plain:""},null,8,["icon"]),C(r).drawing?(z(),be(C(RB),{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(Xp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:he(()=>[le(Sn,{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),[[Ht,C(t).currentImageProps.sourceImage]])],64))}});const ty=Zt(CW,[["__scopeId","data-v-7dc3b5bb"]]),SW={class:"centerIcons"},xW={class:"stackedIcons"},kW=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return Wx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(z(),se("div",SW,[ne("div",xW,[le(C(Me),{class:"firstIcon",size:e.size},{default:he(()=>[(z(),be(Ct(t.iconOne)))]),_:1},8,["size"]),le(C(Me),{class:"secondIcon",size:e.size},{default:he(()=>[(z(),be(Ct(t.iconTwo)))]),_:1},8,["size"])])]))}});const TW=Zt(kW,[["__scopeId","data-v-74586a39"]]),EW={key:1,style:{width:"40px"}},ku=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(z(),be(C(Vn),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:he(()=>[le(C(Gp),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:he(()=>[e.iconTwo?(z(),be(TW,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(z(),se("div",EW,[le(C(Me),{style:{width:"35px"},size:40},{default:he(()=>[(z(),be(Ct(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const OW=4,ny=0,ry=1,AW=2;function ts(e){let t=e.length;for(;--t>=0;)e[t]=0}const PW=0,L2=1,IW=2,MW=3,LW=258,Sm=29,Kl=256,_l=Kl+1+Sm,Oo=30,xm=19,R2=2*_l+1,Ta=15,id=16,RW=7,km=256,D2=16,$2=17,B2=18,Lh=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]),Qu=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]),DW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),F2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$W=512,Qr=new Array((_l+2)*2);ts(Qr);const Ns=new Array(Oo*2);ts(Ns);const wl=new Array($W);ts(wl);const Cl=new Array(LW-MW+1);ts(Cl);const Tm=new Array(Sm);ts(Tm);const Mc=new Array(Oo);ts(Mc);function ad(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 z2,N2,j2;function od(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const V2=e=>e<256?wl[e]:wl[256+(e>>>7)],Sl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},Pn=(e,t,n)=>{e.bi_valid>id-n?(e.bi_buf|=t<>id-e.bi_valid,e.bi_valid+=n-id):(e.bi_buf|=t<{Pn(e,n[t*2],n[t*2+1])},U2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},BW=e=>{e.bi_valid===16?(Sl(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)},FW=(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<=Ta;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--)}},H2=(e,t,n)=>{const r=new Array(Ta+1);let i=0,l,g;for(l=1;l<=Ta;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]=U2(r[o]++,o))}},zW=()=>{let e,t,n,r,i;const l=new Array(Ta+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t<_l;t++)e.dyn_ltree[t*2]=0;for(t=0;t{e.bi_valid>8?Sl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},iy=(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=Cl[i],Ar(e,g+Kl+1,t),o=Lh[g],o!==0&&(i-=Tm[g],Pn(e,i,o)),r--,g=V2(r),Ar(e,g,n),o=Qu[g],o!==0&&(r-=Mc[g],Pn(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=R2,g=0;g>1;g>=1;g--)sd(e,n,g);u=l;do g=e.heap[1],e.heap[1]=e.heap[e.heap_len--],sd(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++,sd(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],FW(e,t),H2(n,a,e.bl_count)},oy=(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(oy(e,e.dyn_ltree,e.l_desc.max_code),oy(e,e.dyn_dtree,e.d_desc.max_code),Rh(e,e.bl_desc),t=xm-1;t>=3&&e.bl_tree[F2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},jW=(e,t,n,r)=>{let i;for(Pn(e,t-257,5),Pn(e,n-1,5),Pn(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 ny;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return ry;for(n=32;n{ly||(zW(),ly=!0),e.l_desc=new od(e.dyn_ltree,z2),e.d_desc=new od(e.dyn_dtree,N2),e.bl_desc=new od(e.bl_tree,j2),e.bi_buf=0,e.bi_valid=0,W2(e)},X2=(e,t,n,r)=>{Pn(e,(PW<<1)+(r?1:0),3),Y2(e),Sl(e,n),Sl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},HW=e=>{Pn(e,L2<<1,3),Ar(e,km,Qr),BW(e)},WW=(e,t,n,r)=>{let i,l,g=0;e.level>0?(e.strm.data_type===AW&&(e.strm.data_type=VW(e)),Rh(e,e.l_desc),Rh(e,e.d_desc),g=NW(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?X2(e,t,n,r):e.strategy===OW||l===i?(Pn(e,(L2<<1)+(r?1:0),3),ay(e,Qr,Ns)):(Pn(e,(IW<<1)+(r?1:0),3),jW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,g+1),ay(e,e.dyn_ltree,e.dyn_dtree)),W2(e),r&&Y2(e)},YW=(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[(Cl[n]+Kl+1)*2]++,e.dyn_dtree[V2(t)*2]++),e.sym_next===e.sym_end);var XW=UW,KW=X2,GW=WW,qW=YW,ZW=HW,JW={_tr_init:XW,_tr_stored_block:KW,_tr_flush_block:GW,_tr_tally:qW,_tr_align:ZW};const QW=(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 xl=QW;const eY=()=>{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},tY=new Uint32Array(eY()),nY=(e,t,n,r)=>{const i=tY,l=r+n;e^=-1;for(let g=r;g>>8^i[(e^t[g])&255];return e^-1};var Qt=nY,Va={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"},ns={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:rY,_tr_stored_block:Dh,_tr_flush_block:iY,_tr_tally:ji,_tr_align:aY}=JW,{Z_NO_FLUSH:Vi,Z_PARTIAL_FLUSH:oY,Z_FULL_FLUSH:sY,Z_FINISH:er,Z_BLOCK:uy,Z_OK:on,Z_STREAM_END:cy,Z_STREAM_ERROR:Rr,Z_DATA_ERROR:lY,Z_BUF_ERROR:ld,Z_DEFAULT_COMPRESSION:uY,Z_FILTERED:cY,Z_HUFFMAN_ONLY:Tu,Z_RLE:fY,Z_FIXED:dY,Z_DEFAULT_STRATEGY:hY,Z_UNKNOWN:pY,Z_DEFLATED:pf}=ns,mY=9,gY=15,vY=8,yY=29,bY=256,$h=bY+1+yY,_Y=30,wY=19,CY=2*$h+1,SY=15,lt=3,Bi=258,Dr=Bi+lt+1,xY=32,Vo=42,Em=57,Bh=69,Fh=73,zh=91,Nh=103,Ea=113,ws=666,kn=1,rs=2,Ua=3,is=4,kY=3,Oa=(e,t)=>(e.msg=Va[t],t),fy=e=>e*2-(e>4?9:0),Ri=e=>{let t=e.length;for(;--t>=0;)e[t]=0},TY=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 EY=(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))},Hn=(e,t)=>{iY(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zn(e.strm)},pt=(e,t)=>{e.pending_buf[e.pending++]=t},ms=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},jh=(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=xl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Qt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},K2=(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+Bi;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},Uo=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),TY(e),r+=t),e.strm.avail_in===0)break;if(n=jh(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=Ui(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ui(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,zn(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&&(jh(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&&(jh(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===er)&&t!==Vi&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,g=t===er&&e.strm.avail_in===0&&r===i?1:0,Dh(e,e.block_start,r,g),e.block_start+=r,zn(e.strm)),g?Ua:kn)},ud=(e,t)=>{let n,r;for(;;){if(e.lookahead=lt&&(e.ins_h=Ui(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=K2(e,n)),e.match_length>=lt)if(r=ji(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=Ui(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=Ui(e,e.ins_h,e.window[e.strstart+1]);else r=ji(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Hn(e,!1),e.strm.avail_out===0))return kn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=lt&&(e.ins_h=Ui(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=ji(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=Ui(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&&(Hn(e,!1),e.strm.avail_out===0))return kn}else if(e.match_available){if(r=ji(e,0,e.window[e.strstart-1]),r&&Hn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return kn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=ji(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<=Bi){if(Uo(e),e.lookahead<=Bi&&t===Vi)return kn;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+Bi;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=ji(e,1,e.match_length-lt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=ji(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Hn(e,!1),e.strm.avail_out===0))return kn}return e.insert=0,t===er?(Hn(e,!0),e.strm.avail_out===0?Ua:is):e.sym_next&&(Hn(e,!1),e.strm.avail_out===0)?kn:rs},AY=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Uo(e),e.lookahead===0)){if(t===Vi)return kn;break}if(e.match_length=0,n=ji(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Hn(e,!1),e.strm.avail_out===0))return kn}return e.insert=0,t===er?(Hn(e,!0),e.strm.avail_out===0?Ua:is):e.sym_next&&(Hn(e,!1),e.strm.avail_out===0)?kn:rs};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 Cs=[new kr(0,0,0,0,G2),new kr(4,4,8,4,ud),new kr(4,5,16,8,ud),new kr(4,6,32,32,ud),new kr(4,4,16,16,ho),new kr(8,16,32,32,ho),new kr(8,16,128,128,ho),new kr(8,32,128,256,ho),new kr(32,128,258,1024,ho),new kr(32,258,258,4096,ho)],PY=e=>{e.window_size=2*e.w_size,Ri(e.head),e.max_lazy_match=Cs[e.level].max_lazy,e.good_match=Cs[e.level].good_length,e.nice_match=Cs[e.level].nice_length,e.max_chain_length=Cs[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 IY(){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=pf,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(CY*2),this.dyn_dtree=new Uint16Array((2*_Y+1)*2),this.bl_tree=new Uint16Array((2*wY+1)*2),Ri(this.dyn_ltree),Ri(this.dyn_dtree),Ri(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(SY+1),this.heap=new Uint16Array(2*$h+1),Ri(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$h+1),Ri(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 Gl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Vo&&t.status!==Em&&t.status!==Bh&&t.status!==Fh&&t.status!==zh&&t.status!==Nh&&t.status!==Ea&&t.status!==ws?1:0},q2=e=>{if(Gl(e))return Oa(e,Rr);e.total_in=e.total_out=0,e.data_type=pY;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Em:t.wrap?Vo:Ea,e.adler=t.wrap===2?0:1,t.last_flush=-2,rY(t),on},Z2=e=>{const t=q2(e);return t===on&&PY(e.state),t},MY=(e,t)=>Gl(e)||e.state.wrap!==2?Rr:(e.state.gzhead=t,on),J2=(e,t,n,r,i,l)=>{if(!e)return Rr;let g=1;if(t===uY&&(t=6),r<0?(g=0,r=-r):r>15&&(g=2,r-=16),i<1||i>mY||n!==pf||r<8||r>15||t<0||t>9||l<0||l>dY||r===8&&g!==1)return Oa(e,Rr);r===8&&(r=9);const o=new IY;return e.state=o,o.strm=e,o.status=Vo,o.wrap=g,o.gzhead=null,o.w_bits=r,o.w_size=1<J2(e,t,pf,gY,vY,hY),RY=(e,t)=>{if(Gl(e)||t>uy||t<0)return e?Oa(e,Rr):Rr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===ws&&t!==er)return Oa(e,e.avail_out===0?ld:Rr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(zn(e),e.avail_out===0)return n.last_flush=-1,on}else if(e.avail_in===0&&fy(t)<=fy(r)&&t!==er)return Oa(e,ld);if(n.status===ws&&e.avail_in!==0)return Oa(e,ld);if(n.status===Vo&&n.wrap===0&&(n.status=Ea),n.status===Vo){let i=pf+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=Tu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=xY),i+=31-i%31,ms(n,i),n.strstart!==0&&(ms(n,e.adler>>>16),ms(n,e.adler&65535)),e.adler=1,n.status=Ea,zn(e),n.pending!==0)return n.last_flush=-1,on}if(n.status===Em){if(e.adler=0,pt(n,31),pt(n,139),pt(n,8),n.gzhead)pt(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)),pt(n,n.gzhead.time&255),pt(n,n.gzhead.time>>8&255),pt(n,n.gzhead.time>>16&255),pt(n,n.gzhead.time>>24&255),pt(n,n.level===9?2:n.strategy>=Tu||n.level<2?4:0),pt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(pt(n,n.gzhead.extra.length&255),pt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Qt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Bh;else if(pt(n,0),pt(n,0),pt(n,0),pt(n,0),pt(n,0),pt(n,n.level===9?2:n.strategy>=Tu||n.level<2?4:0),pt(n,kY),n.status=Ea,zn(e),n.pending!==0)return n.last_flush=-1,on}if(n.status===Bh){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=Qt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,zn(e),n.pending!==0)return n.last_flush=-1,on;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=Qt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Fh}if(n.status===Fh){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=Qt(e.adler,n.pending_buf,n.pending-i,i)),zn(e),n.pending!==0)return n.last_flush=-1,on;i=0}n.gzindexi&&(e.adler=Qt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=zh}if(n.status===zh){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=Qt(e.adler,n.pending_buf,n.pending-i,i)),zn(e),n.pending!==0)return n.last_flush=-1,on;i=0}n.gzindexi&&(e.adler=Qt(e.adler,n.pending_buf,n.pending-i,i))}n.status=Nh}if(n.status===Nh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(zn(e),n.pending!==0))return n.last_flush=-1,on;pt(n,e.adler&255),pt(n,e.adler>>8&255),e.adler=0}if(n.status=Ea,zn(e),n.pending!==0)return n.last_flush=-1,on}if(e.avail_in!==0||n.lookahead!==0||t!==Vi&&n.status!==ws){let i=n.level===0?G2(n,t):n.strategy===Tu?AY(n,t):n.strategy===fY?OY(n,t):Cs[n.level].func(n,t);if((i===Ua||i===is)&&(n.status=ws),i===kn||i===Ua)return e.avail_out===0&&(n.last_flush=-1),on;if(i===rs&&(t===oY?aY(n):t!==uy&&(Dh(n,0,0,!1),t===sY&&(Ri(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),zn(e),e.avail_out===0))return n.last_flush=-1,on}return t!==er?on:n.wrap<=0?cy:(n.wrap===2?(pt(n,e.adler&255),pt(n,e.adler>>8&255),pt(n,e.adler>>16&255),pt(n,e.adler>>24&255),pt(n,e.total_in&255),pt(n,e.total_in>>8&255),pt(n,e.total_in>>16&255),pt(n,e.total_in>>24&255)):(ms(n,e.adler>>>16),ms(n,e.adler&65535)),zn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?on:cy)},DY=e=>{if(Gl(e))return Rr;const t=e.state.status;return e.state=null,t===Ea?Oa(e,lY):on},$Y=(e,t)=>{let n=t.length;if(Gl(e))return Rr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Vo||r.lookahead)return Rr;if(i===1&&(e.adler=xl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Ri(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,Uo(r);r.lookahead>=lt;){let a=r.strstart,u=r.lookahead-(lt-1);do r.ins_h=Ui(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,Uo(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,on};var BY=LY,FY=J2,zY=Z2,NY=q2,jY=MY,VY=RY,UY=DY,HY=$Y,WY="pako deflate (from Nodeca project)",js={deflateInit:BY,deflateInit2:FY,deflateReset:zY,deflateResetKeep:NY,deflateSetHeader:jY,deflate:VY,deflateEnd:UY,deflateSetDictionary:HY,deflateInfo:WY};const YY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var XY=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)YY(n,r)&&(e[r]=n[r])}}return e},KY=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;kl[254]=kl[254]=1;var GY=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 qY=(e,t)=>{if(t<65534&&e.subarray&&Q2)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 qY(l,i)},JY=(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+kl[e[n]]>t?n:t},Tl={string2buf:GY,buf2string:ZY,utf8border:JY};function QY(){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 eC=QY;const tC=Object.prototype.toString,{Z_NO_FLUSH:eX,Z_SYNC_FLUSH:tX,Z_FULL_FLUSH:nX,Z_FINISH:rX,Z_OK:Lc,Z_STREAM_END:iX,Z_DEFAULT_COMPRESSION:aX,Z_DEFAULT_STRATEGY:oX,Z_DEFLATED:sX}=ns;function ql(e){this.options=mf.assign({level:aX,method:sX,chunkSize:16384,windowBits:15,memLevel:8,strategy:oX},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 eC,this.strm.avail_out=0;let n=js.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Lc)throw new Error(Va[n]);if(t.header&&js.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Tl.string2buf(t.dictionary):tC.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=js.deflateSetDictionary(this.strm,r),n!==Lc)throw new Error(Va[n]);this._dict_set=!0}}ql.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?rX:eX,typeof e=="string"?n.input=Tl.string2buf(e):tC.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===tX||l===nX)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=js.deflate(n,l),i===iX)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=js.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Lc;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};ql.prototype.onData=function(e){this.chunks.push(e)};ql.prototype.onEnd=function(e){e===Lc&&(this.result=mf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Om(e,t){const n=new ql(t);if(n.push(e,!0),n.err)throw n.msg||Va[n.err];return n.result}function lX(e,t){return t=t||{},t.raw=!0,Om(e,t)}function uX(e,t){return t=t||{},t.gzip=!0,Om(e,t)}var cX=ql,fX=Om,dX=lX,hX=uX,pX=ns,mX={Deflate:cX,deflate:fX,deflateRaw:dX,gzip:hX,constants:pX};const Eu=16209,gX=16191;var vX=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=Eu;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=Eu;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(po+1),N=new Uint16Array(po+1);let L=null,F,O,V;for(u=0;u<=po;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===py||f!==1))return-1;for(N[1]=0,u=1;udy||e===my&&y>hy)return 1;for(;;){F=u-v,g[d]+1=I?(O=L[g[d]-I],V=E[g[d]-I]):(O=32+64,V=0),_=1<>v)+w]=F<<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<dy||e===my&&y>hy)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 Vs=CX;const SX=0,nC=1,rC=2,{Z_FINISH:gy,Z_BLOCK:xX,Z_TREES:Ou,Z_OK:Ha,Z_STREAM_END:kX,Z_NEED_DICT:TX,Z_STREAM_ERROR:or,Z_DATA_ERROR:iC,Z_MEM_ERROR:aC,Z_BUF_ERROR:EX,Z_DEFLATED:vy}=ns,gf=16180,yy=16181,by=16182,_y=16183,wy=16184,Cy=16185,Sy=16186,xy=16187,ky=16188,Ty=16189,Rc=16190,Xr=16191,fd=16192,Ey=16193,dd=16194,Oy=16195,Ay=16196,Py=16197,Iy=16198,Au=16199,Pu=16200,My=16201,Ly=16202,Ry=16203,Dy=16204,$y=16205,hd=16206,By=16207,Fy=16208,Ft=16209,oC=16210,sC=16211,OX=852,AX=592,PX=15,IX=PX,zy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function MX(){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 to=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modesC?1:0},lC=e=>{if(to(e))return or;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=gf,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(OX),t.distcode=t.distdyn=new Int32Array(AX),t.sane=1,t.back=-1,Ha},uC=e=>{if(to(e))return or;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,lC(e)},cC=(e,t)=>{let n;if(to(e))return or;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?or:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,uC(e))},fC=(e,t)=>{if(!e)return or;const n=new MX;e.state=n,n.strm=e,n.window=null,n.mode=gf;const r=cC(e,t);return r!==Ha&&(e.state=null),r},LX=e=>fC(e,IX);let Ny=!0,pd,md;const RX=e=>{if(Ny){pd=new Int32Array(512),md=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(Vs(nC,e.lens,0,288,pd,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Vs(rC,e.lens,0,32,md,0,e.work,{bits:5}),Ny=!1}e.lencode=pd,e.lenbits=9,e.distcode=md,e.distbits=5},dC=(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(to(e)||!e.output||!e.input&&e.avail_in!==0)return or;n=e.state,n.mode===Xr&&(n.mode=fd),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=Ha;e:for(;;)switch(n.mode){case gf:if(n.wrap===0){n.mode=fd;break}for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Qt(n.check,I,2,0),u=0,d=0,n.mode=yy;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)!==vy){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=Qt(n.check,I,2,0)),u=0,d=0,n.mode=by;case by: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=Qt(n.check,I,4,0)),u=0,d=0,n.mode=_y;case _y: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=Qt(n.check,I,2,0)),u=0,d=0,n.mode=wy;case wy:if(n.flags&1024){for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Qt(n.check,I,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=Cy;case Cy: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=Qt(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Sy;case Sy: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 Ty:for(;d<32;){if(o===0)break e;o--,u+=r[l++]<>>=d&7,d-=d&7,n.mode=hd;break}for(;d<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,d-=1,u&3){case 0:n.mode=Ey;break;case 1:if(RX(n),n.mode=Au,t===Ou){u>>>=2,d-=2;break e}break;case 2:n.mode=Ay;break;case 3:e.msg="invalid block type",n.mode=Ft}u>>>=2,d-=2;break;case Ey: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=dd,t===Ou)break e;case dd:n.mode=Oy;case Oy: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 Ay: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=Py;case Py: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=Vs(SX,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=Iy;case Iy: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=Vs(nC,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=Vs(rC,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=Au,t===Ou)break e;case Au:n.mode=Pu;case Pu: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,vX(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=$y;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=My;case My:if(n.extra){for(N=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Ly;case Ly: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=Ry;case Ry: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=Dy;case Dy: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=Pu);break;case $y:if(a===0)break e;i[g++]=n.length,a--,n.mode=Pu;break;case hd:if(n.wrap){for(;d<32;){if(o===0)break e;o--,u|=r[l++]<{if(to(e))return or;let t=e.state;return t.window&&(t.window=null),e.state=null,Ha},BX=(e,t)=>{if(to(e))return or;const n=e.state;return(n.wrap&2)===0?or:(n.head=t,t.done=!1,Ha)},FX=(e,t)=>{const n=t.length;let r,i,l;return to(e)||(r=e.state,r.wrap!==0&&r.mode!==Rc)?or:r.mode===Rc&&(i=1,i=xl(i,t,n,0),i!==r.check)?iC:(l=dC(e,t,n,n),l?(r.mode=oC,aC):(r.havedict=1,Ha))};var zX=uC,NX=cC,jX=lC,VX=LX,UX=fC,HX=DX,WX=$X,YX=BX,XX=FX,KX="pako inflate (from Nodeca project)",ei={inflateReset:zX,inflateReset2:NX,inflateResetKeep:jX,inflateInit:VX,inflateInit2:UX,inflate:HX,inflateEnd:WX,inflateGetHeader:YX,inflateSetDictionary:XX,inflateInfo:KX};function GX(){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 qX=GX;const hC=Object.prototype.toString,{Z_NO_FLUSH:ZX,Z_FINISH:JX,Z_OK:El,Z_STREAM_END:gd,Z_NEED_DICT:vd,Z_STREAM_ERROR:QX,Z_DATA_ERROR:jy,Z_MEM_ERROR:eK}=ns;function Zl(e){this.options=mf.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 eC,this.strm.avail_out=0;let n=ei.inflateInit2(this.strm,t.windowBits);if(n!==El)throw new Error(Va[n]);if(this.header=new qX,ei.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Tl.string2buf(t.dictionary):hC.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ei.inflateSetDictionary(this.strm,t.dictionary),n!==El)))throw new Error(Va[n])}Zl.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?JX:ZX,hC.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===vd&&i&&(l=ei.inflateSetDictionary(n,i),l===El?l=ei.inflate(n,g):l===jy&&(l=vd));n.avail_in>0&&l===gd&&n.state.wrap>0&&e[n.next_in]!==0;)ei.inflateReset(n),l=ei.inflate(n,g);switch(l){case QX:case jy:case vd:case eK:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===gd))if(this.options.to==="string"){let a=Tl.utf8border(n.output,n.next_out),u=n.next_out-a,d=Tl.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===El&&o===0)){if(l===gd)return l=ei.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Zl.prototype.onData=function(e){this.chunks.push(e)};Zl.prototype.onEnd=function(e){e===El&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=mf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Am(e,t){const n=new Zl(t);if(n.push(e),n.err)throw n.msg||Va[n.err];return n.result}function tK(e,t){return t=t||{},t.raw=!0,Am(e,t)}var nK=Zl,rK=Am,iK=tK,aK=Am,oK=ns,sK={Inflate:nK,inflate:rK,inflateRaw:iK,ungzip:aK,constants:oK};const{Deflate:Cq,deflate:Sq,deflateRaw:lK,gzip:xq}=mX,{Inflate:kq,inflate:Tq,inflateRaw:uK,ungzip:Eq}=sK;var cK=lK,fK=uK;function Vy(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 dK=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=Vy(t);if(console.log("URL params:",n),n.get("share")){const l=fK(new Uint8Array(atob(n.get("share")).split("").map(g=>g.charCodeAt(0))),{to:"string"});if(!l){Ut().raiseError("Error when trying to decode share parameter!",!1);return}n=Vy(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"};en().generateText2Img(r,!1)},hK=10;function ec(e,t,n,r,i=l=>Ut().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})`)}const pK=Wo("interrogate",()=>{const e=oe({}),t=oe(!1);async function n(g){Ut().raiseError(g,!1),t.value=!1,e.value={}}async function r(){const g=Rt(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${g.baseURL.length===0?".":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();!ec(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}}),Pm=e=>(hi("data-v-db184ac6"),e=e(),pi(),e),mK={key:0,style:{"margin-top":"16px"}},gK=Pm(()=>ne("div",null,[je("Drop file here OR "),ne("em",null,"click to upload")],-1)),vK={key:1,style:{"margin-top":"16px"}},yK={key:2},bK={style:{"margin-top":"8px"}},_K=Pm(()=>ne("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),wK={key:0},CK=Pm(()=>ne("h3",null,"Caption",-1)),SK={key:0},xK={key:1},kK=Ee({__name:"InterrogationView",setup(e){const t=pK(),n=en(),r=Ut(),i=oe();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const d=await Ic(u.raw);t.currentInterrogation.source_image=d,t.interrogateImage()}function g(){n.generateText2Img({prompt:o.value})}const o=ee(()=>t.getFormStatus()),{ellipsis:a}=I2();return(u,d)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(z(),se("div",yK,[ne("div",bK,[le(C(at),{icon:C(zg),onClick:C(t).resetInterrogation},{default:he(()=>[je("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(z(),be(C(at),{key:0,icon:C(zg),onClick:g,disabled:!C(o)},{default:he(()=>[je("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):ye("",!0)]),_K,le(C(sf),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(z(),se("div",wK,[CK,C(o)?(z(),se("div",xK,[ne("strong",null,Ae(C(o)),1)])):(z(),se("div",SK,"Processing"+Ae(C(a)),1))])):ye("",!0)])):(z(),se("div",vK,[ne("strong",null,"Uploading image"+Ae(C(a)),1)])):(z(),se("div",mK,[ne("div",null,[le(C(Jp),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:he(()=>[le(C(Me),{size:100},{default:he(()=>[le(C(yp))]),_:1}),gK]),_:1},512)])]))}});const TK=Zt(kK,[["__scopeId","data-v-db184ac6"]]);function EK(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 OK={class:"form"},AK={key:0,style:{"padding-bottom":"50px"}},PK=ne("h1",{style:{margin:"0"}},"Interrogation",-1),IK=ne("div",null,"Interrogate images to get their predicted descriptions.",-1),MK={class:"sidebar"},LK={class:"reference-images-header"},RK=ne("span",{class:"reference-images-label"},"Reference Images",-1),DK={class:"reference-images-actions"},$K={key:0,class:"reference-image-list"},BK={class:"reference-image-index"},FK=["title"],zK={class:"reference-image-controls"},NK={key:1,class:"reference-image-empty"},jK={class:"main"},VK={class:"image center-horizontal"},UK={key:0},HK=Ee({__name:"GenerateView",setup(e){const n=Lp(Mp).smallerOrEqual("md"),r=en(),i=Ut(),l=zs();Rt();const g=Sv(async()=>{const _=r.cacheVersion,S=(await r.getAvailableSamplers()).map(x=>x.name);return S.length===0?[]:u(S)},[]),o=Sv(async()=>{const _=r.cacheVersion,S=(await r.getAvailableSchedulers()).map(x=>x.name);return S.length===0?[]:d(S)},[]),a=vt({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: "+EK(_,!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(),dK(),(_,w)=>(z(),se(Ne,null,[le(C(Cw),{"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(ku,{index:"Text2Img","icon-one":C(RE),"icon-two":C(su),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ku,{index:"Img2Img","icon-one":C(su),"icon-two":C(su),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ku,{index:"Inpainting","icon-one":P2,"icon-two":C(su),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(ku,{index:"Interrogation","icon-one":PH,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),ne("div",OK,[C(r).generatorType==="Interrogation"?(z(),se("div",AK,[PK,IK,le(TK)])):(z(),be(C(Xp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:a,onSubmit:w[32]||(w[32]=tt(()=>{},["prevent"]))},{default:he(()=>[ne("div",MK,[le(KH),le(Mh,{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(Mh,{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(SE)},{append:he(()=>[le(C(Vn),{content:"Randomize!",placement:"top"},{default:he(()=>[le(C(at),{icon:C(eO),onClick:w[1]||(w[1]=()=>C(r).params.seed=C(pC)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue","clear-icon"]),(z(),be(C(T0),{key:0,gutter:10},{default:he(()=>[C(r).multiSelect.sampler.state==="Multiple"?(z(),be(C(lo),{key:0,span:C(n)?24:12},{default:he(()=>[le(_o,{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(lo),{key:1,span:C(n)?24:12},{default:he(()=>[le(_o,{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(lo),{key:2,span:C(n)?24:12},{default:he(()=>[le(_o,{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(lo),{key:3,span:C(n)?24:12},{default:he(()=>[le(_o,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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]=tt(()=>{},["prevent"])),onDrop:w[23]||(w[23]=tt(S=>C(r).setExtraImage(S),["prevent"]))},[ne("div",LK,[RK,ne("div",DK,[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(()=>[je(" 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(()=>[je(" Clear Images ")]),_:1},8,["disabled"])])]),C(r).referenceImages.length>0?(z(),se("div",$K,[(z(!0),se(Ne,null,Nt(C(r).referenceImages,(S,x)=>(z(),se("div",{class:de(["reference-image-item",{"reference-file-item":!m(S)}]),key:S.id},[ne("span",BK,Ae(x+1),1),m(S)?(z(),be(C(sf),{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},Ae(S.name),9,FK),ne("div",zK,[le(C(Vn),{content:"Move up",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",icon:C(y_),disabled:x===0,onClick:k=>C(r).moveExtraImage(x,-1)},null,8,["icon","disabled","onClick"])]),_:2},1024),le(C(Vn),{content:"Move down",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",icon:C(Il),disabled:x===C(r).referenceImages.length-1,onClick:k=>C(r).moveExtraImage(x,1)},null,8,["icon","disabled","onClick"])]),_:2},1024),le(C(Vn),{content:"Remove",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",type:"danger",icon:C(Rl),plain:"",onClick:k=>C(r).removeExtraImage(x)},null,8,["icon","onClick"])]),_:2},1024)])],2))),128))])):(z(),se("div",NK," No reference images selected. "))],32),le(C(T0),null,{default:he(()=>[le(C(lo),{span:C(n)?24:12},{default:he(()=>[le(nd,{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(lo),{span:C(n)?24:12},{default:he(()=>[C(r).generatorType==="Img2Img"?(z(),be(nd,{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(nd,{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",jK,[le(C(at),{onClick:w[27]||(w[27]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:he(()=>[je("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 "+Ae(C(r).totalImageCount)+" image"+Ae(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()})},{default:he(()=>[je("Cancel all")]),_:1},8,["disabled"])):ye("",!0)]),ne("div",VK,[le(C(S$),{class:"center-both generated-image"},{default:he(()=>[!C(r).generating&&C(r).outputs.length==0?(z(),se("div",UK,[/Inpainting/.test(C(r).generatorType)?(z(),be(ty,{key:0})):ye("",!0),/Img2Img/.test(C(r).generatorType)?(z(),be(ty,{key:1})):ye("",!0)])):ye("",!0),!C(i).showGeneratedImages&&C(r).generating?(z(),be(FH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:c(C(r).timer.seconds),onShowGenerated:w[30]||(w[30]=S=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):ye("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(z(),be(iW,{key:2})):ye("",!0)]),_:1}),C(r).lastImageRecoveryAvailable?(z(),be(C(uN),{key:0,class:"last-image-recovery",href:C(r).lastImageRecoveryUrl,target:"_blank",type:"primary",onClick:w[31]||(w[31]=tt(S=>C(r).openLastImageRecovery(),["prevent"]))},{default:he(()=>[je(" Recover last generated image ")]),_:1},8,["href"])):ye("",!0)])]),_:1},8,["model","rules"]))])],64))}});const Us=gT({history:Lk("./"),routes:[{path:"/",name:"generate",component:HK},{path:"/images",name:"images",component:()=>td(()=>Promise.resolve().then(()=>qG),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>td(()=>Promise.resolve().then(()=>uq),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>td(()=>Promise.resolve().then(()=>yq),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function WK(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 Iu(){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 pC(){return Math.floor(Math.random()*9999999)+1}function YK(){return Math.floor(Math.random()*9e5+1e5).toString()}const en=Wo("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=oe("Text2Img"),r=oe(""),i=fn("promptHistory",[]),l=oe(""),g=fn("negativeLibrary",[]),o=oe(Iu()),a=oe({interval:0,seconds:0}),u=oe({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}}),d=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=oe({...d(),sourceProcessing:"inpainting"}),f=oe({...d(),sourceProcessing:"img2img"}),s=Ce=>Ce==="Inpainting"?c.value:Ce==="Img2Img"?f.value:d(),h=ee(()=>s(n.value)),v=oe(""),m=oe(!1),y=oe(!1),b=oe([]),_=oe(null),w=oe([]),S=fn("lastImageGenkey",""),x=ee(()=>S.value?`${Rt().baseURL.length===0?".":Rt().baseURL.replace(/\/+$/,"")}/sdapi/v1/get_last.png?genkey=${encodeURIComponent(S.value)}`:""),k=ee(()=>x.value!==""&&!m.value);function E(){S.value=""}function I(){!x.value||(window.open(x.value,"_blank","noopener"),E())}const D=oe(64),N=ee(()=>Rt().allowLargerParams==="Enabled"?3072:1024),L=oe(1),F=oe(20),O=oe(1),V=ee(()=>Rt().allowLargerParams==="Enabled"?150:50),re=oe(1),J=oe(24),ue=oe(0),M=oe(1),H=oe(0),R=oe(1),P=oe(0),Q=oe(10),j=oe(1),A=ee(()=>Rt().allowLargerParams==="Enabled"?400:200),q=oe(16),G=ee(()=>Rt().allowLargerParams==="Enabled"?32:24),te=(Ce,Ye,Je)=>Array.from({length:(Ye-Ce+1)/Je},(Qe,Pt)=>(Pt+Ce)*Je),fe=oe(te(P.value,Q.value,1)),pe=oe(te(re.value,J.value,.5)),ve=ee(()=>{const Ce=(Sr,$n,os=1)=>Sr*($n.state==="Multiple"&&$n.selected.length>0?$n.selected.length:os),Je=o.value.n*ae().length,Qe=Ce(Je,u.value.sampler),Pt=Ce(Qe,u.value.scheduler),Ze=Ce(Pt,u.value.steps),Kt=Ce(Ze,u.value.guidance);return Ce(Kt,u.value.clipSkip)});function U(){return o.value=Iu(),c.value=d(),f.value=d(),b.value=[],Ut().showGeneratedImages=!1,Y(),E(),!0}function Y(){w.value=[]}function T(){b.value=[]}async function X(){const Ce=Rt(),Ye=Ce.baseURL.length===0?".":Ce.baseURL,Je=await fetch(`${Ye}/sdapi/v1/loras`),Qe=await Je.json();return ec(Je,Qe,200,"Failed to get available LoRAs")?Qe:[]}async function W(Ce){var Dm;if(!e.includes(Ce))return[];if(r.value==="")return B("Failed to generate: No prompt submitted.");const Ye=zs(),Je=Ut();Ye.saveImages();const{sourceImage:Qe,maskImage:Pt,sourceProcessing:Ze}=s(Ce);ht(r.value);const Kt=[],Sr=ae().map(et=>{const Vt=et.split(" ### ");return{full_prompt:et,prompt:Vt[0],negative_prompt:Vt[1]||""}}).map(et=>{const[Vt,Ur]=WK(et.prompt);return{...et,prompt:Vt,extractedLoras:Ur}}),$n=Sr.some(et=>et.extractedLoras.length>0)?await X():[],os=Sr.map(({extractedLoras:et,...Vt})=>{const Ur=et.length>0&&$n.length>0?et.map(lr=>{const ra=$n.find(ia=>ia.name===lr.name||ia.path===lr.name);return{path:ra?ra.path:lr.name,multiplier:lr.multiplier,...lr.is_high_noise?{is_high_noise:!0}:{}}}):[];return{...Vt,...Ur.length>0?{lora:Ur}:{}}}),{seed:wi,cfg_scale:qn,eta:Mm,steps:Vr,clip_skip:wC,sampler_name:CC,scheduler:SC,n:xC,...Ql}=o.value,yf=parseInt(wi.toString()),kC=isNaN(yf)||yf<0?pC():yf,TC=Array.from({length:xC},(et,Vt)=>kC+Vt),io=(et,Vt)=>et.state==="Disabled"?[]:et.state==="Enabled"?[Vt]:et.state==="Multiple"&&et.selected.length===0?[]:et.selected,EC={promptVariant:os,seed:TC,cfg_scale:io(u.value.guidance,qn),eta:io(u.value.eta,Mm),steps:io(u.value.steps,Vr),clip_skip:io(u.value.clipSkip,wC),sampler_name:io(u.value.sampler,CC),scheduler:io(u.value.scheduler,SC)},OC=(et=>Object.entries(et).filter(([Ur,lr])=>lr.length>0).reduce((Ur,[lr,ra])=>{const ia=[];for(const Jt of Ur)for(const eu of ra)ia.push({...Jt,[lr]:eu});return ia},[{}]))(EC),AC=[await Te()];for(const et of OC){const{promptVariant:{full_prompt:Vt,...Ur},...lr}=et,ra=Ce==="Img2Img"?Ql.send_as_refimg:!1,ia=ra&&Ql.frames>1?Ql.reverse_refimg:!1;let Jt={prompt:Vt,params:{...Ql,send_as_refimg:ra,reverse_refimg:ia,...lr,...Ur,init_images:Qe?[Qe.split(",")[1]]:[],mask:Pt,inpainting_mask_invert:Pt?0:null,inpainting_fill:Pt?1:null},source_image:Qe==null?void 0:Qe.split(",")[1],source_mask:Pt,source_processing:Ze,models:AC};Jt.params.sampler_name=="default"&&delete Jt.params.sampler_name,Jt.params.scheduler=="default"&&delete Jt.params.scheduler,!Jt.params.frames||Jt.params.frames<=1?(delete Jt.params.frames,delete Jt.params.fps):Jt.params.fps=Math.min(G.value,Math.max(q.value,Math.round(Number(Jt.params.fps)||Iu().fps)));const eu=an.value.map(PC=>PC.base64);eu.length>0&&(Jt.params.extra_images=eu),Rt().alsoRequestAvi==="Enabled"&&Jt.params.frames&&Jt.params.frames>1&&(Jt.params.video_output_type=2),Rt().keepImageGenOnDisconnect==="Enabled"&&(Jt.params.kcpp_extra_args={keep_image_gen_on_disconnect:!0}),Kt.push(Jt)}let Lm=!1;m.value||(Lm=!0,b.value=[]),m.value=!0,Je.showGeneratedImages=!1;let Rm=w.value.filter(et=>!et.gathered&&!et.failed).length;for(let et=0;et{a.value.seconds++},1e3);!w.value.every(et=>et.gathered||et.failed)&&!y.value;){const et=w.value.find(Vt=>!Vt.gathered&&!Vt.failed);if(!et)break;et.gathered=!0;try{const Vt=await ge(et.params,(Dm=_.value)==null?void 0:Dm.signal);if(!Vt){et.failed=!0;continue}$([{...Vt,...et}])}catch(Vt){et.failed=!0,console.error("Error fetching image:",Vt)}}w.value.some(et=>et.failed)&&w.value.every(et=>et.gathered||et.failed)&&(m.value=!1,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0)}}async function $(Ce){const Ye=ja();console.log(Ce);const Je=await Promise.all(Ce.map(async Ze=>{const Kt=Ze.images[0],Sr=!!Ze.animated?"gif":"png",$n=Ze.extra_data?`data:video/avi;base64,${Ze.extra_data}`:"",os=Ze.final_frame?`data:image/jpeg;base64,${Ze.final_frame}`:"";let wi={id:-1,image:`data:image/${Sr};base64,${Kt}`,prompt:Ze.prompt,modelName:Ze.models[0],frames:Ze.params.frames,fps:Ze.params.fps,extra_avi:$n,final_frame:os,enable_hr:Ze.params.enable_hr,send_as_refimg:Ze.params.send_as_refimg,reverse_refimg:Ze.params.reverse_refimg,lora_meta:""};if(Ze.info&&typeof Ze.info=="string"&&Ze.info.trim()!=="")try{const qn=JSON.parse(Ze.info);["seed","steps","sampler_name","cfg_scale","eta","width","height","clip_skip","fps"].forEach(Vr=>{qn[Vr]!=null&&qn[Vr]!=null?wi[Vr]=qn[Vr]:Ze.params[Vr]!=null&&(wi[Vr]=Ze.params[Vr])}),qn.extra_generation_params&&qn.extra_generation_params["Schedule type"]?wi.scheduler=qn.extra_generation_params["Schedule type"]:wi.scheduler=Ze.params.scheduler,qn.lora_meta&&(wi.lora_meta=qn.lora_meta)}catch(qn){console.warn("Failed to parse info JSON:",qn)}return wi})),Qe=await Ye.pushOutputs(Je),Pt=0;return b.value=[...Qe.map(Ze=>({type:"image",index:Pt,output:Ze})),...b.value].sort((Ze,Kt)=>Ze.index-Kt.index),b.value.length===w.value.length&&(w.value=[],m.value=!1,Ut().showGeneratedImages=!0,E(),clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),Je}async function B(Ce){const Ye=Ut();return Ce&&Ye.raiseError(Ce,!1),[]}function K(Ce,Ye,Je,Qe){return Ye<=Je?Ye:(Ut().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${Ce}' to its default value instead of ${Ye}.`,!0),Qe)}async function ce(Ce,Ye=!0){const Je=Iu();if(n.value="Text2Img",u.value.guidance.state="Enabled",u.value.sampler.state="Enabled",u.value.steps.state="Enabled",u.value.clipSkip.state="Disabled",u.value.scheduler.state="Enabled",Us.push("/"),Ye&&(Ce.width=Ce.width||Je.width,Ce.height=Ce.height||Je.height),Ce.prompt){const Qe=Ce.prompt.split(" ### ");r.value=Qe[0],l.value=Qe[1]||""}if(Ce.sampler_name){o.value.sampler_name=Ce.sampler_name;const Pt=(await Re()).find(Ze=>Ze.aliases&&Ze.aliases.includes(Ce.sampler_name));Pt&&(o.value.sampler_name=Pt.name)}Ce.steps&&(o.value.steps=K("steps",Ce.steps,V.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=K("width",Ce.width,N.value,Je.width)),Ce.height&&(o.value.height=K("height",Ce.height,N.value,Je.height)),Ce.seed&&(o.value.seed=Ce.seed),Ce.clip_skip&&(o.value.clip_skip=K("clip_skip",Ce.clip_skip,Q.value,Je.clip_skip)),Ce.scheduler&&(o.value.scheduler=Ce.scheduler),Ce.frames&&(o.value.frames=K("frames",Ce.frames,A.value,Je.frames)),Ce.fps&&(o.value.fps=Math.min(G.value,Math.max(q.value,Math.round(K("fps",Ce.fps,G.value,Je.fps)))))}function ie(Ce){const Ye=zs();n.value="Img2Img",f.value.sourceImage=Ce,Ye.drawing=!1,b.value=[],Us.push("/"),Qn.fabric.Image.fromURL(Ce,Ye.newImage)}function Z(Ce){const Ye=zs();b.value=[],c.value.sourceImage=Ce,n.value="Inpainting",Us.push("/"),Qn.fabric.Image.fromURL(Ce,Ye.newImage)}function me(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function ae(){const Ce=me(),Ye=Ce.match(/\{(.*?)\}/g)||[];if(Ye.length===0)return[Ce];let Je=[];return Ye.forEach(Qe=>{const Pt=[],Ze=Qe.replace("{","").replace("}","").split("|");Je.length===0?Ze.forEach(Kt=>{const _n=Ce.replace(Qe,Kt);Pt.push(_n)}):Je.forEach(Kt=>{Ze.forEach(_n=>{const Sr=Kt.replace(Qe,_n);Pt.push(Sr)})}),Je=[...Pt]}),Je}async function ge(Ce,Ye){const Je=Rt();try{const Qe=YK();S.value=Qe;const Pt={...Ce,genkey:Qe},Ze=await fetch(`${Je.baseURL.length===0?".":Je.baseURL}/sdapi/v1/${Ce.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Pt),signal:Ye}),Kt=await Ze.json();return ec(Ze,Kt,200,"Failed to fetch",we)?Kt:!1}catch{return!1}}function we(Ce){return Ut().raiseError(Ce,!1),y.value=!1,b.value=[],!1}async function Te(){const Ce=Rt(),Ye=await fetch(`${Ce.baseURL.length===0?".":Ce.baseURL}/sdapi/v1/sd-models`),Je=await Ye.json();if(!!ec(Ye,Je,200,"Failed to get available models"))return Je.length===0?"(No model loaded)":Je[0].model_name}const Oe=oe(0),$e=new Map;function _e(){$e.clear(),Oe.value++}ke(()=>Rt().baseURL,()=>{_e()});async function Se(Ce){const Ye=Rt(),Qe=((Ye.baseURL.length===0?".":Ye.baseURL).replace(/\/+$/,"")||".")+"/"+Ce.replace(/^\/+/,"");if($e.has(Qe))return $e.get(Qe);const Pt=(async()=>{try{const Ze=await fetch(Qe);if(Ze.ok)return await Ze.json();console.error(`API Error: ${Ze.status} ${Ze.statusText} at ${Qe}`)}catch(Ze){console.error(`Fetch error for ${Qe}:`,Ze)}return $e.delete(Qe),null})();return $e.set(Qe,Pt),Pt}async function Re(){const Ce=await Se("/sdapi/v1/samplers");return Array.isArray(Ce)?Ce:[]}async function De(){const Ce=await Se("/sdapi/v1/schedulers");return Array.isArray(Ce)?Ce:[]}function yt(Ce){g.value.indexOf(Ce)===-1&&(g.value=[...g.value,Ce])}function bt(Ce){g.value=g.value.filter(Ye=>Ye!=Ce)}function ht(Ce){if(i.value.findIndex(Ye=>Ye.prompt===Ce)===-1){if(i.value.length>=10+i.value.filter(Ye=>Ye.starred).length){const Ye=i.value.filter(Qe=>!Qe.starred),Je=i.value.findIndex(Qe=>Qe===Ye[Ye.length-1]);i.value.splice(Je,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:Ce}]}}function rn(Ce){i.value=i.value.filter(Ye=>Ye.prompt!=Ce&&Ye!=Ce)}function cn(){return!1}const an=oe([]);async function bn(Ce){var Ze,Kt;const Ye=Ce.target,Je=(Kt=Ye.files)!=null?Kt:(Ze=Ce.dataTransfer)==null?void 0:Ze.files,Qe=Array.from(Je!=null?Je:[]);if(Qe.length===0)return;const Pt=await Promise.all(Qe.map(async(_n,Sr)=>{const $n=await Ic(_n);return{id:`${Date.now()}-${Sr}-${_n.name}`,name:_n.name,size:_n.size,dataUrl:$n,base64:$n.includes("data:image")?$n.split(",")[1]:$n}}));an.value||(an.value=[]);for(let _n=0;_n=an.value.length)return;const Qe=[...an.value],[Pt]=Qe.splice(Ce,1);Qe.splice(Je,0,Pt),an.value=Qe}function ro(){an.value=[];const Ce=document.getElementById("extra_image_input");Ce&&(Ce.value="")}return{generatorType:n,prompt:r,params:o,outputs:b,inpainting:c,img2img:f,uploadDimensions:v,cancelled:y,abortController:_,multiSelect:u,referenceImages:an,negativePrompt:l,generating:m,negativePromptLibrary:g,minDimensions:D,maxDimensions:N,minImages:L,maxImages:F,minSteps:O,maxSteps:V,minCfgScale:re,maxCfgScale:J,minDenoise:H,maxDenoise:R,minClipSkip:P,maxClipSkip:Q,minFrames:j,maxFrames:A,minFps:q,maxFps:G,minEta:ue,maxEta:M,clipSkipList:fe,cfgList:pe,queue:w,promptHistory:i,timer:a,lastImageGenkey:S,lastImageRecoveryUrl:x,lastImageRecoveryAvailable:k,clearLastImageGenkey:E,openLastImageRecovery:I,validGeneratorTypes:e,sourceGeneratorTypes:t,currentImageProps:h,totalImageCount:ve,generateImage:W,generateText2Img:ce,generateImg2Img:ie,generateInpainting:Z,getPrompt:cn,resetStore:U,clearQueue:Y,clearOutputs:T,pushToNegativeLibrary:yt,removeFromNegativeLibrary:bt,pushToPromptHistory:ht,removeFromPromptHistory:rn,setExtraImage:bn,removeExtraImage:Gn,moveExtraImage:na,clearExtraImage:ro,getAvailableSamplers:Re,getAvailableSchedulers:De,cacheVersion:Oe,invalidateApiCaches:_e,getCachedEndpoint:Se}});"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}});var vf=e=>new DataView(new ArrayBuffer(e)),no=e=>new Uint8Array(e.buffer||e),wo=e=>new TextEncoder().encode(String(e));function XK(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:wo(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:no(e)};if(Symbol.asyncIterator in e)return{t,o:mC(e)};throw new TypeError("Unsupported input format.")}function mC(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=KK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function KK(e){return typeof e=="string"?wo(e):e instanceof Uint8Array?e:no(e)}function GK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=wo(t)),e instanceof File)return{i:t||wo(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||wo(g),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:wo(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 qK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:ZK,m:JK}=qK.exports,QK=no(JK).subarray(65536);function Uy(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))QK.set(n),t=ZK(n.length,t);return t}function gC(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 eG(e){const t=vf(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),gC(e.t,t,10),t.setUint16(26,e.i.length,1),no(t)}async function*tG(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=Uy(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=Uy(r,e.u),e.A+=r.length,yield r}}}function nG(e){const t=vf(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),no(t)}function rG(e,t){const n=vf(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),gC(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),no(n)}function iG(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function aG(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(mC(async function*(r){const i=[];let l=0,g=0;for await(const u of r)yield eG(u),yield u.i,yield*tG(u),yield nG(u),i.push(rG(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=vf(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 no(a)}(async function*(r){for await(const i of r){const[l,g]=iG(i);yield Object.assign(XK(...g),GK(...l))}}(e))),{headers:n})}async function vC(e,t=!0,n){const r=Rt();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 ka(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await ka(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await ka(u,"image/gif")}):i.push({name:f+".webp",input:await ka(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await aG(i).blob(),g=document.createElement("a");g.href=URL.createObjectURL(l),g.download="sdui_images.zip",g.click()}async function yC(e,t){const n=Rt(),r=document.createElement("a");let i,l=n.imageDownloadType;e.startsWith("data:image/gif")&&(l="GIF"),l==="PNG"?(i=await ka(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):l==="JPG"?(i=await ka(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):l==="GIF"?(i=await ka(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 bC(e,t){const n=e;if(!n)return;const r=atob(n),i=r.length,l=new Uint8Array(i);for(let u=0;u{Rw.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`;bC(u,d);return}else yC(a.image,`${a.seed}-${a.prompt}`)},g=()=>{en().clearOutputs(),Ut().showGeneratedImages=!1,en().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(cK(s)))),await navigator.clipboard.writeText(f),qi({type:"success",message:"Copied shareable link to clipboard"})}return(a,u)=>(z(),se(Ne,null,[le(C(at),{class:"compact-button",onClick:i,type:"danger",size:"small",icon:C(Rl),plain:""},{default:he(()=>[je("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(el),plain:""},{default:he(()=>[je("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(O4),plain:""},{default:he(()=>[je("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(E_),plain:""},{default:he(()=>[je("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(()=>[je("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(()=>[je("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(()=>[je("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(()=>[je("Dismiss")]),_:1})):ye("",!0),le(C(at),{class:"compact-button",onClick:u[7]||(u[7]=d=>o(e.imageData)),type:"success",icon:C(U3),size:"small",plain:""},{default:he(()=>[je("Share")]),_:1},8,["icon"])],64))}});const _C=Zt(oG,[["__scopeId","data-v-663d89e3"]]),sG={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},lG=["src"],uG={style:{"font-size":"16px","font-weight":"500"}},cG={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},fG={key:0},dG={key:1},hG=ne("br",null,null,-1),pG={key:0},mG=["onClick"],gG={key:1},vG=["onClick"],yG={key:2},bG=["onClick"],_G=Ee({__name:"ImageDialog",setup(e){const t=ja(),n=Ut(),r=oe();yM(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=oe(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 jt.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;en().generateImg2Img(d)}function a(){var d;!((d=l.value)!=null&&d.image)||yC(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`;bC(d,c)}return(d,c)=>{var f;return z(),be(C(JB),{"model-value":C(i),width:(f=l.value)==null?void 0:f.width,class:"image-viewer",onClosed:g,"align-center":""},{footer:he(()=>[le(_C,{"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",sG,[(s=l.value)!=null&&s.image?(z(),se("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,lG)):ye("",!0)])],512),ne("div",uG,Ae(((h=l.value.prompt)==null?void 0:h.split("###")[0])||"Unknown Creation"),1),ne("div",cG,[ne("div",null,"Negative Prompt: "+Ae(((v=l.value.prompt)==null?void 0:v.split("###")[1])||"None"),1),ne("span",null,"Model: "+Ae(l.value.modelName||"Unknown")+" - ",1),ne("span",null,"Sampler: "+Ae(l.value.sampler_name||"Unknown")+" - ",1),ne("span",null,"Scheduler: "+Ae(l.value.scheduler||"Unknown")+" - ",1),ne("span",null,"Seed: "+Ae(l.value.seed||"Unknown")+" - ",1),ne("span",null,"Steps: "+Ae(l.value.steps||"Unknown")+" - ",1),ne("span",null,"CFG Scale: "+Ae(l.value.cfg_scale||"Unknown")+" - ",1),ne("span",null,"Clip Skip: "+Ae((m=l.value.clip_skip)!=null?m:"Unknown")+" - ",1),ne("span",null,"Dimensions: "+Ae(l.value.width||"???")+"x"+Ae(l.value.height||"???")+" - ",1),ne("span",null,"Frames: "+Ae(l.value.frames||"1"),1),l.value.frames&&l.value.frames>1?(z(),se("span",fG," - FPS: "+Ae(l.value.fps||"Unknown"),1)):ye("",!0),l.value.lora_meta?(z(),se("span",dG," - LoRA: "+Ae(l.value.lora_meta),1)):ye("",!0),hG,ne("b",null,[l.value.frames&&l.value.frames>1?(z(),se("span",pG,[ne("a",{href:"#",onClick:tt(a,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download GIF]",8,mG)])):ye("",!0),l.value.extra_avi?(z(),se("span",gG,[je(" - "),ne("a",{href:"#",onClick:tt(u,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download AVI]",8,vG)])):ye("",!0),l.value.final_frame?(z(),se("span",yG,[je(" - "),ne("a",{href:"#",onClick:tt(o,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Extend Video]",8,bG)])):ye("",!0)])])]}),_:1},8,["model-value","width"])}}});const wG=e=>(hi("data-v-8f4d2380"),e=e(),pi(),e),CG=wG(()=>ne("div",{style:{"font-size":"20px"}},"Stable UI",-1)),SG={class:"generator-icons"},xG=Ee({__name:"App",setup(e){const n=Lp(Mp).smallerOrEqual("md"),r=Ut();Rt();const i=yT(),l=oe();return ke(()=>i.path,g=>{l.value&&l.value.open(g)}),(g,o)=>(z(),se(Ne,null,[ne("div",{class:de({"menu-container":!C(n)})},[le(C(Cw),{"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(Gp),{key:0,class:"remove-item-styling center-vertical"},{title:he(()=>[CG]),_:1})),le(ps,{isMobile:C(n),index:"/"},{icon:he(()=>[ne("div",SG,[le(C(Me),null,{default:he(()=>[le(C(OO))]),_:1}),C(r).showGeneratorBadge?(z(),be(C(Me),{key:0,class:"generator-badge",size:10},{default:he(()=>[le(mH)]),_:1})):ye("",!0)])]),title:he(()=>[je("Generate")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/images"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(oO))]),_:1})]),title:he(()=>[je("Images")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/about"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(S_))]),_:1})]),title:he(()=>[je("About")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/options"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(z4))]),_:1})]),title:he(()=>[je("Options")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/return"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(b_))]),_:1})]),title:he(()=>[je("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),ne("div",{class:de({view:!C(n)})},[le(C(v_))],2),le(_G)],64))}});const kG=Zt(xG,[["__scopeId","data-v-8f4d2380"]]);const Im=lk(kG);Im.use(fk());Im.use(Us);Im.mount("#app");Us.replace("/");window.addEventListener("beforeunload",e=>{en().generating&&(e.preventDefault(),e.returnValue="")});const TG={key:1,class:"image-action"},EG=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=Ut(),r=oe(null);G8(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=oe(!1);vM(r,([{isIntersecting:g}])=>{g&&(i.value=g)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(g,o)=>(z(),se("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(z(),be(C(sf),{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(),se("div",TG,[e.imageData.starred?(z(),be(C(Me),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:he(()=>[le(C(E_))]),_:1})):ye("",!0),C(n).multiSelect?(z(),se("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(Me),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:he(()=>[C(l)?ye("",!0):(z(),be(C(Ll),{key:0})),C(l)?(z(),be(C(w_),{key:1})):ye("",!0)]),_:1},8,["color"])])):ye("",!0)])):ye("",!0)],512))}});const Hy=Zt(EG,[["__scopeId","data-v-b9569bbd"]]);function OG({mobileWidth:e=768,hideAfterDistanceFromTop:t=100,hideAfterScroll:n=100}={}){const{width:r}=d1(),i=ee(()=>r.value<=e),l=oe(!0),{y:g}=gM(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 AG={},PG={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},IG=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),MG=[IG];function LG(e,t){return z(),se("svg",PG,MG)}const RG=Zt(AG,[["render",LG]]),DG=e=>(hi("data-v-b39b47c5"),e=e(),pi(),e),$G={class:"options"},BG=["onClick"],FG=["onClick"],zG=["onClick"],NG={key:1,class:"center-both",style:{gap:"12px"}},jG={key:2},VG=DG(()=>ne("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),UG=[VG],HG={key:0},WG={key:0,style:{display:"flex",gap:"8px"}},YG={key:1,class:"images"},XG={key:1},KG=Ee({__name:"ImagesView",setup(e){const{width:t}=d1(),{isVisible:n,isMobile:r}=OG(),i=ja(),l=Rt(),g=Ut();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 jt.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=()=>{Rw.confirm(`This action will permanently delete ${g.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{i.deleteMultipleOutputs(g.selected)})};xv(["a","A","ArrowLeft"],g.openModalToLeft),xv(["d","D","ArrowRight"],g.openModalToRight);async function f(){vC(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(),se(Ne,null,[ne("div",{class:de(["images-top-bar",{"mobile-hidden":C(r)&&!C(n)}])},[ne("div",$G,[le(C(gu),{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(Me),{size:16},{default:he(()=>[le(C(v4))]),_:1})]),_:1})]),default:he(()=>[(z(),se(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":""}`)},Ae(m),11,BG)),64))]),_:1}),le(C(gu),{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(Me),{size:16},{default:he(()=>[le(C(b3))]),_:1})]),_:1})]),default:he(()=>[(z(),se(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":""}`)},Ae(C(i).filterBy===m?"Showing":"Show")+" "+Ae(m),11,FG)),64))]),_:1}),le(C(gu),{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(Me),{size:16},{default:he(()=>[le(RG)]),_:1})]),_:1})]),default:he(()=>[(z(),se(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":""}`)},Ae(m.label),11,zG)),64))]),_:1}),le(C(gu),{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(Me),{size:16},{default:he(()=>[C(g).multiSelect?(z(),be(C(w_),{key:0})):(z(),be(C(Ll),{key:1}))]),_:1})]),_:1})]),default:he(()=>[C(g).multiSelect?(z(),se("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(),se("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(),se("div",{key:2,class:"el-select-dropdown__item selected",onClick:d},"Deselect All")):(z(),se("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(),se("div",{key:5,class:"el-select-dropdown__item",onClick:o},"Select Page")):(z(),se("div",{key:4,class:"el-select-dropdown__item selected",onClick:u},"Deselect Page"))]),_:1})]),C(l).pageless==="Disabled"?(z(),be(C(A9),{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(),se("div",NG,[ne("div",null,Ae(C(g).selected.length)+" selected",1),le(C(at),{type:"danger",onClick:c,icon:C(Rl),plain:""},{default:he(()=>[je("Delete")]),_:1},8,["icon"]),le(C(at),{type:"success",onClick:f,icon:C(el),plain:"",style:{margin:"0"}},{default:he(()=>[je("Download")]),_:1},8,["icon"])])):(z(),se("div",jG,UG))],2),C(i).outputsLength!=0?(z(),se("div",HG,[C(i).currentLayout==="dynamic"?(z(),se("div",WG,[(z(!0),se(Ne,null,Nt(C(s),(m,y)=>(z(),se("div",{key:y,style:{flex:"1 1 0%"}},[(z(!0),se(Ne,null,Nt(m,b=>(z(),be(Hy,{key:b.id,"image-data":b,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):ye("",!0),C(i).currentLayout==="grid"?(z(),se("div",YG,[(z(!0),se(Ne,null,Nt(C(i).currentOutputs,m=>(z(),be(Hy,{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(),se("div",XG,[le(C(WF),{description:"No Images Found"})])):ye("",!0)],64))}});const GG=Zt(KG,[["__scopeId","data-v-b39b47c5"]]),qG=Object.freeze(Object.defineProperty({__proto__:null,default:GG},Symbol.toStringTag,{value:"Module"})),ZG=["href"],JG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=mt("router-link");return z(),se(Ne,null,[e.router?ye("",!0):(z(),se("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,ZG)),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 QG=Zt(JG,[["__scopeId","data-v-17b53b7d"]]),Jl=e=>(hi("data-v-ecc278c5"),e=e(),pi(),e),eq={class:"about"},tq={class:"about-content"},nq=Jl(()=>ne("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),rq=Jl(()=>ne("div",null,[je("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"),je(".")],-1)),iq=Jl(()=>ne("br",null,null,-1)),aq=Jl(()=>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)),oq=Jl(()=>ne("br",null,null,-1)),sq=Ee({__name:"AboutView",setup(e){return(t,n)=>(z(),se("div",eq,[ne("div",tq,[nq,rq,iq,aq,oq,ne("div",null,[je("You can find the KoboldAI community and authors of this fork on the "),le(QG,{href:"https://koboldai.org/discord"},{default:he(()=>[je("KoboldAI Discord")]),_:1})])])]))}});const lq=Zt(sq,[["__scopeId","data-v-ecc278c5"]]),uq=Object.freeze(Object.defineProperty({__proto__:null,default:lq},Symbol.toStringTag,{value:"Module"}));const ca=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(Ni),{prop:e.prop},{label:he(()=>[le(Xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(l.$slots,"label",{},()=>[je(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(Z$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:he(()=>[(z(!0),se(Ne,null,Nt(e.options,o=>(z(),be(C(J$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),as=e=>(hi("data-v-f1fab695"),e=e(),pi(),e),cq=as(()=>ne("h1",null,"Options",-1)),fq=as(()=>ne("h2",null,"Generation Options",-1)),dq=as(()=>ne("h3",null,"Parameter Controls",-1)),hq=as(()=>ne("h2",null,"Image Options",-1)),pq=as(()=>ne("div",null,[je("Drop file here OR "),ne("em",null,"click to upload")],-1)),mq=as(()=>ne("h2",null,"General Options",-1)),gq=Ee({__name:"OptionsView",setup(e){const t=Rt(),n=ja(),r=en(),i=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],l=oe([]),g=oe(),o=oe(!1),a=oe(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 jt.outputs.toCollection().primaryKeys();await vC(c,!1,()=>{a.value++}),o.value=!1,a.value=0}return(c,f)=>(z(),se(Ne,null,[cq,le(C(Xp),{"label-position":"top",model:C(t).options,onSubmit:f[11]||(f[11]=tt(()=>{},["prevent"]))},{default:he(()=>[le(C(Qj),{type:"border-card",style:{"min-height":"50vh"}},{default:he(()=>[le(C(Wf),{label:"\u{1F5A8}\uFE0F Generation"},{default:he(()=>[fq,le(C(Ni),{label:"Base URL"},{default:he(()=>[le(C(Qa),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":f[0]||(f[0]=s=>C(t).baseURL=s)},null,8,["modelValue"])]),_:1}),dq,(z(!0),se(Ne,null,Nt(C(r).multiSelect,(s,h)=>{var v;return z(),se("div",{key:h},[le(ca,{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(ca,{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(ca,{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(_o,{label:"Image Resize Mode",prop:"imageResizeMode",modelValue:C(t).imageResizeMode,"onUpdate:modelValue":f[3]||(f[3]=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(ca,{label:"Video Gen: Request AVI download",prop:"pageless",modelValue:C(t).alsoRequestAvi,"onUpdate:modelValue":f[4]||(f[4]=s=>C(t).alsoRequestAvi=s),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Wf),{label:"\u{1F4F7} Images"},{default:he(()=>[hq,le(Sn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":f[5]||(f[5]=s=>C(t).pageSize=s),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(ca,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":f[6]||(f[6]=s=>C(t).pageless=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(ca,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":f[7]||(f[7]=s=>C(t).autoCarousel=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(ca,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":f[8]||(f[8]=s=>C(t).imageDownloadType=s),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(Ni),{label:"Export Images (ZIP File)"},{default:he(()=>[o.value?(z(),be(C(at),{key:1,icon:C(el),disabled:""},{default:he(()=>[je("Downloading... ("+Ae(a.value)+" / "+Ae(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(z(),be(C(at),{key:0,icon:C(el),onClick:f[9]||(f[9]=s=>d())},{default:he(()=>[je("Download "+Ae(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(Ni),{label:"Import Images (ZIP File)"},{default:he(()=>[le(C(Jp),{drag:"",ref_key:"upload",ref:g,"auto-upload":!1,onChange:u,"file-list":l.value,limit:1,multiple:""},{default:he(()=>[le(C(Me),{size:100},{default:he(()=>[le(C(yp))]),_:1}),pq]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Wf),{label:"\u2699\uFE0F General"},{default:he(()=>[mq,le(_o,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":f[10]||(f[10]=s=>C(t).options.colorMode=s),options:i},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const vq=Zt(gq,[["__scopeId","data-v-f1fab695"]]),yq=Object.freeze(Object.defineProperty({__proto__:null,default:vq},Symbol.toStringTag,{value:"Module"})); +`&&h>0?(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=oe({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=oe({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>en().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>en().currentImageProps),g=ee({get:()=>i.value.drawing&&!r.value,set:P=>i.value.drawing=P}),o=oe(512),a=oe(512),u=oe(!1),d=oe(30),c=oe(!1),f=new Qn.fabric.Circle({radius:d.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=oe("Erase"),h=oe("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 Qn.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=en();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=F({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=F({layerHeight:q,layerWidth:A});const te=o.value*i.value.imageScale,fe=a.value*i.value.imageScale;Q.params.width=te-te%64,Q.params.height=fe-fe%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,fe=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,Y=0,T=P.width,X=P.height,W=0,$=0,B=pe.width,K=pe.height;switch(q){case"Stretch":break;case"ScaleAndCrop":{const ce=pe.width/te,ie=pe.height/fe;ce>ie?(X=pe.height/ce,Y=(P.height-X)/2):(T=pe.width/ie,U=(P.width-T)/2);break}case"ScaleAndPad":{const ce=pe.width/te,ie=pe.height/fe;ceQ?(T=Q,U=ce-Q/2):(B=te,W=Q/2-ce),fe>j?(X=j,Y=ie-j/2):(K=fe,$=j/2-ie);break}}return ve.drawImage(P,U,Y,T,X,W,$,B,K),pe}function I(){const P=en(),Q=Rt();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(),fe=E(te,j,A,q,G,te);if(l.value.sourceImage=fe.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=en();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=";Qn.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 F({image:P,layerWidth:Q,layerHeight:j}={}){const A=new Qn.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 Qn.fabric.Rect({width:Q||o.value,height:j||a.value,left:0,top:0,fill:A||"transparent",absolutePositioned:q||!0,selectable:!1});return new Qn.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=en();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=F(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 sW={},lW={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},uW=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),cW=[uW];function fW(e,t){return z(),se("svg",lW,cW)}const dW=Zt(sW,[["render",fW]]);async function hW(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 pW(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 hW(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 Cm=e=>(hi("data-v-7dc3b5bb"),e=e(),pi(),e),mW=Cm(()=>ne("div",null,[je("Drop file here, paste an image OR "),ne("em",null,"click to upload")],-1)),gW={key:0},vW=Cm(()=>ne("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),yW={class:"canvas-container"},bW=Cm(()=>ne("canvas",{id:"canvas"},null,-1)),_W={class:"action-buttons",style:{left:"10px",right:"unset"}},wW={class:"action-buttons"},CW=Ee({__name:"CustomCanvas",setup(e){const t=en(),n=Ut(),r=zs(),i=oe();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 Ic(a.raw);t.currentImageProps.sourceImage=u,r.drawing=!1,Qn.fabric.Image.fromURL(u,r.newImage)}function g(){t.currentImageProps.sourceImage="",r.resetCanvas()}rt(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Qn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage),window.addEventListener("paste",o)}),Xt(()=>{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(),se(Ne,null,[C(t).currentImageProps.sourceImage?ye("",!0):(z(),be(C(Jp),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:he(()=>[C(t).generatorType==="Img2Img"?(z(),se("div",gW,[vW,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(Me),{size:20,style:{"margin-right":"2px"}},{default:he(()=>[le(P2)]),_:1}),je("draw something")])])):ye("",!0)]),default:he(()=>[le(C(Me),{size:100},{default:he(()=>[le(C(yp))]),_:1}),mW]),_:1},512)),Et(ne("div",null,[ne("div",yW,[bW,ne("div",_W,[le(C(at),{onClick:u[1]||(u[1]=d=>C(r).undoAction()),icon:C(k_),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(T_),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),ne("div",wW,[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(Rl),plain:""},null,8,["icon"]),le(C(at),{onClick:u[4]||(u[4]=d=>C(r).downloadMask()),icon:C(el),plain:""},null,8,["icon"]),le(C(at),{onClick:u[5]||(u[5]=d=>C(r).flipErase()),icon:C(r).erasing?C(h3):dW,plain:""},null,8,["icon"]),C(r).drawing?(z(),be(C(RB),{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(Xp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:he(()=>[le(Sn,{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),[[Ht,C(t).currentImageProps.sourceImage]])],64))}});const ty=Zt(CW,[["__scopeId","data-v-7dc3b5bb"]]),SW={class:"centerIcons"},xW={class:"stackedIcons"},kW=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return Wx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(z(),se("div",SW,[ne("div",xW,[le(C(Me),{class:"firstIcon",size:e.size},{default:he(()=>[(z(),be(Ct(t.iconOne)))]),_:1},8,["size"]),le(C(Me),{class:"secondIcon",size:e.size},{default:he(()=>[(z(),be(Ct(t.iconTwo)))]),_:1},8,["size"])])]))}});const TW=Zt(kW,[["__scopeId","data-v-74586a39"]]),EW={key:1,style:{width:"40px"}},ku=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(z(),be(C(Vn),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:he(()=>[le(C(Gp),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:he(()=>[e.iconTwo?(z(),be(TW,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(z(),se("div",EW,[le(C(Me),{style:{width:"35px"},size:40},{default:he(()=>[(z(),be(Ct(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const OW=4,ny=0,ry=1,AW=2;function ts(e){let t=e.length;for(;--t>=0;)e[t]=0}const PW=0,L2=1,IW=2,MW=3,LW=258,Sm=29,Kl=256,_l=Kl+1+Sm,Oo=30,xm=19,R2=2*_l+1,Ta=15,id=16,RW=7,km=256,D2=16,$2=17,B2=18,Lh=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]),Qu=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]),DW=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),F2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$W=512,Qr=new Array((_l+2)*2);ts(Qr);const Ns=new Array(Oo*2);ts(Ns);const wl=new Array($W);ts(wl);const Cl=new Array(LW-MW+1);ts(Cl);const Tm=new Array(Sm);ts(Tm);const Mc=new Array(Oo);ts(Mc);function ad(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 z2,N2,j2;function od(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const V2=e=>e<256?wl[e]:wl[256+(e>>>7)],Sl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},Pn=(e,t,n)=>{e.bi_valid>id-n?(e.bi_buf|=t<>id-e.bi_valid,e.bi_valid+=n-id):(e.bi_buf|=t<{Pn(e,n[t*2],n[t*2+1])},U2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},BW=e=>{e.bi_valid===16?(Sl(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)},FW=(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<=Ta;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--)}},H2=(e,t,n)=>{const r=new Array(Ta+1);let i=0,l,g;for(l=1;l<=Ta;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]=U2(r[o]++,o))}},zW=()=>{let e,t,n,r,i;const l=new Array(Ta+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t<_l;t++)e.dyn_ltree[t*2]=0;for(t=0;t{e.bi_valid>8?Sl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},iy=(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=Cl[i],Ar(e,g+Kl+1,t),o=Lh[g],o!==0&&(i-=Tm[g],Pn(e,i,o)),r--,g=V2(r),Ar(e,g,n),o=Qu[g],o!==0&&(r-=Mc[g],Pn(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=R2,g=0;g>1;g>=1;g--)sd(e,n,g);u=l;do g=e.heap[1],e.heap[1]=e.heap[e.heap_len--],sd(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++,sd(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],FW(e,t),H2(n,a,e.bl_count)},oy=(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(oy(e,e.dyn_ltree,e.l_desc.max_code),oy(e,e.dyn_dtree,e.d_desc.max_code),Rh(e,e.bl_desc),t=xm-1;t>=3&&e.bl_tree[F2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},jW=(e,t,n,r)=>{let i;for(Pn(e,t-257,5),Pn(e,n-1,5),Pn(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 ny;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return ry;for(n=32;n{ly||(zW(),ly=!0),e.l_desc=new od(e.dyn_ltree,z2),e.d_desc=new od(e.dyn_dtree,N2),e.bl_desc=new od(e.bl_tree,j2),e.bi_buf=0,e.bi_valid=0,W2(e)},X2=(e,t,n,r)=>{Pn(e,(PW<<1)+(r?1:0),3),Y2(e),Sl(e,n),Sl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},HW=e=>{Pn(e,L2<<1,3),Ar(e,km,Qr),BW(e)},WW=(e,t,n,r)=>{let i,l,g=0;e.level>0?(e.strm.data_type===AW&&(e.strm.data_type=VW(e)),Rh(e,e.l_desc),Rh(e,e.d_desc),g=NW(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?X2(e,t,n,r):e.strategy===OW||l===i?(Pn(e,(L2<<1)+(r?1:0),3),ay(e,Qr,Ns)):(Pn(e,(IW<<1)+(r?1:0),3),jW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,g+1),ay(e,e.dyn_ltree,e.dyn_dtree)),W2(e),r&&Y2(e)},YW=(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[(Cl[n]+Kl+1)*2]++,e.dyn_dtree[V2(t)*2]++),e.sym_next===e.sym_end);var XW=UW,KW=X2,GW=WW,qW=YW,ZW=HW,JW={_tr_init:XW,_tr_stored_block:KW,_tr_flush_block:GW,_tr_tally:qW,_tr_align:ZW};const QW=(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 xl=QW;const eY=()=>{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},tY=new Uint32Array(eY()),nY=(e,t,n,r)=>{const i=tY,l=r+n;e^=-1;for(let g=r;g>>8^i[(e^t[g])&255];return e^-1};var Qt=nY,Va={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"},ns={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:rY,_tr_stored_block:Dh,_tr_flush_block:iY,_tr_tally:ji,_tr_align:aY}=JW,{Z_NO_FLUSH:Vi,Z_PARTIAL_FLUSH:oY,Z_FULL_FLUSH:sY,Z_FINISH:er,Z_BLOCK:uy,Z_OK:on,Z_STREAM_END:cy,Z_STREAM_ERROR:Rr,Z_DATA_ERROR:lY,Z_BUF_ERROR:ld,Z_DEFAULT_COMPRESSION:uY,Z_FILTERED:cY,Z_HUFFMAN_ONLY:Tu,Z_RLE:fY,Z_FIXED:dY,Z_DEFAULT_STRATEGY:hY,Z_UNKNOWN:pY,Z_DEFLATED:pf}=ns,mY=9,gY=15,vY=8,yY=29,bY=256,$h=bY+1+yY,_Y=30,wY=19,CY=2*$h+1,SY=15,lt=3,Bi=258,Dr=Bi+lt+1,xY=32,Vo=42,Em=57,Bh=69,Fh=73,zh=91,Nh=103,Ea=113,ws=666,kn=1,rs=2,Ua=3,is=4,kY=3,Oa=(e,t)=>(e.msg=Va[t],t),fy=e=>e*2-(e>4?9:0),Ri=e=>{let t=e.length;for(;--t>=0;)e[t]=0},TY=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 EY=(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))},Hn=(e,t)=>{iY(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zn(e.strm)},pt=(e,t)=>{e.pending_buf[e.pending++]=t},ms=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},jh=(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=xl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Qt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},K2=(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+Bi;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},Uo=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),TY(e),r+=t),e.strm.avail_in===0)break;if(n=jh(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=Ui(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ui(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,zn(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&&(jh(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&&(jh(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===er)&&t!==Vi&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,g=t===er&&e.strm.avail_in===0&&r===i?1:0,Dh(e,e.block_start,r,g),e.block_start+=r,zn(e.strm)),g?Ua:kn)},ud=(e,t)=>{let n,r;for(;;){if(e.lookahead=lt&&(e.ins_h=Ui(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=K2(e,n)),e.match_length>=lt)if(r=ji(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=Ui(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=Ui(e,e.ins_h,e.window[e.strstart+1]);else r=ji(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Hn(e,!1),e.strm.avail_out===0))return kn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=lt&&(e.ins_h=Ui(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=ji(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=Ui(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&&(Hn(e,!1),e.strm.avail_out===0))return kn}else if(e.match_available){if(r=ji(e,0,e.window[e.strstart-1]),r&&Hn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return kn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=ji(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<=Bi){if(Uo(e),e.lookahead<=Bi&&t===Vi)return kn;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+Bi;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=ji(e,1,e.match_length-lt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=ji(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Hn(e,!1),e.strm.avail_out===0))return kn}return e.insert=0,t===er?(Hn(e,!0),e.strm.avail_out===0?Ua:is):e.sym_next&&(Hn(e,!1),e.strm.avail_out===0)?kn:rs},AY=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Uo(e),e.lookahead===0)){if(t===Vi)return kn;break}if(e.match_length=0,n=ji(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Hn(e,!1),e.strm.avail_out===0))return kn}return e.insert=0,t===er?(Hn(e,!0),e.strm.avail_out===0?Ua:is):e.sym_next&&(Hn(e,!1),e.strm.avail_out===0)?kn:rs};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 Cs=[new kr(0,0,0,0,G2),new kr(4,4,8,4,ud),new kr(4,5,16,8,ud),new kr(4,6,32,32,ud),new kr(4,4,16,16,ho),new kr(8,16,32,32,ho),new kr(8,16,128,128,ho),new kr(8,32,128,256,ho),new kr(32,128,258,1024,ho),new kr(32,258,258,4096,ho)],PY=e=>{e.window_size=2*e.w_size,Ri(e.head),e.max_lazy_match=Cs[e.level].max_lazy,e.good_match=Cs[e.level].good_length,e.nice_match=Cs[e.level].nice_length,e.max_chain_length=Cs[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 IY(){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=pf,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(CY*2),this.dyn_dtree=new Uint16Array((2*_Y+1)*2),this.bl_tree=new Uint16Array((2*wY+1)*2),Ri(this.dyn_ltree),Ri(this.dyn_dtree),Ri(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(SY+1),this.heap=new Uint16Array(2*$h+1),Ri(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$h+1),Ri(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 Gl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Vo&&t.status!==Em&&t.status!==Bh&&t.status!==Fh&&t.status!==zh&&t.status!==Nh&&t.status!==Ea&&t.status!==ws?1:0},q2=e=>{if(Gl(e))return Oa(e,Rr);e.total_in=e.total_out=0,e.data_type=pY;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Em:t.wrap?Vo:Ea,e.adler=t.wrap===2?0:1,t.last_flush=-2,rY(t),on},Z2=e=>{const t=q2(e);return t===on&&PY(e.state),t},MY=(e,t)=>Gl(e)||e.state.wrap!==2?Rr:(e.state.gzhead=t,on),J2=(e,t,n,r,i,l)=>{if(!e)return Rr;let g=1;if(t===uY&&(t=6),r<0?(g=0,r=-r):r>15&&(g=2,r-=16),i<1||i>mY||n!==pf||r<8||r>15||t<0||t>9||l<0||l>dY||r===8&&g!==1)return Oa(e,Rr);r===8&&(r=9);const o=new IY;return e.state=o,o.strm=e,o.status=Vo,o.wrap=g,o.gzhead=null,o.w_bits=r,o.w_size=1<J2(e,t,pf,gY,vY,hY),RY=(e,t)=>{if(Gl(e)||t>uy||t<0)return e?Oa(e,Rr):Rr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===ws&&t!==er)return Oa(e,e.avail_out===0?ld:Rr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(zn(e),e.avail_out===0)return n.last_flush=-1,on}else if(e.avail_in===0&&fy(t)<=fy(r)&&t!==er)return Oa(e,ld);if(n.status===ws&&e.avail_in!==0)return Oa(e,ld);if(n.status===Vo&&n.wrap===0&&(n.status=Ea),n.status===Vo){let i=pf+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=Tu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=xY),i+=31-i%31,ms(n,i),n.strstart!==0&&(ms(n,e.adler>>>16),ms(n,e.adler&65535)),e.adler=1,n.status=Ea,zn(e),n.pending!==0)return n.last_flush=-1,on}if(n.status===Em){if(e.adler=0,pt(n,31),pt(n,139),pt(n,8),n.gzhead)pt(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)),pt(n,n.gzhead.time&255),pt(n,n.gzhead.time>>8&255),pt(n,n.gzhead.time>>16&255),pt(n,n.gzhead.time>>24&255),pt(n,n.level===9?2:n.strategy>=Tu||n.level<2?4:0),pt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(pt(n,n.gzhead.extra.length&255),pt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Qt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Bh;else if(pt(n,0),pt(n,0),pt(n,0),pt(n,0),pt(n,0),pt(n,n.level===9?2:n.strategy>=Tu||n.level<2?4:0),pt(n,kY),n.status=Ea,zn(e),n.pending!==0)return n.last_flush=-1,on}if(n.status===Bh){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=Qt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,zn(e),n.pending!==0)return n.last_flush=-1,on;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=Qt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Fh}if(n.status===Fh){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=Qt(e.adler,n.pending_buf,n.pending-i,i)),zn(e),n.pending!==0)return n.last_flush=-1,on;i=0}n.gzindexi&&(e.adler=Qt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=zh}if(n.status===zh){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=Qt(e.adler,n.pending_buf,n.pending-i,i)),zn(e),n.pending!==0)return n.last_flush=-1,on;i=0}n.gzindexi&&(e.adler=Qt(e.adler,n.pending_buf,n.pending-i,i))}n.status=Nh}if(n.status===Nh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(zn(e),n.pending!==0))return n.last_flush=-1,on;pt(n,e.adler&255),pt(n,e.adler>>8&255),e.adler=0}if(n.status=Ea,zn(e),n.pending!==0)return n.last_flush=-1,on}if(e.avail_in!==0||n.lookahead!==0||t!==Vi&&n.status!==ws){let i=n.level===0?G2(n,t):n.strategy===Tu?AY(n,t):n.strategy===fY?OY(n,t):Cs[n.level].func(n,t);if((i===Ua||i===is)&&(n.status=ws),i===kn||i===Ua)return e.avail_out===0&&(n.last_flush=-1),on;if(i===rs&&(t===oY?aY(n):t!==uy&&(Dh(n,0,0,!1),t===sY&&(Ri(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),zn(e),e.avail_out===0))return n.last_flush=-1,on}return t!==er?on:n.wrap<=0?cy:(n.wrap===2?(pt(n,e.adler&255),pt(n,e.adler>>8&255),pt(n,e.adler>>16&255),pt(n,e.adler>>24&255),pt(n,e.total_in&255),pt(n,e.total_in>>8&255),pt(n,e.total_in>>16&255),pt(n,e.total_in>>24&255)):(ms(n,e.adler>>>16),ms(n,e.adler&65535)),zn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?on:cy)},DY=e=>{if(Gl(e))return Rr;const t=e.state.status;return e.state=null,t===Ea?Oa(e,lY):on},$Y=(e,t)=>{let n=t.length;if(Gl(e))return Rr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Vo||r.lookahead)return Rr;if(i===1&&(e.adler=xl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Ri(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,Uo(r);r.lookahead>=lt;){let a=r.strstart,u=r.lookahead-(lt-1);do r.ins_h=Ui(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,Uo(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,on};var BY=LY,FY=J2,zY=Z2,NY=q2,jY=MY,VY=RY,UY=DY,HY=$Y,WY="pako deflate (from Nodeca project)",js={deflateInit:BY,deflateInit2:FY,deflateReset:zY,deflateResetKeep:NY,deflateSetHeader:jY,deflate:VY,deflateEnd:UY,deflateSetDictionary:HY,deflateInfo:WY};const YY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var XY=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)YY(n,r)&&(e[r]=n[r])}}return e},KY=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;kl[254]=kl[254]=1;var GY=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 qY=(e,t)=>{if(t<65534&&e.subarray&&Q2)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 qY(l,i)},JY=(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+kl[e[n]]>t?n:t},Tl={string2buf:GY,buf2string:ZY,utf8border:JY};function QY(){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 eC=QY;const tC=Object.prototype.toString,{Z_NO_FLUSH:eX,Z_SYNC_FLUSH:tX,Z_FULL_FLUSH:nX,Z_FINISH:rX,Z_OK:Lc,Z_STREAM_END:iX,Z_DEFAULT_COMPRESSION:aX,Z_DEFAULT_STRATEGY:oX,Z_DEFLATED:sX}=ns;function ql(e){this.options=mf.assign({level:aX,method:sX,chunkSize:16384,windowBits:15,memLevel:8,strategy:oX},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 eC,this.strm.avail_out=0;let n=js.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Lc)throw new Error(Va[n]);if(t.header&&js.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Tl.string2buf(t.dictionary):tC.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=js.deflateSetDictionary(this.strm,r),n!==Lc)throw new Error(Va[n]);this._dict_set=!0}}ql.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?rX:eX,typeof e=="string"?n.input=Tl.string2buf(e):tC.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===tX||l===nX)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=js.deflate(n,l),i===iX)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=js.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Lc;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};ql.prototype.onData=function(e){this.chunks.push(e)};ql.prototype.onEnd=function(e){e===Lc&&(this.result=mf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Om(e,t){const n=new ql(t);if(n.push(e,!0),n.err)throw n.msg||Va[n.err];return n.result}function lX(e,t){return t=t||{},t.raw=!0,Om(e,t)}function uX(e,t){return t=t||{},t.gzip=!0,Om(e,t)}var cX=ql,fX=Om,dX=lX,hX=uX,pX=ns,mX={Deflate:cX,deflate:fX,deflateRaw:dX,gzip:hX,constants:pX};const Eu=16209,gX=16191;var vX=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=Eu;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=Eu;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(po+1),N=new Uint16Array(po+1);let L=null,F,O,V;for(u=0;u<=po;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===py||f!==1))return-1;for(N[1]=0,u=1;udy||e===my&&y>hy)return 1;for(;;){F=u-v,g[d]+1=I?(O=L[g[d]-I],V=E[g[d]-I]):(O=32+64,V=0),_=1<>v)+w]=F<<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<dy||e===my&&y>hy)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 Vs=CX;const SX=0,nC=1,rC=2,{Z_FINISH:gy,Z_BLOCK:xX,Z_TREES:Ou,Z_OK:Ha,Z_STREAM_END:kX,Z_NEED_DICT:TX,Z_STREAM_ERROR:or,Z_DATA_ERROR:iC,Z_MEM_ERROR:aC,Z_BUF_ERROR:EX,Z_DEFLATED:vy}=ns,gf=16180,yy=16181,by=16182,_y=16183,wy=16184,Cy=16185,Sy=16186,xy=16187,ky=16188,Ty=16189,Rc=16190,Xr=16191,fd=16192,Ey=16193,dd=16194,Oy=16195,Ay=16196,Py=16197,Iy=16198,Au=16199,Pu=16200,My=16201,Ly=16202,Ry=16203,Dy=16204,$y=16205,hd=16206,By=16207,Fy=16208,Ft=16209,oC=16210,sC=16211,OX=852,AX=592,PX=15,IX=PX,zy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function MX(){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 to=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modesC?1:0},lC=e=>{if(to(e))return or;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=gf,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(OX),t.distcode=t.distdyn=new Int32Array(AX),t.sane=1,t.back=-1,Ha},uC=e=>{if(to(e))return or;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,lC(e)},cC=(e,t)=>{let n;if(to(e))return or;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?or:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,uC(e))},fC=(e,t)=>{if(!e)return or;const n=new MX;e.state=n,n.strm=e,n.window=null,n.mode=gf;const r=cC(e,t);return r!==Ha&&(e.state=null),r},LX=e=>fC(e,IX);let Ny=!0,pd,md;const RX=e=>{if(Ny){pd=new Int32Array(512),md=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(Vs(nC,e.lens,0,288,pd,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Vs(rC,e.lens,0,32,md,0,e.work,{bits:5}),Ny=!1}e.lencode=pd,e.lenbits=9,e.distcode=md,e.distbits=5},dC=(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(to(e)||!e.output||!e.input&&e.avail_in!==0)return or;n=e.state,n.mode===Xr&&(n.mode=fd),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=Ha;e:for(;;)switch(n.mode){case gf:if(n.wrap===0){n.mode=fd;break}for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Qt(n.check,I,2,0),u=0,d=0,n.mode=yy;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)!==vy){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=Qt(n.check,I,2,0)),u=0,d=0,n.mode=by;case by: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=Qt(n.check,I,4,0)),u=0,d=0,n.mode=_y;case _y: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=Qt(n.check,I,2,0)),u=0,d=0,n.mode=wy;case wy:if(n.flags&1024){for(;d<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Qt(n.check,I,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=Cy;case Cy: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=Qt(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Sy;case Sy: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 Ty:for(;d<32;){if(o===0)break e;o--,u+=r[l++]<>>=d&7,d-=d&7,n.mode=hd;break}for(;d<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,d-=1,u&3){case 0:n.mode=Ey;break;case 1:if(RX(n),n.mode=Au,t===Ou){u>>>=2,d-=2;break e}break;case 2:n.mode=Ay;break;case 3:e.msg="invalid block type",n.mode=Ft}u>>>=2,d-=2;break;case Ey: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=dd,t===Ou)break e;case dd:n.mode=Oy;case Oy: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 Ay: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=Py;case Py: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=Vs(SX,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=Iy;case Iy: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=Vs(nC,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=Vs(rC,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=Au,t===Ou)break e;case Au:n.mode=Pu;case Pu: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,vX(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=$y;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=My;case My:if(n.extra){for(N=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Ly;case Ly: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=Ry;case Ry: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=Dy;case Dy: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=Pu);break;case $y:if(a===0)break e;i[g++]=n.length,a--,n.mode=Pu;break;case hd:if(n.wrap){for(;d<32;){if(o===0)break e;o--,u|=r[l++]<{if(to(e))return or;let t=e.state;return t.window&&(t.window=null),e.state=null,Ha},BX=(e,t)=>{if(to(e))return or;const n=e.state;return(n.wrap&2)===0?or:(n.head=t,t.done=!1,Ha)},FX=(e,t)=>{const n=t.length;let r,i,l;return to(e)||(r=e.state,r.wrap!==0&&r.mode!==Rc)?or:r.mode===Rc&&(i=1,i=xl(i,t,n,0),i!==r.check)?iC:(l=dC(e,t,n,n),l?(r.mode=oC,aC):(r.havedict=1,Ha))};var zX=uC,NX=cC,jX=lC,VX=LX,UX=fC,HX=DX,WX=$X,YX=BX,XX=FX,KX="pako inflate (from Nodeca project)",ei={inflateReset:zX,inflateReset2:NX,inflateResetKeep:jX,inflateInit:VX,inflateInit2:UX,inflate:HX,inflateEnd:WX,inflateGetHeader:YX,inflateSetDictionary:XX,inflateInfo:KX};function GX(){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 qX=GX;const hC=Object.prototype.toString,{Z_NO_FLUSH:ZX,Z_FINISH:JX,Z_OK:El,Z_STREAM_END:gd,Z_NEED_DICT:vd,Z_STREAM_ERROR:QX,Z_DATA_ERROR:jy,Z_MEM_ERROR:eK}=ns;function Zl(e){this.options=mf.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 eC,this.strm.avail_out=0;let n=ei.inflateInit2(this.strm,t.windowBits);if(n!==El)throw new Error(Va[n]);if(this.header=new qX,ei.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Tl.string2buf(t.dictionary):hC.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ei.inflateSetDictionary(this.strm,t.dictionary),n!==El)))throw new Error(Va[n])}Zl.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?JX:ZX,hC.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===vd&&i&&(l=ei.inflateSetDictionary(n,i),l===El?l=ei.inflate(n,g):l===jy&&(l=vd));n.avail_in>0&&l===gd&&n.state.wrap>0&&e[n.next_in]!==0;)ei.inflateReset(n),l=ei.inflate(n,g);switch(l){case QX:case jy:case vd:case eK:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===gd))if(this.options.to==="string"){let a=Tl.utf8border(n.output,n.next_out),u=n.next_out-a,d=Tl.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===El&&o===0)){if(l===gd)return l=ei.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Zl.prototype.onData=function(e){this.chunks.push(e)};Zl.prototype.onEnd=function(e){e===El&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=mf.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Am(e,t){const n=new Zl(t);if(n.push(e),n.err)throw n.msg||Va[n.err];return n.result}function tK(e,t){return t=t||{},t.raw=!0,Am(e,t)}var nK=Zl,rK=Am,iK=tK,aK=Am,oK=ns,sK={Inflate:nK,inflate:rK,inflateRaw:iK,ungzip:aK,constants:oK};const{Deflate:Cq,deflate:Sq,deflateRaw:lK,gzip:xq}=mX,{Inflate:kq,inflate:Tq,inflateRaw:uK,ungzip:Eq}=sK;var cK=lK,fK=uK;function Vy(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 dK=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=Vy(t);if(console.log("URL params:",n),n.get("share")){const l=fK(new Uint8Array(atob(n.get("share")).split("").map(g=>g.charCodeAt(0))),{to:"string"});if(!l){Ut().raiseError("Error when trying to decode share parameter!",!1);return}n=Vy(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"};en().generateText2Img(r,!1)},hK=10;function ec(e,t,n,r,i=l=>Ut().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})`)}const pK=Wo("interrogate",()=>{const e=oe({}),t=oe(!1);async function n(g){Ut().raiseError(g,!1),t.value=!1,e.value={}}async function r(){const g=Rt(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${g.baseURL.length===0?".":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();!ec(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}}),Pm=e=>(hi("data-v-db184ac6"),e=e(),pi(),e),mK={key:0,style:{"margin-top":"16px"}},gK=Pm(()=>ne("div",null,[je("Drop file here OR "),ne("em",null,"click to upload")],-1)),vK={key:1,style:{"margin-top":"16px"}},yK={key:2},bK={style:{"margin-top":"8px"}},_K=Pm(()=>ne("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),wK={key:0},CK=Pm(()=>ne("h3",null,"Caption",-1)),SK={key:0},xK={key:1},kK=Ee({__name:"InterrogationView",setup(e){const t=pK(),n=en(),r=Ut(),i=oe();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const d=await Ic(u.raw);t.currentInterrogation.source_image=d,t.interrogateImage()}function g(){n.generateText2Img({prompt:o.value})}const o=ee(()=>t.getFormStatus()),{ellipsis:a}=I2();return(u,d)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(z(),se("div",yK,[ne("div",bK,[le(C(at),{icon:C(zg),onClick:C(t).resetInterrogation},{default:he(()=>[je("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(z(),be(C(at),{key:0,icon:C(zg),onClick:g,disabled:!C(o)},{default:he(()=>[je("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):ye("",!0)]),_K,le(C(sf),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(z(),se("div",wK,[CK,C(o)?(z(),se("div",xK,[ne("strong",null,Ae(C(o)),1)])):(z(),se("div",SK,"Processing"+Ae(C(a)),1))])):ye("",!0)])):(z(),se("div",vK,[ne("strong",null,"Uploading image"+Ae(C(a)),1)])):(z(),se("div",mK,[ne("div",null,[le(C(Jp),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:he(()=>[le(C(Me),{size:100},{default:he(()=>[le(C(yp))]),_:1}),gK]),_:1},512)])]))}});const TK=Zt(kK,[["__scopeId","data-v-db184ac6"]]);function EK(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 OK={class:"form"},AK={key:0,style:{"padding-bottom":"50px"}},PK=ne("h1",{style:{margin:"0"}},"Interrogation",-1),IK=ne("div",null,"Interrogate images to get their predicted descriptions.",-1),MK={class:"sidebar"},LK={class:"reference-images-header"},RK=ne("span",{class:"reference-images-label"},"Reference Images",-1),DK={class:"reference-images-actions"},$K={key:0,class:"reference-image-list"},BK={class:"reference-image-index"},FK=["title"],zK={class:"reference-image-controls"},NK={key:1,class:"reference-image-empty"},jK={class:"main"},VK={class:"image center-horizontal"},UK={key:0},HK=Ee({__name:"GenerateView",setup(e){const n=Lp(Mp).smallerOrEqual("md"),r=en(),i=Ut(),l=zs();Rt();const g=Sv(async()=>{const _=r.cacheVersion,S=(await r.getAvailableSamplers()).map(x=>x.name);return S.length===0?[]:u(S)},[]),o=Sv(async()=>{const _=r.cacheVersion,S=(await r.getAvailableSchedulers()).map(x=>x.name);return S.length===0?[]:d(S)},[]),a=vt({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: "+EK(_,!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(),dK(),(_,w)=>(z(),se(Ne,null,[le(C(Cw),{"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(ku,{index:"Text2Img","icon-one":C(RE),"icon-two":C(su),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ku,{index:"Img2Img","icon-one":C(su),"icon-two":C(su),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ku,{index:"Inpainting","icon-one":P2,"icon-two":C(su),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(ku,{index:"Interrogation","icon-one":PH,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),ne("div",OK,[C(r).generatorType==="Interrogation"?(z(),se("div",AK,[PK,IK,le(TK)])):(z(),be(C(Xp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:a,onSubmit:w[32]||(w[32]=tt(()=>{},["prevent"]))},{default:he(()=>[ne("div",MK,[le(KH),le(Mh,{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(Mh,{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(SE)},{append:he(()=>[le(C(Vn),{content:"Randomize!",placement:"top"},{default:he(()=>[le(C(at),{icon:C(eO),onClick:w[1]||(w[1]=()=>C(r).params.seed=C(pC)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue","clear-icon"]),(z(),be(C(T0),{key:0,gutter:10},{default:he(()=>[C(r).multiSelect.sampler.state==="Multiple"?(z(),be(C(lo),{key:0,span:C(n)?24:12},{default:he(()=>[le(_o,{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(lo),{key:1,span:C(n)?24:12},{default:he(()=>[le(_o,{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(lo),{key:2,span:C(n)?24:12},{default:he(()=>[le(_o,{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(lo),{key:3,span:C(n)?24:12},{default:he(()=>[le(_o,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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(Sn,{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]=tt(()=>{},["prevent"])),onDrop:w[23]||(w[23]=tt(S=>C(r).setExtraImage(S),["prevent"]))},[ne("div",LK,[RK,ne("div",DK,[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(()=>[je(" 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(()=>[je(" Clear Images ")]),_:1},8,["disabled"])])]),C(r).referenceImages.length>0?(z(),se("div",$K,[(z(!0),se(Ne,null,Nt(C(r).referenceImages,(S,x)=>(z(),se("div",{class:de(["reference-image-item",{"reference-file-item":!m(S)}]),key:S.id},[ne("span",BK,Ae(x+1),1),m(S)?(z(),be(C(sf),{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},Ae(S.name),9,FK),ne("div",zK,[le(C(Vn),{content:"Move up",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",icon:C(y_),disabled:x===0,onClick:k=>C(r).moveExtraImage(x,-1)},null,8,["icon","disabled","onClick"])]),_:2},1024),le(C(Vn),{content:"Move down",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",icon:C(Il),disabled:x===C(r).referenceImages.length-1,onClick:k=>C(r).moveExtraImage(x,1)},null,8,["icon","disabled","onClick"])]),_:2},1024),le(C(Vn),{content:"Remove",placement:"top"},{default:he(()=>[le(C(at),{class:"small-btn",type:"danger",icon:C(Rl),plain:"",onClick:k=>C(r).removeExtraImage(x)},null,8,["icon","onClick"])]),_:2},1024)])],2))),128))])):(z(),se("div",NK," No reference images selected. "))],32),le(C(T0),null,{default:he(()=>[le(C(lo),{span:C(n)?24:12},{default:he(()=>[le(nd,{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(lo),{span:C(n)?24:12},{default:he(()=>[C(r).generatorType==="Img2Img"?(z(),be(nd,{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(nd,{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",jK,[le(C(at),{onClick:w[27]||(w[27]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:he(()=>[je("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 "+Ae(C(r).totalImageCount)+" image"+Ae(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()})},{default:he(()=>[je("Cancel all")]),_:1},8,["disabled"])):ye("",!0)]),ne("div",VK,[le(C(S$),{class:"center-both generated-image"},{default:he(()=>[!C(r).generating&&C(r).outputs.length==0?(z(),se("div",UK,[/Inpainting/.test(C(r).generatorType)?(z(),be(ty,{key:0})):ye("",!0),/Img2Img/.test(C(r).generatorType)?(z(),be(ty,{key:1})):ye("",!0)])):ye("",!0),!C(i).showGeneratedImages&&C(r).generating?(z(),be(FH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:c(C(r).timer.seconds),onShowGenerated:w[30]||(w[30]=S=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):ye("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(z(),be(iW,{key:2})):ye("",!0)]),_:1}),C(r).lastImageRecoveryAvailable?(z(),be(C(uN),{key:0,class:"last-image-recovery",href:C(r).lastImageRecoveryUrl,target:"_blank",type:"primary",onClick:w[31]||(w[31]=tt(S=>C(r).openLastImageRecovery(),["prevent"]))},{default:he(()=>[je(" Recover last generated image ")]),_:1},8,["href"])):ye("",!0)])]),_:1},8,["model","rules"]))])],64))}});const Us=gT({history:Lk("./"),routes:[{path:"/",name:"generate",component:HK},{path:"/images",name:"images",component:()=>td(()=>Promise.resolve().then(()=>qG),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>td(()=>Promise.resolve().then(()=>uq),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>td(()=>Promise.resolve().then(()=>yq),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function WK(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 Iu(){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 pC(){return Math.floor(Math.random()*9999999)+1}function YK(){return Math.floor(Math.random()*9e5+1e5).toString()}const en=Wo("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=oe("Text2Img"),r=oe(""),i=fn("promptHistory",[]),l=oe(""),g=fn("negativeLibrary",[]),o=oe(Iu()),a=oe({interval:0,seconds:0}),u=oe({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}}),d=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=oe({...d(),sourceProcessing:"inpainting"}),f=oe({...d(),sourceProcessing:"img2img"}),s=Ce=>Ce==="Inpainting"?c.value:Ce==="Img2Img"?f.value:d(),h=ee(()=>s(n.value)),v=oe(""),m=oe(!1),y=oe(!1),b=oe([]),_=oe(null),w=oe([]),S=fn("lastImageGenkey",""),x=ee(()=>S.value?`${Rt().baseURL.length===0?".":Rt().baseURL.replace(/\/+$/,"")}/sdapi/v1/get_last.png?genkey=${encodeURIComponent(S.value)}`:""),k=ee(()=>x.value!==""&&!m.value);function E(){S.value=""}function I(){!x.value||(window.open(x.value,"_blank","noopener"),E())}const D=oe(64),N=ee(()=>Rt().allowLargerParams==="Enabled"?3072:1024),L=oe(1),F=oe(20),O=oe(1),V=ee(()=>Rt().allowLargerParams==="Enabled"?150:50),re=oe(1),J=oe(24),ue=oe(0),M=oe(1),H=oe(0),R=oe(1),P=oe(0),Q=oe(10),j=oe(1),A=ee(()=>Rt().allowLargerParams==="Enabled"?400:200),q=oe(16),G=ee(()=>Rt().allowLargerParams==="Enabled"?32:24),te=(Ce,Ye,Je)=>Array.from({length:(Ye-Ce+1)/Je},(Qe,Pt)=>(Pt+Ce)*Je),fe=oe(te(P.value,Q.value,1)),pe=oe(te(re.value,J.value,.5)),ve=ee(()=>{const Ce=(Sr,$n,os=1)=>Sr*($n.state==="Multiple"&&$n.selected.length>0?$n.selected.length:os),Je=o.value.n*ae().length,Qe=Ce(Je,u.value.sampler),Pt=Ce(Qe,u.value.scheduler),Ze=Ce(Pt,u.value.steps),Kt=Ce(Ze,u.value.guidance);return Ce(Kt,u.value.clipSkip)});function U(){return o.value=Iu(),c.value=d(),f.value=d(),b.value=[],Ut().showGeneratedImages=!1,Y(),E(),!0}function Y(){w.value=[]}function T(){b.value=[]}async function X(){const Ce=Rt(),Ye=Ce.baseURL.length===0?".":Ce.baseURL,Je=await fetch(`${Ye}/sdapi/v1/loras`),Qe=await Je.json();return ec(Je,Qe,200,"Failed to get available LoRAs")?Qe:[]}async function W(Ce){var Dm;if(!e.includes(Ce))return[];if(r.value==="")return B("Failed to generate: No prompt submitted.");const Ye=zs(),Je=Ut();Ye.saveImages();const{sourceImage:Qe,maskImage:Pt,sourceProcessing:Ze}=s(Ce);ht(r.value);const Kt=[],Sr=ae().map(et=>{const Vt=et.split(" ### ");return{full_prompt:et,prompt:Vt[0],negative_prompt:Vt[1]||""}}).map(et=>{const[Vt,Ur]=WK(et.prompt);return{...et,prompt:Vt,extractedLoras:Ur}}),$n=Sr.some(et=>et.extractedLoras.length>0)?await X():[],os=Sr.map(({extractedLoras:et,...Vt})=>{const Ur=et.length>0&&$n.length>0?et.map(lr=>{const ra=$n.find(ia=>ia.name===lr.name||ia.path===lr.name);return{path:ra?ra.path:lr.name,multiplier:lr.multiplier,...lr.is_high_noise?{is_high_noise:!0}:{}}}):[];return{...Vt,...Ur.length>0?{lora:Ur}:{}}}),{seed:wi,cfg_scale:qn,eta:Mm,steps:Vr,clip_skip:wC,sampler_name:CC,scheduler:SC,n:xC,...Ql}=o.value,yf=parseInt(wi.toString()),kC=isNaN(yf)||yf<0?pC():yf,TC=Array.from({length:xC},(et,Vt)=>kC+Vt),io=(et,Vt)=>et.state==="Disabled"?[]:et.state==="Enabled"?[Vt]:et.state==="Multiple"&&et.selected.length===0?[]:et.selected,EC={promptVariant:os,seed:TC,cfg_scale:io(u.value.guidance,qn),eta:io(u.value.eta,Mm),steps:io(u.value.steps,Vr),clip_skip:io(u.value.clipSkip,wC),sampler_name:io(u.value.sampler,CC),scheduler:io(u.value.scheduler,SC)},OC=(et=>Object.entries(et).filter(([Ur,lr])=>lr.length>0).reduce((Ur,[lr,ra])=>{const ia=[];for(const Jt of Ur)for(const eu of ra)ia.push({...Jt,[lr]:eu});return ia},[{}]))(EC),AC=[await Te()];for(const et of OC){const{promptVariant:{full_prompt:Vt,...Ur},...lr}=et,ra=Ce==="Img2Img"?Ql.send_as_refimg:!1,ia=ra&&Ql.frames>1?Ql.reverse_refimg:!1;let Jt={prompt:Vt,params:{...Ql,send_as_refimg:ra,reverse_refimg:ia,...lr,...Ur,init_images:Qe?[Qe.split(",")[1]]:[],mask:Pt,inpainting_mask_invert:Pt?0:null,inpainting_fill:Pt?1:null},source_image:Qe==null?void 0:Qe.split(",")[1],source_mask:Pt,source_processing:Ze,models:AC};Jt.params.sampler_name=="default"&&delete Jt.params.sampler_name,Jt.params.scheduler=="default"&&delete Jt.params.scheduler,!Jt.params.frames||Jt.params.frames<=1?(delete Jt.params.frames,delete Jt.params.fps):Jt.params.fps=Math.min(G.value,Math.max(q.value,Math.round(Number(Jt.params.fps)||Iu().fps)));const eu=an.value.map(PC=>PC.base64);eu.length>0&&(Jt.params.extra_images=eu),Rt().alsoRequestAvi==="Enabled"&&Jt.params.frames&&Jt.params.frames>1&&(Jt.params.video_output_type=2),Rt().keepImageGenOnDisconnect==="Enabled"&&(Jt.params.kcpp_extra_args={keep_image_gen_on_disconnect:!0}),Kt.push(Jt)}let Lm=!1;m.value||(Lm=!0,b.value=[]),m.value=!0,Je.showGeneratedImages=!1;let Rm=w.value.filter(et=>!et.gathered&&!et.failed).length;for(let et=0;et{a.value.seconds++},1e3);!w.value.every(et=>et.gathered||et.failed)&&!y.value;){const et=w.value.find(Vt=>!Vt.gathered&&!Vt.failed);if(!et)break;et.gathered=!0;try{const Vt=await ge(et.params,(Dm=_.value)==null?void 0:Dm.signal);if(!Vt){et.failed=!0;continue}$([{...Vt,...et}])}catch(Vt){et.failed=!0,console.error("Error fetching image:",Vt)}}w.value.some(et=>et.failed)&&w.value.every(et=>et.gathered||et.failed)&&(m.value=!1,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0,w.value=[])}}async function $(Ce){const Ye=ja();console.log(Ce);const Je=await Promise.all(Ce.map(async Ze=>{const Kt=Ze.images[0],Sr=!!Ze.animated?"gif":"png",$n=Ze.extra_data?`data:video/avi;base64,${Ze.extra_data}`:"",os=Ze.final_frame?`data:image/jpeg;base64,${Ze.final_frame}`:"";let wi={id:-1,image:`data:image/${Sr};base64,${Kt}`,prompt:Ze.prompt,modelName:Ze.models[0],frames:Ze.params.frames,fps:Ze.params.fps,extra_avi:$n,final_frame:os,enable_hr:Ze.params.enable_hr,send_as_refimg:Ze.params.send_as_refimg,reverse_refimg:Ze.params.reverse_refimg,lora_meta:""};if(Ze.info&&typeof Ze.info=="string"&&Ze.info.trim()!=="")try{const qn=JSON.parse(Ze.info);["seed","steps","sampler_name","cfg_scale","eta","width","height","clip_skip","fps"].forEach(Vr=>{qn[Vr]!=null&&qn[Vr]!=null?wi[Vr]=qn[Vr]:Ze.params[Vr]!=null&&(wi[Vr]=Ze.params[Vr])}),qn.extra_generation_params&&qn.extra_generation_params["Schedule type"]?wi.scheduler=qn.extra_generation_params["Schedule type"]:wi.scheduler=Ze.params.scheduler,qn.lora_meta&&(wi.lora_meta=qn.lora_meta)}catch(qn){console.warn("Failed to parse info JSON:",qn)}return wi})),Qe=await Ye.pushOutputs(Je),Pt=0;return b.value=[...Qe.map(Ze=>({type:"image",index:Pt,output:Ze})),...b.value].sort((Ze,Kt)=>Ze.index-Kt.index),b.value.length===w.value.length&&(w.value=[],m.value=!1,Ut().showGeneratedImages=!0,E(),clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),Je}async function B(Ce){const Ye=Ut();return Ce&&Ye.raiseError(Ce,!1),[]}function K(Ce,Ye,Je,Qe){return Ye<=Je?Ye:(Ut().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${Ce}' to its default value instead of ${Ye}.`,!0),Qe)}async function ce(Ce,Ye=!0){const Je=Iu();if(n.value="Text2Img",u.value.guidance.state="Enabled",u.value.sampler.state="Enabled",u.value.steps.state="Enabled",u.value.clipSkip.state="Disabled",u.value.scheduler.state="Enabled",Us.push("/"),Ye&&(Ce.width=Ce.width||Je.width,Ce.height=Ce.height||Je.height),Ce.prompt){const Qe=Ce.prompt.split(" ### ");r.value=Qe[0],l.value=Qe[1]||""}if(Ce.sampler_name){o.value.sampler_name=Ce.sampler_name;const Pt=(await Re()).find(Ze=>Ze.aliases&&Ze.aliases.includes(Ce.sampler_name));Pt&&(o.value.sampler_name=Pt.name)}Ce.steps&&(o.value.steps=K("steps",Ce.steps,V.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=K("width",Ce.width,N.value,Je.width)),Ce.height&&(o.value.height=K("height",Ce.height,N.value,Je.height)),Ce.seed&&(o.value.seed=Ce.seed),Ce.clip_skip&&(o.value.clip_skip=K("clip_skip",Ce.clip_skip,Q.value,Je.clip_skip)),Ce.scheduler&&(o.value.scheduler=Ce.scheduler),Ce.frames&&(o.value.frames=K("frames",Ce.frames,A.value,Je.frames)),Ce.fps&&(o.value.fps=Math.min(G.value,Math.max(q.value,Math.round(K("fps",Ce.fps,G.value,Je.fps)))))}function ie(Ce){const Ye=zs();n.value="Img2Img",f.value.sourceImage=Ce,Ye.drawing=!1,b.value=[],Us.push("/"),Qn.fabric.Image.fromURL(Ce,Ye.newImage)}function Z(Ce){const Ye=zs();b.value=[],c.value.sourceImage=Ce,n.value="Inpainting",Us.push("/"),Qn.fabric.Image.fromURL(Ce,Ye.newImage)}function me(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function ae(){const Ce=me(),Ye=Ce.match(/\{(.*?)\}/g)||[];if(Ye.length===0)return[Ce];let Je=[];return Ye.forEach(Qe=>{const Pt=[],Ze=Qe.replace("{","").replace("}","").split("|");Je.length===0?Ze.forEach(Kt=>{const _n=Ce.replace(Qe,Kt);Pt.push(_n)}):Je.forEach(Kt=>{Ze.forEach(_n=>{const Sr=Kt.replace(Qe,_n);Pt.push(Sr)})}),Je=[...Pt]}),Je}async function ge(Ce,Ye){const Je=Rt();try{const Qe=YK();S.value=Qe;const Pt={...Ce,genkey:Qe},Ze=await fetch(`${Je.baseURL.length===0?".":Je.baseURL}/sdapi/v1/${Ce.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Pt),signal:Ye}),Kt=await Ze.json();return ec(Ze,Kt,200,"Failed to fetch",we)?Kt:!1}catch{return!1}}function we(Ce){return Ut().raiseError(Ce,!1),y.value=!1,b.value=[],!1}async function Te(){const Ce=Rt(),Ye=await fetch(`${Ce.baseURL.length===0?".":Ce.baseURL}/sdapi/v1/sd-models`),Je=await Ye.json();if(!!ec(Ye,Je,200,"Failed to get available models"))return Je.length===0?"(No model loaded)":Je[0].model_name}const Oe=oe(0),$e=new Map;function _e(){$e.clear(),Oe.value++}ke(()=>Rt().baseURL,()=>{_e()});async function Se(Ce){const Ye=Rt(),Qe=((Ye.baseURL.length===0?".":Ye.baseURL).replace(/\/+$/,"")||".")+"/"+Ce.replace(/^\/+/,"");if($e.has(Qe))return $e.get(Qe);const Pt=(async()=>{try{const Ze=await fetch(Qe);if(Ze.ok)return await Ze.json();console.error(`API Error: ${Ze.status} ${Ze.statusText} at ${Qe}`)}catch(Ze){console.error(`Fetch error for ${Qe}:`,Ze)}return $e.delete(Qe),null})();return $e.set(Qe,Pt),Pt}async function Re(){const Ce=await Se("/sdapi/v1/samplers");return Array.isArray(Ce)?Ce:[]}async function De(){const Ce=await Se("/sdapi/v1/schedulers");return Array.isArray(Ce)?Ce:[]}function yt(Ce){g.value.indexOf(Ce)===-1&&(g.value=[...g.value,Ce])}function bt(Ce){g.value=g.value.filter(Ye=>Ye!=Ce)}function ht(Ce){if(i.value.findIndex(Ye=>Ye.prompt===Ce)===-1){if(i.value.length>=10+i.value.filter(Ye=>Ye.starred).length){const Ye=i.value.filter(Qe=>!Qe.starred),Je=i.value.findIndex(Qe=>Qe===Ye[Ye.length-1]);i.value.splice(Je,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:Ce}]}}function rn(Ce){i.value=i.value.filter(Ye=>Ye.prompt!=Ce&&Ye!=Ce)}function cn(){return!1}const an=oe([]);async function bn(Ce){var Ze,Kt;const Ye=Ce.target,Je=(Kt=Ye.files)!=null?Kt:(Ze=Ce.dataTransfer)==null?void 0:Ze.files,Qe=Array.from(Je!=null?Je:[]);if(Qe.length===0)return;const Pt=await Promise.all(Qe.map(async(_n,Sr)=>{const $n=await Ic(_n);return{id:`${Date.now()}-${Sr}-${_n.name}`,name:_n.name,size:_n.size,dataUrl:$n,base64:$n.includes("data:image")?$n.split(",")[1]:$n}}));an.value||(an.value=[]);for(let _n=0;_n=an.value.length)return;const Qe=[...an.value],[Pt]=Qe.splice(Ce,1);Qe.splice(Je,0,Pt),an.value=Qe}function ro(){an.value=[];const Ce=document.getElementById("extra_image_input");Ce&&(Ce.value="")}return{generatorType:n,prompt:r,params:o,outputs:b,inpainting:c,img2img:f,uploadDimensions:v,cancelled:y,abortController:_,multiSelect:u,referenceImages:an,negativePrompt:l,generating:m,negativePromptLibrary:g,minDimensions:D,maxDimensions:N,minImages:L,maxImages:F,minSteps:O,maxSteps:V,minCfgScale:re,maxCfgScale:J,minDenoise:H,maxDenoise:R,minClipSkip:P,maxClipSkip:Q,minFrames:j,maxFrames:A,minFps:q,maxFps:G,minEta:ue,maxEta:M,clipSkipList:fe,cfgList:pe,queue:w,promptHistory:i,timer:a,lastImageGenkey:S,lastImageRecoveryUrl:x,lastImageRecoveryAvailable:k,clearLastImageGenkey:E,openLastImageRecovery:I,validGeneratorTypes:e,sourceGeneratorTypes:t,currentImageProps:h,totalImageCount:ve,generateImage:W,generateText2Img:ce,generateImg2Img:ie,generateInpainting:Z,getPrompt:cn,resetStore:U,clearQueue:Y,clearOutputs:T,pushToNegativeLibrary:yt,removeFromNegativeLibrary:bt,pushToPromptHistory:ht,removeFromPromptHistory:rn,setExtraImage:bn,removeExtraImage:Gn,moveExtraImage:na,clearExtraImage:ro,getAvailableSamplers:Re,getAvailableSchedulers:De,cacheVersion:Oe,invalidateApiCaches:_e,getCachedEndpoint:Se}});"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}});var vf=e=>new DataView(new ArrayBuffer(e)),no=e=>new Uint8Array(e.buffer||e),wo=e=>new TextEncoder().encode(String(e));function XK(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:wo(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:no(e)};if(Symbol.asyncIterator in e)return{t,o:mC(e)};throw new TypeError("Unsupported input format.")}function mC(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=KK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function KK(e){return typeof e=="string"?wo(e):e instanceof Uint8Array?e:no(e)}function GK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=wo(t)),e instanceof File)return{i:t||wo(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||wo(g),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:wo(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 qK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:ZK,m:JK}=qK.exports,QK=no(JK).subarray(65536);function Uy(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))QK.set(n),t=ZK(n.length,t);return t}function gC(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 eG(e){const t=vf(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),gC(e.t,t,10),t.setUint16(26,e.i.length,1),no(t)}async function*tG(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=Uy(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=Uy(r,e.u),e.A+=r.length,yield r}}}function nG(e){const t=vf(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),no(t)}function rG(e,t){const n=vf(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),gC(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),no(n)}function iG(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function aG(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(mC(async function*(r){const i=[];let l=0,g=0;for await(const u of r)yield eG(u),yield u.i,yield*tG(u),yield nG(u),i.push(rG(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=vf(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 no(a)}(async function*(r){for await(const i of r){const[l,g]=iG(i);yield Object.assign(XK(...g),GK(...l))}}(e))),{headers:n})}async function vC(e,t=!0,n){const r=Rt();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 ka(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await ka(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await ka(u,"image/gif")}):i.push({name:f+".webp",input:await ka(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await aG(i).blob(),g=document.createElement("a");g.href=URL.createObjectURL(l),g.download="sdui_images.zip",g.click()}async function yC(e,t){const n=Rt(),r=document.createElement("a");let i,l=n.imageDownloadType;e.startsWith("data:image/gif")&&(l="GIF"),l==="PNG"?(i=await ka(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):l==="JPG"?(i=await ka(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):l==="GIF"?(i=await ka(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 bC(e,t){const n=e;if(!n)return;const r=atob(n),i=r.length,l=new Uint8Array(i);for(let u=0;u{Rw.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`;bC(u,d);return}else yC(a.image,`${a.seed}-${a.prompt}`)},g=()=>{en().clearOutputs(),Ut().showGeneratedImages=!1,en().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(cK(s)))),await navigator.clipboard.writeText(f),qi({type:"success",message:"Copied shareable link to clipboard"})}return(a,u)=>(z(),se(Ne,null,[le(C(at),{class:"compact-button",onClick:i,type:"danger",size:"small",icon:C(Rl),plain:""},{default:he(()=>[je("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(el),plain:""},{default:he(()=>[je("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(O4),plain:""},{default:he(()=>[je("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(E_),plain:""},{default:he(()=>[je("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(()=>[je("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(()=>[je("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(()=>[je("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(()=>[je("Dismiss")]),_:1})):ye("",!0),le(C(at),{class:"compact-button",onClick:u[7]||(u[7]=d=>o(e.imageData)),type:"success",icon:C(U3),size:"small",plain:""},{default:he(()=>[je("Share")]),_:1},8,["icon"])],64))}});const _C=Zt(oG,[["__scopeId","data-v-663d89e3"]]),sG={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},lG=["src"],uG={style:{"font-size":"16px","font-weight":"500"}},cG={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},fG={key:0},dG={key:1},hG=ne("br",null,null,-1),pG={key:0},mG=["onClick"],gG={key:1},vG=["onClick"],yG={key:2},bG=["onClick"],_G=Ee({__name:"ImageDialog",setup(e){const t=ja(),n=Ut(),r=oe();yM(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=oe(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 jt.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;en().generateImg2Img(d)}function a(){var d;!((d=l.value)!=null&&d.image)||yC(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`;bC(d,c)}return(d,c)=>{var f;return z(),be(C(JB),{"model-value":C(i),width:(f=l.value)==null?void 0:f.width,class:"image-viewer",onClosed:g,"align-center":""},{footer:he(()=>[le(_C,{"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",sG,[(s=l.value)!=null&&s.image?(z(),se("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,lG)):ye("",!0)])],512),ne("div",uG,Ae(((h=l.value.prompt)==null?void 0:h.split("###")[0])||"Unknown Creation"),1),ne("div",cG,[ne("div",null,"Negative Prompt: "+Ae(((v=l.value.prompt)==null?void 0:v.split("###")[1])||"None"),1),ne("span",null,"Model: "+Ae(l.value.modelName||"Unknown")+" - ",1),ne("span",null,"Sampler: "+Ae(l.value.sampler_name||"Unknown")+" - ",1),ne("span",null,"Scheduler: "+Ae(l.value.scheduler||"Unknown")+" - ",1),ne("span",null,"Seed: "+Ae(l.value.seed||"Unknown")+" - ",1),ne("span",null,"Steps: "+Ae(l.value.steps||"Unknown")+" - ",1),ne("span",null,"CFG Scale: "+Ae(l.value.cfg_scale||"Unknown")+" - ",1),ne("span",null,"Clip Skip: "+Ae((m=l.value.clip_skip)!=null?m:"Unknown")+" - ",1),ne("span",null,"Dimensions: "+Ae(l.value.width||"???")+"x"+Ae(l.value.height||"???")+" - ",1),ne("span",null,"Frames: "+Ae(l.value.frames||"1"),1),l.value.frames&&l.value.frames>1?(z(),se("span",fG," - FPS: "+Ae(l.value.fps||"Unknown"),1)):ye("",!0),l.value.lora_meta?(z(),se("span",dG," - LoRA: "+Ae(l.value.lora_meta),1)):ye("",!0),hG,ne("b",null,[l.value.frames&&l.value.frames>1?(z(),se("span",pG,[ne("a",{href:"#",onClick:tt(a,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download GIF]",8,mG)])):ye("",!0),l.value.extra_avi?(z(),se("span",gG,[je(" - "),ne("a",{href:"#",onClick:tt(u,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Download AVI]",8,vG)])):ye("",!0),l.value.final_frame?(z(),se("span",yG,[je(" - "),ne("a",{href:"#",onClick:tt(o,["prevent"]),style:{cursor:"pointer",color:"var(--el-color-primary)"}},"[Extend Video]",8,bG)])):ye("",!0)])])]}),_:1},8,["model-value","width"])}}});const wG=e=>(hi("data-v-8f4d2380"),e=e(),pi(),e),CG=wG(()=>ne("div",{style:{"font-size":"20px"}},"Stable UI",-1)),SG={class:"generator-icons"},xG=Ee({__name:"App",setup(e){const n=Lp(Mp).smallerOrEqual("md"),r=Ut();Rt();const i=yT(),l=oe();return ke(()=>i.path,g=>{l.value&&l.value.open(g)}),(g,o)=>(z(),se(Ne,null,[ne("div",{class:de({"menu-container":!C(n)})},[le(C(Cw),{"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(Gp),{key:0,class:"remove-item-styling center-vertical"},{title:he(()=>[CG]),_:1})),le(ps,{isMobile:C(n),index:"/"},{icon:he(()=>[ne("div",SG,[le(C(Me),null,{default:he(()=>[le(C(OO))]),_:1}),C(r).showGeneratorBadge?(z(),be(C(Me),{key:0,class:"generator-badge",size:10},{default:he(()=>[le(mH)]),_:1})):ye("",!0)])]),title:he(()=>[je("Generate")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/images"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(oO))]),_:1})]),title:he(()=>[je("Images")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/about"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(S_))]),_:1})]),title:he(()=>[je("About")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/options"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(z4))]),_:1})]),title:he(()=>[je("Options")]),_:1},8,["isMobile"]),le(ps,{isMobile:C(n),index:"/return"},{icon:he(()=>[le(C(Me),null,{default:he(()=>[le(C(b_))]),_:1})]),title:he(()=>[je("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),ne("div",{class:de({view:!C(n)})},[le(C(v_))],2),le(_G)],64))}});const kG=Zt(xG,[["__scopeId","data-v-8f4d2380"]]);const Im=lk(kG);Im.use(fk());Im.use(Us);Im.mount("#app");Us.replace("/");window.addEventListener("beforeunload",e=>{en().generating&&(e.preventDefault(),e.returnValue="")});const TG={key:1,class:"image-action"},EG=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=Ut(),r=oe(null);G8(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=oe(!1);vM(r,([{isIntersecting:g}])=>{g&&(i.value=g)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(g,o)=>(z(),se("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(z(),be(C(sf),{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(),se("div",TG,[e.imageData.starred?(z(),be(C(Me),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:he(()=>[le(C(E_))]),_:1})):ye("",!0),C(n).multiSelect?(z(),se("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(Me),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:he(()=>[C(l)?ye("",!0):(z(),be(C(Ll),{key:0})),C(l)?(z(),be(C(w_),{key:1})):ye("",!0)]),_:1},8,["color"])])):ye("",!0)])):ye("",!0)],512))}});const Hy=Zt(EG,[["__scopeId","data-v-b9569bbd"]]);function OG({mobileWidth:e=768,hideAfterDistanceFromTop:t=100,hideAfterScroll:n=100}={}){const{width:r}=d1(),i=ee(()=>r.value<=e),l=oe(!0),{y:g}=gM(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 AG={},PG={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},IG=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),MG=[IG];function LG(e,t){return z(),se("svg",PG,MG)}const RG=Zt(AG,[["render",LG]]),DG=e=>(hi("data-v-b39b47c5"),e=e(),pi(),e),$G={class:"options"},BG=["onClick"],FG=["onClick"],zG=["onClick"],NG={key:1,class:"center-both",style:{gap:"12px"}},jG={key:2},VG=DG(()=>ne("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),UG=[VG],HG={key:0},WG={key:0,style:{display:"flex",gap:"8px"}},YG={key:1,class:"images"},XG={key:1},KG=Ee({__name:"ImagesView",setup(e){const{width:t}=d1(),{isVisible:n,isMobile:r}=OG(),i=ja(),l=Rt(),g=Ut();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 jt.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=()=>{Rw.confirm(`This action will permanently delete ${g.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{i.deleteMultipleOutputs(g.selected)})};xv(["a","A","ArrowLeft"],g.openModalToLeft),xv(["d","D","ArrowRight"],g.openModalToRight);async function f(){vC(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(),se(Ne,null,[ne("div",{class:de(["images-top-bar",{"mobile-hidden":C(r)&&!C(n)}])},[ne("div",$G,[le(C(gu),{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(Me),{size:16},{default:he(()=>[le(C(v4))]),_:1})]),_:1})]),default:he(()=>[(z(),se(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":""}`)},Ae(m),11,BG)),64))]),_:1}),le(C(gu),{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(Me),{size:16},{default:he(()=>[le(C(b3))]),_:1})]),_:1})]),default:he(()=>[(z(),se(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":""}`)},Ae(C(i).filterBy===m?"Showing":"Show")+" "+Ae(m),11,FG)),64))]),_:1}),le(C(gu),{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(Me),{size:16},{default:he(()=>[le(RG)]),_:1})]),_:1})]),default:he(()=>[(z(),se(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":""}`)},Ae(m.label),11,zG)),64))]),_:1}),le(C(gu),{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(Me),{size:16},{default:he(()=>[C(g).multiSelect?(z(),be(C(w_),{key:0})):(z(),be(C(Ll),{key:1}))]),_:1})]),_:1})]),default:he(()=>[C(g).multiSelect?(z(),se("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(),se("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(),se("div",{key:2,class:"el-select-dropdown__item selected",onClick:d},"Deselect All")):(z(),se("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(),se("div",{key:5,class:"el-select-dropdown__item",onClick:o},"Select Page")):(z(),se("div",{key:4,class:"el-select-dropdown__item selected",onClick:u},"Deselect Page"))]),_:1})]),C(l).pageless==="Disabled"?(z(),be(C(A9),{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(),se("div",NG,[ne("div",null,Ae(C(g).selected.length)+" selected",1),le(C(at),{type:"danger",onClick:c,icon:C(Rl),plain:""},{default:he(()=>[je("Delete")]),_:1},8,["icon"]),le(C(at),{type:"success",onClick:f,icon:C(el),plain:"",style:{margin:"0"}},{default:he(()=>[je("Download")]),_:1},8,["icon"])])):(z(),se("div",jG,UG))],2),C(i).outputsLength!=0?(z(),se("div",HG,[C(i).currentLayout==="dynamic"?(z(),se("div",WG,[(z(!0),se(Ne,null,Nt(C(s),(m,y)=>(z(),se("div",{key:y,style:{flex:"1 1 0%"}},[(z(!0),se(Ne,null,Nt(m,b=>(z(),be(Hy,{key:b.id,"image-data":b,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):ye("",!0),C(i).currentLayout==="grid"?(z(),se("div",YG,[(z(!0),se(Ne,null,Nt(C(i).currentOutputs,m=>(z(),be(Hy,{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(),se("div",XG,[le(C(WF),{description:"No Images Found"})])):ye("",!0)],64))}});const GG=Zt(KG,[["__scopeId","data-v-b39b47c5"]]),qG=Object.freeze(Object.defineProperty({__proto__:null,default:GG},Symbol.toStringTag,{value:"Module"})),ZG=["href"],JG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=mt("router-link");return z(),se(Ne,null,[e.router?ye("",!0):(z(),se("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,ZG)),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 QG=Zt(JG,[["__scopeId","data-v-17b53b7d"]]),Jl=e=>(hi("data-v-ecc278c5"),e=e(),pi(),e),eq={class:"about"},tq={class:"about-content"},nq=Jl(()=>ne("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),rq=Jl(()=>ne("div",null,[je("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"),je(".")],-1)),iq=Jl(()=>ne("br",null,null,-1)),aq=Jl(()=>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)),oq=Jl(()=>ne("br",null,null,-1)),sq=Ee({__name:"AboutView",setup(e){return(t,n)=>(z(),se("div",eq,[ne("div",tq,[nq,rq,iq,aq,oq,ne("div",null,[je("You can find the KoboldAI community and authors of this fork on the "),le(QG,{href:"https://koboldai.org/discord"},{default:he(()=>[je("KoboldAI Discord")]),_:1})])])]))}});const lq=Zt(sq,[["__scopeId","data-v-ecc278c5"]]),uq=Object.freeze(Object.defineProperty({__proto__:null,default:lq},Symbol.toStringTag,{value:"Module"}));const ca=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(Ni),{prop:e.prop},{label:he(()=>[le(Xl,{info:e.info,"label-style":e.labelStyle},{default:he(()=>[xe(l.$slots,"label",{},()=>[je(Ae(e.label),1)])]),_:3},8,["info","label-style"])]),default:he(()=>[le(C(Z$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:he(()=>[(z(!0),se(Ne,null,Nt(e.options,o=>(z(),be(C(J$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),as=e=>(hi("data-v-f1fab695"),e=e(),pi(),e),cq=as(()=>ne("h1",null,"Options",-1)),fq=as(()=>ne("h2",null,"Generation Options",-1)),dq=as(()=>ne("h3",null,"Parameter Controls",-1)),hq=as(()=>ne("h2",null,"Image Options",-1)),pq=as(()=>ne("div",null,[je("Drop file here OR "),ne("em",null,"click to upload")],-1)),mq=as(()=>ne("h2",null,"General Options",-1)),gq=Ee({__name:"OptionsView",setup(e){const t=Rt(),n=ja(),r=en(),i=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],l=oe([]),g=oe(),o=oe(!1),a=oe(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 jt.outputs.toCollection().primaryKeys();await vC(c,!1,()=>{a.value++}),o.value=!1,a.value=0}return(c,f)=>(z(),se(Ne,null,[cq,le(C(Xp),{"label-position":"top",model:C(t).options,onSubmit:f[11]||(f[11]=tt(()=>{},["prevent"]))},{default:he(()=>[le(C(Qj),{type:"border-card",style:{"min-height":"50vh"}},{default:he(()=>[le(C(Wf),{label:"\u{1F5A8}\uFE0F Generation"},{default:he(()=>[fq,le(C(Ni),{label:"Base URL"},{default:he(()=>[le(C(Qa),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":f[0]||(f[0]=s=>C(t).baseURL=s)},null,8,["modelValue"])]),_:1}),dq,(z(!0),se(Ne,null,Nt(C(r).multiSelect,(s,h)=>{var v;return z(),se("div",{key:h},[le(ca,{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(ca,{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(ca,{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(_o,{label:"Image Resize Mode",prop:"imageResizeMode",modelValue:C(t).imageResizeMode,"onUpdate:modelValue":f[3]||(f[3]=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(ca,{label:"Video Gen: Request AVI download",prop:"pageless",modelValue:C(t).alsoRequestAvi,"onUpdate:modelValue":f[4]||(f[4]=s=>C(t).alsoRequestAvi=s),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Wf),{label:"\u{1F4F7} Images"},{default:he(()=>[hq,le(Sn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":f[5]||(f[5]=s=>C(t).pageSize=s),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(ca,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":f[6]||(f[6]=s=>C(t).pageless=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(ca,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":f[7]||(f[7]=s=>C(t).autoCarousel=s),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(ca,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":f[8]||(f[8]=s=>C(t).imageDownloadType=s),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(Ni),{label:"Export Images (ZIP File)"},{default:he(()=>[o.value?(z(),be(C(at),{key:1,icon:C(el),disabled:""},{default:he(()=>[je("Downloading... ("+Ae(a.value)+" / "+Ae(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(z(),be(C(at),{key:0,icon:C(el),onClick:f[9]||(f[9]=s=>d())},{default:he(()=>[je("Download "+Ae(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(Ni),{label:"Import Images (ZIP File)"},{default:he(()=>[le(C(Jp),{drag:"",ref_key:"upload",ref:g,"auto-upload":!1,onChange:u,"file-list":l.value,limit:1,multiple:""},{default:he(()=>[le(C(Me),{size:100},{default:he(()=>[le(C(yp))]),_:1}),pq]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Wf),{label:"\u2699\uFE0F General"},{default:he(()=>[mq,le(_o,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":f[10]||(f[10]=s=>C(t).options.colorMode=s),options:i},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const vq=Zt(gq,[["__scopeId","data-v-f1fab695"]]),yq=Object.freeze(Object.defineProperty({__proto__:null,default:vq},Symbol.toStringTag,{value:"Module"})); diff --git a/embd_res/klite.embd b/embd_res/klite.embd index 2f8794666..8da59c10d 100644 --- a/embd_res/klite.embd +++ b/embd_res/klite.embd @@ -12,7 +12,7 @@ Current version indicated by LITEVER below. -->