From 737b6721bc42e6a050e421f887f1317861807731 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Wed, 24 Dec 2025 11:39:35 +0800 Subject: [PATCH] update sdui --- embd_res/kcpp_sdui.embd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embd_res/kcpp_sdui.embd b/embd_res/kcpp_sdui.embd index 1542a520d..ff3e5bf93 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],h),h=h&&h.slice(f[0]+1)),s&&this.insertNewlineStyleObject(c.lineIndex,c.charIndex+f[0],s);for(var d=1;d0?this.insertCharStyleObject(c.lineIndex+d,0,f[d],h):h&&this.styles[c.lineIndex+d]&&h[0]&&(this.styles[c.lineIndex+d][0]=h[0]),h=h&&h.slice(f[d]+1);f[d]>0&&this.insertCharStyleObject(c.lineIndex+d,0,f[d],h)},setSelectionStartEndWithShift:function(a,u,h){h<=a?(u===a?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=a),this.selectionStart=h):h>a&&ha?this.selectionStart=a:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>a?this.selectionEnd=a:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(o){if(!!this.canvas){this.__newClickTime=+new Date;var a=o.pointer;this.isTripleClick(a)&&(this.fire("tripleclick",o),this._stopEvent(o.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=a,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(o){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===o.x&&this.__lastPointer.y===o.y},_stopEvent:function(o){o.preventDefault&&o.preventDefault(),o.stopPropagation&&o.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(o){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(o.e))},tripleClickHandler:function(o){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(o.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(o.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(o){!this.canvas||!this.editable||o.e.button&&o.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(o){if(this.__isMousedown=!1,!(!this.editable||this.group||o.transform&&o.transform.actionPerformed||o.e.button&&o.e.button!==1)){if(this.canvas){var a=this.canvas._activeObject;if(a&&a!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(o.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(o){var a=this.getSelectionStartFromPointer(o),u=this.selectionStart,h=this.selectionEnd;o.shiftKey?this.setSelectionStartEndWithShift(u,h,a):(this.selectionStart=a,this.selectionEnd=a),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(o){for(var a=this.getLocalPointer(o),u=0,h=0,c=0,f=0,s=0,d,v,g=0,y=this._textLines.length;g0&&(f+=this._textLines[g-1].length+this.missingNewlineOffset(g-1));d=this._getLineLeftOffset(s),h=d*this.scaleX,v=this._textLines[s],this.direction==="rtl"&&(a.x=this.width*this.scaleX-a.x+h);for(var b=0,_=v.length;b<_&&(u=h,h+=this.__charBounds[s][b].kernedWidth*this.scaleX,h<=a.x);b++)f++;return this._getNewSelectionStartFromOffset(a,u,h,f,_)},_getNewSelectionStartFromOffset:function(o,a,u,h,c){var f=o.x-a,s=u-o.x,d=s>f||s<0?0:1,v=h+d;return this.flipX&&(v=c-v),v>this._text.length&&(v=this._text.length),v}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var o=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+o.top+"; left: "+o.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+o.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(o){if(!!this.isEditing){var a=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(o.keyCode in a)this[a[o.keyCode]](o);else if(o.keyCode in this.ctrlKeysMapDown&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapDown[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),o.keyCode>=33&&o.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(o){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(o.keyCode in this.ctrlKeysMapUp&&(o.ctrlKey||o.metaKey))this[this.ctrlKeysMapUp[o.keyCode]](o);else return;o.stopImmediatePropagation(),o.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(o){var a=this.fromPaste;if(this.fromPaste=!1,o&&o.stopPropagation(),!!this.isEditing){var u=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,c=u.length,f,s,d=c-h,v=this.selectionStart,g=this.selectionEnd,y=v!==g,b,_,w;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var S=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),x=v>S.selectionStart;y?(f=this._text.slice(v,g),d+=g-v):c0&&(h=this.__charBounds[o][a-1],u+=h.left+h.width),u},getDownCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===this._textLines.length-1||o.metaKey||o.keyCode===34)return this._text.length-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c+1,s),v=this._textLines[c].slice(f);return v.length+d+1+this.missingNewlineOffset(c)},_getSelectionForOffset:function(o,a){return o.shiftKey&&this.selectionStart!==this.selectionEnd&&a?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(o,a){var u=this._getSelectionForOffset(o,a),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===0||o.metaKey||o.keyCode===33)return-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c-1,s),v=this._textLines[c].slice(0,f),g=this.missingNewlineOffset(c-1);return-this._textLines[c-1].length+d-v.length+(1-g)},_getIndexOnLine:function(o,a){for(var u=this._textLines[o],h=this._getLineLeftOffset(o),c=h,f=0,s,d,v=0,g=u.length;va){d=!0;var y=c-s,b=c,_=Math.abs(y-a),w=Math.abs(b-a);f=w<_?v:v-1;break}return d||(f=u.length-1),f},moveCursorDown:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",o)},moveCursorUp:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",o)},_moveCursorUpOrDown:function(o,a){var u="get"+o+"CursorOffset",h=this[u](a,this._selectionDirection==="right");a.shiftKey?this.moveCursorWithShift(h):this.moveCursorWithoutShift(h),h!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(o){var a=this._selectionDirection==="left"?this.selectionStart+o:this.selectionEnd+o;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,a),o!==0},moveCursorWithoutShift:function(o){return o<0?(this.selectionStart+=o,this.selectionEnd=this.selectionStart):(this.selectionEnd+=o,this.selectionStart=this.selectionEnd),o!==0},moveCursorLeft:function(o){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",o)},_move:function(o,a,u){var h;if(o.altKey)h=this["findWordBoundary"+u](this[a]);else if(o.metaKey||o.keyCode===35||o.keyCode===36)h=this["findLineBoundary"+u](this[a]);else return this[a]+=u==="Left"?-1:1,!0;if(typeof h<"u"&&this[a]!==h)return this[a]=h,!0},_moveLeft:function(o,a){return this._move(o,a,"Left")},_moveRight:function(o,a){return this._move(o,a,"Right")},moveCursorLeftWithoutShift:function(o){var a=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(a=this._moveLeft(o,"selectionStart")),this.selectionEnd=this.selectionStart,a},moveCursorLeftWithShift:function(o){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(o,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(o,"selectionStart")},moveCursorRight:function(o){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",o)},_moveCursorLeftOrRight:function(o,a){var u="moveCursor"+o+"With";this._currentCursorOpacity=1,a.shiftKey?u+="Shift":u+="outShift",this[u](a)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(o){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(o,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(o,"selectionEnd")},moveCursorRightWithoutShift:function(o){var a=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(a=this._moveRight(o,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,a},removeChars:function(o,a){typeof a>"u"&&(a=o+1),this.removeStyleFromTo(o,a),this._text.splice(o,a-o),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(o,a,u,h){typeof h>"u"&&(h=u),h>u&&this.removeStyleFromTo(u,h);var c=t.util.string.graphemeSplit(o);this.insertNewStyleBlock(c,u,a),this._text=[].concat(this._text.slice(0,u),c,this._text.slice(h)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var o=t.util.toFixed,a=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var u=this._getSVGLeftTopOffsets(),h=this._getSVGTextAndBg(u.textTop,u.textLeft);return this._wrapSVGTextAndBg(h)},toSVG:function(u){return this._createBaseSVGMarkup(this._toSVG(),{reviver:u,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(u){var h=!0,c=this.getSvgTextDecoration(this);return[u.textBgRects.join(""),' ",u.textSpans.join(""),` `]},_getSVGTextAndBg:function(u,h){var c=[],f=[],s=u,d;this._setSVGBg(f);for(var v=0,g=this._textLines.length;v",t.util.string.escapeXml(u),""].join("")},_setSVGTextLineText:function(u,h,c,f){var s=this.getHeightOfLine(h),d=this.textAlign.indexOf("justify")!==-1,v,g,y="",b,_,w=0,S=this._textLines[h],x;f+=s*(1-this._fontSizeFraction)/this.lineHeight;for(var T=0,O=S.length-1;T<=O;T++)x=T===O||this.charSpacing,y+=S[T],b=this.__charBounds[h][T],w===0?(c+=b.kernedWidth-b.width,w+=b.width):w+=b.kernedWidth,d&&!x&&this._reSpaceAndTab.test(S[T])&&(x=!0),x||(v=v||this.getCompleteStyleDeclaration(h,T),g=this.getCompleteStyleDeclaration(h,T+1),x=t.util.hasStyleChanged(v,g,!0)),x&&(_=this._getStyleDeclaration(h,T)||{},u.push(this._createTextCharSpan(y,_,c,f)),y="",v=g,c+=w,w=0)},_pushTextBgRect:function(u,h,c,f,s,d){var v=t.Object.NUM_FRACTION_DIGITS;u.push(" `)},_setSVGTextLineBg:function(u,h,c,f){for(var s=this._textLines[h],d=this.getHeightOfLine(h)/this.lineHeight,v=0,g=0,y,b,_=this.getValueOfPropertyAt(h,0,"textBackgroundColor"),w=0,S=s.length;wthis.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(u){for(var h=0,c=0,f=0,s={},d=0;d0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return a.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,v=this._styleMap[u],g=this._styleMap[u+1];v&&(u=v.line,h=v.offset),g&&(c=g.line,d=c===u,f=g.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(v.push(g),g=[],s=S,O=!0):s+=A,!O&&!d&&g.push(w),g=g.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&v.push(g),T+D>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+D),v},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=oe({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=oe({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=te(()=>An().generatorType==="Inpainting"),i=te(()=>r.value?t.value:n.value),l=te(()=>An().currentImageProps),m=te({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),o=oe(512),a=oe(512),u=oe(!1),h=oe(30),c=oe(!1),f=new Zn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=oe("Erase"),d=oe("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function g(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:M=!1,draw:L=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await ee(z.path),z.visibleDrawPath=await ee(z.path),M?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=L?d.value:i.value.maskPathColor);let Q=await ee(z.drawPath);Q=Q.scale(i.value.imageScale),Q.left=Q.left+z.drawPath.left*(i.value.imageScale-1),Q.top=Q.top+z.drawPath.top*(i.value.imageScale-1),L?(i.value.imageLayer.add(Q),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(Q),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),v()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:m.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),m.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,v()}function S(z){i.value.canvas=new Zn.fabric.Canvas(z,{isDrawingMode:!1,width:o.value,height:a.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",se),v()}function x(z,M,L,Q){let V=Q,P=Q;return M>L?(z.scaleToWidth(Q),V=Q*(a.value/o.value)):(z.scaleToHeight(Q),P=Q*(o.value/a.value)),{newHeight:V,newWidth:P}}function T(z){const M=An();if(E(),z.selectable=!1,o.value=z.width,a.value=z.height,o.value>M.maxDimensions||a.value>M.maxDimensions){const{newHeight:Q,newWidth:V}=x(z,o.value,a.value,M.maxDimensions);o.value=V,a.value=Q}if(o.value{o.value>a.value?i.value.imageScale=o.value/L:i.value.imageScale=a.value/L,i.value.imageLayer=R({image:Q,layerHeight:Q.height,layerWidth:Q.width})}),z.cloneAsImage(Q=>{if(!i.value.canvas)return;if(o.value!==L||a.value!==L){const{newHeight:q,newWidth:Z}=x(Q,o.value,a.value,L);o.value=Z,a.value=q}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=B(),i.value.visibleImageLayer=B({image:Q}),i.value.drawLayer=R();const V=o.value*i.value.imageScale,P=a.value*i.value.imageScale;M.params.width=V-V%64,M.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,D(),O()})}function O(){const z=An();if(!i.value.imageLayer||!i.value.drawLayer)return;const M=i.value.imageLayer.getCenter().left-z.params.width/2,L=z.params.width,Q=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:M,top:Q,width:L,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||m.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function D(){if(!i.value.canvas)return;const z=An();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=B({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,D(),A=void 0},5e3))}function N(z,M){const L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Zn.fabric.Image.fromURL(L,Q=>{Q.set({height:z,width:M});const V=Q.toDataURL({format:"png"});l.value.sourceImage=V,m.value=!0,T(Q)})}function R({image:z,layerWidth:M,layerHeight:L}={}){const Q=new Zn.fabric.Canvas(null);return Q.selection=!1,Q.backgroundColor=i.value.maskBackgroundColor,Q.setHeight(L||a.value),Q.setWidth(M||o.value),z&&Q.add(z),Q}function B({image:z,layerWidth:M,layerHeight:L,fill:Q,abosolute:V}={}){const P=z||new Zn.fabric.Rect({width:M||o.value,height:L||a.value,left:0,top:0,fill:Q||"transparent",absolutePositioned:V||!0,selectable:!1});return new Zn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function U(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),m.value){const z=An();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=B(),i.value.drawLayer=R(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ne(){var M;O();const z=document.createElement("a");if(m.value){z.href="data:image/png;base64,"+((M=l.value.sourceImage)==null?void 0:M.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function ee(z){return new Promise((M,L)=>{try{z.clone(M)}catch(Q){L(Q)}})}async function se(z){const M={path:z.path};b({history:M,erase:u.value,draw:m.value}),i.value.redoHistory.push(M)}function I(z){if(!i.value.canvas)return;const M=i.value.canvas.getPointer(z.e);f.left=M.x,f.top=M.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),m.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:m,imageProps:i,updateCropPreview:D,createNewCanvas:S,downloadMask:ne,resetCanvas:E,resetDrawing:U,flipErase:g,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const EH={},OH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},AH=re("g",{fill:"none"},[re("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),PH=[AH];function IH(e,t){return j(),ue("svg",OH,PH)}const MH=Yt(EH,[["render",IH]]);async function LH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(m=>i.onload=m),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function RH(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 LH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let m=0;m{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const ng=e=>(Zr("data-v-d200c279"),e=e(),Jr(),e),DH=ng(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),$H={key:0},BH=ng(()=>re("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),FH={class:"canvas-container"},zH=ng(()=>re("canvas",{id:"canvas"},null,-1)),NH={class:"action-buttons",style:{left:"10px",right:"unset"}},jH={class:"action-buttons"},VH=Ee({__name:"CustomCanvas",setup(e){const t=An(),n=$t(),r=vs(),i=oe();async function l(o){if(!o.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const a=await a2(o.raw);t.currentImageProps.sourceImage=a,r.drawing=!1,Zn.fabric.Image.fromURL(a,r.newImage)}function m(){t.currentImageProps.sourceImage="",r.resetCanvas()}return qe(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Zn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(o,a)=>(j(),ue(ze,null,[C(t).currentImageProps.sourceImage?_e("",!0):(j(),we(C(Mp),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ue("div",$H,[BH,re("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:a[0]||(a[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(De),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[le(n2)]),_:1}),Ue("draw something")])])):_e("",!0)]),default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(qh))]),_:1}),DH]),_:1},512)),mt(re("div",null,[re("div",FH,[zH,re("div",NH,[le(C(lt),{onClick:a[1]||(a[1]=u=>C(r).undoAction()),icon:C(Zb),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(lt),{onClick:a[2]||(a[2]=u=>C(r).redoAction()),icon:C(Jb),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),re("div",jH,[le(C(lt),{onClick:a[3]||(a[3]=u=>C(r).resetDrawing()),icon:C(_r),plain:""},null,8,["icon"]),le(C(lt),{onClick:m,icon:C(Ac),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[4]||(a[4]=u=>C(r).downloadMask()),icon:C(Ms),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[5]||(a[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(TE):MH,plain:""},null,8,["icon"]),C(r).drawing?(j(),we(C(oB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":a[6]||(a[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):_e("",!0)]),le(C(kp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[le(Tn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":a[7]||(a[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const O0=Yt(VH,[["__scopeId","data-v-d200c279"]]),UH={class:"centerIcons"},HH={class:"stackedIcons"},WH=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return lx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ue("div",UH,[re("div",HH,[le(C(De),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1},8,["size"]),le(C(De),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconTwo)))]),_:1},8,["size"])])]))}});const YH=Yt(WH,[["__scopeId","data-v-74586a39"]]),XH={key:1,style:{width:"40px"}},ru=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),we(C(Tr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(Ap),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),we(YH,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ue("div",XH,[le(C(De),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const KH=4,A0=0,P0=1,GH=2;function Ro(e){let t=e.length;for(;--t>=0;)e[t]=0}const qH=0,o2=1,ZH=2,JH=3,QH=258,rg=29,xl=256,Qs=xl+1+rg,io=30,ig=19,s2=2*Qs+1,sa=15,Df=16,eW=7,ag=256,l2=16,u2=17,c2=18,ch=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]),Mu=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]),tW=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]),nW=512,Br=new Array((Qs+2)*2);Ro(Br);const ys=new Array(io*2);Ro(ys);const el=new Array(nW);Ro(el);const tl=new Array(QH-JH+1);Ro(tl);const og=new Array(rg);Ro(og);const uc=new Array(io);Ro(uc);function $f(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 d2,h2,p2;function Bf(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const g2=e=>e<256?el[e]:el[256+(e>>>7)],nl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},mn=(e,t,n)=>{e.bi_valid>Df-n?(e.bi_buf|=t<>Df-e.bi_valid,e.bi_valid+=n-Df):(e.bi_buf|=t<{mn(e,n[t*2],n[t*2+1])},m2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},rW=e=>{e.bi_valid===16?(nl(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)},iW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,m=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,h,c,f,s,d,v=0;for(f=0;f<=sa;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ua&&(f=a,v++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=o&&(s=m[h-o]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(v!==0){do{for(f=a-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[a]--,v-=2}while(v>0);for(f=a;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},v2=(e,t,n)=>{const r=new Array(sa+1);let i=0,l,m;for(l=1;l<=sa;l++)i=i+n[l-1]<<1,r[l]=i;for(m=0;m<=t;m++){let o=e[m*2+1];o!==0&&(e[m*2]=m2(r[o]++,o))}},aW=()=>{let e,t,n,r,i;const l=new Array(sa+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?nl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},I0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,m,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?pr(e,i,t):(m=tl[i],pr(e,m+xl+1,t),o=ch[m],o!==0&&(i-=og[m],mn(e,i,o)),r--,m=g2(r),pr(e,m,n),o=Mu[m],o!==0&&(r-=uc[m],mn(e,r,o)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let m,o,a=-1,u;for(e.heap_len=0,e.heap_max=s2,m=0;m>1;m>=1;m--)Ff(e,n,m);u=l;do m=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ff(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=m,e.heap[--e.heap_max]=o,n[u*2]=n[m*2]+n[o*2],e.depth[u]=(e.depth[m]>=e.depth[o]?e.depth[m]:e.depth[o])+1,n[m*2+1]=n[o*2+1]=u,e.heap[1]=u++,Ff(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],iW(e,t),v2(n,a,e.bl_count)},L0=(e,t,n)=>{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=m,m=t[(r+1)*2+1],!(++o{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),r=0;r<=n;r++)if(l=m,m=t[(r+1)*2+1],!(++o{let t;for(L0(e,e.dyn_ltree,e.l_desc.max_code),L0(e,e.dyn_dtree,e.d_desc.max_code),fh(e,e.bl_desc),t=ig-1;t>=3&&e.bl_tree[f2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},sW=(e,t,n,r)=>{let i;for(mn(e,t-257,5),mn(e,n-1,5),mn(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 A0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return P0;for(n=32;n{D0||(aW(),D0=!0),e.l_desc=new Bf(e.dyn_ltree,d2),e.d_desc=new Bf(e.dyn_dtree,h2),e.bl_desc=new Bf(e.bl_tree,p2),e.bi_buf=0,e.bi_valid=0,y2(e)},_2=(e,t,n,r)=>{mn(e,(qH<<1)+(r?1:0),3),b2(e),nl(e,n),nl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},cW=e=>{mn(e,o2<<1,3),pr(e,ag,Br),rW(e)},fW=(e,t,n,r)=>{let i,l,m=0;e.level>0?(e.strm.data_type===GH&&(e.strm.data_type=lW(e)),fh(e,e.l_desc),fh(e,e.d_desc),m=oW(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?_2(e,t,n,r):e.strategy===KH||l===i?(mn(e,(o2<<1)+(r?1:0),3),M0(e,Br,ys)):(mn(e,(ZH<<1)+(r?1:0),3),sW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,m+1),M0(e,e.dyn_ltree,e.dyn_dtree)),y2(e),r&&b2(e)},dW=(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[(tl[n]+xl+1)*2]++,e.dyn_dtree[g2(t)*2]++),e.sym_next===e.sym_end);var hW=uW,pW=_2,gW=fW,mW=dW,vW=cW,yW={_tr_init:hW,_tr_stored_block:pW,_tr_flush_block:gW,_tr_tally:mW,_tr_align:vW};const bW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,m=0;for(;n!==0;){m=n>2e3?2e3:n,n-=m;do i=i+t[r++]|0,l=l+i|0;while(--m);i%=65521,l%=65521}return i|l<<16|0};var rl=bW;const _W=()=>{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},wW=new Uint32Array(_W()),CW=(e,t,n,r)=>{const i=wW,l=r+n;e^=-1;for(let m=r;m>>8^i[(e^t[m])&255];return e^-1};var Vt=CW,Sa={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"},Do={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:SW,_tr_stored_block:dh,_tr_flush_block:xW,_tr_tally:Ti,_tr_align:TW}=yW,{Z_NO_FLUSH:ki,Z_PARTIAL_FLUSH:kW,Z_FULL_FLUSH:EW,Z_FINISH:zn,Z_BLOCK:$0,Z_OK:Gt,Z_STREAM_END:B0,Z_STREAM_ERROR:yr,Z_DATA_ERROR:OW,Z_BUF_ERROR:zf,Z_DEFAULT_COMPRESSION:AW,Z_FILTERED:PW,Z_HUFFMAN_ONLY:iu,Z_RLE:IW,Z_FIXED:MW,Z_DEFAULT_STRATEGY:LW,Z_UNKNOWN:RW,Z_DEFLATED:Wc}=Do,DW=9,$W=15,BW=8,FW=29,zW=256,hh=zW+1+FW,NW=30,jW=19,VW=2*hh+1,UW=15,rt=3,wi=258,br=wi+rt+1,HW=32,_o=42,sg=57,ph=69,gh=73,mh=91,vh=103,la=113,Jo=666,fn=1,$o=2,xa=3,Bo=4,WW=3,ua=(e,t)=>(e.msg=Sa[t],t),F0=e=>e*2-(e>4?9:0),yi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},YW=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 XW=(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))},In=(e,t)=>{xW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,kn(e.strm)},ft=(e,t)=>{e.pending_buf[e.pending++]=t},Yo=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},yh=(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=rl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Vt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},w2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,m=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-br?e.strstart-(e.w_size-br):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+wi;let s=u[r+m-1],d=u[r+m];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+m]!==d||u[i+m-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rm){if(e.match_start=t,m=l,l>=o)break;s=u[r+m-1],d=u[r+m]}}while((t=c[t&h])>a&&--n!==0);return m<=e.lookahead?m:e.lookahead},wo=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-br)&&(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),YW(e),r+=t),e.strm.avail_in===0)break;if(n=yh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=rt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+rt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,m=0,o=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,kn(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&&(yh(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(m===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(yh(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===zn)&&t!==ki&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,m=t===zn&&e.strm.avail_in===0&&r===i?1:0,dh(e,e.block_start,r,m),e.block_start+=r,kn(e.strm)),m?xa:fn)},Nf=(e,t)=>{let n,r;for(;;){if(e.lookahead=rt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-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-br&&(e.match_length=w2(e,n)),e.match_length>=rt)if(r=Ti(e,e.strstart-e.match_start,e.match_length-rt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=rt){e.match_length--;do e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else r=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(In(e,!1),e.strm.avail_out===0))return fn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=rt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-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=rt-1,n!==0&&e.prev_length4096)&&(e.match_length=rt-1)),e.prev_length>=rt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-rt,r=Ti(e,e.strstart-1-e.prev_match,e.prev_length-rt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-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=rt-1,e.strstart++,r&&(In(e,!1),e.strm.avail_out===0))return fn}else if(e.match_available){if(r=Ti(e,0,e.window[e.strstart-1]),r&&In(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return fn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ti(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const m=e.window;for(;;){if(e.lookahead<=wi){if(wo(e),e.lookahead<=wi&&t===ki)return fn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=rt&&e.strstart>0&&(i=e.strstart-1,r=m[i],r===m[++i]&&r===m[++i]&&r===m[++i])){l=e.strstart+wi;do;while(r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=rt?(n=Ti(e,1,e.match_length-rt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(In(e,!1),e.strm.avail_out===0))return fn}return e.insert=0,t===zn?(In(e,!0),e.strm.avail_out===0?xa:Bo):e.sym_next&&(In(e,!1),e.strm.avail_out===0)?fn:$o},GW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(wo(e),e.lookahead===0)){if(t===ki)return fn;break}if(e.match_length=0,n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(In(e,!1),e.strm.avail_out===0))return fn}return e.insert=0,t===zn?(In(e,!0),e.strm.avail_out===0?xa:Bo):e.sym_next&&(In(e,!1),e.strm.avail_out===0)?fn:$o};function cr(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 Qo=[new cr(0,0,0,0,C2),new cr(4,4,8,4,Nf),new cr(4,5,16,8,Nf),new cr(4,6,32,32,Nf),new cr(4,4,16,16,Ha),new cr(8,16,32,32,Ha),new cr(8,16,128,128,Ha),new cr(8,32,128,256,Ha),new cr(32,128,258,1024,Ha),new cr(32,258,258,4096,Ha)],qW=e=>{e.window_size=2*e.w_size,yi(e.head),e.max_lazy_match=Qo[e.level].max_lazy,e.good_match=Qo[e.level].good_length,e.nice_match=Qo[e.level].nice_length,e.max_chain_length=Qo[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=rt-1,e.match_available=0,e.ins_h=0};function ZW(){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=Wc,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(VW*2),this.dyn_dtree=new Uint16Array((2*NW+1)*2),this.bl_tree=new Uint16Array((2*jW+1)*2),yi(this.dyn_ltree),yi(this.dyn_dtree),yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(UW+1),this.heap=new Uint16Array(2*hh+1),yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*hh+1),yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Tl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==_o&&t.status!==sg&&t.status!==ph&&t.status!==gh&&t.status!==mh&&t.status!==vh&&t.status!==la&&t.status!==Jo?1:0},S2=e=>{if(Tl(e))return ua(e,yr);e.total_in=e.total_out=0,e.data_type=RW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?sg:t.wrap?_o:la,e.adler=t.wrap===2?0:1,t.last_flush=-2,SW(t),Gt},x2=e=>{const t=S2(e);return t===Gt&&qW(e.state),t},JW=(e,t)=>Tl(e)||e.state.wrap!==2?yr:(e.state.gzhead=t,Gt),T2=(e,t,n,r,i,l)=>{if(!e)return yr;let m=1;if(t===AW&&(t=6),r<0?(m=0,r=-r):r>15&&(m=2,r-=16),i<1||i>DW||n!==Wc||r<8||r>15||t<0||t>9||l<0||l>MW||r===8&&m!==1)return ua(e,yr);r===8&&(r=9);const o=new ZW;return e.state=o,o.strm=e,o.status=_o,o.wrap=m,o.gzhead=null,o.w_bits=r,o.w_size=1<T2(e,t,Wc,$W,BW,LW),eY=(e,t)=>{if(Tl(e)||t>$0||t<0)return e?ua(e,yr):yr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Jo&&t!==zn)return ua(e,e.avail_out===0?zf:yr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(kn(e),e.avail_out===0)return n.last_flush=-1,Gt}else if(e.avail_in===0&&F0(t)<=F0(r)&&t!==zn)return ua(e,zf);if(n.status===Jo&&e.avail_in!==0)return ua(e,zf);if(n.status===_o&&n.wrap===0&&(n.status=la),n.status===_o){let i=Wc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=iu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=HW),i+=31-i%31,Yo(n,i),n.strstart!==0&&(Yo(n,e.adler>>>16),Yo(n,e.adler&65535)),e.adler=1,n.status=la,kn(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===sg){if(e.adler=0,ft(n,31),ft(n,139),ft(n,8),n.gzhead)ft(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)),ft(n,n.gzhead.time&255),ft(n,n.gzhead.time>>8&255),ft(n,n.gzhead.time>>16&255),ft(n,n.gzhead.time>>24&255),ft(n,n.level===9?2:n.strategy>=iu||n.level<2?4:0),ft(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ft(n,n.gzhead.extra.length&255),ft(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ph;else if(ft(n,0),ft(n,0),ft(n,0),ft(n,0),ft(n,0),ft(n,n.level===9?2:n.strategy>=iu||n.level<2?4:0),ft(n,WW),n.status=la,kn(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===ph){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=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,kn(e),n.pending!==0)return n.last_flush=-1,Gt;i=0,l-=o}let m=new Uint8Array(n.gzhead.extra);n.pending_buf.set(m.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=gh}if(n.status===gh){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=Vt(e.adler,n.pending_buf,n.pending-i,i)),kn(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=mh}if(n.status===mh){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=Vt(e.adler,n.pending_buf,n.pending-i,i)),kn(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i))}n.status=vh}if(n.status===vh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(kn(e),n.pending!==0))return n.last_flush=-1,Gt;ft(n,e.adler&255),ft(n,e.adler>>8&255),e.adler=0}if(n.status=la,kn(e),n.pending!==0)return n.last_flush=-1,Gt}if(e.avail_in!==0||n.lookahead!==0||t!==ki&&n.status!==Jo){let i=n.level===0?C2(n,t):n.strategy===iu?GW(n,t):n.strategy===IW?KW(n,t):Qo[n.level].func(n,t);if((i===xa||i===Bo)&&(n.status=Jo),i===fn||i===xa)return e.avail_out===0&&(n.last_flush=-1),Gt;if(i===$o&&(t===kW?TW(n):t!==$0&&(dh(n,0,0,!1),t===EW&&(yi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),kn(e),e.avail_out===0))return n.last_flush=-1,Gt}return t!==zn?Gt:n.wrap<=0?B0:(n.wrap===2?(ft(n,e.adler&255),ft(n,e.adler>>8&255),ft(n,e.adler>>16&255),ft(n,e.adler>>24&255),ft(n,e.total_in&255),ft(n,e.total_in>>8&255),ft(n,e.total_in>>16&255),ft(n,e.total_in>>24&255)):(Yo(n,e.adler>>>16),Yo(n,e.adler&65535)),kn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Gt:B0)},tY=e=>{if(Tl(e))return yr;const t=e.state.status;return e.state=null,t===la?ua(e,OW):Gt},nY=(e,t)=>{let n=t.length;if(Tl(e))return yr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==_o||r.lookahead)return yr;if(i===1&&(e.adler=rl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(yi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(t.subarray(n-r.w_size,n),0),t=a,n=r.w_size}const l=e.avail_in,m=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,wo(r);r.lookahead>=rt;){let a=r.strstart,u=r.lookahead-(rt-1);do r.ins_h=Ei(r,r.ins_h,r.window[a+rt-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=rt-1,wo(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=rt-1,r.match_available=0,e.next_in=m,e.input=o,e.avail_in=l,r.wrap=i,Gt};var rY=QW,iY=T2,aY=x2,oY=S2,sY=JW,lY=eY,uY=tY,cY=nY,fY="pako deflate (from Nodeca project)",bs={deflateInit:rY,deflateInit2:iY,deflateReset:aY,deflateResetKeep:oY,deflateSetHeader:sY,deflate:lY,deflateEnd:uY,deflateSetDictionary:cY,deflateInfo:fY};const dY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var hY=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)dY(n,r)&&(e[r]=n[r])}}return e},pY=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;il[254]=il[254]=1;var gY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,m=e.length,o=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const mY=(e,t)=>{if(t<65534&&e.subarray&&k2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=o-1;continue}for(m&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}m<65536?l[i++]=m:(m-=65536,l[i++]=55296|m>>10&1023,l[i++]=56320|m&1023)}return mY(l,i)},yY=(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+il[e[n]]>t?n:t},al={string2buf:gY,buf2string:vY,utf8border:yY};function bY(){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 E2=bY;const O2=Object.prototype.toString,{Z_NO_FLUSH:_Y,Z_SYNC_FLUSH:wY,Z_FULL_FLUSH:CY,Z_FINISH:SY,Z_OK:cc,Z_STREAM_END:xY,Z_DEFAULT_COMPRESSION:TY,Z_DEFAULT_STRATEGY:kY,Z_DEFLATED:EY}=Do;function kl(e){this.options=Yc.assign({level:TY,method:EY,chunkSize:16384,windowBits:15,memLevel:8,strategy:kY},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 E2,this.strm.avail_out=0;let n=bs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==cc)throw new Error(Sa[n]);if(t.header&&bs.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=al.string2buf(t.dictionary):O2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=bs.deflateSetDictionary(this.strm,r),n!==cc)throw new Error(Sa[n]);this._dict_set=!0}}kl.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?SY:_Y,typeof e=="string"?n.input=al.string2buf(e):O2.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===wY||l===CY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=bs.deflate(n,l),i===xY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=bs.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===cc;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};kl.prototype.onData=function(e){this.chunks.push(e)};kl.prototype.onEnd=function(e){e===cc&&(this.result=Yc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function lg(e,t){const n=new kl(t);if(n.push(e,!0),n.err)throw n.msg||Sa[n.err];return n.result}function OY(e,t){return t=t||{},t.raw=!0,lg(e,t)}function AY(e,t){return t=t||{},t.gzip=!0,lg(e,t)}var PY=kl,IY=lg,MY=OY,LY=AY,RY=Do,DY={Deflate:PY,deflate:IY,deflateRaw:MY,gzip:LY,constants:RY};const au=16209,$Y=16191;var BY=function(t,n){let r,i,l,m,o,a,u,h,c,f,s,d,v,g,y,b,_,w,S,x,T,O,A,D;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,m=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,v=N.lencode,g=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,da){t.msg="invalid distance too far back",N.mode=au;break e}if(s>>>=w,d-=w,w=l-m,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=au;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)D[l++]=O[T++],D[l++]=O[T++],D[l++]=O[T++],S-=3;S&&(D[l++]=O[T++],S>1&&(D[l++]=O[T++]))}else{T=l-x;do D[l++]=D[T++],D[l++]=D[T++],D[l++]=D[T++],S-=3;while(S>2);S&&(D[l++]=D[T++],S>1&&(D[l++]=D[T++]))}}else if((w&64)===0){_=g[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const a=o.bits;let u=0,h=0,c=0,f=0,s=0,d=0,v=0,g=0,y=0,b=0,_,w,S,x,T,O=null,A;const D=new Uint16Array(Wa+1),N=new Uint16Array(Wa+1);let R=null,B,E,U;for(u=0;u<=Wa;u++)D[u]=0;for(h=0;h=1&&D[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,o.bits=1,0;for(c=1;c0&&(e===j0||f!==1))return-1;for(N[1]=0,u=1;uz0||e===V0&&y>N0)return 1;for(;;){B=u-v,m[h]+1=A?(E=R[m[h]-A],U=O[m[h]-A]):(E=32+64,U=0),_=1<>v)+w]=B<<24|E<<16|U|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--D[u]===0){if(u===f)break;u=t[n+m[h]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),T+=c,d=u-v,g=1<z0||e===V0&&y>N0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-v<<24|64<<16|0),o.bits=s,0};var _s=VY;const UY=0,A2=1,P2=2,{Z_FINISH:U0,Z_BLOCK:HY,Z_TREES:ou,Z_OK:Ta,Z_STREAM_END:WY,Z_NEED_DICT:YY,Z_STREAM_ERROR:Wn,Z_DATA_ERROR:I2,Z_MEM_ERROR:M2,Z_BUF_ERROR:XY,Z_DEFLATED:H0}=Do,Xc=16180,W0=16181,Y0=16182,X0=16183,K0=16184,G0=16185,q0=16186,Z0=16187,J0=16188,Q0=16189,fc=16190,Ir=16191,Vf=16192,ey=16193,Uf=16194,ty=16195,ny=16196,ry=16197,iy=16198,su=16199,lu=16200,ay=16201,oy=16202,sy=16203,ly=16204,uy=16205,Hf=16206,cy=16207,fy=16208,It=16209,L2=16210,R2=16211,KY=852,GY=592,qY=15,ZY=qY,dy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function JY(){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 $a=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeR2?1:0},D2=e=>{if($a(e))return Wn;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=Xc,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(KY),t.distcode=t.distdyn=new Int32Array(GY),t.sane=1,t.back=-1,Ta},$2=e=>{if($a(e))return Wn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,D2(e)},B2=(e,t)=>{let n;if($a(e))return Wn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Wn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,$2(e))},F2=(e,t)=>{if(!e)return Wn;const n=new JY;e.state=n,n.strm=e,n.window=null,n.mode=Xc;const r=B2(e,t);return r!==Ta&&(e.state=null),r},QY=e=>F2(e,ZY);let hy=!0,Wf,Yf;const eX=e=>{if(hy){Wf=new Int32Array(512),Yf=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(_s(A2,e.lens,0,288,Wf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_s(P2,e.lens,0,32,Yf,0,e.work,{bits:5}),hy=!1}e.lencode=Wf,e.lenbits=9,e.distcode=Yf,e.distbits=5},z2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,m,o,a,u,h,c,f,s,d,v,g=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let D,N;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if($a(e)||!e.output||!e.input&&e.avail_in!==0)return Wn;n=e.state,n.mode===Ir&&(n.mode=Vf),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,c=o,f=a,O=Ta;e:for(;;)switch(n.mode){case Xc:if(n.wrap===0){n.mode=Vf;break}for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0),u=0,h=0,n.mode=W0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=It;break}if((u&15)!==H0){e.msg="unknown compression method",n.mode=It;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=It;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=Y0;case Y0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Vt(n.check,A,4,0)),u=0,h=0,n.mode=X0;case X0:for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=K0;case K0:if(n.flags&1024){for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=G0;case G0:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Vt(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=q0;case q0:if(n.flags&2048){if(o===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ir;break;case Q0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Hf;break}for(;h<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=ey;break;case 1:if(eX(n),n.mode=su,t===ou){u>>>=2,h-=2;break e}break;case 2:n.mode=ny;break;case 3:e.msg="invalid block type",n.mode=It}u>>>=2,h-=2;break;case ey:for(u>>>=h&7,h-=h&7;h<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=It;break}if(n.length=u&65535,u=0,h=0,n.mode=Uf,t===ou)break e;case Uf:n.mode=ty;case ty:if(s=n.length,s){if(s>o&&(s=o),s>a&&(s=a),s===0)break e;i.set(r.subarray(l,l+s),m),o-=s,l+=s,a-=s,m+=s,n.length-=s;break}n.mode=Ir;break;case ny:for(;h<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=It;break}n.have=0,n.mode=ry;case ry:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},O=_s(UY,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid code lengths set",n.mode=It;break}n.have=0,n.mode=iy;case iy:for(;n.have>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=It;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=It;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===It)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=It;break}if(n.lenbits=9,D={bits:n.lenbits},O=_s(A2,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid literal/lengths set",n.mode=It;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},O=_s(P2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,O){e.msg="invalid distances set",n.mode=It;break}if(n.mode=su,t===ou)break e;case su:n.mode=lu;case lu:if(o>=6&&a>=258){e.next_out=m,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=h,BY(e,f),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,n.mode===Ir&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=uy;break}if(b&32){n.back=-1,n.mode=Ir;break}if(b&64){e.msg="invalid literal/length code",n.mode=It;break}n.extra=b&15,n.mode=ay;case ay:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=oy;case oy:for(;g=n.distcode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=It;break}n.offset=_,n.extra=b&15,n.mode=sy;case sy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=It;break}n.mode=ly;case ly:if(a===0)break e;if(s=f-a,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=It;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,d=m-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[m++]=v[d++];while(--s);n.length===0&&(n.mode=lu);break;case uy:if(a===0)break e;i[m++]=n.length,a--,n.mode=lu;break;case Hf:if(n.wrap){for(;h<32;){if(o===0)break e;o--,u|=r[l++]<{if($a(e))return Wn;let t=e.state;return t.window&&(t.window=null),e.state=null,Ta},rX=(e,t)=>{if($a(e))return Wn;const n=e.state;return(n.wrap&2)===0?Wn:(n.head=t,t.done=!1,Ta)},iX=(e,t)=>{const n=t.length;let r,i,l;return $a(e)||(r=e.state,r.wrap!==0&&r.mode!==fc)?Wn:r.mode===fc&&(i=1,i=rl(i,t,n,0),i!==r.check)?I2:(l=z2(e,t,n,n),l?(r.mode=L2,M2):(r.havedict=1,Ta))};var aX=$2,oX=B2,sX=D2,lX=QY,uX=F2,cX=tX,fX=nX,dX=rX,hX=iX,pX="pako inflate (from Nodeca project)",Fr={inflateReset:aX,inflateReset2:oX,inflateResetKeep:sX,inflateInit:lX,inflateInit2:uX,inflate:cX,inflateEnd:fX,inflateGetHeader:dX,inflateSetDictionary:hX,inflateInfo:pX};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 mX=gX;const N2=Object.prototype.toString,{Z_NO_FLUSH:vX,Z_FINISH:yX,Z_OK:ol,Z_STREAM_END:Xf,Z_NEED_DICT:Kf,Z_STREAM_ERROR:bX,Z_DATA_ERROR:py,Z_MEM_ERROR:_X}=Do;function El(e){this.options=Yc.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 E2,this.strm.avail_out=0;let n=Fr.inflateInit2(this.strm,t.windowBits);if(n!==ol)throw new Error(Sa[n]);if(this.header=new mX,Fr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=al.string2buf(t.dictionary):N2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Fr.inflateSetDictionary(this.strm,t.dictionary),n!==ol)))throw new Error(Sa[n])}El.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,m,o;if(this.ended)return!1;for(t===~~t?m=t:m=t===!0?yX:vX,N2.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=Fr.inflate(n,m),l===Kf&&i&&(l=Fr.inflateSetDictionary(n,i),l===ol?l=Fr.inflate(n,m):l===py&&(l=Kf));n.avail_in>0&&l===Xf&&n.state.wrap>0&&e[n.next_in]!==0;)Fr.inflateReset(n),l=Fr.inflate(n,m);switch(l){case bX:case py:case Kf:case _X:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===Xf))if(this.options.to==="string"){let a=al.utf8border(n.output,n.next_out),u=n.next_out-a,h=al.buf2string(n.output,a);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(a,a+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===ol&&o===0)){if(l===Xf)return l=Fr.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};El.prototype.onData=function(e){this.chunks.push(e)};El.prototype.onEnd=function(e){e===ol&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Yc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ug(e,t){const n=new El(t);if(n.push(e),n.err)throw n.msg||Sa[n.err];return n.result}function wX(e,t){return t=t||{},t.raw=!0,ug(e,t)}var CX=El,SX=ug,xX=wX,TX=ug,kX=Do,EX={Inflate:CX,inflate:SX,inflateRaw:xX,ungzip:TX,constants:kX};const{Deflate:CG,deflate:SG,deflateRaw:OX,gzip:xG}=DY,{Inflate:TG,inflate:kG,inflateRaw:AX,ungzip:EG}=EX;var PX=OX,IX=AX;function gy(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 MX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=gy(t);if(console.log("URL params:",n),n.get("share")){const l=IX(new Uint8Array(atob(n.get("share")).split("").map(m=>m.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=gy(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||20),cfg_scale:Number(n.get("cfg_scale")||5),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0),frames:Number(n.get("frames")||1),scheduler:n.get("scheduler")||"default"};An().generateText2Img(r,!1)},LX=10;function bh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(m=>`${m[0]} - ${m[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const RX=So("interrogate",()=>{const e=oe({}),t=oe(!1);async function n(m){$t().raiseError(m,!1),t.value=!1,e.value={}}async function r(){const m=nn(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!bh(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}}),cg=e=>(Zr("data-v-db184ac6"),e=e(),Jr(),e),DX={key:0,style:{"margin-top":"16px"}},$X=cg(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),BX={key:1,style:{"margin-top":"16px"}},FX={key:2},zX={style:{"margin-top":"8px"}},NX=cg(()=>re("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),jX={key:0},VX=cg(()=>re("h3",null,"Caption",-1)),UX={key:0},HX={key:1},WX=Ee({__name:"InterrogationView",setup(e){const t=RX(),n=An(),r=$t(),i=oe();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await a2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function m(){n.generateText2Img({prompt:o.value})}const o=te(()=>t.getFormStatus()),{ellipsis:a}=r2();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ue("div",FX,[re("div",zX,[le(C(lt),{icon:C(ss),onClick:C(t).resetInterrogation},{default:pe(()=>[Ue("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(j(),we(C(lt),{key:0,icon:C(ss),onClick:m,disabled:!C(o)},{default:pe(()=>[Ue("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):_e("",!0)]),NX,le(C(Ep),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(j(),ue("div",jX,[VX,C(o)?(j(),ue("div",HX,[re("strong",null,Pe(C(o)),1)])):(j(),ue("div",UX,"Processing"+Pe(C(a)),1))])):_e("",!0)])):(j(),ue("div",BX,[re("strong",null,"Uploading image"+Pe(C(a)),1)])):(j(),ue("div",DX,[re("div",null,[le(C(Mp),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(qh))]),_:1}),$X]),_:1},512)])]))}});const YX=Yt(WX,[["__scopeId","data-v-db184ac6"]]);function XX(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),m=Math.floor(e%86400%3600%60),o=r>0?r+(t?"d":"days"):"",a=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=m>0?m+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(o),n!=null&&n.hours&&c.push(a),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const KX={class:"form"},GX={key:0,style:{"padding-bottom":"50px"}},qX=re("h1",{style:{margin:"0"}},"Interrogation",-1),ZX=re("div",null,"Interrogate images to get their predicted descriptions.",-1),JX={class:"sidebar"},QX=re("span",{style:{height:"100%","font-size":"14px"}},[Ue("Reference Image: "),re("br"),Ue("(Photomaker/Kontext) ")],-1),eK=re("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),tK={class:"main"},nK={class:"image center-horizontal"},rK={key:0},iK=Ee({__name:"GenerateView",setup(e){const n=fp(cp).smallerOrEqual("md"),r=An(),i=$t(),l=vs(),m=nn();let o=[];const a=aI(async()=>{if(o.length===0)try{o=(await(await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/samplers`)).json()).map(g=>g.name)}catch{o=[]}return o.length===0?[]:c(o)}),u=["default","discrete","karras","exponential","ays","gits","sgm_uniform","simple","smoothstep"],h=Ct({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function c(g){return!r.params||!r.params.sampler_name||g.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=g[0]),g}function f(g){return"Elapsed: "+XX(g,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function s(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function d(g){r.generatorType=g,s(),console.log(g)}function v(){l.showCropPreview=!0,l.updateCropPreview()}return s(),MX(),(g,y)=>(j(),ue(ze,null,[le(C(K1),{"default-active":C(r).generatorType,collapse:!0,onSelect:d,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[le(ru,{index:"Text2Img","icon-one":C(Yk),"icon-two":C(Bl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ru,{index:"Img2Img","icon-one":C(Bl),"icon-two":C(Bl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ru,{index:"Inpainting","icon-one":n2,"icon-two":C(Bl),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(ru,{index:"Interrogation","icon-one":qU,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),re("div",KX,[C(r).generatorType==="Interrogation"?(j(),ue("div",GX,[qX,ZX,le(YX)])):(j(),we(C(kp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:h,onSubmit:y[28]||(y[28]=Je(()=>{},["prevent"]))},{default:pe(()=>[re("div",JX,[le(C(D$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":y[23]||(y[23]=b=>C(i).activeCollapse=b),style:{"margin-bottom":"24px"}},{default:pe(()=>[le(C($$),{title:"Generation Options",name:"1"},{default:pe(()=>[le(pH),le(uh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":y[0]||(y[0]=b=>C(r).negativePrompt=b),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),le(uh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":y[2]||(y[2]=b=>C(r).params.seed=b),placeholder:"Enter seed here"},{append:pe(()=>[le(C(Tr),{content:"Randomize!",placement:"top"},{default:pe(()=>[le(C(lt),{icon:C(d3),onClick:y[1]||(y[1]=()=>C(r).params.seed=C(j2)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue"]),C(r).multiSelect.sampler.enabled?(j(),we(Iu,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":y[3]||(y[3]=b=>C(r).multiSelect.sampler.selected=b),options:C(a),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),we(Iu,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":y[4]||(y[4]=b=>C(r).params.sampler_name=b),options:C(a),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])),le(Tn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":y[5]||(y[5]=b=>C(r).params.n=b),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),we(Tn,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":y[6]||(y[6]=b=>C(r).multiSelect.steps.selected=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(Tn,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":y[7]||(y[7]=b=>C(r).params.steps=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),le(Tn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":y[8]||(y[8]=b=>C(r).params.width=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),le(Tn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":y[9]||(y[9]=b=>C(r).params.height=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),we(Tn,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":y[10]||(y[10]=b=>C(r).multiSelect.guidance.selected=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(Tn,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":y[11]||(y[11]=b=>C(r).params.cfg_scale=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),we(Tn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":y[12]||(y[12]=b=>C(r).multiSelect.clipSkip.selected=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(Tn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":y[13]||(y[13]=b=>C(r).params.clip_skip=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),we(Tn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":y[14]||(y[14]=b=>C(r).params.denoising_strength=b),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):_e("",!0),le(Tn,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":y[15]||(y[15]=b=>C(r).params.frames=b),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). Max 80 frames, about 5 seconds of video."},null,8,["modelValue","min","max"]),le(Iu,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":y[16]||(y[16]=b=>C(r).params.scheduler=b),options:u,info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue"]),re("div",null,[QX,re("input",{class:"el-button",type:"file",id:"extra_image_input",onChange:y[17]||(y[17]=b=>C(r).setExtraImage(b)),accept:"image/*",multiple:""},null,32),re("button",{onClick:y[18]||(y[18]=b=>C(r).clearExtraImage()),class:"el-button"},"Clear Image")]),eK,le(C(yj),null,{default:pe(()=>[le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":y[19]||(y[19]=b=>C(r).multiSelect.sampler.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":y[20]||(y[20]=b=>C(r).multiSelect.guidance.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":y[21]||(y[21]=b=>C(r).multiSelect.clipSkip.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":y[22]||(y[22]=b=>C(r).multiSelect.steps.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),re("div",tK,[le(C(lt),{onClick:y[24]||(y[24]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:pe(()=>[Ue("Reset")]),_:1}),le(C(lt),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:y[25]||(y[25]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[re("span",null," Generate "+Pe(C(r).totalImageCount)+" image"+Pe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),we(C(lt),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:y[26]||(y[26]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue()})},{default:pe(()=>[Ue("Cancel all")]),_:1},8,["disabled"])):_e("",!0)]),re("div",nK,[le(C(BD),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ue("div",rK,[/Inpainting/.test(C(r).generatorType)?(j(),we(O0,{key:0})):_e("",!0),/Img2Img/.test(C(r).generatorType)?(j(),we(O0,{key:1})):_e("",!0)])):_e("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),we(iH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:f(C(r).timer.seconds),onShowGenerated:y[27]||(y[27]=b=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):_e("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),we(xH,{key:2})):_e("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const ws=LT({history:qx("./"),routes:[{path:"/",name:"generate",component:iK},{path:"/images",name:"images",component:()=>Lf(()=>Promise.resolve().then(()=>QK),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>Lf(()=>Promise.resolve().then(()=>dG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>Lf(()=>Promise.resolve().then(()=>_G),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Gf(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,scheduler:"default"}}function j2(){return Math.floor(Math.random()*9999999)+1}const An=So("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=oe("Text2Img"),r=oe(""),i=Bn("promptHistory",[]),l=oe(""),m=Bn("negativeLibrary",[]),o=oe(Gf()),a=oe({interval:0,seconds:0}),u=oe({sampler:{name:"Sampler",enabled:!1,selected:[o.value.sampler_name],noneMessage:"Failed to generate: No sampler selected.",mapToParam:K=>K.sampler_name},steps:{name:"Steps",enabled:!1,selected:[o.value.steps],noneMessage:"Failed to generate: No steps selected.",mapToParam:K=>K.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[o.value.cfg_scale],noneMessage:"Failed to generate: No guidance selected.",mapToParam:K=>K.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[o.value.clip_skip],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:K=>K.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=oe({...h(),sourceProcessing:"inpainting"}),f=oe({...h(),sourceProcessing:"img2img"}),s=K=>K==="Inpainting"?c.value:K==="Img2Img"?f.value:h(),d=te(()=>s(n.value)),v=oe(""),g=oe(!1),y=oe(!1),b=oe([]),_=oe([]),w=oe(64),S=te(()=>nn().allowLargerParams==="Enabled"?3072:1024),x=oe(1),T=oe(20),O=oe(1),A=te(()=>nn().allowLargerParams==="Enabled"?150:50),D=oe(1),N=oe(24),R=oe(.1),B=oe(1),E=oe(0),U=oe(10),ne=oe(1),ee=oe(80),se=(K,ce,be)=>Array.from({length:(ce-K+1)/be},(Ce,Te)=>(Te+K)*be),I=oe(se(E.value,U.value,1)),z=oe(se(D.value,N.value,.5)),M=te(()=>{const K=(Se,Me,Re=1)=>Se*(Me.enabled?Me.selected.length:Re),be=o.value.n*H().length,Ce=K(be,u.value.sampler),Te=K(Ce,u.value.steps),Ae=K(Te,u.value.guidance);return K(Ae,u.value.clipSkip)});function L(){return o.value=Gf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,Q(),!0}function Q(){_.value=[]}async function V(K){if(!e.includes(K))return[];if(r.value==="")return q("Failed to generate: No prompt submitted.");for(const nt of Object.values(u.value))if(nt.enabled&&nt.selected.length===0)return q(nt.noneMessage);const ce=vs(),be=$t();ce.saveImages();const{sourceImage:Ce,maskImage:Te,sourceProcessing:Ae}=s(K);F(r.value);const ye=[],Se=(nt,Jt)=>nt.enabled?nt.selected:Jt,Me=H(),Re=Se(u.value.guidance,[o.value.cfg_scale]),ht=Se(u.value.steps,[o.value.steps]),pt=Se(u.value.clipSkip,[o.value.clip_skip]),st=Se(u.value.sampler,[o.value.sampler_name]),Xt=[await X()];for(const nt of Re)for(const Jt of ht)for(const Kn of pt)for(const Cn of Me){const Ni=Cn.split(" ### ");for(const Y2 of st){let Pl=parseInt(o.value.seed.toString());(isNaN(Pl)||Pl<0)&&(Pl=j2());for(let Gc=0;Gc0&&(Er.params.extra_images=ae),ye.push(Er)}}}let Kt=!1;g.value||(Kt=!0),g.value=!0,be.showGeneratedImages=!1;for(let nt=0;nt{a.value.seconds++},1e3);!_.value.every(nt=>nt.gathered||nt.failed)&&!y.value;){const nt=_.value.filter(Kn=>!Kn.gathered&&!Kn.failed),Jt=ai(nt);for(const[Kn,Cn]of nt.slice(0,Jt).entries()){if(y.value)break;Cn.gathered=!0;try{const Ni=await Y(Cn.params);if(!Ni){Cn.failed=!0;continue}P([{...Ni,...Cn}])}catch(Ni){Cn.failed=!0,console.error("Error fetching image:",Ni)}}}}async function P(K){const ce=Ca();console.log(K);const be=await Promise.all(K.map(async Ae=>{const ye=Ae.images[0],Me=!!Ae.animated?"gif":"png";return{id:-1,image:`data:image/${Me};base64,${ye}`,prompt:Ae.prompt,clip_skip:Ae.params.clip_skip,modelName:Ae.models[0],seed:Ae.params.seed,steps:Ae.params.steps,sampler_name:Ae.params.sampler_name,cfg_scale:Ae.params.cfg_scale,width:Ae.params.width,height:Ae.params.height,frames:Ae.params.frames,scheduler:Ae.params.scheduler}})),Ce=await ce.pushOutputs(be),Te=0;return b.value=[...Ce.map(Ae=>({type:"image",index:Te,output:Ae})),...b.value].sort((Ae,ye)=>Ae.index-ye.index),b.value.length===_.value.length&&(_.value=[],g.value=!1,$t().showGeneratedImages=!0,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),be}async function q(K){const ce=$t();return K&&ce.raiseError(K,!1),[]}function Z(K,ce,be,Ce){return ce<=be?ce:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${K}' to its default value instead of ${ce}.`,!0),Ce)}function ie(K,ce=!0){const be=Gf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,ws.push("/"),ce&&(K.width=K.width||be.width,K.height=K.height||be.height),K.prompt){const Ce=K.prompt.split(" ### ");r.value=Ce[0],l.value=Ce[1]||""}K.sampler_name&&(o.value.sampler_name=K.sampler_name),K.steps&&(o.value.steps=Z("steps",K.steps,A.value,be.steps)),K.cfg_scale&&(o.value.cfg_scale=K.cfg_scale),K.width&&(o.value.width=Z("width",K.width,S.value,be.width)),K.height&&(o.value.height=Z("height",K.height,S.value,be.height)),K.seed&&(o.value.seed=K.seed),K.clip_skip&&(o.value.clip_skip=Z("clip_skip",K.clip_skip,U.value,be.clip_skip)),K.scheduler&&(o.value.scheduler=K.scheduler),K.frames&&(o.value.frames=Z("frames",K.frames,ee.value,be.frames))}function he(K){const ce=vs();n.value="Img2Img",f.value.sourceImage=K,ce.drawing=!1,b.value=[],ws.push("/"),Zn.fabric.Image.fromURL(K,ce.newImage)}function me(K){const ce=vs();b.value=[],c.value.sourceImage=K,n.value="Inpainting",ws.push("/"),Zn.fabric.Image.fromURL(K,ce.newImage)}function ve(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function H(){const K=ve(),ce=K.match(/\{(.*?)\}/g)||[];if(ce.length===0)return[K];let be=[];return ce.forEach(Ce=>{const Te=[],Ae=Ce.replace("{","").replace("}","").split("|");be.length===0?Ae.forEach(ye=>{const Se=K.replace(Ce,ye);Te.push(Se)}):be.forEach(ye=>{Ae.forEach(Se=>{const Me=ye.replace(Ce,Se);Te.push(Me)})}),be=[...Te]}),be}async function Y(K){const ce=nn();try{const be=await fetch(`${ce.baseURL.length===0?".":ce.baseURL}/sdapi/v1/${K.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}),Ce=await be.json();return bh(be,Ce,200,"Failed to fetch",k)?Ce:!1}catch{return!1}}function k(K){return $t().raiseError(K,!1),y.value=!1,b.value=[],!1}async function X(){const K=nn(),ce=await fetch(`${K.baseURL.length===0?".":K.baseURL}/sdapi/v1/sd-models`),be=await ce.json();if(!!bh(ce,be,200,"Failed to get available models"))return be.length===0?"(No model loaded)":be[0].model_name}function W(K){m.value.indexOf(K)===-1&&(m.value=[...m.value,K])}function $(K){m.value=m.value.filter(ce=>ce!=K)}function F(K){if(i.value.findIndex(ce=>ce.prompt===K)===-1){if(i.value.length>=10+i.value.filter(ce=>ce.starred).length){const ce=i.value.filter(Ce=>!Ce.starred),be=i.value.findIndex(Ce=>Ce===ce[ce.length-1]);i.value.splice(be,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:K}]}}function G(K){i.value=i.value.filter(ce=>ce.prompt!=K&&ce!=K)}function de(){return!1}var ae=[];function J(K){let ce=K.target;if(ae=[],ce.files.length>0)for(let be=0;benew DataView(new ArrayBuffer(e)),Ba=e=>new Uint8Array(e.buffer||e),Za=e=>new TextEncoder().encode(String(e));function aK(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:Za(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:Ba(e)};if(Symbol.asyncIterator in e)return{t,o:V2(e)};throw new TypeError("Unsupported input format.")}function V2(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=oK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function oK(e){return typeof e=="string"?Za(e):e instanceof Uint8Array?e:Ba(e)}function sK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=Za(t)),e instanceof File)return{i:t||Za(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),m=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||Za(m),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:Za(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 lK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:uK,m:cK}=lK.exports,fK=Ba(cK).subarray(65536);function my(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))fK.set(n),t=uK(n.length,t);return t}function U2(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 dK(e){const t=Kc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),U2(e.t,t,10),t.setUint16(26,e.i.length,1),Ba(t)}async function*hK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=my(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=my(r,e.u),e.A+=r.length,yield r}}}function pK(e){const t=Kc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),Ba(t)}function gK(e,t){const n=Kc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),U2(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),Ba(n)}function mK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function vK(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(V2(async function*(r){const i=[];let l=0,m=0;for await(const u of r)yield dK(u),yield u.i,yield*hK(u),yield pK(u),i.push(gK(u,l)),i.push(u.i),m++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=Kc(22);a.setUint32(0,1347093766),a.setUint16(8,m,1),a.setUint16(10,m,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield Ba(a)}(async function*(r){for await(const i of r){const[l,m]=mK(i);yield Object.assign(aK(...m),sK(...l))}}(e))),{headers:n})}async function H2(e,t=!0,n){const r=nn();t&&Ri({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let o=0;o]/g,"").substring(0,128).trimEnd();let s=r.imageDownloadType;a.frames&&a.frames>1&&(s="GIF"),s==="PNG"?i.push({name:f+".png",input:await oa(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await oa(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await oa(u,"image/gif")}):i.push({name:f+".webp",input:await oa(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await vK(i).blob(),m=document.createElement("a");m.href=URL.createObjectURL(l),m.download="sdui_images.zip",m.click()}async function yK(e,t){const n=nn(),r=document.createElement("a");let i;n.imageDownloadType==="PNG"?(i=await oa(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):n.imageDownloadType==="JPG"?(i=await oa(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):n.imageDownloadType==="GIF"?(i=await oa(e,"image/gif"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".gif"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const W2=Ee({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=An(),r=Ca(),i=()=>{ow.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ri({type:"success",message:"Deleted Image"})})};async function l(m){const o=window.location.origin,a={prompt:m.prompt,width:m.width?m.width:void 0,height:m.height?m.height:void 0,steps:m.steps,cfg_scale:m.cfg_scale,sampler_name:m.sampler_name,model_name:m.modelName,seed:m.seed,clip_skip:m.clip_skip,frames:m.frames,scheduler:m.scheduler},u=window.location.pathname.replace("images","");let h=`${o}${u}?share=`,c="",f="";for(const[d,v]of Object.entries(a)){if(!v)continue;let g=v;typeof v=="string"?g=encodeURIComponent(v):Array.isArray(v)&&(g=JSON.stringify(v)),c+=`${f}${d}=${g}`,f="&"}h+=btoa(String.fromCharCode.apply(null,Array.from(PX(c)))),await navigator.clipboard.writeText(h),Ri({type:"success",message:"Copied shareable link to clipboard"})}return(m,o)=>(j(),ue(ze,null,[le(C(lt),{onClick:i,type:"danger",icon:C(Ac),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(lt),{onClick:o[0]||(o[0]=a=>C(yK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",icon:C(Ms),plain:""},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"]),e.imageData.starred?_e("",!0):(j(),we(C(lt),{key:0,onClick:o[1]||(o[1]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(NO),plain:""},{default:pe(()=>[Ue("Favourite")]),_:1},8,["icon"])),e.imageData.starred?(j(),we(C(lt),{key:1,onClick:o[2]||(o[2]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(Qb),plain:""},{default:pe(()=>[Ue("Unfavourite")]),_:1},8,["icon"])):_e("",!0),le(C(lt),{onClick:o[3]||(o[3]=a=>C(n).generateText2Img(e.imageData)),type:"success",icon:C(ss),plain:""},{default:pe(()=>[Ue("Text2img")]),_:1},8,["icon"]),le(C(lt),{onClick:o[4]||(o[4]=a=>C(n).generateImg2Img(e.imageData.image)),type:"success",icon:C(ss),plain:""},{default:pe(()=>[Ue("Img2img")]),_:1},8,["icon"]),le(C(lt),{onClick:o[5]||(o[5]=a=>C(n).generateInpainting(e.imageData.image)),type:"success",icon:C(ss),plain:""},{default:pe(()=>[Ue("Inpainting")]),_:1},8,["icon"]),le(C(lt),{onClick:o[6]||(o[6]=a=>l(e.imageData)),type:"success",icon:C(t3),plain:""},{default:pe(()=>[Ue("Copy Link")]),_:1},8,["icon"])],64))}}),bK={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},_K=["src"],wK={style:{"font-size":"18px","font-weight":"500"}},CK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},SK=Ee({__name:"ImageDialog",setup(e){const t=Ca(),n=$t(),r=oe();MI(r,{onSwipeEnd(o,a){a==="RIGHT"&&n.openModalToLeft(),a==="LEFT"&&n.openModalToRight()}});const i=te({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=oe(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const o=t.currentOutputs.find(a=>a.id===n.activeModal);if(o)return l.value=o;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function m(){i.value=!1}return(o,a)=>{var u;return j(),we(C(xB),{"model-value":C(i),width:(u=l.value)==null?void 0:u.width,class:"image-viewer",onClosed:m,"align-center":""},{default:pe(()=>{var h,c,f;return[re("div",{class:"main-output-container",ref_key:"target",ref:r},[re("div",bK,[(h=l.value)!=null&&h.image?(j(),ue("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,_K)):_e("",!0)])],512),re("div",wK,Pe(((c=l.value.prompt)==null?void 0:c.split("###")[0])||"Unkown Creation"),1),re("div",CK,[re("div",null,"Negative Prompt: "+Pe(((f=l.value.prompt)==null?void 0:f.split("###")[1])||"None"),1),re("span",null,"Model: "+Pe(l.value.modelName||"Unknown")+" - ",1),re("span",null,"Sampler: "+Pe(l.value.sampler_name||"Unknown")+" - ",1),re("span",null,"Seed: "+Pe(l.value.seed||"Unknown")+" - ",1),re("span",null,"Steps: "+Pe(l.value.steps||"Unknown")+" - ",1),re("span",null,"CFG Scale: "+Pe(l.value.cfg_scale||"Unknown")+" - ",1),re("span",null,"Clip Skip: "+Pe(l.value.clip_skip||"Unknown")+" - ",1),re("span",null,"Dimensions: "+Pe(l.value.width||"???")+"x"+Pe(l.value.height||"???")+" - ",1)]),re("div",null,[le(W2,{"image-data":l.value},null,8,["image-data"])])]}),_:1},8,["model-value","width"])}}});const xK=e=>(Zr("data-v-8f4d2380"),e=e(),Jr(),e),TK=xK(()=>re("div",{style:{"font-size":"20px"}},"Stable UI",-1)),kK={class:"generator-icons"},EK=Ee({__name:"App",setup(e){const n=fp(cp).smallerOrEqual("md"),r=$t();nn();const i=DT(),l=oe();return ke(()=>i.path,m=>{l.value&&l.value.open(m)}),(m,o)=>(j(),ue(ze,null,[re("div",{class:fe({"menu-container":!C(n)})},[le(C(K1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?_e("",!0):(j(),we(C(Ap),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[TK]),_:1})),le(Wo,{isMobile:C(n),index:"/"},{icon:pe(()=>[re("div",kK,[le(C(De),null,{default:pe(()=>[le(C(N3))]),_:1}),C(r).showGeneratorBadge?(j(),we(C(De),{key:0,class:"generator-badge",size:10},{default:pe(()=>[le(DU)]),_:1})):_e("",!0)])]),title:pe(()=>[Ue("Generate")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/images"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(y3))]),_:1})]),title:pe(()=>[Ue("Images")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/about"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Gb))]),_:1})]),title:pe(()=>[Ue("About")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/options"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(ZO))]),_:1})]),title:pe(()=>[Ue("Options")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/return"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Wb))]),_:1})]),title:pe(()=>[Ue("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),re("div",{class:fe({view:!C(n)})},[le(C(Hb))],2),le(SK)],64))}});const OK=Yt(EK,[["__scopeId","data-v-8f4d2380"]]);const fg=Tx(OK);fg.use(Ox());fg.use(ws);fg.mount("#app");ws.replace("/");const AK={key:1,class:"image-action"},PK=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=oe(null);cI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=oe(!1);II(r,([{isIntersecting:m}])=>{m&&(i.value=m)},{rootMargin:"500px"});const l=te(()=>n.selected.includes(t.imageData.id));return(m,o)=>(j(),ue("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),we(C(Ep),{key:0,class:"thumbnail",src:e.imageData.image,onClick:o[0]||(o[0]=a=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):_e("",!0),i.value?(j(),ue("div",AK,[e.imageData.starred?(j(),we(C(De),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[le(C(Qb))]),_:1})):_e("",!0),C(n).multiSelect?(j(),ue("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(De),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?_e("",!0):(j(),we(C(cl),{key:0})),C(l)?(j(),we(C(Xb),{key:1})):_e("",!0)]),_:1},8,["color"])])):_e("",!0)])):_e("",!0)],512))}});const vy=Yt(PK,[["__scopeId","data-v-b9569bbd"]]);const IK={},MK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},LK=re("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),RK=[LK];function DK(e,t){return j(),ue("svg",MK,RK)}const $K=Yt(IK,[["render",DK]]),BK=e=>(Zr("data-v-301360a8"),e=e(),Jr(),e),FK={class:"images-top-bar"},zK={class:"options"},NK=["onClick"],jK=["onClick"],VK=["onClick"],UK={key:1,class:"center-both",style:{gap:"12px"}},HK={key:2},WK=BK(()=>re("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),YK=[WK],XK={key:0},KK={key:0,style:{display:"flex",gap:"8px"}},GK={key:1,class:"images"},qK={key:1},ZK=Ee({__name:"ImagesView",setup(e){const{width:t}=jI(),n=Ca(),r=nn(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function m(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function o(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function a(){i.selected=[],i.multiSelect=!1}const u=()=>{ow.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};Jm(["a","A","ArrowLeft"],i.openModalToLeft),Jm(["d","D","ArrowRight"],i.openModalToRight);async function h(){H2(i.selected)}const c=te(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ue(ze,null,[re("div",FK,[re("div",zK,[le(C(Xl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(AO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["Newest","Oldest"],d=>re("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Pe(d),11,NK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(IE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>re("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Pe(C(n).filterBy===d?"Showing":"Show")+" "+Pe(d),11,jK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le($K)]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>re("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Pe(d.label),11,VK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),we(C(Xb),{key:0})):(j(),we(C(cl),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ue("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ue("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ue("div",{key:2,class:"el-select-dropdown__item selected",onClick:a},"Deselect All")):(j(),ue("div",{key:3,class:"el-select-dropdown__item",onClick:m},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(v=>v.id).includes(d))?(j(),ue("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ue("div",{key:4,class:"el-select-dropdown__item selected",onClick:o},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),we(C(KN),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):_e("",!0),C(i).multiSelect?(j(),ue("div",UK,[re("div",null,Pe(C(i).selected.length)+" selected",1),le(C(lt),{type:"danger",onClick:u,icon:C(Ac),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(lt),{type:"success",onClick:h,icon:C(Ms),plain:"",style:{margin:"0"}},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"])])):(j(),ue("div",HK,YK))]),C(n).outputsLength!=0?(j(),ue("div",XK,[C(n).currentLayout==="dynamic"?(j(),ue("div",KK,[(j(!0),ue(ze,null,Dt(C(c),(d,v)=>(j(),ue("div",{key:v,style:{flex:"1 1 0%"}},[(j(!0),ue(ze,null,Dt(d,g=>(j(),we(vy,{key:g.id,"image-data":g,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):_e("",!0),C(n).currentLayout==="grid"?(j(),ue("div",GK,[(j(!0),ue(ze,null,Dt(C(n).currentOutputs,d=>(j(),we(vy,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):_e("",!0)])):_e("",!0),C(n).outputsLength==0?(j(),ue("div",qK,[le(C(vF),{description:"No Images Found"})])):_e("",!0)],64))}});const JK=Yt(ZK,[["__scopeId","data-v-301360a8"]]),QK=Object.freeze(Object.defineProperty({__proto__:null,default:JK},Symbol.toStringTag,{value:"Module"})),eG=["href"],tG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=dt("router-link");return j(),ue(ze,null,[e.router?_e("",!0):(j(),ue("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,eG)),e.router?(j(),we(r,{key:1,to:e.href},{default:pe(()=>[xe(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):_e("",!0)],64)}}});const nG=Yt(tG,[["__scopeId","data-v-17b53b7d"]]),Ol=e=>(Zr("data-v-ecc278c5"),e=e(),Jr(),e),rG={class:"about"},iG={class:"about-content"},aG=Ol(()=>re("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),oG=Ol(()=>re("div",null,[Ue("This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in "),re("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ue(".")],-1)),sG=Ol(()=>re("br",null,null,-1)),lG=Ol(()=>re("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),uG=Ol(()=>re("br",null,null,-1)),cG=Ee({__name:"AboutView",setup(e){return(t,n)=>(j(),ue("div",rG,[re("div",iG,[aG,oG,sG,lG,uG,re("div",null,[Ue("You can find the KoboldAI community and authors of this fork on the "),le(nG,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ue("KoboldAI Discord")]),_:1})])])]))}});const fG=Yt(cG,[["__scopeId","data-v-ecc278c5"]]),dG=Object.freeze(Object.defineProperty({__proto__:null,default:fG},Symbol.toStringTag,{value:"Module"}));const uu=Ee({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=te(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,m)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Sl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(l.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(f$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ue(ze,null,Dt(e.options,o=>(j(),we(C(d$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),Al=e=>(Zr("data-v-d14e7594"),e=e(),Jr(),e),hG=Al(()=>re("h1",null,"Options",-1)),pG=Al(()=>re("h2",null,"Generation Options",-1)),gG=Al(()=>re("h2",null,"Image Options",-1)),mG=Al(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),vG=Al(()=>re("h2",null,"General Options",-1)),yG=Ee({__name:"OptionsView",setup(e){const t=nn(),n=Ca(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=oe([]),l=oe(),m=oe(!1),o=oe(0);async function a(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ri({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),m.value=!0,o.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await H2(h,!1,()=>{o.value++}),m.value=!1,o.value=0}return(h,c)=>(j(),ue(ze,null,[hG,le(C(kp),{"label-position":"top",model:C(t).options,onSubmit:c[8]||(c[8]=Je(()=>{},["prevent"]))},{default:pe(()=>[le(C(b9),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[le(C(Sf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[pG,le(C(xi),{label:"Base URL"},{default:pe(()=>[le(C(Ra),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1}),le(uu,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).allowLargerParams=f),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Sf),{label:"\u{1F4F7} Images"},{default:pe(()=>[gG,le(Tn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(uu,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(uu,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(uu,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[5]||(c[5]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(xi),{label:"Export Images (ZIP File)"},{default:pe(()=>[m.value?(j(),we(C(lt),{key:1,icon:C(Ms),disabled:""},{default:pe(()=>[Ue("Downloading... ("+Pe(o.value)+" / "+Pe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),we(C(lt),{key:0,icon:C(Ms),onClick:c[6]||(c[6]=f=>u())},{default:pe(()=>[Ue("Download "+Pe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(xi),{label:"Import Images (ZIP File)"},{default:pe(()=>[le(C(Mp),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:a,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(qh))]),_:1}),mG]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Sf),{label:"\u2699\uFE0F General"},{default:pe(()=>[vG,le(Iu,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[7]||(c[7]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const bG=Yt(yG,[["__scopeId","data-v-d14e7594"]]),_G=Object.freeze(Object.defineProperty({__proto__:null,default:bG},Symbol.toStringTag,{value:"Module"})); +`&&d>0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return a.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,v=this._styleMap[u],g=this._styleMap[u+1];v&&(u=v.line,h=v.offset),g&&(c=g.line,d=c===u,f=g.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(v.push(g),g=[],s=S,O=!0):s+=A,!O&&!d&&g.push(w),g=g.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&v.push(g),T+D>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+D),v},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=a.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=oe({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=oe({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=te(()=>An().generatorType==="Inpainting"),i=te(()=>r.value?t.value:n.value),l=te(()=>An().currentImageProps),m=te({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),o=oe(512),a=oe(512),u=oe(!1),h=oe(30),c=oe(!1),f=new Zn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=oe("Erase"),d=oe("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function g(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:M=!1,draw:L=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await ee(z.path),z.visibleDrawPath=await ee(z.path),M?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=L?d.value:i.value.maskPathColor);let Q=await ee(z.drawPath);Q=Q.scale(i.value.imageScale),Q.left=Q.left+z.drawPath.left*(i.value.imageScale-1),Q.top=Q.top+z.drawPath.top*(i.value.imageScale-1),L?(i.value.imageLayer.add(Q),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(Q),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),v()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:m.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),m.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,v()}function S(z){i.value.canvas=new Zn.fabric.Canvas(z,{isDrawingMode:!1,width:o.value,height:a.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",se),v()}function x(z,M,L,Q){let V=Q,P=Q;return M>L?(z.scaleToWidth(Q),V=Q*(a.value/o.value)):(z.scaleToHeight(Q),P=Q*(o.value/a.value)),{newHeight:V,newWidth:P}}function T(z){const M=An();if(E(),z.selectable=!1,o.value=z.width,a.value=z.height,o.value>M.maxDimensions||a.value>M.maxDimensions){const{newHeight:Q,newWidth:V}=x(z,o.value,a.value,M.maxDimensions);o.value=V,a.value=Q}if(o.value{o.value>a.value?i.value.imageScale=o.value/L:i.value.imageScale=a.value/L,i.value.imageLayer=R({image:Q,layerHeight:Q.height,layerWidth:Q.width})}),z.cloneAsImage(Q=>{if(!i.value.canvas)return;if(o.value!==L||a.value!==L){const{newHeight:q,newWidth:Z}=x(Q,o.value,a.value,L);o.value=Z,a.value=q}i.value.canvas.setWidth(o.value),i.value.canvas.setHeight(a.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=B(),i.value.visibleImageLayer=B({image:Q}),i.value.drawLayer=R();const V=o.value*i.value.imageScale,P=a.value*i.value.imageScale;M.params.width=V-V%64,M.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,D(),O()})}function O(){const z=An();if(!i.value.imageLayer||!i.value.drawLayer)return;const M=i.value.imageLayer.getCenter().left-z.params.width/2,L=z.params.width,Q=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:M,top:Q,width:L,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||m.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function D(){if(!i.value.canvas)return;const z=An();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=B({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,D(),A=void 0},5e3))}function N(z,M){const L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Zn.fabric.Image.fromURL(L,Q=>{Q.set({height:z,width:M});const V=Q.toDataURL({format:"png"});l.value.sourceImage=V,m.value=!0,T(Q)})}function R({image:z,layerWidth:M,layerHeight:L}={}){const Q=new Zn.fabric.Canvas(null);return Q.selection=!1,Q.backgroundColor=i.value.maskBackgroundColor,Q.setHeight(L||a.value),Q.setWidth(M||o.value),z&&Q.add(z),Q}function B({image:z,layerWidth:M,layerHeight:L,fill:Q,abosolute:V}={}){const P=z||new Zn.fabric.Rect({width:M||o.value,height:L||a.value,left:0,top:0,fill:Q||"transparent",absolutePositioned:V||!0,selectable:!1});return new Zn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function U(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),m.value){const z=An();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=B(),i.value.drawLayer=R(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function ne(){var M;O();const z=document.createElement("a");if(m.value){z.href="data:image/png;base64,"+((M=l.value.sourceImage)==null?void 0:M.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function ee(z){return new Promise((M,L)=>{try{z.clone(M)}catch(Q){L(Q)}})}async function se(z){const M={path:z.path};b({history:M,erase:u.value,draw:m.value}),i.value.redoHistory.push(M)}function I(z){if(!i.value.canvas)return;const M=i.value.canvas.getPointer(z.e);f.left=M.x,f.top=M.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),m.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:m,imageProps:i,updateCropPreview:D,createNewCanvas:S,downloadMask:ne,resetCanvas:E,resetDrawing:U,flipErase:g,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const EH={},OH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},AH=re("g",{fill:"none"},[re("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),PH=[AH];function IH(e,t){return j(),ue("svg",OH,PH)}const MH=Yt(EH,[["render",IH]]);async function LH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(m=>i.onload=m),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function RH(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 LH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let m=0;m{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const ng=e=>(Zr("data-v-d200c279"),e=e(),Jr(),e),DH=ng(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),$H={key:0},BH=ng(()=>re("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),FH={class:"canvas-container"},zH=ng(()=>re("canvas",{id:"canvas"},null,-1)),NH={class:"action-buttons",style:{left:"10px",right:"unset"}},jH={class:"action-buttons"},VH=Ee({__name:"CustomCanvas",setup(e){const t=An(),n=$t(),r=vs(),i=oe();async function l(o){if(!o.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const a=await a2(o.raw);t.currentImageProps.sourceImage=a,r.drawing=!1,Zn.fabric.Image.fromURL(a,r.newImage)}function m(){t.currentImageProps.sourceImage="",r.resetCanvas()}return qe(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Zn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(o,a)=>(j(),ue(ze,null,[C(t).currentImageProps.sourceImage?_e("",!0):(j(),we(C(Mp),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ue("div",$H,[BH,re("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:a[0]||(a[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[le(C(De),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[le(n2)]),_:1}),Ue("draw something")])])):_e("",!0)]),default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(qh))]),_:1}),DH]),_:1},512)),mt(re("div",null,[re("div",FH,[zH,re("div",NH,[le(C(lt),{onClick:a[1]||(a[1]=u=>C(r).undoAction()),icon:C(Zb),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),le(C(lt),{onClick:a[2]||(a[2]=u=>C(r).redoAction()),icon:C(Jb),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),re("div",jH,[le(C(lt),{onClick:a[3]||(a[3]=u=>C(r).resetDrawing()),icon:C(_r),plain:""},null,8,["icon"]),le(C(lt),{onClick:m,icon:C(Ac),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[4]||(a[4]=u=>C(r).downloadMask()),icon:C(Ms),plain:""},null,8,["icon"]),le(C(lt),{onClick:a[5]||(a[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(TE):MH,plain:""},null,8,["icon"]),C(r).drawing?(j(),we(C(oB),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":a[6]||(a[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):_e("",!0)]),le(C(kp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[le(Tn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":a[7]||(a[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const O0=Yt(VH,[["__scopeId","data-v-d200c279"]]),UH={class:"centerIcons"},HH={class:"stackedIcons"},WH=Ee({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return lx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ue("div",UH,[re("div",HH,[le(C(De),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1},8,["size"]),le(C(De),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),we(_t(t.iconTwo)))]),_:1},8,["size"])])]))}});const YH=Yt(WH,[["__scopeId","data-v-74586a39"]]),XH={key:1,style:{width:"40px"}},ru=Ee({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),we(C(Tr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[le(C(Ap),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),we(YH,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ue("div",XH,[le(C(De),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),we(_t(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const KH=4,A0=0,P0=1,GH=2;function Ro(e){let t=e.length;for(;--t>=0;)e[t]=0}const qH=0,o2=1,ZH=2,JH=3,QH=258,rg=29,xl=256,Qs=xl+1+rg,io=30,ig=19,s2=2*Qs+1,sa=15,Df=16,eW=7,ag=256,l2=16,u2=17,c2=18,ch=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]),Mu=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]),tW=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]),nW=512,Br=new Array((Qs+2)*2);Ro(Br);const ys=new Array(io*2);Ro(ys);const el=new Array(nW);Ro(el);const tl=new Array(QH-JH+1);Ro(tl);const og=new Array(rg);Ro(og);const uc=new Array(io);Ro(uc);function $f(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 d2,h2,p2;function Bf(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const g2=e=>e<256?el[e]:el[256+(e>>>7)],nl=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},mn=(e,t,n)=>{e.bi_valid>Df-n?(e.bi_buf|=t<>Df-e.bi_valid,e.bi_valid+=n-Df):(e.bi_buf|=t<{mn(e,n[t*2],n[t*2+1])},m2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},rW=e=>{e.bi_valid===16?(nl(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)},iW=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,m=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,a=t.stat_desc.max_length;let u,h,c,f,s,d,v=0;for(f=0;f<=sa;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ua&&(f=a,v++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=o&&(s=m[h-o]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(v!==0){do{for(f=a-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[a]--,v-=2}while(v>0);for(f=a;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},v2=(e,t,n)=>{const r=new Array(sa+1);let i=0,l,m;for(l=1;l<=sa;l++)i=i+n[l-1]<<1,r[l]=i;for(m=0;m<=t;m++){let o=e[m*2+1];o!==0&&(e[m*2]=m2(r[o]++,o))}},aW=()=>{let e,t,n,r,i;const l=new Array(sa+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?nl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},I0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,m,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?pr(e,i,t):(m=tl[i],pr(e,m+xl+1,t),o=ch[m],o!==0&&(i-=og[m],mn(e,i,o)),r--,m=g2(r),pr(e,m,n),o=Mu[m],o!==0&&(r-=uc[m],mn(e,r,o)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let m,o,a=-1,u;for(e.heap_len=0,e.heap_max=s2,m=0;m>1;m>=1;m--)Ff(e,n,m);u=l;do m=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ff(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=m,e.heap[--e.heap_max]=o,n[u*2]=n[m*2]+n[o*2],e.depth[u]=(e.depth[m]>=e.depth[o]?e.depth[m]:e.depth[o])+1,n[m*2+1]=n[o*2+1]=u,e.heap[1]=u++,Ff(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],iW(e,t),v2(n,a,e.bl_count)},L0=(e,t,n)=>{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=m,m=t[(r+1)*2+1],!(++o{let r,i=-1,l,m=t[0*2+1],o=0,a=7,u=4;for(m===0&&(a=138,u=3),r=0;r<=n;r++)if(l=m,m=t[(r+1)*2+1],!(++o{let t;for(L0(e,e.dyn_ltree,e.l_desc.max_code),L0(e,e.dyn_dtree,e.d_desc.max_code),fh(e,e.bl_desc),t=ig-1;t>=3&&e.bl_tree[f2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},sW=(e,t,n,r)=>{let i;for(mn(e,t-257,5),mn(e,n-1,5),mn(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 A0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return P0;for(n=32;n{D0||(aW(),D0=!0),e.l_desc=new Bf(e.dyn_ltree,d2),e.d_desc=new Bf(e.dyn_dtree,h2),e.bl_desc=new Bf(e.bl_tree,p2),e.bi_buf=0,e.bi_valid=0,y2(e)},_2=(e,t,n,r)=>{mn(e,(qH<<1)+(r?1:0),3),b2(e),nl(e,n),nl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},cW=e=>{mn(e,o2<<1,3),pr(e,ag,Br),rW(e)},fW=(e,t,n,r)=>{let i,l,m=0;e.level>0?(e.strm.data_type===GH&&(e.strm.data_type=lW(e)),fh(e,e.l_desc),fh(e,e.d_desc),m=oW(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?_2(e,t,n,r):e.strategy===KH||l===i?(mn(e,(o2<<1)+(r?1:0),3),M0(e,Br,ys)):(mn(e,(ZH<<1)+(r?1:0),3),sW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,m+1),M0(e,e.dyn_ltree,e.dyn_dtree)),y2(e),r&&b2(e)},dW=(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[(tl[n]+xl+1)*2]++,e.dyn_dtree[g2(t)*2]++),e.sym_next===e.sym_end);var hW=uW,pW=_2,gW=fW,mW=dW,vW=cW,yW={_tr_init:hW,_tr_stored_block:pW,_tr_flush_block:gW,_tr_tally:mW,_tr_align:vW};const bW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,m=0;for(;n!==0;){m=n>2e3?2e3:n,n-=m;do i=i+t[r++]|0,l=l+i|0;while(--m);i%=65521,l%=65521}return i|l<<16|0};var rl=bW;const _W=()=>{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},wW=new Uint32Array(_W()),CW=(e,t,n,r)=>{const i=wW,l=r+n;e^=-1;for(let m=r;m>>8^i[(e^t[m])&255];return e^-1};var Vt=CW,Sa={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"},Do={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:SW,_tr_stored_block:dh,_tr_flush_block:xW,_tr_tally:Ti,_tr_align:TW}=yW,{Z_NO_FLUSH:ki,Z_PARTIAL_FLUSH:kW,Z_FULL_FLUSH:EW,Z_FINISH:zn,Z_BLOCK:$0,Z_OK:Gt,Z_STREAM_END:B0,Z_STREAM_ERROR:yr,Z_DATA_ERROR:OW,Z_BUF_ERROR:zf,Z_DEFAULT_COMPRESSION:AW,Z_FILTERED:PW,Z_HUFFMAN_ONLY:iu,Z_RLE:IW,Z_FIXED:MW,Z_DEFAULT_STRATEGY:LW,Z_UNKNOWN:RW,Z_DEFLATED:Wc}=Do,DW=9,$W=15,BW=8,FW=29,zW=256,hh=zW+1+FW,NW=30,jW=19,VW=2*hh+1,UW=15,rt=3,wi=258,br=wi+rt+1,HW=32,_o=42,sg=57,ph=69,gh=73,mh=91,vh=103,la=113,Jo=666,fn=1,$o=2,xa=3,Bo=4,WW=3,ua=(e,t)=>(e.msg=Sa[t],t),F0=e=>e*2-(e>4?9:0),yi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},YW=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 XW=(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))},In=(e,t)=>{xW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,kn(e.strm)},ft=(e,t)=>{e.pending_buf[e.pending++]=t},Yo=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},yh=(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=rl(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Vt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},w2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,m=e.prev_length,o=e.nice_match;const a=e.strstart>e.w_size-br?e.strstart-(e.w_size-br):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+wi;let s=u[r+m-1],d=u[r+m];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(u[i+m]!==d||u[i+m-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rm){if(e.match_start=t,m=l,l>=o)break;s=u[r+m-1],d=u[r+m]}}while((t=c[t&h])>a&&--n!==0);return m<=e.lookahead?m:e.lookahead},wo=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-br)&&(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),YW(e),r+=t),e.strm.avail_in===0)break;if(n=yh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=rt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+rt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,m=0,o=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,kn(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&&(yh(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(m===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(yh(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===zn)&&t!==ki&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,m=t===zn&&e.strm.avail_in===0&&r===i?1:0,dh(e,e.block_start,r,m),e.block_start+=r,kn(e.strm)),m?xa:fn)},Nf=(e,t)=>{let n,r;for(;;){if(e.lookahead=rt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-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-br&&(e.match_length=w2(e,n)),e.match_length>=rt)if(r=Ti(e,e.strstart-e.match_start,e.match_length-rt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=rt){e.match_length--;do e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else r=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(In(e,!1),e.strm.avail_out===0))return fn}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=rt&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-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=rt-1,n!==0&&e.prev_length4096)&&(e.match_length=rt-1)),e.prev_length>=rt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-rt,r=Ti(e,e.strstart-1-e.prev_match,e.prev_length-rt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+rt-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=rt-1,e.strstart++,r&&(In(e,!1),e.strm.avail_out===0))return fn}else if(e.match_available){if(r=Ti(e,0,e.window[e.strstart-1]),r&&In(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return fn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ti(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const m=e.window;for(;;){if(e.lookahead<=wi){if(wo(e),e.lookahead<=wi&&t===ki)return fn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=rt&&e.strstart>0&&(i=e.strstart-1,r=m[i],r===m[++i]&&r===m[++i]&&r===m[++i])){l=e.strstart+wi;do;while(r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=rt?(n=Ti(e,1,e.match_length-rt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(In(e,!1),e.strm.avail_out===0))return fn}return e.insert=0,t===zn?(In(e,!0),e.strm.avail_out===0?xa:Bo):e.sym_next&&(In(e,!1),e.strm.avail_out===0)?fn:$o},GW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(wo(e),e.lookahead===0)){if(t===ki)return fn;break}if(e.match_length=0,n=Ti(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(In(e,!1),e.strm.avail_out===0))return fn}return e.insert=0,t===zn?(In(e,!0),e.strm.avail_out===0?xa:Bo):e.sym_next&&(In(e,!1),e.strm.avail_out===0)?fn:$o};function cr(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 Qo=[new cr(0,0,0,0,C2),new cr(4,4,8,4,Nf),new cr(4,5,16,8,Nf),new cr(4,6,32,32,Nf),new cr(4,4,16,16,Ha),new cr(8,16,32,32,Ha),new cr(8,16,128,128,Ha),new cr(8,32,128,256,Ha),new cr(32,128,258,1024,Ha),new cr(32,258,258,4096,Ha)],qW=e=>{e.window_size=2*e.w_size,yi(e.head),e.max_lazy_match=Qo[e.level].max_lazy,e.good_match=Qo[e.level].good_length,e.nice_match=Qo[e.level].nice_length,e.max_chain_length=Qo[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=rt-1,e.match_available=0,e.ins_h=0};function ZW(){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=Wc,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(VW*2),this.dyn_dtree=new Uint16Array((2*NW+1)*2),this.bl_tree=new Uint16Array((2*jW+1)*2),yi(this.dyn_ltree),yi(this.dyn_dtree),yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(UW+1),this.heap=new Uint16Array(2*hh+1),yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*hh+1),yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Tl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==_o&&t.status!==sg&&t.status!==ph&&t.status!==gh&&t.status!==mh&&t.status!==vh&&t.status!==la&&t.status!==Jo?1:0},S2=e=>{if(Tl(e))return ua(e,yr);e.total_in=e.total_out=0,e.data_type=RW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?sg:t.wrap?_o:la,e.adler=t.wrap===2?0:1,t.last_flush=-2,SW(t),Gt},x2=e=>{const t=S2(e);return t===Gt&&qW(e.state),t},JW=(e,t)=>Tl(e)||e.state.wrap!==2?yr:(e.state.gzhead=t,Gt),T2=(e,t,n,r,i,l)=>{if(!e)return yr;let m=1;if(t===AW&&(t=6),r<0?(m=0,r=-r):r>15&&(m=2,r-=16),i<1||i>DW||n!==Wc||r<8||r>15||t<0||t>9||l<0||l>MW||r===8&&m!==1)return ua(e,yr);r===8&&(r=9);const o=new ZW;return e.state=o,o.strm=e,o.status=_o,o.wrap=m,o.gzhead=null,o.w_bits=r,o.w_size=1<T2(e,t,Wc,$W,BW,LW),eY=(e,t)=>{if(Tl(e)||t>$0||t<0)return e?ua(e,yr):yr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Jo&&t!==zn)return ua(e,e.avail_out===0?zf:yr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(kn(e),e.avail_out===0)return n.last_flush=-1,Gt}else if(e.avail_in===0&&F0(t)<=F0(r)&&t!==zn)return ua(e,zf);if(n.status===Jo&&e.avail_in!==0)return ua(e,zf);if(n.status===_o&&n.wrap===0&&(n.status=la),n.status===_o){let i=Wc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=iu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=HW),i+=31-i%31,Yo(n,i),n.strstart!==0&&(Yo(n,e.adler>>>16),Yo(n,e.adler&65535)),e.adler=1,n.status=la,kn(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===sg){if(e.adler=0,ft(n,31),ft(n,139),ft(n,8),n.gzhead)ft(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)),ft(n,n.gzhead.time&255),ft(n,n.gzhead.time>>8&255),ft(n,n.gzhead.time>>16&255),ft(n,n.gzhead.time>>24&255),ft(n,n.level===9?2:n.strategy>=iu||n.level<2?4:0),ft(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ft(n,n.gzhead.extra.length&255),ft(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ph;else if(ft(n,0),ft(n,0),ft(n,0),ft(n,0),ft(n,0),ft(n,n.level===9?2:n.strategy>=iu||n.level<2?4:0),ft(n,WW),n.status=la,kn(e),n.pending!==0)return n.last_flush=-1,Gt}if(n.status===ph){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=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=o,kn(e),n.pending!==0)return n.last_flush=-1,Gt;i=0,l-=o}let m=new Uint8Array(n.gzhead.extra);n.pending_buf.set(m.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=gh}if(n.status===gh){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=Vt(e.adler,n.pending_buf,n.pending-i,i)),kn(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=mh}if(n.status===mh){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=Vt(e.adler,n.pending_buf,n.pending-i,i)),kn(e),n.pending!==0)return n.last_flush=-1,Gt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i))}n.status=vh}if(n.status===vh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(kn(e),n.pending!==0))return n.last_flush=-1,Gt;ft(n,e.adler&255),ft(n,e.adler>>8&255),e.adler=0}if(n.status=la,kn(e),n.pending!==0)return n.last_flush=-1,Gt}if(e.avail_in!==0||n.lookahead!==0||t!==ki&&n.status!==Jo){let i=n.level===0?C2(n,t):n.strategy===iu?GW(n,t):n.strategy===IW?KW(n,t):Qo[n.level].func(n,t);if((i===xa||i===Bo)&&(n.status=Jo),i===fn||i===xa)return e.avail_out===0&&(n.last_flush=-1),Gt;if(i===$o&&(t===kW?TW(n):t!==$0&&(dh(n,0,0,!1),t===EW&&(yi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),kn(e),e.avail_out===0))return n.last_flush=-1,Gt}return t!==zn?Gt:n.wrap<=0?B0:(n.wrap===2?(ft(n,e.adler&255),ft(n,e.adler>>8&255),ft(n,e.adler>>16&255),ft(n,e.adler>>24&255),ft(n,e.total_in&255),ft(n,e.total_in>>8&255),ft(n,e.total_in>>16&255),ft(n,e.total_in>>24&255)):(Yo(n,e.adler>>>16),Yo(n,e.adler&65535)),kn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Gt:B0)},tY=e=>{if(Tl(e))return yr;const t=e.state.status;return e.state=null,t===la?ua(e,OW):Gt},nY=(e,t)=>{let n=t.length;if(Tl(e))return yr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==_o||r.lookahead)return yr;if(i===1&&(e.adler=rl(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(yi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(t.subarray(n-r.w_size,n),0),t=a,n=r.w_size}const l=e.avail_in,m=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,wo(r);r.lookahead>=rt;){let a=r.strstart,u=r.lookahead-(rt-1);do r.ins_h=Ei(r,r.ins_h,r.window[a+rt-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=rt-1,wo(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=rt-1,r.match_available=0,e.next_in=m,e.input=o,e.avail_in=l,r.wrap=i,Gt};var rY=QW,iY=T2,aY=x2,oY=S2,sY=JW,lY=eY,uY=tY,cY=nY,fY="pako deflate (from Nodeca project)",bs={deflateInit:rY,deflateInit2:iY,deflateReset:aY,deflateResetKeep:oY,deflateSetHeader:sY,deflate:lY,deflateEnd:uY,deflateSetDictionary:cY,deflateInfo:fY};const dY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var hY=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)dY(n,r)&&(e[r]=n[r])}}return e},pY=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;il[254]=il[254]=1;var gY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,m=e.length,o=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const mY=(e,t)=>{if(t<65534&&e.subarray&&k2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=o-1;continue}for(m&=o===2?31:o===3?15:7;o>1&&r1){l[i++]=65533;continue}m<65536?l[i++]=m:(m-=65536,l[i++]=55296|m>>10&1023,l[i++]=56320|m&1023)}return mY(l,i)},yY=(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+il[e[n]]>t?n:t},al={string2buf:gY,buf2string:vY,utf8border:yY};function bY(){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 E2=bY;const O2=Object.prototype.toString,{Z_NO_FLUSH:_Y,Z_SYNC_FLUSH:wY,Z_FULL_FLUSH:CY,Z_FINISH:SY,Z_OK:cc,Z_STREAM_END:xY,Z_DEFAULT_COMPRESSION:TY,Z_DEFAULT_STRATEGY:kY,Z_DEFLATED:EY}=Do;function kl(e){this.options=Yc.assign({level:TY,method:EY,chunkSize:16384,windowBits:15,memLevel:8,strategy:kY},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 E2,this.strm.avail_out=0;let n=bs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==cc)throw new Error(Sa[n]);if(t.header&&bs.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=al.string2buf(t.dictionary):O2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=bs.deflateSetDictionary(this.strm,r),n!==cc)throw new Error(Sa[n]);this._dict_set=!0}}kl.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?SY:_Y,typeof e=="string"?n.input=al.string2buf(e):O2.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===wY||l===CY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=bs.deflate(n,l),i===xY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=bs.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===cc;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};kl.prototype.onData=function(e){this.chunks.push(e)};kl.prototype.onEnd=function(e){e===cc&&(this.result=Yc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function lg(e,t){const n=new kl(t);if(n.push(e,!0),n.err)throw n.msg||Sa[n.err];return n.result}function OY(e,t){return t=t||{},t.raw=!0,lg(e,t)}function AY(e,t){return t=t||{},t.gzip=!0,lg(e,t)}var PY=kl,IY=lg,MY=OY,LY=AY,RY=Do,DY={Deflate:PY,deflate:IY,deflateRaw:MY,gzip:LY,constants:RY};const au=16209,$Y=16191;var BY=function(t,n){let r,i,l,m,o,a,u,h,c,f,s,d,v,g,y,b,_,w,S,x,T,O,A,D;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,D=t.output,m=l-(n-t.avail_out),o=l+(t.avail_out-257),a=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,v=N.lencode,g=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)D[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,da){t.msg="invalid distance too far back",N.mode=au;break e}if(s>>>=w,d-=w,w=l-m,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=au;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)D[l++]=O[T++],D[l++]=O[T++],D[l++]=O[T++],S-=3;S&&(D[l++]=O[T++],S>1&&(D[l++]=O[T++]))}else{T=l-x;do D[l++]=D[T++],D[l++]=D[T++],D[l++]=D[T++],S-=3;while(S>2);S&&(D[l++]=D[T++],S>1&&(D[l++]=D[T++]))}}else if((w&64)===0){_=g[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const a=o.bits;let u=0,h=0,c=0,f=0,s=0,d=0,v=0,g=0,y=0,b=0,_,w,S,x,T,O=null,A;const D=new Uint16Array(Wa+1),N=new Uint16Array(Wa+1);let R=null,B,E,U;for(u=0;u<=Wa;u++)D[u]=0;for(h=0;h=1&&D[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,o.bits=1,0;for(c=1;c0&&(e===j0||f!==1))return-1;for(N[1]=0,u=1;uz0||e===V0&&y>N0)return 1;for(;;){B=u-v,m[h]+1=A?(E=R[m[h]-A],U=O[m[h]-A]):(E=32+64,U=0),_=1<>v)+w]=B<<24|E<<16|U|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--D[u]===0){if(u===f)break;u=t[n+m[h]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),T+=c,d=u-v,g=1<z0||e===V0&&y>N0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-v<<24|64<<16|0),o.bits=s,0};var _s=VY;const UY=0,A2=1,P2=2,{Z_FINISH:U0,Z_BLOCK:HY,Z_TREES:ou,Z_OK:Ta,Z_STREAM_END:WY,Z_NEED_DICT:YY,Z_STREAM_ERROR:Wn,Z_DATA_ERROR:I2,Z_MEM_ERROR:M2,Z_BUF_ERROR:XY,Z_DEFLATED:H0}=Do,Xc=16180,W0=16181,Y0=16182,X0=16183,K0=16184,G0=16185,q0=16186,Z0=16187,J0=16188,Q0=16189,fc=16190,Ir=16191,Vf=16192,ey=16193,Uf=16194,ty=16195,ny=16196,ry=16197,iy=16198,su=16199,lu=16200,ay=16201,oy=16202,sy=16203,ly=16204,uy=16205,Hf=16206,cy=16207,fy=16208,It=16209,L2=16210,R2=16211,KY=852,GY=592,qY=15,ZY=qY,dy=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function JY(){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 $a=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeR2?1:0},D2=e=>{if($a(e))return Wn;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=Xc,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(KY),t.distcode=t.distdyn=new Int32Array(GY),t.sane=1,t.back=-1,Ta},$2=e=>{if($a(e))return Wn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,D2(e)},B2=(e,t)=>{let n;if($a(e))return Wn;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Wn:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,$2(e))},F2=(e,t)=>{if(!e)return Wn;const n=new JY;e.state=n,n.strm=e,n.window=null,n.mode=Xc;const r=B2(e,t);return r!==Ta&&(e.state=null),r},QY=e=>F2(e,ZY);let hy=!0,Wf,Yf;const eX=e=>{if(hy){Wf=new Int32Array(512),Yf=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(_s(A2,e.lens,0,288,Wf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_s(P2,e.lens,0,32,Yf,0,e.work,{bits:5}),hy=!1}e.lencode=Wf,e.lenbits=9,e.distcode=Yf,e.distbits=5},z2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,m,o,a,u,h,c,f,s,d,v,g=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let D,N;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if($a(e)||!e.output||!e.input&&e.avail_in!==0)return Wn;n=e.state,n.mode===Ir&&(n.mode=Vf),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,c=o,f=a,O=Ta;e:for(;;)switch(n.mode){case Xc:if(n.wrap===0){n.mode=Vf;break}for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0),u=0,h=0,n.mode=W0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=It;break}if((u&15)!==H0){e.msg="unknown compression method",n.mode=It;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=It;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=Y0;case Y0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Vt(n.check,A,4,0)),u=0,h=0,n.mode=X0;case X0:for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=K0;case K0:if(n.flags&1024){for(;h<16;){if(o===0)break e;o--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=G0;case G0:if(n.flags&1024&&(s=n.length,s>o&&(s=o),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Vt(n.check,r,s,l)),o-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=q0;case q0:if(n.flags&2048){if(o===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ir;break;case Q0:for(;h<32;){if(o===0)break e;o--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Hf;break}for(;h<3;){if(o===0)break e;o--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=ey;break;case 1:if(eX(n),n.mode=su,t===ou){u>>>=2,h-=2;break e}break;case 2:n.mode=ny;break;case 3:e.msg="invalid block type",n.mode=It}u>>>=2,h-=2;break;case ey:for(u>>>=h&7,h-=h&7;h<32;){if(o===0)break e;o--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=It;break}if(n.length=u&65535,u=0,h=0,n.mode=Uf,t===ou)break e;case Uf:n.mode=ty;case ty:if(s=n.length,s){if(s>o&&(s=o),s>a&&(s=a),s===0)break e;i.set(r.subarray(l,l+s),m),o-=s,l+=s,a-=s,m+=s,n.length-=s;break}n.mode=Ir;break;case ny:for(;h<14;){if(o===0)break e;o--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=It;break}n.have=0,n.mode=ry;case ry:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},O=_s(UY,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid code lengths set",n.mode=It;break}n.have=0,n.mode=iy;case iy:for(;n.have>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=It;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=It;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===It)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=It;break}if(n.lenbits=9,D={bits:n.lenbits},O=_s(A2,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,O){e.msg="invalid literal/lengths set",n.mode=It;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},O=_s(P2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,O){e.msg="invalid distances set",n.mode=It;break}if(n.mode=su,t===ou)break e;case su:n.mode=lu;case lu:if(o>=6&&a>=258){e.next_out=m,e.avail_out=a,e.next_in=l,e.avail_in=o,n.hold=u,n.bits=h,BY(e,f),m=e.next_out,i=e.output,a=e.avail_out,l=e.next_in,r=e.input,o=e.avail_in,u=n.hold,h=n.bits,n.mode===Ir&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=uy;break}if(b&32){n.back=-1,n.mode=Ir;break}if(b&64){e.msg="invalid literal/length code",n.mode=It;break}n.extra=b&15,n.mode=ay;case ay:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=oy;case oy:for(;g=n.distcode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(o===0)break e;o--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(o===0)break e;o--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=It;break}n.offset=_,n.extra=b&15,n.mode=sy;case sy:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=It;break}n.mode=ly;case ly:if(a===0)break e;if(s=f-a,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=It;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,d=m-n.offset,s=n.length;s>a&&(s=a),a-=s,n.length-=s;do i[m++]=v[d++];while(--s);n.length===0&&(n.mode=lu);break;case uy:if(a===0)break e;i[m++]=n.length,a--,n.mode=lu;break;case Hf:if(n.wrap){for(;h<32;){if(o===0)break e;o--,u|=r[l++]<{if($a(e))return Wn;let t=e.state;return t.window&&(t.window=null),e.state=null,Ta},rX=(e,t)=>{if($a(e))return Wn;const n=e.state;return(n.wrap&2)===0?Wn:(n.head=t,t.done=!1,Ta)},iX=(e,t)=>{const n=t.length;let r,i,l;return $a(e)||(r=e.state,r.wrap!==0&&r.mode!==fc)?Wn:r.mode===fc&&(i=1,i=rl(i,t,n,0),i!==r.check)?I2:(l=z2(e,t,n,n),l?(r.mode=L2,M2):(r.havedict=1,Ta))};var aX=$2,oX=B2,sX=D2,lX=QY,uX=F2,cX=tX,fX=nX,dX=rX,hX=iX,pX="pako inflate (from Nodeca project)",Fr={inflateReset:aX,inflateReset2:oX,inflateResetKeep:sX,inflateInit:lX,inflateInit2:uX,inflate:cX,inflateEnd:fX,inflateGetHeader:dX,inflateSetDictionary:hX,inflateInfo:pX};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 mX=gX;const N2=Object.prototype.toString,{Z_NO_FLUSH:vX,Z_FINISH:yX,Z_OK:ol,Z_STREAM_END:Xf,Z_NEED_DICT:Kf,Z_STREAM_ERROR:bX,Z_DATA_ERROR:py,Z_MEM_ERROR:_X}=Do;function El(e){this.options=Yc.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 E2,this.strm.avail_out=0;let n=Fr.inflateInit2(this.strm,t.windowBits);if(n!==ol)throw new Error(Sa[n]);if(this.header=new mX,Fr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=al.string2buf(t.dictionary):N2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Fr.inflateSetDictionary(this.strm,t.dictionary),n!==ol)))throw new Error(Sa[n])}El.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,m,o;if(this.ended)return!1;for(t===~~t?m=t:m=t===!0?yX:vX,N2.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=Fr.inflate(n,m),l===Kf&&i&&(l=Fr.inflateSetDictionary(n,i),l===ol?l=Fr.inflate(n,m):l===py&&(l=Kf));n.avail_in>0&&l===Xf&&n.state.wrap>0&&e[n.next_in]!==0;)Fr.inflateReset(n),l=Fr.inflate(n,m);switch(l){case bX:case py:case Kf:case _X:return this.onEnd(l),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(n.avail_out===0||l===Xf))if(this.options.to==="string"){let a=al.utf8border(n.output,n.next_out),u=n.next_out-a,h=al.buf2string(n.output,a);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(a,a+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===ol&&o===0)){if(l===Xf)return l=Fr.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};El.prototype.onData=function(e){this.chunks.push(e)};El.prototype.onEnd=function(e){e===ol&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Yc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ug(e,t){const n=new El(t);if(n.push(e),n.err)throw n.msg||Sa[n.err];return n.result}function wX(e,t){return t=t||{},t.raw=!0,ug(e,t)}var CX=El,SX=ug,xX=wX,TX=ug,kX=Do,EX={Inflate:CX,inflate:SX,inflateRaw:xX,ungzip:TX,constants:kX};const{Deflate:CG,deflate:SG,deflateRaw:OX,gzip:xG}=DY,{Inflate:TG,inflate:kG,inflateRaw:AX,ungzip:EG}=EX;var PX=OX,IX=AX;function gy(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 MX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=gy(t);if(console.log("URL params:",n),n.get("share")){const l=IX(new Uint8Array(atob(n.get("share")).split("").map(m=>m.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=gy(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||20),cfg_scale:Number(n.get("cfg_scale")||5),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0),frames:Number(n.get("frames")||1),scheduler:n.get("scheduler")||"default"};An().generateText2Img(r,!1)},LX=10;function bh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(m=>`${m[0]} - ${m[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const RX=So("interrogate",()=>{const e=oe({}),t=oe(!1);async function n(m){$t().raiseError(m,!1),t.value=!1,e.value={}}async function r(){const m=nn(),{source_image:o}=e.value;if(!o)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const a=await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:o.split(",")[1],model:"clip"})}),u=await a.json();!bh(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}}),cg=e=>(Zr("data-v-db184ac6"),e=e(),Jr(),e),DX={key:0,style:{"margin-top":"16px"}},$X=cg(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),BX={key:1,style:{"margin-top":"16px"}},FX={key:2},zX={style:{"margin-top":"8px"}},NX=cg(()=>re("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),jX={key:0},VX=cg(()=>re("h3",null,"Caption",-1)),UX={key:0},HX={key:1},WX=Ee({__name:"InterrogationView",setup(e){const t=RX(),n=An(),r=$t(),i=oe();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await a2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function m(){n.generateText2Img({prompt:o.value})}const o=te(()=>t.getFormStatus()),{ellipsis:a}=r2();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ue("div",FX,[re("div",zX,[le(C(lt),{icon:C(ss),onClick:C(t).resetInterrogation},{default:pe(()=>[Ue("New Interrogation")]),_:1},8,["icon","onClick"]),C(o)?(j(),we(C(lt),{key:0,icon:C(ss),onClick:m,disabled:!C(o)},{default:pe(()=>[Ue("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):_e("",!0)]),NX,le(C(Ep),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(o)?(j(),ue("div",jX,[VX,C(o)?(j(),ue("div",HX,[re("strong",null,Pe(C(o)),1)])):(j(),ue("div",UX,"Processing"+Pe(C(a)),1))])):_e("",!0)])):(j(),ue("div",BX,[re("strong",null,"Uploading image"+Pe(C(a)),1)])):(j(),ue("div",DX,[re("div",null,[le(C(Mp),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(qh))]),_:1}),$X]),_:1},512)])]))}});const YX=Yt(WX,[["__scopeId","data-v-db184ac6"]]);function XX(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),m=Math.floor(e%86400%3600%60),o=r>0?r+(t?"d":"days"):"",a=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=m>0?m+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(o),n!=null&&n.hours&&c.push(a),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const KX={class:"form"},GX={key:0,style:{"padding-bottom":"50px"}},qX=re("h1",{style:{margin:"0"}},"Interrogation",-1),ZX=re("div",null,"Interrogate images to get their predicted descriptions.",-1),JX={class:"sidebar"},QX=re("span",{style:{height:"100%","font-size":"14px"}},[Ue("Reference Image: "),re("br"),Ue("(Photomaker/Kontext) ")],-1),eK=re("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),tK={class:"main"},nK={class:"image center-horizontal"},rK={key:0},iK=Ee({__name:"GenerateView",setup(e){const n=fp(cp).smallerOrEqual("md"),r=An(),i=$t(),l=vs(),m=nn();let o=[];const a=aI(async()=>{if(o.length===0)try{o=(await(await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/samplers`)).json()).map(g=>g.name)}catch{o=[]}return o.length===0?[]:c(o)}),u=["default","discrete","karras","exponential","ays","gits","sgm_uniform","simple","smoothstep"],h=Ct({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function c(g){return!r.params||!r.params.sampler_name||g.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=g[0]),g}function f(g){return"Elapsed: "+XX(g,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function s(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function d(g){r.generatorType=g,s(),console.log(g)}function v(){l.showCropPreview=!0,l.updateCropPreview()}return s(),MX(),(g,y)=>(j(),ue(ze,null,[le(C(K1),{"default-active":C(r).generatorType,collapse:!0,onSelect:d,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[le(ru,{index:"Text2Img","icon-one":C(Yk),"icon-two":C(Bl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ru,{index:"Img2Img","icon-one":C(Bl),"icon-two":C(Bl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),le(ru,{index:"Inpainting","icon-one":n2,"icon-two":C(Bl),isMobile:C(n)},null,8,["icon-two","isMobile"]),le(ru,{index:"Interrogation","icon-one":qU,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),re("div",KX,[C(r).generatorType==="Interrogation"?(j(),ue("div",GX,[qX,ZX,le(YX)])):(j(),we(C(kp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:h,onSubmit:y[28]||(y[28]=Je(()=>{},["prevent"]))},{default:pe(()=>[re("div",JX,[le(C(D$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":y[23]||(y[23]=b=>C(i).activeCollapse=b),style:{"margin-bottom":"24px"}},{default:pe(()=>[le(C($$),{title:"Generation Options",name:"1"},{default:pe(()=>[le(pH),le(uh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":y[0]||(y[0]=b=>C(r).negativePrompt=b),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),le(uh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":y[2]||(y[2]=b=>C(r).params.seed=b),placeholder:"Enter seed here"},{append:pe(()=>[le(C(Tr),{content:"Randomize!",placement:"top"},{default:pe(()=>[le(C(lt),{icon:C(d3),onClick:y[1]||(y[1]=()=>C(r).params.seed=C(j2)())},null,8,["icon"])]),_:1})]),_:1},8,["modelValue"]),C(r).multiSelect.sampler.enabled?(j(),we(Iu,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":y[3]||(y[3]=b=>C(r).multiSelect.sampler.selected=b),options:C(a),info:"Multi-select enabled. Heun and DPM2 double generation time per step, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),we(Iu,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":y[4]||(y[4]=b=>C(r).params.sampler_name=b),options:C(a),info:"Heun and DPM2 double generation time per step, but converge twice as fast."},null,8,["modelValue","options"])),le(Tn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":y[5]||(y[5]=b=>C(r).params.n=b),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),we(Tn,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":y[6]||(y[6]=b=>C(r).multiSelect.steps.selected=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(Tn,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":y[7]||(y[7]=b=>C(r).params.steps=b),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),le(Tn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":y[8]||(y[8]=b=>C(r).params.width=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),le(Tn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":y[9]||(y[9]=b=>C(r).params.height=b),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:v},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),we(Tn,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":y[10]||(y[10]=b=>C(r).multiSelect.guidance.selected=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(Tn,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":y[11]||(y[11]=b=>C(r).params.cfg_scale=b),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),we(Tn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":y[12]||(y[12]=b=>C(r).multiSelect.clipSkip.selected=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),we(Tn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":y[13]||(y[13]=b=>C(r).params.clip_skip=b),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),we(Tn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":y[14]||(y[14]=b=>C(r).params.denoising_strength=b),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):_e("",!0),le(Tn,{label:"Video Frames",prop:"frames",modelValue:C(r).params.frames,"onUpdate:modelValue":y[15]||(y[15]=b=>C(r).params.frames=b),min:C(r).minFrames,max:C(r).maxFrames,info:"Number of consecutive video frames to generate (Video models only). Max 80 frames, about 5 seconds of video."},null,8,["modelValue","min","max"]),le(Iu,{label:"Scheduler",prop:"scheduler",modelValue:C(r).params.scheduler,"onUpdate:modelValue":y[16]||(y[16]=b=>C(r).params.scheduler=b),options:u,info:"Experimental! KoboldCpp only, allows you to use a different scheduler. Leave as default otherwise."},null,8,["modelValue"]),re("div",null,[QX,re("input",{class:"el-button",type:"file",id:"extra_image_input",onChange:y[17]||(y[17]=b=>C(r).setExtraImage(b)),accept:"image/*",multiple:""},null,32),re("button",{onClick:y[18]||(y[18]=b=>C(r).clearExtraImage()),class:"el-button"},"Clear Image")]),eK,le(C(yj),null,{default:pe(()=>[le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":y[19]||(y[19]=b=>C(r).multiSelect.sampler.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":y[20]||(y[20]=b=>C(r).multiSelect.guidance.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":y[21]||(y[21]=b=>C(r).multiSelect.clipSkip.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"]),le(C(Hl),{span:C(n)?24:12},{default:pe(()=>[le(nu,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":y[22]||(y[22]=b=>C(r).multiSelect.steps.enabled=b)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),re("div",tK,[le(C(lt),{onClick:y[24]||(y[24]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).resetStore()}),class:"reset-btn"},{default:pe(()=>[Ue("Reset")]),_:1}),le(C(lt),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:y[25]||(y[25]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[re("span",null," Generate "+Pe(C(r).totalImageCount)+" image"+Pe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),we(C(lt),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:y[26]||(y[26]=()=>{C(r).cancelled=!0,C(r).generating=!1,C(r).clearQueue()})},{default:pe(()=>[Ue("Cancel all")]),_:1},8,["disabled"])):_e("",!0)]),re("div",nK,[le(C(BD),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ue("div",rK,[/Inpainting/.test(C(r).generatorType)?(j(),we(O0,{key:0})):_e("",!0),/Img2Img/.test(C(r).generatorType)?(j(),we(O0,{key:1})):_e("",!0)])):_e("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),we(iH,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:f(C(r).timer.seconds),onShowGenerated:y[27]||(y[27]=b=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):_e("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),we(xH,{key:2})):_e("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const ws=LT({history:qx("./"),routes:[{path:"/",name:"generate",component:iK},{path:"/images",name:"images",component:()=>Lf(()=>Promise.resolve().then(()=>QK),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>Lf(()=>Promise.resolve().then(()=>dG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>Lf(()=>Promise.resolve().then(()=>_G),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Gf(){return{steps:20,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:5,clip_skip:0,seed:-1,denoising_strength:.6,frames:1,scheduler:"default"}}function j2(){return Math.floor(Math.random()*9999999)+1}const An=So("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=oe("Text2Img"),r=oe(""),i=Bn("promptHistory",[]),l=oe(""),m=Bn("negativeLibrary",[]),o=oe(Gf()),a=oe({interval:0,seconds:0}),u=oe({sampler:{name:"Sampler",enabled:!1,selected:[o.value.sampler_name],noneMessage:"Failed to generate: No sampler selected.",mapToParam:K=>K.sampler_name},steps:{name:"Steps",enabled:!1,selected:[o.value.steps],noneMessage:"Failed to generate: No steps selected.",mapToParam:K=>K.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[o.value.cfg_scale],noneMessage:"Failed to generate: No guidance selected.",mapToParam:K=>K.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[o.value.clip_skip],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:K=>K.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=oe({...h(),sourceProcessing:"inpainting"}),f=oe({...h(),sourceProcessing:"img2img"}),s=K=>K==="Inpainting"?c.value:K==="Img2Img"?f.value:h(),d=te(()=>s(n.value)),v=oe(""),g=oe(!1),y=oe(!1),b=oe([]),_=oe([]),w=oe(64),S=te(()=>nn().allowLargerParams==="Enabled"?3072:1024),x=oe(1),T=oe(20),O=oe(1),A=te(()=>nn().allowLargerParams==="Enabled"?150:50),D=oe(1),N=oe(24),R=oe(.1),B=oe(1),E=oe(0),U=oe(10),ne=oe(1),ee=oe(80),se=(K,ce,be)=>Array.from({length:(ce-K+1)/be},(Ce,Te)=>(Te+K)*be),I=oe(se(E.value,U.value,1)),z=oe(se(D.value,N.value,.5)),M=te(()=>{const K=(Se,Me,Re=1)=>Se*(Me.enabled?Me.selected.length:Re),be=o.value.n*H().length,Ce=K(be,u.value.sampler),Te=K(Ce,u.value.steps),Ae=K(Te,u.value.guidance);return K(Ae,u.value.clipSkip)});function L(){return o.value=Gf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,Q(),!0}function Q(){_.value=[]}async function V(K){if(!e.includes(K))return[];if(r.value==="")return q("Failed to generate: No prompt submitted.");for(const nt of Object.values(u.value))if(nt.enabled&&nt.selected.length===0)return q(nt.noneMessage);const ce=vs(),be=$t();ce.saveImages();const{sourceImage:Ce,maskImage:Te,sourceProcessing:Ae}=s(K);F(r.value);const ye=[],Se=(nt,Jt)=>nt.enabled?nt.selected:Jt,Me=H(),Re=Se(u.value.guidance,[o.value.cfg_scale]),ht=Se(u.value.steps,[o.value.steps]),pt=Se(u.value.clipSkip,[o.value.clip_skip]),st=Se(u.value.sampler,[o.value.sampler_name]),Xt=[await X()];for(const nt of Re)for(const Jt of ht)for(const Kn of pt)for(const Cn of Me){const Ni=Cn.split(" ### ");for(const Y2 of st){let Pl=parseInt(o.value.seed.toString());(isNaN(Pl)||Pl<0)&&(Pl=j2());for(let Gc=0;Gc0&&(Er.params.extra_images=ae),ye.push(Er)}}}let Kt=!1;g.value||(Kt=!0),g.value=!0,be.showGeneratedImages=!1;for(let nt=0;nt{a.value.seconds++},1e3);!_.value.every(nt=>nt.gathered||nt.failed)&&!y.value;){const nt=_.value.filter(Kn=>!Kn.gathered&&!Kn.failed),Jt=ai(nt);for(const[Kn,Cn]of nt.slice(0,Jt).entries()){if(y.value)break;Cn.gathered=!0;try{const Ni=await Y(Cn.params);if(!Ni){Cn.failed=!0;continue}P([{...Ni,...Cn}])}catch(Ni){Cn.failed=!0,console.error("Error fetching image:",Ni)}}}}async function P(K){const ce=Ca();console.log(K);const be=await Promise.all(K.map(async Ae=>{const ye=Ae.images[0],Me=!!Ae.animated?"gif":"png";return{id:-1,image:`data:image/${Me};base64,${ye}`,prompt:Ae.prompt,clip_skip:Ae.params.clip_skip,modelName:Ae.models[0],seed:Ae.params.seed,steps:Ae.params.steps,sampler_name:Ae.params.sampler_name,cfg_scale:Ae.params.cfg_scale,width:Ae.params.width,height:Ae.params.height,frames:Ae.params.frames,scheduler:Ae.params.scheduler}})),Ce=await ce.pushOutputs(be),Te=0;return b.value=[...Ce.map(Ae=>({type:"image",index:Te,output:Ae})),...b.value].sort((Ae,ye)=>Ae.index-ye.index),b.value.length===_.value.length&&(_.value=[],g.value=!1,$t().showGeneratedImages=!0,clearInterval(a.value.interval),a.value.interval=0,a.value.seconds=0),be}async function q(K){const ce=$t();return K&&ce.raiseError(K,!1),[]}function Z(K,ce,be,Ce){return ce<=be?ce:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${K}' to its default value instead of ${ce}.`,!0),Ce)}function ie(K,ce=!0){const be=Gf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,ws.push("/"),ce&&(K.width=K.width||be.width,K.height=K.height||be.height),K.prompt){const Ce=K.prompt.split(" ### ");r.value=Ce[0],l.value=Ce[1]||""}K.sampler_name&&(o.value.sampler_name=K.sampler_name),K.steps&&(o.value.steps=Z("steps",K.steps,A.value,be.steps)),K.cfg_scale&&(o.value.cfg_scale=K.cfg_scale),K.width&&(o.value.width=Z("width",K.width,S.value,be.width)),K.height&&(o.value.height=Z("height",K.height,S.value,be.height)),K.seed&&(o.value.seed=K.seed),K.clip_skip&&(o.value.clip_skip=Z("clip_skip",K.clip_skip,U.value,be.clip_skip)),K.scheduler&&(o.value.scheduler=K.scheduler),K.frames&&(o.value.frames=Z("frames",K.frames,ee.value,be.frames))}function he(K){const ce=vs();n.value="Img2Img",f.value.sourceImage=K,ce.drawing=!1,b.value=[],ws.push("/"),Zn.fabric.Image.fromURL(K,ce.newImage)}function me(K){const ce=vs();b.value=[],c.value.sourceImage=K,n.value="Inpainting",ws.push("/"),Zn.fabric.Image.fromURL(K,ce.newImage)}function ve(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function H(){const K=ve(),ce=K.match(/\{(.*?)\}/g)||[];if(ce.length===0)return[K];let be=[];return ce.forEach(Ce=>{const Te=[],Ae=Ce.replace("{","").replace("}","").split("|");be.length===0?Ae.forEach(ye=>{const Se=K.replace(Ce,ye);Te.push(Se)}):be.forEach(ye=>{Ae.forEach(Se=>{const Me=ye.replace(Ce,Se);Te.push(Me)})}),be=[...Te]}),be}async function Y(K){const ce=nn();try{const be=await fetch(`${ce.baseURL.length===0?".":ce.baseURL}/sdapi/v1/${K.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}),Ce=await be.json();return bh(be,Ce,200,"Failed to fetch",k)?Ce:!1}catch{return!1}}function k(K){return $t().raiseError(K,!1),y.value=!1,b.value=[],!1}async function X(){const K=nn(),ce=await fetch(`${K.baseURL.length===0?".":K.baseURL}/sdapi/v1/sd-models`),be=await ce.json();if(!!bh(ce,be,200,"Failed to get available models"))return be.length===0?"(No model loaded)":be[0].model_name}function W(K){m.value.indexOf(K)===-1&&(m.value=[...m.value,K])}function $(K){m.value=m.value.filter(ce=>ce!=K)}function F(K){if(i.value.findIndex(ce=>ce.prompt===K)===-1){if(i.value.length>=10+i.value.filter(ce=>ce.starred).length){const ce=i.value.filter(Ce=>!Ce.starred),be=i.value.findIndex(Ce=>Ce===ce[ce.length-1]);i.value.splice(be,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:K}]}}function G(K){i.value=i.value.filter(ce=>ce.prompt!=K&&ce!=K)}function de(){return!1}var ae=[];function J(K){let ce=K.target;if(ae=[],ce.files.length>0)for(let be=0;benew DataView(new ArrayBuffer(e)),Ba=e=>new Uint8Array(e.buffer||e),Za=e=>new TextEncoder().encode(String(e));function aK(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:Za(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:Ba(e)};if(Symbol.asyncIterator in e)return{t,o:V2(e)};throw new TypeError("Unsupported input format.")}function V2(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=oK(i.value);n.enqueue(l),r+=l.byteLength}}}})}function oK(e){return typeof e=="string"?Za(e):e instanceof Uint8Array?e:Ba(e)}function sK(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=Za(t)),e instanceof File)return{i:t||Za(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),m=l&&decodeURIComponent(l),o=n||+e.headers.get("content-length");return{i:t||Za(m),A:o}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:Za(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 lK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:uK,m:cK}=lK.exports,fK=Ba(cK).subarray(65536);function my(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))fK.set(n),t=uK(n.length,t);return t}function U2(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 dK(e){const t=Kc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),U2(e.t,t,10),t.setUint16(26,e.i.length,1),Ba(t)}async function*hK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=my(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=my(r,e.u),e.A+=r.length,yield r}}}function pK(e){const t=Kc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),Ba(t)}function gK(e,t){const n=Kc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),U2(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),Ba(n)}function mK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function vK(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(V2(async function*(r){const i=[];let l=0,m=0;for await(const u of r)yield dK(u),yield u.i,yield*hK(u),yield pK(u),i.push(gK(u,l)),i.push(u.i),m++,l+=46+u.i.length+u.A;let o=0;for(const u of i)yield u,o+=u.length;const a=Kc(22);a.setUint32(0,1347093766),a.setUint16(8,m,1),a.setUint16(10,m,1),a.setUint32(12,o,1),a.setUint32(16,l,1),yield Ba(a)}(async function*(r){for await(const i of r){const[l,m]=mK(i);yield Object.assign(aK(...m),sK(...l))}}(e))),{headers:n})}async function H2(e,t=!0,n){const r=nn();t&&Ri({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 oa(u,"image/png")}):s==="JPG"?i.push({name:f+".jpg",input:await oa(u,"image/jpeg")}):s==="GIF"?i.push({name:f+".gif",input:await oa(u,"image/gif")}):i.push({name:f+".webp",input:await oa(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await vK(i).blob(),m=document.createElement("a");m.href=URL.createObjectURL(l),m.download="sdui_images.zip",m.click()}async function yK(e,t){const n=nn(),r=document.createElement("a");let i,l=n.imageDownloadType;e.startsWith("data:image/gif")&&(l="GIF"),l==="PNG"?(i=await oa(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):l==="JPG"?(i=await oa(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):l==="GIF"?(i=await oa(e,"image/gif"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".gif"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const W2=Ee({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=An(),r=Ca(),i=()=>{ow.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ri({type:"success",message:"Deleted Image"})})};async function l(m){const o=window.location.origin,a={prompt:m.prompt,width:m.width?m.width:void 0,height:m.height?m.height:void 0,steps:m.steps,cfg_scale:m.cfg_scale,sampler_name:m.sampler_name,model_name:m.modelName,seed:m.seed,clip_skip:m.clip_skip,frames:m.frames,scheduler:m.scheduler},u=window.location.pathname.replace("images","");let h=`${o}${u}?share=`,c="",f="";for(const[d,v]of Object.entries(a)){if(!v)continue;let g=v;typeof v=="string"?g=encodeURIComponent(v):Array.isArray(v)&&(g=JSON.stringify(v)),c+=`${f}${d}=${g}`,f="&"}h+=btoa(String.fromCharCode.apply(null,Array.from(PX(c)))),await navigator.clipboard.writeText(h),Ri({type:"success",message:"Copied shareable link to clipboard"})}return(m,o)=>(j(),ue(ze,null,[le(C(lt),{onClick:i,type:"danger",icon:C(Ac),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(lt),{onClick:o[0]||(o[0]=a=>C(yK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",icon:C(Ms),plain:""},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"]),e.imageData.starred?_e("",!0):(j(),we(C(lt),{key:0,onClick:o[1]||(o[1]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(NO),plain:""},{default:pe(()=>[Ue("Favourite")]),_:1},8,["icon"])),e.imageData.starred?(j(),we(C(lt),{key:1,onClick:o[2]||(o[2]=a=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(Qb),plain:""},{default:pe(()=>[Ue("Unfavourite")]),_:1},8,["icon"])):_e("",!0),le(C(lt),{onClick:o[3]||(o[3]=a=>C(n).generateText2Img(e.imageData)),type:"success",icon:C(ss),plain:""},{default:pe(()=>[Ue("Text2img")]),_:1},8,["icon"]),le(C(lt),{onClick:o[4]||(o[4]=a=>C(n).generateImg2Img(e.imageData.image)),type:"success",icon:C(ss),plain:""},{default:pe(()=>[Ue("Img2img")]),_:1},8,["icon"]),le(C(lt),{onClick:o[5]||(o[5]=a=>C(n).generateInpainting(e.imageData.image)),type:"success",icon:C(ss),plain:""},{default:pe(()=>[Ue("Inpainting")]),_:1},8,["icon"]),le(C(lt),{onClick:o[6]||(o[6]=a=>l(e.imageData)),type:"success",icon:C(t3),plain:""},{default:pe(()=>[Ue("Copy Link")]),_:1},8,["icon"])],64))}}),bK={class:"main-output",style:{position:"relative",display:"flex","align-items":"center","justify-content":"center"}},_K=["src"],wK={style:{"font-size":"18px","font-weight":"500"}},CK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},SK=Ee({__name:"ImageDialog",setup(e){const t=Ca(),n=$t(),r=oe();MI(r,{onSwipeEnd(o,a){a==="RIGHT"&&n.openModalToLeft(),a==="LEFT"&&n.openModalToRight()}});const i=te({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=oe(t.currentOutputs[0]);ke(()=>n.activeModal,async()=>{const o=t.currentOutputs.find(a=>a.id===n.activeModal);if(o)return l.value=o;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function m(){i.value=!1}return(o,a)=>{var u;return j(),we(C(xB),{"model-value":C(i),width:(u=l.value)==null?void 0:u.width,class:"image-viewer",onClosed:m,"align-center":""},{default:pe(()=>{var h,c,f;return[re("div",{class:"main-output-container",ref_key:"target",ref:r},[re("div",bK,[(h=l.value)!=null&&h.image?(j(),ue("img",{key:0,src:l.value.image,alt:"Output image",style:{"max-width":"100%","max-height":"100%","object-fit":"contain"}},null,8,_K)):_e("",!0)])],512),re("div",wK,Pe(((c=l.value.prompt)==null?void 0:c.split("###")[0])||"Unkown Creation"),1),re("div",CK,[re("div",null,"Negative Prompt: "+Pe(((f=l.value.prompt)==null?void 0:f.split("###")[1])||"None"),1),re("span",null,"Model: "+Pe(l.value.modelName||"Unknown")+" - ",1),re("span",null,"Sampler: "+Pe(l.value.sampler_name||"Unknown")+" - ",1),re("span",null,"Seed: "+Pe(l.value.seed||"Unknown")+" - ",1),re("span",null,"Steps: "+Pe(l.value.steps||"Unknown")+" - ",1),re("span",null,"CFG Scale: "+Pe(l.value.cfg_scale||"Unknown")+" - ",1),re("span",null,"Clip Skip: "+Pe(l.value.clip_skip||"Unknown")+" - ",1),re("span",null,"Dimensions: "+Pe(l.value.width||"???")+"x"+Pe(l.value.height||"???")+" - ",1)]),re("div",null,[le(W2,{"image-data":l.value},null,8,["image-data"])])]}),_:1},8,["model-value","width"])}}});const xK=e=>(Zr("data-v-8f4d2380"),e=e(),Jr(),e),TK=xK(()=>re("div",{style:{"font-size":"20px"}},"Stable UI",-1)),kK={class:"generator-icons"},EK=Ee({__name:"App",setup(e){const n=fp(cp).smallerOrEqual("md"),r=$t();nn();const i=DT(),l=oe();return ke(()=>i.path,m=>{l.value&&l.value.open(m)}),(m,o)=>(j(),ue(ze,null,[re("div",{class:fe({"menu-container":!C(n)})},[le(C(K1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?_e("",!0):(j(),we(C(Ap),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[TK]),_:1})),le(Wo,{isMobile:C(n),index:"/"},{icon:pe(()=>[re("div",kK,[le(C(De),null,{default:pe(()=>[le(C(N3))]),_:1}),C(r).showGeneratorBadge?(j(),we(C(De),{key:0,class:"generator-badge",size:10},{default:pe(()=>[le(DU)]),_:1})):_e("",!0)])]),title:pe(()=>[Ue("Generate")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/images"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(y3))]),_:1})]),title:pe(()=>[Ue("Images")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/about"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Gb))]),_:1})]),title:pe(()=>[Ue("About")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/options"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(ZO))]),_:1})]),title:pe(()=>[Ue("Options")]),_:1},8,["isMobile"]),le(Wo,{isMobile:C(n),index:"/return"},{icon:pe(()=>[le(C(De),null,{default:pe(()=>[le(C(Wb))]),_:1})]),title:pe(()=>[Ue("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),re("div",{class:fe({view:!C(n)})},[le(C(Hb))],2),le(SK)],64))}});const OK=Yt(EK,[["__scopeId","data-v-8f4d2380"]]);const fg=Tx(OK);fg.use(Ox());fg.use(ws);fg.mount("#app");ws.replace("/");const AK={key:1,class:"image-action"},PK=Ee({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=oe(null);cI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=oe(!1);II(r,([{isIntersecting:m}])=>{m&&(i.value=m)},{rootMargin:"500px"});const l=te(()=>n.selected.includes(t.imageData.id));return(m,o)=>(j(),ue("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),we(C(Ep),{key:0,class:"thumbnail",src:e.imageData.image,onClick:o[0]||(o[0]=a=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):_e("",!0),i.value?(j(),ue("div",AK,[e.imageData.starred?(j(),we(C(De),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[le(C(Qb))]),_:1})):_e("",!0),C(n).multiSelect?(j(),ue("div",{key:1,class:"select-container",onClick:o[1]||(o[1]=a=>C(n).toggleSelection(e.imageData.id))},[le(C(De),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?_e("",!0):(j(),we(C(cl),{key:0})),C(l)?(j(),we(C(Xb),{key:1})):_e("",!0)]),_:1},8,["color"])])):_e("",!0)])):_e("",!0)],512))}});const vy=Yt(PK,[["__scopeId","data-v-b9569bbd"]]);const IK={},MK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},LK=re("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),RK=[LK];function DK(e,t){return j(),ue("svg",MK,RK)}const $K=Yt(IK,[["render",DK]]),BK=e=>(Zr("data-v-301360a8"),e=e(),Jr(),e),FK={class:"images-top-bar"},zK={class:"options"},NK=["onClick"],jK=["onClick"],VK=["onClick"],UK={key:1,class:"center-both",style:{gap:"12px"}},HK={key:2},WK=BK(()=>re("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),YK=[WK],XK={key:0},KK={key:0,style:{display:"flex",gap:"8px"}},GK={key:1,class:"images"},qK={key:1},ZK=Ee({__name:"ImagesView",setup(e){const{width:t}=jI(),n=Ca(),r=nn(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function m(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function o(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function a(){i.selected=[],i.multiSelect=!1}const u=()=>{ow.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};Jm(["a","A","ArrowLeft"],i.openModalToLeft),Jm(["d","D","ArrowRight"],i.openModalToRight);async function h(){H2(i.selected)}const c=te(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ue(ze,null,[re("div",FK,[re("div",zK,[le(C(Xl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(AO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["Newest","Oldest"],d=>re("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Pe(d),11,NK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le(C(IE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>re("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Pe(C(n).filterBy===d?"Showing":"Show")+" "+Pe(d),11,jK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[le($K)]),_:1})]),_:1})]),default:pe(()=>[(j(),ue(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>re("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Pe(d.label),11,VK)),64))]),_:1}),le(C(Xl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[le(C(lt),{class:"btn-select"},{default:pe(()=>[le(C(De),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),we(C(Xb),{key:0})):(j(),we(C(cl),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ue("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ue("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ue("div",{key:2,class:"el-select-dropdown__item selected",onClick:a},"Deselect All")):(j(),ue("div",{key:3,class:"el-select-dropdown__item",onClick:m},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(v=>v.id).includes(d))?(j(),ue("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ue("div",{key:4,class:"el-select-dropdown__item selected",onClick:o},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),we(C(KN),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):_e("",!0),C(i).multiSelect?(j(),ue("div",UK,[re("div",null,Pe(C(i).selected.length)+" selected",1),le(C(lt),{type:"danger",onClick:u,icon:C(Ac),plain:""},{default:pe(()=>[Ue("Delete")]),_:1},8,["icon"]),le(C(lt),{type:"success",onClick:h,icon:C(Ms),plain:"",style:{margin:"0"}},{default:pe(()=>[Ue("Download")]),_:1},8,["icon"])])):(j(),ue("div",HK,YK))]),C(n).outputsLength!=0?(j(),ue("div",XK,[C(n).currentLayout==="dynamic"?(j(),ue("div",KK,[(j(!0),ue(ze,null,Dt(C(c),(d,v)=>(j(),ue("div",{key:v,style:{flex:"1 1 0%"}},[(j(!0),ue(ze,null,Dt(d,g=>(j(),we(vy,{key:g.id,"image-data":g,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):_e("",!0),C(n).currentLayout==="grid"?(j(),ue("div",GK,[(j(!0),ue(ze,null,Dt(C(n).currentOutputs,d=>(j(),we(vy,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):_e("",!0)])):_e("",!0),C(n).outputsLength==0?(j(),ue("div",qK,[le(C(vF),{description:"No Images Found"})])):_e("",!0)],64))}});const JK=Yt(ZK,[["__scopeId","data-v-301360a8"]]),QK=Object.freeze(Object.defineProperty({__proto__:null,default:JK},Symbol.toStringTag,{value:"Module"})),eG=["href"],tG=Ee({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=dt("router-link");return j(),ue(ze,null,[e.router?_e("",!0):(j(),ue("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[xe(t.$slots,"default",{},void 0,!0)],8,eG)),e.router?(j(),we(r,{key:1,to:e.href},{default:pe(()=>[xe(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):_e("",!0)],64)}}});const nG=Yt(tG,[["__scopeId","data-v-17b53b7d"]]),Ol=e=>(Zr("data-v-ecc278c5"),e=e(),Jr(),e),rG={class:"about"},iG={class:"about-content"},aG=Ol(()=>re("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),oG=Ol(()=>re("div",null,[Ue("This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in "),re("a",{href:"https://github.com/LostRuins/koboldcpp"},"KoboldCpp"),Ue(".")],-1)),sG=Ol(()=>re("br",null,null,-1)),lG=Ol(()=>re("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),uG=Ol(()=>re("br",null,null,-1)),cG=Ee({__name:"AboutView",setup(e){return(t,n)=>(j(),ue("div",rG,[re("div",iG,[aG,oG,sG,lG,uG,re("div",null,[Ue("You can find the KoboldAI community and authors of this fork on the "),le(nG,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ue("KoboldAI Discord")]),_:1})])])]))}});const fG=Yt(cG,[["__scopeId","data-v-ecc278c5"]]),dG=Object.freeze(Object.defineProperty({__proto__:null,default:fG},Symbol.toStringTag,{value:"Module"}));const uu=Ee({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=te(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,m)=>(j(),we(C(xi),{prop:e.prop},{label:pe(()=>[le(Sl,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[xe(l.$slots,"label",{},()=>[Ue(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[le(C(f$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ue(ze,null,Dt(e.options,o=>(j(),we(C(d$),{key:o,label:o},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),xe(l.$slots,"inline")]),_:3},8,["prop"]))}}),Al=e=>(Zr("data-v-d14e7594"),e=e(),Jr(),e),hG=Al(()=>re("h1",null,"Options",-1)),pG=Al(()=>re("h2",null,"Generation Options",-1)),gG=Al(()=>re("h2",null,"Image Options",-1)),mG=Al(()=>re("div",null,[Ue("Drop file here OR "),re("em",null,"click to upload")],-1)),vG=Al(()=>re("h2",null,"General Options",-1)),yG=Ee({__name:"OptionsView",setup(e){const t=nn(),n=Ca(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=oe([]),l=oe(),m=oe(!1),o=oe(0);async function a(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ri({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),m.value=!0,o.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await H2(h,!1,()=>{o.value++}),m.value=!1,o.value=0}return(h,c)=>(j(),ue(ze,null,[hG,le(C(kp),{"label-position":"top",model:C(t).options,onSubmit:c[8]||(c[8]=Je(()=>{},["prevent"]))},{default:pe(()=>[le(C(b9),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[le(C(Sf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[pG,le(C(xi),{label:"Base URL"},{default:pe(()=>[le(C(Ra),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1}),le(uu,{label:"Allow Larger Params",prop:"pageless",modelValue:C(t).allowLargerParams,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).allowLargerParams=f),options:["Enabled","Disabled"]},null,8,["modelValue"])]),_:1}),le(C(Sf),{label:"\u{1F4F7} Images"},{default:pe(()=>[gG,le(Tn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),le(uu,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(uu,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),le(uu,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[5]||(c[5]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP","GIF"]},null,8,["modelValue"]),le(C(xi),{label:"Export Images (ZIP File)"},{default:pe(()=>[m.value?(j(),we(C(lt),{key:1,icon:C(Ms),disabled:""},{default:pe(()=>[Ue("Downloading... ("+Pe(o.value)+" / "+Pe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),we(C(lt),{key:0,icon:C(Ms),onClick:c[6]||(c[6]=f=>u())},{default:pe(()=>[Ue("Download "+Pe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),le(C(xi),{label:"Import Images (ZIP File)"},{default:pe(()=>[le(C(Mp),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:a,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[le(C(De),{size:100},{default:pe(()=>[le(C(qh))]),_:1}),mG]),_:1},8,["file-list"])]),_:1})]),_:1}),le(C(Sf),{label:"\u2699\uFE0F General"},{default:pe(()=>[vG,le(Iu,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[7]||(c[7]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const bG=Yt(yG,[["__scopeId","data-v-d14e7594"]]),_G=Object.freeze(Object.defineProperty({__proto__:null,default:bG},Symbol.toStringTag,{value:"Module"}));