From ad16581ab83ef2357dcf221c9d4d1e2bfee1d64d Mon Sep 17 00:00:00 2001 From: blhook <89283782+blhook@users.noreply.github.com> Date: Thu, 2 Mar 2023 18:27:44 -0800 Subject: [PATCH] Change to auto EoL and fix property missing from assignment of hires fix --- invokeai/frontend/.prettierrc.js | 2 +- .../dist/assets/{index-6dcf2dc0.js => index-720872d1.js} | 2 +- invokeai/frontend/dist/index.html | 2 +- .../src/features/parameters/store/postprocessingSlice.ts | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) rename invokeai/frontend/dist/assets/{index-6dcf2dc0.js => index-720872d1.js} (99%) diff --git a/invokeai/frontend/.prettierrc.js b/invokeai/frontend/.prettierrc.js index 76580eb3c4..e58d8f5b05 100644 --- a/invokeai/frontend/.prettierrc.js +++ b/invokeai/frontend/.prettierrc.js @@ -1,7 +1,7 @@ module.exports = { trailingComma: 'es5', tabWidth: 2, - endOfLine: 'crlf', + endOfLine: 'auto', semi: true, singleQuote: true, overrides: [ diff --git a/invokeai/frontend/dist/assets/index-6dcf2dc0.js b/invokeai/frontend/dist/assets/index-720872d1.js similarity index 99% rename from invokeai/frontend/dist/assets/index-6dcf2dc0.js rename to invokeai/frontend/dist/assets/index-720872d1.js index 6cf65e085d..231d12be4e 100644 --- a/invokeai/frontend/dist/assets/index-6dcf2dc0.js +++ b/invokeai/frontend/dist/assets/index-720872d1.js @@ -473,7 +473,7 @@ __p += '`),tn&&(Re+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Re+`return __p -}`;var Vt=yT(function(){return en(H,gt+"return "+Re).apply(n,Z)});if(Vt.source=Re,Y4(Vt))throw Vt;return Vt}function oQ(c){return _n(c).toLowerCase()}function aQ(c){return _n(c).toUpperCase()}function sQ(c,v,C){if(c=_n(c),c&&(C||v===n))return co(c);if(!c||!(v=po(v)))return c;var A=Qi(c),j=Qi(v),H=la(A,j),Z=Cs(A,j)+1;return Ls(A,H,Z).join("")}function lQ(c,v,C){if(c=_n(c),c&&(C||v===n))return c.slice(0,G0(c)+1);if(!c||!(v=po(v)))return c;var A=Qi(c),j=Cs(A,Qi(v))+1;return Ls(A,0,j).join("")}function uQ(c,v,C){if(c=_n(c),c&&(C||v===n))return c.replace(xc,"");if(!c||!(v=po(v)))return c;var A=Qi(c),j=la(A,Qi(v));return Ls(A,j).join("")}function cQ(c,v){var C=B,A=K;if(Cr(v)){var j="separator"in v?v.separator:j;C="length"in v?Ft(v.length):C,A="omission"in v?po(v.omission):A}c=_n(c);var H=c.length;if(bu(c)){var Z=Qi(c);H=Z.length}if(C>=H)return c;var te=C-za(A);if(te<1)return A;var ce=Z?Ls(Z,0,te).join(""):c.slice(0,te);if(j===n)return ce+A;if(Z&&(te+=ce.length-te),X4(j)){if(c.slice(te).search(j)){var ke,Pe=ce;for(j.global||(j=If(j.source,_n(bs.exec(j))+"g")),j.lastIndex=0;ke=j.exec(Pe);)var Re=ke.index;ce=ce.slice(0,Re===n?te:Re)}}else if(c.indexOf(po(j),te)!=te){var nt=ce.lastIndexOf(j);nt>-1&&(ce=ce.slice(0,nt))}return ce+A}function dQ(c){return c=_n(c),c&&_0.test(c)?c.replace(ys,D2):c}var fQ=_l(function(c,v,C){return c+(C?" ":"")+v.toUpperCase()}),J4=pg("toUpperCase");function vT(c,v,C){return c=_n(c),v=C?n:v,v===n?jp(c)?Rf(c):W0(c):c.match(v)||[]}var yT=Tt(function(c,v){try{return Ii(c,n,v)}catch(C){return Y4(C)?C:new Lt(C)}}),hQ=gr(function(c,v){return Zn(v,function(C){C=kl(C),fa(c,C,q4(c[C],c))}),c});function pQ(c){var v=c==null?0:c.length,C=Oe();return c=v?Hn(c,function(A){if(typeof A[1]!="function")throw new Di(a);return[C(A[0]),A[1]]}):[],Tt(function(A){for(var j=-1;++jG)return[];var C=fe,A=hi(c,fe);v=Oe(v),c-=fe;for(var j=Lf(A,v);++C0||v<0)?new Yt(C):(c<0?C=C.takeRight(-c):c&&(C=C.drop(c)),v!==n&&(v=Ft(v),C=v<0?C.dropRight(-v):C.take(v-c)),C)},Yt.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},Yt.prototype.toArray=function(){return this.take(fe)},ga(Yt.prototype,function(c,v){var C=/^(?:filter|find|map|reject)|While$/.test(v),A=/^(?:head|last)$/.test(v),j=F[A?"take"+(v=="last"?"Right":""):v],H=A||/^find/.test(v);j&&(F.prototype[v]=function(){var Z=this.__wrapped__,te=A?[1]:arguments,ce=Z instanceof Yt,ke=te[0],Pe=ce||$t(Z),Re=function(Xt){var tn=j.apply(F,Ba([Xt],te));return A&&nt?tn[0]:tn};Pe&&C&&typeof ke=="function"&&ke.length!=1&&(ce=Pe=!1);var nt=this.__chain__,gt=!!this.__actions__.length,_t=H&&!nt,Vt=ce&&!gt;if(!H&&Pe){Z=Vt?Z:new Yt(this);var kt=c.apply(Z,te);return kt.__actions__.push({func:ab,args:[Re],thisArg:n}),new fo(kt,nt)}return _t&&Vt?c.apply(this,te):(kt=this.thru(Re),_t?A?kt.value()[0]:kt.value():kt)})}),Zn(["pop","push","shift","sort","splice","unshift"],function(c){var v=Ic[c],C=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",A=/^(?:pop|shift)$/.test(c);F.prototype[c]=function(){var j=arguments;if(A&&!this.__chain__){var H=this.value();return v.apply($t(H)?H:[],j)}return this[C](function(Z){return v.apply($t(Z)?Z:[],j)})}}),ga(Yt.prototype,function(c,v){var C=F[v];if(C){var A=C.name+"";an.call(ks,A)||(ks[A]=[]),ks[A].push({name:v,func:C})}}),ks[Qf(n,_).name]=[{name:"wrapper",func:n}],Yt.prototype.clone=Ji,Yt.prototype.reverse=Ni,Yt.prototype.value=U2,F.prototype.at=HY,F.prototype.chain=WY,F.prototype.commit=UY,F.prototype.next=VY,F.prototype.plant=qY,F.prototype.reverse=KY,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=YY,F.prototype.first=F.prototype.head,Fc&&(F.prototype[Fc]=GY),F},Ha=Ro();Kt?((Kt.exports=Ha)._=Ha,Ot._=Ha):St._=Ha}).call(So)})(VSe,Ce);const Pg=(e,t,n,r,i,o,a)=>{const s=e/2-(n+i/2)*a,l=t/2-(r+o/2)*a;return{x:s,y:l}},Tg=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r;return Math.min(1,Math.min(o,a))},GSe=.999,qSe=.1,KSe=20,Vv=.95,KO=30,pk=10,YO=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),ih=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=Hl(s/o,64)):o<1&&(r.height=s,r.width=Hl(s*o,64)),a=r.width*r.height;return r},YSe=e=>({width:Hl(e.width,64),height:Hl(e.height,64)}),IW=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],XSe=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],hE=e=>e.kind==="line"&&e.layer==="mask",ZSe=e=>e.kind==="line"&&e.layer==="base",x3=e=>e.kind==="image"&&e.layer==="base",QSe=e=>e.kind==="fillRect"&&e.layer==="base",JSe=e=>e.kind==="eraseRect"&&e.layer==="base",e3e=e=>e.kind==="line",p1={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},t3e={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:p1,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},DW=ap({name:"canvas",initialState:t3e,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!hE(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{stageDimensions:r}=e,i={width:Cd(Ce.clamp(n.width,64,512),64),height:Cd(Ce.clamp(n.height,64,512),64)},o={x:Hl(n.width/2-i.width/2,64),y:Hl(n.height/2-i.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const l=ih(i);e.scaledBoundingBoxDimensions=l}e.boundingBoxDimensions=i,e.boundingBoxCoordinates=o,e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.layerState={...p1,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const a=Tg(r.width,r.height,n.width,n.height,Vv),s=Pg(r.width,r.height,0,0,n.width,n.height,a);e.stageScale=a,e.stageCoordinates=s,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=YSe(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=ih(n);e.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=YO(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},addImageToStagingArea:(e,t)=>{const{boundingBox:n,image:r}=t.payload;!n||!r||(e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...p1.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(e3e);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Ce.cloneDeep(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.layerState=p1,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(x3),i={width:Math.floor(t),height:Math.floor(n)};if(!r){const d=Tg(i.width,i.height,512,512,Vv),p=Pg(i.width,i.height,0,0,512,512,d),m={width:512,height:512};if(e.stageScale=d,e.stageCoordinates=p,e.stageDimensions=i,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=m,e.boundingBoxScaleMethod==="auto"){const y=ih(m);e.scaledBoundingBoxDimensions=y}return}const{width:o,height:a}=r,l=Tg(t,n,o,a,.95),u=Pg(i.width,i.height,0,0,o,a,l);e.minimumStageScale=l,e.stageScale=l,e.stageCoordinates=YO(u),e.stageDimensions=i,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(x3)){const i=Tg(r.width,r.height,512,512,Vv),o=Pg(r.width,r.height,0,0,512,512,i),a={width:512,height:512};if(e.stageScale=i,e.stageCoordinates=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=a,e.boundingBoxScaleMethod==="auto"){const s=ih(a);e.scaledBoundingBoxDimensions=s}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const d=r?1:Tg(i,o,l,u,Vv),p=Pg(i,o,a,s,l,u,d);e.stageScale=d,e.stageCoordinates=p}else{const d=Tg(i,o,512,512,Vv),p=Pg(i,o,0,0,512,512,d),m={width:512,height:512};if(e.stageScale=d,e.stageCoordinates=p,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=m,e.boundingBoxScaleMethod==="auto"){const y=ih(m);e.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:e=>{const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({...t[n]}),e.layerState.stagingArea={...p1.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:Cd(Ce.clamp(o,64,512),64),height:Cd(Ce.clamp(a,64,512),64)},l={x:Hl(o/2-s.width/2,64),y:Hl(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=ih(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=ih(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}}}),{addEraseRect:jW,addFillRect:NW,addImageToStagingArea:n3e,addLine:r3e,addPointToCurrentLine:$W,clearCanvasHistory:FW,clearMask:pE,commitColorPickerColor:i3e,commitStagingAreaImage:o3e,discardStagedImages:a3e,fitBoundingBoxToStage:bNe,mouseLeftCanvas:s3e,nextStagingAreaImage:l3e,prevStagingAreaImage:u3e,redo:c3e,resetCanvas:gE,resetCanvasInteractionState:d3e,resetCanvasView:BW,resizeAndScaleCanvas:r4,resizeCanvas:f3e,setBoundingBoxCoordinates:RC,setBoundingBoxDimensions:g1,setBoundingBoxPreviewFill:xNe,setBoundingBoxScaleMethod:h3e,setBrushColor:Mm,setBrushSize:Lm,setCanvasContainerDimensions:p3e,setColorPickerColor:g3e,setCursorPosition:m3e,setDoesCanvasNeedScaling:Li,setInitialCanvasImage:i4,setIsDrawing:zW,setIsMaskEnabled:h2,setIsMouseOverBoundingBox:Qb,setIsMoveBoundingBoxKeyHeld:SNe,setIsMoveStageKeyHeld:wNe,setIsMovingBoundingBox:IC,setIsMovingStage:S3,setIsTransformingBoundingBox:DC,setLayer:w3,setMaskColor:HW,setMergedCanvas:v3e,setShouldAutoSave:WW,setShouldCropToBoundingBoxOnSave:UW,setShouldDarkenOutsideBoundingBox:VW,setShouldLockBoundingBox:CNe,setShouldPreserveMaskedArea:GW,setShouldShowBoundingBox:y3e,setShouldShowBrush:_Ne,setShouldShowBrushPreview:kNe,setShouldShowCanvasDebugInfo:qW,setShouldShowCheckboardTransparency:ENe,setShouldShowGrid:KW,setShouldShowIntermediates:YW,setShouldShowStagingImage:b3e,setShouldShowStagingOutline:XO,setShouldSnapToGrid:C3,setStageCoordinates:XW,setStageScale:x3e,setTool:Jl,toggleShouldLockBoundingBox:PNe,toggleTool:TNe,undo:S3e,setScaledBoundingBoxDimensions:Jb,setShouldRestrictStrokesToBox:ZW}=DW.actions,w3e=DW.reducer,C3e={currentImageUuid:"",shouldPinGallery:!0,shouldShowGallery:!0,galleryScrollPosition:0,galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldHoldGalleryOpen:!1,shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},QW=ap({name:"gallery",initialState:C3e,reducers:{setCurrentImage:(e,t)=>{e.currentImage=t.payload,e.currentImageUuid=t.payload.uuid},removeImage:(e,t)=>{const{uuid:n,category:r}=t.payload,i=e.categories[r].images,o=i.filter(a=>a.uuid!==n);if(n===e.currentImageUuid){const a=i.findIndex(l=>l.uuid===n),s=Ce.clamp(a,0,o.length-1);e.currentImage=o.length?o[s]:void 0,e.currentImageUuid=o.length?o[s].uuid:""}e.categories[r].images=o},addImage:(e,t)=>{const{image:n,category:r}=t.payload,{uuid:i,url:o,mtime:a}=n,s=e.categories[r];s.images.find(l=>l.url===o&&l.mtime===a)||(s.images.unshift(n),e.shouldAutoSwitchToNewImages&&(e.currentImageUuid=i,e.currentImage=n,e.currentCategory=r),e.intermediateImage=void 0,s.latest_mtime=a)},setIntermediateImage:(e,t)=>{e.intermediateImage=t.payload},clearIntermediateImage:e=>{e.intermediateImage=void 0},selectNextImage:e=>{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex(i=>i.uuid===t.uuid);if(r{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex(i=>i.uuid===t.uuid);if(r>0){const i=n[r-1];e.currentImage=i,e.currentImageUuid=i.uuid}}},addGalleryImages:(e,t)=>{const{images:n,areMoreImagesAvailable:r,category:i}=t.payload,o=e.categories[i].images;if(n.length>0){const a=n.filter(s=>!o.find(l=>l.url===s.url&&l.mtime===s.mtime));if(e.categories[i].images=o.concat(a).sort((s,l)=>l.mtime-s.mtime),!e.currentImage){const s=n[0];e.currentImage=s,e.currentImageUuid=s.uuid}e.categories[i].latest_mtime=n[0].mtime,e.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(e.categories[i].areMoreImagesAvailable=r)},setShouldPinGallery:(e,t)=>{e.shouldPinGallery=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},setGalleryScrollPosition:(e,t)=>{e.galleryScrollPosition=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},setGalleryImageObjectFit:(e,t)=>{e.galleryImageObjectFit=t.payload},setShouldHoldGalleryOpen:(e,t)=>{e.shouldHoldGalleryOpen=t.payload},setShouldAutoSwitchToNewImages:(e,t)=>{e.shouldAutoSwitchToNewImages=t.payload},setCurrentCategory:(e,t)=>{e.currentCategory=t.payload},setGalleryWidth:(e,t)=>{e.galleryWidth=t.payload},setShouldUseSingleGalleryColumn:(e,t)=>{e.shouldUseSingleGalleryColumn=t.payload}}}),{addImage:sm,clearIntermediateImage:jC,removeImage:JW,setCurrentImage:ZO,addGalleryImages:_3e,setIntermediateImage:k3e,selectNextImage:mE,selectPrevImage:vE,setShouldPinGallery:E3e,setShouldShowGallery:Am,setGalleryScrollPosition:P3e,setGalleryImageMinimumWidth:Gv,setGalleryImageObjectFit:T3e,setShouldHoldGalleryOpen:eU,setShouldAutoSwitchToNewImages:M3e,setCurrentCategory:ex,setGalleryWidth:L3e,setShouldUseSingleGalleryColumn:A3e}=QW.actions,O3e=QW.reducer,R3e={isLightboxOpen:!1},I3e=R3e,tU=ap({name:"lightbox",initialState:I3e,reducers:{setIsLightboxOpen:(e,t)=>{e.isLightboxOpen=t.payload}}}),{setIsLightboxOpen:Om}=tU.actions,D3e=tU.reducer,Rm=e=>typeof e=="string"?e:e.length===1?e[0].prompt:e.map(t=>`${t.prompt}:${t.weight}`).join(" ");function nU(e){let t=typeof e=="string"?e:Rm(e),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...t.matchAll(r)].map(o=>o[1]);return i.length&&(n=i.join(" "),i.forEach(o=>{t=t.replace(`[${o}]`,"").replaceAll("[]","").trim()})),[t,n]}const j3e=e=>{const r=e.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return yE(r)?r:!1},yE=e=>Boolean(typeof e=="string"?j3e(e):e.length&&!e.some(t=>{const{seed:n,weight:r}=t,i=!isNaN(parseInt(n.toString(),10)),o=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&o)})),_3=e=>e.reduce((t,n,r,i)=>{const{seed:o,weight:a}=n;return t+=`${o}:${a}`,r!==i.length-1&&(t+=","),t},""),N3e=e=>e.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),rU={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},$3e=rU,iU=ap({name:"generation",initialState:$3e,reducers:{setPrompt:(e,t)=>{const n=t.payload;typeof n=="string"?e.prompt=n:e.prompt=Rm(n)},setNegativePrompt:(e,t)=>{const n=t.payload;typeof n=="string"?e.negativePrompt=n:e.negativePrompt=Rm(n)},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Ce.clamp(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Ce.clamp(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},setSampler:(e,t)=>{e.sampler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setMaskPath:(e,t)=>{e.maskPath=t.payload},setSeamless:(e,t)=>{e.seamless=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setParameter:(e,t)=>{const{key:n,value:r}=t.payload,i={...e,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},setAllTextToImageParameters:(e,t)=>{const{sampler:n,prompt:r,seed:i,variations:o,steps:a,cfg_scale:s,threshold:l,perlin:u,seamless:d,hires_fix:p,width:m,height:y}=t.payload.image;o&&o.length>0?(e.seedWeights=_3(o),e.shouldGenerateVariations=!0,e.variationAmount=0):e.shouldGenerateVariations=!1,i&&(e.seed=i,e.shouldRandomizeSeed=!1),r&&(e.prompt=Rm(r)),n&&(e.sampler=n),a&&(e.steps=a),s&&(e.cfgScale=s),typeof l>"u"?e.threshold=0:e.threshold=l,typeof u>"u"?e.perlin=0:e.perlin=u,typeof d=="boolean"&&(e.seamless=d),m&&(e.width=m),y&&(e.height=y)},setAllImageToImageParameters:(e,t)=>{const{type:n,strength:r,fit:i,init_image_path:o,mask_image_path:a}=t.payload.image;n==="img2img"&&(o&&(e.initialImage=o),a&&(e.maskPath=a),r&&(e.img2imgStrength=r),typeof i=="boolean"&&(e.shouldFitToWidthHeight=i))},setAllParameters:(e,t)=>{const{type:n,sampler:r,prompt:i,seed:o,variations:a,steps:s,cfg_scale:l,threshold:u,perlin:d,seamless:p,hires_fix:m,width:y,height:b,strength:w,fit:E,init_image_path:_,mask_image_path:k}=t.payload.image;if(n==="img2img"&&(_&&(e.initialImage=_),k&&(e.maskPath=k),w&&(e.img2imgStrength=w),typeof E=="boolean"&&(e.shouldFitToWidthHeight=E)),a&&a.length>0?(e.seedWeights=_3(a),e.shouldGenerateVariations=!0,e.variationAmount=0):e.shouldGenerateVariations=!1,o&&(e.seed=o,e.shouldRandomizeSeed=!1),i){const[T,L]=nU(i);T&&(e.prompt=T),L?e.negativePrompt=L:e.negativePrompt=""}r&&(e.sampler=r),s&&(e.steps=s),l&&(e.cfgScale=l),typeof u>"u"?e.threshold=0:e.threshold=u,typeof d>"u"?e.perlin=0:e.perlin=d,typeof p=="boolean"&&(e.seamless=p),y&&(e.width=y),b&&(e.height=b)},resetParametersState:e=>({...e,...rU}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},setInitialImage:(e,t)=>{e.initialImage=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setSeamSize:(e,t)=>{e.seamSize=t.payload},setSeamBlur:(e,t)=>{e.seamBlur=t.payload},setSeamStrength:(e,t)=>{e.seamStrength=t.payload},setSeamSteps:(e,t)=>{e.seamSteps=t.payload},setTileSize:(e,t)=>{e.tileSize=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload}}}),{clampSymmetrySteps:oU,clearInitialImage:aU,resetParametersState:MNe,resetSeed:LNe,setAllImageToImageParameters:F3e,setAllParameters:sU,setAllTextToImageParameters:ANe,setCfgScale:gk,setHeight:uS,setImg2imgStrength:mk,setInfillMethod:lU,setInitialImage:y0,setIterations:QO,setMaskPath:uU,setParameter:ONe,setPerlin:vk,setPrompt:cU,setNegativePrompt:dU,setSampler:fU,setSeamBlur:JO,setSeamless:hU,setSeamSize:eR,setSeamSteps:tR,setSeamStrength:nR,setSeed:p2,setSeedWeights:pU,setShouldFitToWidthHeight:gU,setShouldGenerateVariations:B3e,setShouldRandomizeSeed:z3e,setSteps:yk,setThreshold:bk,setTileSize:rR,setVariationAmount:iR,setWidth:cS,setShouldUseSymmetry:H3e,setHorizontalSymmetrySteps:oR,setVerticalSymmetrySteps:aR}=iU.actions,W3e=iU.reducer,mU={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},U3e=mU,vU=ap({name:"postprocessing",initialState:U3e,reducers:{setAllPostProcessingParameters:(e,t)=>{const{type:n,hires_fix:r}=t.payload.image;n==="txt2img"&&typeof r=="boolean"&&(e.hiresFix=r)},setFacetoolStrength:(e,t)=>{e.facetoolStrength=t.payload},setCodeformerFidelity:(e,t)=>{e.codeformerFidelity=t.payload},setUpscalingLevel:(e,t)=>{e.upscalingLevel=t.payload},setUpscalingDenoising:(e,t)=>{e.upscalingDenoising=t.payload},setUpscalingStrength:(e,t)=>{e.upscalingStrength=t.payload},setHiresFix:(e,t)=>{e.hiresFix=t.payload},setHiresStrength:(e,t)=>{e.hiresStrength=t.payload},resetPostprocessingState:e=>({...e,...mU}),setShouldRunFacetool:(e,t)=>{e.shouldRunFacetool=t.payload},setFacetoolType:(e,t)=>{e.facetoolType=t.payload},setShouldRunESRGAN:(e,t)=>{e.shouldRunESRGAN=t.payload},setShouldLoopback:(e,t)=>{e.shouldLoopback=t.payload}}}),{setAllPostProcessingParameters:yU,resetPostprocessingState:RNe,setCodeformerFidelity:xk,setFacetoolStrength:k3,setFacetoolType:dS,setHiresFix:bU,setHiresStrength:sR,setShouldLoopback:V3e,setShouldRunESRGAN:G3e,setShouldRunFacetool:q3e,setUpscalingLevel:xU,setUpscalingDenoising:Sk,setUpscalingStrength:wk}=vU.actions,K3e=vU.reducer;function gs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lR(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=H)return c;var te=C-za(A);if(te<1)return A;var ce=Z?Ls(Z,0,te).join(""):c.slice(0,te);if(j===n)return ce+A;if(Z&&(te+=ce.length-te),X4(j)){if(c.slice(te).search(j)){var ke,Pe=ce;for(j.global||(j=If(j.source,_n(bs.exec(j))+"g")),j.lastIndex=0;ke=j.exec(Pe);)var Re=ke.index;ce=ce.slice(0,Re===n?te:Re)}}else if(c.indexOf(po(j),te)!=te){var nt=ce.lastIndexOf(j);nt>-1&&(ce=ce.slice(0,nt))}return ce+A}function dQ(c){return c=_n(c),c&&_0.test(c)?c.replace(ys,D2):c}var fQ=_l(function(c,v,C){return c+(C?" ":"")+v.toUpperCase()}),J4=pg("toUpperCase");function vT(c,v,C){return c=_n(c),v=C?n:v,v===n?jp(c)?Rf(c):W0(c):c.match(v)||[]}var yT=Tt(function(c,v){try{return Ii(c,n,v)}catch(C){return Y4(C)?C:new Lt(C)}}),hQ=gr(function(c,v){return Zn(v,function(C){C=kl(C),fa(c,C,q4(c[C],c))}),c});function pQ(c){var v=c==null?0:c.length,C=Oe();return c=v?Hn(c,function(A){if(typeof A[1]!="function")throw new Di(a);return[C(A[0]),A[1]]}):[],Tt(function(A){for(var j=-1;++jG)return[];var C=fe,A=hi(c,fe);v=Oe(v),c-=fe;for(var j=Lf(A,v);++C0||v<0)?new Yt(C):(c<0?C=C.takeRight(-c):c&&(C=C.drop(c)),v!==n&&(v=Ft(v),C=v<0?C.dropRight(-v):C.take(v-c)),C)},Yt.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},Yt.prototype.toArray=function(){return this.take(fe)},ga(Yt.prototype,function(c,v){var C=/^(?:filter|find|map|reject)|While$/.test(v),A=/^(?:head|last)$/.test(v),j=F[A?"take"+(v=="last"?"Right":""):v],H=A||/^find/.test(v);j&&(F.prototype[v]=function(){var Z=this.__wrapped__,te=A?[1]:arguments,ce=Z instanceof Yt,ke=te[0],Pe=ce||$t(Z),Re=function(Xt){var tn=j.apply(F,Ba([Xt],te));return A&&nt?tn[0]:tn};Pe&&C&&typeof ke=="function"&&ke.length!=1&&(ce=Pe=!1);var nt=this.__chain__,gt=!!this.__actions__.length,_t=H&&!nt,Vt=ce&&!gt;if(!H&&Pe){Z=Vt?Z:new Yt(this);var kt=c.apply(Z,te);return kt.__actions__.push({func:ab,args:[Re],thisArg:n}),new fo(kt,nt)}return _t&&Vt?c.apply(this,te):(kt=this.thru(Re),_t?A?kt.value()[0]:kt.value():kt)})}),Zn(["pop","push","shift","sort","splice","unshift"],function(c){var v=Ic[c],C=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",A=/^(?:pop|shift)$/.test(c);F.prototype[c]=function(){var j=arguments;if(A&&!this.__chain__){var H=this.value();return v.apply($t(H)?H:[],j)}return this[C](function(Z){return v.apply($t(Z)?Z:[],j)})}}),ga(Yt.prototype,function(c,v){var C=F[v];if(C){var A=C.name+"";an.call(ks,A)||(ks[A]=[]),ks[A].push({name:v,func:C})}}),ks[Qf(n,_).name]=[{name:"wrapper",func:n}],Yt.prototype.clone=Ji,Yt.prototype.reverse=Ni,Yt.prototype.value=U2,F.prototype.at=HY,F.prototype.chain=WY,F.prototype.commit=UY,F.prototype.next=VY,F.prototype.plant=qY,F.prototype.reverse=KY,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=YY,F.prototype.first=F.prototype.head,Fc&&(F.prototype[Fc]=GY),F},Ha=Ro();Kt?((Kt.exports=Ha)._=Ha,Ot._=Ha):St._=Ha}).call(So)})(VSe,Ce);const Pg=(e,t,n,r,i,o,a)=>{const s=e/2-(n+i/2)*a,l=t/2-(r+o/2)*a;return{x:s,y:l}},Tg=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r;return Math.min(1,Math.min(o,a))},GSe=.999,qSe=.1,KSe=20,Vv=.95,KO=30,pk=10,YO=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),ih=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=Hl(s/o,64)):o<1&&(r.height=s,r.width=Hl(s*o,64)),a=r.width*r.height;return r},YSe=e=>({width:Hl(e.width,64),height:Hl(e.height,64)}),IW=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],XSe=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],hE=e=>e.kind==="line"&&e.layer==="mask",ZSe=e=>e.kind==="line"&&e.layer==="base",x3=e=>e.kind==="image"&&e.layer==="base",QSe=e=>e.kind==="fillRect"&&e.layer==="base",JSe=e=>e.kind==="eraseRect"&&e.layer==="base",e3e=e=>e.kind==="line",p1={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},t3e={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:p1,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},DW=ap({name:"canvas",initialState:t3e,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!hE(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{stageDimensions:r}=e,i={width:Cd(Ce.clamp(n.width,64,512),64),height:Cd(Ce.clamp(n.height,64,512),64)},o={x:Hl(n.width/2-i.width/2,64),y:Hl(n.height/2-i.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const l=ih(i);e.scaledBoundingBoxDimensions=l}e.boundingBoxDimensions=i,e.boundingBoxCoordinates=o,e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.layerState={...p1,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const a=Tg(r.width,r.height,n.width,n.height,Vv),s=Pg(r.width,r.height,0,0,n.width,n.height,a);e.stageScale=a,e.stageCoordinates=s,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=YSe(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=ih(n);e.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=YO(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},addImageToStagingArea:(e,t)=>{const{boundingBox:n,image:r}=t.payload;!n||!r||(e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...p1.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(e3e);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Ce.cloneDeep(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.layerState=p1,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(x3),i={width:Math.floor(t),height:Math.floor(n)};if(!r){const d=Tg(i.width,i.height,512,512,Vv),p=Pg(i.width,i.height,0,0,512,512,d),m={width:512,height:512};if(e.stageScale=d,e.stageCoordinates=p,e.stageDimensions=i,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=m,e.boundingBoxScaleMethod==="auto"){const y=ih(m);e.scaledBoundingBoxDimensions=y}return}const{width:o,height:a}=r,l=Tg(t,n,o,a,.95),u=Pg(i.width,i.height,0,0,o,a,l);e.minimumStageScale=l,e.stageScale=l,e.stageCoordinates=YO(u),e.stageDimensions=i,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(x3)){const i=Tg(r.width,r.height,512,512,Vv),o=Pg(r.width,r.height,0,0,512,512,i),a={width:512,height:512};if(e.stageScale=i,e.stageCoordinates=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=a,e.boundingBoxScaleMethod==="auto"){const s=ih(a);e.scaledBoundingBoxDimensions=s}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const d=r?1:Tg(i,o,l,u,Vv),p=Pg(i,o,a,s,l,u,d);e.stageScale=d,e.stageCoordinates=p}else{const d=Tg(i,o,512,512,Vv),p=Pg(i,o,0,0,512,512,d),m={width:512,height:512};if(e.stageScale=d,e.stageCoordinates=p,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=m,e.boundingBoxScaleMethod==="auto"){const y=ih(m);e.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:e=>{const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({...t[n]}),e.layerState.stagingArea={...p1.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:Cd(Ce.clamp(o,64,512),64),height:Cd(Ce.clamp(a,64,512),64)},l={x:Hl(o/2-s.width/2,64),y:Hl(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=ih(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=ih(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(Ce.cloneDeep(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}}}),{addEraseRect:jW,addFillRect:NW,addImageToStagingArea:n3e,addLine:r3e,addPointToCurrentLine:$W,clearCanvasHistory:FW,clearMask:pE,commitColorPickerColor:i3e,commitStagingAreaImage:o3e,discardStagedImages:a3e,fitBoundingBoxToStage:bNe,mouseLeftCanvas:s3e,nextStagingAreaImage:l3e,prevStagingAreaImage:u3e,redo:c3e,resetCanvas:gE,resetCanvasInteractionState:d3e,resetCanvasView:BW,resizeAndScaleCanvas:r4,resizeCanvas:f3e,setBoundingBoxCoordinates:RC,setBoundingBoxDimensions:g1,setBoundingBoxPreviewFill:xNe,setBoundingBoxScaleMethod:h3e,setBrushColor:Mm,setBrushSize:Lm,setCanvasContainerDimensions:p3e,setColorPickerColor:g3e,setCursorPosition:m3e,setDoesCanvasNeedScaling:Li,setInitialCanvasImage:i4,setIsDrawing:zW,setIsMaskEnabled:h2,setIsMouseOverBoundingBox:Qb,setIsMoveBoundingBoxKeyHeld:SNe,setIsMoveStageKeyHeld:wNe,setIsMovingBoundingBox:IC,setIsMovingStage:S3,setIsTransformingBoundingBox:DC,setLayer:w3,setMaskColor:HW,setMergedCanvas:v3e,setShouldAutoSave:WW,setShouldCropToBoundingBoxOnSave:UW,setShouldDarkenOutsideBoundingBox:VW,setShouldLockBoundingBox:CNe,setShouldPreserveMaskedArea:GW,setShouldShowBoundingBox:y3e,setShouldShowBrush:_Ne,setShouldShowBrushPreview:kNe,setShouldShowCanvasDebugInfo:qW,setShouldShowCheckboardTransparency:ENe,setShouldShowGrid:KW,setShouldShowIntermediates:YW,setShouldShowStagingImage:b3e,setShouldShowStagingOutline:XO,setShouldSnapToGrid:C3,setStageCoordinates:XW,setStageScale:x3e,setTool:Jl,toggleShouldLockBoundingBox:PNe,toggleTool:TNe,undo:S3e,setScaledBoundingBoxDimensions:Jb,setShouldRestrictStrokesToBox:ZW}=DW.actions,w3e=DW.reducer,C3e={currentImageUuid:"",shouldPinGallery:!0,shouldShowGallery:!0,galleryScrollPosition:0,galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldHoldGalleryOpen:!1,shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},QW=ap({name:"gallery",initialState:C3e,reducers:{setCurrentImage:(e,t)=>{e.currentImage=t.payload,e.currentImageUuid=t.payload.uuid},removeImage:(e,t)=>{const{uuid:n,category:r}=t.payload,i=e.categories[r].images,o=i.filter(a=>a.uuid!==n);if(n===e.currentImageUuid){const a=i.findIndex(l=>l.uuid===n),s=Ce.clamp(a,0,o.length-1);e.currentImage=o.length?o[s]:void 0,e.currentImageUuid=o.length?o[s].uuid:""}e.categories[r].images=o},addImage:(e,t)=>{const{image:n,category:r}=t.payload,{uuid:i,url:o,mtime:a}=n,s=e.categories[r];s.images.find(l=>l.url===o&&l.mtime===a)||(s.images.unshift(n),e.shouldAutoSwitchToNewImages&&(e.currentImageUuid=i,e.currentImage=n,e.currentCategory=r),e.intermediateImage=void 0,s.latest_mtime=a)},setIntermediateImage:(e,t)=>{e.intermediateImage=t.payload},clearIntermediateImage:e=>{e.intermediateImage=void 0},selectNextImage:e=>{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex(i=>i.uuid===t.uuid);if(r{const{currentImage:t}=e;if(!t)return;const n=e.categories[t.category].images;if(t){const r=n.findIndex(i=>i.uuid===t.uuid);if(r>0){const i=n[r-1];e.currentImage=i,e.currentImageUuid=i.uuid}}},addGalleryImages:(e,t)=>{const{images:n,areMoreImagesAvailable:r,category:i}=t.payload,o=e.categories[i].images;if(n.length>0){const a=n.filter(s=>!o.find(l=>l.url===s.url&&l.mtime===s.mtime));if(e.categories[i].images=o.concat(a).sort((s,l)=>l.mtime-s.mtime),!e.currentImage){const s=n[0];e.currentImage=s,e.currentImageUuid=s.uuid}e.categories[i].latest_mtime=n[0].mtime,e.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(e.categories[i].areMoreImagesAvailable=r)},setShouldPinGallery:(e,t)=>{e.shouldPinGallery=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},setGalleryScrollPosition:(e,t)=>{e.galleryScrollPosition=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},setGalleryImageObjectFit:(e,t)=>{e.galleryImageObjectFit=t.payload},setShouldHoldGalleryOpen:(e,t)=>{e.shouldHoldGalleryOpen=t.payload},setShouldAutoSwitchToNewImages:(e,t)=>{e.shouldAutoSwitchToNewImages=t.payload},setCurrentCategory:(e,t)=>{e.currentCategory=t.payload},setGalleryWidth:(e,t)=>{e.galleryWidth=t.payload},setShouldUseSingleGalleryColumn:(e,t)=>{e.shouldUseSingleGalleryColumn=t.payload}}}),{addImage:sm,clearIntermediateImage:jC,removeImage:JW,setCurrentImage:ZO,addGalleryImages:_3e,setIntermediateImage:k3e,selectNextImage:mE,selectPrevImage:vE,setShouldPinGallery:E3e,setShouldShowGallery:Am,setGalleryScrollPosition:P3e,setGalleryImageMinimumWidth:Gv,setGalleryImageObjectFit:T3e,setShouldHoldGalleryOpen:eU,setShouldAutoSwitchToNewImages:M3e,setCurrentCategory:ex,setGalleryWidth:L3e,setShouldUseSingleGalleryColumn:A3e}=QW.actions,O3e=QW.reducer,R3e={isLightboxOpen:!1},I3e=R3e,tU=ap({name:"lightbox",initialState:I3e,reducers:{setIsLightboxOpen:(e,t)=>{e.isLightboxOpen=t.payload}}}),{setIsLightboxOpen:Om}=tU.actions,D3e=tU.reducer,Rm=e=>typeof e=="string"?e:e.length===1?e[0].prompt:e.map(t=>`${t.prompt}:${t.weight}`).join(" ");function nU(e){let t=typeof e=="string"?e:Rm(e),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...t.matchAll(r)].map(o=>o[1]);return i.length&&(n=i.join(" "),i.forEach(o=>{t=t.replace(`[${o}]`,"").replaceAll("[]","").trim()})),[t,n]}const j3e=e=>{const r=e.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return yE(r)?r:!1},yE=e=>Boolean(typeof e=="string"?j3e(e):e.length&&!e.some(t=>{const{seed:n,weight:r}=t,i=!isNaN(parseInt(n.toString(),10)),o=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&o)})),_3=e=>e.reduce((t,n,r,i)=>{const{seed:o,weight:a}=n;return t+=`${o}:${a}`,r!==i.length-1&&(t+=","),t},""),N3e=e=>e.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),rU={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},$3e=rU,iU=ap({name:"generation",initialState:$3e,reducers:{setPrompt:(e,t)=>{const n=t.payload;typeof n=="string"?e.prompt=n:e.prompt=Rm(n)},setNegativePrompt:(e,t)=>{const n=t.payload;typeof n=="string"?e.negativePrompt=n:e.negativePrompt=Rm(n)},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Ce.clamp(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Ce.clamp(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},setSampler:(e,t)=>{e.sampler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setMaskPath:(e,t)=>{e.maskPath=t.payload},setSeamless:(e,t)=>{e.seamless=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setParameter:(e,t)=>{const{key:n,value:r}=t.payload,i={...e,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},setAllTextToImageParameters:(e,t)=>{const{sampler:n,prompt:r,seed:i,variations:o,steps:a,cfg_scale:s,threshold:l,perlin:u,seamless:d,hires_fix:p,width:m,height:y}=t.payload.image;o&&o.length>0?(e.seedWeights=_3(o),e.shouldGenerateVariations=!0,e.variationAmount=0):e.shouldGenerateVariations=!1,i&&(e.seed=i,e.shouldRandomizeSeed=!1),r&&(e.prompt=Rm(r)),n&&(e.sampler=n),a&&(e.steps=a),s&&(e.cfgScale=s),typeof l>"u"?e.threshold=0:e.threshold=l,typeof u>"u"?e.perlin=0:e.perlin=u,typeof d=="boolean"&&(e.seamless=d),m&&(e.width=m),y&&(e.height=y)},setAllImageToImageParameters:(e,t)=>{const{type:n,strength:r,fit:i,init_image_path:o,mask_image_path:a}=t.payload.image;n==="img2img"&&(o&&(e.initialImage=o),a&&(e.maskPath=a),r&&(e.img2imgStrength=r),typeof i=="boolean"&&(e.shouldFitToWidthHeight=i))},setAllParameters:(e,t)=>{const{type:n,sampler:r,prompt:i,seed:o,variations:a,steps:s,cfg_scale:l,threshold:u,perlin:d,seamless:p,hires_fix:m,width:y,height:b,strength:w,fit:E,init_image_path:_,mask_image_path:k}=t.payload.image;if(n==="img2img"&&(_&&(e.initialImage=_),k&&(e.maskPath=k),w&&(e.img2imgStrength=w),typeof E=="boolean"&&(e.shouldFitToWidthHeight=E)),a&&a.length>0?(e.seedWeights=_3(a),e.shouldGenerateVariations=!0,e.variationAmount=0):e.shouldGenerateVariations=!1,o&&(e.seed=o,e.shouldRandomizeSeed=!1),i){const[T,L]=nU(i);T&&(e.prompt=T),L?e.negativePrompt=L:e.negativePrompt=""}r&&(e.sampler=r),s&&(e.steps=s),l&&(e.cfgScale=l),typeof u>"u"?e.threshold=0:e.threshold=u,typeof d>"u"?e.perlin=0:e.perlin=d,typeof p=="boolean"&&(e.seamless=p),y&&(e.width=y),b&&(e.height=b)},resetParametersState:e=>({...e,...rU}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},setInitialImage:(e,t)=>{e.initialImage=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setSeamSize:(e,t)=>{e.seamSize=t.payload},setSeamBlur:(e,t)=>{e.seamBlur=t.payload},setSeamStrength:(e,t)=>{e.seamStrength=t.payload},setSeamSteps:(e,t)=>{e.seamSteps=t.payload},setTileSize:(e,t)=>{e.tileSize=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload}}}),{clampSymmetrySteps:oU,clearInitialImage:aU,resetParametersState:MNe,resetSeed:LNe,setAllImageToImageParameters:F3e,setAllParameters:sU,setAllTextToImageParameters:ANe,setCfgScale:gk,setHeight:uS,setImg2imgStrength:mk,setInfillMethod:lU,setInitialImage:y0,setIterations:QO,setMaskPath:uU,setParameter:ONe,setPerlin:vk,setPrompt:cU,setNegativePrompt:dU,setSampler:fU,setSeamBlur:JO,setSeamless:hU,setSeamSize:eR,setSeamSteps:tR,setSeamStrength:nR,setSeed:p2,setSeedWeights:pU,setShouldFitToWidthHeight:gU,setShouldGenerateVariations:B3e,setShouldRandomizeSeed:z3e,setSteps:yk,setThreshold:bk,setTileSize:rR,setVariationAmount:iR,setWidth:cS,setShouldUseSymmetry:H3e,setHorizontalSymmetrySteps:oR,setVerticalSymmetrySteps:aR}=iU.actions,W3e=iU.reducer,mU={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},U3e=mU,vU=ap({name:"postprocessing",initialState:U3e,reducers:{setAllPostProcessingParameters:(e,t)=>{const{type:n,hires_fix:r}=t.payload.image;n==="txt2img"&&(e.hiresFix=Boolean(r))},setFacetoolStrength:(e,t)=>{e.facetoolStrength=t.payload},setCodeformerFidelity:(e,t)=>{e.codeformerFidelity=t.payload},setUpscalingLevel:(e,t)=>{e.upscalingLevel=t.payload},setUpscalingDenoising:(e,t)=>{e.upscalingDenoising=t.payload},setUpscalingStrength:(e,t)=>{e.upscalingStrength=t.payload},setHiresFix:(e,t)=>{e.hiresFix=t.payload},setHiresStrength:(e,t)=>{e.hiresStrength=t.payload},resetPostprocessingState:e=>({...e,...mU}),setShouldRunFacetool:(e,t)=>{e.shouldRunFacetool=t.payload},setFacetoolType:(e,t)=>{e.facetoolType=t.payload},setShouldRunESRGAN:(e,t)=>{e.shouldRunESRGAN=t.payload},setShouldLoopback:(e,t)=>{e.shouldLoopback=t.payload}}}),{setAllPostProcessingParameters:yU,resetPostprocessingState:RNe,setCodeformerFidelity:xk,setFacetoolStrength:k3,setFacetoolType:dS,setHiresFix:bU,setHiresStrength:sR,setShouldLoopback:V3e,setShouldRunESRGAN:G3e,setShouldRunFacetool:q3e,setUpscalingLevel:xU,setUpscalingDenoising:Sk,setUpscalingStrength:wk}=vU.actions,K3e=vU.reducer;function gs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lR(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:{};gs(this,e),this.init(t,n)}return ms(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||Z3e,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i1?r-1:0),o=1;o-1?s.replace(/###/g,"."):s}function i(){return!e||typeof e=="string"}for(var o=typeof t!="string"?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function hR(e,t,n){var r=bE(e,t,Object),i=r.obj,o=r.k;i[o]=n}function ewe(e,t,n,r){var i=bE(e,t,Object),o=i.obj,a=i.k;o[a]=o[a]||[],r&&(o[a]=o[a].concat(n)),r||o[a].push(n)}function E3(e,t){var n=bE(e,t),r=n.obj,i=n.k;if(r)return r[i]}function pR(e,t,n){var r=E3(e,n);return r!==void 0?r:E3(t,n)}function _U(e,t,n){for(var r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):_U(e[r],t[r],n):e[r]=t[r]);return e}function Mg(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var twe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function nwe(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,function(t){return twe[t]}):e}var a4=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,rwe=[" ",",","?","!",";"];function iwe(e,t,n){t=t||"",n=n||"";var r=rwe.filter(function(s){return t.indexOf(s)<0&&n.indexOf(s)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(s){return s==="?"?"\\?":s}).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function gR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tx(e){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function kU(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;oo+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}var u=r.slice(o+a).join(n);return u?kU(l,u,n):void 0}i=i[r[o]]}return i}}var swe=function(e){o4(n,e);var t=owe(n);function n(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return gs(this,n),i=t.call(this),a4&&Jd.call(Fd(i)),i.data=r||{},i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return ms(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var o=this.options.ns.indexOf(i);o>-1&&this.options.ns.splice(o,1)}},{key:"getResource",value:function(i,o,a){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,u=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure,d=[i,o];a&&typeof a!="string"&&(d=d.concat(a)),a&&typeof a=="string"&&(d=d.concat(l?a.split(l):a)),i.indexOf(".")>-1&&(d=i.split("."));var p=E3(this.data,d);return p||!u||typeof a!="string"?p:kU(this.data&&this.data[i]&&this.data[i][o],a,l)}},{key:"addResource",value:function(i,o,a,s){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},u=this.options.keySeparator;u===void 0&&(u=".");var d=[i,o];a&&(d=d.concat(u?a.split(u):a)),i.indexOf(".")>-1&&(d=i.split("."),s=o,o=d[1]),this.addNamespaces(o),hR(this.data,d,s),l.silent||this.emit("added",i,o,a,s)}},{key:"addResources",value:function(i,o,a){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in a)(typeof a[l]=="string"||Object.prototype.toString.apply(a[l])==="[object Array]")&&this.addResource(i,o,l,a[l],{silent:!0});s.silent||this.emit("added",i,o,a)}},{key:"addResourceBundle",value:function(i,o,a,s,l){var u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},d=[i,o];i.indexOf(".")>-1&&(d=i.split("."),s=a,a=o,o=d[1]),this.addNamespaces(o);var p=E3(this.data,d)||{};s?_U(p,a,l):p=tx(tx({},p),a),hR(this.data,d,p),u.silent||this.emit("added",i,o,a)}},{key:"removeResourceBundle",value:function(i,o){this.hasResourceBundle(i,o)&&delete this.data[i][o],this.removeNamespaces(o),this.emit("removed",i,o)}},{key:"hasResourceBundle",value:function(i,o){return this.getResource(i,o)!==void 0}},{key:"getResourceBundle",value:function(i,o){return o||(o=this.options.defaultNS),this.options.compatibilityAPI==="v1"?tx(tx({},{}),this.getResource(i,o)):this.getResource(i,o)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var o=this.getDataByLanguage(i),a=o&&Object.keys(o)||[];return!!a.find(function(s){return o[s]&&Object.keys(o[s]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Jd),EU={processors:{},addPostProcessor:function(t){this.processors[t.name]=t},handle:function(t,n,r,i,o){var a=this;return t.forEach(function(s){a.processors[s]&&(n=a.processors[s].process(n,r,i,o))}),n}};function mR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yo(e){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var vR={},yR=function(e){o4(n,e);var t=lwe(n);function n(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return gs(this,n),i=t.call(this),a4&&Jd.call(Fd(i)),J3e(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Fd(i)),i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=Wl.create("translator"),i}return ms(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var a=this.resolve(i,o);return a&&a.res!==void 0}},{key:"extractFromKey",value:function(i,o){var a=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;a===void 0&&(a=":");var s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,l=o.ns||this.options.defaultNS||[],u=a&&i.indexOf(a)>-1,d=!this.options.userDefinedKeySeparator&&!o.keySeparator&&!this.options.userDefinedNsSeparator&&!o.nsSeparator&&!iwe(i,a,s);if(u&&!d){var p=i.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:i,namespaces:l};var m=i.split(a);(a!==s||a===s&&this.options.ns.indexOf(m[0])>-1)&&(l=m.shift()),i=m.join(s)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,o,a){var s=this;if(Ks(o)!=="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),o||(o={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,d=this.extractFromKey(i[i.length-1],o),p=d.key,m=d.namespaces,y=m[m.length-1],b=o.lng||this.language,w=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(b&&b.toLowerCase()==="cimode"){if(w){var E=o.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(y).concat(E).concat(p),usedKey:p,exactUsedKey:p,usedLng:b,usedNS:y}:"".concat(y).concat(E).concat(p)}return l?{res:p,usedKey:p,exactUsedKey:p,usedLng:b,usedNS:y}:p}var _=this.resolve(i,o),k=_&&_.res,T=_&&_.usedKey||p,L=_&&_.exactUsedKey||p,O=Object.prototype.toString.apply(k),D=["[object Number]","[object Function]","[object RegExp]"],I=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,N=!this.i18nFormat||this.i18nFormat.handleAsObject,W=typeof k!="string"&&typeof k!="boolean"&&typeof k!="number";if(N&&k&&W&&D.indexOf(O)<0&&!(typeof I=="string"&&O==="[object Array]")){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var B=this.options.returnedObjectHandler?this.options.returnedObjectHandler(T,k,yo(yo({},o),{},{ns:m})):"key '".concat(p," (").concat(this.language,")' returned an object instead of string.");return l?(_.res=B,_):B}if(u){var K=O==="[object Array]",ne=K?[]:{},z=K?L:T;for(var $ in k)if(Object.prototype.hasOwnProperty.call(k,$)){var V="".concat(z).concat(u).concat($);ne[$]=this.translate(V,yo(yo({},o),{joinArrays:!1,ns:m})),ne[$]===V&&(ne[$]=k[$])}k=ne}}else if(N&&typeof I=="string"&&O==="[object Array]")k=k.join(I),k&&(k=this.extendTranslation(k,i,o,a));else{var X=!1,Q=!1,G=o.count!==void 0&&typeof o.count!="string",Y=n.hasDefaultValue(o),ee=G?this.pluralResolver.getSuffix(b,o.count,o):"",fe=o["defaultValue".concat(ee)]||o.defaultValue;!this.isValidLookup(k)&&Y&&(X=!0,k=fe),this.isValidLookup(k)||(Q=!0,k=p);var _e=o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,we=_e&&Q?void 0:k,xe=Y&&fe!==k&&this.options.updateMissing;if(Q||X||xe){if(this.logger.log(xe?"updateKey":"missingKey",b,y,p,xe?fe:k),u){var Le=this.resolve(p,yo(yo({},o),{},{keySeparator:!1}));Le&&Le.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var Se=[],Je=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Je&&Je[0])for(var Xe=0;Xe1&&arguments[1]!==void 0?arguments[1]:{},s,l,u,d,p;return typeof i=="string"&&(i=[i]),i.forEach(function(m){if(!o.isValidLookup(s)){var y=o.extractFromKey(m,a),b=y.key;l=b;var w=y.namespaces;o.options.fallbackNS&&(w=w.concat(o.options.fallbackNS));var E=a.count!==void 0&&typeof a.count!="string",_=E&&!a.ordinal&&a.count===0&&o.pluralResolver.shouldUseIntlApi(),k=a.context!==void 0&&(typeof a.context=="string"||typeof a.context=="number")&&a.context!=="",T=a.lngs?a.lngs:o.languageUtils.toResolveHierarchy(a.lng||o.language,a.fallbackLng);w.forEach(function(L){o.isValidLookup(s)||(p=L,!vR["".concat(T[0],"-").concat(L)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(p)&&(vR["".concat(T[0],"-").concat(L)]=!0,o.logger.warn('key "'.concat(l,'" for languages "').concat(T.join(", "),`" won't get resolved as namespace "`).concat(p,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),T.forEach(function(O){if(!o.isValidLookup(s)){d=O;var D=[b];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(D,b,O,L,a);else{var I;E&&(I=o.pluralResolver.getSuffix(O,a.count,a));var N="".concat(o.options.pluralSeparator,"zero");if(E&&(D.push(b+I),_&&D.push(b+N)),k){var W="".concat(b).concat(o.options.contextSeparator).concat(a.context);D.push(W),E&&(D.push(W+I),_&&D.push(W+N))}}for(var B;B=D.pop();)o.isValidLookup(s)||(u=B,s=o.getResource(O,L,B,a))}}))})}}),{res:s,usedKey:l,exactUsedKey:u,usedLng:d,usedNS:p}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,o,a){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,o,a,s):this.resourceStore.getResource(i,o,a,s)}}],[{key:"hasDefaultValue",value:function(i){var o="defaultValue";for(var a in i)if(Object.prototype.hasOwnProperty.call(i,a)&&o===a.substring(0,o.length)&&i[a]!==void 0)return!0;return!1}}]),n}(Jd);function NC(e){return e.charAt(0).toUpperCase()+e.slice(1)}var bR=function(){function e(t){gs(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Wl.create("languageUtils")}return ms(e,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(o){return o.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=NC(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=NC(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=NC(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(o){if(!i){var a=r.formatLanguageCode(o);(!r.options.supportedLngs||r.isSupportedCode(a))&&(i=a)}}),!i&&this.options.supportedLngs&&n.forEach(function(o){if(!i){var a=r.getLanguagePartFromCode(o);if(r.isSupportedCode(a))return i=a;i=r.options.supportedLngs.find(function(s){if(s.indexOf(a)===0)return s})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,o=this.getFallbackCodes(r||this.options.fallbackLng||[],n),a=[],s=function(u){u&&(i.isSupportedCode(u)?a.push(u):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(u)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(n))):typeof n=="string"&&s(this.formatLanguageCode(n)),o.forEach(function(l){a.indexOf(l)<0&&s(i.formatLanguageCode(l))}),a}}]),e}(),cwe=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],dwe={1:function(t){return Number(t>1)},2:function(t){return Number(t!=1)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(t==1?0:t>=2&&t<=4?1:2)},7:function(t){return Number(t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(t==1?0:t==2?1:t!=8&&t!=11?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(t==1?0:t==2?1:t<7?2:t<11?3:4)},11:function(t){return Number(t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(t!==0)},14:function(t){return Number(t==1?0:t==2?1:t==3?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:t!==0?1:2)},17:function(t){return Number(t==1||t%10==1&&t%100!=11?0:1)},18:function(t){return Number(t==0?0:t==1?1:2)},19:function(t){return Number(t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(t==1?0:t==0||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)},22:function(t){return Number(t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3)}},fwe=["v1","v2","v3"],xR={zero:0,one:1,two:2,few:3,many:4,other:5};function hwe(){var e={};return cwe.forEach(function(t){t.lngs.forEach(function(n){e[n]={numbers:t.nr,plurals:dwe[t.fc]}})}),e}var pwe=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};gs(this,e),this.languageUtils=t,this.options=n,this.logger=Wl.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=hwe()}return ms(e,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(o){return"".concat(r).concat(o)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getRule(n,i);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort(function(a,s){return xR[a]-xR[s]}).map(function(a){return"".concat(r.options.prepend).concat(a)}):o.numbers.map(function(a){return r.getSuffix(n,a,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=this.getRule(n,i);return o?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(o.select(r)):this.getSuffixRetroCompatible(o,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,o=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),a=n.numbers[o];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(a===2?a="plural":a===1&&(a=""));var s=function(){return i.options.prepend&&a.toString()?i.options.prepend+a.toString():a.toString()};return this.options.compatibilityJSON==="v1"?a===1?"":typeof a=="number"?"_plural_".concat(a.toString()):s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?s():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}},{key:"shouldUseIntlApi",value:function(){return!fwe.includes(this.options.compatibilityJSON)}}]),e}();function SR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Fs(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{};gs(this,e),this.logger=Wl.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(n){return n},this.init(t)}return ms(e,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:nwe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Mg(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Mg(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Mg(r.nestingPrefix):r.nestingPrefixEscaped||Mg("$t("),this.nestingSuffix=r.nestingSuffix?Mg(r.nestingSuffix):r.nestingSuffixEscaped||Mg(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,o){var a=this,s,l,u,d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(E){return E.replace(/\$/g,"$$$$")}var m=function(_){if(_.indexOf(a.formatSeparator)<0){var k=pR(r,d,_);return a.alwaysFormat?a.format(k,void 0,i,Fs(Fs(Fs({},o),r),{},{interpolationkey:_})):k}var T=_.split(a.formatSeparator),L=T.shift().trim(),O=T.join(a.formatSeparator).trim();return a.format(pR(r,d,L),O,i,Fs(Fs(Fs({},o),r),{},{interpolationkey:L}))};this.resetRegExp();var y=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,b=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,w=[{regex:this.regexpUnescape,safeValue:function(_){return p(_)}},{regex:this.regexp,safeValue:function(_){return a.escapeValue?p(a.escape(_)):p(_)}}];return w.forEach(function(E){for(u=0;s=E.regex.exec(n);){var _=s[1].trim();if(l=m(_),l===void 0)if(typeof y=="function"){var k=y(n,s,o);l=typeof k=="string"?k:""}else if(o&&Object.prototype.hasOwnProperty.call(o,_))l="";else if(b){l=s[0];continue}else a.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(n)),l="";else typeof l!="string"&&!a.useRawValueToEscape&&(l=fR(l));var T=E.safeValue(l);if(n=n.replace(s[0],T),b?(E.regex.lastIndex+=l.length,E.regex.lastIndex-=s[0].length):E.regex.lastIndex=0,u++,u>=a.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,s,l;function u(y,b){var w=this.nestingOptionsSeparator;if(y.indexOf(w)<0)return y;var E=y.split(new RegExp("".concat(w,"[ ]*{"))),_="{".concat(E[1]);y=E[0],_=this.interpolate(_,l);var k=_.match(/'/g),T=_.match(/"/g);(k&&k.length%2===0&&!T||T.length%2!==0)&&(_=_.replace(/'/g,'"'));try{l=JSON.parse(_),b&&(l=Fs(Fs({},b),l))}catch(L){return this.logger.warn("failed parsing options string in nesting for key ".concat(y),L),"".concat(y).concat(w).concat(_)}return delete l.defaultValue,y}for(;a=this.nestingRegexp.exec(n);){var d=[];l=Fs({},o),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var p=!1;if(a[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(a[1])){var m=a[1].split(this.formatSeparator).map(function(y){return y.trim()});a[1]=m.shift(),d=m,p=!0}if(s=r(u.call(this,a[1].trim(),l),l),s&&a[0]===n&&typeof s!="string")return s;typeof s!="string"&&(s=fR(s)),s||(this.logger.warn("missed to resolve ".concat(a[1]," for nesting ").concat(n)),s=""),p&&(s=d.reduce(function(y,b){return i.format(y,b,o.lng,Fs(Fs({},o),{},{interpolationkey:a[1].trim()}))},s.trim())),n=n.replace(a[0],s),this.regexp.lastIndex=0}return n}}]),e}();function wR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ru(e){for(var t=1;t-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(t==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(t==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var o=i.split(";");o.forEach(function(a){if(a){var s=a.split(":"),l=X3e(s),u=l[0],d=l.slice(1),p=d.join(":").trim().replace(/^'+|'+$/g,"");n[u.trim()]||(n[u.trim()]=p),p==="false"&&(n[u.trim()]=!1),p==="true"&&(n[u.trim()]=!0),isNaN(p)||(n[u.trim()]=parseInt(p,10))}})}}return{formatName:t,formatOptions:n}}function Lg(e){var t={};return function(r,i,o){var a=i+JSON.stringify(o),s=t[a];return s||(s=e(i,o),t[a]=s),s(r)}}var vwe=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};gs(this,e),this.logger=Wl.create("formatter"),this.options=t,this.formats={number:Lg(function(n,r){var i=new Intl.NumberFormat(n,Ru({},r));return function(o){return i.format(o)}}),currency:Lg(function(n,r){var i=new Intl.NumberFormat(n,Ru(Ru({},r),{},{style:"currency"}));return function(o){return i.format(o)}}),datetime:Lg(function(n,r){var i=new Intl.DateTimeFormat(n,Ru({},r));return function(o){return i.format(o)}}),relativetime:Lg(function(n,r){var i=new Intl.RelativeTimeFormat(n,Ru({},r));return function(o){return i.format(o,r.range||"day")}}),list:Lg(function(n,r){var i=new Intl.ListFormat(n,Ru({},r));return function(o){return i.format(o)}})},this.init(t)}return ms(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=Lg(r)}},{key:"format",value:function(n,r,i){var o=this,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=r.split(this.formatSeparator),l=s.reduce(function(u,d){var p=mwe(d),m=p.formatName,y=p.formatOptions;if(o.formats[m]){var b=u;try{var w=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},E=w.locale||w.lng||a.locale||a.lng||i;b=o.formats[m](u,E,Ru(Ru(Ru({},y),a),w))}catch(_){o.logger.warn(_)}return b}else o.logger.warn("there was no format function for ".concat(m));return u},n);return l}}]),e}();function CR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _R(e){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function xwe(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}var Swe=function(e){o4(n,e);var t=ywe(n);function n(r,i,o){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return gs(this,n),a=t.call(this),a4&&Jd.call(Fd(a)),a.backend=r,a.store=i,a.services=o,a.languageUtils=o.languageUtils,a.options=s,a.logger=Wl.create("backendConnector"),a.waitingReads=[],a.maxParallelReads=s.maxParallelReads||10,a.readingCalls=0,a.maxRetries=s.maxRetries>=0?s.maxRetries:5,a.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,a.state={},a.queue=[],a.backend&&a.backend.init&&a.backend.init(o,s.backend,s),a}return ms(n,[{key:"queueLoad",value:function(i,o,a,s){var l=this,u={},d={},p={},m={};return i.forEach(function(y){var b=!0;o.forEach(function(w){var E="".concat(y,"|").concat(w);!a.reload&&l.store.hasResourceBundle(y,w)?l.state[E]=2:l.state[E]<0||(l.state[E]===1?d[E]===void 0&&(d[E]=!0):(l.state[E]=1,b=!1,d[E]===void 0&&(d[E]=!0),u[E]===void 0&&(u[E]=!0),m[w]===void 0&&(m[w]=!0)))}),b||(p[y]=!0)}),(Object.keys(u).length||Object.keys(d).length)&&this.queue.push({pending:d,pendingCount:Object.keys(d).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(u),pending:Object.keys(d),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(m)}}},{key:"loaded",value:function(i,o,a){var s=i.split("|"),l=s[0],u=s[1];o&&this.emit("failedLoading",l,u,o),a&&this.store.addResourceBundle(l,u,a),this.state[i]=o?-1:2;var d={};this.queue.forEach(function(p){ewe(p.loaded,[l],u),xwe(p,i),o&&p.errors.push(o),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(function(m){d[m]||(d[m]={});var y=p.loaded[m];y.length&&y.forEach(function(b){d[m][b]===void 0&&(d[m][b]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",d),this.queue=this.queue.filter(function(p){return!p.done})}},{key:"read",value:function(i,o,a){var s=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,d=arguments.length>5?arguments[5]:void 0;if(!i.length)return d(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:o,fcName:a,tried:l,wait:u,callback:d});return}this.readingCalls++;var p=function(w,E){if(s.readingCalls--,s.waitingReads.length>0){var _=s.waitingReads.shift();s.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(w&&E&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof o=="string"&&(o=[o]);var u=this.queueLoad(i,o,s,l);if(!u.toLoad.length)return u.pending.length||l(),null;u.toLoad.forEach(function(d){a.loadOne(d)})}},{key:"load",value:function(i,o,a){this.prepareLoading(i,o,{},a)}},{key:"reload",value:function(i,o,a){this.prepareLoading(i,o,{reload:!0},a)}},{key:"loadOne",value:function(i){var o=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",s=i.split("|"),l=s[0],u=s[1];this.read(l,u,"read",void 0,void 0,function(d,p){d&&o.logger.warn("".concat(a,"loading namespace ").concat(u," for language ").concat(l," failed"),d),!d&&p&&o.logger.log("".concat(a,"loaded namespace ").concat(u," for language ").concat(l),p),o.loaded(i,d,p)})}},{key:"saveMissing",value:function(i,o,a,s,l){var u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},d=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(o)){this.logger.warn('did not save key "'.concat(a,'" as the namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(a==null||a==="")){if(this.backend&&this.backend.create){var p=_R(_R({},u),{},{isUpdate:l}),m=this.backend.create.bind(this.backend);if(m.length<6)try{var y;m.length===5?y=m(i,o,a,s,p):y=m(i,o,a,s),y&&typeof y.then=="function"?y.then(function(b){return d(null,b)}).catch(d):d(null,y)}catch(b){d(b)}else m(i,o,a,s,d,p)}!i||!i[0]||this.store.addResource(i[0],o,a,s)}}}]),n}(Jd);function kR(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){var n={};if(Ks(t[1])==="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),Ks(t[2])==="object"||Ks(t[3])==="object"){var r=t[3]||t[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(t,n,r,i){return t},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function ER(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function PR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Tl(e){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nx(){}function _we(e){var t=Object.getOwnPropertyNames(Object.getPrototypeOf(e));t.forEach(function(n){typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}var P3=function(e){o4(n,e);var t=wwe(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(gs(this,n),r=t.call(this),a4&&Jd.call(Fd(r)),r.options=ER(i),r.services={},r.logger=Wl,r.modules={external:[]},_we(Fd(r)),o&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,o),g2(r,Fd(r));setTimeout(function(){r.init(i,o)},0)}return r}return ms(n,[{key:"init",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;typeof o=="function"&&(a=o,o={}),!o.defaultNS&&o.defaultNS!==!1&&o.ns&&(typeof o.ns=="string"?o.defaultNS=o.ns:o.ns.indexOf("translation")<0&&(o.defaultNS=o.ns[0]));var s=kR();this.options=Tl(Tl(Tl({},s),this.options),ER(o)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Tl(Tl({},s.interpolation),this.options.interpolation)),o.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=o.keySeparator),o.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=o.nsSeparator);function l(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?Wl.init(l(this.modules.logger),this.options):Wl.init(null,this.options);var u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=vwe);var d=new bR(this.options);this.store=new swe(this.options.resources,this.options);var p=this.services;p.logger=Wl,p.resourceStore=this.store,p.languageUtils=d,p.pluralResolver=new pwe(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=l(u),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new gwe(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Swe(l(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(_){for(var k=arguments.length,T=new Array(k>1?k-1:0),L=1;L1?k-1:0),L=1;L0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var y=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];y.forEach(function(_){i[_]=function(){var k;return(k=i.store)[_].apply(k,arguments)}});var b=["addResource","addResources","addResourceBundle","removeResourceBundle"];b.forEach(function(_){i[_]=function(){var k;return(k=i.store)[_].apply(k,arguments),i}});var w=qv(),E=function(){var k=function(L,O){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),w.resolve(O),a(L,O)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return k(null,i.t.bind(i));i.changeLanguage(i.options.lng,k)};return this.options.resources||!this.options.initImmediate?E():setTimeout(E,0),w}},{key:"loadResources",value:function(i){var o=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nx,s=a,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(s=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return s();var u=[],d=function(y){if(y){var b=o.services.languageUtils.toResolveHierarchy(y);b.forEach(function(w){u.indexOf(w)<0&&u.push(w)})}};if(l)d(l);else{var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.forEach(function(m){return d(m)})}this.options.preload&&this.options.preload.forEach(function(m){return d(m)}),this.services.backendConnector.load(u,this.options.ns,function(m){!m&&!o.resolvedLanguage&&o.language&&o.setResolvedLanguage(o.language),s(m)})}else s(null)}},{key:"reloadResources",value:function(i,o,a){var s=qv();return i||(i=this.languages),o||(o=this.options.ns),a||(a=nx),this.services.backendConnector.reload(i,o,function(l){s.resolve(),a(l)}),s}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&EU.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var o=0;o-1)&&this.store.hasLanguageSomeTranslations(a)){this.resolvedLanguage=a;break}}}},{key:"changeLanguage",value:function(i,o){var a=this;this.isLanguageChangingTo=i;var s=qv();this.emit("languageChanging",i);var l=function(m){a.language=m,a.languages=a.services.languageUtils.toResolveHierarchy(m),a.resolvedLanguage=void 0,a.setResolvedLanguage(m)},u=function(m,y){y?(l(y),a.translator.changeLanguage(y),a.isLanguageChangingTo=void 0,a.emit("languageChanged",y),a.logger.log("languageChanged",y)):a.isLanguageChangingTo=void 0,s.resolve(function(){return a.t.apply(a,arguments)}),o&&o(m,function(){return a.t.apply(a,arguments)})},d=function(m){!i&&!m&&a.services.languageDetector&&(m=[]);var y=typeof m=="string"?m:a.services.languageUtils.getBestMatchFromCodes(m);y&&(a.language||l(y),a.translator.language||a.translator.changeLanguage(y),a.services.languageDetector&&a.services.languageDetector.cacheUserLanguage&&a.services.languageDetector.cacheUserLanguage(y)),a.loadResources(y,function(b){u(b,y)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?d(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(d):this.services.languageDetector.detect(d):d(i),s}},{key:"getFixedT",value:function(i,o,a){var s=this,l=function u(d,p){var m;if(Ks(p)!=="object"){for(var y=arguments.length,b=new Array(y>2?y-2:0),w=2;w1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var s=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;var d=function(y,b){var w=o.services.backendConnector.state["".concat(y,"|").concat(b)];return w===-1||w===2};if(a.precheck){var p=a.precheck(this,d);if(p!==void 0)return p}return!!(this.hasResourceBundle(s,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||d(s,i)&&(!l||d(u,i)))}},{key:"loadNamespaces",value:function(i,o){var a=this,s=qv();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){a.options.ns.indexOf(l)<0&&a.options.ns.push(l)}),this.loadResources(function(l){s.resolve(),o&&o(l)}),s):(o&&o(),Promise.resolve())}},{key:"loadLanguages",value:function(i,o){var a=qv();typeof i=="string"&&(i=[i]);var s=this.options.preload||[],l=i.filter(function(u){return s.indexOf(u)<0});return l.length?(this.options.preload=s.concat(l),this.loadResources(function(u){a.resolve(),o&&o(u)}),a):(o&&o(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var o=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],a=this.services&&this.services.languageUtils||new bR(kR());return o.indexOf(a.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nx,s=Tl(Tl(Tl({},this.options),o),{isClone:!0}),l=new n(s);(o.debug!==void 0||o.prefix!==void 0)&&(l.logger=l.logger.clone(o));var u=["store","services","language"];return u.forEach(function(d){l[d]=i[d]}),l.services=Tl({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new yR(l.services,l.options),l.translator.on("*",function(d){for(var p=arguments.length,m=new Array(p>1?p-1:0),y=1;y0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new P3(e,t)});var Et=P3.createInstance();Et.createInstance=P3.createInstance;Et.createInstance;Et.dir;Et.init;Et.loadResources;Et.reloadResources;Et.use;Et.changeLanguage;Et.getFixedT;Et.t;Et.exists;Et.setDefaultNamespace;Et.hasLoadedNamespace;Et.loadNamespaces;Et.loadLanguages;var PU=[],kwe=PU.forEach,Ewe=PU.slice;function Pwe(e){return kwe.call(Ewe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var TR=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Twe=function(t,n,r){var i=r||{};i.path=i.path||"/";var o=encodeURIComponent(n),a="".concat(t,"=").concat(o);if(i.maxAge>0){var s=i.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(s))}if(i.domain){if(!TR.test(i.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(i.domain)}if(i.path){if(!TR.test(i.path))throw new TypeError("option path is invalid");a+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(a+="; HttpOnly"),i.secure&&(a+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},MR={create:function(t,n,r,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),i&&(o.domain=i),document.cookie=Twe(t,encodeURIComponent(n),o)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),o=i.split("&"),a=0;a0){var l=o[a].substring(0,s);l===t.lookupQuerystring&&(n=o[a].substring(s+1))}}}return n}},Kv=null,LR=function(){if(Kv!==null)return Kv;try{Kv=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Kv=!1}return Kv},Awe={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&LR()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&LR()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Yv=null,AR=function(){if(Yv!==null)return Yv;try{Yv=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Yv=!1}return Yv},Owe={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&AR()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&AR()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},Rwe={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},Iwe={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},Dwe={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},jwe={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function Nwe(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var TU=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};gs(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return ms(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Pwe(r,this.options||{},Nwe()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Mwe),this.addDetector(Lwe),this.addDetector(Awe),this.addDetector(Owe),this.addDetector(Rwe),this.addDetector(Iwe),this.addDetector(Dwe),this.addDetector(jwe)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(o){if(r.detectors[o]){var a=r.detectors[o].lookup(r.options);a&&typeof a=="string"&&(a=[a]),a&&(i=i.concat(a))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(o){i.detectors[o]&&i.detectors[o].cacheUserLanguage(n,i.options)}))}}]),e}();TU.type="languageDetector";function Ck(e){return Ck=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ck(e)}var MU=[],$we=MU.forEach,Fwe=MU.slice;function _k(e){return $we.call(Fwe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function LU(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Ck(XMLHttpRequest))==="object"}function Bwe(e){return!!e&&typeof e.then=="function"}function zwe(e){return Bwe(e)?e:Promise.resolve(e)}function Hwe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Dy={},Wwe={get exports(){return Dy},set exports(e){Dy=e}},V1={},Uwe={get exports(){return V1},set exports(e){V1=e}},OR;function Vwe(){return OR||(OR=1,function(e,t){var n=typeof self<"u"?self:So,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l($){return $&&DataView.prototype.isPrototypeOf($)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function($){return $&&u.indexOf(Object.prototype.toString.call($))>-1};function p($){if(typeof $!="string"&&($=String($)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test($))throw new TypeError("Invalid character in header field name");return $.toLowerCase()}function m($){return typeof $!="string"&&($=String($)),$}function y($){var V={next:function(){var X=$.shift();return{done:X===void 0,value:X}}};return s.iterable&&(V[Symbol.iterator]=function(){return V}),V}function b($){this.map={},$ instanceof b?$.forEach(function(V,X){this.append(X,V)},this):Array.isArray($)?$.forEach(function(V){this.append(V[0],V[1])},this):$&&Object.getOwnPropertyNames($).forEach(function(V){this.append(V,$[V])},this)}b.prototype.append=function($,V){$=p($),V=m(V);var X=this.map[$];this.map[$]=X?X+", "+V:V},b.prototype.delete=function($){delete this.map[p($)]},b.prototype.get=function($){return $=p($),this.has($)?this.map[$]:null},b.prototype.has=function($){return this.map.hasOwnProperty(p($))},b.prototype.set=function($,V){this.map[p($)]=m(V)},b.prototype.forEach=function($,V){for(var X in this.map)this.map.hasOwnProperty(X)&&$.call(V,this.map[X],X,this)},b.prototype.keys=function(){var $=[];return this.forEach(function(V,X){$.push(X)}),y($)},b.prototype.values=function(){var $=[];return this.forEach(function(V){$.push(V)}),y($)},b.prototype.entries=function(){var $=[];return this.forEach(function(V,X){$.push([X,V])}),y($)},s.iterable&&(b.prototype[Symbol.iterator]=b.prototype.entries);function w($){if($.bodyUsed)return Promise.reject(new TypeError("Already read"));$.bodyUsed=!0}function E($){return new Promise(function(V,X){$.onload=function(){V($.result)},$.onerror=function(){X($.error)}})}function _($){var V=new FileReader,X=E(V);return V.readAsArrayBuffer($),X}function k($){var V=new FileReader,X=E(V);return V.readAsText($),X}function T($){for(var V=new Uint8Array($),X=new Array(V.length),Q=0;Q-1?V:$}function N($,V){V=V||{};var X=V.body;if($ instanceof N){if($.bodyUsed)throw new TypeError("Already read");this.url=$.url,this.credentials=$.credentials,V.headers||(this.headers=new b($.headers)),this.method=$.method,this.mode=$.mode,this.signal=$.signal,!X&&$._bodyInit!=null&&(X=$._bodyInit,$.bodyUsed=!0)}else this.url=String($);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new b(V.headers)),this.method=I(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(X)}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function W($){var V=new FormData;return $.trim().split("&").forEach(function(X){if(X){var Q=X.split("="),G=Q.shift().replace(/\+/g," "),Y=Q.join("=").replace(/\+/g," ");V.append(decodeURIComponent(G),decodeURIComponent(Y))}}),V}function B($){var V=new b,X=$.replace(/\r?\n[\t ]+/g," ");return X.split(/\r?\n/).forEach(function(Q){var G=Q.split(":"),Y=G.shift().trim();if(Y){var ee=G.join(":").trim();V.append(Y,ee)}}),V}O.call(N.prototype);function K($,V){V||(V={}),this.type="default",this.status=V.status===void 0?200:V.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in V?V.statusText:"OK",this.headers=new b(V.headers),this.url=V.url||"",this._initBody($)}O.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new b(this.headers),url:this.url})},K.error=function(){var $=new K(null,{status:0,statusText:""});return $.type="error",$};var ne=[301,302,303,307,308];K.redirect=function($,V){if(ne.indexOf(V)===-1)throw new RangeError("Invalid status code");return new K(null,{status:V,headers:{location:$}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(V,X){this.message=V,this.name=X;var Q=Error(V);this.stack=Q.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function z($,V){return new Promise(function(X,Q){var G=new N($,V);if(G.signal&&G.signal.aborted)return Q(new a.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function ee(){Y.abort()}Y.onload=function(){var fe={status:Y.status,statusText:Y.statusText,headers:B(Y.getAllResponseHeaders()||"")};fe.url="responseURL"in Y?Y.responseURL:fe.headers.get("X-Request-URL");var _e="response"in Y?Y.response:Y.responseText;X(new K(_e,fe))},Y.onerror=function(){Q(new TypeError("Network request failed"))},Y.ontimeout=function(){Q(new TypeError("Network request failed"))},Y.onabort=function(){Q(new a.DOMException("Aborted","AbortError"))},Y.open(G.method,G.url,!0),G.credentials==="include"?Y.withCredentials=!0:G.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&s.blob&&(Y.responseType="blob"),G.headers.forEach(function(fe,_e){Y.setRequestHeader(_e,fe)}),G.signal&&(G.signal.addEventListener("abort",ee),Y.onreadystatechange=function(){Y.readyState===4&&G.signal.removeEventListener("abort",ee)}),Y.send(typeof G._bodyInit>"u"?null:G._bodyInit)})}return z.polyfill=!0,o.fetch||(o.fetch=z,o.Headers=b,o.Request=N,o.Response=K),a.Headers=b,a.Request=N,a.Response=K,a.fetch=z,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(Uwe,V1)),V1}(function(e,t){var n;if(typeof fetch=="function"&&(typeof So<"u"&&So.fetch?n=So.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof Hwe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||Vwe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Wwe,Dy);const AU=Dy,RR=Cj({__proto__:null,default:AU},[Dy]);function T3(e){return T3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T3(e)}var Yu;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Yu=global.fetch:typeof window<"u"&&window.fetch?Yu=window.fetch:Yu=fetch);var jy;LU()&&(typeof global<"u"&&global.XMLHttpRequest?jy=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(jy=window.XMLHttpRequest));var M3;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?M3=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(M3=window.ActiveXObject));!Yu&&RR&&!jy&&!M3&&(Yu=AU||RR);typeof Yu!="function"&&(Yu=void 0);var kk=function(t,n){if(n&&T3(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},IR=function(t,n,r){Yu(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},DR=!1,Gwe=function(t,n,r,i){t.queryStringParams&&(n=kk(n,t.queryStringParams));var o=_k({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=_k({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},DR?{}:a);try{IR(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),IR(n,s,i),DR=!0}catch(u){i(u)}}},qwe=function(t,n,r,i){r&&T3(r)==="object"&&(r=kk("",r).slice(1)),t.queryStringParams&&(n=kk(n,t.queryStringParams));try{var o;jy?o=new jy:o=new M3("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},Kwe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Yu&&n.indexOf("file:")!==0)return Gwe(t,n,r,i);if(LU()||typeof ActiveXObject=="function")return qwe(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Ny(e){return Ny=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ny(e)}function Ywe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jR(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Ywe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return Xwe(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=_k(i,this.options||{},Jwe()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=zwe(l),l.then(function(u){if(!u)return a(null,{});var d=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(d,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this;this.options.request(this.options,n,void 0,function(s,l){if(l&&(l.status>=500&&l.status<600||!l.status))return r("failed loading "+n+"; status code: "+l.status,!0);if(l&&l.status>=400&&l.status<500)return r("failed loading "+n+"; status code: "+l.status,!1);if(!l&&s&&s.message&&s.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+s.message,!0);if(s)return r(s,!1);var u,d;try{typeof l.data=="string"?u=a.options.parse(l.data,i,o):u=l.data}catch{d="failed parsing "+n+" to json"}if(d)return r(d,!1);r(null,u)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,d=[],p=[];n.forEach(function(m){var y=s.options.addPath;typeof s.options.addPath=="function"&&(y=s.options.addPath(m,r));var b=s.services.interpolator.interpolate(y,{lng:m,ns:r});s.options.request(s.options,b,l,function(w,E){u+=1,d.push(w),p.push(E),u===n.length&&typeof a=="function"&&a(d,p)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(p){var m=o.toResolveHierarchy(p);m.forEach(function(y){l.indexOf(y)<0&&l.push(y)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(d){return u(d)}),l.forEach(function(d){n.allOptions.ns.forEach(function(p){i.read(d,p,"read",null,null,function(m,y){m&&a.warn("loading namespace ".concat(p," for language ").concat(d," failed"),m),!m&&y&&a.log("loaded namespace ".concat(p," for language ").concat(d),y),i.loaded("".concat(d,"|").concat(p),m,y)})})})}}}]),e}();RU.type="backend";function e4e(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var a=function(l,u){var d=t.services.backendConnector.state["".concat(l,"|").concat(u)];return d===-1||d===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function n4e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!t.languages||!t.languages.length)return Ek("i18n.languages were undefined or empty",t.languages),!0;var r=t.options.ignoreJSONStructure!==void 0;return r?t.hasLoadedNamespace(e,{precheck:function(o,a){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!a(o.isLanguageChangingTo,e))return!1}}):t4e(e,t,n)}var r4e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,i4e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},o4e=function(t){return i4e[t]},a4e=function(t){return t.replace(r4e,o4e)};function FR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function BR(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{};Pk=BR(BR({},Pk),e)}function l4e(){return Pk}var IU;function u4e(e){IU=e}function c4e(){return IU}var d4e={type:"3rdParty",init:function(t){s4e(t.options.react),u4e(t)}},f4e=S.createContext(),h4e=function(){function e(){gs(this,e),this.usedNamespaces={}}return ms(e,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function p4e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function g4e(e,t){return SU(e)||p4e(e,t)||wU(e,t)||CU()}function zR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $C(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{},n=t.i18n,r=S.useContext(f4e)||{},i=r.i18n,o=r.defaultNS,a=n||i||c4e();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new h4e),!a){Ek("You will need to pass in an i18next instance by using initReactI18next");var s=function(W){return Array.isArray(W)?W[W.length-1]:W},l=[s,{},!1];return l.t=s,l.i18n={},l.ready=!1,l}a.options.react&&a.options.react.wait!==void 0&&Ek("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var u=$C($C($C({},l4e()),a.options.react),t),d=u.useSuspense,p=u.keyPrefix,m=e||o||a.options&&a.options.defaultNS;m=typeof m=="string"?[m]:m||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(m);var y=(a.isInitialized||a.initializedStoreOnce)&&m.every(function(N){return n4e(N,a,u)});function b(){return a.getFixedT(null,u.nsMode==="fallback"?m:m[0],p)}var w=S.useState(b),E=g4e(w,2),_=E[0],k=E[1],T=m.join(),L=m4e(T),O=S.useRef(!0);S.useEffect(function(){var N=u.bindI18n,W=u.bindI18nStore;O.current=!0,!y&&!d&&$R(a,m,function(){O.current&&k(b)}),y&&L&&L!==T&&O.current&&k(b);function B(){O.current&&k(b)}return N&&a&&a.on(N,B),W&&a&&a.store.on(W,B),function(){O.current=!1,N&&a&&N.split(" ").forEach(function(K){return a.off(K,B)}),W&&a&&W.split(" ").forEach(function(K){return a.store.off(K,B)})}},[a,T]);var D=S.useRef(!0);S.useEffect(function(){O.current&&!D.current&&k(b),D.current=!1},[a,p]);var I=[_,a,y];if(I.t=_,I.i18n=a,I.ready=y,y||!y&&!d)return I;throw new Promise(function(N){$R(a,m,function(){N()})})}Et.use(RU).use(TU).use(d4e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const v4e={isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[0],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:Et.isInitialized?Et.t("common.statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null,cancelOptions:{cancelType:"immediate",cancelAfter:null}},DU=ap({name:"system",initialState:v4e,reducers:{setShouldDisplayInProgressType:(e,t)=>{e.shouldDisplayInProgressType=t.payload},setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.currentStatus=t.payload},setSystemStatus:(e,t)=>({...e,...t.payload}),errorOccurred:e=>{e.hasError=!0,e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=Et.t("common.statusError"),e.wasErrorSeen=!1},errorSeen:e=>{e.hasError=!1,e.wasErrorSeen=!0,e.currentStatus=e.isConnected?Et.t("common.statusConnected"):Et.t("common.statusDisconnected")},addLogEntry:(e,t)=>{const{timestamp:n,message:r,level:i}=t.payload,a={timestamp:n,message:r,level:i||"info"};e.log.push(a)},setShouldShowLogViewer:(e,t)=>{e.shouldShowLogViewer=t.payload},setIsConnected:(e,t)=>{e.isConnected=t.payload,e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.hasError=!1},setSocketId:(e,t)=>{e.socketId=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setOpenAccordions:(e,t)=>{e.openAccordions=t.payload},setSystemConfig:(e,t)=>({...e,...t.payload}),setShouldDisplayGuides:(e,t)=>{e.shouldDisplayGuides=t.payload},processingCanceled:e=>{e.isProcessing=!1,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=Et.t("common.statusProcessingCanceled")},generationRequested:e=>{e.isProcessing=!0,e.isCancelable=!0,e.currentStep=0,e.totalSteps=0,e.currentIteration=0,e.totalIterations=0,e.currentStatusHasSteps=!1,e.currentStatus=Et.t("common.statusPreparing")},setModelList:(e,t)=>{e.model_list=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},modelChangeRequested:e=>{e.currentStatus=Et.t("common.statusLoadingModel"),e.isCancelable=!1,e.isProcessing=!0,e.currentStatusHasSteps=!1},modelConvertRequested:e=>{e.currentStatus=Et.t("common.statusConvertingModel"),e.isCancelable=!1,e.isProcessing=!0,e.currentStatusHasSteps=!1},modelMergingRequested:e=>{e.currentStatus=Et.t("common.statusMergingModels"),e.isCancelable=!1,e.isProcessing=!0,e.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(e,t)=>{e.saveIntermediatesInterval=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},setProcessingIndeterminateTask:(e,t)=>{e.isProcessing=!0,e.currentStatus=t.payload,e.currentStatusHasSteps=!1},setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setFoundModels:(e,t)=>{e.foundModels=t.payload},setOpenModel:(e,t)=>{e.openModel=t.payload},setCancelType:(e,t)=>{e.cancelOptions.cancelType=t.payload},setCancelAfter:(e,t)=>{e.cancelOptions.cancelAfter=t.payload}}}),{setShouldDisplayInProgressType:y4e,setIsProcessing:wa,addLogEntry:Pi,setShouldShowLogViewer:FC,setIsConnected:HR,setSocketId:INe,setShouldConfirmOnDelete:jU,setOpenAccordions:b4e,setSystemStatus:x4e,setCurrentStatus:hh,setSystemConfig:S4e,setShouldDisplayGuides:w4e,processingCanceled:C4e,errorOccurred:WR,errorSeen:NU,setModelList:Ag,setIsCancelable:_d,modelChangeRequested:_4e,modelConvertRequested:k4e,modelMergingRequested:E4e,setSaveIntermediatesInterval:P4e,setEnableImageDebugging:T4e,generationRequested:M4e,addToast:$u,clearToastQueue:L4e,setProcessingIndeterminateTask:A4e,setSearchFolder:$U,setFoundModels:FU,setOpenModel:UR,setCancelType:VR,setCancelAfter:BC}=DU.actions,O4e=DU.reducer,xE=["txt2img","img2img","unifiedCanvas","nodes","postprocess","training"],R4e={activeTab:0,currentTheme:"dark",parametersPanelScrollPosition:0,shouldHoldParametersPanelOpen:!1,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowDualDisplay:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null},I4e=R4e,BU=ap({name:"ui",initialState:I4e,reducers:{setActiveTab:(e,t)=>{typeof t.payload=="number"?e.activeTab=t.payload:e.activeTab=xE.indexOf(t.payload)},setCurrentTheme:(e,t)=>{e.currentTheme=t.payload},setParametersPanelScrollPosition:(e,t)=>{e.parametersPanelScrollPosition=t.payload},setShouldPinParametersPanel:(e,t)=>{e.shouldPinParametersPanel=t.payload},setShouldShowParametersPanel:(e,t)=>{e.shouldShowParametersPanel=t.payload},setShouldHoldParametersPanelOpen:(e,t)=>{e.shouldHoldParametersPanelOpen=t.payload},setShouldShowDualDisplay:(e,t)=>{e.shouldShowDualDisplay=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setAddNewModelUIOption:(e,t)=>{e.addNewModelUIOption=t.payload}}}),{setActiveTab:Wo,setCurrentTheme:D4e,setParametersPanelScrollPosition:j4e,setShouldHoldParametersPanelOpen:N4e,setShouldPinParametersPanel:$4e,setShouldShowParametersPanel:Fh,setShouldShowDualDisplay:F4e,setShouldShowImageDetails:zU,setShouldUseCanvasBetaLayout:B4e,setShouldShowExistingModelsInSearch:z4e,setShouldUseSliders:H4e,setAddNewModelUIOption:Bh}=BU.actions,W4e=BU.reducer,iu=Object.create(null);iu.open="0";iu.close="1";iu.ping="2";iu.pong="3";iu.message="4";iu.upgrade="5";iu.noop="6";const fS=Object.create(null);Object.keys(iu).forEach(e=>{fS[iu[e]]=e});const U4e={type:"error",data:"parser error"},V4e=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",G4e=typeof ArrayBuffer=="function",q4e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,HU=({type:e,data:t},n,r)=>V4e&&t instanceof Blob?n?r(t):GR(t,r):G4e&&(t instanceof ArrayBuffer||q4e(t))?n?r(t):GR(new Blob([t]),r):r(iu[e]+(t||"")),GR=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)},qR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(r=0;r>4,d[i++]=(a&15)<<4|s>>2,d[i++]=(s&3)<<6|l&63;return u},Y4e=typeof ArrayBuffer=="function",WU=(e,t)=>{if(typeof e!="string")return{type:"message",data:UU(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:X4e(e.substring(1),t)}:fS[n]?e.length>1?{type:fS[n],data:e.substring(1)}:{type:fS[n]}:U4e},X4e=(e,t)=>{if(Y4e){const n=K4e(e);return UU(n,t)}else return{base64:!0,data:e}},UU=(e,t)=>{switch(t){case"blob":return e instanceof ArrayBuffer?new Blob([e]):e;case"arraybuffer":default:return e}},VU=String.fromCharCode(30),Z4e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{HU(o,!1,s=>{r[a]=s,++i===n&&t(r.join(VU))})})},Q4e=(e,t)=>{const n=e.split(VU),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function qU(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const e5e=Za.setTimeout,t5e=Za.clearTimeout;function s4(e,t){t.useNativeTimers?(e.setTimeoutFn=e5e.bind(Za),e.clearTimeoutFn=t5e.bind(Za)):(e.setTimeoutFn=Za.setTimeout.bind(Za),e.clearTimeoutFn=Za.clearTimeout.bind(Za))}const n5e=1.33;function r5e(e){return typeof e=="string"?i5e(e):Math.ceil((e.byteLength||e.size)*n5e)}function i5e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}class o5e extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class KU extends ai{constructor(t){super(),this.writable=!1,s4(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,n,r){return super.emitReserved("error",new o5e(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=WU(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}}const YU="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Tk=64,a5e={};let KR=0,rx=0,YR;function XR(e){let t="";do t=YU[e%Tk]+t,e=Math.floor(e/Tk);while(e>0);return t}function XU(){const e=XR(+new Date);return e!==YR?(KR=0,YR=e):e+"."+XR(KR++)}for(;rx{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Q4e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Z4e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=XU()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=ZU(t),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new eu(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class eu extends ai{constructor(t,n){super(),s4(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const t=qU(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const n=this.xhr=new JU(t);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=eu.requestsCount++,eu.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=u5e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete eu.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}eu.requestsCount=0;eu.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ZR);else if(typeof addEventListener=="function"){const e="onpagehide"in Za?"pagehide":"unload";addEventListener(e,ZR,!1)}}function ZR(){for(let e in eu.requests)eu.requests.hasOwnProperty(e)&&eu.requests[e].abort()}const eV=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),ix=Za.WebSocket||Za.MozWebSocket,QR=!0,f5e="arraybuffer",JR=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class h5e extends KU{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=JR?{}:qU(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=QR&&!JR?n?new ix(t,n):new ix(t):new ix(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||f5e,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{QR&&this.ws.send(o)}catch{}i&&eV(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=XU()),this.supportsBinary||(t.b64=1);const i=ZU(t),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!ix}}const p5e={websocket:h5e,polling:d5e},g5e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,m5e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Mk(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=g5e.exec(e||""),o={},a=14;for(;a--;)o[m5e[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=v5e(o,o.path),o.queryKey=y5e(o,o.query),o}function v5e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function y5e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let tV=class Ng extends ai{constructor(t,n={}){super(),this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=Mk(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=Mk(n.host).host),s4(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=s5e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=GU,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[t],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new p5e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Ng.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Ng.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ng.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,d(),n.close(),n=null)}const a=p=>{const m=new Error("probe error: "+p);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function s(){a("transport closed")}function l(){a("socket closed")}function u(p){n&&p.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),n.open()}onOpen(){if(this.readyState="open",Ng.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Ng.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,nV=Object.prototype.toString,w5e=typeof Blob=="function"||typeof Blob<"u"&&nV.call(Blob)==="[object BlobConstructor]",C5e=typeof File=="function"||typeof File<"u"&&nV.call(File)==="[object FileConstructor]";function SE(e){return x5e&&(e instanceof ArrayBuffer||S5e(e))||w5e&&e instanceof Blob||C5e&&e instanceof File}function hS(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num0;case nn.ACK:case nn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class T5e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=k5e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const M5e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:wE,Encoder:P5e,get PacketType(){return nn},protocol:E5e},Symbol.toStringTag,{value:"Module"}));function Hs(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const L5e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class rV extends ai{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Hs(t,"open",this.onopen.bind(this)),Hs(t,"packet",this.onpacket.bind(this)),Hs(t,"error",this.onerror.bind(this)),Hs(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){if(L5e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:nn.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const a=this.ids++,s=n.pop();this._registerAckCallback(a,s),r.id=a}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this.ids++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(){if(this._queue.length===0)return;const t=this._queue[0];if(t.pending)return;t.pending=!0,t.tryCount++;const n=this.ids;this.ids=t.id,this.flags=t.flags,this.emit.apply(this,t.args),this.ids=n}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:nn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case nn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case nn.EVENT:case nn.BINARY_EVENT:this.onevent(t);break;case nn.ACK:case nn.BINARY_ACK:this.onack(t);break;case nn.DISCONNECT:this.ondisconnect();break;case nn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:nn.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:nn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}b0.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};b0.prototype.reset=function(){this.attempts=0};b0.prototype.setMin=function(e){this.ms=e};b0.prototype.setMax=function(e){this.max=e};b0.prototype.setJitter=function(e){this.jitter=e};class Ok extends ai{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,s4(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new b0({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||M5e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new tV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Hs(n,"open",function(){r.onopen(),t&&t()}),o=Hs(n,"error",a=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",a),t?t(a):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const a=this._timeout;a===0&&i();const s=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},a);this.opts.autoUnref&&s.unref(),this.subs.push(function(){clearTimeout(s)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Hs(t,"ping",this.onping.bind(this)),Hs(t,"data",this.ondata.bind(this)),Hs(t,"error",this.onerror.bind(this)),Hs(t,"close",this.onclose.bind(this)),Hs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){eV(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r||(r=new rV(this,t,n),this.nsps[t]=r),this._autoConnect&&r.connect(),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Xv={};function pS(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=b5e(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=Xv[i]&&o in Xv[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new Ok(r,t):(Xv[i]||(Xv[i]=new Ok(r,t)),l=Xv[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(pS,{Manager:Ok,Socket:rV,io:pS,connect:pS});const A5e=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],O5e=["ddim","plms","k_lms","dpmpp_2","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_euler","k_euler_a","k_heun"],R5e=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],I5e=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],D5e=[{key:"2x",value:2},{key:"4x",value:4}],CE=0,_E=4294967295,j5e=["gfpgan","codeformer"],N5e=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}];var $5e=Math.PI/180;function F5e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Im=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},ft={_global:Im,version:"8.4.2",isBrowser:F5e(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return ft.angleDeg?e*$5e:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return ft.DD.isDragging},isDragReady(){return!!ft.DD.node},releaseCanvasOnDestroy:!0,document:Im.document,_injectGlobal(e){Im.Konva=e}},Mr=e=>{ft[e.prototype.getClassName()]=e};ft._injectGlobal(ft);class Ca{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Ca(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){var n=this.m;return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]}}translate(t,n){return this.m[4]+=this.m[0]*t+this.m[2]*n,this.m[5]+=this.m[1]*t+this.m[3]*n,this}scale(t,n){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=n,this.m[3]*=n,this}rotate(t){var n=Math.cos(t),r=Math.sin(t),i=this.m[0]*n+this.m[2]*r,o=this.m[1]*n+this.m[3]*r,a=this.m[0]*-r+this.m[2]*n,s=this.m[1]*-r+this.m[3]*n;return this.m[0]=i,this.m[1]=o,this.m[2]=a,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,n){var r=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,o=this.m[2]+this.m[0]*t,a=this.m[3]+this.m[1]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=o,this.m[3]=a,this}multiply(t){var n=this.m[0]*t.m[0]+this.m[2]*t.m[1],r=this.m[1]*t.m[0]+this.m[3]*t.m[1],i=this.m[0]*t.m[2]+this.m[2]*t.m[3],o=this.m[1]*t.m[2]+this.m[3]*t.m[3],a=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],s=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=o,this.m[4]=a,this.m[5]=s,this}invert(){var t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*t,r=-this.m[1]*t,i=-this.m[2]*t,o=this.m[0]*t,a=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=o,this.m[4]=a,this.m[5]=s,this}getMatrix(){return this.m}decompose(){var t=this.m[0],n=this.m[1],r=this.m[2],i=this.m[3],o=this.m[4],a=this.m[5],s=t*i-n*r;let l={x:o,y:a,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||n!=0){var u=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/u):-Math.acos(t/u),l.scaleX=u,l.scaleY=s/u,l.skewX=(t*r+n*i)/s,l.skewY=0}else if(r!=0||i!=0){var d=Math.sqrt(r*r+i*i);l.rotation=Math.PI/2-(i>0?Math.acos(-r/d):-Math.acos(r/d)),l.scaleX=s/d,l.scaleY=d,l.skewX=0,l.skewY=(t*r+n*i)/s}return l.rotation=de._getRotation(l.rotation),l}}var B5e="[object Array]",z5e="[object Number]",H5e="[object String]",W5e="[object Boolean]",U5e=Math.PI/180,V5e=180/Math.PI,zC="#",G5e="",q5e="0",K5e="Konva warning: ",eI="Konva error: ",Y5e="rgb(",HC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},X5e=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,ox=[];const Z5e=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,60)},de={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===B5e},_isNumber(e){return Object.prototype.toString.call(e)===z5e&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===H5e},_isBoolean(e){return Object.prototype.toString.call(e)===W5e},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!="string")return!1;var t=e[0];return t==="#"||t==="."||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){ox.push(e),ox.length===1&&Z5e(function(){const t=ox;ox=[],t.forEach(function(n){n()})})},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=de.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(zC,G5e);var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){for(var e=(Math.random()*16777215<<0).toString(16);e.length<6;)e=q5e+e;return zC+e},getRGB(e){var t;return e in HC?(t=HC[e],{r:t[0],g:t[1],b:t[2]}):e[0]===zC?this._hexToRgb(e.substring(1)):e.substr(0,4)===Y5e?(t=X5e.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e=e||"black",de._namedColorToRBA(e)||de._hex3ColorToRGBA(e)||de._hex4ColorToRGBA(e)||de._hex6ColorToRGBA(e)||de._hex8ColorToRGBA(e)||de._rgbColorToRGBA(e)||de._rgbaColorToRGBA(e)||de._hslColorToRGBA(e)},_namedColorToRBA(e){var t=HC[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];var t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];var t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,i=Number(n[1])/100,o=Number(n[2])/100;let a,s,l;if(i===0)return l=o*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};o<.5?a=o*(1+i):a=o+i-o*i;const u=2*o-a,d=[0,0,0];for(let p=0;p<3;p++)s=r+1/3*-(p-1),s<0&&s++,s>1&&s--,6*s<1?l=u+(a-u)*6*s:2*s<1?l=a:3*s<2?l=u+(a-u)*(2/3-s)*6:l=u,d[p]=l*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.height1?(a=n,s=r,l=(n-i)*(n-i)+(r-o)*(r-o)):(a=e+d*(n-e),s=t+d*(r-t),l=(a-i)*(a-i)+(s-o)*(s-o))}return[a,s,l]},_getProjectionToLine(e,t,n){var r=de.cloneObject(e),i=Number.MAX_VALUE;return t.forEach(function(o,a){if(!(!n&&a===t.length-1)){var s=t[(a+1)%t.length],l=de._getProjectionToSegment(o.x,o.y,s.x,s.y,e.x,e.y),u=l[0],d=l[1],p=l[2];pt.length){var a=t;t=e,e=a}for(r=0;r{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let i=0,o=0,a=0,s=0;typeof r=="number"?i=o=a=s=Math.min(r,t/2,n/2):(i=Math.min(r[0]||0,t/2,n/2),o=Math.min(r[1]||0,t/2,n/2),s=Math.min(r[2]||0,t/2,n/2),a=Math.min(r[3]||0,t/2,n/2)),e.moveTo(i,0),e.lineTo(t-o,0),e.arc(t-o,o,o,Math.PI*3/2,0,!1),e.lineTo(t,n-s),e.arc(t-s,n-s,s,0,Math.PI/2,!1),e.lineTo(a,n),e.arc(a,n-a,a,Math.PI/2,Math.PI,!1),e.lineTo(0,i),e.arc(i,i,i,Math.PI,Math.PI*3/2,!1)}};function uf(e){return de._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||de._isBoolean(e)?e:Object.prototype.toString.call(e)}function iV(e){return e>255?255:e<0?0:Math.round(e)}function Ve(){if(ft.isUnminified)return function(e,t){return de._isNumber(e)||de.warn(uf(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function kE(e){if(ft.isUnminified)return function(t,n){let r=de._isNumber(t),i=de._isArray(t)&&t.length==e;return!r&&!i&&de.warn(uf(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}function EE(){if(ft.isUnminified)return function(e,t){var n=de._isNumber(e),r=e==="auto";return n||r||de.warn(uf(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function x0(){if(ft.isUnminified)return function(e,t){return de._isString(e)||de.warn(uf(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function oV(){if(ft.isUnminified)return function(e,t){const n=de._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||de.warn(uf(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function Q5e(){if(ft.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(de._isArray(e)?e.forEach(function(r){de._isNumber(r)||de.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):de.warn(uf(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function el(){if(ft.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||de.warn(uf(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function J5e(e){if(ft.isUnminified)return function(t,n){return t==null||de.isObject(t)||de.warn(uf(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Zv="get",Qv="set";const J={addGetterSetter(e,t,n,r,i){J.addGetter(e,t,n),J.addSetter(e,t,r,i),J.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=Zv+de._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var i=this.attrs[t];return i===void 0?n:i}},addSetter(e,t,n,r){var i=Qv+de._capitalize(t);e.prototype[i]||J.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var i=Qv+de._capitalize(t);e.prototype[i]=function(o){return n&&o!==void 0&&o!==null&&(o=n.call(this,o,t)),this._setAttr(t,o),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,i){var o=n.length,a=de._capitalize,s=Zv+a(t),l=Qv+a(t),u,d;e.prototype[s]=function(){var m={};for(u=0;u{this._setAttr(t+a(w),void 0)}),this._fireChangeEvent(t,y,m),i&&i.call(this),this},J.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=de._capitalize(t),r=Qv+n,i=Zv+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(e,t,n,r){de.error("Adding deprecated "+t);var i=Zv+de._capitalize(t),o=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[i]=function(){de.error(o);var a=this.attrs[t];return a===void 0?n:a},J.addSetter(e,t,r,function(){de.error(o)}),J.addOverloadedGetterSetter(e,t)},backCompat(e,t){de.each(t,function(n,r){var i=e.prototype[r],o=Zv+de._capitalize(n),a=Qv+de._capitalize(n);function s(){i.apply(this,arguments),de.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}e.prototype[n]=s,e.prototype[o]=s,e.prototype[a]=s})},afterSetFilter(){this._filterUpToDate=!1}};function eCe(e){var t=[],n=e.length,r=de,i,o;for(i=0;itypeof d=="number"?Math.floor(d):d)),o+=tCe+u.join(tI)+nCe)):(o+=s.property,t||(o+=sCe+s.val)),o+=oCe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=uCe&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){var n=t.getLineCap();n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){var n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var d=arguments,p=this._context;d.length===3?p.drawImage(t,n,r):d.length===5?p.drawImage(t,n,r,i,o):d.length===9&&p.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(t){t?this._context.fill(t):this._context.fill()}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,a){this._context.setTransform(t,n,r,i,o,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=nI.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=eCe(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){var e;return fn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];fn._dragElements.forEach((n,r)=>{const{node:i}=n,o=i.getStage();o.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=de._getFirstPointerId(e));const a=o._changedPointerPositions.find(u=>u.id===n.pointerId);if(a){if(n.dragStatus!=="dragging"){var s=i.dragDistance(),l=Math.max(Math.abs(a.x-n.startPointerPos.x),Math.abs(a.y-n.startPointerPos.y));if(l{n.fire("dragmove",{type:"dragmove",target:n,evt:e},!0)})},_endDragBefore(e){const t=[];fn._dragElements.forEach(n=>{const{node:r}=n,i=r.getStage();if(e&&i.setPointersPositions(e),!i._changedPointerPositions.find(s=>s.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(fn.justDragged=!0,ft._mouseListenClick=!1,ft._touchListenClick=!1,ft._pointerListenClick=!1,n.dragStatus="stopped");const a=n.node.getLayer()||n.node instanceof ft.Stage&&n.node;a&&t.indexOf(a)===-1&&t.push(a)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){fn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&fn._dragElements.delete(n)})}};ft.isBrowser&&(window.addEventListener("mouseup",fn._endDragBefore,!0),window.addEventListener("touchend",fn._endDragBefore,!0),window.addEventListener("mousemove",fn._drag),window.addEventListener("touchmove",fn._drag),window.addEventListener("mouseup",fn._endDragAfter,!1),window.addEventListener("touchend",fn._endDragAfter,!1));var gS="absoluteOpacity",sx="allEventListeners",Iu="absoluteTransform",rI="absoluteScale",oh="canvas",hCe="Change",pCe="children",gCe="konva",Rk="listening",iI="mouseenter",oI="mouseleave",aI="set",sI="Shape",mS=" ",lI="stage",fd="transform",mCe="Stage",Ik="visible",vCe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(mS);let yCe=1,Ge=class Dk{constructor(t){this._id=yCe++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===fd||t===Iu)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===fd||t===Iu,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(mS);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(oh)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Iu&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(oh)){const{scene:t,filter:n,hit:r}=this._cache.get(oh);de.releaseCanvas(t,n,r),this._cache.delete(oh)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),a=n.pixelRatio,s=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!o){de.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,s-=u,l-=u;var m=new Dm({pixelRatio:a,width:i,height:o}),y=new Dm({pixelRatio:a,width:0,height:0}),b=new PE({pixelRatio:p,width:i,height:o}),w=m.getContext(),E=b.getContext();return b.isCache=!0,m.isCache=!0,this._cache.delete(oh),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),E.save(),w.translate(-s,-l),E.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(gS),this._clearSelfAndDescendantCache(rI),this.drawScene(m,this),this.drawHit(b,this),this._isUnderCache=!1,w.restore(),E.restore(),d&&(w.save(),w.beginPath(),w.rect(0,0,i,o),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),this._cache.set(oh,{scene:m,filter:y,hit:b,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(oh)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var d=l.point(u);i===void 0&&(i=a=d.x,o=s=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),a=Math.max(a,d.x),s=Math.max(s,d.y)}),{x:i,y:o,width:a-i,height:s-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),a,s,l,u;if(t){if(!this._filterUpToDate){var d=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==pCe&&(r=aI+de._capitalize(n),de._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(Rk,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(Ik,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;fn._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!ft.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==mCe&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(fd),this._clearSelfAndDescendantCache(Iu)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new Ca,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(fd);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(fd),this._clearSelfAndDescendantCache(Iu),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,a;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return de.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return de.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&de.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(gS,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,a,s;t.attrs={};for(r in n)i=n[r],s=de.isObject(i)&&!de._isPlainObject(i)&&!de._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),de._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,de._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():ft.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;fn._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=fn._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&fn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return de.haveIntersection(r,this.getClientRect())}static create(t,n){return de._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=Dk.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),ft[r]||(de.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=ft[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Ge.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=Ge.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.hit;if(s){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const d=r===this;if(u){o.save();var p=this.getAbsoluteTransform(r),m=p.getMatrix();if(o.transform(m[0],m[1],m[2],m[3],m[4],m[5]),o.beginPath(),l)l.call(this,o,this);else{var y=this.clipX(),b=this.clipY();o.rect(y,b,a,s)}o.clip(),m=p.copy().invert().getMatrix(),o.transform(m[0],m[1],m[2],m[3],m[4],m[5])}var w=!d&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";w&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(E){E[t](n,r)}),w&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},d=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(w.visible()){var E=w.getClientRect({relativeTo:d,skipShadow:t.skipShadow,skipStroke:t.skipStroke});E.width===0&&E.height===0||(o===void 0?(o=E.x,a=E.y,s=E.x+E.width,l=E.y+E.height):(o=Math.min(o,E.x),a=Math.min(a,E.y),s=Math.max(s,E.x+E.width),l=Math.max(l,E.y+E.height)))}});for(var p=this.find("Shape"),m=!1,y=0;ye.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Og=e=>{const t=x1(e);if(t==="pointer")return ft.pointerEventsEnabled&&UC.pointer;if(t==="touch")return UC.touch;if(t==="mouse")return UC.mouse};function cI(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&de.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const kCe="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",vS=[];let c4=class extends Ma{constructor(t){super(cI(t)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),vS.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{cI(this.attrs)}),this._checkVisibility()}_validateAdd(t){const n=t.getType()==="Layer",r=t.getType()==="FastLayer";n||r||de.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if(typeof t===xCe){if(t.charAt(0)==="."){var n=t.slice(1);t=document.getElementsByClassName(n)[0]}else{var r;t.charAt(0)!=="#"?r=t:r=t.slice(1),t=document.getElementById(r)}if(!t)throw"Can not find container in document with id "+r}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var t=this.children,n=t.length,r;for(r=0;r-1&&vS.splice(n,1),de.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(de.warn(kCe),null)}_getPointerById(t){return this._pointerPositions.find(n=>n.id===t)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){t=t||{},t.x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();var n=new Dm({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),r=n.getContext()._context,i=this.children;return(t.x||t.y)&&r.translate(-1*t.x,-1*t.y),i.forEach(function(o){if(o.isVisible()){var a=o._toKonvaCanvas(t);r.drawImage(a._canvas,t.x,t.y,a.getWidth()/a.getPixelRatio(),a.getHeight()/a.getPixelRatio())}}),n}getIntersection(t){if(!t)return null;var n=this.children,r=n.length,i=r-1,o;for(o=i;o>=0;o--){const a=n[o].getIntersection(t);if(a)return a}return null}_resizeDOM(){var t=this.width(),n=this.height();this.content&&(this.content.style.width=t+uI,this.content.style.height=n+uI),this.bufferCanvas.setSize(t,n),this.bufferHitCanvas.setSize(t,n),this.children.forEach(r=>{r.setSize({width:t,height:n}),r.draw()})}add(t,...n){if(arguments.length>1){for(var r=0;rCCe&&de.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),ft.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return sV(t,this)}setPointerCapture(t){lV(t,this)}releaseCapture(t){G1(t)}getLayers(){return this.children}_bindContentEvents(){ft.isBrowser&&_Ce.forEach(([t,n])=>{this.content.addEventListener(t,r=>{this[n](r)},{passive:!1})})}_pointerenter(t){this.setPointersPositions(t);const n=Og(t.type);this._fire(n.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const n=Og(t.type);this._fire(n.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let n=this[t+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(t){const n=Og(t.type),r=x1(t.type);if(n){this.setPointersPositions(t);var i=this._getTargetShape(r),o=!fn.isDragging||ft.hitOnDragEnabled;i&&o?(i._fireAndBubble(n.pointerout,{evt:t}),i._fireAndBubble(n.pointerleave,{evt:t}),this._fire(n.pointerleave,{evt:t,target:this,currentTarget:this}),this[r+"targetShape"]=null):o&&(this._fire(n.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(t){const n=Og(t.type),r=x1(t.type);if(n){this.setPointersPositions(t);var i=!1;this._changedPointerPositions.forEach(o=>{var a=this.getIntersection(o);if(fn.justDragged=!1,ft["_"+r+"ListenClick"]=!0,!(a&&a.isListening()))return;ft.capturePointerEventsEnabled&&a.setPointerCapture(o.id),this[r+"ClickStartShape"]=a,a._fireAndBubble(n.pointerdown,{evt:t,pointerId:o.id}),i=!0;const l=t.type.indexOf("touch")>=0;a.preventDefault()&&t.cancelable&&l&&t.preventDefault()}),i||this._fire(n.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(t){const n=Og(t.type),r=x1(t.type);if(!n)return;fn.isDragging&&fn.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t);var i=!fn.isDragging||ft.hitOnDragEnabled;if(!i)return;var o={};let a=!1;var s=this._getTargetShape(r);this._changedPointerPositions.forEach(l=>{const u=WC(l.id)||this.getIntersection(l),d=l.id,p={evt:t,pointerId:d};var m=s!==u;if(m&&s&&(s._fireAndBubble(n.pointerout,Object.assign({},p),u),s._fireAndBubble(n.pointerleave,Object.assign({},p),u)),u){if(o[u._id])return;o[u._id]=!0}u&&u.isListening()?(a=!0,m&&(u._fireAndBubble(n.pointerover,Object.assign({},p),s),u._fireAndBubble(n.pointerenter,Object.assign({},p),s),this[r+"targetShape"]=u),u._fireAndBubble(n.pointermove,Object.assign({},p))):s&&(this._fire(n.pointerover,{evt:t,target:this,currentTarget:this,pointerId:d}),this[r+"targetShape"]=null)}),a||this._fire(n.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const n=Og(t.type),r=x1(t.type);if(!n)return;this.setPointersPositions(t);const i=this[r+"ClickStartShape"],o=this[r+"ClickEndShape"];var a={};let s=!1;this._changedPointerPositions.forEach(l=>{const u=WC(l.id)||this.getIntersection(l);if(u){if(u.releaseCapture(l.id),a[u._id])return;a[u._id]=!0}const d=l.id,p={evt:t,pointerId:d};let m=!1;ft["_"+r+"InDblClickWindow"]?(m=!0,clearTimeout(this[r+"DblTimeout"])):fn.justDragged||(ft["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout(function(){ft["_"+r+"InDblClickWindow"]=!1},ft.dblClickWindow),u&&u.isListening()?(s=!0,this[r+"ClickEndShape"]=u,u._fireAndBubble(n.pointerup,Object.assign({},p)),ft["_"+r+"ListenClick"]&&i&&i===u&&(u._fireAndBubble(n.pointerclick,Object.assign({},p)),m&&o&&o===u&&u._fireAndBubble(n.pointerdblclick,Object.assign({},p)))):(this[r+"ClickEndShape"]=null,ft["_"+r+"ListenClick"]&&this._fire(n.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:d}),m&&this._fire(n.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:d}))}),s||this._fire(n.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),ft["_"+r+"ListenClick"]=!1,t.cancelable&&r!=="touch"&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(jk,{evt:t}):this._fire(jk,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(Nk,{evt:t}):this._fire(Nk,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const n=WC(t.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(lm,TE(t)),G1(t.pointerId)}_lostpointercapture(t){G1(t.pointerId)}setPointersPositions(t){var n=this._getContentPosition(),r=null,i=null;t=t||window.event,t.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,o=>{this._pointerPositions.push({id:o.identifier,x:(o.clientX-n.left)/n.scaleX,y:(o.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(t.changedTouches||t.touches,o=>{this._changedPointerPositions.push({id:o.identifier,x:(o.clientX-n.left)/n.scaleX,y:(o.clientY-n.top)/n.scaleY})})):(r=(t.clientX-n.left)/n.scaleX,i=(t.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:de._getFirstPointerId(t)}],this._changedPointerPositions=[{x:r,y:i,id:de._getFirstPointerId(t)}])}_setPointerPosition(t){de.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Dm({width:this.width(),height:this.height()}),this.bufferHitCanvas=new PE({pixelRatio:1,width:this.width(),height:this.height()}),!!ft.isBrowser){var t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}}cache(){return de.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(t){t.batchDraw()}),this}};c4.prototype.nodeType=bCe;Mr(c4);J.addGetterSetter(c4,"container");var bV="hasShadow",xV="shadowRGBA",SV="patternImage",wV="linearGradient",CV="radialGradient";let fx;function VC(){return fx||(fx=de.createCanvasElement().getContext("2d"),fx)}const q1={};function ECe(e){e.fill()}function PCe(e){e.stroke()}function TCe(e){e.fill()}function MCe(e){e.stroke()}function LCe(){this._clearCache(bV)}function ACe(){this._clearCache(xV)}function OCe(){this._clearCache(SV)}function RCe(){this._clearCache(wV)}function ICe(){this._clearCache(CV)}class $e extends Ge{constructor(t){super(t);let n;for(;n=de.getRandomColor(),!(n&&!(n in q1)););this.colorKey=n,q1[n]=this}getContext(){return de.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return de.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(bV,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(SV,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var t=VC();const n=t.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const r=new Ca;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(ft.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),o=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(o)}return n}}_getLinearGradient(){return this._getCache(wV,this.__getLinearGradient)}__getLinearGradient(){var t=this.fillLinearGradientColorStops();if(t){for(var n=VC(),r=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),o=n.createLinearGradient(r.x,r.y,i.x,i.y),a=0;athis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return t==="auto"?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){var n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data,i[3]>0}destroy(){return Ge.prototype.destroy.call(this),delete q1[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=t||this.hasFill(),o=this.hasStroke(),a=this.getAbsoluteOpacity()!==1;if(i&&o&&a)return!0;const s=this.hasShadow(),l=this.shadowForStrokeEnabled();return!!(i&&o&&s&&l)}setStrokeHitEnabled(t){de.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){const n=t.skipTransform,r=t.relativeTo,i=this.getSelfRect(),a=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=i.width+a,l=i.height+a,u=!t.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,p=u?this.shadowOffsetY():0,m=s+Math.abs(d),y=l+Math.abs(p),b=u&&this.shadowBlur()||0,w=m+b*2,E=y+b*2,_={width:w,height:E,x:-(a/2+b)+Math.min(d,0)+i.x,y:-(a/2+b)+Math.min(p,0)+i.y};return n?_:this._transformedRect(_,r)}drawScene(t,n){var r=this.getLayer(),i=t||r.getCanvas(),o=i.getContext(),a=this._getCanvasCache(),s=this.getSceneFunc(),l=this.hasShadow(),u,d,p,m=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(a){o.save();var b=this.getAbsoluteTransform(n).getMatrix();return o.transform(b[0],b[1],b[2],b[3],b[4],b[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()&&!m){u=this.getStage(),d=u.bufferCanvas,p=d.getContext(),p.clear(),p.save(),p._applyLineJoin(this);var w=this.getAbsoluteTransform(n).getMatrix();p.transform(w[0],w[1],w[2],w[3],w[4],w[5]),s.call(this,p,this),p.restore();var E=d.pixelRatio;l&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(d._canvas,0,0,d.width/E,d.height/E)}else{if(o._applyLineJoin(this),!y){var w=this.getAbsoluteTransform(n).getMatrix();o.transform(w[0],w[1],w[2],w[3],w[4],w[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}l&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(t,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),o=t||i.hitCanvas,a=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),u=l&&l.hit;if(this.colorKey||de.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),u){a.save();var d=this.getAbsoluteTransform(n).getMatrix();return a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!s)return this;if(a.save(),a._applyLineJoin(this),!(this===n)){var m=this.getAbsoluteTransform(n).getMatrix();a.transform(m[0],m[1],m[2],m[3],m[4],m[5])}return s.call(this,a,this),a.restore(),this}drawHitFromCache(t=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,o=i.getContext(),a=i.getWidth(),s=i.getHeight(),l,u,d,p,m,y;o.clear(),o.drawImage(r._canvas,0,0,a,s);try{for(l=o.getImageData(0,0,a,s),u=l.data,d=u.length,p=de._hexToRgb(this.colorKey),m=0;mt?(u[m]=p.r,u[m+1]=p.g,u[m+2]=p.b,u[m+3]=255):u[m+3]=0;o.putImageData(l,0,0)}catch(b){de.error("Unable to draw hit graph from cached scene canvas. "+b.message)}return this}hasPointerCapture(t){return sV(t,this)}setPointerCapture(t){lV(t,this)}releaseCapture(t){G1(t)}}$e.prototype._fillFunc=ECe;$e.prototype._strokeFunc=PCe;$e.prototype._fillFuncHit=TCe;$e.prototype._strokeFuncHit=MCe;$e.prototype._centroid=!1;$e.prototype.nodeType="Shape";Mr($e);$e.prototype.eventListeners={};$e.prototype.on.call($e.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",LCe);$e.prototype.on.call($e.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",ACe);$e.prototype.on.call($e.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",OCe);$e.prototype.on.call($e.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",RCe);$e.prototype.on.call($e.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",ICe);J.addGetterSetter($e,"stroke",void 0,oV());J.addGetterSetter($e,"strokeWidth",2,Ve());J.addGetterSetter($e,"fillAfterStrokeEnabled",!1);J.addGetterSetter($e,"hitStrokeWidth","auto",EE());J.addGetterSetter($e,"strokeHitEnabled",!0,el());J.addGetterSetter($e,"perfectDrawEnabled",!0,el());J.addGetterSetter($e,"shadowForStrokeEnabled",!0,el());J.addGetterSetter($e,"lineJoin");J.addGetterSetter($e,"lineCap");J.addGetterSetter($e,"sceneFunc");J.addGetterSetter($e,"hitFunc");J.addGetterSetter($e,"dash");J.addGetterSetter($e,"dashOffset",0,Ve());J.addGetterSetter($e,"shadowColor",void 0,x0());J.addGetterSetter($e,"shadowBlur",0,Ve());J.addGetterSetter($e,"shadowOpacity",1,Ve());J.addComponentsGetterSetter($e,"shadowOffset",["x","y"]);J.addGetterSetter($e,"shadowOffsetX",0,Ve());J.addGetterSetter($e,"shadowOffsetY",0,Ve());J.addGetterSetter($e,"fillPatternImage");J.addGetterSetter($e,"fill",void 0,oV());J.addGetterSetter($e,"fillPatternX",0,Ve());J.addGetterSetter($e,"fillPatternY",0,Ve());J.addGetterSetter($e,"fillLinearGradientColorStops");J.addGetterSetter($e,"strokeLinearGradientColorStops");J.addGetterSetter($e,"fillRadialGradientStartRadius",0);J.addGetterSetter($e,"fillRadialGradientEndRadius",0);J.addGetterSetter($e,"fillRadialGradientColorStops");J.addGetterSetter($e,"fillPatternRepeat","repeat");J.addGetterSetter($e,"fillEnabled",!0);J.addGetterSetter($e,"strokeEnabled",!0);J.addGetterSetter($e,"shadowEnabled",!0);J.addGetterSetter($e,"dashEnabled",!0);J.addGetterSetter($e,"strokeScaleEnabled",!0);J.addGetterSetter($e,"fillPriority","color");J.addComponentsGetterSetter($e,"fillPatternOffset",["x","y"]);J.addGetterSetter($e,"fillPatternOffsetX",0,Ve());J.addGetterSetter($e,"fillPatternOffsetY",0,Ve());J.addComponentsGetterSetter($e,"fillPatternScale",["x","y"]);J.addGetterSetter($e,"fillPatternScaleX",1,Ve());J.addGetterSetter($e,"fillPatternScaleY",1,Ve());J.addComponentsGetterSetter($e,"fillLinearGradientStartPoint",["x","y"]);J.addComponentsGetterSetter($e,"strokeLinearGradientStartPoint",["x","y"]);J.addGetterSetter($e,"fillLinearGradientStartPointX",0);J.addGetterSetter($e,"strokeLinearGradientStartPointX",0);J.addGetterSetter($e,"fillLinearGradientStartPointY",0);J.addGetterSetter($e,"strokeLinearGradientStartPointY",0);J.addComponentsGetterSetter($e,"fillLinearGradientEndPoint",["x","y"]);J.addComponentsGetterSetter($e,"strokeLinearGradientEndPoint",["x","y"]);J.addGetterSetter($e,"fillLinearGradientEndPointX",0);J.addGetterSetter($e,"strokeLinearGradientEndPointX",0);J.addGetterSetter($e,"fillLinearGradientEndPointY",0);J.addGetterSetter($e,"strokeLinearGradientEndPointY",0);J.addComponentsGetterSetter($e,"fillRadialGradientStartPoint",["x","y"]);J.addGetterSetter($e,"fillRadialGradientStartPointX",0);J.addGetterSetter($e,"fillRadialGradientStartPointY",0);J.addComponentsGetterSetter($e,"fillRadialGradientEndPoint",["x","y"]);J.addGetterSetter($e,"fillRadialGradientEndPointX",0);J.addGetterSetter($e,"fillRadialGradientEndPointY",0);J.addGetterSetter($e,"fillPatternRotation",0);J.backCompat($e,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var DCe="#",jCe="beforeDraw",NCe="draw",_V=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],$Ce=_V.length;let sp=class extends Ma{constructor(t){super(t),this.canvas=new Dm,this.hitCanvas=new PE({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i<$Ce;i++){const o=_V[i],a=this._getIntersection({x:t.x+o.x*n,y:t.y+o.y*n}),s=a.shape;if(s)return s;if(r=!!a.antialiased,!a.antialiased)break}if(r)n+=1;else return null}}_getIntersection(t){const n=this.hitCanvas.pixelRatio,r=this.hitCanvas.context.getImageData(Math.round(t.x*n),Math.round(t.y*n),1,1).data,i=r[3];if(i===255){const o=de._rgbToHex(r[0],r[1],r[2]),a=q1[DCe+o];return a?{shape:a}:{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(jCe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Ma.prototype.drawScene.call(this,i,n),this._fire(NCe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Ma.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){de.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return de.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return de.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};sp.prototype.nodeType="Layer";Mr(sp);J.addGetterSetter(sp,"imageSmoothingEnabled",!0);J.addGetterSetter(sp,"clearBeforeDraw",!0);J.addGetterSetter(sp,"hitGraphEnabled",!0,el());class ME extends sp{constructor(t){super(t),this.listening(!1),de.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}ME.prototype.nodeType="FastLayer";Mr(ME);let Jm=class extends Ma{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&de.throw("You may only add groups and shapes to groups.")}};Jm.prototype.nodeType="Group";Mr(Jm);var GC=function(){return Im.performance&&Im.performance.now?function(){return Im.performance.now()}:function(){return new Date().getTime()}}();class Ja{constructor(t,n){this.id=Ja.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:GC(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return t===void 0&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=dI,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=fI,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var t=this.getTimer()-this._startTime;this.state===dI?this.setTime(t):this.state===fI&&this.setTime(this.duration-t)}pause(){this.state=BCe,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Xr{constructor(t){var n=this,r=t.node,i=r._id,o,a=t.easing||K1.Linear,s=!!t.yoyo,l;typeof t.duration>"u"?o=.3:t.duration===0?o=.001:o=t.duration,this.node=r,this._id=zCe++;var u=r.getLayer()||(r instanceof ft.Stage?r.getLayers():null);u||de.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Ja(function(){n.tween.onEnterFrame()},u),this.tween=new HCe(l,function(d){n._tweenFunc(d)},a,0,1,o*1e3,s),this._addListeners(),Xr.attrs[i]||(Xr.attrs[i]={}),Xr.attrs[i][this._id]||(Xr.attrs[i][this._id]={}),Xr.tweens[i]||(Xr.tweens[i]={});for(l in t)FCe[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){var r=this.node,i=r._id,o,a,s,l,u,d,p,m;if(s=Xr.tweens[i][t],s&&delete Xr.attrs[i][s][t],o=r.getAttr(t),de._isArray(n))if(a=[],u=Math.max(n.length,o.length),t==="points"&&n.length!==o.length&&(n.length>o.length?(p=o,o=de._prepareArrayForTween(o,n,r.closed())):(d=n,n=de._prepareArrayForTween(n,o,r.closed()))),t.indexOf("fill")===0)for(l=0;l{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var t=this.node,n=Xr.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var t=this.node,n=Xr.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var t=this.node._id,n=this._id,r=Xr.tweens[t],i;this.pause();for(i in r)delete Xr.tweens[t][i];delete Xr.attrs[t][n]}}Xr.attrs={};Xr.tweens={};Ge.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()};var n=new Xr(e);n.play()};const K1={BackEaseIn(e,t,n,r){var i=1.70158;return n*(e/=r)*e*((i+1)*e-i)+t},BackEaseOut(e,t,n,r){var i=1.70158;return n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},BackEaseInOut(e,t,n,r){var i=1.70158;return(e/=r/2)<1?n/2*(e*e*(((i*=1.525)+1)*e-i))+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,o){var a=0;return e===0?t:(e/=r)===1?t+n:(o||(o=r*.3),!i||i0?t:n),d=a*n,p=s*(s>0?t:n),m=l*(l>0?n:t);return{x:u,y:r?-1*m:p,width:d-u,height:m-p}}}hc.prototype._centroid=!0;hc.prototype.className="Arc";hc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Mr(hc);J.addGetterSetter(hc,"innerRadius",0,Ve());J.addGetterSetter(hc,"outerRadius",0,Ve());J.addGetterSetter(hc,"angle",0,Ve());J.addGetterSetter(hc,"clockwise",!1,el());function $k(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=a*s/(s+l),d=a*l/(s+l),p=n-u*(i-e),m=r-u*(o-t),y=n+d*(i-e),b=r+d*(o-t);return[p,m,y,b]}function pI(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);ud?u:d,E=u>d?1:u/d,_=u>d?d/u:1;t.translate(s,l),t.rotate(y),t.scale(E,_),t.arc(0,0,w,p,p+m,1-b),t.scale(1/E,1/_),t.rotate(-y),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var d=u.points[4],p=u.points[5],m=u.points[4]+p,y=Math.PI/180;if(Math.abs(d-m)m;b-=y){const w=Fn.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],b,0);t.push(w.x,w.y)}else for(let b=d+y;bthis.dataArray[r].pathLength;)t-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(t<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var o=this.dataArray[r],a=o.points;switch(o.command){case"L":return Fn.getPointOnLine(t,o.start.x,o.start.y,a[0],a[1]);case"C":return Fn.getPointOnCubicBezier(t/o.pathLength,o.start.x,o.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return Fn.getPointOnQuadraticBezier(t/o.pathLength,o.start.x,o.start.y,a[0],a[1],a[2],a[3]);case"A":var s=a[0],l=a[1],u=a[2],d=a[3],p=a[4],m=a[5],y=a[6];return p+=m*t/o.pathLength,Fn.getPointOnEllipticalArc(s,l,u,d,p,y)}return null}static getLineLength(t,n,r,i){return Math.sqrt((r-t)*(r-t)+(i-n)*(i-n))}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(b[0]);){var k=null,T=[],L=l,O=u,D,I,N,W,B,K,ne,z,$,V;switch(y){case"l":l+=b.shift(),u+=b.shift(),k="L",T.push(l,u);break;case"L":l=b.shift(),u=b.shift(),T.push(l,u);break;case"m":var X=b.shift(),Q=b.shift();if(l+=X,u+=Q,k="M",a.length>2&&a[a.length-1].command==="z"){for(var G=a.length-2;G>=0;G--)if(a[G].command==="M"){l=a[G].points[0]+X,u=a[G].points[1]+Q;break}}T.push(l,u),y="l";break;case"M":l=b.shift(),u=b.shift(),k="M",T.push(l,u),y="L";break;case"h":l+=b.shift(),k="L",T.push(l,u);break;case"H":l=b.shift(),k="L",T.push(l,u);break;case"v":u+=b.shift(),k="L",T.push(l,u);break;case"V":u=b.shift(),k="L",T.push(l,u);break;case"C":T.push(b.shift(),b.shift(),b.shift(),b.shift()),l=b.shift(),u=b.shift(),T.push(l,u);break;case"c":T.push(l+b.shift(),u+b.shift(),l+b.shift(),u+b.shift()),l+=b.shift(),u+=b.shift(),k="C",T.push(l,u);break;case"S":I=l,N=u,D=a[a.length-1],D.command==="C"&&(I=l+(l-D.points[2]),N=u+(u-D.points[3])),T.push(I,N,b.shift(),b.shift()),l=b.shift(),u=b.shift(),k="C",T.push(l,u);break;case"s":I=l,N=u,D=a[a.length-1],D.command==="C"&&(I=l+(l-D.points[2]),N=u+(u-D.points[3])),T.push(I,N,l+b.shift(),u+b.shift()),l+=b.shift(),u+=b.shift(),k="C",T.push(l,u);break;case"Q":T.push(b.shift(),b.shift()),l=b.shift(),u=b.shift(),T.push(l,u);break;case"q":T.push(l+b.shift(),u+b.shift()),l+=b.shift(),u+=b.shift(),k="Q",T.push(l,u);break;case"T":I=l,N=u,D=a[a.length-1],D.command==="Q"&&(I=l+(l-D.points[0]),N=u+(u-D.points[1])),l=b.shift(),u=b.shift(),k="Q",T.push(I,N,l,u);break;case"t":I=l,N=u,D=a[a.length-1],D.command==="Q"&&(I=l+(l-D.points[0]),N=u+(u-D.points[1])),l+=b.shift(),u+=b.shift(),k="Q",T.push(I,N,l,u);break;case"A":W=b.shift(),B=b.shift(),K=b.shift(),ne=b.shift(),z=b.shift(),$=l,V=u,l=b.shift(),u=b.shift(),k="A",T=this.convertEndpointToCenterParameterization($,V,l,u,ne,z,W,B,K);break;case"a":W=b.shift(),B=b.shift(),K=b.shift(),ne=b.shift(),z=b.shift(),$=l,V=u,l+=b.shift(),u+=b.shift(),k="A",T=this.convertEndpointToCenterParameterization($,V,l,u,ne,z,W,B,K);break}a.push({command:k||y,points:T,start:{x:L,y:O},pathLength:this.calcLength(L,O,k||y,T)})}(y==="z"||y==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=Fn;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":for(o=0,a=u.getPointOnCubicBezier(0,t,n,i[0],i[1],i[2],i[3],i[4],i[5]),l=.01;l<=1;l+=.01)s=u.getPointOnCubicBezier(l,t,n,i[0],i[1],i[2],i[3],i[4],i[5]),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;return o;case"Q":for(o=0,a=u.getPointOnQuadraticBezier(0,t,n,i[0],i[1],i[2],i[3]),l=.01;l<=1;l+=.01)s=u.getPointOnQuadraticBezier(l,t,n,i[0],i[1],i[2],i[3]),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;return o;case"A":o=0;var d=i[4],p=i[5],m=i[4]+p,y=Math.PI/180;if(Math.abs(d-m)m;l-=y)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=d+y;l1&&(s*=Math.sqrt(y),l*=Math.sqrt(y));var b=Math.sqrt((s*s*(l*l)-s*s*(m*m)-l*l*(p*p))/(s*s*(m*m)+l*l*(p*p)));o===a&&(b*=-1),isNaN(b)&&(b=0);var w=b*s*m/l,E=b*-l*p/s,_=(t+r)/2+Math.cos(d)*w-Math.sin(d)*E,k=(n+i)/2+Math.sin(d)*w+Math.cos(d)*E,T=function(B){return Math.sqrt(B[0]*B[0]+B[1]*B[1])},L=function(B,K){return(B[0]*K[0]+B[1]*K[1])/(T(B)*T(K))},O=function(B,K){return(B[0]*K[1]=1&&(W=0),a===0&&W>0&&(W=W-2*Math.PI),a===1&&W<0&&(W=W+2*Math.PI),[_,k,s,l,D,W,d,a]}}Fn.prototype.className="Path";Fn.prototype._attrsAffectingSize=["data"];Mr(Fn);J.addGetterSetter(Fn,"data");class lp extends pc{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,u;if(o){const m=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],y=Fn.calcLength(i[i.length-4],i[i.length-3],"C",m),b=Fn.getPointOnQuadraticBezier(Math.min(1,1-a/y),m[0],m[1],m[2],m[3],m[4],m[5]);l=r[s-2]-b.x,u=r[s-1]-b.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var d=(Math.atan2(u,l)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(d),t.moveTo(0,0),t.lineTo(-a,p/2),t.lineTo(-a,-p/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,p/2),t.lineTo(-a,-p/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}lp.prototype.className="Arrow";Mr(lp);J.addGetterSetter(lp,"pointerLength",10,Ve());J.addGetterSetter(lp,"pointerWidth",10,Ve());J.addGetterSetter(lp,"pointerAtBeginning",!1);J.addGetterSetter(lp,"pointerAtEnding",!0);let S0=class extends $e{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};S0.prototype._centroid=!0;S0.prototype.className="Circle";S0.prototype._attrsAffectingSize=["radius"];Mr(S0);J.addGetterSetter(S0,"radius",0,Ve());class cf extends $e{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}cf.prototype.className="Ellipse";cf.prototype._centroid=!0;cf.prototype._attrsAffectingSize=["radiusX","radiusY"];Mr(cf);J.addComponentsGetterSetter(cf,"radius",["x","y"]);J.addGetterSetter(cf,"radiusX",0,Ve());J.addGetterSetter(cf,"radiusY",0,Ve());let uu=class kV extends $e{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?de.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?de.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=de.createImageElement();i.onload=function(){var o=new kV({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};uu.prototype.className="Image";Mr(uu);J.addGetterSetter(uu,"cornerRadius",0,kE(4));J.addGetterSetter(uu,"image");J.addComponentsGetterSetter(uu,"crop",["x","y","width","height"]);J.addGetterSetter(uu,"cropX",0,Ve());J.addGetterSetter(uu,"cropY",0,Ve());J.addGetterSetter(uu,"cropWidth",0,Ve());J.addGetterSetter(uu,"cropHeight",0,Ve());var EV=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],WCe="Change.konva",UCe="none",Fk="up",Bk="right",zk="down",Hk="left",VCe=EV.length;class LE extends Jm{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}cp.prototype.className="RegularPolygon";cp.prototype._centroid=!0;cp.prototype._attrsAffectingSize=["radius"];Mr(cp);J.addGetterSetter(cp,"radius",0,Ve());J.addGetterSetter(cp,"sides",0,Ve());var gI=Math.PI*2;class dp extends $e{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,gI,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),gI,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}dp.prototype.className="Ring";dp.prototype._centroid=!0;dp.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Mr(dp);J.addGetterSetter(dp,"innerRadius",0,Ve());J.addGetterSetter(dp,"outerRadius",0,Ve());class cu extends $e{constructor(t){super(t),this._updated=!0,this.anim=new Ja(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],d=o[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,d),t.closePath(),t.fillStrokeShape(this)),p)if(a){var m=a[n],y=r*2;t.drawImage(p,s,l,u,d,m[y+0],m[y+1],u,d)}else t.drawImage(p,s,l,u,d,0,0,u,d)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],d=r*2;t.rect(u[d+0],u[d+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var px;function KC(){return px||(px=de.createCanvasElement().getContext(KCe),px)}function o6e(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function a6e(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function s6e(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class Tr extends $e{constructor(t){super(s6e(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=de._isString(t)?t:t==null?"":t+"";return this._setAttr(YCe,n),this}getWidth(){var t=this.attrs.width===Rg||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Rg||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return de.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=KC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+hx+this.fontVariant()+hx+(this.fontSize()+JCe)+i6e(this.fontFamily())}_addTextLine(t){this.align()===Jv&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return KC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==Rg&&o!==void 0,l=a!==Rg&&a!==void 0,u=this.padding(),d=o-u*2,p=a-u*2,m=0,y=this.wrap(),b=y!==yI,w=y!==n6e&&b,E=this.ellipsis();this.textArr=[],KC().font=this._getContextFont();for(var _=E?this._getTextWidth(qC):0,k=0,T=t.length;kd)for(;L.length>0;){for(var D=0,I=L.length,N="",W=0;D>>1,K=L.slice(0,B+1),ne=this._getTextWidth(K)+_;ne<=d?(D=B+1,N=K,W=ne):I=B}if(N){if(w){var z,$=L[N.length],V=$===hx||$===mI;V&&W<=d?z=N.length:z=Math.max(N.lastIndexOf(hx),N.lastIndexOf(mI))+1,z>0&&(D=z,N=N.slice(0,D),W=this._getTextWidth(N))}N=N.trimRight(),this._addTextLine(N),r=Math.max(r,W),m+=i;var X=this._shouldHandleEllipsis(m);if(X){this._tryToAddEllipsisToLastLine();break}if(L=L.slice(D),L=L.trimLeft(),L.length>0&&(O=this._getTextWidth(L),O<=d)){this._addTextLine(L),m+=i,r=Math.max(r,O);break}}else break}else this._addTextLine(L),m+=i,r=Math.max(r,O),this._shouldHandleEllipsis(m)&&kp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Rg&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==yI;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Rg&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+qC)=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;i0&&(s+=t.dataArray[l].pathLength);var u=0;i==="center"&&(u=Math.max(0,s/2-a/2)),i==="right"&&(u=Math.max(0,s-a));for(var d=PV(this.text()),p=this.text().split(" ").length-1,m,y,b,w=-1,E=0,_=function(){E=0;for(var ne=t.dataArray,z=w+1;z0)return w=z,ne[z];ne[z].command==="M"&&(m={x:ne[z].points[0],y:ne[z].points[1]})}return{}},k=function(ne){var z=t._getTextSize(ne).width+r;ne===" "&&i==="justify"&&(z+=(s-a)/p);var $=0,V=0;for(y=void 0;Math.abs(z-$)/z>.01&&V<20;){V++;for(var X=$;b===void 0;)b=_(),b&&X+b.pathLengthz?y=Fn.getPointOnLine(z,m.x,m.y,b.points[0],b.points[1],m.x,m.y):b=void 0;break;case"A":var G=b.points[4],Y=b.points[5],ee=b.points[4]+Y;E===0?E=G+1e-8:z>$?E+=Math.PI/180*Y/Math.abs(Y):E-=Math.PI/360*Y/Math.abs(Y),(Y<0&&E=0&&E>ee)&&(E=ee,Q=!0),y=Fn.getPointOnEllipticalArc(b.points[0],b.points[1],b.points[2],b.points[3],E,b.points[6]);break;case"C":E===0?z>b.pathLength?E=1e-8:E=z/b.pathLength:z>$?E+=(z-$)/b.pathLength/2:E=Math.max(E-($-z)/b.pathLength/2,0),E>1&&(E=1,Q=!0),y=Fn.getPointOnCubicBezier(E,b.start.x,b.start.y,b.points[0],b.points[1],b.points[2],b.points[3],b.points[4],b.points[5]);break;case"Q":E===0?E=z/b.pathLength:z>$?E+=(z-$)/b.pathLength:E-=($-z)/b.pathLength,E>1&&(E=1,Q=!0),y=Fn.getPointOnQuadraticBezier(E,b.start.x,b.start.y,b.points[0],b.points[1],b.points[2],b.points[3]);break}y!==void 0&&($=Fn.getLineLength(m.x,m.y,y.x,y.y)),Q&&(Q=!1,b=void 0)}},T="C",L=t._getTextSize(T).width+r,O=u/L-1,D=0;De+`.${IV}`).join(" "),bI="nodesRect",c6e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],d6e={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const f6e="ontouchstart"in ft._global;function h6e(e,t){if(e==="rotater")return"crosshair";t+=de.degToRad(d6e[e]||0);var n=(de.radToDeg(t)%360+360)%360;return de._inRange(n,315+22.5,360)||de._inRange(n,0,22.5)?"ns-resize":de._inRange(n,45-22.5,45+22.5)?"nesw-resize":de._inRange(n,90-22.5,90+22.5)?"ew-resize":de._inRange(n,135-22.5,135+22.5)?"nwse-resize":de._inRange(n,180-22.5,180+22.5)?"ns-resize":de._inRange(n,225-22.5,225+22.5)?"nesw-resize":de._inRange(n,270-22.5,270+22.5)?"ew-resize":de._inRange(n,315-22.5,315+22.5)?"nwse-resize":(de.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var L3=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],xI=1e8;function p6e(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function DV(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function g6e(e,t){const n=p6e(e);return DV(e,t,n)}function m6e(e,t,n){let r=t;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},o=r._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");r.on(o,i),r.on(c6e.map(a=>a+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(bI),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(bI,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(ft.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),d={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return DV(d,-ft.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-xI,y:-xI,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const d=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:d.x,y:d.y},{x:d.x+d.width,y:d.y},{x:d.x+d.width,y:d.y+d.height},{x:d.x,y:d.y+d.height}],m=u.getAbsoluteTransform();p.forEach(function(y){var b=m.point(y);n.push(b)})});const r=new Ca;r.rotate(-ft.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var d=r.point(u);i===void 0&&(i=a=d.x,o=s=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),a=Math.max(a,d.x),s=Math.max(s,d.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:ft.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),L3.forEach(function(t){this._createAnchor(t)}.bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new m2({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:f6e?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=ft.getAngle(this.rotation()),o=h6e(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new $e({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*de._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const d=o.getAbsolutePosition();if(!(u.x===d.x&&u.y===d.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=o.x()-p.width/2,r=-o.y()+p.height/2;let ne=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ne-=Math.PI);var m=ft.getAngle(this.rotation());const z=m+ne,$=ft.getAngle(this.rotationSnapTolerance()),X=m6e(this.rotationSnaps(),z,$)-p.rotation,Q=g6e(p,X);this._fitNodesInto(Q,t);return}var y=this.keepRatio()||t.shiftKey,k=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(y){var b=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(b.x-o.x(),2)+Math.pow(b.y-o.y(),2));var w=this.findOne(".top-left").x()>b.x?-1:1,E=this.findOne(".top-left").y()>b.y?-1:1;n=i*this.cos*w,r=i*this.sin*E,this.findOne(".top-left").x(b.x-n),this.findOne(".top-left").y(b.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(y){var b=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-b.x,2)+Math.pow(b.y-o.y(),2));var w=this.findOne(".top-right").x()b.y?-1:1;n=i*this.cos*w,r=i*this.sin*E,this.findOne(".top-right").x(b.x+n),this.findOne(".top-right").y(b.y-r)}var _=o.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(y){var b=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(b.x-o.x(),2)+Math.pow(o.y()-b.y,2));var w=b.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(de._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(de._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Ca;if(a.rotate(ft.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=a.point({x:-this.padding()*2,y:0});if(t.x+=p.x,t.y+=p.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=a.point({x:0,y:-this.padding()*2});if(t.x+=p.x,t.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,t);p?t=p:de.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Ca;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Ca;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const d=u.multiply(l.invert());this._nodes.forEach(p=>{var m;const y=p.getParent().getAbsoluteTransform(),b=p.getTransform().copy();b.translate(p.offsetX(),p.offsetY());const w=new Ca;w.multiply(y.copy().invert()).multiply(d).multiply(y).multiply(b);const E=w.decompose();p.setAttrs(E),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(m=p.getLayer())===null||m===void 0||m.batchDraw()}),this.rotation(de._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(de._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();this.find("._anchor").forEach(u=>{u.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*de._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Jm.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Ge.prototype.toObject.call(this)}clone(t){var n=Ge.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};function v6e(e){return e instanceof Array||de.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){L3.indexOf(t)===-1&&de.warn("Unknown anchor name: "+t+". Available names are: "+L3.join(", "))}),e||[]}Tn.prototype.className="Transformer";Mr(Tn);J.addGetterSetter(Tn,"enabledAnchors",L3,v6e);J.addGetterSetter(Tn,"flipEnabled",!0,el());J.addGetterSetter(Tn,"resizeEnabled",!0);J.addGetterSetter(Tn,"anchorSize",10,Ve());J.addGetterSetter(Tn,"rotateEnabled",!0);J.addGetterSetter(Tn,"rotationSnaps",[]);J.addGetterSetter(Tn,"rotateAnchorOffset",50,Ve());J.addGetterSetter(Tn,"rotationSnapTolerance",5,Ve());J.addGetterSetter(Tn,"borderEnabled",!0);J.addGetterSetter(Tn,"anchorStroke","rgb(0, 161, 255)");J.addGetterSetter(Tn,"anchorStrokeWidth",1,Ve());J.addGetterSetter(Tn,"anchorFill","white");J.addGetterSetter(Tn,"anchorCornerRadius",0,Ve());J.addGetterSetter(Tn,"borderStroke","rgb(0, 161, 255)");J.addGetterSetter(Tn,"borderStrokeWidth",1,Ve());J.addGetterSetter(Tn,"borderDash");J.addGetterSetter(Tn,"keepRatio",!0);J.addGetterSetter(Tn,"centeredScaling",!1);J.addGetterSetter(Tn,"ignoreStroke",!1);J.addGetterSetter(Tn,"padding",0,Ve());J.addGetterSetter(Tn,"node");J.addGetterSetter(Tn,"nodes");J.addGetterSetter(Tn,"boundBoxFunc");J.addGetterSetter(Tn,"anchorDragBoundFunc");J.addGetterSetter(Tn,"shouldOverdrawWholeArea",!1);J.addGetterSetter(Tn,"useSingleNodeRotation",!0);J.backCompat(Tn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class gc extends $e{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,ft.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}gc.prototype.className="Wedge";gc.prototype._centroid=!0;gc.prototype._attrsAffectingSize=["radius"];Mr(gc);J.addGetterSetter(gc,"radius",0,Ve());J.addGetterSetter(gc,"angle",0,Ve());J.addGetterSetter(gc,"clockwise",!1);J.backCompat(gc,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function SI(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var y6e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],b6e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function x6e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,d,p,m,y,b,w,E,_,k,T,L,O,D,I,N,W,B,K,ne,z=t+t+1,$=r-1,V=i-1,X=t+1,Q=X*(X+1)/2,G=new SI,Y=null,ee=G,fe=null,_e=null,we=y6e[t],xe=b6e[t];for(s=1;s>xe,K!==0?(K=255/K,n[d]=(m*we>>xe)*K,n[d+1]=(y*we>>xe)*K,n[d+2]=(b*we>>xe)*K):n[d]=n[d+1]=n[d+2]=0,m-=E,y-=_,b-=k,w-=T,E-=fe.r,_-=fe.g,k-=fe.b,T-=fe.a,l=p+((l=o+t+1)<$?l:$)<<2,L+=fe.r=n[l],O+=fe.g=n[l+1],D+=fe.b=n[l+2],I+=fe.a=n[l+3],m+=L,y+=O,b+=D,w+=I,fe=fe.next,E+=N=_e.r,_+=W=_e.g,k+=B=_e.b,T+=K=_e.a,L-=N,O-=W,D-=B,I-=K,_e=_e.next,d+=4;p+=r}for(o=0;o>xe,K>0?(K=255/K,n[l]=(m*we>>xe)*K,n[l+1]=(y*we>>xe)*K,n[l+2]=(b*we>>xe)*K):n[l]=n[l+1]=n[l+2]=0,m-=E,y-=_,b-=k,w-=T,E-=fe.r,_-=fe.g,k-=fe.b,T-=fe.a,l=o+((l=a+X)0&&x6e(t,n)};J.addGetterSetter(Ge,"blurRadius",0,Ve(),J.afterSetFilter);const w6e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};J.addGetterSetter(Ge,"contrast",0,Ve(),J.afterSetFilter);const _6e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,d=l*4,p=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:de.error("Unknown emboss direction: "+r)}do{var m=(p-1)*d,y=o;p+y<1&&(y=0),p+y>u&&(y=0);var b=(p-1+y)*l*4,w=l;do{var E=m+(w-1)*4,_=a;w+_<1&&(_=0),w+_>l&&(_=0);var k=b+(w-1+_)*4,T=s[E]-s[k],L=s[E+1]-s[k+1],O=s[E+2]-s[k+2],D=T,I=D>0?D:-D,N=L>0?L:-L,W=O>0?O:-O;if(N>I&&(D=L),W>I&&(D=O),D*=t,i){var B=s[E]+D,K=s[E+1]+D,ne=s[E+2]+D;s[E]=B>255?255:B<0?0:B,s[E+1]=K>255?255:K<0?0:K,s[E+2]=ne>255?255:ne<0?0:ne}else{var z=n-D;z<0?z=0:z>255&&(z=255),s[E]=s[E+1]=s[E+2]=z}}while(--w)}while(--p)};J.addGetterSetter(Ge,"embossStrength",.5,Ve(),J.afterSetFilter);J.addGetterSetter(Ge,"embossWhiteLevel",.5,Ve(),J.afterSetFilter);J.addGetterSetter(Ge,"embossDirection","top-left",null,J.afterSetFilter);J.addGetterSetter(Ge,"embossBlend",!1,null,J.afterSetFilter);function YC(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const k6e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],d=u,p,m,y=this.enhance();if(y!==0){for(m=0;mi&&(i=o),l=t[m+1],ls&&(s=l),p=t[m+2],pd&&(d=p);i===r&&(i=255,r=0),s===a&&(s=255,a=0),d===u&&(d=255,u=0);var b,w,E,_,k,T,L,O,D;for(y>0?(w=i+y*(255-i),E=r-y*(r-0),k=s+y*(255-s),T=a-y*(a-0),O=d+y*(255-d),D=u-y*(u-0)):(b=(i+r)*.5,w=i+y*(i-b),E=r+y*(r-b),_=(s+a)*.5,k=s+y*(s-_),T=a+y*(a-_),L=(d+u)*.5,O=d+y*(d-L),D=u+y*(u-L)),m=0;m_?E:_;var k=a,T=o,L,O,D=360/T*Math.PI/180,I,N;for(O=0;OT?k:T;var L=a,O=o,D,I,N=n.polarRotation||0,W,B;for(d=0;dt&&(L=T,O=0,D=-1),i=0;i=0&&y=0&&b=0&&y=0&&b=255*4?255:0}return a}function $6e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&y=0&&b=n))for(o=w;o=r||(a=(n*o+i)*4,s+=L[a+0],l+=L[a+1],u+=L[a+2],d+=L[a+3],T+=1);for(s=s/T,l=l/T,u=u/T,d=d/T,i=y;i=n))for(o=w;o=r||(a=(n*o+i)*4,L[a+0]=s,L[a+1]=l,L[a+2]=u,L[a+3]=d)}};J.addGetterSetter(Ge,"pixelSize",8,Ve(),J.afterSetFilter);const H6e=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});J.addGetterSetter(Ge,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});J.addGetterSetter(Ge,"blue",0,iV,J.afterSetFilter);const U6e=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});J.addGetterSetter(Ge,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});J.addGetterSetter(Ge,"blue",0,iV,J.afterSetFilter);J.addGetterSetter(Ge,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});const V6e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),d>127&&(d=255-d),p>127&&(p=255-p),t[l]=u,t[l+1]=d,t[l+2]=p}while(--s)}while(--o)},q6e=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=t,i=document.createElement("div"),o=new $g.Stage({container:i,width:n,height:r}),a=new $g.Layer,s=new $g.Layer;a.add(new $g.Rect({...t,fill:"white"})),e.forEach(u=>s.add(new $g.Line({points:u.points,stroke:"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),o.add(a),o.add(s);const l=o.toDataURL({...t});return i.remove(),l};let jV=null,NV=null;const Y6e=e=>{jV=e},Qs=()=>jV,X6e=e=>{NV=e},$V=()=>NV,Z6e=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},FV=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),Q6e=e=>{const t=Qs(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:o,systemState:a}=e,{codeformerFidelity:s,facetoolStrength:l,facetoolType:u,hiresFix:d,hiresStrength:p,shouldRunESRGAN:m,shouldRunFacetool:y,upscalingLevel:b,upscalingStrength:w,upscalingDenoising:E}=i,{cfgScale:_,height:k,img2imgStrength:T,infillMethod:L,initialImage:O,iterations:D,perlin:I,prompt:N,negativePrompt:W,sampler:B,seamBlur:K,seamless:ne,seamSize:z,seamSteps:$,seamStrength:V,seed:X,seedWeights:Q,shouldFitToWidthHeight:G,shouldGenerateVariations:Y,shouldRandomizeSeed:ee,steps:fe,threshold:_e,tileSize:we,variationAmount:xe,width:Le,shouldUseSymmetry:Se,horizontalSymmetrySteps:Je,verticalSymmetrySteps:Xe}=r,{shouldDisplayInProgressType:tt,saveIntermediatesInterval:yt,enableImageDebugging:Be}=a,Ae={prompt:N,iterations:D,steps:fe,cfg_scale:_,threshold:_e,perlin:I,height:k,width:Le,sampler_name:B,seed:X,progress_images:tt==="full-res",progress_latents:tt==="latents",save_intermediates:yt,generation_mode:n,init_mask:""};let bt=!1,Fe=!1;if(W!==""&&(Ae.prompt=`${N} [${W}]`),Ae.seed=ee?FV(CE,_E):X,Se&&(Je>0&&(Ae.h_symmetry_time_pct=Math.max(0,Math.min(1,Je/fe))),Xe>0&&(Ae.v_symmetry_time_pct=Math.max(0,Math.min(1,Xe/fe)))),n==="txt2img"&&(Ae.hires_fix=d,d&&(Ae.strength=p)),["txt2img","img2img"].includes(n)&&(Ae.seamless=ne,m&&(bt={level:b,denoise_str:E,strength:w}),y&&(Fe={type:u,strength:l},u==="codeformer"&&(Fe.codeformer_fidelity=s))),n==="img2img"&&O&&(Ae.init_img=typeof O=="string"?O:O.url,Ae.strength=T,Ae.fit=G),n==="unifiedCanvas"&&t){const{layerState:{objects:at},boundingBoxCoordinates:jt,boundingBoxDimensions:mt,stageScale:Zt,isMaskEnabled:on,shouldPreserveMaskedArea:se,boundingBoxScaleMethod:Ie,scaledBoundingBoxDimensions:He}=o,Ue={...jt,...mt},ye=K6e(on?at.filter(hE):[],Ue);Ae.init_mask=ye,Ae.fit=!1,Ae.strength=T,Ae.invert_mask=se,Ae.bounding_box=Ue;const je=t.scale();t.scale({x:1/Zt,y:1/Zt});const vt=t.getAbsolutePosition(),Mt=t.toDataURL({x:Ue.x+vt.x,y:Ue.y+vt.y,width:Ue.width,height:Ue.height});Be&&Z6e([{base64:ye,caption:"mask sent as init_mask"},{base64:Mt,caption:"image sent as init_img"}]),t.scale(je),Ae.init_img=Mt,Ae.progress_images=!1,Ie!=="none"&&(Ae.inpaint_width=He.width,Ae.inpaint_height=He.height),Ae.seam_size=z,Ae.seam_blur=K,Ae.seam_strength=V,Ae.seam_steps=$,Ae.tile_size=we,Ae.infill_method=L,Ae.force_outpaint=!1}return Y?(Ae.variation_amount=xe,Q&&(Ae.with_variations=N3e(Q))):Ae.variation_amount=0,Be&&(Ae.enable_image_debugging=Be),{generationParameters:Ae,esrganParameters:bt,facetoolParameters:Fe}};var J6e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,e_e=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,t_e=/[^-+\dA-Z]/g;function Ti(e,t,n,r){if(arguments.length===1&&typeof e=="string"&&!/\d/.test(e)&&(t=e,e=void 0),e=e||e===0?e:new Date,e instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");t=String(wI[t]||t||wI.default);var i=t.slice(0,4);(i==="UTC:"||i==="GMT:")&&(t=t.slice(4),n=!0,i==="GMT:"&&(r=!0));var o=function(){return n?"getUTC":"get"},a=function(){return e[o()+"Date"]()},s=function(){return e[o()+"Day"]()},l=function(){return e[o()+"Month"]()},u=function(){return e[o()+"FullYear"]()},d=function(){return e[o()+"Hours"]()},p=function(){return e[o()+"Minutes"]()},m=function(){return e[o()+"Seconds"]()},y=function(){return e[o()+"Milliseconds"]()},b=function(){return n?0:e.getTimezoneOffset()},w=function(){return n_e(e)},E=function(){return r_e(e)},_={d:function(){return a()},dd:function(){return xa(a())},ddd:function(){return zo.dayNames[s()]},DDD:function(){return CI({y:u(),m:l(),d:a(),_:o(),dayName:zo.dayNames[s()],short:!0})},dddd:function(){return zo.dayNames[s()+7]},DDDD:function(){return CI({y:u(),m:l(),d:a(),_:o(),dayName:zo.dayNames[s()+7]})},m:function(){return l()+1},mm:function(){return xa(l()+1)},mmm:function(){return zo.monthNames[l()]},mmmm:function(){return zo.monthNames[l()+12]},yy:function(){return String(u()).slice(2)},yyyy:function(){return xa(u(),4)},h:function(){return d()%12||12},hh:function(){return xa(d()%12||12)},H:function(){return d()},HH:function(){return xa(d())},M:function(){return p()},MM:function(){return xa(p())},s:function(){return m()},ss:function(){return xa(m())},l:function(){return xa(y(),3)},L:function(){return xa(Math.floor(y()/10))},t:function(){return d()<12?zo.timeNames[0]:zo.timeNames[1]},tt:function(){return d()<12?zo.timeNames[2]:zo.timeNames[3]},T:function(){return d()<12?zo.timeNames[4]:zo.timeNames[5]},TT:function(){return d()<12?zo.timeNames[6]:zo.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":i_e(e)},o:function(){return(b()>0?"-":"+")+xa(Math.floor(Math.abs(b())/60)*100+Math.abs(b())%60,4)},p:function(){return(b()>0?"-":"+")+xa(Math.floor(Math.abs(b())/60),2)+":"+xa(Math.floor(Math.abs(b())%60),2)},S:function(){return["th","st","nd","rd"][a()%10>3?0:(a()%100-a()%10!=10)*a()%10]},W:function(){return w()},WW:function(){return xa(w())},N:function(){return E()}};return t.replace(J6e,function(k){return k in _?_[k]():k.slice(1,k.length-1)})}var wI={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},zo={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},xa=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(t).padStart(n,"0")},CI=function(t){var n=t.y,r=t.m,i=t.d,o=t._,a=t.dayName,s=t.short,l=s===void 0?!1:s,u=new Date,d=new Date;d.setDate(d[o+"Date"]()-1);var p=new Date;p.setDate(p[o+"Date"]()+1);var m=function(){return u[o+"Date"]()},y=function(){return u[o+"Month"]()},b=function(){return u[o+"FullYear"]()},w=function(){return d[o+"Date"]()},E=function(){return d[o+"Month"]()},_=function(){return d[o+"FullYear"]()},k=function(){return p[o+"Date"]()},T=function(){return p[o+"Month"]()},L=function(){return p[o+"FullYear"]()};return b()===n&&y()===r&&m()===i?l?"Tdy":"Today":_()===n&&E()===r&&w()===i?l?"Ysd":"Yesterday":L()===n&&T()===r&&k()===i?l?"Tmw":"Tomorrow":a},n_e=function(t){var n=new Date(t.getFullYear(),t.getMonth(),t.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var o=(n-r)/(864e5*7);return 1+Math.floor(o)},r_e=function(t){var n=t.getDay();return n===0&&(n=7),n},i_e=function(t){return(String(t).match(e_e)||[""]).pop().replace(t_e,"").replace(/GMT\+0000/g,"UTC")};const o_e=(e,t)=>{const{dispatch:n,getState:r}=e;return{emitGenerateImage:i=>{n(wa(!0));const o=r(),{generation:a,postprocessing:s,system:l,canvas:u}=o,d={generationMode:i,generationState:a,postprocessingState:s,canvasState:u,systemState:l};n(M4e());const{generationParameters:p,esrganParameters:m,facetoolParameters:y}=Q6e(d);t.emit("generateImage",p,m,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...m,...y})}`}))},emitRunESRGAN:i=>{n(wa(!0));const{postprocessing:{upscalingLevel:o,upscalingDenoising:a,upscalingStrength:s}}=r(),l={upscale:[o,a,s]};t.emit("runPostprocessing",i,{type:"esrgan",...l}),n(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...l})}`}))},emitRunFacetool:i=>{n(wa(!0));const{postprocessing:{facetoolType:o,facetoolStrength:a,codeformerFidelity:s}}=r(),l={facetool_strength:a};o==="codeformer"&&(l.codeformer_fidelity=s),t.emit("runPostprocessing",i,{type:o,...l}),n(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Face restoration (${o}) requested: ${JSON.stringify({file:i.url,...l})}`}))},emitDeleteImage:i=>{const{url:o,uuid:a,category:s,thumbnail:l}=i;n(JW(i)),t.emit("deleteImage",o,l,a,s)},emitRequestImages:i=>{const o=r().gallery,{earliest_mtime:a}=o.categories[i];t.emit("requestImages",i,a)},emitRequestNewImages:i=>{const o=r().gallery,{latest_mtime:a}=o.categories[i];t.emit("requestLatestImages",i,a)},emitCancelProcessing:()=>{t.emit("cancel")},emitRequestSystemConfig:()=>{t.emit("requestSystemConfig")},emitSearchForModels:i=>{t.emit("searchForModels",i)},emitAddNewModel:i=>{t.emit("addNewModel",i)},emitDeleteModel:i=>{t.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(k4e()),t.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(E4e()),t.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(_4e()),t.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{t.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{t.emit("requestEmptyTempFolder")}}};let mx;const a_e=new Uint8Array(16);function s_e(){if(!mx&&(mx=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!mx))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mx(a_e)}const Hi=[];for(let e=0;e<256;++e)Hi.push((e+256).toString(16).slice(1));function l_e(e,t=0){return(Hi[e[t+0]]+Hi[e[t+1]]+Hi[e[t+2]]+Hi[e[t+3]]+"-"+Hi[e[t+4]]+Hi[e[t+5]]+"-"+Hi[e[t+6]]+Hi[e[t+7]]+"-"+Hi[e[t+8]]+Hi[e[t+9]]+"-"+Hi[e[t+10]]+Hi[e[t+11]]+Hi[e[t+12]]+Hi[e[t+13]]+Hi[e[t+14]]+Hi[e[t+15]]).toLowerCase()}const u_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_I={randomUUID:u_e};function um(e,t,n){if(_I.randomUUID&&!t&&!e)return _I.randomUUID();e=e||{};const r=e.random||(e.rng||s_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return l_e(r)}const Wk=br("socketio/generateImage"),c_e=br("socketio/runESRGAN"),d_e=br("socketio/runFacetool"),f_e=br("socketio/deleteImage"),Uk=br("socketio/requestImages"),kI=br("socketio/requestNewImages"),h_e=br("socketio/cancelProcessing"),p_e=br("socketio/requestSystemConfig"),EI=br("socketio/searchForModels"),v2=br("socketio/addNewModel"),g_e=br("socketio/deleteModel"),m_e=br("socketio/convertToDiffusers"),v_e=br("socketio/mergeDiffusersModels"),BV=br("socketio/requestModelChange"),y_e=br("socketio/saveStagingAreaImageToGallery"),b_e=br("socketio/requestEmptyTempFolder"),x_e=e=>{const{dispatch:t,getState:n}=e;return{onConnect:()=>{try{t(HR(!0)),t(hh(Et.t("common.statusConnected"))),t(p_e());const r=n().gallery;r.categories.result.latest_mtime?t(kI("result")):t(Uk("result")),r.categories.user.latest_mtime?t(kI("user")):t(Uk("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{t(HR(!1)),t(hh(Et.t("common.statusDisconnected"))),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:o}=i.ui,{shouldLoopback:a}=i.postprocessing,{boundingBox:s,generationMode:l,...u}=r,d={uuid:um(),...u};if(["txt2img","img2img"].includes(l)&&t(sm({category:"result",image:{...d,category:"result"}})),l==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;t(n3e({image:{...d,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&t(sm({image:{...d,category:"result"},category:"result"}))}if(a)switch(xE[o]){case"img2img":{t(y0(d));break}}t(jC()),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{t(k3e({uuid:um(),...r,category:"result"})),r.isBase64||t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{t(sm({category:"result",image:{uuid:um(),...r,category:"result"}})),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{t(wa(!0)),t(x4e(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:o}=r;try{t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),t(WR()),t(jC())}catch(a){console.error(a)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:o,category:a}=r,s=i.map(l=>({uuid:um(),...l}));t(_3e({images:s,areMoreImagesAvailable:o,category:a})),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{t(C4e());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(t(sm({category:"result",image:r})),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),t(jC())),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;t(JW(r));const{generation:{initialImage:o,maskPath:a}}=n();(o===i||(o==null?void 0:o.url)===i)&&t(aU()),a===i&&t(uU("")),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{t(S4e(r)),r.infill_methods.includes("patchmatch")||t(lU(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:o}=r;t($U(i)),t(FU(o))},onNewModelAdded:r=>{const{new_model_name:i,model_list:o,update:a}=r;t(Ag(o)),t(wa(!1)),t(hh(Et.t("modelManager.modelAdded"))),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),t($u({title:a?`${Et.t("modelManager.modelUpdated")}: ${i}`:`${Et.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:o}=r;t(Ag(o)),t(wa(!1)),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`${Et.t("modelManager.modelAdded")}: ${i}`,level:"info"})),t($u({title:`${Et.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:o}=r;t(Ag(o)),t(hh(Et.t("common.statusModelConverted"))),t(wa(!1)),t(_d(!0)),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),t($u({title:`${Et.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:o,model_list:a}=r;t(Ag(a)),t(hh(Et.t("common.statusMergedModels"))),t(wa(!1)),t(_d(!0)),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),t($u({title:`${Et.t("modelManager.modelsMerged")}: ${o}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:o}=r;t(Ag(o)),t(hh(Et.t("common.statusModelChanged"))),t(wa(!1)),t(_d(!0)),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:o}=r;t(Ag(o)),t(wa(!1)),t(_d(!0)),t(WR()),t(Pi({timestamp:Ti(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{t($u({title:Et.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},S_e=()=>{const{origin:e}=new URL(window.location.href),t=pS(e,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>o=>a=>{const{onConnect:s,onDisconnect:l,onError:u,onPostprocessingResult:d,onGenerationResult:p,onIntermediateResult:m,onProgressUpdate:y,onGalleryImages:b,onProcessingCanceled:w,onImageDeleted:E,onSystemConfig:_,onModelChanged:k,onFoundModels:T,onNewModelAdded:L,onModelDeleted:O,onModelConverted:D,onModelsMerged:I,onModelChangeFailed:N,onTempFolderEmptied:W}=x_e(i),{emitGenerateImage:B,emitRunESRGAN:K,emitRunFacetool:ne,emitDeleteImage:z,emitRequestImages:$,emitRequestNewImages:V,emitCancelProcessing:X,emitRequestSystemConfig:Q,emitSearchForModels:G,emitAddNewModel:Y,emitDeleteModel:ee,emitConvertToDiffusers:fe,emitMergeDiffusersModels:_e,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:xe,emitRequestEmptyTempFolder:Le}=o_e(i,t);switch(n||(t.on("connect",()=>s()),t.on("disconnect",()=>l()),t.on("error",Se=>u(Se)),t.on("generationResult",Se=>p(Se)),t.on("postprocessingResult",Se=>d(Se)),t.on("intermediateResult",Se=>m(Se)),t.on("progressUpdate",Se=>y(Se)),t.on("galleryImages",Se=>b(Se)),t.on("processingCanceled",()=>{w()}),t.on("imageDeleted",Se=>{E(Se)}),t.on("systemConfig",Se=>{_(Se)}),t.on("foundModels",Se=>{T(Se)}),t.on("newModelAdded",Se=>{L(Se)}),t.on("modelDeleted",Se=>{O(Se)}),t.on("modelConverted",Se=>{D(Se)}),t.on("modelsMerged",Se=>{I(Se)}),t.on("modelChanged",Se=>{k(Se)}),t.on("modelChangeFailed",Se=>{N(Se)}),t.on("tempFolderEmptied",()=>{W()}),n=!0),a.type){case"socketio/generateImage":{B(a.payload);break}case"socketio/runESRGAN":{K(a.payload);break}case"socketio/runFacetool":{ne(a.payload);break}case"socketio/deleteImage":{z(a.payload);break}case"socketio/requestImages":{$(a.payload);break}case"socketio/requestNewImages":{V(a.payload);break}case"socketio/cancelProcessing":{X();break}case"socketio/requestSystemConfig":{Q();break}case"socketio/searchForModels":{G(a.payload);break}case"socketio/addNewModel":{Y(a.payload);break}case"socketio/deleteModel":{ee(a.payload);break}case"socketio/convertToDiffusers":{fe(a.payload);break}case"socketio/mergeDiffusersModels":{_e(a.payload);break}case"socketio/requestModelChange":{we(a.payload);break}case"socketio/saveStagingAreaImageToGallery":{xe(a.payload);break}case"socketio/requestEmptyTempFolder":{Le();break}}o(a)}},w_e=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(e=>`canvas.${e}`),C_e=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(e=>`system.${e}`),__e=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","shouldHoldGalleryOpen","intermediateImage"].map(e=>`gallery.${e}`),zV=SW({generation:W3e,postprocessing:K3e,gallery:O3e,system:O4e,canvas:w3e,ui:W4e,lightbox:D3e}),k_e=OW.getPersistConfig({key:"root",storage:AW,rootReducer:zV,blacklist:[...w_e,...C_e,...__e],debounce:300}),E_e=MSe(k_e,zV),HV=oSe({reducer:E_e,middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(S_e()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),WV=DSe(HV),AE=S.createContext(null),Te=bxe,le=lxe;let PI;const OE=()=>({setOpenUploader:e=>{e&&(PI=e)},openUploader:PI}),Br=lt(e=>e.ui,e=>xE[e.activeTab],{memoizeOptions:{equalityCheck:Ce.isEqual}}),P_e=lt(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:Ce.isEqual}}),fp=lt(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:Ce.isEqual}}),TI=e=>async(t,n)=>{const{imageFile:r}=e,i=n(),o=Br(i),a=new FormData;a.append("file",r,r.name),a.append("data",JSON.stringify({kind:"init"}));const l=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:a})).json(),u={uuid:um(),category:"user",...l};t(sm({image:u,category:"user"})),o==="unifiedCanvas"?t(i4(u)):o==="img2img"&&t(y0(u))};function T_e(){const{t:e}=De();return g.jsxs("div",{className:"work-in-progress nodes-work-in-progress",children:[g.jsx("h1",{children:e("common.nodes")}),g.jsx("p",{children:e("common.nodesDesc")})]})}const M_e=()=>{const{t:e}=De();return g.jsxs("div",{className:"work-in-progress post-processing-work-in-progress",children:[g.jsx("h1",{children:e("common.postProcessing")}),g.jsx("p",{children:e("common.postProcessDesc1")}),g.jsx("p",{children:e("common.postProcessDesc2")}),g.jsx("p",{children:e("common.postProcessDesc3")})]})};function L_e(){const{t:e}=De();return g.jsxs("div",{className:"work-in-progress nodes-work-in-progress",children:[g.jsx("h1",{children:e("common.training")}),g.jsxs("p",{children:[e("common.trainingDesc1"),g.jsx("br",{}),g.jsx("br",{}),e("common.trainingDesc2")]})]})}function A_e(e){const{i18n:t}=De(),n=localStorage.getItem("i18nextLng");Ke.useEffect(()=>{e()},[e]),Ke.useEffect(()=>{t.on("languageChanged",()=>{e()})},[e,t,n])}const O_e=fc({displayName:"ImageToImageIcon",viewBox:"0 0 3543 3543",path:g.jsx("g",{transform:"matrix(1.10943,0,0,1.10943,-206.981,-213.533)",children:g.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M688.533,2405.95L542.987,2405.95C349.532,2405.95 192.47,2248.89 192.47,2055.44L192.47,542.987C192.47,349.532 349.532,192.47 542.987,192.47L2527.88,192.47C2721.33,192.47 2878.4,349.532 2878.4,542.987L2878.4,1172.79L3023.94,1172.79C3217.4,1172.79 3374.46,1329.85 3374.46,1523.3C3374.46,1523.3 3374.46,3035.75 3374.46,3035.75C3374.46,3229.21 3217.4,3386.27 3023.94,3386.27L1039.05,3386.27C845.595,3386.27 688.533,3229.21 688.533,3035.75L688.533,2405.95ZM3286.96,2634.37L3286.96,1523.3C3286.96,1378.14 3169.11,1260.29 3023.94,1260.29C3023.94,1260.29 1039.05,1260.29 1039.05,1260.29C893.887,1260.29 776.033,1378.14 776.033,1523.3L776.033,2489.79L1440.94,1736.22L2385.83,2775.59L2880.71,2200.41L3286.96,2634.37ZM2622.05,1405.51C2778.5,1405.51 2905.51,1532.53 2905.51,1688.98C2905.51,1845.42 2778.5,1972.44 2622.05,1972.44C2465.6,1972.44 2338.58,1845.42 2338.58,1688.98C2338.58,1532.53 2465.6,1405.51 2622.05,1405.51ZM2790.9,1172.79L1323.86,1172.79L944.882,755.906L279.97,1509.47L279.97,542.987C279.97,397.824 397.824,279.97 542.987,279.97C542.987,279.97 2527.88,279.97 2527.88,279.97C2673.04,279.97 2790.9,397.824 2790.9,542.987L2790.9,1172.79ZM2125.98,425.197C2282.43,425.197 2409.45,552.213 2409.45,708.661C2409.45,865.11 2282.43,992.126 2125.98,992.126C1969.54,992.126 1842.52,865.11 1842.52,708.661C1842.52,552.213 1969.54,425.197 2125.98,425.197Z"})})}),R_e=fc({displayName:"NodesIcon",viewBox:"0 0 3543 3543",path:g.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3543.31,770.787C3543.31,515.578 3336.11,308.38 3080.9,308.38L462.407,308.38C207.197,308.38 0,515.578 0,770.787L0,2766.03C0,3021.24 207.197,3228.44 462.407,3228.44L3080.9,3228.44C3336.11,3228.44 3543.31,3021.24 3543.31,2766.03C3543.31,2766.03 3543.31,770.787 3543.31,770.787ZM3427.88,770.787L3427.88,2766.03C3427.88,2957.53 3272.4,3113.01 3080.9,3113.01C3080.9,3113.01 462.407,3113.01 462.407,3113.01C270.906,3113.01 115.431,2957.53 115.431,2766.03L115.431,770.787C115.431,579.286 270.906,423.812 462.407,423.812L3080.9,423.812C3272.4,423.812 3427.88,579.286 3427.88,770.787ZM1214.23,1130.69L1321.47,1130.69C1324.01,1130.69 1326.54,1130.53 1329.05,1130.2C1329.05,1130.2 1367.3,1125.33 1397.94,1149.8C1421.63,1168.72 1437.33,1204.3 1437.33,1265.48L1437.33,2078.74L1220.99,2078.74C1146.83,2078.74 1086.61,2138.95 1086.61,2213.12L1086.61,2762.46C1086.61,2836.63 1146.83,2896.84 1220.99,2896.84L1770.34,2896.84C1844.5,2896.84 1904.71,2836.63 1904.71,2762.46L1904.71,2213.12C1904.71,2138.95 1844.5,2078.74 1770.34,2078.74L1554,2078.74L1554,1604.84C1625.84,1658.19 1703.39,1658.1 1703.39,1658.1C1703.54,1658.1 1703.69,1658.11 1703.84,1658.11L2362.2,1658.11L2362.2,1874.44C2362.2,1948.61 2422.42,2008.82 2496.58,2008.82L3045.93,2008.82C3120.09,2008.82 3180.3,1948.61 3180.3,1874.44L3180.3,1325.1C3180.3,1250.93 3120.09,1190.72 3045.93,1190.72L2496.58,1190.72C2422.42,1190.72 2362.2,1250.93 2362.2,1325.1L2362.2,1558.97L2362.2,1541.44L1704.23,1541.44C1702.2,1541.37 1650.96,1539.37 1609.51,1499.26C1577.72,1468.49 1554,1416.47 1554,1331.69L1554,1265.48C1554,1153.86 1513.98,1093.17 1470.76,1058.64C1411.24,1011.1 1338.98,1012.58 1319.15,1014.03L1214.23,1014.03L1214.23,796.992C1214.23,722.828 1154.02,662.617 1079.85,662.617L530.507,662.617C456.343,662.617 396.131,722.828 396.131,796.992L396.131,1346.34C396.131,1420.5 456.343,1480.71 530.507,1480.71L1079.85,1480.71C1154.02,1480.71 1214.23,1420.5 1214.23,1346.34L1214.23,1130.69Z"})}),I_e=fc({displayName:"PostprocessingIcon",viewBox:"0 0 3543 3543",path:g.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M709.477,1596.53L992.591,1275.66L2239.09,2646.81L2891.95,1888.03L3427.88,2460.51L3427.88,994.78C3427.88,954.66 3421.05,916.122 3408.5,880.254L3521.9,855.419C3535.8,899.386 3543.31,946.214 3543.31,994.78L3543.31,2990.02C3543.31,3245.23 3336.11,3452.43 3080.9,3452.43C3080.9,3452.43 462.407,3452.43 462.407,3452.43C207.197,3452.43 -0,3245.23 -0,2990.02L-0,994.78C-0,739.571 207.197,532.373 462.407,532.373L505.419,532.373L504.644,532.546L807.104,600.085C820.223,601.729 832.422,607.722 841.77,617.116C850.131,625.517 855.784,636.21 858.055,647.804L462.407,647.804C270.906,647.804 115.431,803.279 115.431,994.78L115.431,2075.73L-0,2101.5L115.431,2127.28L115.431,2269.78L220.47,2150.73L482.345,2209.21C503.267,2211.83 522.722,2221.39 537.63,2236.37C552.538,2251.35 562.049,2270.9 564.657,2291.93L671.84,2776.17L779.022,2291.93C781.631,2270.9 791.141,2251.35 806.05,2236.37C820.958,2221.39 840.413,2211.83 861.334,2209.21L1353.15,2101.5L861.334,1993.8C840.413,1991.18 820.958,1981.62 806.05,1966.64C791.141,1951.66 781.631,1932.11 779.022,1911.08L709.477,1596.53ZM671.84,1573.09L725.556,2006.07C726.863,2016.61 731.63,2026.4 739.101,2033.91C746.573,2041.42 756.323,2046.21 766.808,2047.53L1197.68,2101.5L766.808,2155.48C756.323,2156.8 746.573,2161.59 739.101,2169.09C731.63,2176.6 726.863,2186.4 725.556,2196.94L671.84,2629.92L618.124,2196.94C616.817,2186.4 612.05,2176.6 604.579,2169.09C597.107,2161.59 587.357,2156.8 576.872,2155.48L146.001,2101.5L576.872,2047.53C587.357,2046.21 597.107,2041.42 604.579,2033.91C612.05,2026.4 616.817,2016.61 618.124,2006.07L671.84,1573.09ZM609.035,1710.36L564.657,1911.08C562.049,1932.11 552.538,1951.66 537.63,1966.64C522.722,1981.62 503.267,1991.18 482.345,1993.8L328.665,2028.11L609.035,1710.36ZM2297.12,938.615L2451.12,973.003C2480.59,976.695 2507.99,990.158 2528.99,1011.26C2549.99,1032.37 2563.39,1059.9 2567.07,1089.52L2672.73,1566.9C2634.5,1580.11 2593.44,1587.29 2550.72,1587.29C2344.33,1587.29 2176.77,1419.73 2176.77,1213.34C2176.77,1104.78 2223.13,1006.96 2297.12,938.615ZM2718.05,76.925L2793.72,686.847C2795.56,701.69 2802.27,715.491 2812.8,726.068C2823.32,736.644 2837.06,743.391 2851.83,745.242L3458.78,821.28L2851.83,897.318C2837.06,899.168 2823.32,905.916 2812.8,916.492C2802.27,927.068 2795.56,940.87 2793.72,955.712L2718.05,1565.63L2642.38,955.712C2640.54,940.87 2633.83,927.068 2623.3,916.492C2612.78,905.916 2599.04,899.168 2584.27,897.318L1977.32,821.28L2584.27,745.242C2599.04,743.391 2612.78,736.644 2623.3,726.068C2633.83,715.491 2640.54,701.69 2642.38,686.847L2718.05,76.925ZM2883.68,1043.06C2909.88,1094.13 2924.67,1152.02 2924.67,1213.34C2924.67,1335.4 2866.06,1443.88 2775.49,1512.14L2869.03,1089.52C2871.07,1073.15 2876.07,1057.42 2883.68,1043.06ZM925.928,201.2L959.611,472.704C960.431,479.311 963.42,485.455 968.105,490.163C972.79,494.871 978.904,497.875 985.479,498.698L1255.66,532.546L985.479,566.395C978.904,567.218 972.79,570.222 968.105,574.93C963.42,579.638 960.431,585.781 959.611,592.388L925.928,863.893L892.245,592.388C891.425,585.781 888.436,579.638 883.751,574.93C879.066,570.222 872.952,567.218 866.378,566.395L596.195,532.546L866.378,498.698C872.952,497.875 879.066,494.871 883.751,490.163C888.436,485.455 891.425,479.311 892.245,472.704L925.928,201.2ZM2864.47,532.373L3080.9,532.373C3258.7,532.373 3413.2,632.945 3490.58,780.281L3319.31,742.773C3257.14,683.925 3173.2,647.804 3080.9,647.804L2927.07,647.804C2919.95,642.994 2913.25,637.473 2907.11,631.298C2886.11,610.194 2872.71,582.655 2869.03,553.04L2864.47,532.373ZM1352.36,532.373L2571.64,532.373L2567.07,553.04C2563.39,582.655 2549.99,610.194 2528.99,631.298C2522.85,637.473 2516.16,642.994 2509.03,647.804L993.801,647.804C996.072,636.21 1001.73,625.517 1010.09,617.116C1019.43,607.722 1031.63,601.729 1044.75,600.085L1353.15,532.546L1352.36,532.373Z"})}),D_e=fc({displayName:"TextToImageIcon",viewBox:"0 0 3543 3543",path:g.jsx("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",transform:"matrix(1.11667,0,0,1.1066,-231.131,-213.062)",children:g.jsx("path",{d:"M2209.59,1137.35L2209.59,1098.17C2177.13,1108.99 2125.74,1121.91 2055.41,1136.94C2054.77,1137.08 2054.14,1137.21 2053.49,1137.35L1662.79,1137.35C1687.75,1101.98 1720.8,1074.35 1761.93,1054.44C1808.52,1031.9 1875.69,1012.22 1963.45,995.386C2081.86,973.146 2163.91,952.409 2209.59,933.174L2209.59,907.929C2209.59,859.241 2197.57,824.529 2173.53,803.792C2149.48,783.054 2104.1,772.686 2037.38,772.686C1992.3,772.686 1957.14,781.552 1931.89,799.284C1906.64,817.015 1886.21,848.121 1870.58,892.601L1640.67,851.127C1666.51,758.56 1710.99,690.037 1774.11,645.557C1837.22,601.077 1930.99,578.837 2055.41,578.837C2168.42,578.837 2252.57,592.211 2307.87,618.959C2363.17,645.707 2402.09,679.668 2424.63,720.842C2447.17,762.016 2458.44,837.602 2458.44,947.6L2456.7,1137.35L3021.34,1137.35C3214.79,1137.35 3371.86,1294.41 3371.86,1487.87C3371.86,1487.87 3371.86,3000.32 3371.86,3000.32C3371.86,3193.78 3214.79,3350.84 3021.34,3350.84C3021.34,3350.84 1036.45,3350.84 1036.45,3350.84C842.991,3350.84 685.93,3193.78 685.93,3000.32L685.93,1487.87C685.93,1400.21 718.174,1320.03 771.448,1258.54L772.123,1257.76L607.408,1257.76L498.311,1558L215.202,1558L730.028,236.22L1012.24,236.22L1373.06,1137.35L2209.59,1137.35ZM3284.36,2598.93L3284.36,1487.87C3284.36,1342.71 3166.5,1224.85 3021.34,1224.85C3021.34,1224.85 1036.45,1224.85 1036.45,1224.85C891.284,1224.85 773.43,1342.71 773.43,1487.87L773.43,2454.35L1438.34,1700.79L2383.22,2740.16L2878.11,2164.98L3284.36,2598.93ZM2619.44,1370.08C2775.89,1370.08 2902.91,1497.1 2902.91,1653.54C2902.91,1809.99 2775.89,1937.01 2619.44,1937.01C2462.99,1937.01 2335.98,1809.99 2335.98,1653.54C2335.98,1497.1 2462.99,1370.08 2619.44,1370.08ZM772.877,1256.89L772.849,1256.93L773.167,1256.57L772.877,1256.89ZM773.634,1256.04L773.563,1256.12L773.985,1255.64L773.634,1256.04ZM774.394,1255.18L774.276,1255.31L774.746,1254.78L774.394,1255.18ZM775.157,1254.32L774.988,1254.51L775.493,1253.95L775.157,1254.32ZM775.923,1253.47L775.698,1253.72L776.237,1253.12L775.923,1253.47ZM776.691,1252.62L776.403,1252.94L776.979,1252.3L776.691,1252.62ZM777.462,1251.77L777.098,1252.17L777.723,1251.49L777.462,1251.77ZM925.081,1155.44C868.026,1174.57 817.508,1207.99 777.775,1251.43C817.511,1207.99 868.031,1174.57 925.081,1155.44ZM925.646,1155.25L925.108,1155.43L926.103,1155.1L925.646,1155.25ZM935.286,1152.2C932.214,1153.12 929.159,1154.09 926.13,1155.09C929.165,1154.09 932.219,1153.12 935.286,1152.2ZM935.716,1152.07L935.384,1152.17L936.292,1151.89L935.716,1152.07ZM936.843,1151.73L936.451,1151.85L937.327,1151.59L936.843,1151.73ZM937.972,1151.4L937.514,1151.53L938.377,1151.28L937.972,1151.4ZM939.102,1151.07L938.57,1151.22L939.438,1150.97L939.102,1151.07ZM940.233,1150.74L939.613,1150.92L940.505,1150.67L940.233,1150.74ZM946.659,1148.98C944.639,1149.51 942.626,1150.07 940.626,1150.63C942.631,1150.06 944.642,1149.51 946.659,1148.98ZM947.056,1148.87L946.829,1148.93L947.659,1148.71L947.056,1148.87ZM948.198,1148.57L947.919,1148.65L948.705,1148.44L948.198,1148.57ZM949.342,1148.28L949.008,1148.37L949.771,1148.17L949.342,1148.28ZM950.488,1147.99L950.096,1148.09L950.848,1147.9L950.488,1147.99ZM951.635,1147.7L951.182,1147.81L951.932,1147.63L951.635,1147.7ZM952.783,1147.42L952.262,1147.55L953.022,1147.36L952.783,1147.42ZM953.933,1147.14L953.327,1147.28L954.115,1147.09L953.933,1147.14ZM958.213,1146.13C956.927,1146.42 955.644,1146.73 954.354,1147.04C955.637,1146.73 956.923,1146.43 958.213,1146.13ZM958.547,1146.06L958.409,1146.09L959.174,1145.91L958.547,1146.06ZM959.704,1145.79L959.517,1145.84L960.229,1145.68L959.704,1145.79ZM960.863,1145.54L960.626,1145.59L961.311,1145.44L960.863,1145.54ZM962.023,1145.28L961.736,1145.35L962.406,1145.2L962.023,1145.28ZM963.184,1145.03L962.846,1145.11L963.508,1144.97L963.184,1145.03ZM964.347,1144.79L963.956,1144.87L964.615,1144.73L964.347,1144.79ZM965.511,1144.55L965.066,1144.64L965.725,1144.5L965.511,1144.55ZM966.677,1144.31L966.172,1144.41L966.838,1144.28L966.677,1144.31ZM967.844,1144.08L967.269,1144.19L967.953,1144.05L967.844,1144.08ZM970.183,1143.62C969.793,1143.69 969.403,1143.77 969.013,1143.85L969.055,1143.84C969.413,1143.77 969.771,1143.7 970.129,1143.63L970.183,1143.62ZM971.354,1143.4L971.245,1143.42L971.882,1143.3L971.354,1143.4ZM972.526,1143.18L972.37,1143.21L972.987,1143.09L972.526,1143.18ZM973.7,1142.96L973.496,1143L974.103,1142.89L973.7,1142.96ZM974.876,1142.75L974.624,1142.8L975.225,1142.69L974.876,1142.75ZM976.052,1142.55L975.754,1142.6L976.349,1142.49L976.052,1142.55ZM977.23,1142.34L976.885,1142.4L977.476,1142.3L977.23,1142.34ZM978.41,1142.14L978.019,1142.21L978.605,1142.11L978.41,1142.14ZM979.59,1141.95L979.156,1142.02L979.736,1141.92L979.59,1141.95ZM980.772,1141.76L980.299,1141.83L980.868,1141.74L980.772,1141.76ZM981.955,1141.57L981.464,1141.65L982.002,1141.56L981.955,1141.57ZM983.14,1141.39L983.1,1141.39L983.605,1141.32L983.14,1141.39ZM984.326,1141.21L984.239,1141.22L984.778,1141.14L984.326,1141.21ZM985.513,1141.03L985.379,1141.05L985.928,1140.97L985.513,1141.03ZM986.702,1140.86L986.521,1140.89L987.073,1140.81L986.702,1140.86ZM987.891,1140.69L987.665,1140.73L988.218,1140.65L987.891,1140.69ZM989.082,1140.53L988.811,1140.57L989.363,1140.49L989.082,1140.53ZM990.275,1140.37L989.96,1140.41L990.508,1140.34L990.275,1140.37ZM991.468,1140.22L991.113,1140.26L991.654,1140.19L991.468,1140.22ZM992.663,1140.07L992.273,1140.12L992.8,1140.05L992.663,1140.07ZM993.859,1139.92L993.447,1139.97L993.948,1139.91L993.859,1139.92ZM995.056,1139.78L994.671,1139.82L995.097,1139.77L995.056,1139.78ZM996.255,1139.64L996.23,1139.64L996.578,1139.6L996.255,1139.64ZM997.454,1139.5L997.383,1139.51L997.852,1139.46L997.454,1139.5ZM998.655,1139.37L998.537,1139.38L999.041,1139.33L998.655,1139.37ZM999.857,1139.24L999.693,1139.26L1000.21,1139.21L999.857,1139.24ZM1001.06,1139.12L1000.85,1139.14L1001.38,1139.09L1001.06,1139.12ZM1002.26,1139L1002.01,1139.03L1002.54,1138.98L1002.26,1139ZM1003.47,1138.89L1003.18,1138.91L1003.7,1138.87L1003.47,1138.89ZM1004.68,1138.78L1004.34,1138.81L1004.86,1138.76L1004.68,1138.78ZM1005.89,1138.67L1005.52,1138.7L1006.02,1138.66L1005.89,1138.67ZM1007.1,1138.57L1006.71,1138.6L1007.18,1138.56L1007.1,1138.57ZM1008.31,1138.47L1007.96,1138.5L1008.35,1138.46L1008.31,1138.47ZM1009.52,1138.37L1009.5,1138.38L1009.72,1138.36L1009.52,1138.37ZM1010.73,1138.28L1010.67,1138.29L1011.1,1138.26L1010.73,1138.28ZM1011.94,1138.2L1011.84,1138.2L1012.32,1138.17L1011.94,1138.2ZM1013.16,1138.12L1013,1138.13L1013.51,1138.09L1013.16,1138.12ZM1014.37,1138.04L1014.17,1138.05L1014.69,1138.02L1014.37,1138.04ZM1015.59,1137.96L1015.35,1137.98L1015.86,1137.95L1015.59,1137.96ZM1016.81,1137.89L1016.52,1137.91L1017.04,1137.88L1016.81,1137.89ZM1018.03,1137.83L1017.7,1137.85L1018.21,1137.82L1018.03,1137.83ZM1019.25,1137.77L1018.89,1137.79L1019.39,1137.76L1019.25,1137.77ZM1020.47,1137.71L1020.1,1137.73L1020.56,1137.71L1020.47,1137.71ZM1021.69,1137.66L1021.36,1137.67L1021.74,1137.66L1021.69,1137.66ZM1022.92,1137.61L1022.91,1137.61L1023.02,1137.61L1022.92,1137.61ZM1024.14,1137.57L1024.09,1137.57L1024.49,1137.55L1024.14,1137.57ZM1025.37,1137.52L1025.27,1137.53L1025.74,1137.51L1025.37,1137.52ZM1026.6,1137.49L1026.45,1137.49L1026.94,1137.48L1026.6,1137.49ZM1027.82,1137.46L1027.63,1137.46L1028.14,1137.45L1027.82,1137.46ZM1029.05,1137.43L1028.81,1137.43L1029.33,1137.42L1029.05,1137.43ZM1030.28,1137.41L1030,1137.41L1030.52,1137.4L1030.28,1137.41ZM1031.51,1137.39L1031.19,1137.39L1031.7,1137.38L1031.51,1137.39ZM1032.75,1137.37L1032.39,1137.38L1032.89,1137.37L1032.75,1137.37ZM1033.98,1137.36L1033.61,1137.36L1034.07,1137.36L1033.98,1137.36ZM1035.21,1137.35L1034.87,1137.36L1035.26,1137.35L1035.21,1137.35ZM1050.1,1035.06L867.977,544.575L689.455,1035.06L1050.1,1035.06Z"})})}),j_e=fc({displayName:"TrainingIcon",viewBox:"0 0 3544 3544",path:g.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M0,768.593L0,2774.71C0,2930.6 78.519,3068.3 198.135,3150.37C273.059,3202.68 364.177,3233.38 462.407,3233.38C462.407,3233.38 3080.9,3233.38 3080.9,3233.38C3179.13,3233.38 3270.25,3202.68 3345.17,3150.37C3464.79,3068.3 3543.31,2930.6 3543.31,2774.71L3543.31,768.593C3543.31,517.323 3339.31,313.324 3088.04,313.324L455.269,313.324C203.999,313.324 0,517.323 0,768.593ZM3427.88,775.73L3427.88,2770.97C3427.88,2962.47 3272.4,3117.95 3080.9,3117.95L462.407,3117.95C270.906,3117.95 115.431,2962.47 115.431,2770.97C115.431,2770.97 115.431,775.73 115.431,775.73C115.431,584.229 270.906,428.755 462.407,428.755C462.407,428.755 3080.9,428.755 3080.9,428.755C3272.4,428.755 3427.88,584.229 3427.88,775.73ZM796.24,1322.76L796.24,1250.45C796.24,1199.03 836.16,1157.27 885.331,1157.27C885.331,1157.27 946.847,1157.27 946.847,1157.27C996.017,1157.27 1035.94,1199.03 1035.94,1250.45L1035.94,1644.81L2507.37,1644.81L2507.37,1250.45C2507.37,1199.03 2547.29,1157.27 2596.46,1157.27C2596.46,1157.27 2657.98,1157.27 2657.98,1157.27C2707.15,1157.27 2747.07,1199.03 2747.07,1250.45L2747.07,1322.76C2756.66,1319.22 2767.02,1317.29 2777.83,1317.29C2777.83,1317.29 2839.34,1317.29 2839.34,1317.29C2888.51,1317.29 2928.43,1357.21 2928.43,1406.38L2928.43,1527.32C2933.51,1526.26 2938.77,1525.71 2944.16,1525.71L2995.3,1525.71C3036.18,1525.71 3069.37,1557.59 3069.37,1596.86C3069.37,1596.86 3069.37,1946.44 3069.37,1946.44C3069.37,1985.72 3036.18,2017.6 2995.3,2017.6C2995.3,2017.6 2944.16,2017.6 2944.16,2017.6C2938.77,2017.6 2933.51,2017.04 2928.43,2015.99L2928.43,2136.92C2928.43,2186.09 2888.51,2226.01 2839.34,2226.01L2777.83,2226.01C2767.02,2226.01 2756.66,2224.08 2747.07,2220.55L2747.07,2292.85C2747.07,2344.28 2707.15,2386.03 2657.98,2386.03C2657.98,2386.03 2596.46,2386.03 2596.46,2386.03C2547.29,2386.03 2507.37,2344.28 2507.37,2292.85L2507.37,1898.5L1035.94,1898.5L1035.94,2292.85C1035.94,2344.28 996.017,2386.03 946.847,2386.03C946.847,2386.03 885.331,2386.03 885.331,2386.03C836.16,2386.03 796.24,2344.28 796.24,2292.85L796.24,2220.55C786.651,2224.08 776.29,2226.01 765.482,2226.01L703.967,2226.01C654.796,2226.01 614.876,2186.09 614.876,2136.92L614.876,2015.99C609.801,2017.04 604.539,2017.6 599.144,2017.6C599.144,2017.6 548.003,2017.6 548.003,2017.6C507.125,2017.6 473.937,1985.72 473.937,1946.44C473.937,1946.44 473.937,1596.86 473.937,1596.86C473.937,1557.59 507.125,1525.71 548.003,1525.71L599.144,1525.71C604.539,1525.71 609.801,1526.26 614.876,1527.32L614.876,1406.38C614.876,1357.21 654.796,1317.29 703.967,1317.29C703.967,1317.29 765.482,1317.29 765.482,1317.29C776.29,1317.29 786.651,1319.22 796.24,1322.76ZM977.604,1250.45C977.604,1232.7 963.822,1218.29 946.847,1218.29L885.331,1218.29C868.355,1218.29 854.573,1232.7 854.573,1250.45L854.573,2292.85C854.573,2310.61 868.355,2325.02 885.331,2325.02L946.847,2325.02C963.822,2325.02 977.604,2310.61 977.604,2292.85L977.604,1250.45ZM2565.7,1250.45C2565.7,1232.7 2579.49,1218.29 2596.46,1218.29L2657.98,1218.29C2674.95,1218.29 2688.73,1232.7 2688.73,1250.45L2688.73,2292.85C2688.73,2310.61 2674.95,2325.02 2657.98,2325.02L2596.46,2325.02C2579.49,2325.02 2565.7,2310.61 2565.7,2292.85L2565.7,1250.45ZM673.209,1406.38L673.209,2136.92C673.209,2153.9 686.991,2167.68 703.967,2167.68L765.482,2167.68C782.458,2167.68 796.24,2153.9 796.24,2136.92L796.24,1406.38C796.24,1389.41 782.458,1375.63 765.482,1375.63L703.967,1375.63C686.991,1375.63 673.209,1389.41 673.209,1406.38ZM2870.1,1406.38L2870.1,2136.92C2870.1,2153.9 2856.32,2167.68 2839.34,2167.68L2777.83,2167.68C2760.85,2167.68 2747.07,2153.9 2747.07,2136.92L2747.07,1406.38C2747.07,1389.41 2760.85,1375.63 2777.83,1375.63L2839.34,1375.63C2856.32,1375.63 2870.1,1389.41 2870.1,1406.38ZM614.876,1577.5C610.535,1574.24 605.074,1572.3 599.144,1572.3L548.003,1572.3C533.89,1572.3 522.433,1583.3 522.433,1596.86L522.433,1946.44C522.433,1960 533.89,1971.01 548.003,1971.01L599.144,1971.01C605.074,1971.01 610.535,1969.07 614.876,1965.81L614.876,1577.5ZM2928.43,1965.81L2928.43,1577.5C2932.77,1574.24 2938.23,1572.3 2944.16,1572.3L2995.3,1572.3C3009.42,1572.3 3020.87,1583.3 3020.87,1596.86L3020.87,1946.44C3020.87,1960 3009.42,1971.01 2995.3,1971.01L2944.16,1971.01C2938.23,1971.01 2932.77,1969.07 2928.43,1965.81ZM2507.37,1703.14L1035.94,1703.14L1035.94,1840.16L2507.37,1840.16L2507.37,1898.38L2507.37,1659.46L2507.37,1703.14Z"})}),N_e=fc({displayName:"UnifiedCanvasIcon",viewBox:"0 0 3544 3544",path:g.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3543.31,770.787C3543.31,515.578 3336.11,308.38 3080.9,308.38L462.407,308.38C207.197,308.38 -0,515.578 -0,770.787L-0,2766.03C-0,3021.24 207.197,3228.44 462.407,3228.44L3080.9,3228.44C3336.11,3228.44 3543.31,3021.24 3543.31,2766.03C3543.31,2766.03 3543.31,770.787 3543.31,770.787ZM922.933,3113.01L462.407,3113.01C437.741,3113.01 413.674,3110.43 390.453,3105.52L390.453,2899.11L922.933,2899.11L922.933,3113.01ZM947.933,2899.11L947.933,3113.01L1480.41,3113.01L1480.41,2899.11L947.933,2899.11ZM1505.41,2899.11L1505.41,3113.01L2037.89,3113.01L2037.89,2899.11L1505.41,2899.11ZM2062.89,2899.11L2062.89,3113.01L2595.37,3113.01L2595.37,2899.11L2062.89,2899.11ZM3152.85,3105.52C3129.63,3110.43 3105.57,3113.01 3080.9,3113.01L2620.37,3113.01L2620.37,2899.11L3152.85,2899.11L3152.85,3105.52ZM365.453,3099.26L365.408,3099.24C354.521,3096.07 343.79,3092.37 333.266,3088.14C315.377,3080.95 298.094,3072.26 281.651,3062.2C263.114,3050.85 245.648,3037.77 229.544,3023.17C213.34,3008.49 198.518,2992.28 185.34,2974.83C174.102,2959.94 164.06,2944.16 155.353,2927.66C150.517,2918.5 146.102,2909.13 142.102,2899.57L141.91,2899.11L365.453,2899.11L365.453,3099.26ZM3401.4,2899.11C3361.33,2995.39 3279.12,3069.8 3177.85,3099.26L3177.85,2899.11L3401.4,2899.11ZM132.624,2874.11C121.465,2840.08 115.431,2803.76 115.431,2766.03L115.431,2341.63L365.453,2341.63L365.453,2874.11L132.624,2874.11ZM922.933,918.103L922.933,669.193L390.453,669.193L390.453,1201.67L731.014,1201.67L731.014,1226.67L390.453,1226.67L390.453,1759.15L731.014,1759.15L731.014,1784.15L390.453,1784.15L390.453,2316.63L731.014,2316.63L731.014,2341.63L390.453,2341.63L390.453,2874.11L922.933,2874.11L922.933,2625.2C931.122,2627.1 939.463,2628.6 947.933,2629.66L947.933,2874.11L1480.41,2874.11L1480.41,2631.62L1505.41,2631.62L1505.41,2874.11L2037.89,2874.11L2037.89,2631.62L2062.89,2631.62L2062.89,2874.11L2595.37,2874.11L2595.37,2629.66C2603.85,2628.6 2612.18,2627.1 2620.37,2625.2L2620.37,2874.11L3152.85,2874.11L3152.85,2341.63L2812.29,2341.63L2812.29,2316.63L3152.85,2316.63L3152.85,1784.15L2812.29,1784.15L2812.29,1759.15L3152.85,1759.15L3152.85,1226.67L2812.29,1226.67L2812.29,1201.67L3152.85,1201.67L3152.85,669.193L2620.37,669.193L2620.37,918.103C2612.18,916.203 2603.84,914.708 2595.37,913.642L2595.37,669.193L2062.89,669.193L2062.89,911.688L2037.89,911.688L2037.89,669.193L1505.41,669.193L1505.41,911.688L1480.41,911.688L1480.41,669.193L947.933,669.193L947.933,913.642C939.462,914.708 931.123,916.203 922.933,918.103ZM3427.88,2341.63L3427.88,2766.03C3427.88,2803.76 3421.84,2840.08 3410.68,2874.11L3177.85,2874.11L3177.85,2341.63L3427.88,2341.63ZM2494.01,2603.04L2524.53,2603.04C2541.26,2603.04 2557.62,2601.44 2573.47,2598.39L2598.02,2593.66L2588.56,2544.56L2564.01,2549.29C2551.23,2551.75 2538.03,2553.04 2524.53,2553.04L2494.01,2553.04L2494.01,2603.04ZM1294.01,2603.04L1394.01,2603.04L1394.01,2553.04L1294.01,2553.04L1294.01,2603.04ZM1894.01,2603.04L1994.01,2603.04L1994.01,2553.04L1894.01,2553.04L1894.01,2603.04ZM2194.01,2603.04L2294.01,2603.04L2294.01,2553.04L2194.01,2553.04L2194.01,2603.04ZM1144.01,2603.04L1244.01,2603.04L1244.01,2553.04L1144.01,2553.04L1144.01,2603.04ZM1444.01,2603.04L1544.01,2603.04L1544.01,2553.04L1444.01,2553.04L1444.01,2603.04ZM1594.01,2603.04L1694.01,2603.04L1694.01,2553.04L1594.01,2553.04L1594.01,2603.04ZM2344.01,2603.04L2444.01,2603.04L2444.01,2553.04L2344.01,2553.04L2344.01,2603.04ZM2044.01,2603.04L2144.01,2603.04L2144.01,2553.04L2044.01,2553.04L2044.01,2603.04ZM994.01,2603.04L1094.01,2603.04L1094.01,2553.04L994.01,2553.04L994.01,2603.04ZM1744.01,2603.04L1844.01,2603.04L1844.01,2553.04L1744.01,2553.04L1744.01,2603.04ZM864.145,2551.46C878.835,2562.5 894.741,2572 911.624,2579.74L934.352,2590.15L955.18,2544.7L932.452,2534.28C918.844,2528.05 906.024,2520.39 894.185,2511.49L874.199,2496.47L844.16,2536.44L864.145,2551.46ZM2674.44,2554.92C2689.46,2544.16 2703.28,2531.82 2715.65,2518.14L2732.42,2499.61L2695.35,2466.06L2678.58,2484.6C2668.59,2495.63 2657.44,2505.59 2645.32,2514.28L2625,2528.84L2654.12,2569.48L2674.44,2554.92ZM865.632,1911.31L1339.59,1374.15L2030.89,2134.59L2392.97,1713.77L2677.68,2017.9L2677.68,2324.93C2677.68,2424.23 2597.06,2504.85 2497.76,2504.85C2497.76,2504.85 1045.55,2504.85 1045.55,2504.85C946.251,2504.85 865.632,2424.23 865.632,2324.93L865.632,1911.31ZM771.251,2417.22C776.455,2435.14 783.552,2452.26 792.313,2468.35L804.27,2490.3L848.18,2466.39L836.223,2444.43C829.171,2431.49 823.457,2417.7 819.268,2403.28L812.297,2379.27L764.28,2393.21L771.251,2417.22ZM2770.36,2422.83C2775.83,2405.47 2779.52,2387.33 2781.2,2368.61L2783.43,2343.71L2733.64,2339.24L2731.4,2364.14C2730.05,2379.21 2727.08,2393.82 2722.67,2407.79L2715.15,2431.63L2762.84,2446.67L2770.36,2422.83ZM761.068,2236.12L761.068,2336.12L811.068,2336.12L811.068,2236.12L761.068,2236.12ZM3177.85,1784.15L3177.85,2316.63L3427.88,2316.63L3427.88,1784.15L3177.85,1784.15ZM115.431,1784.15L115.431,2316.63L365.453,2316.63L365.453,1784.15L115.431,1784.15ZM2782.24,2291.41L2782.24,2191.41L2732.24,2191.41L2732.24,2291.41L2782.24,2291.41ZM761.068,2086.12L761.068,2186.12L811.068,2186.12L811.068,2086.12L761.068,2086.12ZM2782.24,2141.41L2782.24,2041.4L2732.24,2041.4L2732.24,2141.41L2782.24,2141.41ZM761.068,1936.12L761.068,2036.12L811.068,2036.12L811.068,1936.12L761.068,1936.12ZM2782.24,1991.4L2782.24,1891.4L2732.24,1891.4L2732.24,1991.4L2782.24,1991.4ZM761.068,1786.12L761.068,1886.12L811.068,1886.12L811.068,1786.12L761.068,1786.12ZM2782.24,1841.4L2782.24,1741.41L2732.24,1741.41L2732.24,1841.4L2782.24,1841.4ZM3177.85,1226.67L3177.85,1759.15L3427.88,1759.15L3427.88,1226.67L3177.85,1226.67ZM115.431,1226.67L115.431,1759.15L365.453,1759.15L365.453,1226.67L115.431,1226.67ZM761.068,1636.12L761.068,1736.12L811.068,1736.12L811.068,1636.12L761.068,1636.12ZM2782.24,1691.41L2782.24,1591.41L2732.24,1591.41L2732.24,1691.41L2782.24,1691.41ZM761.068,1486.12L761.068,1586.12L811.068,1586.12L811.068,1486.12L761.068,1486.12ZM2203.72,1132.2C2318.18,1132.2 2411.11,1225.13 2411.11,1339.59C2411.11,1454.05 2318.18,1546.98 2203.72,1546.98C2089.26,1546.98 1996.33,1454.05 1996.33,1339.59C1996.33,1225.13 2089.26,1132.2 2203.72,1132.2ZM2782.24,1541.41L2782.24,1441.41L2732.24,1441.41L2732.24,1541.41L2782.24,1541.41ZM761.068,1336.12L761.068,1436.12L811.068,1436.12L811.068,1336.12L761.068,1336.12ZM2782.24,1391.41L2782.24,1291.41L2732.24,1291.41L2732.24,1391.41L2782.24,1391.41ZM761.068,1186.12L761.068,1286.12L811.068,1286.12L811.068,1186.12L761.068,1186.12ZM2732.24,1197.98L2732.24,1241.41L2782.24,1241.41L2782.24,1172.98L2781.03,1172.98C2780.06,1162.82 2778.49,1152.83 2776.36,1143.04L2771.04,1118.62L2722.18,1129.24L2727.5,1153.67C2730.61,1167.95 2732.24,1182.78 2732.24,1197.98ZM3412.74,669.193L3412.89,669.694C3414.66,675.5 3416.28,681.348 3417.73,687.238C3420.46,698.265 3422.65,709.427 3424.28,720.67C3425.85,731.554 3426.91,742.513 3427.45,753.497C3427.74,759.256 3427.87,765.021 3427.88,770.787L3427.88,1201.67L3177.85,1201.67L3177.85,669.193L3412.74,669.193ZM115.431,1201.67L115.431,770.787C115.436,765.021 115.572,759.256 115.855,753.497C116.395,742.513 117.453,731.554 119.031,720.67C120.66,709.427 122.844,698.265 125.574,687.238C127.032,681.348 128.65,675.5 130.414,669.694L130.567,669.193L365.453,669.193L365.453,1201.67L115.431,1201.67ZM804.386,1055C794.186,1070.26 785.572,1086.67 778.777,1103.99L769.647,1127.26L816.194,1145.52L825.324,1122.25C830.797,1108.3 837.738,1095.08 845.955,1082.79L859.848,1062L818.279,1034.21L804.386,1055ZM2730.5,1043.14C2719.39,1028.39 2706.73,1014.86 2692.77,1002.81L2673.84,986.48L2641.17,1024.34L2660.1,1040.67C2671.37,1050.39 2681.59,1061.31 2690.56,1073.22L2705.6,1093.19L2745.54,1063.11L2730.5,1043.14ZM933.266,954.821C915.698,961.006 898.998,969.041 883.402,978.694L862.144,991.851L888.457,1034.37L909.715,1021.21C922.275,1013.44 935.723,1006.96 949.871,1001.98L973.452,993.681L956.848,946.518L933.266,954.821ZM2596.18,950.378C2578.71,945.327 2560.49,942.072 2541.72,940.832L2516.78,939.183L2513.48,989.074L2538.43,990.723C2553.54,991.722 2568.22,994.341 2582.28,998.409L2606.3,1005.36L2620.19,957.325L2596.18,950.378ZM2165.09,940.265L2065.09,940.265L2065.09,990.265L2165.09,990.265L2165.09,940.265ZM1865.08,940.265L1765.08,940.265L1765.08,990.265L1865.08,990.265L1865.08,940.265ZM1115.08,940.265L1015.08,940.265L1015.08,990.265L1115.08,990.265L1115.08,940.265ZM2015.09,940.265L1915.09,940.265L1915.09,990.265L2015.09,990.265L2015.09,940.265ZM2315.09,940.265L2215.09,940.265L2215.09,990.265L2315.09,990.265L2315.09,940.265ZM1265.08,940.265L1165.08,940.265L1165.08,990.265L1265.08,990.265L1265.08,940.265ZM1415.08,940.265L1315.08,940.265L1315.08,990.265L1415.08,990.265L1415.08,940.265ZM1565.08,940.265L1465.08,940.265L1465.08,990.265L1565.08,990.265L1565.08,940.265ZM1715.08,940.265L1615.08,940.265L1615.08,990.265L1715.08,990.265L1715.08,940.265ZM2465.09,940.265L2365.09,940.265L2365.09,990.265L2465.09,990.265L2465.09,940.265ZM365.453,437.562L365.453,644.193L139.286,644.193C178.303,544.782 261.917,467.677 365.453,437.562ZM922.933,423.812L922.933,644.193L390.453,644.193L390.453,431.295C413.674,426.391 437.741,423.812 462.407,423.812L922.933,423.812ZM947.933,423.812L947.933,644.193L1480.41,644.193L1480.41,423.812L947.933,423.812ZM1505.41,423.812L1505.41,644.193L2037.89,644.193L2037.89,423.812L1505.41,423.812ZM2062.89,423.812L2062.89,644.193L2595.37,644.193L2595.37,423.812L2062.89,423.812ZM2620.37,423.812L3080.9,423.812C3105.57,423.812 3129.63,426.391 3152.85,431.295L3152.85,644.193L2620.37,644.193L2620.37,423.812ZM3177.85,437.562C3281.38,467.669 3365,544.774 3404.02,644.193L3177.85,644.193L3177.85,437.562Z"})}),Ye=Ze((e,t)=>{const{tooltip:n="",styleClass:r,tooltipProps:i,asCheckbox:o,isChecked:a,...s}=e;return g.jsx(si,{label:n,hasArrow:!0,...i,...i!=null&&i.placement?{placement:i.placement}:{placement:"top"},children:g.jsx(ls,{ref:t,className:r?`invokeai__icon-button ${r}`:"invokeai__icon-button","data-as-checkbox":o,"data-selected":a!==void 0?a:void 0,...s})})}),On=Ze((e,t)=>{const{children:n,tooltip:r="",tooltipProps:i,styleClass:o,...a}=e;return g.jsx(si,{label:r,...i,children:g.jsx(ss,{ref:t,className:["invokeai__button",o].join(" "),...a,children:n})})}),Ys=e=>{const{triggerComponent:t,children:n,styleClass:r,hasArrow:i=!0,...o}=e;return g.jsxs(V8,{...o,children:[g.jsx(U8,{children:t}),g.jsxs(q8,{className:`invokeai__popover-content ${r}`,children:[i&&g.jsx(G8,{className:"invokeai__popover-arrow"}),n]})]})},d4=lt(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:Ce.isEqual}}),Jo=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:i,tooltipProps:o,size:a="sm",fontSize:s="sm",styleClass:l,...u}=e;return g.jsxs(sn,{isDisabled:n,className:`invokeai__select ${l}`,onClick:d=>{d.stopPropagation(),d.nativeEvent.stopImmediatePropagation(),d.nativeEvent.stopPropagation(),d.nativeEvent.cancelBubble=!0},children:[t&&g.jsx(Sn,{className:"invokeai__select-label",fontSize:s,fontWeight:"bold",marginRight:0,marginBottom:0,whiteSpace:"nowrap",children:t}),g.jsx(si,{label:i,...o,children:g.jsx(qH,{className:"invokeai__select-picker",fontSize:s,size:a,...u,children:r.map(d=>typeof d=="string"||typeof d=="number"?g.jsx("option",{value:d,className:"invokeai__select-option",children:d},d):g.jsx("option",{value:d.value,className:"invokeai__select-option",children:d.key},d.value))})})]})};function $_e(){const e=le(i=>i.postprocessing.facetoolType),t=Te(),{t:n}=De(),r=i=>t(dS(i.target.value));return g.jsx(Jo,{label:n("parameters.type"),validValues:j5e.concat(),value:e,onChange:r})}var UV={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},MI=Ke.createContext&&Ke.createContext(UV),Bd=globalThis&&globalThis.__assign||function(){return Bd=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{_e(i)},[i]);const we=S.useMemo(()=>V!=null&&V.max?V.max:a,[a,V==null?void 0:V.max]),xe=Xe=>{l(Xe)},Le=Xe=>{Xe.target.value===""&&(Xe.target.value=String(o));const tt=Ce.clamp(w?Math.floor(Number(Xe.target.value)):Number(fe),o,we);l(tt)},Se=Xe=>{_e(Xe)},Je=()=>{O&&O()};return g.jsxs(sn,{className:W?`invokeai__slider-component ${W}`:"invokeai__slider-component","data-markers":p,style:L?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:"1rem",margin:0,padding:0}:{},...B,children:[g.jsx(Sn,{className:"invokeai__slider-component-label",fontSize:"sm",...K,children:r}),g.jsxs(l2,{w:"100%",gap:2,alignItems:"center",children:[g.jsxs(QH,{"aria-label":r,value:i,min:o,max:a,step:s,onChange:xe,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:I,width:u,...ee,children:[p&&g.jsxs(g.Fragment,{children:[g.jsx(tk,{value:o,className:"invokeai__slider-mark invokeai__slider-mark-start",ml:m,...ne,children:o}),g.jsx(tk,{value:a,className:"invokeai__slider-mark invokeai__slider-mark-end",ml:y,...ne,children:a})]}),g.jsx(eW,{className:"invokeai__slider_track",...z,children:g.jsx(tW,{className:"invokeai__slider_track-filled"})}),g.jsx(si,{hasArrow:!0,className:"invokeai__slider-component-tooltip",placement:"top",isOpen:t,label:`${i}${d}`,hidden:T,...G,children:g.jsx(JH,{className:"invokeai__slider-thumb",...$})})]}),b&&g.jsxs(B8,{min:o,max:we,step:s,value:fe,onChange:Se,onBlur:Le,className:"invokeai__slider-number-field",isDisabled:N,...V,children:[g.jsx(z8,{className:"invokeai__slider-number-input",width:E,readOnly:_,minWidth:E,...X}),g.jsxs(BH,{...Q,children:[g.jsx(W8,{onClick:()=>l(Number(fe)),className:"invokeai__slider-number-stepper"}),g.jsx(H8,{onClick:()=>l(Number(fe)),className:"invokeai__slider-number-stepper"})]})]}),k&&g.jsx(Ye,{size:"sm","aria-label":"Reset",tooltip:"Reset",icon:g.jsx(f4,{}),onClick:Je,isDisabled:D,...Y})]})]})}function G_e(){const e=le(i=>i.system.isGFPGANAvailable),t=le(i=>i.postprocessing.facetoolStrength),{t:n}=De(),r=Te();return g.jsx(Dn,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.strength"),step:.05,min:0,max:1,onChange:i=>r(k3(i)),handleReset:()=>r(k3(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function q_e(){const e=le(i=>i.system.isGFPGANAvailable),t=le(i=>i.postprocessing.codeformerFidelity),{t:n}=De(),r=Te();return g.jsx(Dn,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.codeformerFidelity"),step:.05,min:0,max:1,onChange:i=>r(xk(i)),handleReset:()=>r(xk(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const RE=()=>{const e=le(t=>t.postprocessing.facetoolType);return g.jsxs(Ee,{direction:"column",gap:2,minWidth:"20rem",children:[g.jsx($_e,{}),g.jsx(G_e,{}),e==="codeformer"&&g.jsx(q_e,{})]})};function K_e(){const e=le(i=>i.system.isESRGANAvailable),t=le(i=>i.postprocessing.upscalingDenoising),{t:n}=De(),r=Te();return g.jsx(Dn,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:i=>{r(Sk(i))},handleReset:()=>r(Sk(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function Y_e(){const e=le(i=>i.system.isESRGANAvailable),t=le(i=>i.postprocessing.upscalingStrength),{t:n}=De(),r=Te();return g.jsx(Dn,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:i=>r(wk(i)),handleReset:()=>r(wk(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function X_e(){const e=le(o=>o.system.isESRGANAvailable),t=le(o=>o.postprocessing.upscalingLevel),{t:n}=De(),r=Te(),i=o=>r(xU(Number(o.target.value)));return g.jsx(Jo,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:i,validValues:D5e})}const IE=()=>g.jsxs(Ee,{flexDir:"column",rowGap:2,minWidth:"20rem",children:[g.jsx(X_e,{}),g.jsx(K_e,{}),g.jsx(Y_e,{})]}),DE=e=>e.postprocessing,hr=e=>e.system,Z_e=e=>e.system.toastQueue,qV=lt(hr,e=>{const{model_list:t}=e,n=Ce.reduce(t,(r,i,o)=>(i.status==="active"&&(r=o),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:Ce.isEqual}}),Q_e=lt(hr,e=>{const{model_list:t}=e;return Ce.pickBy(t,(r,i)=>{if(r.format==="diffusers")return{name:i,...r}})},{memoizeOptions:{resultEqualityCheck:Ce.isEqual}});function Vk(){return Vk=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var ake=function(t,n,r){r===void 0&&(r=!1);var i=n.alt,o=n.meta,a=n.mod,s=n.shift,l=n.ctrl,u=n.keys,d=t.key,p=t.code,m=t.ctrlKey,y=t.metaKey,b=t.shiftKey,w=t.altKey,E=kd(p),_=d.toLowerCase();if(!r){if(i===!w&&_!=="alt"||s===!b&&_!=="shift")return!1;if(a){if(!y&&!m)return!1}else if(o===!y&&_!=="meta"||l===!m&&_!=="ctrl")return!1}return u&&u.length===1&&(u.includes(_)||u.includes(E))?!0:u?tke(u):!u},ske=S.createContext(void 0),lke=function(){return S.useContext(ske)};function QV(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&QV(e[r],t[r])},!0):e===t}var uke=S.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),cke=function(){return S.useContext(uke)};function dke(e){var t=S.useRef(void 0);return QV(t.current,e)||(t.current=e),t.current}var LI=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},fke=typeof window<"u"?S.useLayoutEffect:S.useEffect;function Qe(e,t,n,r){var i=S.useRef(null),o=S.useRef(!1),a=n instanceof Array?r instanceof Array?void 0:r:n,s=n instanceof Array?n:r instanceof Array?r:void 0,l=S.useCallback(t,s??[]),u=S.useRef(l);s?u.current=l:u.current=t;var d=dke(a),p=cke(),m=p.enabledScopes,y=lke();return fke(function(){if(!((d==null?void 0:d.enabled)===!1||!oke(m,d==null?void 0:d.scopes))){var b=function(k,T){var L;if(T===void 0&&(T=!1),!(ike(k)&&!ZV(k,d==null?void 0:d.enableOnFormTags))){if(i.current!==null&&document.activeElement!==i.current&&!i.current.contains(document.activeElement)){LI(k);return}(L=k.target)!=null&&L.isContentEditable&&!(d!=null&&d.enableOnContentEditable)||XC(e,d==null?void 0:d.splitKey).forEach(function(O){var D,I=ZC(O,d==null?void 0:d.combinationKey);if(ake(k,I,d==null?void 0:d.ignoreModifiers)||(D=I.keys)!=null&&D.includes("*")){if(T&&o.current)return;if(nke(k,I,d==null?void 0:d.preventDefault),!rke(k,I,d==null?void 0:d.enabled)){LI(k);return}u.current(k,I),T||(o.current=!0)}})}},w=function(k){k.key!==void 0&&(YV(kd(k.code)),((d==null?void 0:d.keydown)===void 0&&(d==null?void 0:d.keyup)!==!0||d!=null&&d.keydown)&&b(k))},E=function(k){k.key!==void 0&&(XV(kd(k.code)),o.current=!1,d!=null&&d.keyup&&b(k,!0))};return(i.current||(a==null?void 0:a.document)||document).addEventListener("keyup",E),(i.current||(a==null?void 0:a.document)||document).addEventListener("keydown",w),y&&XC(e,d==null?void 0:d.splitKey).forEach(function(_){return y.addHotkey(ZC(_,d==null?void 0:d.combinationKey))}),function(){(i.current||(a==null?void 0:a.document)||document).removeEventListener("keyup",E),(i.current||(a==null?void 0:a.document)||document).removeEventListener("keydown",w),y&&XC(e,d==null?void 0:d.splitKey).forEach(function(_){return y.removeHotkey(ZC(_,d==null?void 0:d.combinationKey))})}}},[e,d,m]),i}function hke(e){return ut({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function pke(e){return ut({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function gke(e){return ut({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"}}]})(e)}function JV(e){return ut({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function eG(e){return ut({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function mke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function vke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function tG(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function yke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function bke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function jE(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function nG(e){return ut({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function e0(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function rG(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function xke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function NE(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function iG(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function Ske(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 344v112a23.94 23.94 0 0 1-24 24H312c-21.39 0-32.09-25.9-17-41l36.2-36.2L224 295.6 116.77 402.9 153 439c15.09 15.1 4.39 41-17 41H24a23.94 23.94 0 0 1-24-24V344c0-21.4 25.89-32.1 41-17l36.19 36.2L184.46 256 77.18 148.7 41 185c-15.1 15.1-41 4.4-41-17V56a23.94 23.94 0 0 1 24-24h112c21.39 0 32.09 25.9 17 41l-36.2 36.2L224 216.4l107.23-107.3L295 73c-15.09-15.1-4.39-41 17-41h112a23.94 23.94 0 0 1 24 24v112c0 21.4-25.89 32.1-41 17l-36.19-36.2L263.54 256l107.28 107.3L407 327.1c15.1-15.2 41-4.5 41 16.9z"}}]})(e)}function wke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function oG(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function Cke(e){return ut({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function _ke(e){return ut({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function aG(e){return ut({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function kke(e){return ut({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM94.6 168.9l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.2 1 8.9 8.6 4.3 13.2l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L152 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.6-4.7-1.9-12.3 4.3-13.3zM248 432c-60.6 0-134.5-38.3-143.8-93.3-2-11.8 9.3-21.5 20.7-17.9C155.1 330.5 200 336 248 336s92.9-5.5 123.1-15.2c11.5-3.7 22.6 6.1 20.7 17.9-9.3 55-83.2 93.3-143.8 93.3zm157.7-249.9l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L344 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.5-4.6-1.9-12.2 4.3-13.2l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.3.9 9 8.5 4.4 13.1z"}}]})(e)}function Eke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function Pke(e){return ut({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function Tke(e){return ut({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"}}]})(e)}function sG(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function Mke(e){return ut({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function Lke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function lG(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function Ake(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)}function Oke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function y2(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function Rke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function Ike(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(e)}function Dke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function $E(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function jke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function Nke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"}}]})(e)}function AI(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function FE(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function $ke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"}}]})(e)}function hp(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function Fke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function h4(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Bke(e){return ut({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"}}]})(e)}function BE(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}const rn=e=>e.canvas,Lr=lt([rn,Br,hr],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),uG=e=>e.canvas.layerState.objects.find(x3),pp=e=>e.gallery,zke=lt([pp,d4,Lr,Br],(e,t,n,r)=>{const{categories:i,currentCategory:o,currentImageUuid:a,shouldPinGallery:s,shouldShowGallery:l,galleryScrollPosition:u,galleryImageMinimumWidth:d,galleryImageObjectFit:p,shouldHoldGalleryOpen:m,shouldAutoSwitchToNewImages:y,galleryWidth:b,shouldUseSingleGalleryColumn:w}=e,{isLightboxOpen:E}=t;return{currentImageUuid:a,shouldPinGallery:s,shouldShowGallery:l,galleryScrollPosition:u,galleryImageMinimumWidth:d,galleryImageObjectFit:p,galleryGridTemplateColumns:w?"auto":`repeat(auto-fill, minmax(${d}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:m,shouldAutoSwitchToNewImages:y,images:i[o].images,areMoreImagesAvailable:i[o].areMoreImagesAvailable,currentCategory:o,galleryWidth:b,isLightboxOpen:E,isStaging:n,shouldEnableResize:!(E||r==="unifiedCanvas"&&s),shouldUseSingleGalleryColumn:w}},{memoizeOptions:{resultEqualityCheck:Ce.isEqual}}),Hke=lt([pp,hr,d4,Br],(e,t,n,r)=>({mayDeleteImage:t.isConnected&&!t.isProcessing,galleryImageObjectFit:e.galleryImageObjectFit,galleryImageMinimumWidth:e.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:e.shouldUseSingleGalleryColumn,activeTabName:r,isLightboxOpen:n.isLightboxOpen}),{memoizeOptions:{resultEqualityCheck:Ce.isEqual}}),Wke=lt(hr,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:Ce.isEqual}}),A3=S.forwardRef(({image:e,children:t},n)=>{const{isOpen:r,onOpen:i,onClose:o}=Kd(),a=Te(),{shouldConfirmOnDelete:s,isConnected:l,isProcessing:u}=le(Wke),d=S.useRef(null),p=b=>{b.stopPropagation(),s?i():m()},m=()=>{l&&!u&&e&&a(f_e(e)),o()};Qe("delete",()=>{s?i():m()},[e,s,l,u]);const y=b=>a(jU(!b.target.checked));return g.jsxs(g.Fragment,{children:[S.cloneElement(t,{onClick:e?p:void 0,ref:n}),g.jsx($H,{isOpen:r,leastDestructiveRef:d,onClose:o,children:g.jsx(oc,{children:g.jsxs(FH,{className:"modal",children:[g.jsx(op,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),g.jsx(Zm,{children:g.jsxs(Ee,{direction:"column",gap:5,children:[g.jsx(Dt,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),g.jsx(sn,{children:g.jsxs(Ee,{alignItems:"center",children:[g.jsx(Sn,{mb:0,children:"Don't ask me again"}),g.jsx(K8,{checked:!s,onChange:y})]})})]})}),g.jsxs(zw,{children:[g.jsx(ss,{ref:d,onClick:o,className:"modal-close-btn",children:"Cancel"}),g.jsx(ss,{colorScheme:"red",onClick:m,ml:3,children:"Delete"})]})]})})})]})});A3.displayName="DeleteImageModal";const zE=()=>{const e=Te();return t=>{const n=typeof t=="string"?t:Rm(t),[r,i]=nU(n);e(cU(r)),e(dU(i))}},Uke=lt([hr,pp,DE,fp,d4,Br],(e,t,n,r,i,o)=>{const{isProcessing:a,isConnected:s,isGFPGANAvailable:l,isESRGANAvailable:u}=e,{upscalingLevel:d,facetoolStrength:p}=n,{isLightboxOpen:m}=i,{shouldShowImageDetails:y}=r,{intermediateImage:b,currentImage:w}=t;return{isProcessing:a,isConnected:s,isGFPGANAvailable:l,isESRGANAvailable:u,upscalingLevel:d,facetoolStrength:p,shouldDisableToolbarButtons:Boolean(b)||!w,currentImage:w,shouldShowImageDetails:y,activeTabName:o,isLightboxOpen:m}},{memoizeOptions:{resultEqualityCheck:Ce.isEqual}}),cG=()=>{var B,K,ne,z,$,V,X,Q;const e=Te(),{isProcessing:t,isConnected:n,isGFPGANAvailable:r,isESRGANAvailable:i,upscalingLevel:o,facetoolStrength:a,shouldDisableToolbarButtons:s,shouldShowImageDetails:l,currentImage:u,isLightboxOpen:d,activeTabName:p}=le(Uke),m=a2(),{t:y}=De(),b=zE(),w=()=>{u&&(d&&e(Om(!1)),e(y0(u)),e(Wo("img2img")))},E=async()=>{if(!u)return;const G=await fetch(u.url).then(ee=>ee.blob()),Y=[new ClipboardItem({[G.type]:G})];await navigator.clipboard.write(Y),m({title:y("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},_=()=>{navigator.clipboard.writeText(u?window.location.toString()+u.url:"").then(()=>{m({title:y("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};Qe("shift+i",()=>{u?(w(),m({title:y("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):m({title:y("toast.imageNotLoaded"),description:y("toast.imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})},[u]);const k=()=>{u!=null&&u.metadata&&(e(sU(u.metadata)),e(yU(u.metadata)),u.metadata.image.type==="img2img"?e(Wo("img2img")):u.metadata.image.type==="txt2img"&&e(Wo("txt2img")))};Qe("a",()=>{var G,Y;["txt2img","img2img"].includes((Y=(G=u==null?void 0:u.metadata)==null?void 0:G.image)==null?void 0:Y.type)?(k(),m({title:y("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})):m({title:y("toast.parametersNotSet"),description:y("toast.parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[u]);const T=()=>{u!=null&&u.metadata&&e(p2(u.metadata.image.seed))};Qe("s",()=>{var G,Y;(Y=(G=u==null?void 0:u.metadata)==null?void 0:G.image)!=null&&Y.seed?(T(),m({title:y("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):m({title:y("toast.seedNotSet"),description:y("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[u]);const L=S.useCallback(()=>{var G,Y,ee,fe;(Y=(G=u==null?void 0:u.metadata)==null?void 0:G.image)!=null&&Y.prompt&&b((fe=(ee=u==null?void 0:u.metadata)==null?void 0:ee.image)==null?void 0:fe.prompt)},[(K=(B=u==null?void 0:u.metadata)==null?void 0:B.image)==null?void 0:K.prompt,b]);Qe("p",()=>{var G,Y;(Y=(G=u==null?void 0:u.metadata)==null?void 0:G.image)!=null&&Y.prompt?(L(),m({title:y("toast.promptSet"),status:"success",duration:2500,isClosable:!0})):m({title:y("toast.promptNotSet"),description:y("toast.promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[u]);const O=()=>{u&&e(c_e(u))};Qe("Shift+U",()=>{i&&!s&&n&&!t&&o?O():m({title:y("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[u,i,s,n,t,o]);const D=()=>{u&&e(d_e(u))};Qe("Shift+R",()=>{r&&!s&&n&&!t&&a?D():m({title:y("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[u,r,s,n,t,a]);const I=()=>e(zU(!l)),N=()=>{u&&(d&&e(Om(!1)),e(i4(u)),e(Li(!0)),p!=="unifiedCanvas"&&e(Wo("unifiedCanvas")),m({title:y("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};Qe("i",()=>{u?I():m({title:y("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[u,l]);const W=()=>{e(Om(!d))};return g.jsxs("div",{className:"current-image-options",children:[g.jsxs(Gi,{isAttached:!0,children:[g.jsx(Ys,{trigger:"hover",triggerComponent:g.jsx(Ye,{"aria-label":`${y("parameters.sendTo")}...`,icon:g.jsx(Nke,{})}),children:g.jsxs("div",{className:"current-image-send-to-popover",children:[g.jsx(On,{size:"sm",onClick:w,leftIcon:g.jsx(AI,{}),children:y("parameters.sendToImg2Img")}),g.jsx(On,{size:"sm",onClick:N,leftIcon:g.jsx(AI,{}),children:y("parameters.sendToUnifiedCanvas")}),g.jsx(On,{size:"sm",onClick:E,leftIcon:g.jsx(e0,{}),children:y("parameters.copyImage")}),g.jsx(On,{size:"sm",onClick:_,leftIcon:g.jsx(e0,{}),children:y("parameters.copyImageToLink")}),g.jsx(Nh,{download:!0,href:u==null?void 0:u.url,children:g.jsx(On,{leftIcon:g.jsx(NE,{}),size:"sm",w:"100%",children:y("parameters.downloadImage")})})]})}),g.jsx(Ye,{icon:g.jsx(wke,{}),tooltip:d?`${y("parameters.closeViewer")} (Z)`:`${y("parameters.openInViewer")} (Z)`,"aria-label":d?`${y("parameters.closeViewer")} (Z)`:`${y("parameters.openInViewer")} (Z)`,"data-selected":d,onClick:W})]}),g.jsxs(Gi,{isAttached:!0,children:[g.jsx(Ye,{icon:g.jsx(Rke,{}),tooltip:`${y("parameters.usePrompt")} (P)`,"aria-label":`${y("parameters.usePrompt")} (P)`,isDisabled:!((z=(ne=u==null?void 0:u.metadata)==null?void 0:ne.image)!=null&&z.prompt),onClick:L}),g.jsx(Ye,{icon:g.jsx(jke,{}),tooltip:`${y("parameters.useSeed")} (S)`,"aria-label":`${y("parameters.useSeed")} (S)`,isDisabled:!((V=($=u==null?void 0:u.metadata)==null?void 0:$.image)!=null&&V.seed),onClick:T}),g.jsx(Ye,{icon:g.jsx(yke,{}),tooltip:`${y("parameters.useAll")} (A)`,"aria-label":`${y("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((Q=(X=u==null?void 0:u.metadata)==null?void 0:X.image)==null?void 0:Q.type),onClick:k})]}),g.jsxs(Gi,{isAttached:!0,children:[g.jsx(Ys,{trigger:"hover",triggerComponent:g.jsx(Ye,{icon:g.jsx(kke,{}),"aria-label":y("parameters.restoreFaces")}),children:g.jsxs("div",{className:"current-image-postprocessing-popover",children:[g.jsx(RE,{}),g.jsx(On,{isDisabled:!r||!u||!(n&&!t)||!a,onClick:D,children:y("parameters.restoreFaces")})]})}),g.jsx(Ys,{trigger:"hover",triggerComponent:g.jsx(Ye,{icon:g.jsx(Ske,{}),"aria-label":y("parameters.upscale")}),children:g.jsxs("div",{className:"current-image-postprocessing-popover",children:[g.jsx(IE,{}),g.jsx(On,{isDisabled:!i||!u||!(n&&!t)||!o,onClick:O,children:y("parameters.upscaleImage")})]})})]}),g.jsx(Gi,{isAttached:!0,children:g.jsx(Ye,{icon:g.jsx(nG,{}),tooltip:`${y("parameters.info")} (I)`,"aria-label":`${y("parameters.info")} (I)`,"data-selected":l,onClick:I})}),g.jsx(A3,{image:u,children:g.jsx(Ye,{icon:g.jsx(hp,{}),tooltip:`${y("parameters.deleteImage")} (Del)`,"aria-label":`${y("parameters.deleteImage")} (Del)`,isDisabled:!u||!n||t,style:{backgroundColor:"var(--btn-delete-image)"}})})]})};var Vke=fc({displayName:"EditIcon",path:g.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[g.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),g.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),dG=fc({displayName:"ExternalLinkIcon",path:g.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[g.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),g.jsx("path",{d:"M15 3h6v6"}),g.jsx("path",{d:"M10 14L21 3"})]})}),Gke=fc({displayName:"DeleteIcon",path:g.jsx("g",{fill:"currentColor",children:g.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});function qke(e){return ut({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const Jn=({label:e,value:t,onClick:n,isLink:r,labelPosition:i,withCopy:o=!1})=>g.jsxs(Ee,{gap:2,children:[n&&g.jsx(si,{label:`Recall ${e}`,children:g.jsx(ls,{"aria-label":"Use this parameter",icon:g.jsx(qke,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),o&&g.jsx(si,{label:`Copy ${e}`,children:g.jsx(ls,{"aria-label":`Copy ${e}`,icon:g.jsx(e0,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),g.jsxs(Ee,{direction:i?"column":"row",children:[g.jsxs(Dt,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?g.jsxs(Nh,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",g.jsx(dG,{mx:"2px"})]}):g.jsx(Dt,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}),Kke=(e,t)=>e.image.uuid===t.image.uuid,HE=S.memo(({image:e,styleClass:t})=>{var B,K;const n=Te(),r=zE();Qe("esc",()=>{n(zU(!1))});const i=((B=e==null?void 0:e.metadata)==null?void 0:B.image)||{},o=e==null?void 0:e.dreamPrompt,{cfg_scale:a,fit:s,height:l,hires_fix:u,init_image_path:d,mask_image_path:p,orig_path:m,perlin:y,postprocessing:b,prompt:w,sampler:E,seamless:_,seed:k,steps:T,strength:L,threshold:O,type:D,variations:I,width:N}=i,W=JSON.stringify(e.metadata,null,2);return g.jsx("div",{className:`image-metadata-viewer ${t}`,children:g.jsxs(Ee,{gap:1,direction:"column",width:"100%",children:[g.jsxs(Ee,{gap:2,children:[g.jsx(Dt,{fontWeight:"semibold",children:"File:"}),g.jsxs(Nh,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,g.jsx(dG,{mx:"2px"})]})]}),Object.keys(i).length>0?g.jsxs(g.Fragment,{children:[D&&g.jsx(Jn,{label:"Generation type",value:D}),((K=e.metadata)==null?void 0:K.model_weights)&&g.jsx(Jn,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(D)&&g.jsx(Jn,{label:"Original image",value:m}),w&&g.jsx(Jn,{label:"Prompt",labelPosition:"top",value:typeof w=="string"?w:Rm(w),onClick:()=>r(w)}),k!==void 0&&g.jsx(Jn,{label:"Seed",value:k,onClick:()=>n(p2(k))}),O!==void 0&&g.jsx(Jn,{label:"Noise Threshold",value:O,onClick:()=>n(bk(O))}),y!==void 0&&g.jsx(Jn,{label:"Perlin Noise",value:y,onClick:()=>n(vk(y))}),E&&g.jsx(Jn,{label:"Sampler",value:E,onClick:()=>n(fU(E))}),T&&g.jsx(Jn,{label:"Steps",value:T,onClick:()=>n(yk(T))}),a!==void 0&&g.jsx(Jn,{label:"CFG scale",value:a,onClick:()=>n(gk(a))}),I&&I.length>0&&g.jsx(Jn,{label:"Seed-weight pairs",value:_3(I),onClick:()=>n(pU(_3(I)))}),_&&g.jsx(Jn,{label:"Seamless",value:_,onClick:()=>n(hU(_))}),u&&g.jsx(Jn,{label:"High Resolution Optimization",value:u,onClick:()=>n(bU(u))}),N&&g.jsx(Jn,{label:"Width",value:N,onClick:()=>n(cS(N))}),l&&g.jsx(Jn,{label:"Height",value:l,onClick:()=>n(uS(l))}),d&&g.jsx(Jn,{label:"Initial image",value:d,isLink:!0,onClick:()=>n(y0(d))}),p&&g.jsx(Jn,{label:"Mask image",value:p,isLink:!0,onClick:()=>n(uU(p))}),D==="img2img"&&L&&g.jsx(Jn,{label:"Image to image strength",value:L,onClick:()=>n(mk(L))}),s&&g.jsx(Jn,{label:"Image to image fit",value:s,onClick:()=>n(gU(s))}),b&&b.length>0&&g.jsxs(g.Fragment,{children:[g.jsx(jh,{size:"sm",children:"Postprocessing"}),b.map((ne,z)=>{if(ne.type==="esrgan"){const{scale:$,strength:V,denoise_str:X}=ne;return g.jsxs(Ee,{pl:"2rem",gap:1,direction:"column",children:[g.jsx(Dt,{size:"md",children:`${z+1}: Upscale (ESRGAN)`}),g.jsx(Jn,{label:"Scale",value:$,onClick:()=>n(xU($))}),g.jsx(Jn,{label:"Strength",value:V,onClick:()=>n(wk(V))}),X!==void 0&&g.jsx(Jn,{label:"Denoising strength",value:X,onClick:()=>n(Sk(X))})]},z)}else if(ne.type==="gfpgan"){const{strength:$}=ne;return g.jsxs(Ee,{pl:"2rem",gap:1,direction:"column",children:[g.jsx(Dt,{size:"md",children:`${z+1}: Face restoration (GFPGAN)`}),g.jsx(Jn,{label:"Strength",value:$,onClick:()=>{n(k3($)),n(dS("gfpgan"))}})]},z)}else if(ne.type==="codeformer"){const{strength:$,fidelity:V}=ne;return g.jsxs(Ee,{pl:"2rem",gap:1,direction:"column",children:[g.jsx(Dt,{size:"md",children:`${z+1}: Face restoration (Codeformer)`}),g.jsx(Jn,{label:"Strength",value:$,onClick:()=>{n(k3($)),n(dS("codeformer"))}}),V&&g.jsx(Jn,{label:"Fidelity",value:V,onClick:()=>{n(xk(V)),n(dS("codeformer"))}})]},z)}})]}),o&&g.jsx(Jn,{withCopy:!0,label:"Dream Prompt",value:o}),g.jsxs(Ee,{gap:2,direction:"column",children:[g.jsxs(Ee,{gap:2,children:[g.jsx(si,{label:"Copy metadata JSON",children:g.jsx(ls,{"aria-label":"Copy metadata JSON",icon:g.jsx(e0,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(W)})}),g.jsx(Dt,{fontWeight:"semibold",children:"Metadata JSON:"})]}),g.jsx("div",{className:"image-json-viewer",children:g.jsx("pre",{children:W})})]})]}):g.jsx(aH,{width:"100%",pt:10,children:g.jsx(Dt,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})},Kke);HE.displayName="ImageMetadataViewer";const fG=lt([pp,fp],(e,t)=>{const{currentCategory:n,currentImage:r,intermediateImage:i}=e,{shouldShowImageDetails:o}=t,a=e.categories[r?r.category:"result"].images,s=a.findIndex(u=>{var d;return u.uuid===((d=e==null?void 0:e.currentImage)==null?void 0:d.uuid)}),l=a.length;return{imageToDisplay:i||r,isIntermediate:Boolean(i),viewerImageToDisplay:r,currentCategory:n,isOnFirstImage:s===0,isOnLastImage:!isNaN(s)&&s===l-1,shouldShowImageDetails:o,shouldShowPrevImageButton:s===0,shouldShowNextImageButton:!isNaN(s)&&s===l-1}},{memoizeOptions:{resultEqualityCheck:Ce.isEqual}});function Yke(){const e=Te(),{isOnFirstImage:t,isOnLastImage:n,shouldShowImageDetails:r,imageToDisplay:i,isIntermediate:o}=le(fG),[a,s]=S.useState(!1),l=()=>{s(!0)},u=()=>{s(!1)},d=()=>{e(vE())},p=()=>{e(mE())};return g.jsxs("div",{className:"current-image-preview",children:[i&&g.jsx(jw,{src:i.url,width:i.width,height:i.height,style:{imageRendering:o?"pixelated":"initial"}}),!r&&g.jsxs("div",{className:"current-image-next-prev-buttons",children:[g.jsx("div",{className:"next-prev-button-trigger-area prev-button-trigger-area",onMouseOver:l,onMouseOut:u,children:a&&!t&&g.jsx(ls,{"aria-label":"Previous image",icon:g.jsx(JV,{className:"next-prev-button"}),variant:"unstyled",onClick:d})}),g.jsx("div",{className:"next-prev-button-trigger-area next-button-trigger-area",onMouseOver:l,onMouseOut:u,children:a&&!n&&g.jsx(ls,{"aria-label":"Next image",icon:g.jsx(eG,{className:"next-prev-button"}),variant:"unstyled",onClick:p})})]}),r&&i&&g.jsx(HE,{image:i,styleClass:"current-image-metadata"})]})}var Xke=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ni=globalThis&&globalThis.__assign||function(){return ni=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof o>"u"?void 0:Number(o),minHeight:typeof a>"u"?void 0:Number(a)}},r7e=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],jI="__resizable_base__",hG=function(e){Jke(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var i=r.parentNode;if(!i)return null;var o=r.window.document.createElement("div");return o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.transform="scale(0, 0)",o.style.left="0",o.style.flex="0 0 100%",o.classList?o.classList.add(jI):o.className+=jI,i.appendChild(o),o},r.removeBase=function(i){var o=r.parentNode;o&&o.removeChild(i)},r.ref=function(i){i&&(r.resizable=i)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||e7e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:o,this.resizable.style.position=a}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,i=function(s){if(typeof n.state[s]>"u"||n.state[s]==="auto")return"auto";if(n.propsSize&&n.propsSize[s]&&n.propsSize[s].toString().endsWith("%")){if(n.state[s].toString().endsWith("%"))return n.state[s].toString();var l=n.getParentSize(),u=Number(n.state[s].toString().replace("px","")),d=u/l[s]*100;return d+"%"}return QC(n.state[s])},o=r&&typeof r.width<"u"&&!this.state.isResizing?QC(r.width):i("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?QC(r.height):i("height");return{width:o,height:a}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var o={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=i),this.removeBase(n),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var i=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof i>"u"||i==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var i=this.props.boundsByDirection,o=this.state.direction,a=i&&Ig("left",o),s=i&&Ig("top",o),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=a?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=s?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=s?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=s?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n"u"?10:o.width,p=typeof i.width>"u"||i.width<0?n:i.width,m=typeof o.height>"u"?10:o.height,y=typeof i.height>"u"||i.height<0?r:i.height,b=l||0,w=u||0;if(s){var E=(m-b)*this.ratio+w,_=(y-b)*this.ratio+w,k=(d-w)/this.ratio+b,T=(p-w)/this.ratio+b,L=Math.max(d,E),O=Math.min(p,_),D=Math.max(m,k),I=Math.min(y,T);n=yx(n,L,O),r=yx(r,D,I)}else n=yx(n,d,p),r=yx(r,m,y);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var o=this.resizable.getBoundingClientRect(),a=o.left,s=o.top,l=o.right,u=o.bottom;this.resizableLeft=a,this.resizableRight=l,this.resizableTop=s,this.resizableBottom=u}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var i=0,o=0;if(n.nativeEvent&&t7e(n.nativeEvent)?(i=n.nativeEvent.clientX,o=n.nativeEvent.clientY):n.nativeEvent&&bx(n.nativeEvent)&&(i=n.nativeEvent.touches[0].clientX,o=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(n,r,this.resizable);if(a===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var s,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",s=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:i,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ol(Ol({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:s};this.setState(p)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&bx(n))try{n.preventDefault(),n.stopPropagation()}catch{}var i=this.props,o=i.maxWidth,a=i.maxHeight,s=i.minWidth,l=i.minHeight,u=bx(n)?n.touches[0].clientX:n.clientX,d=bx(n)?n.touches[0].clientY:n.clientY,p=this.state,m=p.direction,y=p.original,b=p.width,w=p.height,E=this.getParentSize(),_=n7e(E,this.window.innerWidth,this.window.innerHeight,o,a,s,l);o=_.maxWidth,a=_.maxHeight,s=_.minWidth,l=_.minHeight;var k=this.calculateNewSizeFromDirection(u,d),T=k.newHeight,L=k.newWidth,O=this.calculateNewMaxFromBoundary(o,a);this.props.snap&&this.props.snap.x&&(L=DI(L,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(T=DI(T,this.props.snap.y,this.props.snapGap));var D=this.calculateNewSizeFromAspectRatio(L,T,{width:O.maxWidth,height:O.maxHeight},{width:s,height:l});if(L=D.newWidth,T=D.newHeight,this.props.grid){var I=II(L,this.props.grid[0]),N=II(T,this.props.grid[1]),W=this.props.snapGap||0;L=W===0||Math.abs(I-L)<=W?I:L,T=W===0||Math.abs(N-T)<=W?N:T}var B={width:L-y.width,height:T-y.height};if(b&&typeof b=="string"){if(b.endsWith("%")){var K=L/E.width*100;L=K+"%"}else if(b.endsWith("vw")){var ne=L/this.window.innerWidth*100;L=ne+"vw"}else if(b.endsWith("vh")){var z=L/this.window.innerHeight*100;L=z+"vh"}}if(w&&typeof w=="string"){if(w.endsWith("%")){var K=T/E.height*100;T=K+"%"}else if(w.endsWith("vw")){var ne=T/this.window.innerWidth*100;T=ne+"vw"}else if(w.endsWith("vh")){var z=T/this.window.innerHeight*100;T=z+"vh"}}var $={width:this.createSizeForCssProperty(L,"width"),height:this.createSizeForCssProperty(T,"height")};this.flexDir==="row"?$.flexBasis=$.width:this.flexDir==="column"&&($.flexBasis=$.height),Xs.flushSync(function(){r.setState($)}),this.props.onResize&&this.props.onResize(n,m,this.resizable,B)}},t.prototype.onMouseUp=function(n){var r=this.state,i=r.isResizing,o=r.direction,a=r.original;if(!(!i||!this.resizable)){var s={width:this.size.width-a.width,height:this.size.height-a.height};this.props.onResizeStop&&this.props.onResizeStop(n,o,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ol(Ol({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,i=r.enable,o=r.handleStyles,a=r.handleClasses,s=r.handleWrapperStyle,l=r.handleWrapperClass,u=r.handleComponent;if(!i)return null;var d=Object.keys(i).map(function(p){return i[p]!==!1?S.createElement(Qke,{key:p,direction:p,onResizeStart:n.onResizeStart,replaceStyles:o&&o[p],className:a&&a[p]},u&&u[p]?u[p]:null):null});return S.createElement("div",{className:l,style:s},d)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,s){return r7e.indexOf(s)!==-1||(a[s]=n.props[s]),a},{}),i=Ol(Ol(Ol({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return S.createElement(o,Ol({ref:this.ref,style:i,className:this.props.className},r),this.state.isResizing&&S.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(S.PureComponent);const Gn=e=>{const{label:t,styleClass:n,...r}=e;return g.jsx(dz,{className:`invokeai__checkbox ${n}`,...r,children:t})};function pG(e){return ut({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function gG(e){return ut({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function i7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function o7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"}}]})(e)}function a7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function s7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function l7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function mG(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function u7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function c7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 10l5 5 5-5z"}}]})(e)}function d7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 14l5-5 5 5z"}}]})(e)}function f7e(e){return ut({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}function h7e(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function p7e(e,t){e.classList?e.classList.add(t):h7e(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function NI(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function g7e(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=NI(e.className,t):e.setAttribute("class",NI(e.className&&e.className.baseVal||"",t))}const $I={disabled:!1},vG=Ke.createContext(null);var yG=function(t){return t.scrollTop},S1="unmounted",ph="exited",gh="entering",Fg="entered",Gk="exiting",mc=function(e){b8(t,e);function t(r,i){var o;o=e.call(this,r,i)||this;var a=i,s=a&&!a.isMounting?r.enter:r.appear,l;return o.appearStatus=null,r.in?s?(l=ph,o.appearStatus=gh):l=Fg:r.unmountOnExit||r.mountOnEnter?l=S1:l=ph,o.state={status:l},o.nextCallback=null,o}t.getDerivedStateFromProps=function(i,o){var a=i.in;return a&&o.status===S1?{status:ph}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var o=null;if(i!==this.props){var a=this.state.status;this.props.in?a!==gh&&a!==Fg&&(o=gh):(a===gh||a===Fg)&&(o=Gk)}this.updateStatus(!1,o)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,o,a,s;return o=a=s=i,i!=null&&typeof i!="number"&&(o=i.exit,a=i.enter,s=i.appear!==void 0?i.appear:a),{exit:o,enter:a,appear:s}},n.updateStatus=function(i,o){if(i===void 0&&(i=!1),o!==null)if(this.cancelNextCallback(),o===gh){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Ob.findDOMNode(this);a&&yG(a)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===ph&&this.setState({status:S1})},n.performEnter=function(i){var o=this,a=this.props.enter,s=this.context?this.context.isMounting:i,l=this.props.nodeRef?[s]:[Ob.findDOMNode(this),s],u=l[0],d=l[1],p=this.getTimeouts(),m=s?p.appear:p.enter;if(!i&&!a||$I.disabled){this.safeSetState({status:Fg},function(){o.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:gh},function(){o.props.onEntering(u,d),o.onTransitionEnd(m,function(){o.safeSetState({status:Fg},function(){o.props.onEntered(u,d)})})})},n.performExit=function(){var i=this,o=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:Ob.findDOMNode(this);if(!o||$I.disabled){this.safeSetState({status:ph},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Gk},function(){i.props.onExiting(s),i.onTransitionEnd(a.exit,function(){i.safeSetState({status:ph},function(){i.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,o){o=this.setNextCallback(o),this.setState(i,o)},n.setNextCallback=function(i){var o=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,o.nextCallback=null,i(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(i,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:Ob.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=l[0],d=l[1];this.props.addEndListener(u,d)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===S1)return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var s=m8(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Ke.createElement(vG.Provider,{value:null},typeof a=="function"?a(i,s):Ke.cloneElement(Ke.Children.only(a),s))},t}(Ke.Component);mc.contextType=vG;mc.propTypes={};function Dg(){}mc.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Dg,onEntering:Dg,onEntered:Dg,onExit:Dg,onExiting:Dg,onExited:Dg};mc.UNMOUNTED=S1;mc.EXITED=ph;mc.ENTERING=gh;mc.ENTERED=Fg;mc.EXITING=Gk;const m7e=mc;var v7e=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return p7e(t,r)})},JC=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return g7e(t,r)})},WE=function(e){b8(t,e);function t(){for(var r,i=arguments.length,o=new Array(i),a=0;ab,Object.values(b));return S.createElement(w.Provider,{value:E},y)}function d(p,m){const y=(m==null?void 0:m[e][l])||s,b=S.useContext(y);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(a=>S.createContext(a));return function(s){const l=(s==null?void 0:s[e])||o;return S.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[r,y7e(i,...t)]}function y7e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((s,{useScope:l,scopeName:u})=>{const p=l(o)[`__scope${u}`];return{...s,...p}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function b7e(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function xG(...e){return t=>e.forEach(n=>b7e(n,t))}function ds(...e){return S.useCallback(xG(...e),e)}const Fy=S.forwardRef((e,t)=>{const{children:n,...r}=e,i=S.Children.toArray(n),o=i.find(S7e);if(o){const a=o.props.children,s=i.map(l=>l===o?S.Children.count(a)>1?S.Children.only(null):S.isValidElement(a)?a.props.children:null:l);return S.createElement(qk,pn({},r,{ref:t}),S.isValidElement(a)?S.cloneElement(a,void 0,s):null)}return S.createElement(qk,pn({},r,{ref:t}),n)});Fy.displayName="Slot";const qk=S.forwardRef((e,t)=>{const{children:n,...r}=e;return S.isValidElement(n)?S.cloneElement(n,{...w7e(r,n.props),ref:xG(t,n.ref)}):S.Children.count(n)>1?S.Children.only(null):null});qk.displayName="SlotClone";const x7e=({children:e})=>S.createElement(S.Fragment,null,e);function S7e(e){return S.isValidElement(e)&&e.type===x7e}function w7e(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{o(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}const C7e=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],sc=C7e.reduce((e,t)=>{const n=S.forwardRef((r,i)=>{const{asChild:o,...a}=r,s=o?Fy:t;return S.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),S.createElement(s,pn({},a,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function SG(e,t){e&&Xs.flushSync(()=>e.dispatchEvent(t))}function wG(e){const t=e+"CollectionProvider",[n,r]=b2(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=y=>{const{scope:b,children:w}=y,E=Ke.useRef(null),_=Ke.useRef(new Map).current;return Ke.createElement(i,{scope:b,itemMap:_,collectionRef:E},w)},s=e+"CollectionSlot",l=Ke.forwardRef((y,b)=>{const{scope:w,children:E}=y,_=o(s,w),k=ds(b,_.collectionRef);return Ke.createElement(Fy,{ref:k},E)}),u=e+"CollectionItemSlot",d="data-radix-collection-item",p=Ke.forwardRef((y,b)=>{const{scope:w,children:E,..._}=y,k=Ke.useRef(null),T=ds(b,k),L=o(u,w);return Ke.useEffect(()=>(L.itemMap.set(k,{ref:k,..._}),()=>void L.itemMap.delete(k))),Ke.createElement(Fy,{[d]:"",ref:T},E)});function m(y){const b=o(e+"CollectionConsumer",y);return Ke.useCallback(()=>{const E=b.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((L,O)=>_.indexOf(L.ref.current)-_.indexOf(O.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,r]}const _7e=S.createContext(void 0);function CG(e){const t=S.useContext(_7e);return e||t||"ltr"}function Js(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function k7e(e,t=globalThis==null?void 0:globalThis.document){const n=Js(e);S.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Kk="dismissableLayer.update",E7e="dismissableLayer.pointerDownOutside",P7e="dismissableLayer.focusOutside";let FI;const T7e=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),M7e=S.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...u}=e,d=S.useContext(T7e),[p,m]=S.useState(null),y=(n=p==null?void 0:p.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,b]=S.useState({}),w=ds(t,N=>m(N)),E=Array.from(d.layers),[_]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=E.indexOf(_),T=p?E.indexOf(p):-1,L=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=k,D=L7e(N=>{const W=N.target,B=[...d.branches].some(K=>K.contains(W));!O||B||(o==null||o(N),s==null||s(N),N.defaultPrevented||l==null||l())},y),I=A7e(N=>{const W=N.target;[...d.branches].some(K=>K.contains(W))||(a==null||a(N),s==null||s(N),N.defaultPrevented||l==null||l())},y);return k7e(N=>{T===d.layers.size-1&&(i==null||i(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},y),S.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(FI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),BI(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=FI)}},[p,y,r,d]),S.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),BI())},[p,d]),S.useEffect(()=>{const N=()=>b({});return document.addEventListener(Kk,N),()=>document.removeEventListener(Kk,N)},[]),S.createElement(sc.div,pn({},u,{ref:w,style:{pointerEvents:L?O?"auto":"none":void 0,...e.style},onFocusCapture:Kn(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Kn(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Kn(e.onPointerDownCapture,D.onPointerDownCapture)}))});function L7e(e,t=globalThis==null?void 0:globalThis.document){const n=Js(e),r=S.useRef(!1),i=S.useRef(()=>{});return S.useEffect(()=>{const o=s=>{if(s.target&&!r.current){let u=function(){_G(E7e,n,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function A7e(e,t=globalThis==null?void 0:globalThis.document){const n=Js(e),r=S.useRef(!1);return S.useEffect(()=>{const i=o=>{o.target&&!r.current&&_G(P7e,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function BI(){const e=new CustomEvent(Kk);document.dispatchEvent(e)}function _G(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?SG(i,o):i.dispatchEvent(o)}let e6=0;function O7e(){S.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:zI()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:zI()),e6++,()=>{e6===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),e6--}},[])}function zI(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}const t6="focusScope.autoFocusOnMount",n6="focusScope.autoFocusOnUnmount",HI={bubbles:!1,cancelable:!0},R7e=S.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[s,l]=S.useState(null),u=Js(i),d=Js(o),p=S.useRef(null),m=ds(t,w=>l(w)),y=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let w=function(_){if(y.paused||!s)return;const k=_.target;s.contains(k)?p.current=k:mh(p.current,{select:!0})},E=function(_){y.paused||!s||s.contains(_.relatedTarget)||mh(p.current,{select:!0})};return document.addEventListener("focusin",w),document.addEventListener("focusout",E),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",E)}}},[r,s,y.paused]),S.useEffect(()=>{if(s){UI.add(y);const w=document.activeElement;if(!s.contains(w)){const _=new CustomEvent(t6,HI);s.addEventListener(t6,u),s.dispatchEvent(_),_.defaultPrevented||(I7e(F7e(kG(s)),{select:!0}),document.activeElement===w&&mh(s))}return()=>{s.removeEventListener(t6,u),setTimeout(()=>{const _=new CustomEvent(n6,HI);s.addEventListener(n6,d),s.dispatchEvent(_),_.defaultPrevented||mh(w??document.body,{select:!0}),s.removeEventListener(n6,d),UI.remove(y)},0)}}},[s,u,d,y]);const b=S.useCallback(w=>{if(!n&&!r||y.paused)return;const E=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,_=document.activeElement;if(E&&_){const k=w.currentTarget,[T,L]=D7e(k);T&&L?!w.shiftKey&&_===L?(w.preventDefault(),n&&mh(T,{select:!0})):w.shiftKey&&_===T&&(w.preventDefault(),n&&mh(L,{select:!0})):_===k&&w.preventDefault()}},[n,r,y.paused]);return S.createElement(sc.div,pn({tabIndex:-1},a,{ref:m,onKeyDown:b}))});function I7e(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mh(r,{select:t}),document.activeElement!==n)return}function D7e(e){const t=kG(e),n=WI(t,e),r=WI(t.reverse(),e);return[n,r]}function kG(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function WI(e,t){for(const n of e)if(!j7e(n,{upTo:t}))return n}function j7e(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function N7e(e){return e instanceof HTMLInputElement&&"select"in e}function mh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&N7e(e)&&t&&e.select()}}const UI=$7e();function $7e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=VI(e,t),e.unshift(t)},remove(t){var n;e=VI(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function VI(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function F7e(e){return e.filter(t=>t.tagName!=="A")}const Pd=Boolean(globalThis==null?void 0:globalThis.document)?S.useLayoutEffect:()=>{},B7e=p6["useId".toString()]||(()=>{});let z7e=0;function H7e(e){const[t,n]=S.useState(B7e());return Pd(()=>{e||n(r=>r??String(z7e++))},[e]),e||(t?`radix-${t}`:"")}function gp(e){return e.split("-")[0]}function x2(e){return e.split("-")[1]}function w0(e){return["top","bottom"].includes(gp(e))?"x":"y"}function UE(e){return e==="y"?"height":"width"}function GI(e,t,n){let{reference:r,floating:i}=e;const o=r.x+r.width/2-i.width/2,a=r.y+r.height/2-i.height/2,s=w0(t),l=UE(s),u=r[l]/2-i[l]/2,d=s==="x";let p;switch(gp(t)){case"top":p={x:o,y:r.y-i.height};break;case"bottom":p={x:o,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:a};break;case"left":p={x:r.x-i.width,y:a};break;default:p={x:r.x,y:r.y}}switch(x2(t)){case"start":p[s]-=u*(n&&d?-1:1);break;case"end":p[s]+=u*(n&&d?-1:1)}return p}const W7e=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=GI(l,r,s),p=r,m={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=e??{},{x:i,y:o,placement:a,rects:s,platform:l}=t;if(n==null)return{};const u=EG(r),d={x:i,y:o},p=w0(a),m=x2(a),y=UE(p),b=await l.getDimensions(n),w=p==="y"?"top":"left",E=p==="y"?"bottom":"right",_=s.reference[y]+s.reference[p]-d[p]-s.floating[y],k=d[p]-s.reference[p],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(n));let L=T?p==="y"?T.clientHeight||0:T.clientWidth||0:0;L===0&&(L=s.floating[y]);const O=_/2-k/2,D=u[w],I=L-b[y]-u[E],N=L/2-b[y]/2+O,W=Yk(D,N,I),B=(m==="start"?u[w]:u[E])>0&&N!==W&&s.reference[y]<=s.floating[y];return{[p]:d[p]-(B?NV7e[t])}function G7e(e,t,n){n===void 0&&(n=!1);const r=x2(e),i=w0(e),o=UE(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=R3(a)),{main:a,cross:R3(a)}}const q7e={start:"end",end:"start"};function KI(e){return e.replace(/start|end/g,t=>q7e[t])}const PG=["top","right","bottom","left"];PG.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);const K7e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:s,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",flipAlignment:y=!0,...b}=e,w=gp(r),E=p||(w===a||!y?[R3(a)]:function(N){const W=R3(N);return[KI(N),W,KI(W)]}(a)),_=[a,...E],k=await By(t,b),T=[];let L=((n=i.flip)==null?void 0:n.overflows)||[];if(u&&T.push(k[w]),d){const{main:N,cross:W}=G7e(r,o,await(s.isRTL==null?void 0:s.isRTL(l.floating)));T.push(k[N],k[W])}if(L=[...L,{placement:r,overflows:T}],!T.every(N=>N<=0)){var O,D;const N=((O=(D=i.flip)==null?void 0:D.index)!=null?O:0)+1,W=_[N];if(W)return{data:{index:N,overflows:L},reset:{placement:W}};let B="bottom";switch(m){case"bestFit":{var I;const K=(I=L.map(ne=>[ne,ne.overflows.filter(z=>z>0).reduce((z,$)=>z+$,0)]).sort((ne,z)=>ne[1]-z[1])[0])==null?void 0:I[0].placement;K&&(B=K);break}case"initialPlacement":B=a}if(r!==B)return{reset:{placement:B}}}return{}}}};function YI(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function XI(e){return PG.some(t=>e[t]>=0)}const Y7e=function(e){let{strategy:t="referenceHidden",...n}=e===void 0?{}:e;return{name:"hide",async fn(r){const{rects:i}=r;switch(t){case"referenceHidden":{const o=YI(await By(r,{...n,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:XI(o)}}}case"escaped":{const o=YI(await By(r,{...n,altBoundary:!0}),i.floating);return{data:{escapedOffsets:o,escaped:XI(o)}}}default:return{}}}}},X7e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,i=await async function(o,a){const{placement:s,platform:l,elements:u}=o,d=await(l.isRTL==null?void 0:l.isRTL(u.floating)),p=gp(s),m=x2(s),y=w0(s)==="x",b=["left","top"].includes(p)?-1:1,w=d&&y?-1:1,E=typeof a=="function"?a(o):a;let{mainAxis:_,crossAxis:k,alignmentAxis:T}=typeof E=="number"?{mainAxis:E,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...E};return m&&typeof T=="number"&&(k=m==="end"?-1*T:T),y?{x:k*w,y:_*b}:{x:_*b,y:k*w}}(t,e);return{x:n+i.x,y:r+i.y,data:i}}}};function TG(e){return e==="x"?"y":"x"}const Z7e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:E=>{let{x:_,y:k}=E;return{x:_,y:k}}},...l}=e,u={x:n,y:r},d=await By(t,l),p=w0(gp(i)),m=TG(p);let y=u[p],b=u[m];if(o){const E=p==="y"?"bottom":"right";y=Yk(y+d[p==="y"?"top":"left"],y,y-d[E])}if(a){const E=m==="y"?"bottom":"right";b=Yk(b+d[m==="y"?"top":"left"],b,b-d[E])}const w=s.fn({...t,[p]:y,[m]:b});return{...w,data:{x:w.x-n,y:w.y-r}}}}},Q7e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=e,d={x:n,y:r},p=w0(i),m=TG(p);let y=d[p],b=d[m];const w=typeof s=="function"?s({...o,placement:i}):s,E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(l){const O=p==="y"?"height":"width",D=o.reference[p]-o.floating[O]+E.mainAxis,I=o.reference[p]+o.reference[O]-E.mainAxis;yI&&(y=I)}if(u){var _,k,T,L;const O=p==="y"?"width":"height",D=["top","left"].includes(gp(i)),I=o.reference[m]-o.floating[O]+(D&&(_=(k=a.offset)==null?void 0:k[m])!=null?_:0)+(D?0:E.crossAxis),N=o.reference[m]+o.reference[O]+(D?0:(T=(L=a.offset)==null?void 0:L[m])!=null?T:0)-(D?E.crossAxis:0);bN&&(b=N)}return{[p]:y,[m]:b}}}},J7e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:o}=t,{apply:a,...s}=e,l=await By(t,s),u=gp(n),d=x2(n);let p,m;u==="top"||u==="bottom"?(p=u,m=d===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(m=u,p=d==="end"?"top":"bottom");const y=vh(l.left,0),b=vh(l.right,0),w=vh(l.top,0),E=vh(l.bottom,0),_={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(w!==0||E!==0?w+E:vh(l.top,l.bottom)):l[p]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(y!==0||b!==0?y+b:vh(l.left,l.right)):l[m])},k=await i.getDimensions(o.floating);a==null||a({...t,..._});const T=await i.getDimensions(o.floating);return k.width!==T.width||k.height!==T.height?{reset:{rects:!0}}:{}}}};function MG(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function vc(e){if(e==null)return window;if(!MG(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function S2(e){return vc(e).getComputedStyle(e)}function Xu(e){return MG(e)?"":e?(e.nodeName||"").toLowerCase():""}function LG(){const e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(t=>t.brand+"/"+t.version).join(" "):navigator.userAgent}function ou(e){return e instanceof vc(e).HTMLElement}function ef(e){return e instanceof vc(e).Element}function VE(e){return typeof ShadowRoot>"u"?!1:e instanceof vc(e).ShadowRoot||e instanceof ShadowRoot}function p4(e){const{overflow:t,overflowX:n,overflowY:r}=S2(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function e9e(e){return["table","td","th"].includes(Xu(e))}function ZI(e){const t=/firefox/i.test(LG()),n=S2(e);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"}function AG(){return!/^((?!chrome|android).)*safari/i.test(LG())}const QI=Math.min,Y1=Math.max,I3=Math.round;function Zu(e,t,n){var r,i,o,a;t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect();let l=1,u=1;t&&ou(e)&&(l=e.offsetWidth>0&&I3(s.width)/e.offsetWidth||1,u=e.offsetHeight>0&&I3(s.height)/e.offsetHeight||1);const d=ef(e)?vc(e):window,p=!AG()&&n,m=(s.left+(p&&(r=(i=d.visualViewport)==null?void 0:i.offsetLeft)!=null?r:0))/l,y=(s.top+(p&&(o=(a=d.visualViewport)==null?void 0:a.offsetTop)!=null?o:0))/u,b=s.width/l,w=s.height/u;return{width:b,height:w,top:y,right:m+b,bottom:y+w,left:m,x:m,y}}function zd(e){return(t=e,(t instanceof vc(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function g4(e){return ef(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function OG(e){return Zu(zd(e)).left+g4(e).scrollLeft}function t9e(e,t,n){const r=ou(t),i=zd(t),o=Zu(e,r&&function(l){const u=Zu(l);return I3(u.width)!==l.offsetWidth||I3(u.height)!==l.offsetHeight}(t),n==="fixed");let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&n!=="fixed")if((Xu(t)!=="body"||p4(i))&&(a=g4(t)),ou(t)){const l=Zu(t,!0);s.x=l.x+t.clientLeft,s.y=l.y+t.clientTop}else i&&(s.x=OG(i));return{x:o.left+a.scrollLeft-s.x,y:o.top+a.scrollTop-s.y,width:o.width,height:o.height}}function RG(e){return Xu(e)==="html"?e:e.assignedSlot||e.parentNode||(VE(e)?e.host:null)||zd(e)}function JI(e){return ou(e)&&getComputedStyle(e).position!=="fixed"?e.offsetParent:null}function Xk(e){const t=vc(e);let n=JI(e);for(;n&&e9e(n)&&getComputedStyle(n).position==="static";)n=JI(n);return n&&(Xu(n)==="html"||Xu(n)==="body"&&getComputedStyle(n).position==="static"&&!ZI(n))?t:n||function(r){let i=RG(r);for(VE(i)&&(i=i.host);ou(i)&&!["html","body"].includes(Xu(i));){if(ZI(i))return i;i=i.parentNode}return null}(e)||t}function eD(e){if(ou(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=Zu(e);return{width:t.width,height:t.height}}function IG(e){const t=RG(e);return["html","body","#document"].includes(Xu(t))?e.ownerDocument.body:ou(t)&&p4(t)?t:IG(t)}function D3(e,t){var n;t===void 0&&(t=[]);const r=IG(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=vc(r),a=i?[o].concat(o.visualViewport||[],p4(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(D3(a))}function tD(e,t,n){return t==="viewport"?O3(function(r,i){const o=vc(r),a=zd(r),s=o.visualViewport;let l=a.clientWidth,u=a.clientHeight,d=0,p=0;if(s){l=s.width,u=s.height;const m=AG();(m||!m&&i==="fixed")&&(d=s.offsetLeft,p=s.offsetTop)}return{width:l,height:u,x:d,y:p}}(e,n)):ef(t)?function(r,i){const o=Zu(r,!1,i==="fixed"),a=o.top+r.clientTop,s=o.left+r.clientLeft;return{top:a,left:s,x:s,y:a,right:s+r.clientWidth,bottom:a+r.clientHeight,width:r.clientWidth,height:r.clientHeight}}(t,n):O3(function(r){var i;const o=zd(r),a=g4(r),s=(i=r.ownerDocument)==null?void 0:i.body,l=Y1(o.scrollWidth,o.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),u=Y1(o.scrollHeight,o.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0);let d=-a.scrollLeft+OG(r);const p=-a.scrollTop;return S2(s||o).direction==="rtl"&&(d+=Y1(o.clientWidth,s?s.clientWidth:0)-l),{width:l,height:u,x:d,y:p}}(zd(e)))}function n9e(e){const t=D3(e),n=["absolute","fixed"].includes(S2(e).position)&&ou(e)?Xk(e):e;return ef(n)?t.filter(r=>ef(r)&&function(i,o){const a=o.getRootNode==null?void 0:o.getRootNode();if(i.contains(o))return!0;if(a&&VE(a)){let s=o;do{if(s&&i===s)return!0;s=s.parentNode||s.host}while(s)}return!1}(r,n)&&Xu(r)!=="body"):[]}const r9e={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?n9e(t):[].concat(n),r],a=o[0],s=o.reduce((l,u)=>{const d=tD(t,u,i);return l.top=Y1(d.top,l.top),l.right=QI(d.right,l.right),l.bottom=QI(d.bottom,l.bottom),l.left=Y1(d.left,l.left),l},tD(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const i=ou(n),o=zd(n);if(n===o)return t;let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&r!=="fixed")&&((Xu(n)!=="body"||p4(o))&&(a=g4(n)),ou(n))){const l=Zu(n,!0);s.x=l.x+n.clientLeft,s.y=l.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+s.x,y:t.y-a.scrollTop+s.y}},isElement:ef,getDimensions:eD,getOffsetParent:Xk,getDocumentElement:zd,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:t9e(t,Xk(n),r),floating:{...eD(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>S2(e).direction==="rtl"};function i9e(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=!0,animationFrame:s=!1}=r,l=i&&!s,u=o&&!s,d=l||u?[...ef(e)?D3(e):[],...D3(t)]:[];d.forEach(b=>{l&&b.addEventListener("scroll",n,{passive:!0}),u&&b.addEventListener("resize",n)});let p,m=null;if(a){let b=!0;m=new ResizeObserver(()=>{b||n(),b=!1}),ef(e)&&!s&&m.observe(e),m.observe(t)}let y=s?Zu(e):null;return s&&function b(){const w=Zu(e);!y||w.x===y.x&&w.y===y.y&&w.width===y.width&&w.height===y.height||n(),y=w,p=requestAnimationFrame(b)}(),n(),()=>{var b;d.forEach(w=>{l&&w.removeEventListener("scroll",n),u&&w.removeEventListener("resize",n)}),(b=m)==null||b.disconnect(),m=null,s&&cancelAnimationFrame(p)}}const o9e=(e,t,n)=>W7e(e,t,{platform:r9e,...n});var Zk=typeof document<"u"?S.useLayoutEffect:S.useEffect;function Qk(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Qk(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!Qk(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function a9e(e){const t=S.useRef(e);return Zk(()=>{t.current=e}),t}function s9e(e){let{middleware:t,placement:n="bottom",strategy:r="absolute",whileElementsMounted:i}=e===void 0?{}:e;const o=S.useRef(null),a=S.useRef(null),s=a9e(i),l=S.useRef(null),[u,d]=S.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[p,m]=S.useState(t);Qk(p==null?void 0:p.map(T=>{let{options:L}=T;return L}),t==null?void 0:t.map(T=>{let{options:L}=T;return L}))||m(t);const y=S.useCallback(()=>{!o.current||!a.current||o9e(o.current,a.current,{middleware:p,placement:n,strategy:r}).then(T=>{b.current&&Xs.flushSync(()=>{d(T)})})},[p,n,r]);Zk(()=>{b.current&&y()},[y]);const b=S.useRef(!1);Zk(()=>(b.current=!0,()=>{b.current=!1}),[]);const w=S.useCallback(()=>{if(typeof l.current=="function"&&(l.current(),l.current=null),o.current&&a.current)if(s.current){const T=s.current(o.current,a.current,y);l.current=T}else y()},[y,s]),E=S.useCallback(T=>{o.current=T,w()},[w]),_=S.useCallback(T=>{a.current=T,w()},[w]),k=S.useMemo(()=>({reference:o,floating:a}),[]);return S.useMemo(()=>({...u,update:y,refs:k,reference:E,floating:_}),[u,y,k,E,_])}const l9e=e=>{const{element:t,padding:n}=e;function r(i){return Object.prototype.hasOwnProperty.call(i,"current")}return{name:"arrow",options:e,fn(i){return r(t)?t.current!=null?qI({element:t.current,padding:n}).fn(i):{}:t?qI({element:t,padding:n}).fn(i):{}}}};function u9e(e){const[t,n]=S.useState(void 0);return Pd(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,s=u.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const DG="Popper",[GE,jG]=b2(DG),[c9e,NG]=GE(DG),d9e=e=>{const{__scopePopper:t,children:n}=e,[r,i]=S.useState(null);return S.createElement(c9e,{scope:t,anchor:r,onAnchorChange:i},n)},f9e="PopperAnchor",h9e=S.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=NG(f9e,n),a=S.useRef(null),s=ds(t,a);return S.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:S.createElement(sc.div,pn({},i,{ref:s}))}),j3="PopperContent",[p9e,WNe]=GE(j3),[g9e,m9e]=GE(j3,{hasParent:!1,positionUpdateFns:new Set}),v9e=S.forwardRef((e,t)=>{var n,r,i,o,a,s,l,u;const{__scopePopper:d,side:p="bottom",sideOffset:m=0,align:y="center",alignOffset:b=0,arrowPadding:w=0,collisionBoundary:E=[],collisionPadding:_=0,sticky:k="partial",hideWhenDetached:T=!1,avoidCollisions:L=!0,onPlaced:O,...D}=e,I=NG(j3,d),[N,W]=S.useState(null),B=ds(t,He=>W(He)),[K,ne]=S.useState(null),z=u9e(K),$=(n=z==null?void 0:z.width)!==null&&n!==void 0?n:0,V=(r=z==null?void 0:z.height)!==null&&r!==void 0?r:0,X=p+(y!=="center"?"-"+y:""),Q=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},G=Array.isArray(E)?E:[E],Y=G.length>0,ee={padding:Q,boundary:G.filter(b9e),altBoundary:Y},{reference:fe,floating:_e,strategy:we,x:xe,y:Le,placement:Se,middlewareData:Je,update:Xe}=s9e({strategy:"fixed",placement:X,whileElementsMounted:i9e,middleware:[x9e(),X7e({mainAxis:m+V,alignmentAxis:b}),L?Z7e({mainAxis:!0,crossAxis:!1,limiter:k==="partial"?Q7e():void 0,...ee}):void 0,K?l9e({element:K,padding:w}):void 0,L?K7e({...ee}):void 0,J7e({...ee,apply:({elements:He,availableWidth:Ue,availableHeight:ye})=>{He.floating.style.setProperty("--radix-popper-available-width",`${Ue}px`),He.floating.style.setProperty("--radix-popper-available-height",`${ye}px`)}}),S9e({arrowWidth:$,arrowHeight:V}),T?Y7e({strategy:"referenceHidden"}):void 0].filter(y9e)});Pd(()=>{fe(I.anchor)},[fe,I.anchor]);const tt=xe!==null&&Le!==null,[yt,Be]=$G(Se),Ae=Js(O);Pd(()=>{tt&&(Ae==null||Ae())},[tt,Ae]);const bt=(i=Je.arrow)===null||i===void 0?void 0:i.x,Fe=(o=Je.arrow)===null||o===void 0?void 0:o.y,at=((a=Je.arrow)===null||a===void 0?void 0:a.centerOffset)!==0,[jt,mt]=S.useState();Pd(()=>{N&&mt(window.getComputedStyle(N).zIndex)},[N]);const{hasParent:Zt,positionUpdateFns:on}=m9e(j3,d),se=!Zt;S.useLayoutEffect(()=>{if(!se)return on.add(Xe),()=>{on.delete(Xe)}},[se,on,Xe]),Pd(()=>{se&&tt&&Array.from(on).reverse().forEach(He=>requestAnimationFrame(He))},[se,tt,on]);const Ie={"data-side":yt,"data-align":Be,...D,ref:B,style:{...D.style,animation:tt?void 0:"none",opacity:(s=Je.hide)!==null&&s!==void 0&&s.referenceHidden?0:void 0}};return S.createElement("div",{ref:_e,"data-radix-popper-content-wrapper":"",style:{position:we,left:0,top:0,transform:tt?`translate3d(${Math.round(xe)}px, ${Math.round(Le)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:jt,["--radix-popper-transform-origin"]:[(l=Je.transformOrigin)===null||l===void 0?void 0:l.x,(u=Je.transformOrigin)===null||u===void 0?void 0:u.y].join(" ")},dir:e.dir},S.createElement(p9e,{scope:d,placedSide:yt,onArrowChange:ne,arrowX:bt,arrowY:Fe,shouldHideArrow:at},se?S.createElement(g9e,{scope:d,hasParent:!0,positionUpdateFns:on},S.createElement(sc.div,Ie)):S.createElement(sc.div,Ie)))});function y9e(e){return e!==void 0}function b9e(e){return e!==null}const x9e=()=>({name:"anchorCssProperties",fn(e){const{rects:t,elements:n}=e,{width:r,height:i}=t.reference;return n.floating.style.setProperty("--radix-popper-anchor-width",`${r}px`),n.floating.style.setProperty("--radix-popper-anchor-height",`${i}px`),{}}}),S9e=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,o,a;const{placement:s,rects:l,middlewareData:u}=t,p=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,m=p?0:e.arrowWidth,y=p?0:e.arrowHeight,[b,w]=$G(s),E={start:"0%",center:"50%",end:"100%"}[w],_=((r=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+m/2,k=((o=(a=u.arrow)===null||a===void 0?void 0:a.y)!==null&&o!==void 0?o:0)+y/2;let T="",L="";return b==="bottom"?(T=p?E:`${_}px`,L=`${-y}px`):b==="top"?(T=p?E:`${_}px`,L=`${l.floating.height+y}px`):b==="right"?(T=`${-y}px`,L=p?E:`${k}px`):b==="left"&&(T=`${l.floating.width+y}px`,L=p?E:`${k}px`),{data:{x:T,y:L}}}});function $G(e){const[t,n="center"]=e.split("-");return[t,n]}const w9e=d9e,C9e=h9e,_9e=v9e;function k9e(e,t){return S.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const FG=e=>{const{present:t,children:n}=e,r=E9e(t),i=typeof n=="function"?n({present:r.isPresent}):S.Children.only(n),o=ds(r.ref,i.ref);return typeof n=="function"||r.isPresent?S.cloneElement(i,{ref:o}):null};FG.displayName="Presence";function E9e(e){const[t,n]=S.useState(),r=S.useRef({}),i=S.useRef(e),o=S.useRef("none"),a=e?"mounted":"unmounted",[s,l]=k9e(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const u=Sx(r.current);o.current=s==="mounted"?u:"none"},[s]),Pd(()=>{const u=r.current,d=i.current;if(d!==e){const m=o.current,y=Sx(u);e?l("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Pd(()=>{if(t){const u=p=>{const y=Sx(r.current).includes(p.animationName);p.target===t&&y&&Xs.flushSync(()=>l("ANIMATION_END"))},d=p=>{p.target===t&&(o.current=Sx(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:S.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Sx(e){return(e==null?void 0:e.animationName)||"none"}function P9e({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=T9e({defaultProp:t,onChange:n}),o=e!==void 0,a=o?e:r,s=Js(n),l=S.useCallback(u=>{if(o){const p=typeof u=="function"?u(e):u;p!==e&&s(p)}else i(u)},[o,e,i,s]);return[a,l]}function T9e({defaultProp:e,onChange:t}){const n=S.useState(e),[r]=n,i=S.useRef(r),o=Js(t);return S.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}const r6="rovingFocusGroup.onEntryFocus",M9e={bubbles:!1,cancelable:!0},qE="RovingFocusGroup",[Jk,BG,L9e]=wG(qE),[A9e,zG]=b2(qE,[L9e]),[O9e,R9e]=A9e(qE),I9e=S.forwardRef((e,t)=>S.createElement(Jk.Provider,{scope:e.__scopeRovingFocusGroup},S.createElement(Jk.Slot,{scope:e.__scopeRovingFocusGroup},S.createElement(D9e,pn({},e,{ref:t}))))),D9e=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,...d}=e,p=S.useRef(null),m=ds(t,p),y=CG(o),[b=null,w]=P9e({prop:a,defaultProp:s,onChange:l}),[E,_]=S.useState(!1),k=Js(u),T=BG(n),L=S.useRef(!1),[O,D]=S.useState(0);return S.useEffect(()=>{const I=p.current;if(I)return I.addEventListener(r6,k),()=>I.removeEventListener(r6,k)},[k]),S.createElement(O9e,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:b,onItemFocus:S.useCallback(I=>w(I),[w]),onItemShiftTab:S.useCallback(()=>_(!0),[]),onFocusableItemAdd:S.useCallback(()=>D(I=>I+1),[]),onFocusableItemRemove:S.useCallback(()=>D(I=>I-1),[])},S.createElement(sc.div,pn({tabIndex:E||O===0?-1:0,"data-orientation":r},d,{ref:m,style:{outline:"none",...e.style},onMouseDown:Kn(e.onMouseDown,()=>{L.current=!0}),onFocus:Kn(e.onFocus,I=>{const N=!L.current;if(I.target===I.currentTarget&&N&&!E){const W=new CustomEvent(r6,M9e);if(I.currentTarget.dispatchEvent(W),!W.defaultPrevented){const B=T().filter(V=>V.focusable),K=B.find(V=>V.active),ne=B.find(V=>V.id===b),$=[K,ne,...B].filter(Boolean).map(V=>V.ref.current);HG($)}}L.current=!1}),onBlur:Kn(e.onBlur,()=>_(!1))})))}),j9e="RovingFocusGroupItem",N9e=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...a}=e,s=H7e(),l=o||s,u=R9e(j9e,n),d=u.currentTabStopId===l,p=BG(n),{onFocusableItemAdd:m,onFocusableItemRemove:y}=u;return S.useEffect(()=>{if(r)return m(),()=>y()},[r,m,y]),S.createElement(Jk.ItemSlot,{scope:n,id:l,focusable:r,active:i},S.createElement(sc.span,pn({tabIndex:d?0:-1,"data-orientation":u.orientation},a,{ref:t,onMouseDown:Kn(e.onMouseDown,b=>{r?u.onItemFocus(l):b.preventDefault()}),onFocus:Kn(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Kn(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=B9e(b,u.orientation,u.dir);if(w!==void 0){b.preventDefault();let _=p().filter(k=>k.focusable).map(k=>k.ref.current);if(w==="last")_.reverse();else if(w==="prev"||w==="next"){w==="prev"&&_.reverse();const k=_.indexOf(b.currentTarget);_=u.loop?z9e(_,k+1):_.slice(k+1)}setTimeout(()=>HG(_))}})})))}),$9e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function F9e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function B9e(e,t,n){const r=F9e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $9e[r]}function HG(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function z9e(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const H9e=I9e,W9e=N9e,U9e=["Enter"," "],V9e=["ArrowDown","PageUp","Home"],WG=["ArrowUp","PageDown","End"],G9e=[...V9e,...WG],m4="Menu",[e7,q9e,K9e]=wG(m4),[mp,UG]=b2(m4,[K9e,jG,zG]),KE=jG(),VG=zG(),[Y9e,v4]=mp(m4),[X9e,YE]=mp(m4),Z9e=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:a=!0}=e,s=KE(t),[l,u]=S.useState(null),d=S.useRef(!1),p=Js(o),m=CG(i);return S.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),S.createElement(w9e,s,S.createElement(Y9e,{scope:t,open:n,onOpenChange:p,content:l,onContentChange:u},S.createElement(X9e,{scope:t,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:m,modal:a},r)))},Q9e=S.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=KE(n);return S.createElement(C9e,pn({},i,r,{ref:t}))}),J9e="MenuPortal",[UNe,e8e]=mp(J9e,{forceMount:void 0}),Hd="MenuContent",[t8e,GG]=mp(Hd),n8e=S.forwardRef((e,t)=>{const n=e8e(Hd,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=v4(Hd,e.__scopeMenu),a=YE(Hd,e.__scopeMenu);return S.createElement(e7.Provider,{scope:e.__scopeMenu},S.createElement(FG,{present:r||o.open},S.createElement(e7.Slot,{scope:e.__scopeMenu},a.modal?S.createElement(r8e,pn({},i,{ref:t})):S.createElement(i8e,pn({},i,{ref:t})))))}),r8e=S.forwardRef((e,t)=>{const n=v4(Hd,e.__scopeMenu),r=S.useRef(null),i=ds(t,r);return S.useEffect(()=>{const o=r.current;if(o)return LH(o)},[]),S.createElement(qG,pn({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Kn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),i8e=S.forwardRef((e,t)=>{const n=v4(Hd,e.__scopeMenu);return S.createElement(qG,pn({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),qG=S.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:y,disableOutsideScroll:b,...w}=e,E=v4(Hd,n),_=YE(Hd,n),k=KE(n),T=VG(n),L=q9e(n),[O,D]=S.useState(null),I=S.useRef(null),N=ds(t,I,E.onContentChange),W=S.useRef(0),B=S.useRef(""),K=S.useRef(0),ne=S.useRef(null),z=S.useRef("right"),$=S.useRef(0),V=b?NH:S.Fragment,X=b?{as:Fy,allowPinchZoom:!0}:void 0,Q=Y=>{var ee,fe;const _e=B.current+Y,we=L().filter(tt=>!tt.disabled),xe=document.activeElement,Le=(ee=we.find(tt=>tt.ref.current===xe))===null||ee===void 0?void 0:ee.textValue,Se=we.map(tt=>tt.textValue),Je=h8e(Se,_e,Le),Xe=(fe=we.find(tt=>tt.textValue===Je))===null||fe===void 0?void 0:fe.ref.current;(function tt(yt){B.current=yt,window.clearTimeout(W.current),yt!==""&&(W.current=window.setTimeout(()=>tt(""),1e3))})(_e),Xe&&setTimeout(()=>Xe.focus())};S.useEffect(()=>()=>window.clearTimeout(W.current),[]),O7e();const G=S.useCallback(Y=>{var ee,fe;return z.current===((ee=ne.current)===null||ee===void 0?void 0:ee.side)&&g8e(Y,(fe=ne.current)===null||fe===void 0?void 0:fe.area)},[]);return S.createElement(t8e,{scope:n,searchRef:B,onItemEnter:S.useCallback(Y=>{G(Y)&&Y.preventDefault()},[G]),onItemLeave:S.useCallback(Y=>{var ee;G(Y)||((ee=I.current)===null||ee===void 0||ee.focus(),D(null))},[G]),onTriggerLeave:S.useCallback(Y=>{G(Y)&&Y.preventDefault()},[G]),pointerGraceTimerRef:K,onPointerGraceIntentChange:S.useCallback(Y=>{ne.current=Y},[])},S.createElement(V,X,S.createElement(R7e,{asChild:!0,trapped:i,onMountAutoFocus:Kn(o,Y=>{var ee;Y.preventDefault(),(ee=I.current)===null||ee===void 0||ee.focus()}),onUnmountAutoFocus:a},S.createElement(M7e,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:y},S.createElement(H9e,pn({asChild:!0},T,{dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:D,onEntryFocus:Kn(l,Y=>{_.isUsingKeyboardRef.current||Y.preventDefault()})}),S.createElement(_9e,pn({role:"menu","aria-orientation":"vertical","data-state":c8e(E.open),"data-radix-menu-content":"",dir:_.dir},k,w,{ref:N,style:{outline:"none",...w.style},onKeyDown:Kn(w.onKeyDown,Y=>{const fe=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,_e=Y.ctrlKey||Y.altKey||Y.metaKey,we=Y.key.length===1;fe&&(Y.key==="Tab"&&Y.preventDefault(),!_e&&we&&Q(Y.key));const xe=I.current;if(Y.target!==xe||!G9e.includes(Y.key))return;Y.preventDefault();const Se=L().filter(Je=>!Je.disabled).map(Je=>Je.ref.current);WG.includes(Y.key)&&Se.reverse(),d8e(Se)}),onBlur:Kn(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(W.current),B.current="")}),onPointerMove:Kn(e.onPointerMove,n7(Y=>{const ee=Y.target,fe=$.current!==Y.clientX;if(Y.currentTarget.contains(ee)&&fe){const _e=Y.clientX>$.current?"right":"left";z.current=_e,$.current=Y.clientX}}))})))))))}),t7="MenuItem",nD="menu.itemSelect",o8e=S.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=S.useRef(null),a=YE(t7,e.__scopeMenu),s=GG(t7,e.__scopeMenu),l=ds(t,o),u=S.useRef(!1),d=()=>{const p=o.current;if(!n&&p){const m=new CustomEvent(nD,{bubbles:!0,cancelable:!0});p.addEventListener(nD,y=>r==null?void 0:r(y),{once:!0}),SG(p,m),m.defaultPrevented?u.current=!1:a.onClose()}};return S.createElement(a8e,pn({},i,{ref:l,disabled:n,onClick:Kn(e.onClick,d),onPointerDown:p=>{var m;(m=e.onPointerDown)===null||m===void 0||m.call(e,p),u.current=!0},onPointerUp:Kn(e.onPointerUp,p=>{var m;u.current||(m=p.currentTarget)===null||m===void 0||m.click()}),onKeyDown:Kn(e.onKeyDown,p=>{const m=s.searchRef.current!=="";n||m&&p.key===" "||U9e.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})}))}),a8e=S.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,a=GG(t7,n),s=VG(n),l=S.useRef(null),u=ds(t,l),[d,p]=S.useState(!1),[m,y]=S.useState("");return S.useEffect(()=>{const b=l.current;if(b){var w;y(((w=b.textContent)!==null&&w!==void 0?w:"").trim())}},[o.children]),S.createElement(e7.ItemSlot,{scope:n,disabled:r,textValue:i??m},S.createElement(W9e,pn({asChild:!0},s,{focusable:!r}),S.createElement(sc.div,pn({role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},o,{ref:u,onPointerMove:Kn(e.onPointerMove,n7(b=>{r?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus())})),onPointerLeave:Kn(e.onPointerLeave,n7(b=>a.onItemLeave(b))),onFocus:Kn(e.onFocus,()=>p(!0)),onBlur:Kn(e.onBlur,()=>p(!1))}))))}),s8e="MenuRadioGroup";mp(s8e,{value:void 0,onValueChange:()=>{}});const l8e="MenuItemIndicator";mp(l8e,{checked:!1});const u8e="MenuSub";mp(u8e);function c8e(e){return e?"open":"closed"}function d8e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function f8e(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function h8e(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=f8e(e,Math.max(o,0));i.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function p8e(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,a=t.length-1;or!=d>r&&n<(u-s)*(r-l)/(d-l)+s&&(i=!i)}return i}function g8e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return p8e(n,t)}function n7(e){return t=>t.pointerType==="mouse"?e(t):void 0}const m8e=Z9e,v8e=Q9e,y8e=n8e,b8e=o8e,KG="ContextMenu",[x8e,VNe]=b2(KG,[UG]),y4=UG(),[S8e,YG]=x8e(KG),w8e=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:o=!0}=e,[a,s]=S.useState(!1),l=y4(t),u=Js(r),d=S.useCallback(p=>{s(p),u(p)},[u]);return S.createElement(S8e,{scope:t,open:a,onOpenChange:d,modal:o},S.createElement(m8e,pn({},l,{dir:i,open:a,onOpenChange:d,modal:o}),n))},C8e="ContextMenuTrigger",_8e=S.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,o=YG(C8e,n),a=y4(n),s=S.useRef({x:0,y:0}),l=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=S.useRef(0),d=S.useCallback(()=>window.clearTimeout(u.current),[]),p=m=>{s.current={x:m.clientX,y:m.clientY},o.onOpenChange(!0)};return S.useEffect(()=>d,[d]),S.useEffect(()=>void(r&&d()),[r,d]),S.createElement(S.Fragment,null,S.createElement(v8e,pn({},a,{virtualRef:l})),S.createElement(sc.span,pn({"data-state":o.open?"open":"closed","data-disabled":r?"":void 0},i,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Kn(e.onContextMenu,m=>{d(),p(m),m.preventDefault()}),onPointerDown:r?e.onPointerDown:Kn(e.onPointerDown,wx(m=>{d(),u.current=window.setTimeout(()=>p(m),700)})),onPointerMove:r?e.onPointerMove:Kn(e.onPointerMove,wx(d)),onPointerCancel:r?e.onPointerCancel:Kn(e.onPointerCancel,wx(d)),onPointerUp:r?e.onPointerUp:Kn(e.onPointerUp,wx(d))})))}),k8e="ContextMenuContent",E8e=S.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=YG(k8e,n),o=y4(n),a=S.useRef(!1);return S.createElement(y8e,pn({},o,r,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{var l;(l=e.onCloseAutoFocus)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&a.current&&s.preventDefault(),a.current=!1},onInteractOutside:s=>{var l;(l=e.onInteractOutside)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&!i.modal&&(a.current=!0)},style:{...e.style,["--radix-context-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"}}))}),P8e=S.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=y4(n);return S.createElement(b8e,pn({},i,r,{ref:t}))});function wx(e){return t=>t.pointerType!=="mouse"?e(t):void 0}const T8e=w8e,M8e=_8e,L8e=E8e,ud=P8e,A8e=(e,t)=>e.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,XG=S.memo(e=>{var z,$,V,X,Q,G,Y,ee;const t=Te(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:i,mayDeleteImage:o,shouldUseSingleGalleryColumn:a}=le(Hke),{image:s,isSelected:l}=e,{url:u,thumbnail:d,uuid:p,metadata:m}=s,[y,b]=S.useState(!1),w=a2(),{t:E}=De(),_=zE(),k=()=>b(!0),T=()=>b(!1),L=()=>{var fe,_e,we,xe;(_e=(fe=s.metadata)==null?void 0:fe.image)!=null&&_e.prompt&&_((xe=(we=s.metadata)==null?void 0:we.image)==null?void 0:xe.prompt),w({title:E("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},O=()=>{s.metadata&&t(p2(s.metadata.image.seed)),w({title:E("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{t(y0(s)),n!=="img2img"&&t(Wo("img2img")),w({title:E("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},I=()=>{t(i4(s)),t(r4()),n!=="unifiedCanvas"&&t(Wo("unifiedCanvas")),w({title:E("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},N=()=>{m&&(t(sU(m)),t(yU(m))),w({title:E("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},W=async()=>{var fe;if((fe=m==null?void 0:m.image)!=null&&fe.init_image_path&&(await fetch(m.image.init_image_path)).ok){t(Wo("img2img")),t(F3e(m)),w({title:E("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}w({title:E("toast.initialImageNotSet"),description:E("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},B=()=>t(ZO(s)),K=fe=>{fe.dataTransfer.setData("invokeai/imageUuid",p),fe.dataTransfer.effectAllowed="move"},ne=()=>{t(ZO(s))};return g.jsxs(T8e,{onOpenChange:fe=>{t(eU(fe))},children:[g.jsx(M8e,{children:g.jsxs(ao,{position:"relative",className:"hoverable-image",onMouseOver:k,onMouseOut:T,userSelect:"none",draggable:!0,onDragStart:K,children:[g.jsx(jw,{className:"hoverable-image-image",objectFit:a?"contain":r,rounded:"md",src:d||u,loading:"lazy"}),g.jsx("div",{className:"hoverable-image-content",onClick:B,children:l&&g.jsx(ja,{width:"50%",height:"50%",as:jE,className:"hoverable-image-check"})}),y&&i>=64&&g.jsx("div",{className:"hoverable-image-delete-button",children:g.jsx(A3,{image:s,children:g.jsx(ls,{"aria-label":E("parameters.deleteImage"),icon:g.jsx($ke,{}),size:"xs",variant:"imageHoverIconButton",fontSize:14,isDisabled:!o})})})]},p)}),g.jsxs(L8e,{className:"hoverable-image-context-menu",sticky:"always",onInteractOutside:fe=>{fe.detail.originalEvent.preventDefault()},children:[g.jsx(ud,{onClickCapture:ne,children:E("parameters.openInViewer")}),g.jsx(ud,{onClickCapture:L,disabled:(($=(z=s==null?void 0:s.metadata)==null?void 0:z.image)==null?void 0:$.prompt)===void 0,children:E("parameters.usePrompt")}),g.jsx(ud,{onClickCapture:O,disabled:((X=(V=s==null?void 0:s.metadata)==null?void 0:V.image)==null?void 0:X.seed)===void 0,children:E("parameters.useSeed")}),g.jsx(ud,{onClickCapture:N,disabled:!["txt2img","img2img"].includes((G=(Q=s==null?void 0:s.metadata)==null?void 0:Q.image)==null?void 0:G.type),children:E("parameters.useAll")}),g.jsx(ud,{onClickCapture:W,disabled:((ee=(Y=s==null?void 0:s.metadata)==null?void 0:Y.image)==null?void 0:ee.type)!=="img2img",children:E("parameters.useInitImg")}),g.jsx(ud,{onClickCapture:D,children:E("parameters.sendToImg2Img")}),g.jsx(ud,{onClickCapture:I,children:E("parameters.sendToUnifiedCanvas")}),g.jsx(ud,{"data-warning":!0,children:g.jsx(A3,{image:s,children:g.jsx("p",{children:E("parameters.deleteImage")})})})]})]})},A8e);XG.displayName="HoverableImage";const Cx=320,rD=40,O8e={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},iD=400;function ZG(){const e=Te(),{t}=De(),{images:n,currentCategory:r,currentImageUuid:i,shouldPinGallery:o,shouldShowGallery:a,galleryScrollPosition:s,galleryImageMinimumWidth:l,galleryGridTemplateColumns:u,activeTabName:d,galleryImageObjectFit:p,shouldHoldGalleryOpen:m,shouldAutoSwitchToNewImages:y,areMoreImagesAvailable:b,galleryWidth:w,isLightboxOpen:E,isStaging:_,shouldEnableResize:k,shouldUseSingleGalleryColumn:T}=le(zke),{galleryMinWidth:L,galleryMaxWidth:O}=E?{galleryMinWidth:iD,galleryMaxWidth:iD}:O8e[d],[D,I]=S.useState(w>=Cx),[N,W]=S.useState(!1),[B,K]=S.useState(0),ne=S.useRef(null),z=S.useRef(null),$=S.useRef(null);S.useEffect(()=>{w>=Cx&&I(!1)},[w]);const V=()=>{e(E3e(!o)),e(Li(!0))},X=()=>{a?G():Q()},Q=()=>{e(Am(!0)),o&&e(Li(!0))},G=S.useCallback(()=>{e(Am(!1)),e(eU(!1)),e(P3e(z.current?z.current.scrollTop:0)),setTimeout(()=>o&&e(Li(!0)),400)},[e,o]),Y=()=>{e(Uk(r))},ee=xe=>{e(Gv(xe))},fe=()=>{m||($.current=window.setTimeout(()=>G(),500))},_e=()=>{$.current&&window.clearTimeout($.current)};Qe("g",()=>{X()},[a,o]),Qe("left",()=>{e(vE())},{enabled:!_||d!=="unifiedCanvas"},[_]),Qe("right",()=>{e(mE())},{enabled:!_||d!=="unifiedCanvas"},[_]),Qe("shift+g",()=>{V()},[o]),Qe("esc",()=>{e(Am(!1))},{enabled:()=>!o,preventDefault:!0},[o]);const we=32;return Qe("shift+up",()=>{if(l<256){const xe=Ce.clamp(l+we,32,256);e(Gv(xe))}},[l]),Qe("shift+down",()=>{if(l>32){const xe=Ce.clamp(l-we,32,256);e(Gv(xe))}},[l]),S.useEffect(()=>{z.current&&(z.current.scrollTop=s)},[s,a]),S.useEffect(()=>{function xe(Le){!o&&ne.current&&!ne.current.contains(Le.target)&&G()}return document.addEventListener("mousedown",xe),()=>{document.removeEventListener("mousedown",xe)}},[G,o]),g.jsx(bG,{nodeRef:ne,in:a||m,unmountOnExit:!0,timeout:200,classNames:"image-gallery-wrapper",children:g.jsxs("div",{className:"image-gallery-wrapper",style:{zIndex:o?1:100},"data-pinned":o,ref:ne,onMouseLeave:o?void 0:fe,onMouseEnter:o?void 0:_e,onMouseOver:o?void 0:_e,children:[g.jsxs(hG,{minWidth:L,maxWidth:o?O:window.innerWidth,className:"image-gallery-popup",handleStyles:{left:{width:"15px"}},enable:{left:k},size:{width:w,height:o?"100%":"100vh"},onResizeStart:(xe,Le,Se)=>{K(Se.clientHeight),Se.style.height=`${Se.clientHeight}px`,o&&(Se.style.position="fixed",Se.style.right="1rem",W(!0))},onResizeStop:(xe,Le,Se,Je)=>{const Xe=o?Ce.clamp(Number(w)+Je.width,L,Number(O)):Number(w)+Je.width;e(L3e(Xe)),Se.removeAttribute("data-resize-alert"),o&&(Se.style.position="relative",Se.style.removeProperty("right"),Se.style.setProperty("height",o?"100%":"100vh"),W(!1),e(Li(!0)))},onResize:(xe,Le,Se,Je)=>{const Xe=Ce.clamp(Number(w)+Je.width,L,Number(o?O:.95*window.innerWidth));Xe>=Cx&&!D?I(!0):XeXe-rD&&e(Gv(Xe-rD)),o&&(Xe>=O?Se.setAttribute("data-resize-alert","true"):Se.removeAttribute("data-resize-alert")),Se.style.height=`${B}px`},children:[g.jsxs("div",{className:"image-gallery-header",children:[g.jsx(Gi,{size:"sm",isAttached:!0,variant:"solid",className:"image-gallery-category-btn-group",children:D?g.jsxs(g.Fragment,{children:[g.jsx(On,{size:"sm","data-selected":r==="result",onClick:()=>e(ex("result")),children:t("gallery.generations")}),g.jsx(On,{size:"sm","data-selected":r==="user",onClick:()=>e(ex("user")),children:t("gallery.uploads")})]}):g.jsxs(g.Fragment,{children:[g.jsx(Ye,{"aria-label":t("gallery.showGenerations"),tooltip:t("gallery.showGenerations"),"data-selected":r==="result",icon:g.jsx(Eke,{}),onClick:()=>e(ex("result"))}),g.jsx(Ye,{"aria-label":t("gallery.showUploads"),tooltip:t("gallery.showUploads"),"data-selected":r==="user",icon:g.jsx(Bke,{}),onClick:()=>e(ex("user"))})]})}),g.jsxs("div",{className:"image-gallery-header-right-icons",children:[g.jsx(Ys,{isLazy:!0,trigger:"hover",placement:"left",triggerComponent:g.jsx(Ye,{size:"sm","aria-label":t("gallery.gallerySettings"),icon:g.jsx(BE,{}),className:"image-gallery-icon-btn",cursor:"pointer"}),children:g.jsxs("div",{className:"image-gallery-settings-popover",children:[g.jsxs("div",{children:[g.jsx(Dn,{value:l,onChange:ee,min:32,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize")}),g.jsx(Ye,{size:"sm","aria-label":t("gallery.galleryImageResetSize"),tooltip:t("gallery.galleryImageResetSize"),onClick:()=>e(Gv(64)),icon:g.jsx(f4,{}),"data-selected":o,styleClass:"image-gallery-icon-btn"})]}),g.jsx("div",{children:g.jsx(Gn,{label:t("gallery.maintainAspectRatio"),isChecked:p==="contain",onChange:()=>e(T3e(p==="contain"?"cover":"contain"))})}),g.jsx("div",{children:g.jsx(Gn,{label:t("gallery.autoSwitchNewImages"),isChecked:y,onChange:xe=>e(M3e(xe.target.checked))})}),g.jsx("div",{children:g.jsx(Gn,{label:t("gallery.singleColumnLayout"),isChecked:T,onChange:xe=>e(A3e(xe.target.checked))})})]})}),g.jsx(Ye,{size:"sm",className:"image-gallery-icon-btn","aria-label":t("gallery.pinGallery"),tooltip:`${t("gallery.pinGallery")} (Shift+G)`,onClick:V,icon:o?g.jsx(pG,{}):g.jsx(gG,{})})]})]}),g.jsx("div",{className:"image-gallery-container",ref:z,children:n.length||b?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"image-gallery",style:{gridTemplateColumns:u},children:n.map(xe=>{const{uuid:Le}=xe,Se=i===Le;return g.jsx(XG,{image:xe,isSelected:Se},Le)})}),g.jsx(ss,{onClick:Y,isDisabled:!b,className:"image-gallery-load-more-btn",children:t(b?"gallery.loadMore":"gallery.allImagesLoaded")})]}):g.jsxs("div",{className:"image-gallery-container-placeholder",children:[g.jsx(mG,{}),g.jsx("p",{children:t("gallery.noImagesInGallery")})]})})]}),N&&g.jsx("div",{style:{width:`${w}px`,height:"100%"}})]})})}var ns=function(e,t){return Number(e.toFixed(t))},R8e=function(e,t){return typeof e=="number"?e:t},mr=function(e,t,n){n&&typeof n=="function"&&n(e,t)},I8e=function(e){return-Math.cos(e*Math.PI)/2+.5},D8e=function(e){return e},j8e=function(e){return e*e},N8e=function(e){return e*(2-e)},$8e=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},F8e=function(e){return e*e*e},B8e=function(e){return--e*e*e+1},z8e=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},H8e=function(e){return e*e*e*e},W8e=function(e){return 1- --e*e*e*e},U8e=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},V8e=function(e){return e*e*e*e*e},G8e=function(e){return 1+--e*e*e*e*e},q8e=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},QG={easeOut:I8e,linear:D8e,easeInQuad:j8e,easeOutQuad:N8e,easeInOutQuad:$8e,easeInCubic:F8e,easeOutCubic:B8e,easeInOutCubic:z8e,easeInQuart:H8e,easeOutQuart:W8e,easeInOutQuart:U8e,easeInQuint:V8e,easeOutQuint:G8e,easeInOutQuint:q8e},JG=function(e){typeof e=="number"&&cancelAnimationFrame(e)},Fl=function(e){e.mounted&&(JG(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function eq(e,t,n,r){if(e.mounted){var i=new Date().getTime(),o=1;Fl(e),e.animation=function(){if(!e.mounted)return JG(e.animation);var a=new Date().getTime()-i,s=a/n,l=QG[t],u=l(s);a>=n?(r(o),e.animation=null):e.animation&&(r(u),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function K8e(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function ff(e,t,n,r){var i=K8e(t);if(!(!e.mounted||!i)){var o=e.setTransformState,a=e.transformState,s=a.scale,l=a.positionX,u=a.positionY,d=t.scale-s,p=t.positionX-l,m=t.positionY-u;n===0?o(t.scale,t.positionX,t.positionY):eq(e,r,n,function(y){var b=s+d*y,w=l+p*y,E=u+m*y;o(b,w,E)})}}function Y8e(e,t,n){var r=e.offsetWidth,i=e.offsetHeight,o=t.offsetWidth,a=t.offsetHeight,s=o*n,l=a*n,u=r-s,d=i-l;return{wrapperWidth:r,wrapperHeight:i,newContentWidth:s,newDiffWidth:u,newContentHeight:l,newDiffHeight:d}}var X8e=function(e,t,n,r,i,o,a){var s=e>t?n*(a?1:.5):0,l=r>i?o*(a?1:.5):0,u=e-t-s,d=s,p=r-i-l,m=l;return{minPositionX:u,maxPositionX:d,minPositionY:p,maxPositionY:m}},XE=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,i=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var o=Y8e(n,r,t),a=o.wrapperWidth,s=o.wrapperHeight,l=o.newContentWidth,u=o.newDiffWidth,d=o.newContentHeight,p=o.newDiffHeight,m=X8e(a,l,u,s,d,p,Boolean(i));return m},r7=function(e,t,n,r){return r?en?ns(n,2):ns(e,2):ns(e,2)},t0=function(e,t){var n=XE(e,t);return e.bounds=n,n};function b4(e,t,n,r,i,o,a){var s=n.minPositionX,l=n.minPositionY,u=n.maxPositionX,d=n.maxPositionY,p=0,m=0;a&&(p=i,m=o);var y=r7(e,s-p,u+p,r),b=r7(t,l-m,d+m,r);return{x:y,y:b}}function x4(e,t,n,r,i,o){var a=e.transformState,s=a.scale,l=a.positionX,u=a.positionY,d=r-s;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:l,y:u};var p=l-t*d,m=u-n*d,y=b4(p,m,i,o,0,0,null);return y}function w2(e,t,n,r,i){var o=i?r:0,a=t-o;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=a?a:e}var oD=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,i=e.wrapperComponent,o=t.target,a=i==null?void 0:i.contains(o),s=r&&o&&a;if(!s)return!1;var l=S4(o,n);return!l},aD=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,i=r.panning.disabled,o=t&&n&&!i;return!!o},Z8e=function(e,t){var n=e.transformState,r=n.positionX,i=n.positionY;e.isPanning=!0;var o=t.clientX,a=t.clientY;e.startCoords={x:o-r,y:a-i}},Q8e=function(e,t){var n=t.touches,r=e.transformState,i=r.positionX,o=r.positionY;e.isPanning=!0;var a=n.length===1;if(a){var s=n[0].clientX,l=n[0].clientY;e.startCoords={x:s-i,y:l-o}}};function J8e(e){var t=e.transformState,n=t.positionX,r=t.positionY,i=t.scale,o=e.setup,a=o.disabled,s=o.limitToBounds,l=o.centerZoomedOut,u=e.wrapperComponent;if(!(a||!u||!e.bounds)){var d=e.bounds,p=d.maxPositionX,m=d.minPositionX,y=d.maxPositionY,b=d.minPositionY,w=n>p||ny||rp?u.offsetWidth:e.setup.minPositionX||0,k=r>y?u.offsetHeight:e.setup.minPositionY||0,T=x4(e,_,k,i,e.bounds,s||l),L=T.x,O=T.y;return{scale:i,positionX:w?L:n,positionY:E?O:r}}}function eEe(e,t,n,r,i){var o=e.setup.limitToBounds,a=e.wrapperComponent,s=e.bounds,l=e.transformState,u=l.scale,d=l.positionX,p=l.positionY;if(!(a===null||s===null||t===d&&n===p)){var m=b4(t,n,s,o,r,i,a),y=m.x,b=m.y;e.setTransformState(u,y,b)}}var tEe=function(e,t,n){var r=e.startCoords,i=e.transformState,o=e.setup.panning,a=o.lockAxisX,s=o.lockAxisY,l=i.positionX,u=i.positionY;if(!r)return{x:l,y:u};var d=t-r.x,p=n-r.y,m=a?l:d,y=s?u:p;return{x:m,y}},N3=function(e,t){var n=e.setup,r=e.transformState,i=r.scale,o=n.minScale,a=n.disablePadding;return t>0&&i>=o&&!a?t:0},nEe=function(e){var t=e.mounted,n=e.setup,r=n.disabled,i=n.velocityAnimation,o=e.transformState.scale,a=i.disabled,s=!a||o>1||!r||t;return!!s},rEe=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,i=e.setup,o=i.disabled,a=i.velocityAnimation,s=e.transformState.scale,l=a.disabled,u=!l||s>1||!o||t;return!(!u||!n||!r)};function iEe(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,i=n.animationTime,o=n.sensitivity;return r?i*t*o:i}function sD(e,t,n,r,i,o,a,s,l,u){if(i){if(t>a&&n>a){var d=a+(e-a)*u;return d>l?l:do?o:d}}return r?t:r7(e,o,a,i)}function oEe(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function aEe(e,t){var n=nEe(e);if(n){var r=e.lastMousePosition,i=e.velocityTime,o=e.setup,a=e.wrapperComponent,s=o.velocityAnimation.equalToMove,l=Date.now();if(r&&i&&a){var u=oEe(a,s),d=t.x-r.x,p=t.y-r.y,m=d/u,y=p/u,b=l-i,w=d*d+p*p,E=Math.sqrt(w)/b;e.velocity={velocityX:m,velocityY:y,total:E}}e.lastMousePosition=t,e.velocityTime=l}}function sEe(e){var t=e.velocity,n=e.bounds,r=e.setup,i=e.wrapperComponent,o=rEe(e);if(!(!o||!t||!n||!i)){var a=t.velocityX,s=t.velocityY,l=t.total,u=n.maxPositionX,d=n.minPositionX,p=n.maxPositionY,m=n.minPositionY,y=r.limitToBounds,b=r.alignmentAnimation,w=r.zoomAnimation,E=r.panning,_=E.lockAxisY,k=E.lockAxisX,T=w.animationType,L=b.sizeX,O=b.sizeY,D=b.velocityAlignmentTime,I=D,N=iEe(e,l),W=Math.max(N,I),B=N3(e,L),K=N3(e,O),ne=B*i.offsetWidth/100,z=K*i.offsetHeight/100,$=u+ne,V=d-ne,X=p+z,Q=m-z,G=e.transformState,Y=new Date().getTime();eq(e,T,W,function(ee){var fe=e.transformState,_e=fe.scale,we=fe.positionX,xe=fe.positionY,Le=new Date().getTime()-Y,Se=Le/I,Je=QG[b.animationType],Xe=1-Je(Math.min(1,Se)),tt=1-ee,yt=we+a*tt,Be=xe+s*tt,Ae=sD(yt,G.positionX,we,k,y,d,u,V,$,Xe),bt=sD(Be,G.positionY,xe,_,y,m,p,Q,X,Xe);(we!==yt||xe!==Be)&&e.setTransformState(_e,Ae,bt)})}}function lD(e,t){var n=e.transformState.scale;Fl(e),t0(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?Q8e(e,t):Z8e(e,t)}function tq(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,i=n.alignmentAnimation,o=i.disabled,a=i.sizeX,s=i.sizeY,l=i.animationTime,u=i.animationType,d=o||t.1&&p;m?sEe(e):tq(e)}}function ZE(e,t,n,r){var i=e.setup,o=i.minScale,a=i.maxScale,s=i.limitToBounds,l=w2(ns(t,2),o,a,0,!1),u=t0(e,l),d=x4(e,n,r,l,u,s),p=d.x,m=d.y;return{scale:l,positionX:p,positionY:m}}function nq(e,t,n){var r=e.transformState.scale,i=e.wrapperComponent,o=e.setup,a=o.minScale,s=o.limitToBounds,l=o.zoomAnimation,u=l.disabled,d=l.animationTime,p=l.animationType,m=u||r>=a;if((r>=1||s)&&tq(e),!(m||!i||!e.mounted)){var y=t||i.offsetWidth/2,b=n||i.offsetHeight/2,w=ZE(e,a,y,b);w&&ff(e,w,d,p)}}var Wd=function(){return Wd=Object.assign||function(t){for(var n,r=1,i=arguments.length;ra||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},_Ee=function(e,t){var n=e.setup.pinch,r=n.disabled,i=n.excluded,o=e.isInitialized,a=t.target,s=o&&!r&&a;if(!s)return!1;var l=S4(a,i);return!l},kEe=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,i=n&&!t&&r;return!!i},EEe=function(e,t,n){var r=n.getBoundingClientRect(),i=e.touches,o=ns(i[0].clientX-r.left,5),a=ns(i[0].clientY-r.top,5),s=ns(i[1].clientX-r.left,5),l=ns(i[1].clientY-r.top,5);return{x:(o+s)/2/t,y:(a+l)/2/t}},uq=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},PEe=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,i=e.setup,o=i.maxScale,a=i.minScale,s=i.zoomAnimation,l=i.disablePadding,u=s.size,d=s.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var p=t/r,m=p*n;return w2(ns(m,2),a,o,u,!d&&!l)},TEe=160,MEe=100,LEe=function(e,t){var n=e.props,r=n.onWheelStart,i=n.onZoomStart;e.wheelStopEventTimer||(Fl(e),mr(Un(e),t,r),mr(Un(e),t,i))},AEe=function(e,t){var n=e.props,r=n.onWheel,i=n.onZoom,o=e.contentComponent,a=e.setup,s=e.transformState,l=s.scale,u=a.limitToBounds,d=a.centerZoomedOut,p=a.zoomAnimation,m=a.wheel,y=a.disablePadding,b=p.size,w=p.disabled,E=m.step;if(!o)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var _=SEe(t,null),k=wEe(e,_,E,!t.ctrlKey);if(l!==k){var T=t0(e,k),L=lq(t,o,l),O=w||b===0||d||y,D=u&&O,I=x4(e,L.x,L.y,k,T,D),N=I.x,W=I.y;e.previousWheelEvent=t,e.setTransformState(k,N,W),mr(Un(e),t,r),mr(Un(e),t,i)}},OEe=function(e,t){var n=e.props,r=n.onWheelStop,i=n.onZoomStop;i7(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(nq(e,t.x,t.y),e.wheelAnimationTimer=null)},MEe);var o=CEe(e,t);o&&(i7(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,mr(Un(e),t,r),mr(Un(e),t,i))},TEe))},REe=function(e,t){var n=uq(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,Fl(e)},IEe=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,i=e.transformState.scale,o=e.setup,a=o.limitToBounds,s=o.centerZoomedOut,l=o.zoomAnimation,u=l.disabled,d=l.size;if(!(r===null||!n)){var p=EEe(t,i,n);if(!(!Number.isFinite(p.x)||!Number.isFinite(p.y))){var m=uq(t),y=PEe(e,m);if(y!==i){var b=t0(e,y),w=u||d===0||s,E=a&&w,_=x4(e,p.x,p.y,y,b,E),k=_.x,T=_.y;e.pinchMidpoint=p,e.lastDistance=m,e.setTransformState(y,k,T)}}}},DEe=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,nq(e,t==null?void 0:t.x,t==null?void 0:t.y)},cq=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;i7(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,mr(Un(e),t,n)},r)},jEe=function(e,t){var n=e.props,r=n.onZoomStart,i=n.onZoom,o=e.setup.doubleClick,a=o.animationTime,s=o.animationType;mr(Un(e),t,r),aq(e,a,s,function(){return mr(Un(e),t,i)}),cq(e,t)};function NEe(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,i=e.transformState,o=e.contentComponent,a=i.scale,s=e.props,l=s.onZoomStart,u=s.onZoom,d=n.doubleClick,p=d.disabled,m=d.mode,y=d.step,b=d.animationTime,w=d.animationType;if(!p&&!r){if(m==="reset")return jEe(e,t);if(!o)return console.error("No ContentComponent found");var E=m==="zoomOut"?-1:1,_=iq(e,E,y);if(a!==_){mr(Un(e),t,l);var k=lq(t,o,a),T=ZE(e,_,k.x,k.y);if(!T)return console.error("Error during zoom event. New transformation state was not calculated.");mr(Un(e),t,u),ff(e,T,b,w),cq(e,t)}}}var $Ee=function(e,t){var n=e.isInitialized,r=e.setup,i=e.wrapperComponent,o=r.doubleClick,a=o.disabled,s=o.excluded,l=t.target,u=i==null?void 0:i.contains(l),d=n&&l&&u&&!a;if(!d)return!1;var p=S4(l,s);return!p},FEe=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){t0(n,n.transformState.scale),n.setup=dD(r)},this.initializeWindowEvents=function(){var r,i=o6(),o=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,a=o==null?void 0:o.defaultView;a==null||a.addEventListener("mousedown",n.onPanningStart,i),a==null||a.addEventListener("mousemove",n.onPanning,i),a==null||a.addEventListener("mouseup",n.onPanningStop,i),o==null||o.addEventListener("mouseleave",n.clearPanning,i),a==null||a.addEventListener("keyup",n.setKeyUnPressed,i),a==null||a.addEventListener("keydown",n.setKeyPressed,i)},this.cleanupWindowEvents=function(){var r,i,o=o6(),a=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,s=a==null?void 0:a.defaultView;s==null||s.removeEventListener("mousedown",n.onPanningStart,o),s==null||s.removeEventListener("mousemove",n.onPanning,o),s==null||s.removeEventListener("mouseup",n.onPanningStop,o),a==null||a.removeEventListener("mouseleave",n.clearPanning,o),s==null||s.removeEventListener("keyup",n.setKeyUnPressed,o),s==null||s.removeEventListener("keydown",n.setKeyPressed,o),document.removeEventListener("mouseleave",n.clearPanning,o),Fl(n),(i=n.observer)===null||i===void 0||i.disconnect()},this.handleInitializeWrapperEvents=function(r){var i=o6();r.addEventListener("wheel",n.onWheelZoom,i),r.addEventListener("dblclick",n.onDoubleClick,i),r.addEventListener("touchstart",n.onTouchPanningStart,i),r.addEventListener("touchmove",n.onTouchPanning,i),r.addEventListener("touchend",n.onTouchPanningStop,i)},this.handleInitialize=function(r){var i=n.setup.centerOnInit;n.applyTransformation(),i&&(n.setCenter(),n.observer=new ResizeObserver(function(){var o;n.setCenter(),(o=n.observer)===null||o===void 0||o.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var i=n.setup.disabled;if(!i){var o=bEe(n,r);if(o){var a=n.isPressingKeys(n.setup.wheel.activationKeys);a&&(LEe(n,r),AEe(n,r),OEe(n,r))}}},this.onPanningStart=function(r){var i=n.setup.disabled,o=n.props.onPanningStart;if(!i){var a=oD(n,r);if(a){var s=n.isPressingKeys(n.setup.panning.activationKeys);s&&(r.preventDefault(),r.stopPropagation(),Fl(n),lD(n,r),mr(Un(n),r,o))}}},this.onPanning=function(r){var i=n.setup.disabled,o=n.props.onPanning;if(!i){var a=aD(n);if(a){var s=n.isPressingKeys(n.setup.panning.activationKeys);s&&(r.preventDefault(),r.stopPropagation(),uD(n,r.clientX,r.clientY),mr(Un(n),r,o))}}},this.onPanningStop=function(r){var i=n.props.onPanningStop;n.isPanning&&(lEe(n),mr(Un(n),r,i))},this.onPinchStart=function(r){var i=n.setup.disabled,o=n.props,a=o.onPinchingStart,s=o.onZoomStart;if(!i){var l=_Ee(n,r);l&&(REe(n,r),Fl(n),mr(Un(n),r,a),mr(Un(n),r,s))}},this.onPinch=function(r){var i=n.setup.disabled,o=n.props,a=o.onPinching,s=o.onZoom;if(!i){var l=kEe(n);l&&(r.preventDefault(),r.stopPropagation(),IEe(n,r),mr(Un(n),r,a),mr(Un(n),r,s))}},this.onPinchStop=function(r){var i=n.props,o=i.onPinchingStop,a=i.onZoomStop;n.pinchStartScale&&(DEe(n),mr(Un(n),r,o),mr(Un(n),r,a))},this.onTouchPanningStart=function(r){var i=n.setup.disabled,o=n.props.onPanningStart;if(!i){var a=oD(n,r);if(a){var s=n.lastTouch&&+new Date-n.lastTouch<200;if(s&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,Fl(n);var l=r.touches,u=l.length===1,d=l.length===2;u&&(Fl(n),lD(n,r),mr(Un(n),r,o)),d&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var i=n.setup.disabled,o=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(i)return;var a=aD(n);if(!a)return;r.preventDefault(),r.stopPropagation();var s=r.touches[0];uD(n,s.clientX,s.clientY),mr(Un(n),r,o)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var i=n.setup.disabled;if(!i){var o=$Ee(n,r);o&&NEe(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?Boolean(r.find(function(i){return n.pressedKeys[i]})):!0},this.setTransformState=function(r,i,o){var a=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(i)&&!Number.isNaN(o)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=i,n.transformState.positionY=o;var s=Un(n);n.onChangeCallbacks.forEach(function(l){return l(s)}),mr(s,{scale:r,positionX:i,positionY:o},a),n.applyTransformation()}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=sq(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,i,o){return n.props.customTransform?n.props.customTransform(r,i,o):vEe(r,i,o)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,i=r.scale,o=r.positionX,a=r.positionY,s=n.handleTransformStyles(o,a,i);n.contentComponent.style.transform=s}},this.getContext=function(){return Un(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,i){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=i,t0(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(i),n.initializeWindowEvents(),n.isInitialized=!0,mr(Un(n),void 0,n.props.onInit)},this.props=t,this.setup=dD(this.props),this.transformState=rq(this.props)}return e}(),QE=Ke.createContext(null),BEe=function(e,t){return typeof e=="function"?e(t):e},zEe=Ke.forwardRef(function(e,t){var n=S.useState(0),r=n[1],i=e.children,o=S.useRef(new FEe(e)).current,a=BEe(e.children,Un(o)),s=S.useCallback(function(){typeof i=="function"&&r(function(l){return l+1})},[i]);return S.useImperativeHandle(t,function(){return Un(o)},[o]),S.useEffect(function(){o.update(e)},[o,e]),S.useEffect(function(){return o.onChange(s)},[o,e,s]),Ke.createElement(QE.Provider,{value:o},a)});function HEe(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var WEe=`.transform-component-module_wrapper__7HFJe { position: relative; diff --git a/invokeai/frontend/dist/index.html b/invokeai/frontend/dist/index.html index 0e164d9d42..bf86a16cf9 100644 --- a/invokeai/frontend/dist/index.html +++ b/invokeai/frontend/dist/index.html @@ -5,7 +5,7 @@ InvokeAI - A Stable Diffusion Toolkit - + diff --git a/invokeai/frontend/src/features/parameters/store/postprocessingSlice.ts b/invokeai/frontend/src/features/parameters/store/postprocessingSlice.ts index 4e4d002265..f7ea040680 100644 --- a/invokeai/frontend/src/features/parameters/store/postprocessingSlice.ts +++ b/invokeai/frontend/src/features/parameters/store/postprocessingSlice.ts @@ -47,9 +47,10 @@ export const postprocessingSlice = createSlice({ ) => { const { type, hires_fix } = action.payload.image; - if (type === 'txt2img' && typeof hires_fix === 'boolean') - state.hiresFix = hires_fix; - // Strength of img2img used in hires_fix is not currently exposed in the Metadata for the final image. + if (type === 'txt2img') { + state.hiresFix = Boolean(hires_fix); + // Strength of img2img used in hires_fix is not currently exposed in the Metadata for the final image. + } }, setFacetoolStrength: (state, action: PayloadAction) => { state.facetoolStrength = action.payload;