diff --git a/invokeai/frontend/web/dist/assets/App-6440ab3b.js b/invokeai/frontend/web/dist/assets/App-6440ab3b.js new file mode 100644 index 0000000000..819de2897b --- /dev/null +++ b/invokeai/frontend/web/dist/assets/App-6440ab3b.js @@ -0,0 +1,171 @@ +import{a as Ou,b as vI,S as bI,c as xI,d as yI,e as G1,f as CI,i as q1,g as KR,h as wI,j as SI,k as QR,l as Ix,m as XR,n as YR,o as zw,p as kI,t as JR,q as ZR,r as eD,s as tD,u as nD,v as l,R as z,w as Px,x as Bh,y as rD,z as oD,A as sD,B as aD,P as iD,C as Ex,D as lD,E as cD,F as uD,G as dD,H as De,I as a,J as Gr,K as Un,L as Ae,M as kt,N as vr,O as ot,Q as wf,T as So,U as Ar,V as no,W as lr,X as Ci,Y as cl,Z as Vt,_ as Ms,$ as Yc,a0 as wi,a1 as Si,a2 as pg,a3 as Mx,a4 as Sf,a5 as K1,a6 as fD,a7 as Fw,a8 as pD,a9 as jI,aa as Q1,ab as kf,ac as Au,ad as hD,ae as _I,af as II,ag as PI,ah as ea,ai as mD,aj as me,ak as we,al as Nn,am as H,an as gD,ao as Bw,ap as vD,aq as bD,ar as xD,as as ki,at as Le,au as N,av as yo,aw as lo,ax as Ie,ay as Zl,az as Q,aA as EI,aB as yD,aC as CD,aD as wD,aE as SD,aF as ls,aG as Ox,aH as ji,aI as le,aJ as Qo,aK as jf,aL as kD,aM as jD,aN as Hw,aO as Ax,aP as je,aQ as ta,aR as _D,aS as MI,aT as OI,aU as Ww,aV as ID,aW as PD,aX as ED,aY as _i,aZ as Rx,a_ as fn,a$ as MD,b0 as OD,b1 as Ha,b2 as AI,b3 as RI,b4 as Ht,b5 as hg,b6 as AD,b7 as Vw,b8 as DI,b9 as RD,ba as DD,bb as TD,bc as ND,bd as $D,be as LD,bf as zD,bg as TI,bh as FD,bi as BD,bj as HD,bk as WD,bl as VD,bm as fu,bn as Dx,bo as UD,bp as GD,bq as qD,br as wc,bs as KD,bt as QD,bu as XD,bv as YD,bw as Uw,bx as JD,by as ZD,bz as Jc,bA as NI,bB as $I,bC as mg,bD as Tx,bE as Nx,bF as Rs,bG as LI,bH as e7,bI as Hl,bJ as Pd,bK as Gw,bL as t7,bM as n7,bN as r7,bO as Wp,bP as Vp,bQ as md,bR as Bv,bS as $d,bT as Ld,bU as zd,bV as Fd,bW as qw,bX as Hh,bY as Hv,bZ as Wh,b_ as Kw,b$ as X1,c0 as Wv,c1 as Y1,c2 as Qw,c3 as Vc,c4 as Vv,c5 as Vh,c6 as Xw,c7 as Wl,c8 as Yw,c9 as Vl,ca as Up,cb as Uh,cc as Jw,cd as J1,ce as Gh,cf as Zw,cg as Z1,ch as _f,ci as zI,cj as o7,ck as eS,cl as $x,cm as qh,cn as FI,co as Do,cp as gd,cq as Sc,cr as Lx,cs as BI,ct as Gp,cu as zx,cv as s7,cw as HI,cx as Uv,cy as gg,cz as a7,cA as WI,cB as eb,cC as tb,cD as VI,cE as i7,cF as nb,cG as l7,cH as rb,cI as c7,cJ as ob,cK as u7,cL as UI,cM as d7,cN as GI,cO as qI,cP as f7,cQ as KI,cR as Fx,cS as Bx,cT as Hx,cU as Wx,cV as vg,cW as Vx,cX as ni,cY as QI,cZ as XI,c_ as Ux,c$ as YI,d0 as p7,d1 as vd,d2 as di,d3 as JI,d4 as ZI,d5 as tS,d6 as Gx,d7 as eP,d8 as qx,d9 as Kx,da as tP,db as Rr,dc as h7,dd as to,de as m7,df as Ru,dg as bg,dh as Qx,di as nP,dj as rP,dk as g7,dl as v7,dm as b7,dn as Kh,dp as oP,dq as sP,dr as x7,ds as y7,dt as C7,du as w7,dv as S7,dw as k7,dx as j7,dy as _7,dz as nS,dA as Xx,dB as I7,dC as P7,dD as If,dE as E7,dF as M7,dG as xg,dH as O7,dI as A7,dJ as R7,dK as D7,dL as xr,dM as T7,dN as N7,dO as $7,dP as L7,dQ as z7,dR as F7,dS as rr,dT as Jd,dU as rS,dV as aa,dW as aP,dX as B7,dY as Yx,dZ as H7,d_ as oS,d$ as W7,e0 as V7,e1 as U7,e2 as iP,e3 as G7,e4 as q7,e5 as K7,e6 as Q7,e7 as X7,e8 as Y7,e9 as lP,ea as J7,eb as Z7,ec as sS,ed as eT,ee as tT,ef as nT,eg as rT,eh as oT,ei as sT,ej as aT,ek as cP,el as iT,em as lT,en as cT,eo as aS,ep as qp,eq as Fs,er as uT,es as dT,et as fT,eu as pT,ev as hT,ew as mT,ex as na,ey as gT,ez as vT,eA as bT,eB as xT,eC as yT,eD as CT,eE as wT,eF as ST,eG as kT,eH as jT,eI as _T,eJ as IT,eK as PT,eL as ET,eM as MT,eN as OT,eO as AT,eP as RT,eQ as DT,eR as TT,eS as NT,eT as $T,eU as LT,eV as zT,eW as FT,eX as iS,eY as uP,eZ as BT,e_ as Ys,e$ as Zd,f0 as Ro,f1 as HT,f2 as WT,f3 as dP,f4 as fP,f5 as VT,f6 as lS,f7 as UT,f8 as cS,f9 as uS,fa as dS,fb as GT,fc as qT,fd as fS,fe as pS,ff as KT,fg as QT,fh as Qh,fi as XT,fj as hS,fk as mS,fl as YT,fm as JT,fn as pP,fo as ZT,fp as eN,fq as hP,fr as tN,fs as nN,ft as gS,fu as rN,fv as vS,fw as oN,fx as sN,fy as mP,fz as gP,fA as Pf,fB as vP,fC as Al,fD as bP,fE as bS,fF as aN,fG as iN,fH as xP,fI as lN,fJ as cN,fK as uN,fL as dN,fM as fN,fN as Jx,fO as sb,fP as pN,fQ as hN,fR as mN,fS as yP,fT as Zx,fU as CP,fV as ey,fW as wP,fX as gN,fY as oi,fZ as vN,f_ as SP,f$ as Du,g0 as bN,g1 as ty,g2 as kP,g3 as xN,g4 as yN,g5 as CN,g6 as wN,g7 as SN,g8 as kN,g9 as Ed,ga as Uc,gb as xS,gc as jN,gd as _N,ge as IN,gf as PN,gg as EN,gh as MN,gi as ON,gj as yS,gk as AN,gl as RN,gm as DN,gn as TN,go as NN,gp as $N,gq as CS,gr as LN,gs as zN,gt as FN,gu as BN,gv as HN,gw as WN,gx as VN,gy as UN,gz as GN,gA as wS,gB as qN,gC as KN,gD as QN,gE as XN,gF as YN,gG as JN,gH as ZN,gI as e9,gJ as t9,gK as n9,gL as r9,gM as o9,gN as s9,gO as Ef,gP as a9,gQ as i9,gR as l9,gS as c9,gT as u9,gU as d9,gV as f9,gW as p9,gX as SS,gY as Ih,gZ as h9,g_ as Xh,g$ as jP,h0 as Yh,h1 as m9,h2 as g9,h3 as Zc,h4 as _P,h5 as IP,h6 as ny,h7 as v9,h8 as b9,h9 as x9,ha as ab,hb as PP,hc as y9,hd as C9,he as EP,hf as w9,hg as S9,hh as k9,hi as j9,hj as _9,hk as kS,hl as kc,hm as I9,hn as P9,ho as E9,hp as M9,hq as O9,hr as jS,hs as A9,ht as R9,hu as D9,hv as T9,hw as N9,hx as $9,hy as L9,hz as z9,hA as Gv,hB as qv,hC as Kv,hD as Kp,hE as _S,hF as ib,hG as IS,hH as F9,hI as B9,hJ as MP,hK as H9,hL as W9,hM as V9,hN as U9,hO as G9,hP as q9,hQ as K9,hR as Q9,hS as X9,hT as Y9,hU as J9,hV as Z9,hW as e$,hX as t$,hY as n$,hZ as Qp,h_ as Qv,h$ as r$,i0 as o$,i1 as s$,i2 as a$,i3 as i$,i4 as l$,i5 as c$,i6 as u$,i7 as d$,i8 as PS,i9 as ES,ia as f$,ib as p$,ic as h$,id as m$}from"./index-f820e2e3.js";import{u as OP,a as Ii,b as g$,r as qe,f as v$,g as MS,c as Xt,d as zr}from"./MantineProvider-a6a1d85c.js";var b$=200;function x$(e,t,n,r){var o=-1,s=xI,i=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Ou(t,vI(n))),r?(s=yI,i=!1):t.length>=b$&&(s=G1,i=!1,t=new bI(t));e:for(;++o=120&&h.length>=120)?new bI(i&&h):void 0}h=e[0];var m=-1,g=c[0];e:for(;++m{r.has(s)&&n(o,s)})}function T$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const AP=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:g,selected:b})=>{const{background:y,backgroundColor:x}=s||{},w=i||y||x;return z.createElement("rect",{className:Px(["react-flow__minimap-node",{selected:b},p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:w,stroke:c,strokeWidth:d,shapeRendering:m,onClick:g?S=>g(S,e):void 0})};AP.displayName="MiniMapNode";var N$=l.memo(AP);const $$=e=>e.nodeOrigin,L$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Xv=e=>e instanceof Function?e:()=>e;function z$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=N$,onClick:i}){const c=Bh(L$,Ex),d=Bh($$),p=Xv(t),h=Xv(e),m=Xv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return z.createElement(z.Fragment,null,c.map(b=>{const{x:y,y:x}=rD(b,d).positionAbsolute;return z.createElement(s,{key:b.id,x:y,y:x,width:b.width,height:b.height,style:b.style,selected:b.selected,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:g,onClick:i,id:b.id})}))}var F$=l.memo(z$);const B$=200,H$=150,W$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?uD(dD(t,e.nodeOrigin),n):n,rfId:e.rfId}},V$="react-flow__minimap-desc";function RP({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:b,pannable:y=!1,zoomable:x=!1,ariaLabel:w="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:I=5}){const _=oD(),M=l.useRef(null),{boundingRect:E,viewBB:A,rfId:R}=Bh(W$,Ex),D=(e==null?void 0:e.width)??B$,O=(e==null?void 0:e.height)??H$,T=E.width/D,K=E.height/O,G=Math.max(T,K),X=G*D,Z=G*O,te=I*G,V=E.x-(X-E.width)/2-te,oe=E.y-(Z-E.height)/2-te,ne=X+te*2,se=Z+te*2,re=`${V$}-${R}`,ae=l.useRef(0);ae.current=G,l.useEffect(()=>{if(M.current){const $=sD(M.current),F=W=>{const{transform:U,d3Selection:ee,d3Zoom:J}=_.getState();if(W.sourceEvent.type!=="wheel"||!ee||!J)return;const ge=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*j,he=U[2]*Math.pow(2,ge);J.scaleTo(ee,he)},q=W=>{const{transform:U,d3Selection:ee,d3Zoom:J,translateExtent:ge,width:he,height:de}=_.getState();if(W.sourceEvent.type!=="mousemove"||!ee||!J)return;const _e=ae.current*Math.max(1,U[2])*(S?-1:1),Pe={x:U[0]-W.sourceEvent.movementX*_e,y:U[1]-W.sourceEvent.movementY*_e},ze=[[0,0],[he,de]],ht=lD.translate(Pe.x,Pe.y).scale(U[2]),Je=J.constrain()(ht,ze,ge);J.transform(ee,Je)},pe=aD().on("zoom",y?q:null).on("zoom.wheel",x?F:null);return $.call(pe),()=>{$.on("zoom",null)}}},[y,x,S,j]);const B=g?$=>{const F=cD($);g($,{x:F[0],y:F[1]})}:void 0,Y=b?($,F)=>{const q=_.getState().nodeInternals.get(F);b($,q)}:void 0;return z.createElement(iD,{position:m,style:e,className:Px(["react-flow__minimap",t]),"data-testid":"rf__minimap"},z.createElement("svg",{width:D,height:O,viewBox:`${V} ${oe} ${ne} ${se}`,role:"img","aria-labelledby":re,ref:M,onClick:B},w&&z.createElement("title",{id:re},w),z.createElement(F$,{onClick:Y,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:c}),z.createElement("path",{className:"react-flow__minimap-mask",d:`M${V-te},${oe-te}h${ne+te*2}v${se+te*2}h${-ne-te*2}z + M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}RP.displayName="MiniMap";var U$=l.memo(RP),ra;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ra||(ra={}));function G$({color:e,dimensions:t,lineWidth:n}){return z.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function q$({color:e,radius:t}){return z.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const K$={[ra.Dots]:"#91919a",[ra.Lines]:"#eee",[ra.Cross]:"#e2e2e2"},Q$={[ra.Dots]:1,[ra.Lines]:1,[ra.Cross]:6},X$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function DP({id:e,variant:t=ra.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:c,className:d}){const p=l.useRef(null),{transform:h,patternId:m}=Bh(X$,Ex),g=i||K$[t],b=r||Q$[t],y=t===ra.Dots,x=t===ra.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*h[2]||1,w[1]*h[2]||1],j=b*h[2],I=x?[j,j]:S,_=y?[j/s,j/s]:[I[0]/s,I[1]/s];return z.createElement("svg",{className:Px(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},z.createElement("pattern",{id:m+e,x:h[0]%S[0],y:h[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`},y?z.createElement(q$,{color:g,radius:j/s}):z.createElement(G$,{dimensions:I,color:g,lineWidth:o})),z.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}DP.displayName="Background";var Y$=l.memo(DP);function J$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Z$=J$();const TP=1/60*1e3,eL=typeof performance<"u"?()=>performance.now():()=>Date.now(),NP=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(eL()),TP);function tL(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,c={schedule:(d,p=!1,h=!1)=>{const m=h&&o,g=m?t:n;return p&&i.add(d),g.indexOf(d)===-1&&(g.push(d),m&&o&&(r=t.length)),d},cancel:d=>{const p=n.indexOf(d);p!==-1&&n.splice(p,1),i.delete(d)},process:d=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=tL(()=>ef=!0),e),{}),rL=Mf.reduce((e,t)=>{const n=yg[t];return e[t]=(r,o=!1,s=!1)=>(ef||aL(),n.schedule(r,o,s)),e},{}),oL=Mf.reduce((e,t)=>(e[t]=yg[t].cancel,e),{});Mf.reduce((e,t)=>(e[t]=()=>yg[t].process(eu),e),{});const sL=e=>yg[e].process(eu),$P=e=>{ef=!1,eu.delta=lb?TP:Math.max(Math.min(e-eu.timestamp,nL),1),eu.timestamp=e,cb=!0,Mf.forEach(sL),cb=!1,ef&&(lb=!1,NP($P))},aL=()=>{ef=!0,lb=!0,cb||NP($P)},AS=()=>eu;function Cg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=l.Children.toArray(e.path),i=De((c,d)=>a.jsx(Gr,{ref:d,viewBox:t,...o,...c,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}var iL=Object.defineProperty,lL=(e,t,n)=>t in e?iL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mr=(e,t,n)=>(lL(e,typeof t!="symbol"?t+"":t,n),n);function RS(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var cL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function DS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function TS(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var ub=typeof window<"u"?l.useLayoutEffect:l.useEffect,Jh=e=>e,uL=class{constructor(){Mr(this,"descendants",new Map),Mr(this,"register",e=>{if(e!=null)return cL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Mr(this,"unregister",e=>{this.descendants.delete(e);const t=RS(Array.from(this.descendants.keys()));this.assignIndex(t)}),Mr(this,"destroy",()=>{this.descendants.clear()}),Mr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Mr(this,"count",()=>this.descendants.size),Mr(this,"enabledCount",()=>this.enabledValues().length),Mr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Mr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Mr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Mr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Mr(this,"first",()=>this.item(0)),Mr(this,"firstEnabled",()=>this.enabledItem(0)),Mr(this,"last",()=>this.item(this.descendants.size-1)),Mr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Mr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Mr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Mr(this,"next",(e,t=!0)=>{const n=DS(e,this.count(),t);return this.item(n)}),Mr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=DS(r,this.enabledCount(),t);return this.enabledItem(o)}),Mr(this,"prev",(e,t=!0)=>{const n=TS(e,this.count()-1,t);return this.item(n)}),Mr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=TS(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Mr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=RS(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function dL(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function xn(...e){return t=>{e.forEach(n=>{dL(n,t)})}}function fL(...e){return l.useMemo(()=>xn(...e),e)}function pL(){const e=l.useRef(new uL);return ub(()=>()=>e.current.destroy()),e.current}var[hL,LP]=Un({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function mL(e){const t=LP(),[n,r]=l.useState(-1),o=l.useRef(null);ub(()=>()=>{o.current&&t.unregister(o.current)},[]),ub(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Jh(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:xn(s,o)}}function ry(){return[Jh(hL),()=>Jh(LP()),()=>pL(),o=>mL(o)]}var[gL,wg]=Un({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[vL,oy]=Un({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[bL,Mbe,xL,yL]=ry(),Nc=De(function(t,n){const{getButtonProps:r}=oy(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...wg().button};return a.jsx(Ae.button,{...o,className:kt("chakra-accordion__button",t.className),__css:i})});Nc.displayName="AccordionButton";function Of(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,b)=>g!==b}=e,s=vr(r),i=vr(o),[c,d]=l.useState(n),p=t!==void 0,h=p?t:c,m=vr(g=>{const y=typeof g=="function"?g(h):g;i(h,y)&&(p||d(y),s(y))},[p,s,h,i]);return[h,m]}function CL(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;kL(e),jL(e);const c=xL(),[d,p]=l.useState(-1);l.useEffect(()=>()=>{p(-1)},[]);const[h,m]=Of({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:i,getAccordionItemProps:b=>{let y=!1;return b!==null&&(y=Array.isArray(h)?h.includes(b):h===b),{isOpen:y,onChange:w=>{if(b!==null)if(o&&Array.isArray(h)){const S=w?h.concat(b):h.filter(j=>j!==b);m(S)}else w?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:c}}var[wL,sy]=Un({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function SL(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=sy(),c=l.useRef(null),d=l.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;_L(e);const{register:g,index:b,descendants:y}=yL({disabled:t&&!n}),{isOpen:x,onChange:w}=s(b===-1?null:b);IL({isOpen:x,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},I=l.useCallback(()=>{w==null||w(!x),i(b)},[b,i,x,w]),_=l.useCallback(R=>{const O={ArrowDown:()=>{const T=y.nextEnabled(b);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(b);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[R.key];O&&(R.preventDefault(),O(R))},[y,b]),M=l.useCallback(()=>{i(b)},[i,b]),E=l.useCallback(function(D={},O=null){return{...D,type:"button",ref:xn(g,c,O),id:h,disabled:!!t,"aria-expanded":!!x,"aria-controls":m,onClick:ot(D.onClick,I),onFocus:ot(D.onFocus,M),onKeyDown:ot(D.onKeyDown,_)}},[h,t,x,I,M,_,m,g]),A=l.useCallback(function(D={},O=null){return{...D,ref:O,role:"region",id:m,"aria-labelledby":h,hidden:!x}},[h,x,m]);return{isOpen:x,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:E,getPanelProps:A,htmlProps:o}}function kL(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;wf({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function jL(e){wf({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function _L(e){wf({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. + `})}function IL(e){wf({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function $c(e){const{isOpen:t,isDisabled:n}=oy(),{reduceMotion:r}=sy(),o=kt("chakra-accordion__icon",e.className),s=wg(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(Gr,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}$c.displayName="AccordionIcon";var Lc=De(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=SL(t),d={...wg().container,overflowAnchor:"none"},p=l.useMemo(()=>i,[i]);return a.jsx(vL,{value:p,children:a.jsx(Ae.div,{ref:n,...s,className:kt("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Lc.displayName="AccordionItem";var Gc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Tl={enter:{duration:.2,ease:Gc.easeOut},exit:{duration:.1,ease:Gc.easeIn}},ii={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},PL=e=>e!=null&&parseInt(e.toString(),10)>0,NS={exit:{height:{duration:.2,ease:Gc.ease},opacity:{duration:.3,ease:Gc.ease}},enter:{height:{duration:.3,ease:Gc.ease},opacity:{duration:.4,ease:Gc.ease}}},EL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:PL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:ii.exit(NS.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:ii.enter(NS.enter,o)}}},Af=l.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:c,className:d,transition:p,transitionEnd:h,...m}=e,[g,b]=l.useState(!1);l.useEffect(()=>{const j=setTimeout(()=>{b(!0)});return()=>clearTimeout(j)},[]),wf({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,x={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(So,{initial:!1,custom:x,children:w&&a.jsx(Ar.div,{ref:t,...m,className:kt("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:x,variants:EL,initial:r?"exit":!1,animate:S,exit:"exit"})})});Af.displayName="Collapse";var ML={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:ii.enter(Tl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:ii.exit(Tl.exit,n),transitionEnd:t==null?void 0:t.exit}}},zP={initial:"exit",animate:"enter",exit:"exit",variants:ML},OL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:c,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,g={transition:i,transitionEnd:c,delay:d};return a.jsx(So,{custom:g,children:m&&a.jsx(Ar.div,{ref:n,className:kt("chakra-fade",s),custom:g,...zP,animate:h,...p})})});OL.displayName="Fade";var AL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:ii.exit(Tl.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:ii.enter(Tl.enter,n),transitionEnd:e==null?void 0:e.enter}}},FP={initial:"exit",animate:"enter",exit:"exit",variants:AL},RL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:c,transition:d,transitionEnd:p,delay:h,...m}=t,g=r?o&&r:!0,b=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:d,transitionEnd:p,delay:h};return a.jsx(So,{custom:y,children:g&&a.jsx(Ar.div,{ref:n,className:kt("chakra-offset-slide",c),...FP,animate:b,custom:y,...m})})});RL.displayName="ScaleFade";var DL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:ii.exit(Tl.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:ii.enter(Tl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const c={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:ii.exit(Tl.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},Md={initial:"initial",animate:"enter",exit:"exit",variants:DL},TL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:c=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...g}=t,b=r?o&&r:!0,y=o||r?"enter":"exit",x={offsetX:c,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return a.jsx(So,{custom:x,children:b&&a.jsx(Ar.div,{ref:n,className:kt("chakra-offset-slide",i),custom:x,...Md,animate:y,...g})})});TL.displayName="SlideFade";var zc=De(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=sy(),{getPanelProps:c,isOpen:d}=oy(),p=c(s,n),h=kt("chakra-accordion__panel",r),m=wg();i||delete p.hidden;const g=a.jsx(Ae.div,{...p,__css:m.panel,className:h});return i?g:a.jsx(Af,{in:d,...o,children:g})});zc.displayName="AccordionPanel";var BP=De(function({children:t,reduceMotion:n,...r},o){const s=no("Accordion",r),i=lr(r),{htmlProps:c,descendants:d,...p}=CL(i),h=l.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(bL,{value:d,children:a.jsx(wL,{value:h,children:a.jsx(gL,{value:s,children:a.jsx(Ae.div,{ref:o,...c,className:kt("chakra-accordion",r.className),__css:s.root,children:t})})})})});BP.displayName="Accordion";function Sg(e){return l.Children.toArray(e).filter(t=>l.isValidElement(t))}var[NL,$L]=Un({strict:!1,name:"ButtonGroupContext"}),LL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},zL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Hn=De(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:c="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,g=kt("chakra-button__group",i),b=l.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...d?LL[h]:zL[h](c)};const x=h==="vertical";return a.jsx(NL,{value:b,children:a.jsx(Ae.div,{ref:n,role:"group",__css:y,className:g,"data-attached":d?"":void 0,"data-orientation":h,flexDir:x?"column":void 0,...m})})});Hn.displayName="ButtonGroup";function FL(e){const[t,n]=l.useState(!e);return{ref:l.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function db(e){const{children:t,className:n,...r}=e,o=l.isValidElement(t)?l.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=kt("chakra-button__icon",n);return a.jsx(Ae.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}db.displayName="ButtonIcon";function fb(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(Ci,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...c}=e,d=kt("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=l.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(Ae.div,{className:d,...c,__css:h,children:o})}fb.displayName="ButtonSpinner";var nl=De((e,t)=>{const n=$L(),r=cl("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:c,leftIcon:d,rightIcon:p,loadingText:h,iconSpacing:m="0.5rem",type:g,spinner:b,spinnerPlacement:y="start",className:x,as:w,...S}=lr(e),j=l.useMemo(()=>{const E={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:E}}},[r,n]),{ref:I,type:_}=FL(w),M={rightIcon:p,leftIcon:d,iconSpacing:m,children:c};return a.jsxs(Ae.button,{ref:fL(t,I),as:w,type:g??_,"data-active":Vt(i),"data-loading":Vt(s),__css:j,className:kt("chakra-button",x),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(fb,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:m,children:b}),s?h||a.jsx(Ae.span,{opacity:0,children:a.jsx($S,{...M})}):a.jsx($S,{...M}),s&&y==="end"&&a.jsx(fb,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:m,children:b})]})});nl.displayName="Button";function $S(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(db,{marginEnd:o,children:t}),r,n&&a.jsx(db,{marginStart:o,children:n})]})}var Ia=De((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,c=n||r,d=l.isValidElement(c)?l.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(nl,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:d})});Ia.displayName="IconButton";var[Obe,BL]=Un({name:"CheckboxGroupContext",strict:!1});function HL(e){const[t,n]=l.useState(e),[r,o]=l.useState(!1);return e!==t&&(o(!0),n(e)),r}function WL(e){return a.jsx(Ae.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function VL(e){return a.jsx(Ae.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function UL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?VL:WL;return n||t?a.jsx(Ae.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[GL,HP]=Un({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[qL,Rf]=Un({strict:!1,name:"FormControlContext"});function KL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,c=l.useId(),d=t||`field-${c}`,p=`${d}-label`,h=`${d}-feedback`,m=`${d}-helptext`,[g,b]=l.useState(!1),[y,x]=l.useState(!1),[w,S]=l.useState(!1),j=l.useCallback((A={},R=null)=>({id:m,...A,ref:xn(R,D=>{D&&x(!0)})}),[m]),I=l.useCallback((A={},R=null)=>({...A,ref:R,"data-focus":Vt(w),"data-disabled":Vt(o),"data-invalid":Vt(r),"data-readonly":Vt(s),id:A.id!==void 0?A.id:p,htmlFor:A.htmlFor!==void 0?A.htmlFor:d}),[d,o,w,r,s,p]),_=l.useCallback((A={},R=null)=>({id:h,...A,ref:xn(R,D=>{D&&b(!0)}),"aria-live":"polite"}),[h]),M=l.useCallback((A={},R=null)=>({...A,...i,ref:R,role:"group","data-focus":Vt(w),"data-disabled":Vt(o),"data-invalid":Vt(r),"data-readonly":Vt(s)}),[i,o,w,r,s]),E=l.useCallback((A={},R=null)=>({...A,ref:R,role:"presentation","aria-hidden":!0,children:A.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:b,hasHelpText:y,setHasHelpText:x,id:d,labelId:p,feedbackId:h,helpTextId:m,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:_,getRootProps:M,getLabelProps:I,getRequiredIndicatorProps:E}}var Vn=De(function(t,n){const r=no("Form",t),o=lr(t),{getRootProps:s,htmlProps:i,...c}=KL(o),d=kt("chakra-form-control",t.className);return a.jsx(qL,{value:c,children:a.jsx(GL,{value:r,children:a.jsx(Ae.div,{...s({},n),className:d,__css:r.container})})})});Vn.displayName="FormControl";var WP=De(function(t,n){const r=Rf(),o=HP(),s=kt("chakra-form__helper-text",t.className);return a.jsx(Ae.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});WP.displayName="FormHelperText";var yr=De(function(t,n){var r;const o=cl("FormLabel",t),s=lr(t),{className:i,children:c,requiredIndicator:d=a.jsx(VP,{}),optionalIndicator:p=null,...h}=s,m=Rf(),g=(r=m==null?void 0:m.getLabelProps(h,n))!=null?r:{ref:n,...h};return a.jsxs(Ae.label,{...g,className:kt("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,m!=null&&m.isRequired?d:p]})});yr.displayName="FormLabel";var VP=De(function(t,n){const r=Rf(),o=HP();if(!(r!=null&&r.isRequired))return null;const s=kt("chakra-form__required-indicator",t.className);return a.jsx(Ae.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});VP.displayName="RequiredIndicator";function ay(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=iy(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Ms(n),"aria-required":Ms(o),"aria-readonly":Ms(r)}}function iy(e){var t,n,r;const o=Rf(),{id:s,disabled:i,readOnly:c,required:d,isRequired:p,isInvalid:h,isReadOnly:m,isDisabled:g,onFocus:b,onBlur:y,...x}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...x,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=c??m)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=d??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:ot(o==null?void 0:o.onFocus,b),onBlur:ot(o==null?void 0:o.onBlur,y)}}var ly={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},UP=Ae("span",{baseStyle:ly});UP.displayName="VisuallyHidden";var QL=Ae("input",{baseStyle:ly});QL.displayName="VisuallyHiddenInput";var XL=()=>typeof document<"u",LS=!1,Df=null,Ul=!1,pb=!1,hb=new Set;function cy(e,t){hb.forEach(n=>n(e,t))}var YL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function JL(e){return!(e.metaKey||!YL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function zS(e){Ul=!0,JL(e)&&(Df="keyboard",cy("keyboard",e))}function jc(e){if(Df="pointer",e.type==="mousedown"||e.type==="pointerdown"){Ul=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;cy("pointer",e)}}function ZL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function ez(e){ZL(e)&&(Ul=!0,Df="virtual")}function tz(e){e.target===window||e.target===document||(!Ul&&!pb&&(Df="virtual",cy("virtual",e)),Ul=!1,pb=!1)}function nz(){Ul=!1,pb=!0}function FS(){return Df!=="pointer"}function rz(){if(!XL()||LS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Ul=!0,e.apply(this,n)},document.addEventListener("keydown",zS,!0),document.addEventListener("keyup",zS,!0),document.addEventListener("click",ez,!0),window.addEventListener("focus",tz,!0),window.addEventListener("blur",nz,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",jc,!0),document.addEventListener("pointermove",jc,!0),document.addEventListener("pointerup",jc,!0)):(document.addEventListener("mousedown",jc,!0),document.addEventListener("mousemove",jc,!0),document.addEventListener("mouseup",jc,!0)),LS=!0}function GP(e){rz(),e(FS());const t=()=>e(FS());return hb.add(t),()=>{hb.delete(t)}}function oz(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function qP(e={}){const t=iy(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:c,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:g,onChange:b,isIndeterminate:y,name:x,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":I,"aria-invalid":_,...M}=e,E=oz(M,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),A=vr(b),R=vr(c),D=vr(d),[O,T]=l.useState(!1),[K,G]=l.useState(!1),[X,Z]=l.useState(!1),[te,V]=l.useState(!1);l.useEffect(()=>GP(T),[]);const oe=l.useRef(null),[ne,se]=l.useState(!0),[re,ae]=l.useState(!!h),B=m!==void 0,Y=B?m:re,$=l.useCallback(de=>{if(r||n){de.preventDefault();return}B||ae(Y?de.target.checked:y?!0:de.target.checked),A==null||A(de)},[r,n,Y,B,y,A]);Yc(()=>{oe.current&&(oe.current.indeterminate=!!y)},[y]),wi(()=>{n&&G(!1)},[n,G]),Yc(()=>{const de=oe.current;if(!(de!=null&&de.form))return;const _e=()=>{ae(!!h)};return de.form.addEventListener("reset",_e),()=>{var Pe;return(Pe=de.form)==null?void 0:Pe.removeEventListener("reset",_e)}},[]);const F=n&&!g,q=l.useCallback(de=>{de.key===" "&&V(!0)},[V]),pe=l.useCallback(de=>{de.key===" "&&V(!1)},[V]);Yc(()=>{if(!oe.current)return;oe.current.checked!==Y&&ae(oe.current.checked)},[oe.current]);const W=l.useCallback((de={},_e=null)=>{const Pe=ze=>{K&&ze.preventDefault(),V(!0)};return{...de,ref:_e,"data-active":Vt(te),"data-hover":Vt(X),"data-checked":Vt(Y),"data-focus":Vt(K),"data-focus-visible":Vt(K&&O),"data-indeterminate":Vt(y),"data-disabled":Vt(n),"data-invalid":Vt(s),"data-readonly":Vt(r),"aria-hidden":!0,onMouseDown:ot(de.onMouseDown,Pe),onMouseUp:ot(de.onMouseUp,()=>V(!1)),onMouseEnter:ot(de.onMouseEnter,()=>Z(!0)),onMouseLeave:ot(de.onMouseLeave,()=>Z(!1))}},[te,Y,n,K,O,X,y,s,r]),U=l.useCallback((de={},_e=null)=>({...de,ref:_e,"data-active":Vt(te),"data-hover":Vt(X),"data-checked":Vt(Y),"data-focus":Vt(K),"data-focus-visible":Vt(K&&O),"data-indeterminate":Vt(y),"data-disabled":Vt(n),"data-invalid":Vt(s),"data-readonly":Vt(r)}),[te,Y,n,K,O,X,y,s,r]),ee=l.useCallback((de={},_e=null)=>({...E,...de,ref:xn(_e,Pe=>{Pe&&se(Pe.tagName==="LABEL")}),onClick:ot(de.onClick,()=>{var Pe;ne||((Pe=oe.current)==null||Pe.click(),requestAnimationFrame(()=>{var ze;(ze=oe.current)==null||ze.focus({preventScroll:!0})}))}),"data-disabled":Vt(n),"data-checked":Vt(Y),"data-invalid":Vt(s)}),[E,n,Y,s,ne]),J=l.useCallback((de={},_e=null)=>({...de,ref:xn(oe,_e),type:"checkbox",name:x,value:w,id:i,tabIndex:S,onChange:ot(de.onChange,$),onBlur:ot(de.onBlur,R,()=>G(!1)),onFocus:ot(de.onFocus,D,()=>G(!0)),onKeyDown:ot(de.onKeyDown,q),onKeyUp:ot(de.onKeyUp,pe),required:o,checked:Y,disabled:F,readOnly:r,"aria-label":j,"aria-labelledby":I,"aria-invalid":_?!!_:s,"aria-describedby":p,"aria-disabled":n,style:ly}),[x,w,i,$,R,D,q,pe,o,Y,F,r,j,I,_,s,p,n,S]),ge=l.useCallback((de={},_e=null)=>({...de,ref:_e,onMouseDown:ot(de.onMouseDown,sz),"data-disabled":Vt(n),"data-checked":Vt(Y),"data-invalid":Vt(s)}),[Y,n,s]);return{state:{isInvalid:s,isFocused:K,isChecked:Y,isActive:te,isHovered:X,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:ee,getCheckboxProps:W,getIndicatorProps:U,getInputProps:J,getLabelProps:ge,htmlProps:E}}function sz(e){e.preventDefault(),e.stopPropagation()}var az={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},iz={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},lz=Si({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),cz=Si({from:{opacity:0},to:{opacity:1}}),uz=Si({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Tf=De(function(t,n){const r=BL(),o={...r,...t},s=no("Checkbox",o),i=lr(t),{spacing:c="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:g=a.jsx(UL,{}),isChecked:b,isDisabled:y=r==null?void 0:r.isDisabled,onChange:x,inputProps:w,...S}=i;let j=b;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let I=x;r!=null&&r.onChange&&i.value&&(I=pg(r.onChange,x));const{state:_,getInputProps:M,getCheckboxProps:E,getLabelProps:A,getRootProps:R}=qP({...S,isDisabled:y,isChecked:j,onChange:I}),D=HL(_.isChecked),O=l.useMemo(()=>({animation:D?_.isIndeterminate?`${cz} 20ms linear, ${uz} 200ms linear`:`${lz} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,D,_.isIndeterminate,s.icon]),T=l.cloneElement(g,{__css:O,isIndeterminate:_.isIndeterminate,isChecked:_.isChecked});return a.jsxs(Ae.label,{__css:{...iz,...s.container},className:kt("chakra-checkbox",d),...R(),children:[a.jsx("input",{className:"chakra-checkbox__input",...M(w,n)}),a.jsx(Ae.span,{__css:{...az,...s.control},className:"chakra-checkbox__control",...E(),children:T}),p&&a.jsx(Ae.span,{className:"chakra-checkbox__label",...A(),__css:{marginStart:c,...s.label},children:p})]})});Tf.displayName="Checkbox";function dz(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function uy(e,t){let n=dz(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function mb(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function Zh(e,t,n){return(e-t)*100/(n-t)}function KP(e,t,n){return(n-t)*e+t}function gb(e,t,n){const r=Math.round((e-t)/n)*n+t,o=mb(n);return uy(r,o)}function tu(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=Yv(r,s,n))!=null?O:""}),g=typeof o<"u",b=g?o:h,y=QP(Vi(b),s),x=n??y,w=l.useCallback(O=>{O!==b&&(g||m(O.toString()),p==null||p(O.toString(),Vi(O)))},[p,g,b]),S=l.useCallback(O=>{let T=O;return d&&(T=tu(T,i,c)),uy(T,x)},[x,d,c,i]),j=l.useCallback((O=s)=>{let T;b===""?T=Vi(O):T=Vi(b)+O,T=S(T),w(T)},[S,s,w,b]),I=l.useCallback((O=s)=>{let T;b===""?T=Vi(-O):T=Vi(b)-O,T=S(T),w(T)},[S,s,w,b]),_=l.useCallback(()=>{var O;let T;r==null?T="":T=(O=Yv(r,s,n))!=null?O:i,w(T)},[r,n,s,w,i]),M=l.useCallback(O=>{var T;const K=(T=Yv(O,s,x))!=null?T:i;w(K)},[x,s,w,i]),E=Vi(b);return{isOutOfRange:E>c||E" `}),[hz,dy]=Un({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),YP={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},Nf=De(function(t,n){const{getInputProps:r}=dy(),o=XP(),s=r(t,n),i=kt("chakra-editable__input",t.className);return a.jsx(Ae.input,{...s,__css:{outline:0,...YP,...o.input},className:i})});Nf.displayName="EditableInput";var $f=De(function(t,n){const{getPreviewProps:r}=dy(),o=XP(),s=r(t,n),i=kt("chakra-editable__preview",t.className);return a.jsx(Ae.span,{...s,__css:{cursor:"text",display:"inline-block",...YP,...o.preview},className:i})});$f.displayName="EditablePreview";function Nl(e,t,n,r){const o=vr(n);return l.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function mz(e){return"current"in e}var JP=()=>typeof window<"u";function gz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var vz=e=>JP()&&e.test(navigator.vendor),bz=e=>JP()&&e.test(gz()),xz=()=>bz(/mac|iphone|ipad|ipod/i),yz=()=>xz()&&vz(/apple/i);function ZP(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Nl(o,"pointerdown",s=>{if(!yz()||!r)return;const i=s.target,d=(n??[t]).some(p=>{const h=mz(p)?p.current:p;return(h==null?void 0:h.contains(i))||h===i});o().activeElement!==i&&d&&(s.preventDefault(),i.focus())})}function BS(e,t){return e?e===t||e.contains(t):!1}function Cz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:c,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:g,onEdit:b,finalFocusRef:y,...x}=e,w=vr(b),S=!!(d&&!i),[j,I]=l.useState(S),[_,M]=Of({defaultValue:c||"",value:s,onChange:t}),[E,A]=l.useState(_),R=l.useRef(null),D=l.useRef(null),O=l.useRef(null),T=l.useRef(null),K=l.useRef(null);ZP({ref:R,enabled:j,elements:[T,K]});const G=!j&&!i;Yc(()=>{var W,U;j&&((W=R.current)==null||W.focus(),m&&((U=R.current)==null||U.select()))},[]),wi(()=>{var W,U,ee,J;if(!j){y?(W=y.current)==null||W.focus():(U=O.current)==null||U.focus();return}(ee=R.current)==null||ee.focus(),m&&((J=R.current)==null||J.select()),w==null||w()},[j,w,m]);const X=l.useCallback(()=>{G&&I(!0)},[G]),Z=l.useCallback(()=>{A(_)},[_]),te=l.useCallback(()=>{I(!1),M(E),n==null||n(E),o==null||o(E)},[n,o,M,E]),V=l.useCallback(()=>{I(!1),A(_),r==null||r(_),o==null||o(E)},[_,r,o,E]);l.useEffect(()=>{if(j)return;const W=R.current;(W==null?void 0:W.ownerDocument.activeElement)===W&&(W==null||W.blur())},[j]);const oe=l.useCallback(W=>{M(W.currentTarget.value)},[M]),ne=l.useCallback(W=>{const U=W.key,J={Escape:te,Enter:ge=>{!ge.shiftKey&&!ge.metaKey&&V()}}[U];J&&(W.preventDefault(),J(W))},[te,V]),se=l.useCallback(W=>{const U=W.key,J={Escape:te}[U];J&&(W.preventDefault(),J(W))},[te]),re=_.length===0,ae=l.useCallback(W=>{var U;if(!j)return;const ee=W.currentTarget.ownerDocument,J=(U=W.relatedTarget)!=null?U:ee.activeElement,ge=BS(T.current,J),he=BS(K.current,J);!ge&&!he&&(h?V():te())},[h,V,te,j]),B=l.useCallback((W={},U=null)=>{const ee=G&&p?0:void 0;return{...W,ref:xn(U,D),children:re?g:_,hidden:j,"aria-disabled":Ms(i),tabIndex:ee,onFocus:ot(W.onFocus,X,Z)}},[i,j,G,p,re,X,Z,g,_]),Y=l.useCallback((W={},U=null)=>({...W,hidden:!j,placeholder:g,ref:xn(U,R),disabled:i,"aria-disabled":Ms(i),value:_,onBlur:ot(W.onBlur,ae),onChange:ot(W.onChange,oe),onKeyDown:ot(W.onKeyDown,ne),onFocus:ot(W.onFocus,Z)}),[i,j,ae,oe,ne,Z,g,_]),$=l.useCallback((W={},U=null)=>({...W,hidden:!j,placeholder:g,ref:xn(U,R),disabled:i,"aria-disabled":Ms(i),value:_,onBlur:ot(W.onBlur,ae),onChange:ot(W.onChange,oe),onKeyDown:ot(W.onKeyDown,se),onFocus:ot(W.onFocus,Z)}),[i,j,ae,oe,se,Z,g,_]),F=l.useCallback((W={},U=null)=>({"aria-label":"Edit",...W,type:"button",onClick:ot(W.onClick,X),ref:xn(U,O),disabled:i}),[X,i]),q=l.useCallback((W={},U=null)=>({...W,"aria-label":"Submit",ref:xn(K,U),type:"button",onClick:ot(W.onClick,V),disabled:i}),[V,i]),pe=l.useCallback((W={},U=null)=>({"aria-label":"Cancel",id:"cancel",...W,ref:xn(T,U),type:"button",onClick:ot(W.onClick,te),disabled:i}),[te,i]);return{isEditing:j,isDisabled:i,isValueEmpty:re,value:_,onEdit:X,onCancel:te,onSubmit:V,getPreviewProps:B,getInputProps:Y,getTextareaProps:$,getEditButtonProps:F,getSubmitButtonProps:q,getCancelButtonProps:pe,htmlProps:x}}var Lf=De(function(t,n){const r=no("Editable",t),o=lr(t),{htmlProps:s,...i}=Cz(o),{isEditing:c,onSubmit:d,onCancel:p,onEdit:h}=i,m=kt("chakra-editable",t.className),g=Mx(t.children,{isEditing:c,onSubmit:d,onCancel:p,onEdit:h});return a.jsx(hz,{value:i,children:a.jsx(pz,{value:r,children:a.jsx(Ae.div,{ref:n,...s,className:m,children:g})})})});Lf.displayName="Editable";function e5(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=dy();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var t5={exports:{}},wz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Sz=wz,kz=Sz;function n5(){}function r5(){}r5.resetWarningCache=n5;var jz=function(){function e(r,o,s,i,c,d){if(d!==kz){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r5,resetWarningCache:n5};return n.PropTypes=n,n};t5.exports=jz();var _z=t5.exports;const nr=Sf(_z);var vb="data-focus-lock",o5="data-focus-lock-disabled",Iz="data-no-focus-lock",Pz="data-autofocus-inside",Ez="data-no-autofocus";function Mz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Oz(e,t){var n=l.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function s5(e,t){return Oz(t||null,function(n){return e.forEach(function(r){return Mz(r,n)})})}var Jv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},wa=function(){return wa=Object.assign||function(t){for(var n,r=1,o=arguments.length;r=0}).sort(Gz)},qz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],my=qz.join(","),Kz="".concat(my,", [data-focus-guard]"),S5=function(e,t){return Wa((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?Kz:my)?[r]:[],S5(r))},[])},Qz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?kg([e.contentDocument.body],t):[e]},kg=function(e,t){return e.reduce(function(n,r){var o,s=S5(r,t),i=(o=[]).concat.apply(o,s.map(function(c){return Qz(c,t)}));return n.concat(i,r.parentNode?Wa(r.parentNode.querySelectorAll(my)).filter(function(c){return c===r}):[])},[])},Xz=function(e){var t=e.querySelectorAll("[".concat(Pz,"]"));return Wa(t).map(function(n){return kg([n])}).reduce(function(n,r){return n.concat(r)},[])},gy=function(e,t){return Wa(e).filter(function(n){return v5(t,n)}).filter(function(n){return Wz(n)})},HS=function(e,t){return t===void 0&&(t=new Map),Wa(e).filter(function(n){return b5(t,n)})},xb=function(e,t,n){return w5(gy(kg(e,n),t),!0,n)},WS=function(e,t){return w5(gy(kg(e),t),!1)},Yz=function(e,t){return gy(Xz(e),t)},nu=function(e,t){return e.shadowRoot?nu(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Wa(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?nu(o,t):!1}return nu(n,t)})},Jz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,c){return!t.has(c)})},k5=function(e){return e.parentNode?k5(e.parentNode):e},vy=function(e){var t=em(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(vb);return n.push.apply(n,o?Jz(Wa(k5(r).querySelectorAll("[".concat(vb,'="').concat(o,'"]:not([').concat(o5,'="disabled"])')))):[r]),n},[])},Zz=function(e){try{return e()}catch{return}},tf=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?tf(t.shadowRoot):t instanceof HTMLIFrameElement&&Zz(function(){return t.contentWindow.document})?tf(t.contentWindow.document):t}},eF=function(e,t){return e===t},tF=function(e,t){return!!Wa(e.querySelectorAll("iframe")).some(function(n){return eF(n,t)})},j5=function(e,t){return t===void 0&&(t=tf(h5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:vy(e).some(function(n){return nu(n,t)||tF(n,t)})},nF=function(e){e===void 0&&(e=document);var t=tf(e);return t?Wa(e.querySelectorAll("[".concat(Iz,"]"))).some(function(n){return nu(n,t)}):!1},rF=function(e,t){return t.filter(C5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},by=function(e,t){return C5(e)&&e.name?rF(e,t):e},oF=function(e){var t=new Set;return e.forEach(function(n){return t.add(by(n,e))}),e.filter(function(n){return t.has(n)})},VS=function(e){return e[0]&&e.length>1?by(e[0],e):e[0]},US=function(e,t){return e.length>1?e.indexOf(by(e[t],e)):t},_5="NEW_FOCUS",sF=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],c=hy(n);if(!(n&&e.indexOf(n)>=0)){var d=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):d,h=r?e.indexOf(r):-1,m=d-p,g=t.indexOf(s),b=t.indexOf(i),y=oF(t),x=n!==void 0?y.indexOf(n):-1,w=x-(r?y.indexOf(r):d),S=US(e,0),j=US(e,o-1);if(d===-1||h===-1)return _5;if(!m&&h>=0)return h;if(d<=g&&c&&Math.abs(m)>1)return j;if(d>=b&&c&&Math.abs(m)>1)return S;if(m&&Math.abs(w)>1)return h;if(d<=g)return j;if(d>b)return S;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},aF=function(e){return function(t){var n,r=(n=x5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},iF=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=HS(r.filter(aF(n)));return o&&o.length?VS(o):VS(HS(t))},yb=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&yb(e.parentNode.host||e.parentNode,t),t},Zv=function(e,t){for(var n=yb(e),r=yb(t),o=0;o=0)return s}return!1},I5=function(e,t,n){var r=em(e),o=em(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(c){i=Zv(i||c,c)||i,n.filter(Boolean).forEach(function(d){var p=Zv(s,d);p&&(!i||nu(p,i)?i=p:i=Zv(p,i))})}),i},lF=function(e,t){return e.reduce(function(n,r){return n.concat(Yz(r,t))},[])},cF=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(Uz)},uF=function(e,t){var n=tf(em(e).length>0?document:h5(e).ownerDocument),r=vy(e).filter(tm),o=I5(n||e,e,r),s=new Map,i=WS(r,s),c=xb(r,s).filter(function(b){var y=b.node;return tm(y)});if(!(!c[0]&&(c=i,!c[0]))){var d=WS([o],s).map(function(b){var y=b.node;return y}),p=cF(d,c),h=p.map(function(b){var y=b.node;return y}),m=sF(h,d,n,t);if(m===_5){var g=iF(i,h,lF(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},dF=function(e){var t=vy(e).filter(tm),n=I5(e,e,t),r=new Map,o=xb([n],r,!0),s=xb(t,r).filter(function(i){var c=i.node;return tm(c)}).map(function(i){var c=i.node;return c});return o.map(function(i){var c=i.node,d=i.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:hy(c)}})},fF=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},e1=0,t1=!1,P5=function(e,t,n){n===void 0&&(n={});var r=uF(e,t);if(!t1&&r){if(e1>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),t1=!0,setTimeout(function(){t1=!1},1);return}e1++,fF(r.node,n.focusOptions),e1--}};function xy(e){setTimeout(e,1)}var pF=function(){return document&&document.activeElement===document.body},hF=function(){return pF()||nF()},ru=null,qc=null,ou=null,nf=!1,mF=function(){return!0},gF=function(t){return(ru.whiteList||mF)(t)},vF=function(t,n){ou={observerNode:t,portaledElement:n}},bF=function(t){return ou&&ou.portaledElement===t};function GS(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var xF=function(t){return t&&"current"in t?t.current:t},yF=function(t){return t?!!nf:nf==="meanwhile"},CF=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},wF=function(t,n){return n.some(function(r){return CF(t,r,r)})},nm=function(){var t=!1;if(ru){var n=ru,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,c=n.crossFrame,d=n.focusOptions,p=r||ou&&ou.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(i.map(xF).filter(Boolean));if((!h||gF(h))&&(o||yF(c)||!hF()||!qc&&s)&&(p&&!(j5(m)||h&&wF(h,m)||bF(h))&&(document&&!qc&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=P5(m,qc,{focusOptions:d}),ou={})),nf=!1,qc=document&&document.activeElement),document){var g=document&&document.activeElement,b=dF(m),y=b.map(function(x){var w=x.node;return w}).indexOf(g);y>-1&&(b.filter(function(x){var w=x.guard,S=x.node;return w&&S.dataset.focusAutoGuard}).forEach(function(x){var w=x.node;return w.removeAttribute("tabIndex")}),GS(y,b.length,1,b),GS(y,-1,-1,b))}}}return t},E5=function(t){nm()&&t&&(t.stopPropagation(),t.preventDefault())},yy=function(){return xy(nm)},SF=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||vF(r,n)},kF=function(){return null},M5=function(){nf="just",xy(function(){nf="meanwhile"})},jF=function(){document.addEventListener("focusin",E5),document.addEventListener("focusout",yy),window.addEventListener("blur",M5)},_F=function(){document.removeEventListener("focusin",E5),document.removeEventListener("focusout",yy),window.removeEventListener("blur",M5)};function IF(e){return e.filter(function(t){var n=t.disabled;return!n})}function PF(e){var t=e.slice(-1)[0];t&&!ru&&jF();var n=ru,r=n&&t&&t.id===n.id;ru=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(qc=null,(!r||n.observed!==t.observed)&&t.onActivation(),nm(),xy(nm)):(_F(),qc=null)}d5.assignSyncMedium(SF);f5.assignMedium(yy);Dz.assignMedium(function(e){return e({moveFocusInside:P5,focusInside:j5})});const EF=Lz(IF,PF)(kF);var O5=l.forwardRef(function(t,n){return l.createElement(p5,K1({sideCar:EF,ref:n},t))}),A5=p5.propTypes||{};A5.sideCar;T$(A5,["sideCar"]);O5.propTypes={};const qS=O5;function R5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cy(e){var t;if(!R5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function MF(e){var t,n;return(n=(t=D5(e))==null?void 0:t.defaultView)!=null?n:window}function D5(e){return R5(e)?e.ownerDocument:document}function OF(e){return D5(e).activeElement}function AF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function RF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function T5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:Cy(e)&&AF(e)?e:T5(RF(e))}var N5=e=>e.hasAttribute("tabindex"),DF=e=>N5(e)&&e.tabIndex===-1;function TF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function $5(e){return e.parentElement&&$5(e.parentElement)?!0:e.hidden}function NF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function L5(e){if(!Cy(e)||$5(e)||TF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():NF(e)?!0:N5(e)}function $F(e){return e?Cy(e)&&L5(e)&&!DF(e):!1}var LF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],zF=LF.join(),FF=e=>e.offsetWidth>0&&e.offsetHeight>0;function z5(e){const t=Array.from(e.querySelectorAll(zF));return t.unshift(e),t.filter(n=>L5(n)&&FF(n))}var KS,BF=(KS=qS.default)!=null?KS:qS,F5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=l.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&z5(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),m=l.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),g=o&&!n;return a.jsx(BF,{crossFrame:p,persistentFocus:d,autoFocus:c,disabled:i,onActivation:h,onDeactivation:m,returnFocus:g,children:s})};F5.displayName="FocusLock";var HF=Z$?l.useLayoutEffect:l.useEffect;function Cb(e,t=[]){const n=l.useRef(e);return HF(()=>{n.current=e}),l.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function WF(e,t,n,r){const o=Cb(t);return l.useEffect(()=>{var s;const i=(s=Fw(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Fw(n))!=null?s:document).removeEventListener(e,o,r)}}function VF(e,t){const n=l.useId();return l.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function UF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function hs(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Cb(n),i=Cb(t),[c,d]=l.useState(e.defaultIsOpen||!1),[p,h]=UF(r,c),m=VF(o,"disclosure"),g=l.useCallback(()=>{p||d(!1),i==null||i()},[p,i]),b=l.useCallback(()=>{p||d(!0),s==null||s()},[p,s]),y=l.useCallback(()=>{(h?g:b)()},[h,b,g]);return{isOpen:!!h,onOpen:b,onClose:g,onToggle:y,isControlled:p,getButtonProps:(x={})=>({...x,"aria-expanded":h,"aria-controls":m,onClick:pD(x.onClick,y)}),getDisclosureProps:(x={})=>({...x,hidden:!h,id:m})}}var[GF,qF]=Un({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),B5=De(function(t,n){const r=no("Input",t),{children:o,className:s,...i}=lr(t),c=kt("chakra-input__group",s),d={},p=Sg(o),h=r.field;p.forEach(g=>{var b,y;r&&(h&&g.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&g.type.id==="InputRightElement"&&(d.paddingEnd=(y=h.height)!=null?y:h.h),g.type.id==="InputRightAddon"&&(d.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(g=>{var b,y;const x=jI({size:((b=g.props)==null?void 0:b.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?l.cloneElement(g,x):l.cloneElement(g,Object.assign(x,d,g.props))});return a.jsx(Ae.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(GF,{value:r,children:m})})});B5.displayName="InputGroup";var KF=Ae("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),jg=De(function(t,n){var r,o;const{placement:s="left",...i}=t,c=qF(),d=c.field,h={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=d==null?void 0:d.height)!=null?r:d==null?void 0:d.h,height:(o=d==null?void 0:d.height)!=null?o:d==null?void 0:d.h,fontSize:d==null?void 0:d.fontSize,...c.element};return a.jsx(KF,{ref:n,__css:h,...i})});jg.id="InputElement";jg.displayName="InputElement";var H5=De(function(t,n){const{className:r,...o}=t,s=kt("chakra-input__left-element",r);return a.jsx(jg,{ref:n,placement:"left",className:s,...o})});H5.id="InputLeftElement";H5.displayName="InputLeftElement";var wy=De(function(t,n){const{className:r,...o}=t,s=kt("chakra-input__right-element",r);return a.jsx(jg,{ref:n,placement:"right",className:s,...o})});wy.id="InputRightElement";wy.displayName="InputRightElement";var _g=De(function(t,n){const{htmlSize:r,...o}=t,s=no("Input",o),i=lr(o),c=ay(i),d=kt("chakra-input",t.className);return a.jsx(Ae.input,{size:r,...c,__css:s.field,ref:n,className:d})});_g.displayName="Input";_g.id="Input";var Ig=De(function(t,n){const r=cl("Link",t),{className:o,isExternal:s,...i}=lr(t);return a.jsx(Ae.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:kt("chakra-link",o),...i,__css:r})});Ig.displayName="Link";var[QF,W5]=Un({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Sy=De(function(t,n){const r=no("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:c,...d}=lr(t),p=Sg(o),m=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return a.jsx(QF,{value:r,children:a.jsx(Ae.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...m},...d,children:p})})});Sy.displayName="List";var V5=De((e,t)=>{const{as:n,...r}=e;return a.jsx(Sy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});V5.displayName="OrderedList";var zf=De(function(t,n){const{as:r,...o}=t;return a.jsx(Sy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});zf.displayName="UnorderedList";var Ps=De(function(t,n){const r=W5();return a.jsx(Ae.li,{ref:n,...t,__css:r.item})});Ps.displayName="ListItem";var XF=De(function(t,n){const r=W5();return a.jsx(Gr,{ref:n,role:"presentation",...t,__css:r.icon})});XF.displayName="ListIcon";var rl=De(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:c,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:g,templateColumns:b,...y}=t,x={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:c,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return a.jsx(Ae.div,{ref:n,__css:x,...y})});rl.displayName="Grid";function U5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Q1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var Pi=Ae("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});Pi.displayName="Spacer";var G5=e=>a.jsx(Ae.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});G5.displayName="StackItem";function YF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":U5(n,o=>r[o])}}var ky=De((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:c,children:d,divider:p,className:h,shouldWrapChildren:m,...g}=e,b=n?"row":r??"column",y=l.useMemo(()=>YF({spacing:i,direction:b}),[i,b]),x=!!p,w=!m&&!x,S=l.useMemo(()=>{const I=Sg(d);return w?I:I.map((_,M)=>{const E=typeof _.key<"u"?_.key:M,A=M+1===I.length,D=m?a.jsx(G5,{children:_},E):_;if(!x)return D;const O=l.cloneElement(p,{__css:y}),T=A?null:O;return a.jsxs(l.Fragment,{children:[D,T]},E)})},[p,y,x,w,m,d]),j=kt("chakra-stack",h);return a.jsx(Ae.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:x?void 0:i,className:j,...g,children:S})});ky.displayName="Stack";var q5=De((e,t)=>a.jsx(ky,{align:"center",...e,direction:"column",ref:t}));q5.displayName="VStack";var Pg=De((e,t)=>a.jsx(ky,{align:"center",...e,direction:"row",ref:t}));Pg.displayName="HStack";function QS(e){return U5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var rf=De(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:c,rowSpan:d,rowStart:p,...h}=t,m=jI({gridArea:r,gridColumn:QS(o),gridRow:QS(d),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:c});return a.jsx(Ae.div,{ref:n,__css:m,...h})});rf.displayName="GridItem";var Va=De(function(t,n){const r=cl("Badge",t),{className:o,...s}=lr(t);return a.jsx(Ae.span,{ref:n,className:kt("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Va.displayName="Badge";var io=De(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:c,borderStyle:d,borderColor:p,...h}=cl("Divider",t),{className:m,orientation:g="horizontal",__css:b,...y}=lr(t),x={vertical:{borderLeftWidth:r||i||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return a.jsx(Ae.hr,{ref:n,"aria-orientation":g,...y,__css:{...h,border:"0",borderColor:p,borderStyle:d,...x[g],...b},className:kt("chakra-divider",m)})});io.displayName="Divider";function JF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function ZF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=l.useState([]),s=l.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};l.useEffect(()=>i,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(JF(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),c()}}}return d}function eB(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function tB(){const e=l.useRef(new Map),t=e.current,n=l.useCallback((o,s,i,c)=>{e.current.set(i,{type:s,el:o,options:c}),o.addEventListener(s,i,c)},[]),r=l.useCallback((o,s,i,c)=>{o.removeEventListener(s,i,c),e.current.delete(i)},[]);return l.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function n1(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function K5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:c,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:g,onMouseLeave:b,...y}=e,[x,w]=l.useState(!0),[S,j]=l.useState(!1),I=tB(),_=V=>{V&&V.tagName!=="BUTTON"&&w(!1)},M=x?m:m||0,E=n&&!r,A=l.useCallback(V=>{if(n){V.stopPropagation(),V.preventDefault();return}V.currentTarget.focus(),d==null||d(V)},[n,d]),R=l.useCallback(V=>{S&&n1(V)&&(V.preventDefault(),V.stopPropagation(),j(!1),I.remove(document,"keyup",R,!1))},[S,I]),D=l.useCallback(V=>{if(p==null||p(V),n||V.defaultPrevented||V.metaKey||!n1(V.nativeEvent)||x)return;const oe=o&&V.key==="Enter";s&&V.key===" "&&(V.preventDefault(),j(!0)),oe&&(V.preventDefault(),V.currentTarget.click()),I.add(document,"keyup",R,!1)},[n,x,p,o,s,I,R]),O=l.useCallback(V=>{if(h==null||h(V),n||V.defaultPrevented||V.metaKey||!n1(V.nativeEvent)||x)return;s&&V.key===" "&&(V.preventDefault(),j(!1),V.currentTarget.click())},[s,x,n,h]),T=l.useCallback(V=>{V.button===0&&(j(!1),I.remove(document,"mouseup",T,!1))},[I]),K=l.useCallback(V=>{if(V.button!==0)return;if(n){V.stopPropagation(),V.preventDefault();return}x||j(!0),V.currentTarget.focus({preventScroll:!0}),I.add(document,"mouseup",T,!1),i==null||i(V)},[n,x,i,I,T]),G=l.useCallback(V=>{V.button===0&&(x||j(!1),c==null||c(V))},[c,x]),X=l.useCallback(V=>{if(n){V.preventDefault();return}g==null||g(V)},[n,g]),Z=l.useCallback(V=>{S&&(V.preventDefault(),j(!1)),b==null||b(V)},[S,b]),te=xn(t,_);return x?{...y,ref:te,type:"button","aria-disabled":E?void 0:n,disabled:E,onClick:A,onMouseDown:i,onMouseUp:c,onKeyUp:h,onKeyDown:p,onMouseOver:g,onMouseLeave:b}:{...y,ref:te,role:"button","data-active":Vt(S),"aria-disabled":n?"true":void 0,tabIndex:E?void 0:M,onClick:A,onMouseDown:K,onMouseUp:G,onKeyUp:O,onKeyDown:D,onMouseOver:X,onMouseLeave:Z}}function nB(e){const t=e.current;if(!t)return!1;const n=OF(t);return!n||t.contains(n)?!1:!!$F(n)}function Q5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;wi(()=>{if(!s||nB(e))return;const i=(o==null?void 0:o.current)||e.current;let c;if(i)return c=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var rB={preventScroll:!0,shouldFocus:!1};function oB(e,t=rB){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=sB(e)?e.current:e,c=o&&s,d=l.useRef(c),p=l.useRef(s);Yc(()=>{!p.current&&s&&(d.current=c),p.current=s},[s,c]);const h=l.useCallback(()=>{if(!(!s||!i||!d.current)&&(d.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var m;(m=n.current)==null||m.focus({preventScroll:r})});else{const m=z5(i);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,i,n]);wi(()=>{h()},[h]),Nl(i,"transitionend",h)}function sB(e){return"current"in e}var _c=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),qr={arrowShadowColor:_c("--popper-arrow-shadow-color"),arrowSize:_c("--popper-arrow-size","8px"),arrowSizeHalf:_c("--popper-arrow-size-half"),arrowBg:_c("--popper-arrow-bg"),transformOrigin:_c("--popper-transform-origin"),arrowOffset:_c("--popper-arrow-offset")};function aB(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var iB={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},lB=e=>iB[e],XS={scroll:!0,resize:!0};function cB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...XS,...e}}:t={enabled:e,options:XS},t}var uB={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},dB={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{YS(e)},effect:({state:e})=>()=>{YS(e)}},YS=e=>{e.elements.popper.style.setProperty(qr.transformOrigin.var,lB(e.placement))},fB={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{pB(e)}},pB=e=>{var t;if(!e.placement)return;const n=hB(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:qr.arrowSize.varRef,height:qr.arrowSize.varRef,zIndex:-1});const r={[qr.arrowSizeHalf.var]:`calc(${qr.arrowSize.varRef} / 2 - 1px)`,[qr.arrowOffset.var]:`calc(${qr.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},hB=e=>{if(e.startsWith("top"))return{property:"bottom",value:qr.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:qr.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:qr.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:qr.arrowOffset.varRef}},mB={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{JS(e)},effect:({state:e})=>()=>{JS(e)}},JS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=aB(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:qr.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},gB={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},vB={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function bB(e,t="ltr"){var n,r;const o=((n=gB[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=vB[e])!=null?r:o}var qo="top",Ds="bottom",Ts="right",Ko="left",jy="auto",Ff=[qo,Ds,Ts,Ko],pu="start",of="end",xB="clippingParents",X5="viewport",bd="popper",yB="reference",ZS=Ff.reduce(function(e,t){return e.concat([t+"-"+pu,t+"-"+of])},[]),Y5=[].concat(Ff,[jy]).reduce(function(e,t){return e.concat([t,t+"-"+pu,t+"-"+of])},[]),CB="beforeRead",wB="read",SB="afterRead",kB="beforeMain",jB="main",_B="afterMain",IB="beforeWrite",PB="write",EB="afterWrite",MB=[CB,wB,SB,kB,jB,_B,IB,PB,EB];function Ma(e){return e?(e.nodeName||"").toLowerCase():null}function ms(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gl(e){var t=ms(e).Element;return e instanceof t||e instanceof Element}function Os(e){var t=ms(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function _y(e){if(typeof ShadowRoot>"u")return!1;var t=ms(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function OB(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Os(s)||!Ma(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var c=o[i];c===!1?s.removeAttribute(i):s.setAttribute(i,c===!0?"":c)}))})}function AB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=i.reduce(function(d,p){return d[p]="",d},{});!Os(o)||!Ma(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const RB={name:"applyStyles",enabled:!0,phase:"write",fn:OB,effect:AB,requires:["computeStyles"]};function Pa(e){return e.split("-")[0]}var $l=Math.max,rm=Math.min,hu=Math.round;function wb(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function J5(){return!/^((?!chrome|android).)*safari/i.test(wb())}function mu(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Os(e)&&(o=e.offsetWidth>0&&hu(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&hu(r.height)/e.offsetHeight||1);var i=Gl(e)?ms(e):window,c=i.visualViewport,d=!J5()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/o,h=(r.top+(d&&c?c.offsetTop:0))/s,m=r.width/o,g=r.height/s;return{width:m,height:g,top:h,right:p+m,bottom:h+g,left:p,x:p,y:h}}function Iy(e){var t=mu(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Z5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&_y(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fi(e){return ms(e).getComputedStyle(e)}function DB(e){return["table","td","th"].indexOf(Ma(e))>=0}function ul(e){return((Gl(e)?e.ownerDocument:e.document)||window.document).documentElement}function Eg(e){return Ma(e)==="html"?e:e.assignedSlot||e.parentNode||(_y(e)?e.host:null)||ul(e)}function ek(e){return!Os(e)||fi(e).position==="fixed"?null:e.offsetParent}function TB(e){var t=/firefox/i.test(wb()),n=/Trident/i.test(wb());if(n&&Os(e)){var r=fi(e);if(r.position==="fixed")return null}var o=Eg(e);for(_y(o)&&(o=o.host);Os(o)&&["html","body"].indexOf(Ma(o))<0;){var s=fi(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Bf(e){for(var t=ms(e),n=ek(e);n&&DB(n)&&fi(n).position==="static";)n=ek(n);return n&&(Ma(n)==="html"||Ma(n)==="body"&&fi(n).position==="static")?t:n||TB(e)||t}function Py(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Bd(e,t,n){return $l(e,rm(t,n))}function NB(e,t,n){var r=Bd(e,t,n);return r>n?n:r}function e3(){return{top:0,right:0,bottom:0,left:0}}function t3(e){return Object.assign({},e3(),e)}function n3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var $B=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,t3(typeof t!="number"?t:n3(t,Ff))};function LB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,c=Pa(n.placement),d=Py(c),p=[Ko,Ts].indexOf(c)>=0,h=p?"height":"width";if(!(!s||!i)){var m=$B(o.padding,n),g=Iy(s),b=d==="y"?qo:Ko,y=d==="y"?Ds:Ts,x=n.rects.reference[h]+n.rects.reference[d]-i[d]-n.rects.popper[h],w=i[d]-n.rects.reference[d],S=Bf(s),j=S?d==="y"?S.clientHeight||0:S.clientWidth||0:0,I=x/2-w/2,_=m[b],M=j-g[h]-m[y],E=j/2-g[h]/2+I,A=Bd(_,E,M),R=d;n.modifiersData[r]=(t={},t[R]=A,t.centerOffset=A-E,t)}}function zB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||Z5(t.elements.popper,o)&&(t.elements.arrow=o))}const FB={name:"arrow",enabled:!0,phase:"main",fn:LB,effect:zB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function gu(e){return e.split("-")[1]}var BB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function HB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:hu(n*o)/o||0,y:hu(r*o)/o||0}}function tk(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,m=e.isFixed,g=i.x,b=g===void 0?0:g,y=i.y,x=y===void 0?0:y,w=typeof h=="function"?h({x:b,y:x}):{x:b,y:x};b=w.x,x=w.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),I=Ko,_=qo,M=window;if(p){var E=Bf(n),A="clientHeight",R="clientWidth";if(E===ms(n)&&(E=ul(n),fi(E).position!=="static"&&c==="absolute"&&(A="scrollHeight",R="scrollWidth")),E=E,o===qo||(o===Ko||o===Ts)&&s===of){_=Ds;var D=m&&E===M&&M.visualViewport?M.visualViewport.height:E[A];x-=D-r.height,x*=d?1:-1}if(o===Ko||(o===qo||o===Ds)&&s===of){I=Ts;var O=m&&E===M&&M.visualViewport?M.visualViewport.width:E[R];b-=O-r.width,b*=d?1:-1}}var T=Object.assign({position:c},p&&BB),K=h===!0?HB({x:b,y:x},ms(n)):{x:b,y:x};if(b=K.x,x=K.y,d){var G;return Object.assign({},T,(G={},G[_]=j?"0":"",G[I]=S?"0":"",G.transform=(M.devicePixelRatio||1)<=1?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",G))}return Object.assign({},T,(t={},t[_]=j?x+"px":"",t[I]=S?b+"px":"",t.transform="",t))}function WB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:Pa(t.placement),variation:gu(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,tk(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,tk(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const VB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:WB,data:{}};var Xp={passive:!0};function UB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,c=i===void 0?!0:i,d=ms(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,Xp)}),c&&d.addEventListener("resize",n.update,Xp),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,Xp)}),c&&d.removeEventListener("resize",n.update,Xp)}}const GB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:UB,data:{}};var qB={left:"right",right:"left",bottom:"top",top:"bottom"};function Ph(e){return e.replace(/left|right|bottom|top/g,function(t){return qB[t]})}var KB={start:"end",end:"start"};function nk(e){return e.replace(/start|end/g,function(t){return KB[t]})}function Ey(e){var t=ms(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function My(e){return mu(ul(e)).left+Ey(e).scrollLeft}function QB(e,t){var n=ms(e),r=ul(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;var p=J5();(p||!p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:i,x:c+My(e),y:d}}function XB(e){var t,n=ul(e),r=Ey(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=$l(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=$l(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+My(e),d=-r.scrollTop;return fi(o||n).direction==="rtl"&&(c+=$l(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:c,y:d}}function Oy(e){var t=fi(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function r3(e){return["html","body","#document"].indexOf(Ma(e))>=0?e.ownerDocument.body:Os(e)&&Oy(e)?e:r3(Eg(e))}function Hd(e,t){var n;t===void 0&&(t=[]);var r=r3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=ms(r),i=o?[s].concat(s.visualViewport||[],Oy(r)?r:[]):r,c=t.concat(i);return o?c:c.concat(Hd(Eg(i)))}function Sb(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function YB(e,t){var n=mu(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function rk(e,t,n){return t===X5?Sb(QB(e,n)):Gl(t)?YB(t,n):Sb(XB(ul(e)))}function JB(e){var t=Hd(Eg(e)),n=["absolute","fixed"].indexOf(fi(e).position)>=0,r=n&&Os(e)?Bf(e):e;return Gl(r)?t.filter(function(o){return Gl(o)&&Z5(o,r)&&Ma(o)!=="body"}):[]}function ZB(e,t,n,r){var o=t==="clippingParents"?JB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],c=s.reduce(function(d,p){var h=rk(e,p,r);return d.top=$l(h.top,d.top),d.right=rm(h.right,d.right),d.bottom=rm(h.bottom,d.bottom),d.left=$l(h.left,d.left),d},rk(e,i,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function o3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Pa(r):null,s=r?gu(r):null,i=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case qo:d={x:i,y:t.y-n.height};break;case Ds:d={x:i,y:t.y+t.height};break;case Ts:d={x:t.x+t.width,y:c};break;case Ko:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=o?Py(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case pu:d[p]=d[p]-(t[h]/2-n[h]/2);break;case of:d[p]=d[p]+(t[h]/2-n[h]/2);break}}return d}function sf(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?xB:c,p=n.rootBoundary,h=p===void 0?X5:p,m=n.elementContext,g=m===void 0?bd:m,b=n.altBoundary,y=b===void 0?!1:b,x=n.padding,w=x===void 0?0:x,S=t3(typeof w!="number"?w:n3(w,Ff)),j=g===bd?yB:bd,I=e.rects.popper,_=e.elements[y?j:g],M=ZB(Gl(_)?_:_.contextElement||ul(e.elements.popper),d,h,i),E=mu(e.elements.reference),A=o3({reference:E,element:I,strategy:"absolute",placement:o}),R=Sb(Object.assign({},I,A)),D=g===bd?R:E,O={top:M.top-D.top+S.top,bottom:D.bottom-M.bottom+S.bottom,left:M.left-D.left+S.left,right:D.right-M.right+S.right},T=e.modifiersData.offset;if(g===bd&&T){var K=T[o];Object.keys(O).forEach(function(G){var X=[Ts,Ds].indexOf(G)>=0?1:-1,Z=[qo,Ds].indexOf(G)>=0?"y":"x";O[G]+=K[Z]*X})}return O}function eH(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?Y5:d,h=gu(r),m=h?c?ZS:ZS.filter(function(y){return gu(y)===h}):Ff,g=m.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=m);var b=g.reduce(function(y,x){return y[x]=sf(e,{placement:x,boundary:o,rootBoundary:s,padding:i})[Pa(x)],y},{});return Object.keys(b).sort(function(y,x){return b[y]-b[x]})}function tH(e){if(Pa(e)===jy)return[];var t=Ph(e);return[nk(e),t,nk(t)]}function nH(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!0:i,d=n.fallbackPlacements,p=n.padding,h=n.boundary,m=n.rootBoundary,g=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,x=n.allowedAutoPlacements,w=t.options.placement,S=Pa(w),j=S===w,I=d||(j||!y?[Ph(w)]:tH(w)),_=[w].concat(I).reduce(function(Y,$){return Y.concat(Pa($)===jy?eH(t,{placement:$,boundary:h,rootBoundary:m,padding:p,flipVariations:y,allowedAutoPlacements:x}):$)},[]),M=t.rects.reference,E=t.rects.popper,A=new Map,R=!0,D=_[0],O=0;O<_.length;O++){var T=_[O],K=Pa(T),G=gu(T)===pu,X=[qo,Ds].indexOf(K)>=0,Z=X?"width":"height",te=sf(t,{placement:T,boundary:h,rootBoundary:m,altBoundary:g,padding:p}),V=X?G?Ts:Ko:G?Ds:qo;M[Z]>E[Z]&&(V=Ph(V));var oe=Ph(V),ne=[];if(s&&ne.push(te[K]<=0),c&&ne.push(te[V]<=0,te[oe]<=0),ne.every(function(Y){return Y})){D=T,R=!1;break}A.set(T,ne)}if(R)for(var se=y?3:1,re=function($){var F=_.find(function(q){var pe=A.get(q);if(pe)return pe.slice(0,$).every(function(W){return W})});if(F)return D=F,"break"},ae=se;ae>0;ae--){var B=re(ae);if(B==="break")break}t.placement!==D&&(t.modifiersData[r]._skip=!0,t.placement=D,t.reset=!0)}}const rH={name:"flip",enabled:!0,phase:"main",fn:nH,requiresIfExists:["offset"],data:{_skip:!1}};function ok(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function sk(e){return[qo,Ts,Ds,Ko].some(function(t){return e[t]>=0})}function oH(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=sf(t,{elementContext:"reference"}),c=sf(t,{altBoundary:!0}),d=ok(i,r),p=ok(c,o,s),h=sk(d),m=sk(p);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":m})}const sH={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:oH};function aH(e,t,n){var r=Pa(e),o=[Ko,qo].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],c=s[1];return i=i||0,c=(c||0)*o,[Ko,Ts].indexOf(r)>=0?{x:c,y:i}:{x:i,y:c}}function iH(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=Y5.reduce(function(h,m){return h[m]=aH(m,t.rects,s),h},{}),c=i[t.placement],d=c.x,p=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const lH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:iH};function cH(e){var t=e.state,n=e.name;t.modifiersData[n]=o3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const uH={name:"popperOffsets",enabled:!0,phase:"read",fn:cH,data:{}};function dH(e){return e==="x"?"y":"x"}function fH(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!1:i,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,m=n.padding,g=n.tether,b=g===void 0?!0:g,y=n.tetherOffset,x=y===void 0?0:y,w=sf(t,{boundary:d,rootBoundary:p,padding:m,altBoundary:h}),S=Pa(t.placement),j=gu(t.placement),I=!j,_=Py(S),M=dH(_),E=t.modifiersData.popperOffsets,A=t.rects.reference,R=t.rects.popper,D=typeof x=="function"?x(Object.assign({},t.rects,{placement:t.placement})):x,O=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,K={x:0,y:0};if(E){if(s){var G,X=_==="y"?qo:Ko,Z=_==="y"?Ds:Ts,te=_==="y"?"height":"width",V=E[_],oe=V+w[X],ne=V-w[Z],se=b?-R[te]/2:0,re=j===pu?A[te]:R[te],ae=j===pu?-R[te]:-A[te],B=t.elements.arrow,Y=b&&B?Iy(B):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:e3(),F=$[X],q=$[Z],pe=Bd(0,A[te],Y[te]),W=I?A[te]/2-se-pe-F-O.mainAxis:re-pe-F-O.mainAxis,U=I?-A[te]/2+se+pe+q+O.mainAxis:ae+pe+q+O.mainAxis,ee=t.elements.arrow&&Bf(t.elements.arrow),J=ee?_==="y"?ee.clientTop||0:ee.clientLeft||0:0,ge=(G=T==null?void 0:T[_])!=null?G:0,he=V+W-ge-J,de=V+U-ge,_e=Bd(b?rm(oe,he):oe,V,b?$l(ne,de):ne);E[_]=_e,K[_]=_e-V}if(c){var Pe,ze=_==="x"?qo:Ko,ht=_==="x"?Ds:Ts,Je=E[M],qt=M==="y"?"height":"width",Pt=Je+w[ze],jt=Je-w[ht],Se=[qo,Ko].indexOf(S)!==-1,Fe=(Pe=T==null?void 0:T[M])!=null?Pe:0,it=Se?Pt:Je-A[qt]-R[qt]-Fe+O.altAxis,At=Se?Je+A[qt]+R[qt]-Fe-O.altAxis:jt,ke=b&&Se?NB(it,Je,At):Bd(b?it:Pt,Je,b?At:jt);E[M]=ke,K[M]=ke-Je}t.modifiersData[r]=K}}const pH={name:"preventOverflow",enabled:!0,phase:"main",fn:fH,requiresIfExists:["offset"]};function hH(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function mH(e){return e===ms(e)||!Os(e)?Ey(e):hH(e)}function gH(e){var t=e.getBoundingClientRect(),n=hu(t.width)/e.offsetWidth||1,r=hu(t.height)/e.offsetHeight||1;return n!==1||r!==1}function vH(e,t,n){n===void 0&&(n=!1);var r=Os(t),o=Os(t)&&gH(t),s=ul(t),i=mu(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((Ma(t)!=="body"||Oy(s))&&(c=mH(t)),Os(t)?(d=mu(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=My(s))),{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function bH(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(c){if(!n.has(c)){var d=t.get(c);d&&o(d)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function xH(e){var t=bH(e);return MB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function yH(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function CH(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var ak={placement:"bottom",modifiers:[],strategy:"absolute"};function ik(){for(var e=arguments.length,t=new Array(e),n=0;n{}),I=l.useCallback(()=>{var O;!t||!y.current||!x.current||((O=j.current)==null||O.call(j),w.current=kH(y.current,x.current,{placement:S,modifiers:[mB,fB,dB,{...uB,enabled:!!g},{name:"eventListeners",...cB(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:c??[0,d]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!m,options:{boundary:h}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,i,s,c,d,p,m,h,o]);l.useEffect(()=>()=>{var O;!y.current&&!x.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const _=l.useCallback(O=>{y.current=O,I()},[I]),M=l.useCallback((O={},T=null)=>({...O,ref:xn(_,T)}),[_]),E=l.useCallback(O=>{x.current=O,I()},[I]),A=l.useCallback((O={},T=null)=>({...O,ref:xn(E,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,E,g]),R=l.useCallback((O={},T=null)=>{const{size:K,shadowColor:G,bg:X,style:Z,...te}=O;return{...te,ref:T,"data-popper-arrow":"",style:jH(O)}},[]),D=l.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=w.current)==null||O.update()},forceUpdate(){var O;(O=w.current)==null||O.forceUpdate()},transformOrigin:qr.transformOrigin.varRef,referenceRef:_,popperRef:E,getPopperProps:A,getArrowProps:R,getArrowInnerProps:D,getReferenceProps:M}}function jH(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Ry(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=vr(n),i=vr(t),[c,d]=l.useState(e.defaultIsOpen||!1),p=r!==void 0?r:c,h=r!==void 0,m=l.useId(),g=o??`disclosure-${m}`,b=l.useCallback(()=>{h||d(!1),i==null||i()},[h,i]),y=l.useCallback(()=>{h||d(!0),s==null||s()},[h,s]),x=l.useCallback(()=>{p?b():y()},[p,y,b]);function w(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(I){var _;(_=j.onClick)==null||_.call(j,I),x()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:b,onToggle:x,isControlled:h,getButtonProps:w,getDisclosureProps:S}}function _H(e){const{ref:t,handler:n,enabled:r=!0}=e,o=vr(n),i=l.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;l.useEffect(()=>{if(!r)return;const c=m=>{r1(m,t)&&(i.isPointerDown=!0)},d=m=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&r1(m,t)&&(i.isPointerDown=!1,o(m))},p=m=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&r1(m,t)&&(i.isPointerDown=!1,o(m))},h=s3(t.current);return h.addEventListener("mousedown",c,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",c,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",c,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",c,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function r1(e,t){var n;const r=e.target;return r&&!s3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function s3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function a3(e){const{isOpen:t,ref:n}=e,[r,o]=l.useState(t),[s,i]=l.useState(!1);return l.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Nl(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=MF(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Dy(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[IH,PH,EH,MH]=ry(),[OH,Hf]=Un({strict:!1,name:"MenuContext"});function AH(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function i3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function lk(e){return i3(e).activeElement===e}function RH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:c,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:g="unmount",direction:b,computePositionOnMount:y=!1,...x}=e,w=l.useRef(null),S=l.useRef(null),j=EH(),I=l.useCallback(()=>{requestAnimationFrame(()=>{var B;(B=w.current)==null||B.focus({preventScroll:!1})})},[]),_=l.useCallback(()=>{const B=setTimeout(()=>{var Y;if(o)(Y=o.current)==null||Y.focus();else{const $=j.firstEnabled();$&&G($.index)}});oe.current.add(B)},[j,o]),M=l.useCallback(()=>{const B=setTimeout(()=>{const Y=j.lastEnabled();Y&&G(Y.index)});oe.current.add(B)},[j]),E=l.useCallback(()=>{h==null||h(),s?_():I()},[s,_,I,h]),{isOpen:A,onOpen:R,onClose:D,onToggle:O}=Ry({isOpen:c,defaultIsOpen:d,onClose:p,onOpen:E});_H({enabled:A&&r,ref:w,handler:B=>{var Y;(Y=S.current)!=null&&Y.contains(B.target)||D()}});const T=Ay({...x,enabled:A||y,placement:m,direction:b}),[K,G]=l.useState(-1);wi(()=>{A||G(-1)},[A]),Q5(w,{focusRef:S,visible:A,shouldFocus:!0});const X=a3({isOpen:A,ref:w}),[Z,te]=AH(t,"menu-button","menu-list"),V=l.useCallback(()=>{R(),I()},[R,I]),oe=l.useRef(new Set([]));l.useEffect(()=>{const B=oe.current;return()=>{B.forEach(Y=>clearTimeout(Y)),B.clear()}},[]);const ne=l.useCallback(()=>{R(),_()},[_,R]),se=l.useCallback(()=>{R(),M()},[R,M]),re=l.useCallback(()=>{var B,Y;const $=i3(w.current),F=(B=w.current)==null?void 0:B.contains($.activeElement);if(!(A&&!F))return;const pe=(Y=j.item(K))==null?void 0:Y.node;pe==null||pe.focus({preventScroll:!0})},[A,K,j]),ae=l.useRef(null);return{openAndFocusMenu:V,openAndFocusFirstItem:ne,openAndFocusLastItem:se,onTransitionEnd:re,unstable__animationState:X,descendants:j,popper:T,buttonId:Z,menuId:te,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:A,onToggle:O,onOpen:R,onClose:D,menuRef:w,buttonRef:S,focusedIndex:K,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:G,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:ae}}function DH(e={},t=null){const n=Hf(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,c=l.useCallback(d=>{const p=d.key,m={Enter:s,ArrowDown:s,ArrowUp:i}[p];m&&(d.preventDefault(),d.stopPropagation(),m(d))},[s,i]);return{...e,ref:xn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":Vt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:ot(e.onClick,r),onKeyDown:ot(e.onKeyDown,c)}}function kb(e){var t;return LH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function TH(e={},t=null){const n=Hf();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:c,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,g=PH(),b=ZF({preventDefault:S=>S.key!==" "&&kb(S.target)}),y=l.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,_={Tab:E=>E.preventDefault(),Escape:c,ArrowDown:()=>{const E=g.nextEnabled(r);E&&o(E.index)},ArrowUp:()=>{const E=g.prevEnabled(r);E&&o(E.index)}}[j];if(_){S.preventDefault(),_(S);return}const M=b(E=>{const A=eB(g.values(),E,R=>{var D,O;return(O=(D=R==null?void 0:R.node)==null?void 0:D.textContent)!=null?O:""},g.item(r));if(A){const R=g.indexOf(A.node);o(R)}});kb(S.target)&&M(S)},[g,r,b,c,o]),x=l.useRef(!1);i&&(x.current=!0);const w=Dy({wasSelected:x.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:xn(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:ot(e.onKeyDown,y)}}function NH(e={}){const{popper:t,isOpen:n}=Hf();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function $H(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:c,isFocusable:d,closeOnSelect:p,type:h,...m}=e,g=Hf(),{setFocusedIndex:b,focusedIndex:y,closeOnSelect:x,onClose:w,menuRef:S,isOpen:j,menuId:I,rafId:_}=g,M=l.useRef(null),E=`${I}-menuitem-${l.useId()}`,{index:A,register:R}=MH({disabled:c&&!d}),D=l.useCallback(V=>{n==null||n(V),!c&&b(A)},[b,A,c,n]),O=l.useCallback(V=>{r==null||r(V),M.current&&!lk(M.current)&&D(V)},[D,r]),T=l.useCallback(V=>{o==null||o(V),!c&&b(-1)},[b,c,o]),K=l.useCallback(V=>{s==null||s(V),kb(V.currentTarget)&&(p??x)&&w()},[w,s,x,p]),G=l.useCallback(V=>{i==null||i(V),b(A)},[b,i,A]),X=A===y,Z=c&&!d;wi(()=>{if(j)return X&&!Z&&M.current?(_.current&&cancelAnimationFrame(_.current),_.current=requestAnimationFrame(()=>{var V;(V=M.current)==null||V.focus({preventScroll:!0}),_.current=null})):S.current&&!lk(S.current)&&S.current.focus({preventScroll:!0}),()=>{_.current&&cancelAnimationFrame(_.current)}},[X,Z,S,j]);const te=K5({onClick:K,onFocus:G,onMouseEnter:D,onMouseMove:O,onMouseLeave:T,ref:xn(R,M,t),isDisabled:c,isFocusable:d});return{...m,...te,type:h??te.type,id:E,role:"menuitem",tabIndex:X?0:-1}}function LH(e){var t;if(!zH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function zH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}var[FH,Tu]=Un({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Mg=e=>{const{children:t}=e,n=no("Menu",e),r=lr(e),{direction:o}=kf(),{descendants:s,...i}=RH({...r,direction:o}),c=l.useMemo(()=>i,[i]),{isOpen:d,onClose:p,forceUpdate:h}=c;return a.jsx(IH,{value:s,children:a.jsx(OH,{value:c,children:a.jsx(FH,{value:n,children:Mx(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Mg.displayName="Menu";var l3=De((e,t)=>{const n=Tu();return a.jsx(Ae.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});l3.displayName="MenuCommand";var BH=De((e,t)=>{const{type:n,...r}=e,o=Tu(),s=r.as||n?n??void 0:"button",i=l.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(Ae.button,{ref:t,type:s,...r,__css:i})}),c3=e=>{const{className:t,children:n,...r}=e,o=Tu(),s=l.Children.only(n),i=l.isValidElement(s)?l.cloneElement(s,{focusable:"false","aria-hidden":!0,className:kt("chakra-menu__icon",s.props.className)}):null,c=kt("chakra-menu__icon-wrapper",t);return a.jsx(Ae.span,{className:c,...r,__css:o.icon,children:i})};c3.displayName="MenuIcon";var Kn=De((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...c}=e,d=$H(c,t),h=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(BH,{...d,className:kt("chakra-menu__menuitem",d.className),children:[n&&a.jsx(c3,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&a.jsx(l3,{marginStart:s,children:o})]})});Kn.displayName="MenuItem";var HH={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},WH=Ae(Ar.div),ql=De(function(t,n){var r,o;const{rootProps:s,motionProps:i,...c}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Hf(),m=TH(c,n),g=NH(s),b=Tu();return a.jsx(Ae.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:a.jsx(WH,{variants:HH,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...i,className:kt("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:pg(h.onComplete,m.onAnimationComplete)})})});ql.displayName="MenuList";var af=De((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=kt("chakra-menu__group__title",o),c=Tu();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(Ae.p,{className:i,...s,__css:c.groupTitle,children:n}),r]})});af.displayName="MenuGroup";var VH=De((e,t)=>{const n=Tu();return a.jsx(Ae.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Og=De((e,t)=>{const{children:n,as:r,...o}=e,s=DH(o,t),i=r||VH;return a.jsx(i,{...s,className:kt("chakra-menu__menu-button",e.className),children:a.jsx(Ae.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Og.displayName="MenuButton";var UH={slideInBottom:{...Md,custom:{offsetY:16,reverse:!0}},slideInRight:{...Md,custom:{offsetX:16,reverse:!0}},slideInTop:{...Md,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...Md,custom:{offsetX:-16,reverse:!0}},scale:{...FP,custom:{initialScale:.95,reverse:!0}},none:{}},GH=Ae(Ar.section),qH=e=>UH[e||"none"],u3=l.forwardRef((e,t)=>{const{preset:n,motionProps:r=qH(n),...o}=e;return a.jsx(GH,{ref:t,...r,...o})});u3.displayName="ModalTransition";var KH=Object.defineProperty,QH=(e,t,n)=>t in e?KH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XH=(e,t,n)=>(QH(e,typeof t!="symbol"?t+"":t,n),n),YH=class{constructor(){XH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},jb=new YH;function d3(e,t){const[n,r]=l.useState(0);return l.useEffect(()=>{const o=e.current;if(o){if(t){const s=jb.add(o);r(s)}return()=>{jb.remove(o),r(0)}}},[t,e]),n}var JH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ic=new WeakMap,Yp=new WeakMap,Jp={},o1=0,f3=function(e){return e&&(e.host||f3(e.parentNode))},ZH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=f3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},eW=function(e,t,n,r){var o=ZH(t,Array.isArray(e)?e:[e]);Jp[n]||(Jp[n]=new WeakMap);var s=Jp[n],i=[],c=new Set,d=new Set(o),p=function(m){!m||c.has(m)||(c.add(m),p(m.parentNode))};o.forEach(p);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))h(g);else{var b=g.getAttribute(r),y=b!==null&&b!=="false",x=(Ic.get(g)||0)+1,w=(s.get(g)||0)+1;Ic.set(g,x),s.set(g,w),i.push(g),x===1&&y&&Yp.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return h(t),c.clear(),o1++,function(){i.forEach(function(m){var g=Ic.get(m)-1,b=s.get(m)-1;Ic.set(m,g),s.set(m,b),g||(Yp.has(m)||m.removeAttribute(r),Yp.delete(m)),b||m.removeAttribute(n)}),o1--,o1||(Ic=new WeakMap,Ic=new WeakMap,Yp=new WeakMap,Jp={})}},tW=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||JH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),eW(r,o,n,"aria-hidden")):function(){return null}};function nW(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:c,onEsc:d}=e,p=l.useRef(null),h=l.useRef(null),[m,g,b]=oW(r,"chakra-modal","chakra-modal--header","chakra-modal--body");rW(p,t&&i);const y=d3(p,t),x=l.useRef(null),w=l.useCallback(D=>{x.current=D.target},[]),S=l.useCallback(D=>{D.key==="Escape"&&(D.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[j,I]=l.useState(!1),[_,M]=l.useState(!1),E=l.useCallback((D={},O=null)=>({role:"dialog",...D,ref:xn(O,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":_?b:void 0,onClick:ot(D.onClick,T=>T.stopPropagation())}),[b,_,m,g,j]),A=l.useCallback(D=>{D.stopPropagation(),x.current===D.target&&jb.isTopModal(p.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),R=l.useCallback((D={},O=null)=>({...D,ref:xn(O,h),onClick:ot(D.onClick,A),onKeyDown:ot(D.onKeyDown,S),onMouseDown:ot(D.onMouseDown,w)}),[S,w,A]);return{isOpen:t,onClose:n,headerId:g,bodyId:b,setBodyMounted:M,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:E,getDialogContainerProps:R,index:y}}function rW(e,t){const n=e.current;l.useEffect(()=>{if(!(!e.current||!t))return tW(e.current)},[t,e,n])}function oW(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[sW,Nu]=Un({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[aW,Kl]=Un({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),vu=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b,onCloseComplete:y}=t,x=no("Modal",t),S={...nW(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b};return a.jsx(aW,{value:S,children:a.jsx(sW,{value:x,children:a.jsx(So,{onExitComplete:y,children:S.isOpen&&a.jsx(Au,{...n,children:r})})})})};vu.displayName="Modal";var Eh="right-scroll-bar-position",Mh="width-before-scroll-bar",iW="with-scroll-bars-hidden",lW="--removed-body-scroll-bar-size",p3=c5(),s1=function(){},Ag=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:s1,onWheelCapture:s1,onTouchMoveCapture:s1}),o=r[0],s=r[1],i=e.forwardProps,c=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,b=e.noIsolation,y=e.inert,x=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,j=e.gapMode,I=a5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=g,M=s5([n,t]),E=wa(wa({},I),o);return l.createElement(l.Fragment,null,h&&l.createElement(_,{sideCar:p3,removeScrollBar:p,shards:m,noIsolation:b,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:j}),i?l.cloneElement(l.Children.only(c),wa(wa({},E),{ref:M})):l.createElement(S,wa({},E,{className:d,ref:M}),c))});Ag.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ag.classNames={fullWidth:Mh,zeroRight:Eh};var ck,cW=function(){if(ck)return ck;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cW();return t&&e.setAttribute("nonce",t),e}function dW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function fW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=uW())&&(dW(t,n),fW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hW=function(){var e=pW();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},h3=function(){var e=hW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},mW={left:0,top:0,right:0,gap:0},a1=function(e){return parseInt(e||"",10)||0},gW=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[a1(n),a1(r),a1(o)]},vW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mW;var t=gW(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},bW=h3(),xW=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),` + .`.concat(iW,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(o,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(i,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(Eh,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Mh,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Eh," .").concat(Eh,` { + right: 0 `).concat(r,`; + } + + .`).concat(Mh," .").concat(Mh,` { + margin-right: 0 `).concat(r,`; + } + + body { + `).concat(lW,": ").concat(c,`px; + } +`)},yW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=l.useMemo(function(){return vW(o)},[o]);return l.createElement(bW,{styles:xW(s,!t,o,n?"":"!important")})},_b=!1;if(typeof window<"u")try{var Zp=Object.defineProperty({},"passive",{get:function(){return _b=!0,!0}});window.addEventListener("test",Zp,Zp),window.removeEventListener("test",Zp,Zp)}catch{_b=!1}var Pc=_b?{passive:!1}:!1,CW=function(e){return e.tagName==="TEXTAREA"},m3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!CW(e)&&n[t]==="visible")},wW=function(e){return m3(e,"overflowY")},SW=function(e){return m3(e,"overflowX")},uk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=g3(e,r);if(o){var s=v3(e,r),i=s[1],c=s[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},g3=function(e,t){return e==="v"?wW(t):SW(t)},v3=function(e,t){return e==="v"?kW(t):jW(t)},_W=function(e,t){return e==="h"&&t==="rtl"?-1:1},IW=function(e,t,n,r,o){var s=_W(e,window.getComputedStyle(t).direction),i=s*r,c=n.target,d=t.contains(c),p=!1,h=i>0,m=0,g=0;do{var b=v3(e,c),y=b[0],x=b[1],w=b[2],S=x-w-s*y;(y||S)&&g3(e,c)&&(m+=S,g+=y),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(h&&(o&&Math.abs(m)<1||!o&&i>m)||!h&&(o&&Math.abs(g)<1||!o&&-i>g))&&(p=!0),p},eh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},dk=function(e){return[e.deltaX,e.deltaY]},fk=function(e){return e&&"current"in e?e.current:e},PW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EW=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},MW=0,Ec=[];function OW(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),o=l.useState(MW++)[0],s=l.useState(h3)[0],i=l.useRef(e);l.useEffect(function(){i.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var x=Az([e.lockRef.current],(e.shards||[]).map(fk),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=l.useCallback(function(x,w){if("touches"in x&&x.touches.length===2)return!i.current.allowPinchZoom;var S=eh(x),j=n.current,I="deltaX"in x?x.deltaX:j[0]-S[0],_="deltaY"in x?x.deltaY:j[1]-S[1],M,E=x.target,A=Math.abs(I)>Math.abs(_)?"h":"v";if("touches"in x&&A==="h"&&E.type==="range")return!1;var R=uk(A,E);if(!R)return!0;if(R?M=A:(M=A==="v"?"h":"v",R=uk(A,E)),!R)return!1;if(!r.current&&"changedTouches"in x&&(I||_)&&(r.current=M),!M)return!0;var D=r.current||M;return IW(D,w,x,D==="h"?I:_,!0)},[]),d=l.useCallback(function(x){var w=x;if(!(!Ec.length||Ec[Ec.length-1]!==s)){var S="deltaY"in w?dk(w):eh(w),j=t.current.filter(function(M){return M.name===w.type&&(M.target===w.target||w.target===M.shadowParent)&&PW(M.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var I=(i.current.shards||[]).map(fk).filter(Boolean).filter(function(M){return M.contains(w.target)}),_=I.length>0?c(w,I[0]):!i.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),p=l.useCallback(function(x,w,S,j){var I={name:x,delta:w,target:S,should:j,shadowParent:AW(S)};t.current.push(I),setTimeout(function(){t.current=t.current.filter(function(_){return _!==I})},1)},[]),h=l.useCallback(function(x){n.current=eh(x),r.current=void 0},[]),m=l.useCallback(function(x){p(x.type,dk(x),x.target,c(x,e.lockRef.current))},[]),g=l.useCallback(function(x){p(x.type,eh(x),x.target,c(x,e.lockRef.current))},[]);l.useEffect(function(){return Ec.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",d,Pc),document.addEventListener("touchmove",d,Pc),document.addEventListener("touchstart",h,Pc),function(){Ec=Ec.filter(function(x){return x!==s}),document.removeEventListener("wheel",d,Pc),document.removeEventListener("touchmove",d,Pc),document.removeEventListener("touchstart",h,Pc)}},[]);var b=e.removeScrollBar,y=e.inert;return l.createElement(l.Fragment,null,y?l.createElement(s,{styles:EW(o)}):null,b?l.createElement(yW,{gapMode:e.gapMode}):null)}function AW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const RW=Rz(p3,OW);var b3=l.forwardRef(function(e,t){return l.createElement(Ag,wa({},e,{ref:t,sideCar:RW}))});b3.classNames=Ag.classNames;const DW=b3;function TW(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:c,returnFocusOnClose:d,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:m}=Kl(),[g,b]=hD();l.useEffect(()=>{!g&&b&&setTimeout(b)},[g,b]);const y=d3(r,m);return a.jsx(F5,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:c,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:h,children:a.jsx(DW,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var bu=De((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:c,getDialogContainerProps:d}=Kl(),p=c(i,t),h=d(o),m=kt("chakra-modal__content",n),g=Nu(),b={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:x}=Kl();return a.jsx(TW,{children:a.jsx(Ae.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(u3,{preset:x,motionProps:s,className:m,...p,__css:b,children:r})})})});bu.displayName="ModalContent";function Wf(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(vu,{...n,initialFocusRef:t})}var Vf=De((e,t)=>a.jsx(bu,{ref:t,role:"alertdialog",...e})),pi=De((e,t)=>{const{className:n,...r}=e,o=kt("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Nu().footer};return a.jsx(Ae.footer,{ref:t,...r,__css:i,className:o})});pi.displayName="ModalFooter";var Oa=De((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Kl();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=kt("chakra-modal__header",n),d={flex:0,...Nu().header};return a.jsx(Ae.header,{ref:t,className:i,id:o,...r,__css:d})});Oa.displayName="ModalHeader";var NW=Ae(Ar.div),Aa=De((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=kt("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Nu().overlay},{motionPreset:p}=Kl(),m=o||(p==="none"?{}:zP);return a.jsx(NW,{...m,__css:d,ref:t,className:i,...s})});Aa.displayName="ModalOverlay";var Ra=De((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Kl();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=kt("chakra-modal__body",n),c=Nu();return a.jsx(Ae.div,{ref:t,className:i,id:o,...r,__css:c.body})});Ra.displayName="ModalBody";var Rg=De((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Kl(),i=kt("chakra-modal__close-btn",r),c=Nu();return a.jsx(_I,{ref:t,__css:c.closeButton,className:i,onClick:ot(n,d=>{d.stopPropagation(),s()}),...o})});Rg.displayName="ModalCloseButton";var $W=e=>a.jsx(Gr,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),LW=e=>a.jsx(Gr,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function pk(e,t,n,r){l.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],c=new s.MutationObserver(d=>{for(const p of d)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return c.observe(e.current,{attributes:!0,attributeFilter:i}),()=>c.disconnect()})}function zW(e,t){const n=vr(e);l.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var FW=50,hk=300;function BW(e,t){const[n,r]=l.useState(!1),[o,s]=l.useState(null),[i,c]=l.useState(!0),d=l.useRef(null),p=()=>clearTimeout(d.current);zW(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?FW:null);const h=l.useCallback(()=>{i&&e(),d.current=setTimeout(()=>{c(!1),r(!0),s("increment")},hk)},[e,i]),m=l.useCallback(()=>{i&&t(),d.current=setTimeout(()=>{c(!1),r(!0),s("decrement")},hk)},[t,i]),g=l.useCallback(()=>{c(!0),r(!1),p()},[]);return l.useEffect(()=>()=>p(),[]),{up:h,down:m,stop:g,isSpinning:n}}var HW=/^[Ee0-9+\-.]$/;function WW(e){return HW.test(e)}function VW(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function UW(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:c,isDisabled:d,isRequired:p,isInvalid:h,pattern:m="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:b,id:y,onChange:x,precision:w,name:S,"aria-describedby":j,"aria-label":I,"aria-labelledby":_,onFocus:M,onBlur:E,onInvalid:A,getAriaValueText:R,isValidCharacter:D,format:O,parse:T,...K}=e,G=vr(M),X=vr(E),Z=vr(A),te=vr(D??WW),V=vr(R),oe=fz(e),{update:ne,increment:se,decrement:re}=oe,[ae,B]=l.useState(!1),Y=!(c||d),$=l.useRef(null),F=l.useRef(null),q=l.useRef(null),pe=l.useRef(null),W=l.useCallback(ke=>ke.split("").filter(te).join(""),[te]),U=l.useCallback(ke=>{var lt;return(lt=T==null?void 0:T(ke))!=null?lt:ke},[T]),ee=l.useCallback(ke=>{var lt;return((lt=O==null?void 0:O(ke))!=null?lt:ke).toString()},[O]);wi(()=>{(oe.valueAsNumber>s||oe.valueAsNumber{if(!$.current)return;if($.current.value!=oe.value){const lt=U($.current.value);oe.setValue(W(lt))}},[U,W]);const J=l.useCallback((ke=i)=>{Y&&se(ke)},[se,Y,i]),ge=l.useCallback((ke=i)=>{Y&&re(ke)},[re,Y,i]),he=BW(J,ge);pk(q,"disabled",he.stop,he.isSpinning),pk(pe,"disabled",he.stop,he.isSpinning);const de=l.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;const Rt=U(ke.currentTarget.value);ne(W(Rt)),F.current={start:ke.currentTarget.selectionStart,end:ke.currentTarget.selectionEnd}},[ne,W,U]),_e=l.useCallback(ke=>{var lt,Rt,zt;G==null||G(ke),F.current&&(ke.target.selectionStart=(Rt=F.current.start)!=null?Rt:(lt=ke.currentTarget.value)==null?void 0:lt.length,ke.currentTarget.selectionEnd=(zt=F.current.end)!=null?zt:ke.currentTarget.selectionStart)},[G]),Pe=l.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;VW(ke,te)||ke.preventDefault();const lt=ze(ke)*i,Rt=ke.key,Re={ArrowUp:()=>J(lt),ArrowDown:()=>ge(lt),Home:()=>ne(o),End:()=>ne(s)}[Rt];Re&&(ke.preventDefault(),Re(ke))},[te,i,J,ge,ne,o,s]),ze=ke=>{let lt=1;return(ke.metaKey||ke.ctrlKey)&&(lt=.1),ke.shiftKey&&(lt=10),lt},ht=l.useMemo(()=>{const ke=V==null?void 0:V(oe.value);if(ke!=null)return ke;const lt=oe.value.toString();return lt||void 0},[oe.value,V]),Je=l.useCallback(()=>{let ke=oe.value;if(oe.value==="")return;/^[eE]/.test(oe.value.toString())?oe.setValue(""):(oe.valueAsNumbers&&(ke=s),oe.cast(ke))},[oe,s,o]),qt=l.useCallback(()=>{B(!1),n&&Je()},[n,B,Je]),Pt=l.useCallback(()=>{t&&requestAnimationFrame(()=>{var ke;(ke=$.current)==null||ke.focus()})},[t]),jt=l.useCallback(ke=>{ke.preventDefault(),he.up(),Pt()},[Pt,he]),Se=l.useCallback(ke=>{ke.preventDefault(),he.down(),Pt()},[Pt,he]);Nl(()=>$.current,"wheel",ke=>{var lt,Rt;const Re=((Rt=(lt=$.current)==null?void 0:lt.ownerDocument)!=null?Rt:document).activeElement===$.current;if(!b||!Re)return;ke.preventDefault();const Qe=ze(ke)*i,En=Math.sign(ke.deltaY);En===-1?J(Qe):En===1&&ge(Qe)},{passive:!1});const Fe=l.useCallback((ke={},lt=null)=>{const Rt=d||r&&oe.isAtMax;return{...ke,ref:xn(lt,q),role:"button",tabIndex:-1,onPointerDown:ot(ke.onPointerDown,zt=>{zt.button!==0||Rt||jt(zt)}),onPointerLeave:ot(ke.onPointerLeave,he.stop),onPointerUp:ot(ke.onPointerUp,he.stop),disabled:Rt,"aria-disabled":Ms(Rt)}},[oe.isAtMax,r,jt,he.stop,d]),it=l.useCallback((ke={},lt=null)=>{const Rt=d||r&&oe.isAtMin;return{...ke,ref:xn(lt,pe),role:"button",tabIndex:-1,onPointerDown:ot(ke.onPointerDown,zt=>{zt.button!==0||Rt||Se(zt)}),onPointerLeave:ot(ke.onPointerLeave,he.stop),onPointerUp:ot(ke.onPointerUp,he.stop),disabled:Rt,"aria-disabled":Ms(Rt)}},[oe.isAtMin,r,Se,he.stop,d]),At=l.useCallback((ke={},lt=null)=>{var Rt,zt,Re,Qe;return{name:S,inputMode:g,type:"text",pattern:m,"aria-labelledby":_,"aria-label":I,"aria-describedby":j,id:y,disabled:d,...ke,readOnly:(Rt=ke.readOnly)!=null?Rt:c,"aria-readonly":(zt=ke.readOnly)!=null?zt:c,"aria-required":(Re=ke.required)!=null?Re:p,required:(Qe=ke.required)!=null?Qe:p,ref:xn($,lt),value:ee(oe.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(oe.valueAsNumber)?void 0:oe.valueAsNumber,"aria-invalid":Ms(h??oe.isOutOfRange),"aria-valuetext":ht,autoComplete:"off",autoCorrect:"off",onChange:ot(ke.onChange,de),onKeyDown:ot(ke.onKeyDown,Pe),onFocus:ot(ke.onFocus,_e,()=>B(!0)),onBlur:ot(ke.onBlur,X,qt)}},[S,g,m,_,I,ee,j,y,d,p,c,h,oe.value,oe.valueAsNumber,oe.isOutOfRange,o,s,ht,de,Pe,_e,X,qt]);return{value:ee(oe.value),valueAsNumber:oe.valueAsNumber,isFocused:ae,isDisabled:d,isReadOnly:c,getIncrementButtonProps:Fe,getDecrementButtonProps:it,getInputProps:At,htmlProps:K}}var[GW,Dg]=Un({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[qW,Ty]=Un({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Tg=De(function(t,n){const r=no("NumberInput",t),o=lr(t),s=iy(o),{htmlProps:i,...c}=UW(s),d=l.useMemo(()=>c,[c]);return a.jsx(qW,{value:d,children:a.jsx(GW,{value:r,children:a.jsx(Ae.div,{...i,ref:n,className:kt("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Tg.displayName="NumberInput";var Ng=De(function(t,n){const r=Dg();return a.jsx(Ae.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});Ng.displayName="NumberInputStepper";var $g=De(function(t,n){const{getInputProps:r}=Ty(),o=r(t,n),s=Dg();return a.jsx(Ae.input,{...o,className:kt("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});$g.displayName="NumberInputField";var x3=Ae("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Lg=De(function(t,n){var r;const o=Dg(),{getDecrementButtonProps:s}=Ty(),i=s(t,n);return a.jsx(x3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx($W,{})})});Lg.displayName="NumberDecrementStepper";var zg=De(function(t,n){var r;const{getIncrementButtonProps:o}=Ty(),s=o(t,n),i=Dg();return a.jsx(x3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(LW,{})})});zg.displayName="NumberIncrementStepper";var[KW,ec]=Un({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[QW,Fg]=Un({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Bg(e){const t=l.Children.only(e.children),{getTriggerProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}Bg.displayName="PopoverTrigger";var Mc={click:"click",hover:"hover"};function XW(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:c,arrowShadowColor:d,trigger:p=Mc.click,openDelay:h=200,closeDelay:m=200,isLazy:g,lazyBehavior:b="unmount",computePositionOnMount:y,...x}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:I}=Ry(e),_=l.useRef(null),M=l.useRef(null),E=l.useRef(null),A=l.useRef(!1),R=l.useRef(!1);w&&(R.current=!0);const[D,O]=l.useState(!1),[T,K]=l.useState(!1),G=l.useId(),X=o??G,[Z,te,V,oe]=["popover-trigger","popover-content","popover-header","popover-body"].map(de=>`${de}-${X}`),{referenceRef:ne,getArrowProps:se,getPopperProps:re,getArrowInnerProps:ae,forceUpdate:B}=Ay({...x,enabled:w||!!y}),Y=a3({isOpen:w,ref:E});ZP({enabled:w,ref:M}),Q5(E,{focusRef:M,visible:w,shouldFocus:s&&p===Mc.click}),oB(E,{focusRef:r,visible:w,shouldFocus:i&&p===Mc.click});const $=Dy({wasSelected:R.current,enabled:g,mode:b,isSelected:Y.present}),F=l.useCallback((de={},_e=null)=>{const Pe={...de,style:{...de.style,transformOrigin:qr.transformOrigin.varRef,[qr.arrowSize.var]:c?`${c}px`:void 0,[qr.arrowShadowColor.var]:d},ref:xn(E,_e),children:$?de.children:null,id:te,tabIndex:-1,role:"dialog",onKeyDown:ot(de.onKeyDown,ze=>{n&&ze.key==="Escape"&&S()}),onBlur:ot(de.onBlur,ze=>{const ht=mk(ze),Je=i1(E.current,ht),qt=i1(M.current,ht);w&&t&&(!Je&&!qt)&&S()}),"aria-labelledby":D?V:void 0,"aria-describedby":T?oe:void 0};return p===Mc.hover&&(Pe.role="tooltip",Pe.onMouseEnter=ot(de.onMouseEnter,()=>{A.current=!0}),Pe.onMouseLeave=ot(de.onMouseLeave,ze=>{ze.nativeEvent.relatedTarget!==null&&(A.current=!1,setTimeout(()=>S(),m))})),Pe},[$,te,D,V,T,oe,p,n,S,w,t,m,d,c]),q=l.useCallback((de={},_e=null)=>re({...de,style:{visibility:w?"visible":"hidden",...de.style}},_e),[w,re]),pe=l.useCallback((de,_e=null)=>({...de,ref:xn(_e,_,ne)}),[_,ne]),W=l.useRef(),U=l.useRef(),ee=l.useCallback(de=>{_.current==null&&ne(de)},[ne]),J=l.useCallback((de={},_e=null)=>{const Pe={...de,ref:xn(M,_e,ee),id:Z,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":te};return p===Mc.click&&(Pe.onClick=ot(de.onClick,I)),p===Mc.hover&&(Pe.onFocus=ot(de.onFocus,()=>{W.current===void 0&&j()}),Pe.onBlur=ot(de.onBlur,ze=>{const ht=mk(ze),Je=!i1(E.current,ht);w&&t&&Je&&S()}),Pe.onKeyDown=ot(de.onKeyDown,ze=>{ze.key==="Escape"&&S()}),Pe.onMouseEnter=ot(de.onMouseEnter,()=>{A.current=!0,W.current=window.setTimeout(()=>j(),h)}),Pe.onMouseLeave=ot(de.onMouseLeave,()=>{A.current=!1,W.current&&(clearTimeout(W.current),W.current=void 0),U.current=window.setTimeout(()=>{A.current===!1&&S()},m)})),Pe},[Z,w,te,p,ee,I,j,t,S,h,m]);l.useEffect(()=>()=>{W.current&&clearTimeout(W.current),U.current&&clearTimeout(U.current)},[]);const ge=l.useCallback((de={},_e=null)=>({...de,id:V,ref:xn(_e,Pe=>{O(!!Pe)})}),[V]),he=l.useCallback((de={},_e=null)=>({...de,id:oe,ref:xn(_e,Pe=>{K(!!Pe)})}),[oe]);return{forceUpdate:B,isOpen:w,onAnimationComplete:Y.onComplete,onClose:S,getAnchorProps:pe,getArrowProps:se,getArrowInnerProps:ae,getPopoverPositionerProps:q,getPopoverProps:F,getTriggerProps:J,getHeaderProps:ge,getBodyProps:he}}function i1(e,t){return e===t||(e==null?void 0:e.contains(t))}function mk(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Uf(e){const t=no("Popover",e),{children:n,...r}=lr(e),o=kf(),s=XW({...r,direction:o.direction});return a.jsx(KW,{value:s,children:a.jsx(QW,{value:t,children:Mx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Uf.displayName="Popover";function y3(e){const t=l.Children.only(e.children),{getAnchorProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}y3.displayName="PopoverAnchor";var l1=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function C3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:c}=e,{getArrowProps:d,getArrowInnerProps:p}=ec(),h=Fg(),m=(t=n??r)!=null?t:o,g=s??i;return a.jsx(Ae.div,{...d(),className:"chakra-popover__arrow-positioner",children:a.jsx(Ae.div,{className:kt("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":l1("colors",c),"--popper-arrow-bg":l1("colors",m),"--popper-arrow-shadow":l1("shadows",g),...h.arrow}})})}C3.displayName="PopoverArrow";var Hg=De(function(t,n){const{getBodyProps:r}=ec(),o=Fg();return a.jsx(Ae.div,{...r(t,n),className:kt("chakra-popover__body",t.className),__css:o.body})});Hg.displayName="PopoverBody";var w3=De(function(t,n){const{onClose:r}=ec(),o=Fg();return a.jsx(_I,{size:"sm",onClick:r,className:kt("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});w3.displayName="PopoverCloseButton";function YW(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var JW={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},ZW=Ae(Ar.section),S3=De(function(t,n){const{variants:r=JW,...o}=t,{isOpen:s}=ec();return a.jsx(ZW,{ref:n,variants:YW(r),initial:!1,animate:s?"enter":"exit",...o})});S3.displayName="PopoverTransition";var Gf=De(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:c,onAnimationComplete:d}=ec(),p=Fg(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(Ae.div,{...c(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(S3,{...o,...i(s,n),onAnimationComplete:pg(d,s.onAnimationComplete),className:kt("chakra-popover__content",t.className),__css:h})})});Gf.displayName="PopoverContent";var Ib=e=>a.jsx(Ae.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});Ib.displayName="Circle";function eV(e,t,n){return(e-t)*100/(n-t)}var tV=Si({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),nV=Si({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),rV=Si({"0%":{left:"-40%"},"100%":{left:"100%"}}),oV=Si({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function k3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:c="progressbar"}=e,d=eV(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,d):o})(),role:c},percent:d,value:t}}var j3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(Ae.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${nV} 2s linear infinite`:void 0},...r})};j3.displayName="Shape";var Pb=De((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:c,value:d,capIsRound:p,children:h,thickness:m="10px",color:g="#0078d4",trackColor:b="#edebe9",isIndeterminate:y,...x}=e,w=k3({min:s,max:o,value:d,valueText:i,getValueText:c,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,I=y?{css:{animation:`${tV} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},_={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(Ae.div,{ref:t,className:"chakra-progress",...w.bind,...x,__css:_,children:[a.jsxs(j3,{size:r,isIndeterminate:y,children:[a.jsx(Ib,{stroke:b,strokeWidth:m,className:"chakra-progress__track"}),a.jsx(Ib,{stroke:g,strokeWidth:m,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:w.value===0&&!y?0:void 0,...I})]}),h]})});Pb.displayName="CircularProgress";var[sV,aV]=Un({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),iV=De((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...c}=e,d=k3({value:o,min:n,max:r,isIndeterminate:s,role:i}),h={height:"100%",...aV().filledTrack};return a.jsx(Ae.div,{ref:t,style:{width:`${d.percent}%`,...c.style},...d.bind,...c,__css:h})}),_3=De((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:c,children:d,borderRadius:p,isIndeterminate:h,"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,title:y,role:x,...w}=lr(e),S=no("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),I={animation:`${oV} 1s linear infinite`},E={...!h&&i&&c&&I,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${rV} 1s ease infinite normal none running`}},A={overflow:"hidden",position:"relative",...S.track};return a.jsx(Ae.div,{ref:t,borderRadius:j,__css:A,...w,children:a.jsxs(sV,{value:S,children:[a.jsx(iV,{"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:h,css:E,borderRadius:j,title:y,role:x}),d]})})});_3.displayName="Progress";function lV(e){return e&&Q1(e)&&Q1(e.target)}function cV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:c,...d}=e,[p,h]=l.useState(r||""),m=typeof n<"u",g=m?n:p,b=l.useRef(null),y=l.useCallback(()=>{const M=b.current;if(!M)return;let E="input:not(:disabled):checked";const A=M.querySelector(E);if(A){A.focus();return}E="input:not(:disabled)";const R=M.querySelector(E);R==null||R.focus()},[]),w=`radio-${l.useId()}`,S=o||w,j=l.useCallback(M=>{const E=lV(M)?M.target.value:M;m||h(E),t==null||t(String(E))},[t,m]),I=l.useCallback((M={},E=null)=>({...M,ref:xn(E,b),role:"radiogroup"}),[]),_=l.useCallback((M={},E=null)=>({...M,ref:E,name:S,[c?"checked":"isChecked"]:g!=null?M.value===g:void 0,onChange(R){j(R)},"data-radiogroup":!0}),[c,S,j,g]);return{getRootProps:I,getRadioProps:_,name:S,ref:b,focus:y,setValue:h,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:d}}var[uV,I3]=Un({name:"RadioGroupContext",strict:!1}),om=De((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:c,isFocusable:d,...p}=e,{value:h,onChange:m,getRootProps:g,name:b,htmlProps:y}=cV(p),x=l.useMemo(()=>({name:b,size:r,onChange:m,colorScheme:n,value:h,variant:o,isDisabled:c,isFocusable:d}),[b,r,m,n,h,o,c,d]);return a.jsx(uV,{value:x,children:a.jsx(Ae.div,{...g(y,t),className:kt("chakra-radio-group",i),children:s})})});om.displayName="RadioGroup";var dV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function fV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:c,isInvalid:d,name:p,value:h,id:m,"data-radiogroup":g,"aria-describedby":b,...y}=e,x=`radio-${l.useId()}`,w=Rf(),j=!!I3()||!!g;let _=!!w&&!j?w.id:x;_=m??_;const M=o??(w==null?void 0:w.isDisabled),E=s??(w==null?void 0:w.isReadOnly),A=i??(w==null?void 0:w.isRequired),R=d??(w==null?void 0:w.isInvalid),[D,O]=l.useState(!1),[T,K]=l.useState(!1),[G,X]=l.useState(!1),[Z,te]=l.useState(!1),[V,oe]=l.useState(!!t),ne=typeof n<"u",se=ne?n:V;l.useEffect(()=>GP(O),[]);const re=l.useCallback(ee=>{if(E||M){ee.preventDefault();return}ne||oe(ee.target.checked),c==null||c(ee)},[ne,M,E,c]),ae=l.useCallback(ee=>{ee.key===" "&&te(!0)},[te]),B=l.useCallback(ee=>{ee.key===" "&&te(!1)},[te]),Y=l.useCallback((ee={},J=null)=>({...ee,ref:J,"data-active":Vt(Z),"data-hover":Vt(G),"data-disabled":Vt(M),"data-invalid":Vt(R),"data-checked":Vt(se),"data-focus":Vt(T),"data-focus-visible":Vt(T&&D),"data-readonly":Vt(E),"aria-hidden":!0,onMouseDown:ot(ee.onMouseDown,()=>te(!0)),onMouseUp:ot(ee.onMouseUp,()=>te(!1)),onMouseEnter:ot(ee.onMouseEnter,()=>X(!0)),onMouseLeave:ot(ee.onMouseLeave,()=>X(!1))}),[Z,G,M,R,se,T,E,D]),{onFocus:$,onBlur:F}=w??{},q=l.useCallback((ee={},J=null)=>{const ge=M&&!r;return{...ee,id:_,ref:J,type:"radio",name:p,value:h,onChange:ot(ee.onChange,re),onBlur:ot(F,ee.onBlur,()=>K(!1)),onFocus:ot($,ee.onFocus,()=>K(!0)),onKeyDown:ot(ee.onKeyDown,ae),onKeyUp:ot(ee.onKeyUp,B),checked:se,disabled:ge,readOnly:E,required:A,"aria-invalid":Ms(R),"aria-disabled":Ms(ge),"aria-required":Ms(A),"data-readonly":Vt(E),"aria-describedby":b,style:dV}},[M,r,_,p,h,re,F,$,ae,B,se,E,A,R,b]);return{state:{isInvalid:R,isFocused:T,isChecked:se,isActive:Z,isHovered:G,isDisabled:M,isReadOnly:E,isRequired:A},getCheckboxProps:Y,getRadioProps:Y,getInputProps:q,getLabelProps:(ee={},J=null)=>({...ee,ref:J,onMouseDown:ot(ee.onMouseDown,pV),"data-disabled":Vt(M),"data-checked":Vt(se),"data-invalid":Vt(R)}),getRootProps:(ee,J=null)=>({...ee,ref:J,"data-disabled":Vt(M),"data-checked":Vt(se),"data-invalid":Vt(R)}),htmlProps:y}}function pV(e){e.preventDefault(),e.stopPropagation()}function hV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var ei=De((e,t)=>{var n;const r=I3(),{onChange:o,value:s}=e,i=no("Radio",{...r,...e}),c=lr(e),{spacing:d="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:m=r==null?void 0:r.isFocusable,inputProps:g,...b}=c;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let x=o;r!=null&&r.onChange&&s!=null&&(x=pg(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:I,getRootProps:_,htmlProps:M}=fV({...b,isChecked:y,isFocusable:m,isDisabled:h,onChange:x,name:w}),[E,A]=hV(M,II),R=j(A),D=S(g,t),O=I(),T=Object.assign({},E,_()),K={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},G={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},X={userSelect:"none",marginStart:d,...i.label};return a.jsxs(Ae.label,{className:"chakra-radio",...T,__css:K,children:[a.jsx("input",{className:"chakra-radio__input",...D}),a.jsx(Ae.span,{className:"chakra-radio__control",...R,__css:G}),p&&a.jsx(Ae.span,{className:"chakra-radio__label",...O,__css:X,children:p})]})});ei.displayName="Radio";var P3=De(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(Ae.select,{...i,ref:n,className:kt("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});P3.displayName="SelectField";function mV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var E3=De((e,t)=>{var n;const r=no("Select",e),{rootProps:o,placeholder:s,icon:i,color:c,height:d,h:p,minH:h,minHeight:m,iconColor:g,iconSize:b,...y}=lr(e),[x,w]=mV(y,II),S=ay(w),j={width:"100%",height:"fit-content",position:"relative",color:c},I={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(Ae.div,{className:"chakra-select__wrapper",__css:j,...x,...o,children:[a.jsx(P3,{ref:t,height:p??d,minH:h??m,placeholder:s,...S,__css:I,children:e.children}),a.jsx(M3,{"data-disabled":Vt(S.disabled),...(g||c)&&{color:g||c},__css:r.icon,...b&&{fontSize:b},children:i})]})});E3.displayName="Select";var gV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),vV=Ae("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),M3=e=>{const{children:t=a.jsx(gV,{}),...n}=e,r=l.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(vV,{...n,className:"chakra-select__icon-wrapper",children:l.isValidElement(t)?r:null})};M3.displayName="SelectIcon";function bV(){const e=l.useRef(!0);return l.useEffect(()=>{e.current=!1},[]),e.current}function xV(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}var yV=Ae("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),Eb=PI("skeleton-start-color"),Mb=PI("skeleton-end-color"),CV=Si({from:{opacity:0},to:{opacity:1}}),wV=Si({from:{borderColor:Eb.reference,background:Eb.reference},to:{borderColor:Mb.reference,background:Mb.reference}}),Wg=De((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=cl("Skeleton",n),o=bV(),{startColor:s="",endColor:i="",isLoaded:c,fadeDuration:d,speed:p,className:h,fitContent:m,...g}=lr(n),[b,y]=ea("colors",[s,i]),x=xV(c),w=kt("chakra-skeleton",h),S={...b&&{[Eb.variable]:b},...y&&{[Mb.variable]:y}};if(c){const j=o||x?"none":`${CV} ${d}s`;return a.jsx(Ae.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(yV,{ref:t,className:w,...g,__css:{width:m?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${wV}`}})});Wg.displayName="Skeleton";var js=e=>e?"":void 0,su=e=>e?!0:void 0,dl=(...e)=>e.filter(Boolean).join(" ");function au(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function SV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Od(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Oh={width:0,height:0},th=e=>e||Oh;function O3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=x=>{var w;const S=(w=r[x])!=null?w:Oh;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Od({orientation:t,vertical:{bottom:`calc(${n[x]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[x]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((x,w)=>th(x).height>th(w).height?x:w,Oh):r.reduce((x,w)=>th(x).width>th(w).width?x:w,Oh),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Od({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},d={position:"absolute",...Od({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,h=[0,o?100-n[0]:n[0]],m=p?h:n;let g=m[0];!p&&o&&(g=100-g);const b=Math.abs(m[m.length-1]-m[0]),y={...d,...Od({orientation:t,vertical:o?{height:`${b}%`,top:`${g}%`}:{height:`${b}%`,bottom:`${g}%`},horizontal:o?{width:`${b}%`,right:`${g}%`}:{width:`${b}%`,left:`${g}%`}})};return{trackStyle:d,innerTrackStyle:y,rootStyle:c,getThumbStyle:s}}function A3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function kV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function jV(e){const t=IV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function R3(e){return!!e.touches}function _V(e){return R3(e)&&e.touches.length>1}function IV(e){var t;return(t=e.view)!=null?t:window}function PV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function EV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function D3(e,t="page"){return R3(e)?PV(e,t):EV(e,t)}function MV(e){return t=>{const n=jV(t);(!n||n&&t.button===0)&&e(t)}}function OV(e,t=!1){function n(o){e(o,{point:D3(o)})}return t?MV(n):n}function Ah(e,t,n,r){return kV(e,t,OV(n,t==="pointerdown"),r)}var AV=Object.defineProperty,RV=(e,t,n)=>t in e?AV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qs=(e,t,n)=>(RV(e,typeof t!="symbol"?t+"":t,n),n),DV=class{constructor(e,t,n){Qs(this,"history",[]),Qs(this,"startEvent",null),Qs(this,"lastEvent",null),Qs(this,"lastEventInfo",null),Qs(this,"handlers",{}),Qs(this,"removeListeners",()=>{}),Qs(this,"threshold",3),Qs(this,"win"),Qs(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=c1(this.lastEventInfo,this.history),d=this.startEvent!==null,p=LV(c.offset,{x:0,y:0})>=this.threshold;if(!d&&!p)return;const{timestamp:h}=AS();this.history.push({...c.point,timestamp:h});const{onStart:m,onMove:g}=this.handlers;d||(m==null||m(this.lastEvent,c),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,c)}),Qs(this,"onPointerMove",(c,d)=>{this.lastEvent=c,this.lastEventInfo=d,rL.update(this.updatePoint,!0)}),Qs(this,"onPointerUp",(c,d)=>{const p=c1(d,this.history),{onEnd:h,onSessionEnd:m}=this.handlers;m==null||m(c,p),this.end(),!(!h||!this.startEvent)&&(h==null||h(c,p))});var r;if(this.win=(r=e.view)!=null?r:window,_V(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:D3(e)},{timestamp:s}=AS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,c1(o,this.history)),this.removeListeners=$V(Ah(this.win,"pointermove",this.onPointerMove),Ah(this.win,"pointerup",this.onPointerUp),Ah(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),oL.update(this.updatePoint)}};function gk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function c1(e,t){return{point:e.point,delta:gk(e.point,t[t.length-1]),offset:gk(e.point,t[0]),velocity:NV(t,.1)}}var TV=e=>e*1e3;function NV(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>TV(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function $V(...e){return t=>e.reduce((n,r)=>r(n),t)}function u1(e,t){return Math.abs(e-t)}function vk(e){return"x"in e&&"y"in e}function LV(e,t){if(typeof e=="number"&&typeof t=="number")return u1(e,t);if(vk(e)&&vk(t)){const n=u1(e.x,t.x),r=u1(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function T3(e){const t=l.useRef(null);return t.current=e,t}function N3(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:c}=t,d=!!(n||r||o||s||i),p=l.useRef(null),h=T3({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(m,g){p.current=null,o==null||o(m,g)}});l.useEffect(()=>{var m;(m=p.current)==null||m.updateHandlers(h.current)}),l.useEffect(()=>{const m=e.current;if(!m||!d)return;function g(b){p.current=new DV(b,h.current,c)}return Ah(m,"pointerdown",g)},[e,d,h,c]),l.useEffect(()=>()=>{var m;(m=p.current)==null||m.end(),p.current=null},[])}function zV(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,c;if("borderBoxSize"in s){const d=s.borderBoxSize,p=Array.isArray(d)?d[0]:d;i=p.inlineSize,c=p.blockSize}else i=e.offsetWidth,c=e.offsetHeight;t({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var FV=globalThis!=null&&globalThis.document?l.useLayoutEffect:l.useEffect;function BV(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function $3({getNodes:e,observeMutation:t=!0}){const[n,r]=l.useState([]),[o,s]=l.useState(0);return FV(()=>{const i=e(),c=i.map((d,p)=>zV(d,h=>{r(m=>[...m.slice(0,p),h,...m.slice(p+1)])}));if(t){const d=i[0];c.push(BV(d,()=>{s(p=>p+1)}))}return()=>{c.forEach(d=>{d==null||d()})}},[o]),n}function HV(e){return typeof e=="object"&&e!==null&&"current"in e}function WV(e){const[t]=$3({observeMutation:!1,getNodes(){return[HV(e)?e.current:e]}});return t}function VV(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:c="ltr",orientation:d="horizontal",id:p,isDisabled:h,isReadOnly:m,onChangeStart:g,onChangeEnd:b,step:y=1,getAriaValueText:x,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:I,focusThumbOnChange:_=!0,minStepsBetweenThumbs:M=0,...E}=e,A=vr(g),R=vr(b),D=vr(x),O=A3({isReversed:i,direction:c,orientation:d}),[T,K]=Of({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[G,X]=l.useState(!1),[Z,te]=l.useState(!1),[V,oe]=l.useState(-1),ne=!(h||m),se=l.useRef(T),re=T.map(Te=>tu(Te,t,n)),ae=M*y,B=UV(re,t,n,ae),Y=l.useRef({eventSource:null,value:[],valueBounds:[]});Y.current.value=re,Y.current.valueBounds=B;const $=re.map(Te=>n-Te+t),q=(O?$:re).map(Te=>Zh(Te,t,n)),pe=d==="vertical",W=l.useRef(null),U=l.useRef(null),ee=$3({getNodes(){const Te=U.current,ct=Te==null?void 0:Te.querySelectorAll("[role=slider]");return ct?Array.from(ct):[]}}),J=l.useId(),he=SV(p??J),de=l.useCallback(Te=>{var ct,ft;if(!W.current)return;Y.current.eventSource="pointer";const tt=W.current.getBoundingClientRect(),{clientX:en,clientY:ar}=(ft=(ct=Te.touches)==null?void 0:ct[0])!=null?ft:Te,vn=pe?tt.bottom-ar:en-tt.left,dn=pe?tt.height:tt.width;let Tr=vn/dn;return O&&(Tr=1-Tr),KP(Tr,t,n)},[pe,O,n,t]),_e=(n-t)/10,Pe=y||(n-t)/100,ze=l.useMemo(()=>({setValueAtIndex(Te,ct){if(!ne)return;const ft=Y.current.valueBounds[Te];ct=parseFloat(gb(ct,ft.min,Pe)),ct=tu(ct,ft.min,ft.max);const tt=[...Y.current.value];tt[Te]=ct,K(tt)},setActiveIndex:oe,stepUp(Te,ct=Pe){const ft=Y.current.value[Te],tt=O?ft-ct:ft+ct;ze.setValueAtIndex(Te,tt)},stepDown(Te,ct=Pe){const ft=Y.current.value[Te],tt=O?ft+ct:ft-ct;ze.setValueAtIndex(Te,tt)},reset(){K(se.current)}}),[Pe,O,K,ne]),ht=l.useCallback(Te=>{const ct=Te.key,tt={ArrowRight:()=>ze.stepUp(V),ArrowUp:()=>ze.stepUp(V),ArrowLeft:()=>ze.stepDown(V),ArrowDown:()=>ze.stepDown(V),PageUp:()=>ze.stepUp(V,_e),PageDown:()=>ze.stepDown(V,_e),Home:()=>{const{min:en}=B[V];ze.setValueAtIndex(V,en)},End:()=>{const{max:en}=B[V];ze.setValueAtIndex(V,en)}}[ct];tt&&(Te.preventDefault(),Te.stopPropagation(),tt(Te),Y.current.eventSource="keyboard")},[ze,V,_e,B]),{getThumbStyle:Je,rootStyle:qt,trackStyle:Pt,innerTrackStyle:jt}=l.useMemo(()=>O3({isReversed:O,orientation:d,thumbRects:ee,thumbPercents:q}),[O,d,q,ee]),Se=l.useCallback(Te=>{var ct;const ft=Te??V;if(ft!==-1&&_){const tt=he.getThumb(ft),en=(ct=U.current)==null?void 0:ct.ownerDocument.getElementById(tt);en&&setTimeout(()=>en.focus())}},[_,V,he]);wi(()=>{Y.current.eventSource==="keyboard"&&(R==null||R(Y.current.value))},[re,R]);const Fe=Te=>{const ct=de(Te)||0,ft=Y.current.value.map(dn=>Math.abs(dn-ct)),tt=Math.min(...ft);let en=ft.indexOf(tt);const ar=ft.filter(dn=>dn===tt);ar.length>1&&ct>Y.current.value[en]&&(en=en+ar.length-1),oe(en),ze.setValueAtIndex(en,ct),Se(en)},it=Te=>{if(V==-1)return;const ct=de(Te)||0;oe(V),ze.setValueAtIndex(V,ct),Se(V)};N3(U,{onPanSessionStart(Te){ne&&(X(!0),Fe(Te),A==null||A(Y.current.value))},onPanSessionEnd(){ne&&(X(!1),R==null||R(Y.current.value))},onPan(Te){ne&&it(Te)}});const At=l.useCallback((Te={},ct=null)=>({...Te,...E,id:he.root,ref:xn(ct,U),tabIndex:-1,"aria-disabled":su(h),"data-focused":js(Z),style:{...Te.style,...qt}}),[E,h,Z,qt,he]),ke=l.useCallback((Te={},ct=null)=>({...Te,ref:xn(ct,W),id:he.track,"data-disabled":js(h),style:{...Te.style,...Pt}}),[h,Pt,he]),lt=l.useCallback((Te={},ct=null)=>({...Te,ref:ct,id:he.innerTrack,style:{...Te.style,...jt}}),[jt,he]),Rt=l.useCallback((Te,ct=null)=>{var ft;const{index:tt,...en}=Te,ar=re[tt];if(ar==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${tt}\`. The \`value\` or \`defaultValue\` length is : ${re.length}`);const vn=B[tt];return{...en,ref:ct,role:"slider",tabIndex:ne?0:void 0,id:he.getThumb(tt),"data-active":js(G&&V===tt),"aria-valuetext":(ft=D==null?void 0:D(ar))!=null?ft:w==null?void 0:w[tt],"aria-valuemin":vn.min,"aria-valuemax":vn.max,"aria-valuenow":ar,"aria-orientation":d,"aria-disabled":su(h),"aria-readonly":su(m),"aria-label":S==null?void 0:S[tt],"aria-labelledby":S!=null&&S[tt]||j==null?void 0:j[tt],style:{...Te.style,...Je(tt)},onKeyDown:au(Te.onKeyDown,ht),onFocus:au(Te.onFocus,()=>{te(!0),oe(tt)}),onBlur:au(Te.onBlur,()=>{te(!1),oe(-1)})}},[he,re,B,ne,G,V,D,w,d,h,m,S,j,Je,ht,te]),zt=l.useCallback((Te={},ct=null)=>({...Te,ref:ct,id:he.output,htmlFor:re.map((ft,tt)=>he.getThumb(tt)).join(" "),"aria-live":"off"}),[he,re]),Re=l.useCallback((Te,ct=null)=>{const{value:ft,...tt}=Te,en=!(ftn),ar=ft>=re[0]&&ft<=re[re.length-1];let vn=Zh(ft,t,n);vn=O?100-vn:vn;const dn={position:"absolute",pointerEvents:"none",...Od({orientation:d,vertical:{bottom:`${vn}%`},horizontal:{left:`${vn}%`}})};return{...tt,ref:ct,id:he.getMarker(Te.value),role:"presentation","aria-hidden":!0,"data-disabled":js(h),"data-invalid":js(!en),"data-highlighted":js(ar),style:{...Te.style,...dn}}},[h,O,n,t,d,re,he]),Qe=l.useCallback((Te,ct=null)=>{const{index:ft,...tt}=Te;return{...tt,ref:ct,id:he.getInput(ft),type:"hidden",value:re[ft],name:Array.isArray(I)?I[ft]:`${I}-${ft}`}},[I,re,he]);return{state:{value:re,isFocused:Z,isDragging:G,getThumbPercent:Te=>q[Te],getThumbMinValue:Te=>B[Te].min,getThumbMaxValue:Te=>B[Te].max},actions:ze,getRootProps:At,getTrackProps:ke,getInnerTrackProps:lt,getThumbProps:Rt,getMarkerProps:Re,getInputProps:Qe,getOutputProps:zt}}function UV(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,c=s===e.length-1?n:e[s+1]-r;return{min:i,max:c}})}var[GV,Vg]=Un({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[qV,Ug]=Un({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),L3=De(function(t,n){const r={orientation:"horizontal",...t},o=no("Slider",r),s=lr(r),{direction:i}=kf();s.direction=i;const{getRootProps:c,...d}=VV(s),p=l.useMemo(()=>({...d,name:r.name}),[d,r.name]);return a.jsx(GV,{value:p,children:a.jsx(qV,{value:o,children:a.jsx(Ae.div,{...c({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});L3.displayName="RangeSlider";var Ob=De(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Vg(),i=Ug(),c=r(t,n);return a.jsxs(Ae.div,{...c,className:dl("chakra-slider__thumb",t.className),__css:i.thumb,children:[c.children,s&&a.jsx("input",{...o({index:t.index})})]})});Ob.displayName="RangeSliderThumb";var z3=De(function(t,n){const{getTrackProps:r}=Vg(),o=Ug(),s=r(t,n);return a.jsx(Ae.div,{...s,className:dl("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});z3.displayName="RangeSliderTrack";var F3=De(function(t,n){const{getInnerTrackProps:r}=Vg(),o=Ug(),s=r(t,n);return a.jsx(Ae.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});F3.displayName="RangeSliderFilledTrack";var Rh=De(function(t,n){const{getMarkerProps:r}=Vg(),o=Ug(),s=r(t,n);return a.jsx(Ae.div,{...s,className:dl("chakra-slider__marker",t.className),__css:o.mark})});Rh.displayName="RangeSliderMark";function KV(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:c,direction:d="ltr",orientation:p="horizontal",id:h,isDisabled:m,isReadOnly:g,onChangeStart:b,onChangeEnd:y,step:x=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":I,name:_,focusThumbOnChange:M=!0,...E}=e,A=vr(b),R=vr(y),D=vr(w),O=A3({isReversed:c,direction:d,orientation:p}),[T,K]=Of({value:s,defaultValue:i??XV(n,r),onChange:o}),[G,X]=l.useState(!1),[Z,te]=l.useState(!1),V=!(m||g),oe=(r-n)/10,ne=x||(r-n)/100,se=tu(T,n,r),re=r-se+n,B=Zh(O?re:se,n,r),Y=p==="vertical",$=T3({min:n,max:r,step:x,isDisabled:m,value:se,isInteractive:V,isReversed:O,isVertical:Y,eventSource:null,focusThumbOnChange:M,orientation:p}),F=l.useRef(null),q=l.useRef(null),pe=l.useRef(null),W=l.useId(),U=h??W,[ee,J]=[`slider-thumb-${U}`,`slider-track-${U}`],ge=l.useCallback(Re=>{var Qe,En;if(!F.current)return;const Te=$.current;Te.eventSource="pointer";const ct=F.current.getBoundingClientRect(),{clientX:ft,clientY:tt}=(En=(Qe=Re.touches)==null?void 0:Qe[0])!=null?En:Re,en=Y?ct.bottom-tt:ft-ct.left,ar=Y?ct.height:ct.width;let vn=en/ar;O&&(vn=1-vn);let dn=KP(vn,Te.min,Te.max);return Te.step&&(dn=parseFloat(gb(dn,Te.min,Te.step))),dn=tu(dn,Te.min,Te.max),dn},[Y,O,$]),he=l.useCallback(Re=>{const Qe=$.current;Qe.isInteractive&&(Re=parseFloat(gb(Re,Qe.min,ne)),Re=tu(Re,Qe.min,Qe.max),K(Re))},[ne,K,$]),de=l.useMemo(()=>({stepUp(Re=ne){const Qe=O?se-Re:se+Re;he(Qe)},stepDown(Re=ne){const Qe=O?se+Re:se-Re;he(Qe)},reset(){he(i||0)},stepTo(Re){he(Re)}}),[he,O,se,ne,i]),_e=l.useCallback(Re=>{const Qe=$.current,Te={ArrowRight:()=>de.stepUp(),ArrowUp:()=>de.stepUp(),ArrowLeft:()=>de.stepDown(),ArrowDown:()=>de.stepDown(),PageUp:()=>de.stepUp(oe),PageDown:()=>de.stepDown(oe),Home:()=>he(Qe.min),End:()=>he(Qe.max)}[Re.key];Te&&(Re.preventDefault(),Re.stopPropagation(),Te(Re),Qe.eventSource="keyboard")},[de,he,oe,$]),Pe=(t=D==null?void 0:D(se))!=null?t:S,ze=WV(q),{getThumbStyle:ht,rootStyle:Je,trackStyle:qt,innerTrackStyle:Pt}=l.useMemo(()=>{const Re=$.current,Qe=ze??{width:0,height:0};return O3({isReversed:O,orientation:Re.orientation,thumbRects:[Qe],thumbPercents:[B]})},[O,ze,B,$]),jt=l.useCallback(()=>{$.current.focusThumbOnChange&&setTimeout(()=>{var Qe;return(Qe=q.current)==null?void 0:Qe.focus()})},[$]);wi(()=>{const Re=$.current;jt(),Re.eventSource==="keyboard"&&(R==null||R(Re.value))},[se,R]);function Se(Re){const Qe=ge(Re);Qe!=null&&Qe!==$.current.value&&K(Qe)}N3(pe,{onPanSessionStart(Re){const Qe=$.current;Qe.isInteractive&&(X(!0),jt(),Se(Re),A==null||A(Qe.value))},onPanSessionEnd(){const Re=$.current;Re.isInteractive&&(X(!1),R==null||R(Re.value))},onPan(Re){$.current.isInteractive&&Se(Re)}});const Fe=l.useCallback((Re={},Qe=null)=>({...Re,...E,ref:xn(Qe,pe),tabIndex:-1,"aria-disabled":su(m),"data-focused":js(Z),style:{...Re.style,...Je}}),[E,m,Z,Je]),it=l.useCallback((Re={},Qe=null)=>({...Re,ref:xn(Qe,F),id:J,"data-disabled":js(m),style:{...Re.style,...qt}}),[m,J,qt]),At=l.useCallback((Re={},Qe=null)=>({...Re,ref:Qe,style:{...Re.style,...Pt}}),[Pt]),ke=l.useCallback((Re={},Qe=null)=>({...Re,ref:xn(Qe,q),role:"slider",tabIndex:V?0:void 0,id:ee,"data-active":js(G),"aria-valuetext":Pe,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":se,"aria-orientation":p,"aria-disabled":su(m),"aria-readonly":su(g),"aria-label":j,"aria-labelledby":j?void 0:I,style:{...Re.style,...ht(0)},onKeyDown:au(Re.onKeyDown,_e),onFocus:au(Re.onFocus,()=>te(!0)),onBlur:au(Re.onBlur,()=>te(!1))}),[V,ee,G,Pe,n,r,se,p,m,g,j,I,ht,_e]),lt=l.useCallback((Re,Qe=null)=>{const En=!(Re.valuer),Te=se>=Re.value,ct=Zh(Re.value,n,r),ft={position:"absolute",pointerEvents:"none",...QV({orientation:p,vertical:{bottom:O?`${100-ct}%`:`${ct}%`},horizontal:{left:O?`${100-ct}%`:`${ct}%`}})};return{...Re,ref:Qe,role:"presentation","aria-hidden":!0,"data-disabled":js(m),"data-invalid":js(!En),"data-highlighted":js(Te),style:{...Re.style,...ft}}},[m,O,r,n,p,se]),Rt=l.useCallback((Re={},Qe=null)=>({...Re,ref:Qe,type:"hidden",value:se,name:_}),[_,se]);return{state:{value:se,isFocused:Z,isDragging:G},actions:de,getRootProps:Fe,getTrackProps:it,getInnerTrackProps:At,getThumbProps:ke,getMarkerProps:lt,getInputProps:Rt}}function QV(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function XV(e,t){return t"}),[JV,qg]=Un({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Ny=De((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=no("Slider",r),s=lr(r),{direction:i}=kf();s.direction=i;const{getInputProps:c,getRootProps:d,...p}=KV(s),h=d(),m=c({},t);return a.jsx(YV,{value:p,children:a.jsx(JV,{value:o,children:a.jsxs(Ae.div,{...h,className:dl("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...m})]})})})});Ny.displayName="Slider";var $y=De((e,t)=>{const{getThumbProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__thumb",e.className),__css:r.thumb})});$y.displayName="SliderThumb";var Ly=De((e,t)=>{const{getTrackProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__track",e.className),__css:r.track})});Ly.displayName="SliderTrack";var zy=De((e,t)=>{const{getInnerTrackProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__filled-track",e.className),__css:r.filledTrack})});zy.displayName="SliderFilledTrack";var Fc=De((e,t)=>{const{getMarkerProps:n}=Gg(),r=qg(),o=n(e,t);return a.jsx(Ae.div,{...o,className:dl("chakra-slider__marker",e.className),__css:r.mark})});Fc.displayName="SliderMark";var[ZV,B3]=Un({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),H3=De(function(t,n){const r=no("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...c}=lr(t);return a.jsx(ZV,{value:r,children:a.jsx(Ae.div,{ref:n,...c,className:kt("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});H3.displayName="Stat";var W3=De(function(t,n){return a.jsx(Ae.div,{...t,ref:n,role:"group",className:kt("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});W3.displayName="StatGroup";var V3=De(function(t,n){const r=B3();return a.jsx(Ae.dt,{ref:n,...t,className:kt("chakra-stat__label",t.className),__css:r.label})});V3.displayName="StatLabel";var U3=De(function(t,n){const r=B3();return a.jsx(Ae.dd,{ref:n,...t,className:kt("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});U3.displayName="StatNumber";var Fy=De(function(t,n){const r=no("Switch",t),{spacing:o="0.5rem",children:s,...i}=lr(t),{getIndicatorProps:c,getInputProps:d,getCheckboxProps:p,getRootProps:h,getLabelProps:m}=qP(i),g=l.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=l.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=l.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(Ae.label,{...h(),className:kt("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...d({},n)}),a.jsx(Ae.span,{...p(),className:"chakra-switch__track",__css:b,children:a.jsx(Ae.span,{__css:r.thumb,className:"chakra-switch__thumb",...c()})}),s&&a.jsx(Ae.span,{className:"chakra-switch__label",...m(),__css:y,children:s})]})});Fy.displayName="Switch";var[eU,tU,nU,rU]=ry();function oU(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:c="unmount",orientation:d="horizontal",direction:p="ltr",...h}=e,[m,g]=l.useState(n??0),[b,y]=Of({defaultValue:n??0,value:o,onChange:r});l.useEffect(()=>{o!=null&&g(o)},[o]);const x=nU(),w=l.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:b,focusedIndex:m,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:c,orientation:d,descendants:x,direction:p,htmlProps:h}}var[sU,Kg]=Un({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function aU(e){const{focusedIndex:t,orientation:n,direction:r}=Kg(),o=tU(),s=l.useCallback(i=>{const c=()=>{var j;const I=o.nextEnabled(t);I&&((j=I.node)==null||j.focus())},d=()=>{var j;const I=o.prevEnabled(t);I&&((j=I.node)==null||j.focus())},p=()=>{var j;const I=o.firstEnabled();I&&((j=I.node)==null||j.focus())},h=()=>{var j;const I=o.lastEnabled();I&&((j=I.node)==null||j.focus())},m=n==="horizontal",g=n==="vertical",b=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",x=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>m&&d(),[x]:()=>m&&c(),ArrowDown:()=>g&&c(),ArrowUp:()=>g&&d(),Home:p,End:h}[b];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:ot(e.onKeyDown,s)}}function iU(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:c,selectedIndex:d}=Kg(),{index:p,register:h}=rU({disabled:t&&!n}),m=p===d,g=()=>{o(p)},b=()=>{c(p),!s&&!(t&&n)&&o(p)},y=K5({...r,ref:xn(h,e.ref),isDisabled:t,isFocusable:n,onClick:ot(e.onClick,g)}),x="button";return{...y,id:G3(i,p),role:"tab",tabIndex:m?0:-1,type:x,"aria-selected":m,"aria-controls":q3(i,p),onFocus:t?void 0:ot(e.onFocus,b)}}var[lU,cU]=Un({});function uU(e){const t=Kg(),{id:n,selectedIndex:r}=t,s=Sg(e.children).map((i,c)=>l.createElement(lU,{key:c,value:{isSelected:c===r,id:q3(n,c),tabId:G3(n,c),selectedIndex:r}},i));return{...e,children:s}}function dU(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Kg(),{isSelected:s,id:i,tabId:c}=cU(),d=l.useRef(!1);s&&(d.current=!0);const p=Dy({wasSelected:d.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":c,hidden:!s,id:i}}function G3(e,t){return`${e}--tab-${t}`}function q3(e,t){return`${e}--tabpanel-${t}`}var[fU,Qg]=Un({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),tc=De(function(t,n){const r=no("Tabs",t),{children:o,className:s,...i}=lr(t),{htmlProps:c,descendants:d,...p}=oU(i),h=l.useMemo(()=>p,[p]),{isFitted:m,...g}=c,b={position:"relative",...r.root};return a.jsx(eU,{value:d,children:a.jsx(sU,{value:h,children:a.jsx(fU,{value:r,children:a.jsx(Ae.div,{className:kt("chakra-tabs",s),ref:n,...g,__css:b,children:o})})})})});tc.displayName="Tabs";var nc=De(function(t,n){const r=aU({...t,ref:n}),s={display:"flex",...Qg().tablist};return a.jsx(Ae.div,{...r,className:kt("chakra-tabs__tablist",t.className),__css:s})});nc.displayName="TabList";var Go=De(function(t,n){const r=dU({...t,ref:n}),o=Qg();return a.jsx(Ae.div,{outline:"0",...r,className:kt("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});Go.displayName="TabPanel";var $u=De(function(t,n){const r=uU(t),o=Qg();return a.jsx(Ae.div,{...r,width:"100%",ref:n,className:kt("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});$u.displayName="TabPanels";var wo=De(function(t,n){const r=Qg(),o=iU({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(Ae.button,{...o,className:kt("chakra-tabs__tab",t.className),__css:s})});wo.displayName="Tab";function pU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var hU=["h","minH","height","minHeight"],K3=De((e,t)=>{const n=cl("Textarea",e),{className:r,rows:o,...s}=lr(e),i=ay(s),c=o?pU(n,hU):n;return a.jsx(Ae.textarea,{ref:t,rows:o,...i,className:kt("chakra-textarea",r),__css:c})});K3.displayName="Textarea";var mU={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},Ab=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Dh=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function gU(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:c=!0,onOpen:d,onClose:p,placement:h,id:m,isOpen:g,defaultIsOpen:b,arrowSize:y=10,arrowShadowColor:x,arrowPadding:w,modifiers:S,isDisabled:j,gutter:I,offset:_,direction:M,...E}=e,{isOpen:A,onOpen:R,onClose:D}=Ry({isOpen:g,defaultIsOpen:b,onOpen:d,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:K,getArrowProps:G}=Ay({enabled:A,placement:h,arrowPadding:w,modifiers:S,gutter:I,offset:_,direction:M}),X=l.useId(),te=`tooltip-${m??X}`,V=l.useRef(null),oe=l.useRef(),ne=l.useCallback(()=>{oe.current&&(clearTimeout(oe.current),oe.current=void 0)},[]),se=l.useRef(),re=l.useCallback(()=>{se.current&&(clearTimeout(se.current),se.current=void 0)},[]),ae=l.useCallback(()=>{re(),D()},[D,re]),B=vU(V,ae),Y=l.useCallback(()=>{if(!j&&!oe.current){A&&B();const J=Dh(V);oe.current=J.setTimeout(R,t)}},[B,j,A,R,t]),$=l.useCallback(()=>{ne();const J=Dh(V);se.current=J.setTimeout(ae,n)},[n,ae,ne]),F=l.useCallback(()=>{A&&r&&$()},[r,$,A]),q=l.useCallback(()=>{A&&i&&$()},[i,$,A]),pe=l.useCallback(J=>{A&&J.key==="Escape"&&$()},[A,$]);Nl(()=>Ab(V),"keydown",c?pe:void 0),Nl(()=>{if(!s)return null;const J=V.current;if(!J)return null;const ge=T5(J);return ge.localName==="body"?Dh(V):ge},"scroll",()=>{A&&s&&ae()},{passive:!0,capture:!0}),l.useEffect(()=>{j&&(ne(),A&&D())},[j,A,D,ne]),l.useEffect(()=>()=>{ne(),re()},[ne,re]),Nl(()=>V.current,"pointerleave",$);const W=l.useCallback((J={},ge=null)=>({...J,ref:xn(V,ge,O),onPointerEnter:ot(J.onPointerEnter,de=>{de.pointerType!=="touch"&&Y()}),onClick:ot(J.onClick,F),onPointerDown:ot(J.onPointerDown,q),onFocus:ot(J.onFocus,Y),onBlur:ot(J.onBlur,$),"aria-describedby":A?te:void 0}),[Y,$,q,A,te,F,O]),U=l.useCallback((J={},ge=null)=>T({...J,style:{...J.style,[qr.arrowSize.var]:y?`${y}px`:void 0,[qr.arrowShadowColor.var]:x}},ge),[T,y,x]),ee=l.useCallback((J={},ge=null)=>{const he={...J.style,position:"relative",transformOrigin:qr.transformOrigin.varRef};return{ref:ge,...E,...J,id:te,role:"tooltip",style:he}},[E,te]);return{isOpen:A,show:Y,hide:$,getTriggerProps:W,getTooltipProps:ee,getTooltipPositionerProps:U,getArrowProps:G,getArrowInnerProps:K}}var d1="chakra-ui:close-tooltip";function vU(e,t){return l.useEffect(()=>{const n=Ab(e);return n.addEventListener(d1,t),()=>n.removeEventListener(d1,t)},[t,e]),()=>{const n=Ab(e),r=Dh(e);n.dispatchEvent(new r.CustomEvent(d1))}}function bU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function xU(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var yU=Ae(Ar.div),Wn=De((e,t)=>{var n,r;const o=cl("Tooltip",e),s=lr(e),i=kf(),{children:c,label:d,shouldWrapChildren:p,"aria-label":h,hasArrow:m,bg:g,portalProps:b,background:y,backgroundColor:x,bgColor:w,motionProps:S,...j}=s,I=(r=(n=y??x)!=null?n:g)!=null?r:w;if(I){o.bg=I;const T=mD(i,"colors",I);o[qr.arrowBg.var]=T}const _=gU({...j,direction:i.direction}),M=typeof c=="string"||p;let E;if(M)E=a.jsx(Ae.span,{display:"inline-block",tabIndex:0,..._.getTriggerProps(),children:c});else{const T=l.Children.only(c);E=l.cloneElement(T,_.getTriggerProps(T.props,T.ref))}const A=!!h,R=_.getTooltipProps({},t),D=A?bU(R,["role","id"]):R,O=xU(R,["role","id"]);return d?a.jsxs(a.Fragment,{children:[E,a.jsx(So,{children:_.isOpen&&a.jsx(Au,{...b,children:a.jsx(Ae.div,{..._.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(yU,{variants:mU,initial:"exit",animate:"enter",exit:"exit",...S,...D,__css:o,children:[d,A&&a.jsx(Ae.span,{srOnly:!0,...O,children:h}),m&&a.jsx(Ae.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(Ae.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:c})});Wn.displayName="Tooltip";function Xg(e,t={}){let n=l.useCallback(o=>t.keys?D$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return l.useSyncExternalStore(n,r,r)}const CU=me(we,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Q3=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=H(CU);return l.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${gD[t]}`)):localStorage.setItem("ROARR_LOG","false"),Bw.ROARR.write=vD.createLogWriter()},[t,n]),l.useEffect(()=>{const o={...bD};xD.set(Bw.Roarr.child(o))},[]),l.useMemo(()=>ki(e),[e])};function Lu(e,t,n,r){function o(s){return s instanceof n?s:new n(function(i){i(s)})}return new(n||(n=Promise))(function(s,i){function c(h){try{p(r.next(h))}catch(m){i(m)}}function d(h){try{p(r.throw(h))}catch(m){i(m)}}function p(h){h.done?s(h.value):o(h.value).then(c,d)}p((r=r.apply(e,t||[])).next())})}function zu(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(p){return function(h){return d([p,h])}}function d(p){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,p[0]&&(n=0)),n;)try{if(r=1,o&&(s=p[0]&2?o.return:p[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,p[1])).done)return s;switch(o=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,o=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){i={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function xk(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function SU(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=wU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var kU=[".DS_Store","Thumbs.db"];function jU(e){return Lu(this,void 0,void 0,function(){return zu(this,function(t){return sm(e)&&_U(e.dataTransfer)?[2,MU(e.dataTransfer,e.type)]:IU(e)?[2,PU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,EU(e)]:[2,[]]})})}function _U(e){return sm(e)}function IU(e){return sm(e)&&sm(e.target)}function sm(e){return typeof e=="object"&&e!==null}function PU(e){return Rb(e.target.files).map(function(t){return qf(t)})}function EU(e){return Lu(this,void 0,void 0,function(){var t;return zu(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return qf(r)})]}})})}function MU(e,t){return Lu(this,void 0,void 0,function(){var n,r;return zu(this,function(o){switch(o.label){case 0:return e.items?(n=Rb(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(OU))]):[3,2];case 1:return r=o.sent(),[2,yk(X3(r))];case 2:return[2,yk(Rb(e.files).map(function(s){return qf(s)}))]}})})}function yk(e){return e.filter(function(t){return kU.indexOf(t.name)===-1})}function Rb(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,jk(n)];if(e.sizen)return[!1,jk(n)]}return[!0,null]}function Ml(e){return e!=null}function qU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,c=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(d){var p=e6(d,n),h=lf(p,1),m=h[0],g=t6(d,r,o),b=lf(g,1),y=b[0],x=c?c(d):null;return m&&y&&!x})}function am(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function nh(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function Ik(e){e.preventDefault()}function KU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function QU(e){return e.indexOf("Edge/")!==-1}function XU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return KU(e)||QU(e)}function ya(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pG(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var By=l.forwardRef(function(e,t){var n=e.children,r=im(e,nG),o=Hy(r),s=o.open,i=im(o,rG);return l.useImperativeHandle(t,function(){return{open:s}},[s]),z.createElement(l.Fragment,null,n(kr(kr({},i),{},{open:s})))});By.displayName="Dropzone";var s6={disabled:!1,getFilesFromEvent:jU,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};By.defaultProps=s6;By.propTypes={children:nr.func,accept:nr.objectOf(nr.arrayOf(nr.string)),multiple:nr.bool,preventDropOnDocument:nr.bool,noClick:nr.bool,noKeyboard:nr.bool,noDrag:nr.bool,noDragEventsBubbling:nr.bool,minSize:nr.number,maxSize:nr.number,maxFiles:nr.number,disabled:nr.bool,getFilesFromEvent:nr.func,onFileDialogCancel:nr.func,onFileDialogOpen:nr.func,useFsAccessApi:nr.bool,autoFocus:nr.bool,onDragEnter:nr.func,onDragLeave:nr.func,onDragOver:nr.func,onDrop:nr.func,onDropAccepted:nr.func,onDropRejected:nr.func,onError:nr.func,validator:nr.func};var $b={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Hy(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=kr(kr({},s6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,c=t.multiple,d=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,m=t.onDragOver,g=t.onDrop,b=t.onDropAccepted,y=t.onDropRejected,x=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,I=t.preventDropOnDocument,_=t.noClick,M=t.noKeyboard,E=t.noDrag,A=t.noDragEventsBubbling,R=t.onError,D=t.validator,O=l.useMemo(function(){return ZU(n)},[n]),T=l.useMemo(function(){return JU(n)},[n]),K=l.useMemo(function(){return typeof w=="function"?w:Ek},[w]),G=l.useMemo(function(){return typeof x=="function"?x:Ek},[x]),X=l.useRef(null),Z=l.useRef(null),te=l.useReducer(hG,$b),V=f1(te,2),oe=V[0],ne=V[1],se=oe.isFocused,re=oe.isFileDialogActive,ae=l.useRef(typeof window<"u"&&window.isSecureContext&&S&&YU()),B=function(){!ae.current&&re&&setTimeout(function(){if(Z.current){var Fe=Z.current.files;Fe.length||(ne({type:"closeDialog"}),G())}},300)};l.useEffect(function(){return window.addEventListener("focus",B,!1),function(){window.removeEventListener("focus",B,!1)}},[Z,re,G,ae]);var Y=l.useRef([]),$=function(Fe){X.current&&X.current.contains(Fe.target)||(Fe.preventDefault(),Y.current=[])};l.useEffect(function(){return I&&(document.addEventListener("dragover",Ik,!1),document.addEventListener("drop",$,!1)),function(){I&&(document.removeEventListener("dragover",Ik),document.removeEventListener("drop",$))}},[X,I]),l.useEffect(function(){return!r&&j&&X.current&&X.current.focus(),function(){}},[X,j,r]);var F=l.useCallback(function(Se){R?R(Se):console.error(Se)},[R]),q=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se),Y.current=[].concat(aG(Y.current),[Se.target]),nh(Se)&&Promise.resolve(o(Se)).then(function(Fe){if(!(am(Se)&&!A)){var it=Fe.length,At=it>0&&qU({files:Fe,accept:O,minSize:i,maxSize:s,multiple:c,maxFiles:d,validator:D}),ke=it>0&&!At;ne({isDragAccept:At,isDragReject:ke,isDragActive:!0,type:"setDraggedFiles"}),p&&p(Se)}}).catch(function(Fe){return F(Fe)})},[o,p,F,A,O,i,s,c,d,D]),pe=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se);var Fe=nh(Se);if(Fe&&Se.dataTransfer)try{Se.dataTransfer.dropEffect="copy"}catch{}return Fe&&m&&m(Se),!1},[m,A]),W=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se);var Fe=Y.current.filter(function(At){return X.current&&X.current.contains(At)}),it=Fe.indexOf(Se.target);it!==-1&&Fe.splice(it,1),Y.current=Fe,!(Fe.length>0)&&(ne({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),nh(Se)&&h&&h(Se))},[X,h,A]),U=l.useCallback(function(Se,Fe){var it=[],At=[];Se.forEach(function(ke){var lt=e6(ke,O),Rt=f1(lt,2),zt=Rt[0],Re=Rt[1],Qe=t6(ke,i,s),En=f1(Qe,2),Te=En[0],ct=En[1],ft=D?D(ke):null;if(zt&&Te&&!ft)it.push(ke);else{var tt=[Re,ct];ft&&(tt=tt.concat(ft)),At.push({file:ke,errors:tt.filter(function(en){return en})})}}),(!c&&it.length>1||c&&d>=1&&it.length>d)&&(it.forEach(function(ke){At.push({file:ke,errors:[GU]})}),it.splice(0)),ne({acceptedFiles:it,fileRejections:At,type:"setFiles"}),g&&g(it,At,Fe),At.length>0&&y&&y(At,Fe),it.length>0&&b&&b(it,Fe)},[ne,c,O,i,s,d,g,b,y,D]),ee=l.useCallback(function(Se){Se.preventDefault(),Se.persist(),Je(Se),Y.current=[],nh(Se)&&Promise.resolve(o(Se)).then(function(Fe){am(Se)&&!A||U(Fe,Se)}).catch(function(Fe){return F(Fe)}),ne({type:"reset"})},[o,U,F,A]),J=l.useCallback(function(){if(ae.current){ne({type:"openDialog"}),K();var Se={multiple:c,types:T};window.showOpenFilePicker(Se).then(function(Fe){return o(Fe)}).then(function(Fe){U(Fe,null),ne({type:"closeDialog"})}).catch(function(Fe){eG(Fe)?(G(Fe),ne({type:"closeDialog"})):tG(Fe)?(ae.current=!1,Z.current?(Z.current.value=null,Z.current.click()):F(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):F(Fe)});return}Z.current&&(ne({type:"openDialog"}),K(),Z.current.value=null,Z.current.click())},[ne,K,G,S,U,F,T,c]),ge=l.useCallback(function(Se){!X.current||!X.current.isEqualNode(Se.target)||(Se.key===" "||Se.key==="Enter"||Se.keyCode===32||Se.keyCode===13)&&(Se.preventDefault(),J())},[X,J]),he=l.useCallback(function(){ne({type:"focus"})},[]),de=l.useCallback(function(){ne({type:"blur"})},[]),_e=l.useCallback(function(){_||(XU()?setTimeout(J,0):J())},[_,J]),Pe=function(Fe){return r?null:Fe},ze=function(Fe){return M?null:Pe(Fe)},ht=function(Fe){return E?null:Pe(Fe)},Je=function(Fe){A&&Fe.stopPropagation()},qt=l.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Fe=Se.refKey,it=Fe===void 0?"ref":Fe,At=Se.role,ke=Se.onKeyDown,lt=Se.onFocus,Rt=Se.onBlur,zt=Se.onClick,Re=Se.onDragEnter,Qe=Se.onDragOver,En=Se.onDragLeave,Te=Se.onDrop,ct=im(Se,oG);return kr(kr(Nb({onKeyDown:ze(ya(ke,ge)),onFocus:ze(ya(lt,he)),onBlur:ze(ya(Rt,de)),onClick:Pe(ya(zt,_e)),onDragEnter:ht(ya(Re,q)),onDragOver:ht(ya(Qe,pe)),onDragLeave:ht(ya(En,W)),onDrop:ht(ya(Te,ee)),role:typeof At=="string"&&At!==""?At:"presentation"},it,X),!r&&!M?{tabIndex:0}:{}),ct)}},[X,ge,he,de,_e,q,pe,W,ee,M,E,r]),Pt=l.useCallback(function(Se){Se.stopPropagation()},[]),jt=l.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Fe=Se.refKey,it=Fe===void 0?"ref":Fe,At=Se.onChange,ke=Se.onClick,lt=im(Se,sG),Rt=Nb({accept:O,multiple:c,type:"file",style:{display:"none"},onChange:Pe(ya(At,ee)),onClick:Pe(ya(ke,Pt)),tabIndex:-1},it,Z);return kr(kr({},Rt),lt)}},[Z,n,c,ee,r]);return kr(kr({},oe),{},{isFocused:se&&!r,getRootProps:qt,getInputProps:jt,rootRef:X,inputRef:Z,open:Pe(J)})}function hG(e,t){switch(t.type){case"focus":return kr(kr({},e),{},{isFocused:!0});case"blur":return kr(kr({},e),{},{isFocused:!1});case"openDialog":return kr(kr({},$b),{},{isFileDialogActive:!0});case"closeDialog":return kr(kr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return kr(kr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return kr(kr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return kr({},$b);default:return e}}function Ek(){}function Lb(){return Lb=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 CG=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,c=n.shift,d=n.ctrl,p=n.keys,h=t.key,m=t.code,g=t.ctrlKey,b=t.metaKey,y=t.shiftKey,x=t.altKey,w=qi(m),S=h.toLowerCase();if(!r){if(o===!x&&S!=="alt"||c===!y&&S!=="shift")return!1;if(i){if(!b&&!g)return!1}else if(s===!b&&S!=="meta"&&S!=="os"||d===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(w))?!0:p?Th(p):!p},wG=l.createContext(void 0),SG=function(){return l.useContext(wG)};function u6(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&&u6(e[r],t[r])},!0):e===t}var kG=l.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),jG=function(){return l.useContext(kG)};function _G(e){var t=l.useRef(void 0);return u6(t.current,e)||(t.current=e),t.current}var Mk=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},IG=typeof window<"u"?l.useLayoutEffect:l.useEffect;function _t(e,t,n,r){var o=l.useRef(null),s=l.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,c=Wy(e)?e.join(i==null?void 0:i.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,p=l.useCallback(t,d??[]),h=l.useRef(p);d?h.current=p:h.current=t;var m=_G(i),g=jG(),b=g.enabledScopes,y=SG();return IG(function(){if(!((m==null?void 0:m.enabled)===!1||!yG(b,m==null?void 0:m.scopes))){var x=function(_,M){var E;if(M===void 0&&(M=!1),!(xG(_)&&!c6(_,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(_))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){Mk(_);return}(E=_.target)!=null&&E.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||p1(c,m==null?void 0:m.splitKey).forEach(function(A){var R,D=h1(A,m==null?void 0:m.combinationKey);if(CG(_,D,m==null?void 0:m.ignoreModifiers)||(R=D.keys)!=null&&R.includes("*")){if(M&&s.current)return;if(vG(_,D,m==null?void 0:m.preventDefault),!bG(_,D,m==null?void 0:m.enabled)){Mk(_);return}h.current(_,D),M||(s.current=!0)}})}},w=function(_){_.key!==void 0&&(i6(qi(_.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&x(_))},S=function(_){_.key!==void 0&&(l6(qi(_.code)),s.current=!1,m!=null&&m.keyup&&x(_,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&p1(c,m==null?void 0:m.splitKey).forEach(function(I){return y.addHotkey(h1(I,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&p1(c,m==null?void 0:m.splitKey).forEach(function(I){return y.removeHotkey(h1(I,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[c,m,b]),o}const PG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return _t("esc",()=>{r(!1)}),a.jsxs(Le,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(N,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(yo,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(yo,{size:"lg",children:"Invalid Upload"}),a.jsx(yo,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},EG=l.memo(PG),MG=me([we,lo],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},Ie),OG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=H(MG),o=Zl(),{t:s}=Q(),[i,c]=l.useState(!1),[d]=EI(),p=l.useCallback(_=>{c(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(M=>M.message).join(` +`),status:"error"})},[s,o]),h=l.useCallback(async _=>{d({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,d]),m=l.useCallback((_,M)=>{if(M.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}M.forEach(E=>{p(E)}),_.forEach(E=>{h(E)})},[s,o,h,p]),g=l.useCallback(()=>{c(!0)},[]),{getRootProps:b,getInputProps:y,isDragAccept:x,isDragReject:w,isDragActive:S,inputRef:j}=Hy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:m,onDragOver:g,multiple:!1});l.useEffect(()=>{const _=async M=>{var E,A;j.current&&(E=M.clipboardData)!=null&&E.files&&(j.current.files=M.clipboardData.files,(A=j.current)==null||A.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]);const I=l.useCallback(_=>{_.key},[]);return a.jsxs(Le,{...b({style:{}}),onKeyDown:I,children:[a.jsx("input",{...y()}),t,a.jsx(So,{children:S&&i&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(EG,{isDragAccept:x,isDragReject:w,setIsHandlingUpload:c})},"image-upload-overlay")})]})},AG=l.memo(OG),RG=De((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:c,...d}=e;return a.jsx(Wn,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(nl,{ref:t,colorScheme:c?"accent":"base",...d,children:n})})}),Dt=l.memo(RG);function DG(e){const t=l.createContext(null);return[({children:o,value:s})=>z.createElement(t.Provider,{value:s},o),()=>{const o=l.useContext(t);if(o===null)throw new Error(e);return o}]}function d6(e){return Array.isArray(e)?e:[e]}const TG=()=>{};function NG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||TG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function f6({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function p6(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==z.Fragment:!1}function h6(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const zG=yD({key:"mantine",prepend:!0});function FG(){return OP()||zG}var BG=Object.defineProperty,Ok=Object.getOwnPropertySymbols,HG=Object.prototype.hasOwnProperty,WG=Object.prototype.propertyIsEnumerable,Ak=(e,t,n)=>t in e?BG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VG=(e,t)=>{for(var n in t||(t={}))HG.call(t,n)&&Ak(e,n,t[n]);if(Ok)for(var n of Ok(t))WG.call(t,n)&&Ak(e,n,t[n]);return e};const m1="ref";function UG(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(m1 in n))return{args:e,ref:t};t=n[m1];const r=VG({},n);return delete r[m1],{args:[r],ref:t}}const{cssFactory:GG}=(()=>{function e(n,r,o){const s=[],i=SD(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:c,args:d}=UG(i),p=CD(d,r.registered);return wD(r,p,!1),`${r.key}-${p.name}${c===void 0?"":` ${c}`}`};return{css:o,cx:(...i)=>e(r.registered,o,m6(i))}}return{cssFactory:t}})();function g6(){const e=FG();return LG(()=>GG({cache:e}),[e])}function qG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((c,d)=>(Object.keys(d.classNames).forEach(p=>{typeof c[p]!="string"?c[p]=`${d.classNames[p]}`:c[p]=`${c[p]} ${d.classNames[p]}`}),c),{});return Object.keys(t).reduce((c,d)=>(c[d]=e(t[d],i[d],r!=null&&r[d],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${d}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${d}`:null),c),{})}var KG=Object.defineProperty,Rk=Object.getOwnPropertySymbols,QG=Object.prototype.hasOwnProperty,XG=Object.prototype.propertyIsEnumerable,Dk=(e,t,n)=>t in e?KG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g1=(e,t)=>{for(var n in t||(t={}))QG.call(t,n)&&Dk(e,n,t[n]);if(Rk)for(var n of Rk(t))XG.call(t,n)&&Dk(e,n,t[n]);return e};function zb(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=g1(g1({},e[n]),t[n]):e[n]=g1({},t[n])}),e}function Tk(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>zb(s,i),{}):o(e)}function YG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&zb(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&zb(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function ko(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=Ii(),i=g$(o==null?void 0:o.name),c=OP(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:h}=g6(),m=t(s,r,d),g=Tk(o==null?void 0:o.styles,s,r,d),b=Tk(i,s,r,d),y=YG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),x=Object.fromEntries(Object.keys(m).map(w=>{const S=h({[p(m[w])]:!(o!=null&&o.unstyled)},p(y[w]),p(b[w]),p(g[w]));return[w,S]}));return{classes:qG({cx:h,classes:x,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:c}),cx:h,theme:s}}return n}function Nk(e){return`___ref-${e||""}`}var JG=Object.defineProperty,ZG=Object.defineProperties,eq=Object.getOwnPropertyDescriptors,$k=Object.getOwnPropertySymbols,tq=Object.prototype.hasOwnProperty,nq=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?JG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xd=(e,t)=>{for(var n in t||(t={}))tq.call(t,n)&&Lk(e,n,t[n]);if($k)for(var n of $k(t))nq.call(t,n)&&Lk(e,n,t[n]);return e},yd=(e,t)=>ZG(e,eq(t));const Cd={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${qe(10)})`},transitionProperty:"transform, opacity"},rh={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${qe(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${qe(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${qe(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${qe(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:yd(xd({},Cd),{common:{transformOrigin:"center center"}}),"pop-bottom-left":yd(xd({},Cd),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":yd(xd({},Cd),{common:{transformOrigin:"bottom right"}}),"pop-top-left":yd(xd({},Cd),{common:{transformOrigin:"top left"}}),"pop-top-right":yd(xd({},Cd),{common:{transformOrigin:"top right"}})},zk=["mousedown","touchstart"];function rq(e,t,n){const r=l.useRef();return l.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const c=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!c&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||zk).forEach(s=>document.addEventListener(s,o)),()=>{(t||zk).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function oq(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function sq(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function aq(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=l.useState(n?t:sq(e,t)),s=l.useRef();return l.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),oq(s.current,i=>o(i.matches))},[e]),r}const v6=typeof document<"u"?l.useLayoutEffect:l.useEffect;function oa(e,t){const n=l.useRef(!1);l.useEffect(()=>()=>{n.current=!1},[]),l.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function iq({opened:e,shouldReturnFocus:t=!0}){const n=l.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return oa(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const lq=/input|select|textarea|button|object/,b6="a, input, select, textarea, button, object, [tabindex]";function cq(e){return e.style.display==="none"}function uq(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(cq(n))return!1;n=n.parentNode}return!0}function x6(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Fb(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(x6(e));return(lq.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&uq(e)}function y6(e){const t=x6(e);return(Number.isNaN(t)||t>=0)&&Fb(e)}function dq(e){return Array.from(e.querySelectorAll(b6)).filter(y6)}function fq(e,t){const n=dq(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Uy(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function pq(e,t="body > :not(script)"){const n=Uy(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),c=o.getAttribute("data-hidden"),d=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!c&&!d&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:c||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function hq(e=!0){const t=l.useRef(),n=l.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const c=Array.from(s.querySelectorAll(b6));i=c.find(y6)||c.find(Fb)||null,!i&&Fb(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=l.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=pq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return l.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&fq(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const mq=z["useId".toString()]||(()=>{});function gq(){const e=mq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Gy(e){const t=gq(),[n,r]=l.useState(t);return v6(()=>{r(Uy())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function Fk(e,t,n){l.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function C6(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function vq(...e){return t=>{e.forEach(n=>C6(n,t))}}function Kf(...e){return l.useCallback(vq(...e),e)}function cf({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=l.useState(t!==void 0?t:n),i=c=>{s(c),r==null||r(c)};return e!==void 0?[e,r,!0]:[o,i,!1]}function w6(e,t){return aq("(prefers-reduced-motion: reduce)",e,t)}const bq=e=>e<.5?2*e*e:-1+(4-2*e)*e,xq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,d=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),h=m=>p[m]-d[m];if(e==="y"){const m=h("top");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.height*(s?0:1)||!s?b:0}const g=i?d.height:window.innerHeight;if(r==="end"){const b=m+o-g+p.height;return b>=-p.height*(s?0:1)||!s?b:0}return r==="center"?m-g/2+p.height/2:0}if(e==="x"){const m=h("left");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.width||!s?b:0}const g=i?d.width:window.innerWidth;if(r==="end"){const b=m+o-g+p.width;return b>=-p.width||!s?b:0}return r==="center"?m-g/2+p.width/2:0}return 0},yq=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},Cq=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function S6({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=bq,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const c=l.useRef(0),d=l.useRef(0),p=l.useRef(!1),h=l.useRef(null),m=l.useRef(null),g=w6(),b=()=>{c.current&&cancelAnimationFrame(c.current)},y=l.useCallback(({alignment:w="start"}={})=>{var S;p.current=!1,c.current&&b();const j=(S=yq({parent:h.current,axis:t}))!=null?S:0,I=xq({parent:h.current,target:m.current,axis:t,alignment:w,offset:o,isList:i})-(h.current?0:j);function _(){d.current===0&&(d.current=performance.now());const E=performance.now()-d.current,A=g||e===0?1:E/e,R=j+I*r(A);Cq({parent:h.current,axis:t,distance:R}),!p.current&&A<1?c.current=requestAnimationFrame(_):(typeof n=="function"&&n(),d.current=0,c.current=0,b())}_()},[t,e,r,i,o,n,g]),x=()=>{s&&(p.current=!0)};return Fk("wheel",x,{passive:!0}),Fk("touchmove",x,{passive:!0}),l.useEffect(()=>b,[]),{scrollableRef:h,targetRef:m,scrollIntoView:y,cancel:b}}var Bk=Object.getOwnPropertySymbols,wq=Object.prototype.hasOwnProperty,Sq=Object.prototype.propertyIsEnumerable,kq=(e,t)=>{var n={};for(var r in e)wq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bk)for(var r of Bk(e))t.indexOf(r)<0&&Sq.call(e,r)&&(n[r]=e[r]);return n};function Yg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:w,c:S,opacity:j,ff:I,fz:_,fw:M,lts:E,ta:A,lh:R,fs:D,tt:O,td:T,w:K,miw:G,maw:X,h:Z,mih:te,mah:V,bgsz:oe,bgp:ne,bgr:se,bga:re,pos:ae,top:B,left:Y,bottom:$,right:F,inset:q,display:pe}=t,W=kq(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:v$({m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:w,c:S,opacity:j,ff:I,fz:_,fw:M,lts:E,ta:A,lh:R,fs:D,tt:O,td:T,w:K,miw:G,maw:X,h:Z,mih:te,mah:V,bgsz:oe,bgp:ne,bgr:se,bga:re,pos:ae,top:B,left:Y,bottom:$,right:F,inset:q,display:pe}),rest:W}}function jq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>MS(Xt({size:r,sizes:t.breakpoints}))-MS(Xt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function _q({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return jq(e,t).reduce((i,c)=>{if(c==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(h=>{i[h]=p}),i):(i[r]=p,i)}const d=n(e[c],t);return Array.isArray(r)?(i[t.fn.largerThan(c)]={},r.forEach(p=>{i[t.fn.largerThan(c)][p]=d}),i):(i[t.fn.largerThan(c)]={[r]:d},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function Iq(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function Pq(e){return qe(e)}function Eq(e){return e}function Mq(e,t){return Xt({size:e,sizes:t.fontSizes})}const Oq=["-xs","-sm","-md","-lg","-xl"];function Aq(e,t){return Oq.includes(e)?`calc(${Xt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Xt({size:e,sizes:t.spacing})}const Rq={identity:Eq,color:Iq,size:Pq,fontSize:Mq,spacing:Aq},Dq={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var Tq=Object.defineProperty,Hk=Object.getOwnPropertySymbols,Nq=Object.prototype.hasOwnProperty,$q=Object.prototype.propertyIsEnumerable,Wk=(e,t,n)=>t in e?Tq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vk=(e,t)=>{for(var n in t||(t={}))Nq.call(t,n)&&Wk(e,n,t[n]);if(Hk)for(var n of Hk(t))$q.call(t,n)&&Wk(e,n,t[n]);return e};function Uk(e,t,n=Dq){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(_q({value:e[s],getValue:Rq[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=Vk(Vk({},o[i]),s[i]):o[i]=s[i]}),o),{})}function Gk(e,t){return typeof e=="function"?e(t):e}function Lq(e,t,n){const r=Ii(),{css:o,cx:s}=g6();return Array.isArray(e)?s(n,o(Uk(t,r)),e.map(i=>o(Gk(i,r)))):s(n,o(Gk(e,r)),o(Uk(t,r)))}var zq=Object.defineProperty,lm=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&qk(e,n,t[n]);if(lm)for(var n of lm(t))j6.call(t,n)&&qk(e,n,t[n]);return e},Bq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lm)for(var r of lm(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const _6=l.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,c=Bq(n,["className","component","style","sx"]);const{systemStyles:d,rest:p}=Yg(c),h=o||"div";return z.createElement(h,Fq({ref:t,className:Lq(i,d,r),style:s},p))});_6.displayName="@mantine/core/Box";const Xo=_6;var Hq=Object.defineProperty,Wq=Object.defineProperties,Vq=Object.getOwnPropertyDescriptors,Kk=Object.getOwnPropertySymbols,Uq=Object.prototype.hasOwnProperty,Gq=Object.prototype.propertyIsEnumerable,Qk=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xk=(e,t)=>{for(var n in t||(t={}))Uq.call(t,n)&&Qk(e,n,t[n]);if(Kk)for(var n of Kk(t))Gq.call(t,n)&&Qk(e,n,t[n]);return e},qq=(e,t)=>Wq(e,Vq(t)),Kq=ko(e=>({root:qq(Xk(Xk({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const Qq=Kq;var Xq=Object.defineProperty,cm=Object.getOwnPropertySymbols,I6=Object.prototype.hasOwnProperty,P6=Object.prototype.propertyIsEnumerable,Yk=(e,t,n)=>t in e?Xq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yq=(e,t)=>{for(var n in t||(t={}))I6.call(t,n)&&Yk(e,n,t[n]);if(cm)for(var n of cm(t))P6.call(t,n)&&Yk(e,n,t[n]);return e},Jq=(e,t)=>{var n={};for(var r in e)I6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&cm)for(var r of cm(e))t.indexOf(r)<0&&P6.call(e,r)&&(n[r]=e[r]);return n};const E6=l.forwardRef((e,t)=>{const n=zr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,c=Jq(n,["className","component","unstyled","variant"]),{classes:d,cx:p}=Qq(null,{name:"UnstyledButton",unstyled:s,variant:i});return z.createElement(Xo,Yq({component:o,ref:t,className:p(d.root,r),type:o==="button"?"button":void 0},c))});E6.displayName="@mantine/core/UnstyledButton";const Zq=E6;var eK=Object.defineProperty,tK=Object.defineProperties,nK=Object.getOwnPropertyDescriptors,Jk=Object.getOwnPropertySymbols,rK=Object.prototype.hasOwnProperty,oK=Object.prototype.propertyIsEnumerable,Zk=(e,t,n)=>t in e?eK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bb=(e,t)=>{for(var n in t||(t={}))rK.call(t,n)&&Zk(e,n,t[n]);if(Jk)for(var n of Jk(t))oK.call(t,n)&&Zk(e,n,t[n]);return e},e4=(e,t)=>tK(e,nK(t));const sK=["subtle","filled","outline","light","default","transparent","gradient"],oh={xs:qe(18),sm:qe(22),md:qe(28),lg:qe(34),xl:qe(44)};function aK({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:sK.includes(e)?Bb({border:`${qe(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var iK=ko((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:e4(Bb({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Xt({size:s,sizes:oh}),minHeight:Xt({size:s,sizes:oh}),width:Xt({size:s,sizes:oh}),minWidth:Xt({size:s,sizes:oh})},aK({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":e4(Bb({content:'""'},e.fn.cover(qe(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const lK=iK;var cK=Object.defineProperty,um=Object.getOwnPropertySymbols,M6=Object.prototype.hasOwnProperty,O6=Object.prototype.propertyIsEnumerable,t4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,n4=(e,t)=>{for(var n in t||(t={}))M6.call(t,n)&&t4(e,n,t[n]);if(um)for(var n of um(t))O6.call(t,n)&&t4(e,n,t[n]);return e},r4=(e,t)=>{var n={};for(var r in e)M6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&um)for(var r of um(e))t.indexOf(r)<0&&O6.call(e,r)&&(n[r]=e[r]);return n};function uK(e){var t=e,{size:n,color:r}=t,o=r4(t,["size","color"]);const s=o,{style:i}=s,c=r4(s,["style"]);return z.createElement("svg",n4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:n4({width:n},i)},c),z.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},z.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},z.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},z.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},z.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},z.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var dK=Object.defineProperty,dm=Object.getOwnPropertySymbols,A6=Object.prototype.hasOwnProperty,R6=Object.prototype.propertyIsEnumerable,o4=(e,t,n)=>t in e?dK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s4=(e,t)=>{for(var n in t||(t={}))A6.call(t,n)&&o4(e,n,t[n]);if(dm)for(var n of dm(t))R6.call(t,n)&&o4(e,n,t[n]);return e},a4=(e,t)=>{var n={};for(var r in e)A6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dm)for(var r of dm(e))t.indexOf(r)<0&&R6.call(e,r)&&(n[r]=e[r]);return n};function fK(e){var t=e,{size:n,color:r}=t,o=a4(t,["size","color"]);const s=o,{style:i}=s,c=a4(s,["style"]);return z.createElement("svg",s4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:s4({width:n,height:n},i)},c),z.createElement("g",{fill:"none",fillRule:"evenodd"},z.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},z.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),z.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},z.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var pK=Object.defineProperty,fm=Object.getOwnPropertySymbols,D6=Object.prototype.hasOwnProperty,T6=Object.prototype.propertyIsEnumerable,i4=(e,t,n)=>t in e?pK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l4=(e,t)=>{for(var n in t||(t={}))D6.call(t,n)&&i4(e,n,t[n]);if(fm)for(var n of fm(t))T6.call(t,n)&&i4(e,n,t[n]);return e},c4=(e,t)=>{var n={};for(var r in e)D6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fm)for(var r of fm(e))t.indexOf(r)<0&&T6.call(e,r)&&(n[r]=e[r]);return n};function hK(e){var t=e,{size:n,color:r}=t,o=c4(t,["size","color"]);const s=o,{style:i}=s,c=c4(s,["style"]);return z.createElement("svg",l4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:l4({width:n},i)},c),z.createElement("circle",{cx:"15",cy:"15",r:"15"},z.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},z.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),z.createElement("circle",{cx:"105",cy:"15",r:"15"},z.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),z.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var mK=Object.defineProperty,pm=Object.getOwnPropertySymbols,N6=Object.prototype.hasOwnProperty,$6=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?mK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gK=(e,t)=>{for(var n in t||(t={}))N6.call(t,n)&&u4(e,n,t[n]);if(pm)for(var n of pm(t))$6.call(t,n)&&u4(e,n,t[n]);return e},vK=(e,t)=>{var n={};for(var r in e)N6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&$6.call(e,r)&&(n[r]=e[r]);return n};const v1={bars:uK,oval:fK,dots:hK},bK={xs:qe(18),sm:qe(22),md:qe(36),lg:qe(44),xl:qe(58)},xK={size:"md"};function L6(e){const t=zr("Loader",xK,e),{size:n,color:r,variant:o}=t,s=vK(t,["size","color","variant"]),i=Ii(),c=o in v1?o:i.loader;return z.createElement(Xo,gK({role:"presentation",component:v1[c]||v1.bars,size:Xt({size:n,sizes:bK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}L6.displayName="@mantine/core/Loader";var yK=Object.defineProperty,hm=Object.getOwnPropertySymbols,z6=Object.prototype.hasOwnProperty,F6=Object.prototype.propertyIsEnumerable,d4=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f4=(e,t)=>{for(var n in t||(t={}))z6.call(t,n)&&d4(e,n,t[n]);if(hm)for(var n of hm(t))F6.call(t,n)&&d4(e,n,t[n]);return e},CK=(e,t)=>{var n={};for(var r in e)z6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&F6.call(e,r)&&(n[r]=e[r]);return n};const wK={color:"gray",size:"md",variant:"subtle"},B6=l.forwardRef((e,t)=>{const n=zr("ActionIcon",wK,e),{className:r,color:o,children:s,radius:i,size:c,variant:d,gradient:p,disabled:h,loaderProps:m,loading:g,unstyled:b,__staticSelector:y}=n,x=CK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=lK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:b,size:c,variant:d}),I=z.createElement(L6,f4({color:j.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},m));return z.createElement(Zq,f4({className:S(w.root,r),ref:t,disabled:h,"data-disabled":h||void 0,"data-loading":g||void 0,unstyled:b},x),g?I:s)});B6.displayName="@mantine/core/ActionIcon";const SK=B6;var kK=Object.defineProperty,jK=Object.defineProperties,_K=Object.getOwnPropertyDescriptors,mm=Object.getOwnPropertySymbols,H6=Object.prototype.hasOwnProperty,W6=Object.prototype.propertyIsEnumerable,p4=(e,t,n)=>t in e?kK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IK=(e,t)=>{for(var n in t||(t={}))H6.call(t,n)&&p4(e,n,t[n]);if(mm)for(var n of mm(t))W6.call(t,n)&&p4(e,n,t[n]);return e},PK=(e,t)=>jK(e,_K(t)),EK=(e,t)=>{var n={};for(var r in e)H6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&W6.call(e,r)&&(n[r]=e[r]);return n};function V6(e){const t=zr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=EK(t,["children","target","className","innerRef"]),c=Ii(),[d,p]=l.useState(!1),h=l.useRef();return v6(()=>(p(!0),h.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(h.current),()=>{!r&&document.body.removeChild(h.current)}),[r]),d?ls.createPortal(z.createElement("div",PK(IK({className:o,dir:c.dir},i),{ref:s}),n),h.current):null}V6.displayName="@mantine/core/Portal";var MK=Object.defineProperty,gm=Object.getOwnPropertySymbols,U6=Object.prototype.hasOwnProperty,G6=Object.prototype.propertyIsEnumerable,h4=(e,t,n)=>t in e?MK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,OK=(e,t)=>{for(var n in t||(t={}))U6.call(t,n)&&h4(e,n,t[n]);if(gm)for(var n of gm(t))G6.call(t,n)&&h4(e,n,t[n]);return e},AK=(e,t)=>{var n={};for(var r in e)U6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&G6.call(e,r)&&(n[r]=e[r]);return n};function q6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=AK(t,["withinPortal","children"]);return n?z.createElement(V6,OK({},o),r):z.createElement(z.Fragment,null,r)}q6.displayName="@mantine/core/OptionalPortal";var RK=Object.defineProperty,vm=Object.getOwnPropertySymbols,K6=Object.prototype.hasOwnProperty,Q6=Object.prototype.propertyIsEnumerable,m4=(e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g4=(e,t)=>{for(var n in t||(t={}))K6.call(t,n)&&m4(e,n,t[n]);if(vm)for(var n of vm(t))Q6.call(t,n)&&m4(e,n,t[n]);return e},DK=(e,t)=>{var n={};for(var r in e)K6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&Q6.call(e,r)&&(n[r]=e[r]);return n};function X6(e){const t=e,{width:n,height:r,style:o}=t,s=DK(t,["width","height","style"]);return z.createElement("svg",g4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:g4({width:n,height:r},o)},s),z.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}X6.displayName="@mantine/core/CloseIcon";var TK=Object.defineProperty,bm=Object.getOwnPropertySymbols,Y6=Object.prototype.hasOwnProperty,J6=Object.prototype.propertyIsEnumerable,v4=(e,t,n)=>t in e?TK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NK=(e,t)=>{for(var n in t||(t={}))Y6.call(t,n)&&v4(e,n,t[n]);if(bm)for(var n of bm(t))J6.call(t,n)&&v4(e,n,t[n]);return e},$K=(e,t)=>{var n={};for(var r in e)Y6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bm)for(var r of bm(e))t.indexOf(r)<0&&J6.call(e,r)&&(n[r]=e[r]);return n};const LK={xs:qe(12),sm:qe(16),md:qe(20),lg:qe(28),xl:qe(34)},zK={size:"sm"},Z6=l.forwardRef((e,t)=>{const n=zr("CloseButton",zK,e),{iconSize:r,size:o,children:s}=n,i=$K(n,["iconSize","size","children"]),c=qe(r||LK[o]);return z.createElement(SK,NK({ref:t,__staticSelector:"CloseButton",size:o},i),s||z.createElement(X6,{width:c,height:c}))});Z6.displayName="@mantine/core/CloseButton";const eE=Z6;var FK=Object.defineProperty,BK=Object.defineProperties,HK=Object.getOwnPropertyDescriptors,b4=Object.getOwnPropertySymbols,WK=Object.prototype.hasOwnProperty,VK=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?FK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sh=(e,t)=>{for(var n in t||(t={}))WK.call(t,n)&&x4(e,n,t[n]);if(b4)for(var n of b4(t))VK.call(t,n)&&x4(e,n,t[n]);return e},UK=(e,t)=>BK(e,HK(t));function GK({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function qK({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function KK(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function QK({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var XK=ko((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:c,weight:d,transform:p,align:h,strikethrough:m,italic:g},{size:b})=>{const y=e.fn.variant({variant:"gradient",gradient:c});return{root:UK(sh(sh(sh(sh({},e.fn.fontStyles()),e.fn.focusStyles()),KK(n)),QK({theme:e,truncate:r})),{color:qK({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":Xt({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:GK({underline:i,strikethrough:m}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:p,textAlign:h,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const YK=XK;var JK=Object.defineProperty,xm=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,y4=(e,t,n)=>t in e?JK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZK=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&y4(e,n,t[n]);if(xm)for(var n of xm(t))nE.call(t,n)&&y4(e,n,t[n]);return e},eQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const tQ={variant:"text"},rE=l.forwardRef((e,t)=>{const n=zr("Text",tQ,e),{className:r,size:o,weight:s,transform:i,color:c,align:d,variant:p,lineClamp:h,truncate:m,gradient:g,inline:b,inherit:y,underline:x,strikethrough:w,italic:S,classNames:j,styles:I,unstyled:_,span:M,__staticSelector:E}=n,A=eQ(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:R,cx:D}=YK({color:c,lineClamp:h,truncate:m,inline:b,inherit:y,underline:x,strikethrough:w,italic:S,weight:s,transform:i,align:d,gradient:g},{unstyled:_,name:E||"Text",variant:p,size:o});return z.createElement(Xo,ZK({ref:t,className:D(R.root,{[R.gradient]:p==="gradient"},r),component:M?"span":"div"},A))});rE.displayName="@mantine/core/Text";const xu=rE,ah={xs:qe(1),sm:qe(2),md:qe(3),lg:qe(4),xl:qe(5)};function ih(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var nQ=ko((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:qe(1),borderTop:`${Xt({size:n,sizes:ah})} ${r} ${ih(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Xt({size:n,sizes:ah})} ${r} ${ih(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:qe(Xt({size:n,sizes:ah})),borderTopColor:ih(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:qe(Xt({size:n,sizes:ah})),borderLeftColor:ih(e,t),borderLeftStyle:r}}));const rQ=nQ;var oQ=Object.defineProperty,sQ=Object.defineProperties,aQ=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?oQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t)=>{for(var n in t||(t={}))oE.call(t,n)&&C4(e,n,t[n]);if(ym)for(var n of ym(t))sE.call(t,n)&&C4(e,n,t[n]);return e},iQ=(e,t)=>sQ(e,aQ(t)),lQ=(e,t)=>{var n={};for(var r in e)oE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&sE.call(e,r)&&(n[r]=e[r]);return n};const cQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Hb=l.forwardRef((e,t)=>{const n=zr("Divider",cQ,e),{className:r,color:o,orientation:s,size:i,label:c,labelPosition:d,labelProps:p,variant:h,styles:m,classNames:g,unstyled:b}=n,y=lQ(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:x,cx:w}=rQ({color:o},{classNames:g,styles:m,unstyled:b,name:"Divider",variant:h,size:i}),S=s==="vertical",j=s==="horizontal",I=!!c&&j,_=!(p!=null&&p.color);return z.createElement(Xo,w4({ref:t,className:w(x.root,{[x.vertical]:S,[x.horizontal]:j,[x.withLabel]:I},r),role:"separator"},y),I&&z.createElement(xu,iQ(w4({},p),{size:(p==null?void 0:p.size)||"xs",mt:qe(2),className:w(x.label,x[d],{[x.labelDefaultStyles]:_})}),c))});Hb.displayName="@mantine/core/Divider";var uQ=Object.defineProperty,dQ=Object.defineProperties,fQ=Object.getOwnPropertyDescriptors,S4=Object.getOwnPropertySymbols,pQ=Object.prototype.hasOwnProperty,hQ=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?uQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j4=(e,t)=>{for(var n in t||(t={}))pQ.call(t,n)&&k4(e,n,t[n]);if(S4)for(var n of S4(t))hQ.call(t,n)&&k4(e,n,t[n]);return e},mQ=(e,t)=>dQ(e,fQ(t)),gQ=ko((e,t,{size:n})=>({item:mQ(j4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:Xt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":j4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const vQ=gQ;var bQ=Object.defineProperty,_4=Object.getOwnPropertySymbols,xQ=Object.prototype.hasOwnProperty,yQ=Object.prototype.propertyIsEnumerable,I4=(e,t,n)=>t in e?bQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CQ=(e,t)=>{for(var n in t||(t={}))xQ.call(t,n)&&I4(e,n,t[n]);if(_4)for(var n of _4(t))yQ.call(t,n)&&I4(e,n,t[n]);return e};function qy({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:c,onItemSelect:d,itemsRefs:p,itemComponent:h,size:m,nothingFound:g,creatable:b,createLabel:y,unstyled:x,variant:w}){const{classes:S}=vQ(null,{classNames:n,styles:r,unstyled:x,name:i,variant:w,size:m}),j=[],I=[];let _=null;const M=(A,R)=>{const D=typeof o=="function"?o(A.value):!1;return z.createElement(h,CQ({key:A.value,className:S.item,"data-disabled":A.disabled||void 0,"data-hovered":!A.disabled&&t===R||void 0,"data-selected":!A.disabled&&D||void 0,selected:D,onMouseEnter:()=>c(R),id:`${s}-${R}`,role:"option",tabIndex:-1,"aria-selected":t===R,ref:O=>{p&&p.current&&(p.current[A.value]=O)},onMouseDown:A.disabled?null:O=>{O.preventDefault(),d(A)},disabled:A.disabled,variant:w},A))};let E=null;if(e.forEach((A,R)=>{A.creatable?_=R:A.group?(E!==A.group&&(E=A.group,I.push(z.createElement("div",{className:S.separator,key:`__mantine-divider-${R}`},z.createElement(Hb,{classNames:{label:S.separatorLabel},label:A.group})))),I.push(M(A,R))):j.push(M(A,R))}),b){const A=e[_];j.push(z.createElement("div",{key:Uy(),className:S.item,"data-hovered":t===_||void 0,onMouseEnter:()=>c(_),onMouseDown:R=>{R.preventDefault(),d(A)},tabIndex:-1,ref:R=>{p&&p.current&&(p.current[A.value]=R)}},y))}return I.length>0&&j.length>0&&j.unshift(z.createElement("div",{className:S.separator,key:"empty-group-separator"},z.createElement(Hb,null))),I.length>0||j.length>0?z.createElement(z.Fragment,null,I,j):z.createElement(xu,{size:m,unstyled:x,className:S.nothingFound},g)}qy.displayName="@mantine/core/SelectItems";var wQ=Object.defineProperty,Cm=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?wQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SQ=(e,t)=>{for(var n in t||(t={}))aE.call(t,n)&&P4(e,n,t[n]);if(Cm)for(var n of Cm(t))iE.call(t,n)&&P4(e,n,t[n]);return e},kQ=(e,t)=>{var n={};for(var r in e)aE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cm)for(var r of Cm(e))t.indexOf(r)<0&&iE.call(e,r)&&(n[r]=e[r]);return n};const Ky=l.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=kQ(n,["label","value"]);return z.createElement("div",SQ({ref:t},s),r||o)});Ky.displayName="@mantine/core/DefaultItem";function Kr(){return Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(n=>jQ(n,t))}function rc(...e){return l.useCallback(lE(...e),e)}const cE=l.forwardRef((e,t)=>{const{children:n,...r}=e,o=l.Children.toArray(n),s=o.find(IQ);if(s){const i=s.props.children,c=o.map(d=>d===s?l.Children.count(i)>1?l.Children.only(null):l.isValidElement(i)?i.props.children:null:d);return l.createElement(Vb,wm({},r,{ref:t}),l.isValidElement(i)?l.cloneElement(i,void 0,c):null)}return l.createElement(Vb,wm({},r,{ref:t}),n)});cE.displayName="Slot";const Vb=l.forwardRef((e,t)=>{const{children:n,...r}=e;return l.isValidElement(n)?l.cloneElement(n,{...PQ(r,n.props),ref:lE(t,n.ref)}):l.Children.count(n)>1?l.Children.only(null):null});Vb.displayName="SlotClone";const _Q=({children:e})=>l.createElement(l.Fragment,null,e);function IQ(e){return l.isValidElement(e)&&e.type===_Q}function PQ(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{s(...c),o(...c)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const EQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Qf=EQ.reduce((e,t)=>{const n=l.forwardRef((r,o)=>{const{asChild:s,...i}=r,c=s?cE:t;return l.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),l.createElement(c,Wb({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ub=globalThis!=null&&globalThis.document?l.useLayoutEffect:()=>{};function MQ(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Xf=e=>{const{present:t,children:n}=e,r=OQ(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=rc(r.ref,o.ref);return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null};Xf.displayName="Presence";function OQ(e){const[t,n]=l.useState(),r=l.useRef({}),o=l.useRef(e),s=l.useRef("none"),i=e?"mounted":"unmounted",[c,d]=MQ(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const p=lh(r.current);s.current=c==="mounted"?p:"none"},[c]),Ub(()=>{const p=r.current,h=o.current;if(h!==e){const g=s.current,b=lh(p);e?d("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?d("UNMOUNT"):d(h&&g!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Ub(()=>{if(t){const p=m=>{const b=lh(r.current).includes(m.animationName);m.target===t&&b&&ls.flushSync(()=>d("ANIMATION_END"))},h=m=>{m.target===t&&(s.current=lh(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:l.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function lh(e){return(e==null?void 0:e.animationName)||"none"}function AQ(e,t=[]){let n=[];function r(s,i){const c=l.createContext(i),d=n.length;n=[...n,i];function p(m){const{scope:g,children:b,...y}=m,x=(g==null?void 0:g[e][d])||c,w=l.useMemo(()=>y,Object.values(y));return l.createElement(x.Provider,{value:w},b)}function h(m,g){const b=(g==null?void 0:g[e][d])||c,y=l.useContext(b);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,h]}const o=()=>{const s=n.map(i=>l.createContext(i));return function(c){const d=(c==null?void 0:c[e])||s;return l.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,RQ(o,...t)]}function RQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((c,{useScope:d,scopeName:p})=>{const m=d(s)[`__scope${p}`];return{...c,...m}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ol(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const DQ=l.createContext(void 0);function TQ(e){const t=l.useContext(DQ);return e||t||"ltr"}function NQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ll(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function $Q(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const uE="ScrollArea",[dE,Abe]=AQ(uE),[LQ,Bs]=dE(uE),zQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[c,d]=l.useState(null),[p,h]=l.useState(null),[m,g]=l.useState(null),[b,y]=l.useState(null),[x,w]=l.useState(null),[S,j]=l.useState(0),[I,_]=l.useState(0),[M,E]=l.useState(!1),[A,R]=l.useState(!1),D=rc(t,T=>d(T)),O=TQ(o);return l.createElement(LQ,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:c,viewport:p,onViewportChange:h,content:m,onContentChange:g,scrollbarX:b,onScrollbarXChange:y,scrollbarXEnabled:M,onScrollbarXEnabledChange:E,scrollbarY:x,onScrollbarYChange:w,scrollbarYEnabled:A,onScrollbarYEnabledChange:R,onCornerWidthChange:j,onCornerHeightChange:_},l.createElement(Qf.div,Kr({dir:O},i,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":I+"px",...e.style}})))}),FQ="ScrollAreaViewport",BQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=Bs(FQ,n),i=l.useRef(null),c=rc(t,i,s.onViewportChange);return l.createElement(l.Fragment,null,l.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),l.createElement(Qf.div,Kr({"data-radix-scroll-area-viewport":""},o,{ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),l.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),Ei="ScrollAreaScrollbar",HQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Bs(Ei,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,c=e.orientation==="horizontal";return l.useEffect(()=>(c?s(!0):i(!0),()=>{c?s(!1):i(!1)}),[c,s,i]),o.type==="hover"?l.createElement(WQ,Kr({},r,{ref:t,forceMount:n})):o.type==="scroll"?l.createElement(VQ,Kr({},r,{ref:t,forceMount:n})):o.type==="auto"?l.createElement(fE,Kr({},r,{ref:t,forceMount:n})):o.type==="always"?l.createElement(Qy,Kr({},r,{ref:t})):null}),WQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Bs(Ei,e.__scopeScrollArea),[s,i]=l.useState(!1);return l.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const p=()=>{window.clearTimeout(d),i(!0)},h=()=>{d=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",h)}}},[o.scrollArea,o.scrollHideDelay]),l.createElement(Xf,{present:n||s},l.createElement(fE,Kr({"data-state":s?"visible":"hidden"},r,{ref:t})))}),VQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Bs(Ei,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Zg(()=>d("SCROLL_END"),100),[c,d]=$Q("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return l.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,o.scrollHideDelay,d]),l.useEffect(()=>{const p=o.viewport,h=s?"scrollLeft":"scrollTop";if(p){let m=p[h];const g=()=>{const b=p[h];m!==b&&(d("SCROLL"),i()),m=b};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,d,i]),l.createElement(Xf,{present:n||c!=="hidden"},l.createElement(Qy,Kr({"data-state":c==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ll(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ll(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),fE=l.forwardRef((e,t)=>{const n=Bs(Ei,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=l.useState(!1),c=e.orientation==="horizontal",d=Zg(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=Bs(Ei,e.__scopeScrollArea),s=l.useRef(null),i=l.useRef(0),[c,d]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=gE(c.viewport,c.content),h={...r,sizes:c,onSizesChange:d,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function m(g,b){return JQ(g,i.current,c,b)}return n==="horizontal"?l.createElement(UQ,Kr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,b=E4(g,c,o.dir);s.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=m(g,o.dir))}})):n==="vertical"?l.createElement(GQ,Kr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,b=E4(g,c);s.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=m(g))}})):null}),UQ=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Bs(Ei,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarXChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(hE,Kr({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Jg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollLeft+h.deltaX;e.onWheelScroll(g),bE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Sm(i.paddingLeft),paddingEnd:Sm(i.paddingRight)}})}}))}),GQ=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Bs(Ei,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarYChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(hE,Kr({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Jg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollTop+h.deltaY;e.onWheelScroll(g),bE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Sm(i.paddingTop),paddingEnd:Sm(i.paddingBottom)}})}}))}),[qQ,pE]=dE(Ei),hE=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:p,onWheelScroll:h,onResize:m,...g}=e,b=Bs(Ei,n),[y,x]=l.useState(null),w=rc(t,D=>x(D)),S=l.useRef(null),j=l.useRef(""),I=b.viewport,_=r.content-r.viewport,M=Ol(h),E=Ol(d),A=Zg(m,10);function R(D){if(S.current){const O=D.clientX-S.current.left,T=D.clientY-S.current.top;p({x:O,y:T})}}return l.useEffect(()=>{const D=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&M(O,_)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[I,y,_,M]),l.useEffect(E,[r,E]),yu(y,A),yu(b.content,A),l.createElement(qQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ol(s),onThumbPointerUp:Ol(i),onThumbPositionChange:E,onThumbPointerDown:Ol(c)},l.createElement(Qf.div,Kr({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Ll(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",R(D))}),onPointerMove:Ll(e.onPointerMove,R),onPointerUp:Ll(e.onPointerUp,D=>{const O=D.target;O.hasPointerCapture(D.pointerId)&&O.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Gb="ScrollAreaThumb",KQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pE(Gb,e.__scopeScrollArea);return l.createElement(Xf,{present:n||o.hasThumb},l.createElement(QQ,Kr({ref:t},r)))}),QQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Bs(Gb,n),i=pE(Gb,n),{onThumbPositionChange:c}=i,d=rc(t,m=>i.onThumbChange(m)),p=l.useRef(),h=Zg(()=>{p.current&&(p.current(),p.current=void 0)},100);return l.useEffect(()=>{const m=s.viewport;if(m){const g=()=>{if(h(),!p.current){const b=ZQ(m,c);p.current=b,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[s.viewport,h,c]),l.createElement(Qf.div,Kr({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ll(e.onPointerDownCapture,m=>{const b=m.target.getBoundingClientRect(),y=m.clientX-b.left,x=m.clientY-b.top;i.onThumbPointerDown({x:y,y:x})}),onPointerUp:Ll(e.onPointerUp,i.onThumbPointerUp)}))}),mE="ScrollAreaCorner",XQ=l.forwardRef((e,t)=>{const n=Bs(mE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.createElement(YQ,Kr({},e,{ref:t})):null}),YQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Bs(mE,n),[s,i]=l.useState(0),[c,d]=l.useState(0),p=!!(s&&c);return yu(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),d(m)}),yu(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),i(m)}),p?l.createElement(Qf.div,Kr({},r,{ref:t,style:{width:s,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Sm(e){return e?parseInt(e,10):0}function gE(e,t){const n=e/t;return isNaN(n)?0:n}function Jg(e){const t=gE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function JQ(e,t,n,r="ltr"){const o=Jg(n),s=o/2,i=t||s,c=o-i,d=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-c,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return vE([d,p],m)(e)}function E4(e,t,n="ltr"){const r=Jg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,c=s-r,d=n==="ltr"?[0,i]:[i*-1,0],p=NQ(e,d);return vE([0,i],[0,c])(p)}function vE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function bE(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,c=n.top!==s.top;(i||c)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Zg(e,t){const n=Ol(e),r=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),l.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function yu(e,t){const n=Ol(t);Ub(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const eX=zQ,tX=BQ,M4=HQ,O4=KQ,nX=XQ;var rX=ko((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?qe(t):void 0,paddingBottom:n?qe(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${qe(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${Nk("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:qe(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:qe(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:Nk("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:qe(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:qe(44),minHeight:qe(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const oX=rX;var sX=Object.defineProperty,aX=Object.defineProperties,iX=Object.getOwnPropertyDescriptors,km=Object.getOwnPropertySymbols,xE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,A4=(e,t,n)=>t in e?sX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qb=(e,t)=>{for(var n in t||(t={}))xE.call(t,n)&&A4(e,n,t[n]);if(km)for(var n of km(t))yE.call(t,n)&&A4(e,n,t[n]);return e},CE=(e,t)=>aX(e,iX(t)),wE=(e,t)=>{var n={};for(var r in e)xE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&km)for(var r of km(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const SE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},e0=l.forwardRef((e,t)=>{const n=zr("ScrollArea",SE,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:c,scrollHideDelay:d,type:p,dir:h,offsetScrollbars:m,viewportRef:g,onScrollPositionChange:b,unstyled:y,variant:x,viewportProps:w}=n,S=wE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,I]=l.useState(!1),_=Ii(),{classes:M,cx:E}=oX({scrollbarSize:c,offsetScrollbars:m,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:x});return z.createElement(eX,{type:p==="never"?"always":p,scrollHideDelay:d,dir:h||_.dir,ref:t,asChild:!0},z.createElement(Xo,qb({className:E(M.root,o)},S),z.createElement(tX,CE(qb({},w),{className:M.viewport,ref:g,onScroll:typeof b=="function"?({currentTarget:A})=>b({x:A.scrollLeft,y:A.scrollTop}):void 0}),r),z.createElement(M4,{orientation:"horizontal",className:M.scrollbar,forceMount:!0,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},z.createElement(O4,{className:M.thumb})),z.createElement(M4,{orientation:"vertical",className:M.scrollbar,forceMount:!0,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},z.createElement(O4,{className:M.thumb})),z.createElement(nX,{className:M.corner})))}),kE=l.forwardRef((e,t)=>{const n=zr("ScrollAreaAutosize",SE,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:c,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,sx:y,variant:x,viewportProps:w}=n,S=wE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return z.createElement(Xo,CE(qb({},S),{ref:t,sx:[{display:"flex"},...d6(y)]}),z.createElement(Xo,{sx:{display:"flex",flexDirection:"column",flex:1}},z.createElement(e0,{classNames:o,styles:s,scrollHideDelay:c,scrollbarSize:i,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,variant:x,viewportProps:w},r)))});kE.displayName="@mantine/core/ScrollAreaAutosize";e0.displayName="@mantine/core/ScrollArea";e0.Autosize=kE;const jE=e0;var lX=Object.defineProperty,cX=Object.defineProperties,uX=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,IE=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?lX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D4=(e,t)=>{for(var n in t||(t={}))_E.call(t,n)&&R4(e,n,t[n]);if(jm)for(var n of jm(t))IE.call(t,n)&&R4(e,n,t[n]);return e},dX=(e,t)=>cX(e,uX(t)),fX=(e,t)=>{var n={};for(var r in e)_E.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&IE.call(e,r)&&(n[r]=e[r]);return n};const t0=l.forwardRef((e,t)=>{var n=e,{style:r}=n,o=fX(n,["style"]);return z.createElement(jE,dX(D4({},o),{style:D4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});t0.displayName="@mantine/core/SelectScrollArea";var pX=ko(()=>({dropdown:{},itemsWrapper:{padding:qe(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const hX=pX,ia=Math.min,xo=Math.max,_m=Math.round,ch=Math.floor,ol=e=>({x:e,y:e}),mX={left:"right",right:"left",bottom:"top",top:"bottom"},gX={start:"end",end:"start"};function Kb(e,t,n){return xo(e,ia(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function la(e){return e.split("-")[0]}function Fu(e){return e.split("-")[1]}function Xy(e){return e==="x"?"y":"x"}function Yy(e){return e==="y"?"height":"width"}function oc(e){return["top","bottom"].includes(la(e))?"y":"x"}function Jy(e){return Xy(oc(e))}function vX(e,t,n){n===void 0&&(n=!1);const r=Fu(e),o=Jy(e),s=Yy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Im(i)),[i,Im(i)]}function bX(e){const t=Im(e);return[Qb(e),t,Qb(t)]}function Qb(e){return e.replace(/start|end/g,t=>gX[t])}function xX(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:i;default:return[]}}function yX(e,t,n,r){const o=Fu(e);let s=xX(la(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Qb)))),s}function Im(e){return e.replace(/left|right|bottom|top/g,t=>mX[t])}function CX(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zy(e){return typeof e!="number"?CX(e):{top:e,right:e,bottom:e,left:e}}function Cu(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function T4(e,t,n){let{reference:r,floating:o}=e;const s=oc(t),i=Jy(t),c=Yy(i),d=la(t),p=s==="y",h=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let b;switch(d){case"top":b={x:h,y:r.y-o.height};break;case"bottom":b={x:h,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-o.width,y:m};break;default:b={x:r.x,y:r.y}}switch(Fu(t)){case"start":b[i]-=g*(n&&p?-1:1);break;case"end":b[i]+=g*(n&&p?-1:1);break}return b}const wX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),d=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:m}=T4(p,r,d),g=r,b={},y=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:d}=t,{element:p,padding:h=0}=hi(e,t)||{};if(p==null)return{};const m=Zy(h),g={x:n,y:r},b=Jy(o),y=Yy(b),x=await i.getDimensions(p),w=b==="y",S=w?"top":"left",j=w?"bottom":"right",I=w?"clientHeight":"clientWidth",_=s.reference[y]+s.reference[b]-g[b]-s.floating[y],M=g[b]-s.reference[b],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(p));let A=E?E[I]:0;(!A||!await(i.isElement==null?void 0:i.isElement(E)))&&(A=c.floating[I]||s.floating[y]);const R=_/2-M/2,D=A/2-x[y]/2-1,O=ia(m[S],D),T=ia(m[j],D),K=O,G=A-x[y]-T,X=A/2-x[y]/2+R,Z=Kb(K,X,G),te=!d.arrow&&Fu(o)!=null&&X!=Z&&s.reference[y]/2-(XK<=0)){var D,O;const K=(((D=s.flip)==null?void 0:D.index)||0)+1,G=M[K];if(G)return{data:{index:K,overflows:R},reset:{placement:G}};let X=(O=R.filter(Z=>Z.overflows[0]<=0).sort((Z,te)=>Z.overflows[1]-te.overflows[1])[0])==null?void 0:O.placement;if(!X)switch(b){case"bestFit":{var T;const Z=(T=R.map(te=>[te.placement,te.overflows.filter(V=>V>0).reduce((V,oe)=>V+oe,0)]).sort((te,V)=>te[1]-V[1])[0])==null?void 0:T[0];Z&&(X=Z);break}case"initialPlacement":X=c;break}if(o!==X)return{reset:{placement:X}}}return{}}}};function PE(e){const t=ia(...e.map(s=>s.left)),n=ia(...e.map(s=>s.top)),r=xo(...e.map(s=>s.right)),o=xo(...e.map(s=>s.bottom));return{x:t,y:n,width:r-t,height:o-n}}function kX(e){const t=e.slice().sort((o,s)=>o.y-s.y),n=[];let r=null;for(let o=0;or.height/2?n.push([s]):n[n.length-1].push(s),r=s}return n.map(o=>Cu(PE(o)))}const jX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:c=2,x:d,y:p}=hi(e,t),h=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),m=kX(h),g=Cu(PE(h)),b=Zy(c);function y(){if(m.length===2&&m[0].left>m[1].right&&d!=null&&p!=null)return m.find(w=>d>w.left-b.left&&dw.top-b.top&&p=2){if(oc(n)==="y"){const O=m[0],T=m[m.length-1],K=la(n)==="top",G=O.top,X=T.bottom,Z=K?O.left:T.left,te=K?O.right:T.right,V=te-Z,oe=X-G;return{top:G,bottom:X,left:Z,right:te,width:V,height:oe,x:Z,y:G}}const w=la(n)==="left",S=xo(...m.map(O=>O.right)),j=ia(...m.map(O=>O.left)),I=m.filter(O=>w?O.left===j:O.right===S),_=I[0].top,M=I[I.length-1].bottom,E=j,A=S,R=A-E,D=M-_;return{top:_,bottom:M,left:E,right:A,width:R,height:D,x:E,y:_}}return g}const x=await s.getElementRects({reference:{getBoundingClientRect:y},floating:r.floating,strategy:i});return o.reference.x!==x.reference.x||o.reference.y!==x.reference.y||o.reference.width!==x.reference.width||o.reference.height!==x.reference.height?{reset:{rects:x}}:{}}}};async function _X(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=la(n),c=Fu(n),d=oc(n)==="y",p=["left","top"].includes(i)?-1:1,h=s&&d?-1:1,m=hi(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return c&&typeof y=="number"&&(b=c==="end"?y*-1:y),d?{x:b*h,y:g*p}:{x:g*p,y:b*h}}const IX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await _X(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},PX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...d}=hi(e,t),p={x:n,y:r},h=await e2(t,d),m=oc(la(o)),g=Xy(m);let b=p[g],y=p[m];if(s){const w=g==="y"?"top":"left",S=g==="y"?"bottom":"right",j=b+h[w],I=b-h[S];b=Kb(j,b,I)}if(i){const w=m==="y"?"top":"left",S=m==="y"?"bottom":"right",j=y+h[w],I=y-h[S];y=Kb(j,y,I)}const x=c.fn({...t,[g]:b,[m]:y});return{...x,data:{x:x.x-n,y:x.y-r}}}}},EX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:p=!0}=hi(e,t),h={x:n,y:r},m=oc(o),g=Xy(m);let b=h[g],y=h[m];const x=hi(c,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const I=g==="y"?"height":"width",_=s.reference[g]-s.floating[I]+w.mainAxis,M=s.reference[g]+s.reference[I]-w.mainAxis;b<_?b=_:b>M&&(b=M)}if(p){var S,j;const I=g==="y"?"width":"height",_=["top","left"].includes(la(o)),M=s.reference[m]-s.floating[I]+(_&&((S=i.offset)==null?void 0:S[m])||0)+(_?0:w.crossAxis),E=s.reference[m]+s.reference[I]+(_?0:((j=i.offset)==null?void 0:j[m])||0)-(_?w.crossAxis:0);yE&&(y=E)}return{[g]:b,[m]:y}}}},MX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=hi(e,t),d=await e2(t,c),p=la(n),h=Fu(n),m=oc(n)==="y",{width:g,height:b}=r.floating;let y,x;p==="top"||p==="bottom"?(y=p,x=h===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=p,y=h==="end"?"top":"bottom");const w=b-d[y],S=g-d[x],j=!t.middlewareData.shift;let I=w,_=S;if(m){const E=g-d.left-d.right;_=h||j?ia(S,E):E}else{const E=b-d.top-d.bottom;I=h||j?ia(w,E):E}if(j&&!h){const E=xo(d.left,0),A=xo(d.right,0),R=xo(d.top,0),D=xo(d.bottom,0);m?_=g-2*(E!==0||A!==0?E+A:xo(d.left,d.right)):I=b-2*(R!==0||D!==0?R+D:xo(d.top,d.bottom))}await i({...t,availableWidth:_,availableHeight:I});const M=await o.getDimensions(s.floating);return g!==M.width||b!==M.height?{reset:{rects:!0}}:{}}}};function sl(e){return EE(e)?(e.nodeName||"").toLowerCase():"#document"}function ds(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mi(e){var t;return(t=(EE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EE(e){return e instanceof Node||e instanceof ds(e).Node}function mi(e){return e instanceof Element||e instanceof ds(e).Element}function Da(e){return e instanceof HTMLElement||e instanceof ds(e).HTMLElement}function $4(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ds(e).ShadowRoot}function Yf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function OX(e){return["table","td","th"].includes(sl(e))}function t2(e){const t=n2(),n=Ns(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function AX(e){let t=wu(e);for(;Da(t)&&!n0(t);){if(t2(t))return t;t=wu(t)}return null}function n2(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function n0(e){return["html","body","#document"].includes(sl(e))}function Ns(e){return ds(e).getComputedStyle(e)}function r0(e){return mi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function wu(e){if(sl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$4(e)&&e.host||Mi(e);return $4(t)?t.host:t}function ME(e){const t=wu(e);return n0(t)?e.ownerDocument?e.ownerDocument.body:e.body:Da(t)&&Yf(t)?t:ME(t)}function uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ME(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ds(o);return s?t.concat(i,i.visualViewport||[],Yf(o)?o:[],i.frameElement&&n?uf(i.frameElement):[]):t.concat(o,uf(o,[],n))}function OE(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Da(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=_m(n)!==s||_m(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function r2(e){return mi(e)?e:e.contextElement}function iu(e){const t=r2(e);if(!Da(t))return ol(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=OE(t);let i=(s?_m(n.width):n.width)/r,c=(s?_m(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const RX=ol(0);function AE(e){const t=ds(e);return!n2()||!t.visualViewport?RX:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DX(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ds(e)?!1:t}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=r2(e);let i=ol(1);t&&(r?mi(r)&&(i=iu(r)):i=iu(e));const c=DX(s,n,r)?AE(s):ol(0);let d=(o.left+c.x)/i.x,p=(o.top+c.y)/i.y,h=o.width/i.x,m=o.height/i.y;if(s){const g=ds(s),b=r&&mi(r)?ds(r):r;let y=g.frameElement;for(;y&&r&&b!==g;){const x=iu(y),w=y.getBoundingClientRect(),S=Ns(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*x.x,I=w.top+(y.clientTop+parseFloat(S.paddingTop))*x.y;d*=x.x,p*=x.y,h*=x.x,m*=x.y,d+=j,p+=I,y=ds(y).frameElement}}return Cu({width:h,height:m,x:d,y:p})}function TX(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Da(n),s=Mi(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},c=ol(1);const d=ol(0);if((o||!o&&r!=="fixed")&&((sl(n)!=="body"||Yf(s))&&(i=r0(n)),Da(n))){const p=Ql(n);c=iu(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-i.scrollLeft*c.x+d.x,y:t.y*c.y-i.scrollTop*c.y+d.y}}function NX(e){return Array.from(e.getClientRects())}function RE(e){return Ql(Mi(e)).left+r0(e).scrollLeft}function $X(e){const t=Mi(e),n=r0(e),r=e.ownerDocument.body,o=xo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=xo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+RE(e);const c=-n.scrollTop;return Ns(r).direction==="rtl"&&(i+=xo(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}function LX(e,t){const n=ds(e),r=Mi(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;const p=n2();(!p||p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:i,x:c,y:d}}function zX(e,t){const n=Ql(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Da(e)?iu(e):ol(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,d=o*s.x,p=r*s.y;return{width:i,height:c,x:d,y:p}}function L4(e,t,n){let r;if(t==="viewport")r=LX(e,n);else if(t==="document")r=$X(Mi(e));else if(mi(t))r=zX(t,n);else{const o=AE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Cu(r)}function DE(e,t){const n=wu(e);return n===t||!mi(n)||n0(n)?!1:Ns(n).position==="fixed"||DE(n,t)}function FX(e,t){const n=t.get(e);if(n)return n;let r=uf(e,[],!1).filter(c=>mi(c)&&sl(c)!=="body"),o=null;const s=Ns(e).position==="fixed";let i=s?wu(e):e;for(;mi(i)&&!n0(i);){const c=Ns(i),d=t2(i);!d&&c.position==="fixed"&&(o=null),(s?!d&&!o:!d&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Yf(i)&&!d&&DE(e,i))?r=r.filter(h=>h!==i):o=c,i=wu(i)}return t.set(e,r),r}function BX(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?FX(t,this._c):[].concat(n),r],c=i[0],d=i.reduce((p,h)=>{const m=L4(t,h,o);return p.top=xo(m.top,p.top),p.right=ia(m.right,p.right),p.bottom=ia(m.bottom,p.bottom),p.left=xo(m.left,p.left),p},L4(t,c,o));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function HX(e){return OE(e)}function WX(e,t,n){const r=Da(t),o=Mi(t),s=n==="fixed",i=Ql(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=ol(0);if(r||!r&&!s)if((sl(t)!=="body"||Yf(o))&&(c=r0(t)),r){const p=Ql(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&(d.x=RE(o));return{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function z4(e,t){return!Da(e)||Ns(e).position==="fixed"?null:t?t(e):e.offsetParent}function TE(e,t){const n=ds(e);if(!Da(e))return n;let r=z4(e,t);for(;r&&OX(r)&&Ns(r).position==="static";)r=z4(r,t);return r&&(sl(r)==="html"||sl(r)==="body"&&Ns(r).position==="static"&&!t2(r))?n:r||AX(e)||n}const VX=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||TE,s=this.getDimensions;return{reference:WX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}};function UX(e){return Ns(e).direction==="rtl"}const GX={convertOffsetParentRelativeRectToViewportRelativeRect:TX,getDocumentElement:Mi,getClippingRect:BX,getOffsetParent:TE,getElementRects:VX,getClientRects:NX,getDimensions:HX,getScale:iu,isElement:mi,isRTL:UX};function qX(e,t){let n=null,r;const o=Mi(e);function s(){clearTimeout(r),n&&n.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const{left:p,top:h,width:m,height:g}=e.getBoundingClientRect();if(c||t(),!m||!g)return;const b=ch(h),y=ch(o.clientWidth-(p+m)),x=ch(o.clientHeight-(h+g)),w=ch(p),j={rootMargin:-b+"px "+-y+"px "+-x+"px "+-w+"px",threshold:xo(0,ia(1,d))||1};let I=!0;function _(M){const E=M[0].intersectionRatio;if(E!==d){if(!I)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},100)}I=!1}try{n=new IntersectionObserver(_,{...j,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,j)}n.observe(e)}return i(!0),s}function KX(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,p=r2(e),h=o||s?[...p?uf(p):[],...uf(t)]:[];h.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const m=p&&c?qX(p,n):null;let g=-1,b=null;i&&(b=new ResizeObserver(S=>{let[j]=S;j&&j.target===p&&b&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{b&&b.observe(t)})),n()}),p&&!d&&b.observe(p),b.observe(t));let y,x=d?Ql(e):null;d&&w();function w(){const S=Ql(e);x&&(S.x!==x.x||S.y!==x.y||S.width!==x.width||S.height!==x.height)&&n(),x=S,y=requestAnimationFrame(w)}return n(),()=>{h.forEach(S=>{o&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),m&&m(),b&&b.disconnect(),b=null,d&&cancelAnimationFrame(y)}}const QX=(e,t,n)=>{const r=new Map,o={platform:GX,...n},s={...o.platform,_c:r};return wX(e,t,{...o,platform:s})},XX=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?N4({element:t.current,padding:n}).fn(o):{}:t?N4({element:t,padding:n}).fn(o):{}}}};var Nh=typeof document<"u"?l.useLayoutEffect:l.useEffect;function Pm(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,o;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(!Pm(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Pm(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function F4(e){const t=l.useRef(e);return Nh(()=>{t.current=e}),t}function YX(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[c,d]=l.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=l.useState(r);Pm(p,r)||h(r);const m=l.useRef(null),g=l.useRef(null),b=l.useRef(c),y=F4(s),x=F4(o),[w,S]=l.useState(null),[j,I]=l.useState(null),_=l.useCallback(O=>{m.current!==O&&(m.current=O,S(O))},[]),M=l.useCallback(O=>{g.current!==O&&(g.current=O,I(O))},[]),E=l.useCallback(()=>{if(!m.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};x.current&&(O.platform=x.current),QX(m.current,g.current,O).then(T=>{const K={...T,isPositioned:!0};A.current&&!Pm(b.current,K)&&(b.current=K,ls.flushSync(()=>{d(K)}))})},[p,t,n,x]);Nh(()=>{i===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[i]);const A=l.useRef(!1);Nh(()=>(A.current=!0,()=>{A.current=!1}),[]),Nh(()=>{if(w&&j){if(y.current)return y.current(w,j,E);E()}},[w,j,E,y]);const R=l.useMemo(()=>({reference:m,floating:g,setReference:_,setFloating:M}),[_,M]),D=l.useMemo(()=>({reference:w,floating:j}),[w,j]);return l.useMemo(()=>({...c,update:E,refs:R,elements:D,reference:_,floating:M}),[c,E,R,D,_,M])}var JX=typeof document<"u"?l.useLayoutEffect:l.useEffect;function ZX(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const eY=l.createContext(null),tY=()=>l.useContext(eY);function nY(e){return(e==null?void 0:e.ownerDocument)||document}function rY(e){return nY(e).defaultView||window}function uh(e){return e?e instanceof rY(e).Element:!1}const oY=Ox["useInsertionEffect".toString()],sY=oY||(e=>e());function aY(e){const t=l.useRef(()=>{});return sY(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;oZX())[0],[p,h]=l.useState(null),m=l.useCallback(S=>{const j=uh(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=l.useCallback(S=>{(uh(S)||S===null)&&(i.current=S,h(S)),(uh(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!uh(S))&&o.refs.setReference(S)},[o.refs]),b=l.useMemo(()=>({...o.refs,setReference:g,setPositionReference:m,domReference:i}),[o.refs,g,m]),y=l.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),x=aY(n),w=l.useMemo(()=>({...o,refs:b,elements:y,dataRef:c,nodeId:r,events:d,open:t,onOpenChange:x}),[o,r,d,t,x,b,y]);return JX(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),l.useMemo(()=>({...o,context:w,refs:b,reference:g,positionReference:m}),[o,b,w,g,m])}function lY({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=l.useState(0);l.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return KX(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),oa(()=>{t.update()},r),oa(()=>{s(i=>i+1)},[e])}function cY(e){const t=[IX(e.offset)];return e.middlewares.shift&&t.push(PX({limiter:EX()})),e.middlewares.flip&&t.push(SX()),e.middlewares.inline&&t.push(jX()),t.push(XX({element:e.arrowRef,padding:e.arrowOffset})),t}function uY(e){const[t,n]=cf({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,c;t?((i=e.onClose)==null||i.call(e),n(!1)):((c=e.onOpen)==null||c.call(e),n(!0))},s=iY({placement:e.position,middleware:[...cY(e),...e.width==="target"?[MX({apply({rects:i}){var c,d;Object.assign((d=(c=s.refs.floating.current)==null?void 0:c.style)!=null?d:{},{width:`${i.reference.width}px`})}})]:[]]});return lY({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),oa(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),oa(()=>{var i,c;e.opened?(c=e.onOpen)==null||c.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const NE={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[dY,$E]=DG(NE.context);var fY=Object.defineProperty,pY=Object.defineProperties,hY=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,LE=Object.prototype.hasOwnProperty,zE=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?fY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dh=(e,t)=>{for(var n in t||(t={}))LE.call(t,n)&&B4(e,n,t[n]);if(Em)for(var n of Em(t))zE.call(t,n)&&B4(e,n,t[n]);return e},mY=(e,t)=>pY(e,hY(t)),gY=(e,t)=>{var n={};for(var r in e)LE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&zE.call(e,r)&&(n[r]=e[r]);return n};const vY={refProp:"ref",popupType:"dialog",shouldOverrideDefaultTargetId:!0},FE=l.forwardRef((e,t)=>{const n=zr("PopoverTarget",vY,e),{children:r,refProp:o,popupType:s,shouldOverrideDefaultTargetId:i}=n,c=gY(n,["children","refProp","popupType","shouldOverrideDefaultTargetId"]);if(!p6(r))throw new Error(NE.children);const d=c,p=$E(),h=Kf(p.reference,r.ref,t),m=p.withRoles?{"aria-haspopup":s,"aria-expanded":p.opened,"aria-controls":p.getDropdownId(),id:i?p.getTargetId():r.props.id}:{};return l.cloneElement(r,dh(mY(dh(dh(dh({},d),m),p.targetProps),{className:m6(p.targetProps.className,d.className,r.props.className),[o]:h}),p.controlled?null:{onClick:p.onToggle}))});FE.displayName="@mantine/core/PopoverTarget";var bY=ko((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${qe(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${qe(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const xY=bY;var yY=Object.defineProperty,H4=Object.getOwnPropertySymbols,CY=Object.prototype.hasOwnProperty,wY=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?yY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t)=>{for(var n in t||(t={}))CY.call(t,n)&&W4(e,n,t[n]);if(H4)for(var n of H4(t))wY.call(t,n)&&W4(e,n,t[n]);return e};const V4={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function SY({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in rh?Oc(Oc(Oc({transitionProperty:rh[e].transitionProperty},o),rh[e].common),rh[e][V4[t]]):null:Oc(Oc(Oc({transitionProperty:e.transitionProperty},o),e.common),e[V4[t]])}function kY({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:c}){const d=Ii(),p=w6(),h=d.respectReducedMotion?p:!1,[m,g]=l.useState(h?0:e),[b,y]=l.useState(r?"entered":"exited"),x=l.useRef(-1),w=S=>{const j=S?o:s,I=S?i:c;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(x.current);const _=h?0:S?e:t;if(g(_),_===0)typeof j=="function"&&j(),typeof I=="function"&&I(),y(S?"entered":"exited");else{const M=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);x.current=window.setTimeout(()=>{window.clearTimeout(M),typeof I=="function"&&I(),y(S?"entered":"exited")},_)}};return oa(()=>{w(r)},[r]),l.useEffect(()=>()=>window.clearTimeout(x.current),[]),{transitionDuration:m,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function BE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h}){const{transitionDuration:m,transitionStatus:g,transitionTimingFunction:b}=kY({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h});return m===0?o?z.createElement(z.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:z.createElement(z.Fragment,null,s(SY({transition:t,duration:m,state:g,timingFunction:b})))}BE.displayName="@mantine/core/Transition";function HE({children:e,active:t=!0,refProp:n="ref"}){const r=hq(t),o=Kf(r,e==null?void 0:e.ref);return p6(e)?l.cloneElement(e,{[n]:o}):e}HE.displayName="@mantine/core/FocusTrap";var jY=Object.defineProperty,_Y=Object.defineProperties,IY=Object.getOwnPropertyDescriptors,U4=Object.getOwnPropertySymbols,PY=Object.prototype.hasOwnProperty,EY=Object.prototype.propertyIsEnumerable,G4=(e,t,n)=>t in e?jY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bi=(e,t)=>{for(var n in t||(t={}))PY.call(t,n)&&G4(e,n,t[n]);if(U4)for(var n of U4(t))EY.call(t,n)&&G4(e,n,t[n]);return e},fh=(e,t)=>_Y(e,IY(t));function q4(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function K4(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const MY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function OY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:c}){const[d,p="center"]=e.split("-"),h={width:qe(t),height:qe(t),transform:"rotate(45deg)",position:"absolute",[MY[d]]:qe(r)},m=qe(-t/2);return d==="left"?fh(Bi(Bi({},h),q4(p,i,n,o)),{right:m,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?fh(Bi(Bi({},h),q4(p,i,n,o)),{left:m,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?fh(Bi(Bi({},h),K4(p,s,n,o,c)),{bottom:m,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?fh(Bi(Bi({},h),K4(p,s,n,o,c)),{top:m,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var AY=Object.defineProperty,RY=Object.defineProperties,DY=Object.getOwnPropertyDescriptors,Mm=Object.getOwnPropertySymbols,WE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?AY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TY=(e,t)=>{for(var n in t||(t={}))WE.call(t,n)&&Q4(e,n,t[n]);if(Mm)for(var n of Mm(t))VE.call(t,n)&&Q4(e,n,t[n]);return e},NY=(e,t)=>RY(e,DY(t)),$Y=(e,t)=>{var n={};for(var r in e)WE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mm)for(var r of Mm(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};const UE=l.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,visible:d,arrowX:p,arrowY:h}=n,m=$Y(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=Ii();return d?z.createElement("div",NY(TY({},m),{ref:t,style:OY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,dir:g.dir,arrowX:p,arrowY:h})})):null});UE.displayName="@mantine/core/FloatingArrow";var LY=Object.defineProperty,zY=Object.defineProperties,FY=Object.getOwnPropertyDescriptors,Om=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?LY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ac=(e,t)=>{for(var n in t||(t={}))GE.call(t,n)&&X4(e,n,t[n]);if(Om)for(var n of Om(t))qE.call(t,n)&&X4(e,n,t[n]);return e},ph=(e,t)=>zY(e,FY(t)),BY=(e,t)=>{var n={};for(var r in e)GE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Om)for(var r of Om(e))t.indexOf(r)<0&&qE.call(e,r)&&(n[r]=e[r]);return n};const HY={};function KE(e){var t;const n=zr("PopoverDropdown",HY,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,c=BY(n,["style","className","children","onKeyDownCapture"]),d=$E(),{classes:p,cx:h}=xY({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),m=iq({opened:d.opened,shouldReturnFocus:d.returnFocus}),g=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:z.createElement(q6,ph(Ac({},d.portalProps),{withinPortal:d.withinPortal}),z.createElement(BE,ph(Ac({mounted:d.opened},d.transitionProps),{transition:d.transitionProps.transition||"fade",duration:(t=d.transitionProps.duration)!=null?t:150,keepMounted:d.keepMounted,exitDuration:typeof d.transitionProps.exitDuration=="number"?d.transitionProps.exitDuration:d.transitionProps.duration}),b=>{var y,x;return z.createElement(HE,{active:d.trapFocus},z.createElement(Xo,Ac(ph(Ac({},g),{tabIndex:-1,ref:d.floating,style:ph(Ac(Ac({},r),b),{zIndex:d.zIndex,top:(y=d.y)!=null?y:0,left:(x=d.x)!=null?x:0,width:d.width==="target"?void 0:qe(d.width)}),className:h(p.dropdown,o),onKeyDownCapture:NG(d.onClose,{active:d.closeOnEscape,onTrigger:m,onKeyDown:i}),"data-position":d.placement}),c),s,z.createElement(UE,{ref:d.arrowRef,arrowX:d.arrowX,arrowY:d.arrowY,visible:d.withArrow,position:d.placement,arrowSize:d.arrowSize,arrowRadius:d.arrowRadius,arrowOffset:d.arrowOffset,arrowPosition:d.arrowPosition,className:p.arrow})))}))}KE.displayName="@mantine/core/PopoverDropdown";function WY(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var Y4=Object.getOwnPropertySymbols,VY=Object.prototype.hasOwnProperty,UY=Object.prototype.propertyIsEnumerable,GY=(e,t)=>{var n={};for(var r in e)VY.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Y4)for(var r of Y4(e))t.indexOf(r)<0&&UY.call(e,r)&&(n[r]=e[r]);return n};const qY={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Vy("popover"),__staticSelector:"Popover",width:"max-content"};function Bu(e){var t,n,r,o,s,i;const c=l.useRef(null),d=zr("Popover",qY,e),{children:p,position:h,offset:m,onPositionChange:g,positionDependencies:b,opened:y,transitionProps:x,width:w,middlewares:S,withArrow:j,arrowSize:I,arrowOffset:_,arrowRadius:M,arrowPosition:E,unstyled:A,classNames:R,styles:D,closeOnClickOutside:O,withinPortal:T,portalProps:K,closeOnEscape:G,clickOutsideEvents:X,trapFocus:Z,onClose:te,onOpen:V,onChange:oe,zIndex:ne,radius:se,shadow:re,id:ae,defaultOpened:B,__staticSelector:Y,withRoles:$,disabled:F,returnFocus:q,variant:pe,keepMounted:W}=d,U=GY(d,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[ee,J]=l.useState(null),[ge,he]=l.useState(null),de=Gy(ae),_e=Ii(),Pe=uY({middlewares:S,width:w,position:WY(_e.dir,h),offset:typeof m=="number"?m+(j?I/2:0):m,arrowRef:c,arrowOffset:_,onPositionChange:g,positionDependencies:b,opened:y,defaultOpened:B,onChange:oe,onOpen:V,onClose:te});rq(()=>Pe.opened&&O&&Pe.onClose(),X,[ee,ge]);const ze=l.useCallback(Je=>{J(Je),Pe.floating.reference(Je)},[Pe.floating.reference]),ht=l.useCallback(Je=>{he(Je),Pe.floating.floating(Je)},[Pe.floating.floating]);return z.createElement(dY,{value:{returnFocus:q,disabled:F,controlled:Pe.controlled,reference:ze,floating:ht,x:Pe.floating.x,y:Pe.floating.y,arrowX:(r=(n=(t=Pe.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=Pe.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:Pe.opened,arrowRef:c,transitionProps:x,width:w,withArrow:j,arrowSize:I,arrowOffset:_,arrowRadius:M,arrowPosition:E,placement:Pe.floating.placement,trapFocus:Z,withinPortal:T,portalProps:K,zIndex:ne,radius:se,shadow:re,closeOnEscape:G,onClose:Pe.onClose,onToggle:Pe.onToggle,getTargetId:()=>`${de}-target`,getDropdownId:()=>`${de}-dropdown`,withRoles:$,targetProps:U,__staticSelector:Y,classNames:R,styles:D,unstyled:A,variant:pe,keepMounted:W}},p)}Bu.Target=FE;Bu.Dropdown=KE;Bu.displayName="@mantine/core/Popover";var KY=Object.defineProperty,Am=Object.getOwnPropertySymbols,QE=Object.prototype.hasOwnProperty,XE=Object.prototype.propertyIsEnumerable,J4=(e,t,n)=>t in e?KY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QY=(e,t)=>{for(var n in t||(t={}))QE.call(t,n)&&J4(e,n,t[n]);if(Am)for(var n of Am(t))XE.call(t,n)&&J4(e,n,t[n]);return e},XY=(e,t)=>{var n={};for(var r in e)QE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&XE.call(e,r)&&(n[r]=e[r]);return n};function YY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:c,__staticSelector:d,styles:p,classNames:h,unstyled:m}=t,g=XY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=hX(null,{name:d,styles:p,classNames:h,unstyled:m});return z.createElement(Bu.Dropdown,QY({p:0,onMouseDown:y=>y.preventDefault()},g),z.createElement("div",{style:{maxHeight:qe(o),display:"flex"}},z.createElement(Xo,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==t0?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:c},z.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function Yi({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:c,switchDirectionOnFlip:d,zIndex:p,dropdownPosition:h,positionDependencies:m=[],classNames:g,styles:b,unstyled:y,readOnly:x,variant:w}){return z.createElement(Bu,{unstyled:y,classNames:g,styles:b,width:"target",withRoles:!1,opened:e,middlewares:{flip:h==="flip",shift:!1},position:h==="flip"?"bottom":h,positionDependencies:m,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:x,onPositionChange:S=>d&&(c==null?void 0:c(S==="top"?"column-reverse":"column")),variant:w},s)}Yi.Target=Bu.Target;Yi.Dropdown=YY;var JY=Object.defineProperty,ZY=Object.defineProperties,eJ=Object.getOwnPropertyDescriptors,Rm=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,Z4=(e,t,n)=>t in e?JY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hh=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Z4(e,n,t[n]);if(Rm)for(var n of Rm(t))JE.call(t,n)&&Z4(e,n,t[n]);return e},tJ=(e,t)=>ZY(e,eJ(t)),nJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rm)for(var r of Rm(e))t.indexOf(r)<0&&JE.call(e,r)&&(n[r]=e[r]);return n};function ZE(e,t,n){const r=zr(e,t,n),{label:o,description:s,error:i,required:c,classNames:d,styles:p,className:h,unstyled:m,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:w,wrapperProps:S,id:j,size:I,style:_,inputContainer:M,inputWrapperOrder:E,withAsterisk:A,variant:R}=r,D=nJ(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=Gy(j),{systemStyles:T,rest:K}=Yg(D),G=hh({label:o,description:s,error:i,required:c,classNames:d,className:h,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:w,unstyled:m,styles:p,id:O,size:I,style:_,inputContainer:M,inputWrapperOrder:E,withAsterisk:A,variant:R},S);return tJ(hh({},K),{classNames:d,styles:p,unstyled:m,wrapperProps:hh(hh({},G),T),inputProps:{required:c,classNames:d,styles:p,unstyled:m,id:O,size:I,__staticSelector:g,error:i,variant:R}})}var rJ=ko((e,t,{size:n})=>({label:{display:"inline-block",fontSize:Xt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const oJ=rJ;var sJ=Object.defineProperty,Dm=Object.getOwnPropertySymbols,eM=Object.prototype.hasOwnProperty,tM=Object.prototype.propertyIsEnumerable,ej=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aJ=(e,t)=>{for(var n in t||(t={}))eM.call(t,n)&&ej(e,n,t[n]);if(Dm)for(var n of Dm(t))tM.call(t,n)&&ej(e,n,t[n]);return e},iJ=(e,t)=>{var n={};for(var r in e)eM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dm)for(var r of Dm(e))t.indexOf(r)<0&&tM.call(e,r)&&(n[r]=e[r]);return n};const lJ={labelElement:"label",size:"sm"},o2=l.forwardRef((e,t)=>{const n=zr("InputLabel",lJ,e),{labelElement:r,children:o,required:s,size:i,classNames:c,styles:d,unstyled:p,className:h,htmlFor:m,__staticSelector:g,variant:b,onMouseDown:y}=n,x=iJ(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=oJ(null,{name:["InputWrapper",g],classNames:c,styles:d,unstyled:p,variant:b,size:i});return z.createElement(Xo,aJ({component:r,ref:t,className:S(w.label,h),htmlFor:r==="label"?m:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},x),o,s&&z.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});o2.displayName="@mantine/core/InputLabel";var cJ=ko((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${qe(2)})`,lineHeight:1.2,display:"block"}}));const uJ=cJ;var dJ=Object.defineProperty,Tm=Object.getOwnPropertySymbols,nM=Object.prototype.hasOwnProperty,rM=Object.prototype.propertyIsEnumerable,tj=(e,t,n)=>t in e?dJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fJ=(e,t)=>{for(var n in t||(t={}))nM.call(t,n)&&tj(e,n,t[n]);if(Tm)for(var n of Tm(t))rM.call(t,n)&&tj(e,n,t[n]);return e},pJ=(e,t)=>{var n={};for(var r in e)nM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&rM.call(e,r)&&(n[r]=e[r]);return n};const hJ={size:"sm"},s2=l.forwardRef((e,t)=>{const n=zr("InputError",hJ,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=pJ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=uJ(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return z.createElement(xu,fJ({className:b(g.error,o),ref:t},m),r)});s2.displayName="@mantine/core/InputError";var mJ=ko((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${qe(2)})`,lineHeight:1.2,display:"block"}}));const gJ=mJ;var vJ=Object.defineProperty,Nm=Object.getOwnPropertySymbols,oM=Object.prototype.hasOwnProperty,sM=Object.prototype.propertyIsEnumerable,nj=(e,t,n)=>t in e?vJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bJ=(e,t)=>{for(var n in t||(t={}))oM.call(t,n)&&nj(e,n,t[n]);if(Nm)for(var n of Nm(t))sM.call(t,n)&&nj(e,n,t[n]);return e},xJ=(e,t)=>{var n={};for(var r in e)oM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&sM.call(e,r)&&(n[r]=e[r]);return n};const yJ={size:"sm"},a2=l.forwardRef((e,t)=>{const n=zr("InputDescription",yJ,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=xJ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=gJ(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return z.createElement(xu,bJ({color:"dimmed",className:b(g.description,o),ref:t,unstyled:c},m),r)});a2.displayName="@mantine/core/InputDescription";const aM=l.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),CJ=aM.Provider,wJ=()=>l.useContext(aM);function SJ(e,{hasDescription:t,hasError:n}){const r=e.findIndex(d=>d==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var kJ=Object.defineProperty,jJ=Object.defineProperties,_J=Object.getOwnPropertyDescriptors,rj=Object.getOwnPropertySymbols,IJ=Object.prototype.hasOwnProperty,PJ=Object.prototype.propertyIsEnumerable,oj=(e,t,n)=>t in e?kJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,EJ=(e,t)=>{for(var n in t||(t={}))IJ.call(t,n)&&oj(e,n,t[n]);if(rj)for(var n of rj(t))PJ.call(t,n)&&oj(e,n,t[n]);return e},MJ=(e,t)=>jJ(e,_J(t)),OJ=ko(e=>({root:MJ(EJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const AJ=OJ;var RJ=Object.defineProperty,DJ=Object.defineProperties,TJ=Object.getOwnPropertyDescriptors,$m=Object.getOwnPropertySymbols,iM=Object.prototype.hasOwnProperty,lM=Object.prototype.propertyIsEnumerable,sj=(e,t,n)=>t in e?RJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hi=(e,t)=>{for(var n in t||(t={}))iM.call(t,n)&&sj(e,n,t[n]);if($m)for(var n of $m(t))lM.call(t,n)&&sj(e,n,t[n]);return e},aj=(e,t)=>DJ(e,TJ(t)),NJ=(e,t)=>{var n={};for(var r in e)iM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&lM.call(e,r)&&(n[r]=e[r]);return n};const $J={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},cM=l.forwardRef((e,t)=>{const n=zr("InputWrapper",$J,e),{className:r,label:o,children:s,required:i,id:c,error:d,description:p,labelElement:h,labelProps:m,descriptionProps:g,errorProps:b,classNames:y,styles:x,size:w,inputContainer:S,__staticSelector:j,unstyled:I,inputWrapperOrder:_,withAsterisk:M,variant:E}=n,A=NJ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:R,cx:D}=AJ(null,{classNames:y,styles:x,name:["InputWrapper",j],unstyled:I,variant:E,size:w}),O={classNames:y,styles:x,unstyled:I,size:w,variant:E,__staticSelector:j},T=typeof M=="boolean"?M:i,K=c?`${c}-error`:b==null?void 0:b.id,G=c?`${c}-description`:g==null?void 0:g.id,Z=`${!!d&&typeof d!="boolean"?K:""} ${p?G:""}`,te=Z.trim().length>0?Z.trim():void 0,V=o&&z.createElement(o2,Hi(Hi({key:"label",labelElement:h,id:c?`${c}-label`:void 0,htmlFor:c,required:T},O),m),o),oe=p&&z.createElement(a2,aj(Hi(Hi({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||G}),p),ne=z.createElement(l.Fragment,{key:"input"},S(s)),se=typeof d!="boolean"&&d&&z.createElement(s2,aj(Hi(Hi({},b),O),{size:(b==null?void 0:b.size)||O.size,key:"error",id:(b==null?void 0:b.id)||K}),d),re=_.map(ae=>{switch(ae){case"label":return V;case"input":return ne;case"description":return oe;case"error":return se;default:return null}});return z.createElement(CJ,{value:Hi({describedBy:te},SJ(_,{hasDescription:!!oe,hasError:!!se}))},z.createElement(Xo,Hi({className:D(R.root,r),ref:t},A),re))});cM.displayName="@mantine/core/InputWrapper";var LJ=Object.defineProperty,Lm=Object.getOwnPropertySymbols,uM=Object.prototype.hasOwnProperty,dM=Object.prototype.propertyIsEnumerable,ij=(e,t,n)=>t in e?LJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zJ=(e,t)=>{for(var n in t||(t={}))uM.call(t,n)&&ij(e,n,t[n]);if(Lm)for(var n of Lm(t))dM.call(t,n)&&ij(e,n,t[n]);return e},FJ=(e,t)=>{var n={};for(var r in e)uM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&dM.call(e,r)&&(n[r]=e[r]);return n};const BJ={},fM=l.forwardRef((e,t)=>{const n=zr("InputPlaceholder",BJ,e),{sx:r}=n,o=FJ(n,["sx"]);return z.createElement(Xo,zJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...d6(r)],ref:t},o))});fM.displayName="@mantine/core/InputPlaceholder";var HJ=Object.defineProperty,WJ=Object.defineProperties,VJ=Object.getOwnPropertyDescriptors,lj=Object.getOwnPropertySymbols,UJ=Object.prototype.hasOwnProperty,GJ=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?HJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mh=(e,t)=>{for(var n in t||(t={}))UJ.call(t,n)&&cj(e,n,t[n]);if(lj)for(var n of lj(t))GJ.call(t,n)&&cj(e,n,t[n]);return e},b1=(e,t)=>WJ(e,VJ(t));const ks={xs:qe(30),sm:qe(36),md:qe(42),lg:qe(50),xl:qe(60)},qJ=["default","filled","unstyled"];function KJ({theme:e,variant:t}){return qJ.includes(t)?t==="default"?{border:`${qe(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${qe(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:qe(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var QJ=ko((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:c,offsetTop:d,pointer:p},{variant:h,size:m})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,b=h==="default"||h==="filled"?{minHeight:Xt({size:m,sizes:ks}),paddingLeft:`calc(${Xt({size:m,sizes:ks})} / 3)`,paddingRight:s?o||Xt({size:m,sizes:ks}):`calc(${Xt({size:m,sizes:ks})} / 3)`,borderRadius:e.fn.radius(n)}:h==="unstyled"&&s?{paddingRight:o||Xt({size:m,sizes:ks})}:null;return{wrapper:{position:"relative",marginTop:d?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:c?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:b1(mh(mh(b1(mh({},e.fn.fontStyles()),{height:t?h==="unstyled"?void 0:"auto":Xt({size:m,sizes:ks}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Xt({size:m,sizes:ks})} - ${qe(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Xt({size:m,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),KJ({theme:e,variant:h})),b),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?qe(i):Xt({size:m,sizes:ks})},"&::placeholder":b1(mh({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?qe(i):Xt({size:m,sizes:ks}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||Xt({size:m,sizes:ks})}}});const XJ=QJ;var YJ=Object.defineProperty,JJ=Object.defineProperties,ZJ=Object.getOwnPropertyDescriptors,zm=Object.getOwnPropertySymbols,pM=Object.prototype.hasOwnProperty,hM=Object.prototype.propertyIsEnumerable,uj=(e,t,n)=>t in e?YJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gh=(e,t)=>{for(var n in t||(t={}))pM.call(t,n)&&uj(e,n,t[n]);if(zm)for(var n of zm(t))hM.call(t,n)&&uj(e,n,t[n]);return e},dj=(e,t)=>JJ(e,ZJ(t)),eZ=(e,t)=>{var n={};for(var r in e)pM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&hM.call(e,r)&&(n[r]=e[r]);return n};const tZ={size:"sm",variant:"default"},sc=l.forwardRef((e,t)=>{const n=zr("Input",tZ,e),{className:r,error:o,required:s,disabled:i,variant:c,icon:d,style:p,rightSectionWidth:h,iconWidth:m,rightSection:g,rightSectionProps:b,radius:y,size:x,wrapperProps:w,classNames:S,styles:j,__staticSelector:I,multiline:_,sx:M,unstyled:E,pointer:A}=n,R=eZ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:D,offsetTop:O,describedBy:T}=wJ(),{classes:K,cx:G}=XJ({radius:y,multiline:_,invalid:!!o,rightSectionWidth:h?qe(h):void 0,iconWidth:m,withRightSection:!!g,offsetBottom:D,offsetTop:O,pointer:A},{classNames:S,styles:j,name:["Input",I],unstyled:E,variant:c,size:x}),{systemStyles:X,rest:Z}=Yg(R);return z.createElement(Xo,gh(gh({className:G(K.wrapper,r),sx:M,style:p},X),w),d&&z.createElement("div",{className:K.icon},d),z.createElement(Xo,dj(gh({component:"input"},Z),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:K.input})),g&&z.createElement("div",dj(gh({},b),{className:K.rightSection}),g))});sc.displayName="@mantine/core/Input";sc.Wrapper=cM;sc.Label=o2;sc.Description=a2;sc.Error=s2;sc.Placeholder=fM;const Su=sc;var nZ=Object.defineProperty,Fm=Object.getOwnPropertySymbols,mM=Object.prototype.hasOwnProperty,gM=Object.prototype.propertyIsEnumerable,fj=(e,t,n)=>t in e?nZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pj=(e,t)=>{for(var n in t||(t={}))mM.call(t,n)&&fj(e,n,t[n]);if(Fm)for(var n of Fm(t))gM.call(t,n)&&fj(e,n,t[n]);return e},rZ=(e,t)=>{var n={};for(var r in e)mM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&gM.call(e,r)&&(n[r]=e[r]);return n};const oZ={multiple:!1},vM=l.forwardRef((e,t)=>{const n=zr("FileButton",oZ,e),{onChange:r,children:o,multiple:s,accept:i,name:c,form:d,resetRef:p,disabled:h,capture:m,inputProps:g}=n,b=rZ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=l.useRef(),x=()=>{!h&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return C6(p,()=>{y.current.value=""}),z.createElement(z.Fragment,null,o(pj({onClick:x},b)),z.createElement("input",pj({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:w,ref:Kf(t,y),name:c,form:d,capture:m},g)))});vM.displayName="@mantine/core/FileButton";const bM={xs:qe(16),sm:qe(22),md:qe(26),lg:qe(30),xl:qe(36)},sZ={xs:qe(10),sm:qe(12),md:qe(14),lg:qe(16),xl:qe(18)};var aZ=ko((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:Xt({size:o,sizes:bM}),paddingLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?Xt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:Xt({size:o,sizes:sZ}),borderRadius:Xt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${qe(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const iZ=aZ;var lZ=Object.defineProperty,Bm=Object.getOwnPropertySymbols,xM=Object.prototype.hasOwnProperty,yM=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?lZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cZ=(e,t)=>{for(var n in t||(t={}))xM.call(t,n)&&hj(e,n,t[n]);if(Bm)for(var n of Bm(t))yM.call(t,n)&&hj(e,n,t[n]);return e},uZ=(e,t)=>{var n={};for(var r in e)xM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&yM.call(e,r)&&(n[r]=e[r]);return n};const dZ={xs:16,sm:22,md:24,lg:26,xl:30};function CM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:c,readOnly:d,size:p,radius:h="sm",variant:m,unstyled:g}=t,b=uZ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:x}=iZ({disabled:c,readOnly:d,radius:h},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:m});return z.createElement("div",cZ({className:x(y.defaultValue,s)},b),z.createElement("span",{className:y.defaultValueLabel},n),!c&&!d&&z.createElement(eE,{"aria-hidden":!0,onMouseDown:i,size:dZ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}CM.displayName="@mantine/core/MultiSelect/DefaultValue";function fZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const d=[];for(let p=0;ph===e[p].value&&!e[p].disabled))&&d.push(e[p]);return d}const c=[];for(let d=0;dp===e[d].value&&!e[d].disabled),e[d])&&c.push(e[d]),!(c.length>=n));d+=1);return c}var pZ=Object.defineProperty,Hm=Object.getOwnPropertySymbols,wM=Object.prototype.hasOwnProperty,SM=Object.prototype.propertyIsEnumerable,mj=(e,t,n)=>t in e?pZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gj=(e,t)=>{for(var n in t||(t={}))wM.call(t,n)&&mj(e,n,t[n]);if(Hm)for(var n of Hm(t))SM.call(t,n)&&mj(e,n,t[n]);return e},hZ=(e,t)=>{var n={};for(var r in e)wM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&SM.call(e,r)&&(n[r]=e[r]);return n};const mZ={xs:qe(14),sm:qe(18),md:qe(20),lg:qe(24),xl:qe(28)};function gZ(e){var t=e,{size:n,error:r,style:o}=t,s=hZ(t,["size","error","style"]);const i=Ii(),c=Xt({size:n,sizes:mZ});return z.createElement("svg",gj({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:gj({color:r?i.colors.red[6]:i.colors.gray[6],width:c,height:c},o),"data-chevron":!0},s),z.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var vZ=Object.defineProperty,bZ=Object.defineProperties,xZ=Object.getOwnPropertyDescriptors,vj=Object.getOwnPropertySymbols,yZ=Object.prototype.hasOwnProperty,CZ=Object.prototype.propertyIsEnumerable,bj=(e,t,n)=>t in e?vZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wZ=(e,t)=>{for(var n in t||(t={}))yZ.call(t,n)&&bj(e,n,t[n]);if(vj)for(var n of vj(t))CZ.call(t,n)&&bj(e,n,t[n]);return e},SZ=(e,t)=>bZ(e,xZ(t));function kM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?z.createElement(eE,SZ(wZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):z.createElement(gZ,{error:o,size:r})}kM.displayName="@mantine/core/SelectRightSection";var kZ=Object.defineProperty,jZ=Object.defineProperties,_Z=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,jM=Object.prototype.hasOwnProperty,_M=Object.prototype.propertyIsEnumerable,xj=(e,t,n)=>t in e?kZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x1=(e,t)=>{for(var n in t||(t={}))jM.call(t,n)&&xj(e,n,t[n]);if(Wm)for(var n of Wm(t))_M.call(t,n)&&xj(e,n,t[n]);return e},yj=(e,t)=>jZ(e,_Z(t)),IZ=(e,t)=>{var n={};for(var r in e)jM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wm)for(var r of Wm(e))t.indexOf(r)<0&&_M.call(e,r)&&(n[r]=e[r]);return n};function IM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=IZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const c=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&z.createElement(kM,x1({},i)),styles:yj(x1({},c),{rightSection:yj(x1({},c==null?void 0:c.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var PZ=Object.defineProperty,EZ=Object.defineProperties,MZ=Object.getOwnPropertyDescriptors,Cj=Object.getOwnPropertySymbols,OZ=Object.prototype.hasOwnProperty,AZ=Object.prototype.propertyIsEnumerable,wj=(e,t,n)=>t in e?PZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RZ=(e,t)=>{for(var n in t||(t={}))OZ.call(t,n)&&wj(e,n,t[n]);if(Cj)for(var n of Cj(t))AZ.call(t,n)&&wj(e,n,t[n]);return e},DZ=(e,t)=>EZ(e,MZ(t)),TZ=ko((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${Xt({size:n,sizes:ks})} - ${qe(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Xt({size:n,sizes:ks})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${qe(2)}) calc(${e.spacing.xs} / 2)`},searchInput:DZ(RZ({},e.fn.fontStyles()),{flex:1,minWidth:qe(60),backgroundColor:"transparent",border:0,outline:0,fontSize:Xt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:Xt({size:n,sizes:bM}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const NZ=TZ;var $Z=Object.defineProperty,LZ=Object.defineProperties,zZ=Object.getOwnPropertyDescriptors,Vm=Object.getOwnPropertySymbols,PM=Object.prototype.hasOwnProperty,EM=Object.prototype.propertyIsEnumerable,Sj=(e,t,n)=>t in e?$Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))PM.call(t,n)&&Sj(e,n,t[n]);if(Vm)for(var n of Vm(t))EM.call(t,n)&&Sj(e,n,t[n]);return e},kj=(e,t)=>LZ(e,zZ(t)),FZ=(e,t)=>{var n={};for(var r in e)PM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vm)for(var r of Vm(e))t.indexOf(r)<0&&EM.call(e,r)&&(n[r]=e[r]);return n};function BZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function HZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function jj(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const WZ={size:"sm",valueComponent:CM,itemComponent:Ky,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:BZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:HZ,switchDirectionOnFlip:!1,zIndex:Vy("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},MM=l.forwardRef((e,t)=>{const n=zr("MultiSelect",WZ,e),{className:r,style:o,required:s,label:i,description:c,size:d,error:p,classNames:h,styles:m,wrapperProps:g,value:b,defaultValue:y,data:x,onChange:w,valueComponent:S,itemComponent:j,id:I,transitionProps:_,maxDropdownHeight:M,shadow:E,nothingFound:A,onFocus:R,onBlur:D,searchable:O,placeholder:T,filter:K,limit:G,clearSearchOnChange:X,clearable:Z,clearSearchOnBlur:te,variant:V,onSearchChange:oe,searchValue:ne,disabled:se,initiallyOpened:re,radius:ae,icon:B,rightSection:Y,rightSectionWidth:$,creatable:F,getCreateLabel:q,shouldCreate:pe,onCreate:W,sx:U,dropdownComponent:ee,onDropdownClose:J,onDropdownOpen:ge,maxSelectedValues:he,withinPortal:de,portalProps:_e,switchDirectionOnFlip:Pe,zIndex:ze,selectOnBlur:ht,name:Je,dropdownPosition:qt,errorProps:Pt,labelProps:jt,descriptionProps:Se,form:Fe,positionDependencies:it,onKeyDown:At,unstyled:ke,inputContainer:lt,inputWrapperOrder:Rt,readOnly:zt,withAsterisk:Re,clearButtonProps:Qe,hoverOnSearchChange:En,disableSelectedItemFiltering:Te}=n,ct=FZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:ft,cx:tt,theme:en}=NZ({invalid:!!p},{name:"MultiSelect",classNames:h,styles:m,unstyled:ke,size:d,variant:V}),{systemStyles:ar,rest:vn}=Yg(ct),dn=l.useRef(),Tr=l.useRef({}),ir=Gy(I),[$n,Jn]=l.useState(re),[Mn,Fr]=l.useState(-1),[co,Nr]=l.useState("column"),[$r,Lo]=cf({value:ne,defaultValue:"",finalValue:void 0,onChange:oe}),[Br,ts]=l.useState(!1),{scrollIntoView:gs,targetRef:Ga,scrollableRef:fa}=S6({duration:0,offset:5,cancelable:!1,isList:!0}),ie=F&&typeof q=="function";let ue=null;const xe=x.map(Ve=>typeof Ve=="string"?{label:Ve,value:Ve}:Ve),Me=f6({data:xe}),[ye,pt]=cf({value:jj(b,x),defaultValue:jj(y,x),finalValue:[],onChange:w}),at=l.useRef(!!he&&he{if(!zt){const Ct=ye.filter(Ft=>Ft!==Ve);pt(Ct),he&&Ct.length{Lo(Ve.currentTarget.value),!se&&!at.current&&O&&Jn(!0)},wt=Ve=>{typeof R=="function"&&R(Ve),!se&&!at.current&&O&&Jn(!0)},Ge=fZ({data:Me,searchable:O,searchValue:$r,limit:G,filter:K,value:ye,disableSelectedItemFiltering:Te});ie&&pe($r,Me)&&(ue=q($r),Ge.push({label:$r,value:$r,creatable:!0}));const Ee=Math.min(Mn,Ge.length-1),et=(Ve,Ct,Ft)=>{let Qt=Ve;for(;Ft(Qt);)if(Qt=Ct(Qt),!Ge[Qt].disabled)return Qt;return Ve};oa(()=>{Fr(En&&$r?0:-1)},[$r,En]),oa(()=>{!se&&ye.length>x.length&&Jn(!1),he&&ye.length=he&&(at.current=!0,Jn(!1))},[ye]);const Et=Ve=>{if(!zt)if(X&&Lo(""),ye.includes(Ve.value))Kt(Ve.value);else{if(Ve.creatable&&typeof W=="function"){const Ct=W(Ve.value);typeof Ct<"u"&&Ct!==null&&pt(typeof Ct=="string"?[...ye,Ct]:[...ye,Ct.value])}else pt([...ye,Ve.value]);ye.length===he-1&&(at.current=!0,Jn(!1)),Ge.length===1&&Jn(!1)}},$t=Ve=>{typeof D=="function"&&D(Ve),ht&&Ge[Ee]&&$n&&Et(Ge[Ee]),te&&Lo(""),Jn(!1)},Ut=Ve=>{if(Br||(At==null||At(Ve),zt)||Ve.key!=="Backspace"&&he&&at.current)return;const Ct=co==="column",Ft=()=>{Fr(Ln=>{var Jt;const yn=et(Ln,hn=>hn+1,hn=>hn{Fr(Ln=>{var Jt;const yn=et(Ln,hn=>hn-1,hn=>hn>0);return $n&&(Ga.current=Tr.current[(Jt=Ge[yn])==null?void 0:Jt.value],gs({alignment:Ct?"start":"end"})),yn})};switch(Ve.key){case"ArrowUp":{Ve.preventDefault(),Jn(!0),Ct?Qt():Ft();break}case"ArrowDown":{Ve.preventDefault(),Jn(!0),Ct?Ft():Qt();break}case"Enter":{Ve.preventDefault(),Ge[Ee]&&$n?Et(Ge[Ee]):Jn(!0);break}case" ":{O||(Ve.preventDefault(),Ge[Ee]&&$n?Et(Ge[Ee]):Jn(!0));break}case"Backspace":{ye.length>0&&$r.length===0&&(pt(ye.slice(0,-1)),Jn(!0),he&&(at.current=!1));break}case"Home":{if(!O){Ve.preventDefault(),$n||Jn(!0);const Ln=Ge.findIndex(Jt=>!Jt.disabled);Fr(Ln),gs({alignment:Ct?"end":"start"})}break}case"End":{if(!O){Ve.preventDefault(),$n||Jn(!0);const Ln=Ge.map(Jt=>!!Jt.disabled).lastIndexOf(!1);Fr(Ln),gs({alignment:Ct?"end":"start"})}break}case"Escape":Jn(!1)}},tn=ye.map(Ve=>{let Ct=Me.find(Ft=>Ft.value===Ve&&!Ft.disabled);return!Ct&&ie&&(Ct={value:Ve,label:Ve}),Ct}).filter(Ve=>!!Ve).map((Ve,Ct)=>z.createElement(S,kj(Rc({},Ve),{variant:V,disabled:se,className:ft.value,readOnly:zt,onRemove:Ft=>{Ft.preventDefault(),Ft.stopPropagation(),Kt(Ve.value)},key:Ve.value,size:d,styles:m,classNames:h,radius:ae,index:Ct}))),ln=Ve=>ye.includes(Ve),an=()=>{var Ve;Lo(""),pt([]),(Ve=dn.current)==null||Ve.focus(),he&&(at.current=!1)},Yt=!zt&&(Ge.length>0?$n:$n&&!!A);return oa(()=>{const Ve=Yt?ge:J;typeof Ve=="function"&&Ve()},[Yt]),z.createElement(Su.Wrapper,Rc(Rc({required:s,id:ir,label:i,error:p,description:c,size:d,className:r,style:o,classNames:h,styles:m,__staticSelector:"MultiSelect",sx:U,errorProps:Pt,descriptionProps:Se,labelProps:jt,inputContainer:lt,inputWrapperOrder:Rt,unstyled:ke,withAsterisk:Re,variant:V},ar),g),z.createElement(Yi,{opened:Yt,transitionProps:_,shadow:"sm",withinPortal:de,portalProps:_e,__staticSelector:"MultiSelect",onDirectionChange:Nr,switchDirectionOnFlip:Pe,zIndex:ze,dropdownPosition:qt,positionDependencies:[...it,$r],classNames:h,styles:m,unstyled:ke,variant:V},z.createElement(Yi.Target,null,z.createElement("div",{className:ft.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":$n&&Yt?`${ir}-items`:null,"aria-controls":ir,"aria-expanded":$n,onMouseLeave:()=>Fr(-1),tabIndex:-1},z.createElement("input",{type:"hidden",name:Je,value:ye.join(","),form:Fe,disabled:se}),z.createElement(Su,Rc({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:V,disabled:se,error:p,required:s,radius:ae,icon:B,unstyled:ke,onMouseDown:Ve=>{var Ct;Ve.preventDefault(),!se&&!at.current&&Jn(!$n),(Ct=dn.current)==null||Ct.focus()},classNames:kj(Rc({},h),{input:tt({[ft.input]:!O},h==null?void 0:h.input)})},IM({theme:en,rightSection:Y,rightSectionWidth:$,styles:m,size:d,shouldClear:Z&&ye.length>0,onClear:an,error:p,disabled:se,clearButtonProps:Qe,readOnly:zt})),z.createElement("div",{className:ft.values,"data-clearable":Z||void 0},tn,z.createElement("input",Rc({ref:Kf(t,dn),type:"search",id:ir,className:tt(ft.searchInput,{[ft.searchInputPointer]:!O,[ft.searchInputInputHidden]:!$n&&ye.length>0||!O&&ye.length>0,[ft.searchInputEmpty]:ye.length===0}),onKeyDown:Ut,value:$r,onChange:gt,onFocus:wt,onBlur:$t,readOnly:!O||at.current||zt,placeholder:ye.length===0?T:void 0,disabled:se,"data-mantine-stop-propagation":$n,autoComplete:"off",onCompositionStart:()=>ts(!0),onCompositionEnd:()=>ts(!1)},vn)))))),z.createElement(Yi.Dropdown,{component:ee||t0,maxHeight:M,direction:co,id:ir,innerRef:fa,__staticSelector:"MultiSelect",classNames:h,styles:m},z.createElement(qy,{data:Ge,hovered:Ee,classNames:h,styles:m,uuid:ir,__staticSelector:"MultiSelect",onItemHover:Fr,onItemSelect:Et,itemsRefs:Tr,itemComponent:j,size:d,nothingFound:A,isItemSelected:ln,creatable:F&&!!ue,createLabel:ue,unstyled:ke,variant:V}))))});MM.displayName="@mantine/core/MultiSelect";var VZ=Object.defineProperty,UZ=Object.defineProperties,GZ=Object.getOwnPropertyDescriptors,Um=Object.getOwnPropertySymbols,OM=Object.prototype.hasOwnProperty,AM=Object.prototype.propertyIsEnumerable,_j=(e,t,n)=>t in e?VZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y1=(e,t)=>{for(var n in t||(t={}))OM.call(t,n)&&_j(e,n,t[n]);if(Um)for(var n of Um(t))AM.call(t,n)&&_j(e,n,t[n]);return e},qZ=(e,t)=>UZ(e,GZ(t)),KZ=(e,t)=>{var n={};for(var r in e)OM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Um)for(var r of Um(e))t.indexOf(r)<0&&AM.call(e,r)&&(n[r]=e[r]);return n};const QZ={type:"text",size:"sm",__staticSelector:"TextInput"},RM=l.forwardRef((e,t)=>{const n=ZE("TextInput",QZ,e),{inputProps:r,wrapperProps:o}=n,s=KZ(n,["inputProps","wrapperProps"]);return z.createElement(Su.Wrapper,y1({},o),z.createElement(Su,qZ(y1(y1({},r),s),{ref:t})))});RM.displayName="@mantine/core/TextInput";function XZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const c=s!=null&&e.find(p=>p.value===s)||null;if(c&&!i&&(c==null?void 0:c.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(c),h=p+n,m=h-e.length;return m>0?e.slice(p-m):e.slice(p,h)}return e}const d=[];for(let p=0;p=n));p+=1);return d}var YZ=ko(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const JZ=YZ;var ZZ=Object.defineProperty,eee=Object.defineProperties,tee=Object.getOwnPropertyDescriptors,Gm=Object.getOwnPropertySymbols,DM=Object.prototype.hasOwnProperty,TM=Object.prototype.propertyIsEnumerable,Ij=(e,t,n)=>t in e?ZZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wd=(e,t)=>{for(var n in t||(t={}))DM.call(t,n)&&Ij(e,n,t[n]);if(Gm)for(var n of Gm(t))TM.call(t,n)&&Ij(e,n,t[n]);return e},C1=(e,t)=>eee(e,tee(t)),nee=(e,t)=>{var n={};for(var r in e)DM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gm)for(var r of Gm(e))t.indexOf(r)<0&&TM.call(e,r)&&(n[r]=e[r]);return n};function ree(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function oee(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const see={required:!1,size:"sm",shadow:"sm",itemComponent:Ky,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:ree,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:oee,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Vy("popover"),positionDependencies:[],dropdownPosition:"flip"},i2=l.forwardRef((e,t)=>{const n=ZE("Select",see,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:c,defaultValue:d,onChange:p,itemComponent:h,onKeyDown:m,onBlur:g,onFocus:b,transitionProps:y,initiallyOpened:x,unstyled:w,classNames:S,styles:j,filter:I,maxDropdownHeight:_,searchable:M,clearable:E,nothingFound:A,limit:R,disabled:D,onSearchChange:O,searchValue:T,rightSection:K,rightSectionWidth:G,creatable:X,getCreateLabel:Z,shouldCreate:te,selectOnBlur:V,onCreate:oe,dropdownComponent:ne,onDropdownClose:se,onDropdownOpen:re,withinPortal:ae,portalProps:B,switchDirectionOnFlip:Y,zIndex:$,name:F,dropdownPosition:q,allowDeselect:pe,placeholder:W,filterDataOnExactSearchMatch:U,form:ee,positionDependencies:J,readOnly:ge,clearButtonProps:he,hoverOnSearchChange:de}=n,_e=nee(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:Pe,cx:ze,theme:ht}=JZ(),[Je,qt]=l.useState(x),[Pt,jt]=l.useState(-1),Se=l.useRef(),Fe=l.useRef({}),[it,At]=l.useState("column"),ke=it==="column",{scrollIntoView:lt,targetRef:Rt,scrollableRef:zt}=S6({duration:0,offset:5,cancelable:!1,isList:!0}),Re=pe===void 0?E:pe,Qe=ue=>{if(Je!==ue){qt(ue);const xe=ue?re:se;typeof xe=="function"&&xe()}},En=X&&typeof Z=="function";let Te=null;const ct=i.map(ue=>typeof ue=="string"?{label:ue,value:ue}:ue),ft=f6({data:ct}),[tt,en,ar]=cf({value:c,defaultValue:d,finalValue:null,onChange:p}),vn=ft.find(ue=>ue.value===tt),[dn,Tr]=cf({value:T,defaultValue:(vn==null?void 0:vn.label)||"",finalValue:void 0,onChange:O}),ir=ue=>{Tr(ue),M&&typeof O=="function"&&O(ue)},$n=()=>{var ue;ge||(en(null),ar||ir(""),(ue=Se.current)==null||ue.focus())};l.useEffect(()=>{const ue=ft.find(xe=>xe.value===tt);ue?ir(ue.label):(!En||!tt)&&ir("")},[tt]),l.useEffect(()=>{vn&&(!M||!Je)&&ir(vn.label)},[vn==null?void 0:vn.label]);const Jn=ue=>{if(!ge)if(Re&&(vn==null?void 0:vn.value)===ue.value)en(null),Qe(!1);else{if(ue.creatable&&typeof oe=="function"){const xe=oe(ue.value);typeof xe<"u"&&xe!==null&&en(typeof xe=="string"?xe:xe.value)}else en(ue.value);ar||ir(ue.label),jt(-1),Qe(!1),Se.current.focus()}},Mn=XZ({data:ft,searchable:M,limit:R,searchValue:dn,filter:I,filterDataOnExactSearchMatch:U,value:tt});En&&te(dn,Mn)&&(Te=Z(dn),Mn.push({label:dn,value:dn,creatable:!0}));const Fr=(ue,xe,Me)=>{let ye=ue;for(;Me(ye);)if(ye=xe(ye),!Mn[ye].disabled)return ye;return ue};oa(()=>{jt(de&&dn?0:-1)},[dn,de]);const co=tt?Mn.findIndex(ue=>ue.value===tt):0,Nr=!ge&&(Mn.length>0?Je:Je&&!!A),$r=()=>{jt(ue=>{var xe;const Me=Fr(ue,ye=>ye-1,ye=>ye>0);return Rt.current=Fe.current[(xe=Mn[Me])==null?void 0:xe.value],Nr&<({alignment:ke?"start":"end"}),Me})},Lo=()=>{jt(ue=>{var xe;const Me=Fr(ue,ye=>ye+1,ye=>yewindow.setTimeout(()=>{var ue;Rt.current=Fe.current[(ue=Mn[co])==null?void 0:ue.value],lt({alignment:ke?"end":"start"})},50);oa(()=>{Nr&&Br()},[Nr]);const ts=ue=>{switch(typeof m=="function"&&m(ue),ue.key){case"ArrowUp":{ue.preventDefault(),Je?ke?$r():Lo():(jt(co),Qe(!0),Br());break}case"ArrowDown":{ue.preventDefault(),Je?ke?Lo():$r():(jt(co),Qe(!0),Br());break}case"Home":{if(!M){ue.preventDefault(),Je||Qe(!0);const xe=Mn.findIndex(Me=>!Me.disabled);jt(xe),Nr&<({alignment:ke?"end":"start"})}break}case"End":{if(!M){ue.preventDefault(),Je||Qe(!0);const xe=Mn.map(Me=>!!Me.disabled).lastIndexOf(!1);jt(xe),Nr&<({alignment:ke?"end":"start"})}break}case"Escape":{ue.preventDefault(),Qe(!1),jt(-1);break}case" ":{M||(ue.preventDefault(),Mn[Pt]&&Je?Jn(Mn[Pt]):(Qe(!0),jt(co),Br()));break}case"Enter":M||ue.preventDefault(),Mn[Pt]&&Je&&(ue.preventDefault(),Jn(Mn[Pt]))}},gs=ue=>{typeof g=="function"&&g(ue);const xe=ft.find(Me=>Me.value===tt);V&&Mn[Pt]&&Je&&Jn(Mn[Pt]),ir((xe==null?void 0:xe.label)||""),Qe(!1)},Ga=ue=>{typeof b=="function"&&b(ue),M&&Qe(!0)},fa=ue=>{ge||(ir(ue.currentTarget.value),E&&ue.currentTarget.value===""&&en(null),jt(-1),Qe(!0))},ie=()=>{ge||(Qe(!Je),tt&&!Je&&jt(co))};return z.createElement(Su.Wrapper,C1(wd({},o),{__staticSelector:"Select"}),z.createElement(Yi,{opened:Nr,transitionProps:y,shadow:s,withinPortal:ae,portalProps:B,__staticSelector:"Select",onDirectionChange:At,switchDirectionOnFlip:Y,zIndex:$,dropdownPosition:q,positionDependencies:[...J,dn],classNames:S,styles:j,unstyled:w,variant:r.variant},z.createElement(Yi.Target,null,z.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":Nr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":Nr,onMouseLeave:()=>jt(-1),tabIndex:-1},z.createElement("input",{type:"hidden",name:F,value:tt||"",form:ee,disabled:D}),z.createElement(Su,wd(C1(wd(wd({autoComplete:"off",type:"search"},r),_e),{ref:Kf(t,Se),onKeyDown:ts,__staticSelector:"Select",value:dn,placeholder:W,onChange:fa,"aria-autocomplete":"list","aria-controls":Nr?`${r.id}-items`:null,"aria-activedescendant":Pt>=0?`${r.id}-${Pt}`:null,onMouseDown:ie,onBlur:gs,onFocus:Ga,readOnly:!M||ge,disabled:D,"data-mantine-stop-propagation":Nr,name:null,classNames:C1(wd({},S),{input:ze({[Pe.input]:!M},S==null?void 0:S.input)})}),IM({theme:ht,rightSection:K,rightSectionWidth:G,styles:j,size:r.size,shouldClear:E&&!!vn,onClear:$n,error:o.error,clearButtonProps:he,disabled:D,readOnly:ge}))))),z.createElement(Yi.Dropdown,{component:ne||t0,maxHeight:_,direction:it,id:r.id,innerRef:zt,__staticSelector:"Select",classNames:S,styles:j},z.createElement(qy,{data:Mn,hovered:Pt,classNames:S,styles:j,isItemSelected:ue=>ue===tt,uuid:r.id,__staticSelector:"Select",onItemHover:jt,onItemSelect:Jn,itemsRefs:Fe,itemComponent:h,size:r.size,nothingFound:A,creatable:En&&!!Te,createLabel:Te,"aria-label":o.label,unstyled:w,variant:r.variant}))))});i2.displayName="@mantine/core/Select";const Jf=()=>{const[e,t,n,r,o,s,i,c,d,p,h,m,g,b,y,x,w,S,j,I,_,M,E,A,R,D,O,T,K,G,X,Z,te,V,oe,ne,se,re,ae,B,Y,$,F,q,pe,W,U,ee,J,ge,he,de,_e,Pe,ze,ht,Je,qt,Pt,jt,Se,Fe,it,At,ke,lt,Rt,zt,Re,Qe,En,Te,ct,ft,tt,en]=ea("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:c,base450:d,base500:p,base550:h,base600:m,base650:g,base700:b,base750:y,base800:x,base850:w,base900:S,base950:j,accent50:I,accent100:_,accent150:M,accent200:E,accent250:A,accent300:R,accent350:D,accent400:O,accent450:T,accent500:K,accent550:G,accent600:X,accent650:Z,accent700:te,accent750:V,accent800:oe,accent850:ne,accent900:se,accent950:re,baseAlpha50:ae,baseAlpha100:B,baseAlpha150:Y,baseAlpha200:$,baseAlpha250:F,baseAlpha300:q,baseAlpha350:pe,baseAlpha400:W,baseAlpha450:U,baseAlpha500:ee,baseAlpha550:J,baseAlpha600:ge,baseAlpha650:he,baseAlpha700:de,baseAlpha750:_e,baseAlpha800:Pe,baseAlpha850:ze,baseAlpha900:ht,baseAlpha950:Je,accentAlpha50:qt,accentAlpha100:Pt,accentAlpha150:jt,accentAlpha200:Se,accentAlpha250:Fe,accentAlpha300:it,accentAlpha350:At,accentAlpha400:ke,accentAlpha450:lt,accentAlpha500:Rt,accentAlpha550:zt,accentAlpha600:Re,accentAlpha650:Qe,accentAlpha700:En,accentAlpha750:Te,accentAlpha800:ct,accentAlpha850:ft,accentAlpha900:tt,accentAlpha950:en}},Xe=(e,t)=>n=>n==="light"?e:t,NM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Jf(),{colorMode:x}=ji(),[w]=ea("shadows",["dark-lg"]),[S,j,I]=ea("space",[1,2,6]),[_]=ea("radii",["base"]),[M]=ea("lineHeights",["base"]);return l.useCallback(()=>({label:{color:Xe(c,r)(x)},separatorLabel:{color:Xe(s,s)(x),"::after":{borderTopColor:Xe(r,c)(x)}},input:{border:"unset",backgroundColor:Xe(e,p)(x),borderRadius:_,borderStyle:"solid",borderWidth:"2px",borderColor:Xe(n,d)(x),color:Xe(p,t)(x),minHeight:"unset",lineHeight:M,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:I,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Xe(r,i)(x)},"&:focus":{borderColor:Xe(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Xe(o,s)(x)},"&:focus-within":{borderColor:Xe(h,y)(x)},"&[data-disabled]":{backgroundColor:Xe(r,c)(x),color:Xe(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Xe(t,p)(x),color:Xe(p,t)(x),button:{color:Xe(p,t)(x)},"&:hover":{backgroundColor:Xe(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Xe(n,d)(x),borderColor:Xe(n,d)(x),boxShadow:w},item:{backgroundColor:Xe(n,d)(x),color:Xe(d,n)(x),padding:6,"&[data-hovered]":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)},"&[data-active]":{backgroundColor:Xe(r,c)(x),"&:hover":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)}},"&[data-selected]":{backgroundColor:Xe(g,y)(x),color:Xe(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Xe(b,b)(x),color:Xe("white",e)(x)}},"&[data-disabled]":{color:Xe(s,i)(x),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Xe(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,w,x,M,_,S,j,I])},$M=De((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:c,...d}=e,p=le(),[h,m]=l.useState(""),g=l.useCallback(w=>{w.shiftKey&&p(Qo(!0))},[p]),b=l.useCallback(w=>{w.shiftKey||p(Qo(!1))},[p]),y=l.useCallback(w=>{s&&s(w)},[s]),x=NM();return a.jsx(Wn,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Vn,{ref:t,isDisabled:c,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(yr,{children:i}),a.jsx(i2,{ref:o,disabled:c,searchValue:h,onSearchChange:m,onChange:y,onKeyDown:g,onKeyUp:b,searchable:n,maxDropdownHeight:300,styles:x,...d})]})})});$M.displayName="IAIMantineSearchableSelect";const sr=l.memo($M),aee=me([we],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},Ie),iee=()=>{const e=le(),[t,n]=l.useState(),{data:r,isFetching:o}=jf(),{imagesToChange:s,isModalOpen:i}=H(aee),[c]=kD(),[d]=jD(),{t:p}=Q(),h=l.useMemo(()=>{const x=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(w=>x.push({label:w.board_name,value:w.board_id})),x},[r,p]),m=l.useCallback(()=>{e(Hw()),e(Ax(!1))},[e]),g=l.useCallback(()=>{!s.length||!t||(t==="none"?d({imageDTOs:s}):c({imageDTOs:s,board_id:t}),n(null),e(Hw()))},[c,e,s,d,t]),b=l.useCallback(x=>n(x),[]),y=l.useRef(null);return a.jsx(Wf,{isOpen:i,onClose:m,leastDestructiveRef:y,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Ra,{children:a.jsxs(N,{sx:{flexDir:"column",gap:4},children:[a.jsxs(je,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(sr,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:b,value:t,data:h})]})}),a.jsxs(pi,{children:[a.jsx(Dt,{ref:y,onClick:m,children:p("boards.cancel")}),a.jsx(Dt,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},lee=l.memo(iee),LM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:c,...d}=e;return a.jsx(Wn,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Vn,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(N,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(N,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(yr,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(Fy,{...d})]}),c&&a.jsx(WP,{children:a.jsx(je,{variant:"subtext",children:c})})]})})})};LM.displayName="IAISwitch";const _r=l.memo(LM),cee=e=>{const{t}=Q(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!ta(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(je,{children:r}),a.jsxs(zf,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(Ps,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(Ps,{children:t("common.unifiedCanvas")}),n.isControlImage&&a.jsx(Ps,{children:t("common.controlNet")}),n.isNodesImage&&a.jsx(Ps,{children:t("common.nodeEditor")})]}),a.jsx(je,{children:o})]})},zM=l.memo(cee),uee=me([we,_D],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:c,isModalOpen:d}=o,p=(c??[]).map(({image_name:m})=>MI(e,m)),h={isInitialImage:ta(p,m=>m.isInitialImage),isCanvasImage:ta(p,m=>m.isCanvasImage),isNodesImage:ta(p,m=>m.isNodesImage),isControlImage:ta(p,m=>m.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:c,imagesUsage:t,isModalOpen:d,imageUsageSummary:h}},Ie),dee=()=>{const e=le(),{t}=Q(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:c}=H(uee),d=l.useCallback(g=>e(OI(!g.target.checked)),[e]),p=l.useCallback(()=>{e(Ww()),e(ID(!1))},[e]),h=l.useCallback(()=>{!o.length||!s.length||(e(Ww()),e(PD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),m=l.useRef(null);return a.jsx(Wf,{isOpen:i,onClose:p,leastDestructiveRef:m,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Ra,{children:a.jsxs(N,{direction:"column",gap:3,children:[a.jsx(zM,{imageUsage:c}),a.jsx(io,{}),a.jsx(je,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(je,{children:t("common.areYouSure")}),a.jsx(_r,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:d})]})}),a.jsxs(pi,{children:[a.jsx(Dt,{ref:m,onClick:p,children:"Cancel"}),a.jsx(Dt,{colorScheme:"error",onClick:h,ml:3,children:"Delete"})]})]})})})},fee=l.memo(dee),FM=De((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Wn,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(Ia,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});FM.displayName="IAIIconButton";const rt=l.memo(FM);var BM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Pj=z.createContext&&z.createContext(BM),Ji=globalThis&&globalThis.__assign||function(){return Ji=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=H(i=>i.config.disabledTabs),n=H(i=>i.config.disabledFeatures),r=H(i=>i.config.disabledSDFeatures),o=l.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=l.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function ete(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(rl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(rl,{children:[a.jsx(je,{fontWeight:600,children:t}),r&&a.jsx(je,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Le,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function tte({children:e}){const{isOpen:t,onOpen:n,onClose:r}=hs(),{t:o}=Q(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],c=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],d=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],h=m=>a.jsx(N,{flexDir:"column",gap:4,children:m.map((g,b)=>a.jsxs(N,{flexDir:"column",px:2,gap:4,children:[a.jsx(ete,{title:g.title,description:g.desc,hotkey:g.hotkey}),b{const{data:t}=ED(),n=l.useRef(null),r=rO(n);return a.jsxs(N,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(_i,{src:Rx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(N,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(je,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(So,{children:e&&r&&t&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(je,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},cte=l.memo(lte),oO=De((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...c}=e,d=NM();return a.jsx(Wn,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Vn,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(yr,{children:o}),a.jsx(i2,{disabled:s,ref:r,styles:d,...c})]})})});oO.displayName="IAIMantineSelect";const Dr=l.memo(oO),ute={ar:fn.t("common.langArabic",{lng:"ar"}),nl:fn.t("common.langDutch",{lng:"nl"}),en:fn.t("common.langEnglish",{lng:"en"}),fr:fn.t("common.langFrench",{lng:"fr"}),de:fn.t("common.langGerman",{lng:"de"}),he:fn.t("common.langHebrew",{lng:"he"}),it:fn.t("common.langItalian",{lng:"it"}),ja:fn.t("common.langJapanese",{lng:"ja"}),ko:fn.t("common.langKorean",{lng:"ko"}),pl:fn.t("common.langPolish",{lng:"pl"}),pt_BR:fn.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:fn.t("common.langPortuguese",{lng:"pt"}),ru:fn.t("common.langRussian",{lng:"ru"}),zh_CN:fn.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:fn.t("common.langSpanish",{lng:"es"}),uk:fn.t("common.langUkranian",{lng:"ua"})},dte={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},sO=me(we,({system:e})=>e.language,Ie);function Xs(e){const{t}=Q(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...c}=e;return a.jsxs(N,{justifyContent:"space-between",py:1,children:[a.jsxs(N,{gap:2,alignItems:"center",children:[a.jsx(je,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Va,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(_r,{...c})]})}const fte=e=>a.jsx(N,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Bc=l.memo(fte);function pte(){const{t:e}=Q(),t=le(),{data:n}=MD(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=OD(),{data:s}=Ha(),i=s&&(s.queue.in_progress>0||s.queue.pending>0),c=l.useCallback(()=>{i||r().unwrap().then(d=>{t(AI()),t(RI()),t(Ht({title:e("settings.intermediatesCleared",{count:d}),status:"info"}))}).catch(()=>{t(Ht({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,i]);return a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Dt,{tooltip:i?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:c,isLoading:o,isDisabled:!n||i,children:e("settings.clearIntermediatesWithCount",{count:n??0})}),a.jsx(je,{fontWeight:"bold",children:e("settings.clearIntermediatesDesc1")}),a.jsx(je,{variant:"subtext",children:e("settings.clearIntermediatesDesc2")}),a.jsx(je,{variant:"subtext",children:e("settings.clearIntermediatesDesc3")})]})}const hte=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Jf(),{colorMode:x}=ji(),[w]=ea("shadows",["dark-lg"]);return l.useCallback(()=>({label:{color:Xe(c,r)(x)},separatorLabel:{color:Xe(s,s)(x),"::after":{borderTopColor:Xe(r,c)(x)}},searchInput:{":placeholder":{color:Xe(r,c)(x)}},input:{backgroundColor:Xe(e,p)(x),borderWidth:"2px",borderColor:Xe(n,d)(x),color:Xe(p,t)(x),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Xe(r,i)(x)},"&:focus":{borderColor:Xe(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Xe(o,s)(x)},"&:focus-within":{borderColor:Xe(h,y)(x)},"&[data-disabled]":{backgroundColor:Xe(r,c)(x),color:Xe(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Xe(n,d)(x),color:Xe(p,t)(x),button:{color:Xe(p,t)(x)},"&:hover":{backgroundColor:Xe(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Xe(n,d)(x),borderColor:Xe(n,d)(x),boxShadow:w},item:{backgroundColor:Xe(n,d)(x),color:Xe(d,n)(x),padding:6,"&[data-hovered]":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)},"&[data-active]":{backgroundColor:Xe(r,c)(x),"&:hover":{color:Xe(p,t)(x),backgroundColor:Xe(r,c)(x)}},"&[data-selected]":{backgroundColor:Xe(g,y)(x),color:Xe(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Xe(b,b)(x),color:Xe("white",e)(x)}},"&[data-disabled]":{color:Xe(s,i)(x),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Xe(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,w,x])},aO=De((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...c}=e,d=le(),p=l.useCallback(g=>{g.shiftKey&&d(Qo(!0))},[d]),h=l.useCallback(g=>{g.shiftKey||d(Qo(!1))},[d]),m=hte();return a.jsx(Wn,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Vn,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(yr,{children:s}),a.jsx(MM,{ref:o,disabled:i,onKeyDown:p,onKeyUp:h,searchable:n,maxDropdownHeight:300,styles:m,...c})]})})});aO.displayName="IAIMantineMultiSelect";const mte=l.memo(aO),gte=To(hg,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function vte(){const e=le(),{t}=Q(),n=H(o=>o.ui.favoriteSchedulers),r=l.useCallback(o=>{e(AD(o))},[e]);return a.jsx(mte,{label:t("settings.favoriteSchedulers"),value:n,data:gte,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const bte=me([we],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:h,shouldShowProgressInViewer:m,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:h,shouldShowProgressInViewer:m,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Nn}}),xte=({children:e,config:t})=>{const n=le(),{t:r}=Q(),[o,s]=l.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,c=(t==null?void 0:t.shouldShowResetWebUiText)??!0,d=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;l.useEffect(()=>{i||n(Vw(!1))},[i,n]);const{isNSFWCheckerAvailable:h,isWatermarkerAvailable:m}=DI(void 0,{selectFromResult:({data:U})=>({isNSFWCheckerAvailable:(U==null?void 0:U.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(U==null?void 0:U.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:b,onClose:y}=hs(),{isOpen:x,onOpen:w,onClose:S}=hs(),{shouldConfirmOnDelete:j,enableImageDebugging:I,shouldUseSliders:_,shouldShowProgressInViewer:M,consoleLogLevel:E,shouldLogToConsole:A,shouldAntialiasProgressImage:R,shouldUseNSFWChecker:D,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:K}=H(bte),G=l.useCallback(()=>{Object.keys(window.localStorage).forEach(U=>{(RD.includes(U)||U.startsWith(DD))&&localStorage.removeItem(U)}),y(),w(),setInterval(()=>s(U=>U-1),1e3)},[y,w]);l.useEffect(()=>{o<=0&&window.location.reload()},[o]);const X=l.useCallback(U=>{n(TD(U))},[n]),Z=l.useCallback(U=>{n(ND(U))},[n]),te=l.useCallback(U=>{n(Vw(U.target.checked))},[n]),{colorMode:V,toggleColorMode:oe}=ji(),ne=Pn("localization").isFeatureEnabled,se=H(sO),re=l.useCallback(U=>{n(OI(U.target.checked))},[n]),ae=l.useCallback(U=>{n($D(U.target.checked))},[n]),B=l.useCallback(U=>{n(LD(U.target.checked))},[n]),Y=l.useCallback(U=>{n(zD(U.target.checked))},[n]),$=l.useCallback(U=>{n(TI(U.target.checked))},[n]),F=l.useCallback(U=>{n(FD(U.target.checked))},[n]),q=l.useCallback(U=>{n(BD(U.target.checked))},[n]),pe=l.useCallback(U=>{n(HD(U.target.checked))},[n]),W=l.useCallback(U=>{n(WD(U.target.checked))},[n]);return a.jsxs(a.Fragment,{children:[l.cloneElement(e,{onClick:b}),a.jsxs(vu,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Aa,{}),a.jsxs(bu,{children:[a.jsx(Oa,{bg:"none",children:r("common.settingsLabel")}),a.jsx(Rg,{}),a.jsx(Ra,{children:a.jsxs(N,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.general")}),a.jsx(Xs,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:re})]}),a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.generation")}),a.jsx(vte,{}),a.jsx(Xs,{label:r("settings.enableNSFWChecker"),isDisabled:!h,isChecked:D,onChange:ae}),a.jsx(Xs,{label:r("settings.enableInvisibleWatermark"),isDisabled:!m,isChecked:O,onChange:B})]}),a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.ui")}),a.jsx(Xs,{label:r("common.darkMode"),isChecked:V==="dark",onChange:oe}),a.jsx(Xs,{label:r("settings.useSlidersForAll"),isChecked:_,onChange:Y}),a.jsx(Xs,{label:r("settings.showProgressInViewer"),isChecked:M,onChange:$}),a.jsx(Xs,{label:r("settings.antialiasProgressImages"),isChecked:R,onChange:F}),a.jsx(Xs,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:q}),p&&a.jsx(Dr,{disabled:!ne,label:r("common.languagePickerLabel"),value:se,data:Object.entries(ute).map(([U,ee])=>({value:U,label:ee})),onChange:Z}),a.jsx(Xs,{label:r("settings.enableInformationalPopovers"),isChecked:K,onChange:pe})]}),i&&a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.developer")}),a.jsx(Xs,{label:r("settings.shouldLogToConsole"),isChecked:A,onChange:te}),a.jsx(Dr,{disabled:!A,label:r("settings.consoleLogLevel"),onChange:X,value:E,data:VD.concat()}),a.jsx(Xs,{label:r("settings.enableImageDebugging"),isChecked:I,onChange:W})]}),d&&a.jsx(pte,{}),a.jsxs(Bc,{children:[a.jsx(yo,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Dt,{colorScheme:"error",onClick:G,children:r("settings.resetWebUI")}),c&&a.jsxs(a.Fragment,{children:[a.jsx(je,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(je,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(pi,{children:a.jsx(Dt,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(vu,{closeOnOverlayClick:!1,isOpen:x,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Aa,{backdropFilter:"blur(40px)"}),a.jsxs(bu,{children:[a.jsx(Oa,{}),a.jsx(Ra,{children:a.jsx(N,{justifyContent:"center",children:a.jsx(je,{fontSize:"lg",children:a.jsxs(je,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(pi,{})]})]})]})},yte=l.memo(xte),Cte=me(we,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:dte[n]}},Ie),Aj={ok:"green.400",working:"yellow.400",error:"red.400"},Rj={ok:"green.600",working:"yellow.500",error:"red.500"},wte=()=>{const{isConnected:e,statusTranslationKey:t}=H(Cte),{t:n}=Q(),r=l.useRef(null),{data:o}=Ha(),s=l.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=rO(r);return a.jsxs(N,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(So,{children:i&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(je,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Rj[s],_dark:{color:Aj[s]}},children:n(t)})},"statusText")}),a.jsx(Gr,{as:jee,sx:{boxSize:"0.5rem",color:Rj[s],_dark:{color:Aj[s]}}})]})},Ste=l.memo(wte),kte=()=>{const{t:e}=Q(),t=Pn("bugLink").isFeatureEnabled,n=Pn("discordLink").isFeatureEnabled,r=Pn("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(cte,{}),a.jsx(Pi,{}),a.jsx(Ste,{}),a.jsxs(Mg,{children:[a.jsx(Og,{as:rt,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(See,{}),sx:{boxSize:8}}),a.jsxs(ql,{motionProps:fu,children:[a.jsxs(af,{title:e("common.communityLabel"),children:[r&&a.jsx(Kn,{as:"a",href:o,target:"_blank",icon:a.jsx(gee,{}),children:e("common.githubLabel")}),t&&a.jsx(Kn,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(kee,{}),children:e("common.reportBugLabel")}),n&&a.jsx(Kn,{as:"a",href:s,target:"_blank",icon:a.jsx(mee,{}),children:e("common.discordLabel")})]}),a.jsxs(af,{title:e("common.settingsLabel"),children:[a.jsx(tte,{children:a.jsx(Kn,{as:"button",icon:a.jsx(zee,{}),children:e("common.hotkeysLabel")})}),a.jsx(yte,{children:a.jsx(Kn,{as:"button",icon:a.jsx(GM,{}),children:e("common.settingsLabel")})})]})]})]})]})},jte=l.memo(kte);/*! + * OverlayScrollbars + * Version: 2.4.4 + * + * Copyright (c) Rene Haas | KingSora. + * https://github.com/KingSora + * + * Released under the MIT license. + */const Js=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const c=(h,m)=>{const g=s,b=h,y=m||(r?!r(g,b):g!==b);return(y||o)&&(s=b,i=g),[s,y,i]};return[t?h=>c(t(s,i),h):c,h=>[s,!!h,i]]},c2=typeof window<"u",iO=c2&&Node.ELEMENT_NODE,{toString:_te,hasOwnProperty:w1}=Object.prototype,Ite=/^\[object (.+)\]$/,fl=e=>e===void 0,l0=e=>e===null,Pte=e=>fl(e)||l0(e)?`${e}`:_te.call(e).replace(Ite,"$1").toLowerCase(),Ea=e=>typeof e=="number",Zf=e=>typeof e=="string",lO=e=>typeof e=="boolean",Ta=e=>typeof e=="function",$s=e=>Array.isArray(e),df=e=>typeof e=="object"&&!$s(e)&&!l0(e),c0=e=>{const t=!!e&&e.length,n=Ea(t)&&t>-1&&t%1==0;return $s(e)||!Ta(e)&&n?t>0&&df(e)?t-1 in e:!0:!1},qm=e=>{if(!e||!df(e)||Pte(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=w1.call(e,n),i=o&&w1.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return fl(t)||w1.call(e,t)},Wd=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===iO:!1},u0=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===iO:!1};function Xn(e,t){if(c0(e))for(let n=0;nt(e[n],n,e));return e}const d0=(e,t)=>e.indexOf(t)>=0,Qi=(e,t)=>e.concat(t),Qn=(e,t,n)=>(!n&&!Zf(t)&&c0(t)?Array.prototype.push.apply(e,t):e.push(t),e),Vu=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Qn(n,r)}):Xn(e,r=>{Qn(n,r)}),n)},Km=e=>!!e&&!e.length,Dj=e=>Vu(new Set(e)),Ls=(e,t,n)=>{Xn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},f0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),gi=e=>e?Object.keys(e):[],Bn=(e,t,n,r,o,s,i)=>{const c=[t,n,r,o,s,i];return(typeof e!="object"||l0(e))&&!Ta(e)&&(e={}),Xn(c,d=>{Xn(d,(p,h)=>{const m=d[h];if(e===m)return!0;const g=$s(m);if(m&&qm(m)){const b=e[h];let y=b;g&&!$s(b)?y=[]:!g&&!qm(b)&&(y={}),e[h]=Bn(y,m)}else e[h]=g?m.slice():m})}),e},cO=(e,t)=>Xn(Bn({},e),(n,r,o)=>{n===void 0?delete o[r]:t&&n&&qm(n)&&(o[r]=cO(n,t))}),u2=e=>{for(const t in e)return!1;return!0},Mo=(e,t,n)=>{if(fl(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},uO=(e,t)=>new Set((Mo(e,t)||"").split(" ")),Wo=(e,t)=>{e&&e.removeAttribute(t)},zl=(e,t,n,r)=>{if(n){const o=uO(e,t);o[r?"add":"delete"](n);const s=Vu(o).join(" ").trim();Mo(e,t,s)}},Ete=(e,t,n)=>uO(e,t).has(n),Xb=c2&&Element.prototype,dO=(e,t)=>{const n=[],r=t?u0(t)&&t:document;return r?Qn(n,r.querySelectorAll(e)):n},Mte=(e,t)=>{const n=t?u0(t)&&t:document;return n?n.querySelector(e):null},Qm=(e,t)=>u0(e)?(Xb.matches||Xb.msMatchesSelector).call(e,t):!1,Yb=e=>e?Vu(e.childNodes):[],li=e=>e&&e.parentElement,Kc=(e,t)=>{if(u0(e)){const n=Xb.closest;if(n)return n.call(e,t);do{if(Qm(e,t))return e;e=li(e)}while(e)}},Ote=(e,t,n)=>{const r=Kc(e,t),o=e&&Mte(n,r),s=Kc(o,t)===r;return r&&o?r===e||o===e||s&&Kc(Kc(e,n),t)!==r:!1},As=()=>{},ci=e=>{if(c0(e))Xn(Vu(e),t=>ci(t));else if(e){const t=li(e);t&&t.removeChild(e)}},d2=(e,t,n)=>{if(n&&e){let r=t,o;return c0(n)?(o=document.createDocumentFragment(),Xn(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null),()=>ci(n)}return As},_s=(e,t)=>d2(e,null,t),Ate=(e,t)=>d2(li(e),e,t),Tj=(e,t)=>d2(li(e),e&&e.nextSibling,t),Fl=e=>{const t=document.createElement("div");return Mo(t,"class",e),t},fO=e=>{const t=Fl();return t.innerHTML=e.trim(),Xn(Yb(t),n=>ci(n))},Yo=c2?window:{},Vd=Math.max,Rte=Math.min,ff=Math.round,pO=Yo.cancelAnimationFrame,hO=Yo.requestAnimationFrame,Xm=Yo.setTimeout,Jb=Yo.clearTimeout,Zb=e=>e.charAt(0).toUpperCase()+e.slice(1),Dte=()=>Fl().style,Tte=["-webkit-","-moz-","-o-","-ms-"],Nte=["WebKit","Moz","O","MS","webkit","moz","o","ms"],S1={},k1={},$te=e=>{let t=k1[e];if(f0(k1,e))return t;const n=Zb(e),r=Dte();return Xn(Tte,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Zb(s)+n].find(c=>r[c]!==void 0))}),k1[e]=t||""},p0=e=>{let t=S1[e]||Yo[e];return f0(S1,e)||(Xn(Nte,n=>(t=t||Yo[n+Zb(e)],!t)),S1[e]=t),t},Lte=p0("MutationObserver"),Nj=p0("IntersectionObserver"),Ym=p0("ResizeObserver"),ex=p0("ScrollTimeline"),Gt=(e,...t)=>e.bind(0,...t),El=e=>{let t;const n=e?Xm:hO,r=e?Jb:pO;return[o=>{r(t),t=n(o,Ta(e)?e():e)},()=>r(t)]},mO=(e,t)=>{let n,r,o,s=As;const{v:i,p:c,g:d}=t||{},p=function(y){s(),Jb(n),n=r=void 0,s=As,e.apply(this,y)},h=b=>d&&r?d(r,b):b,m=()=>{s!==As&&p(h(o)||o)},g=function(){const y=Vu(arguments),x=Ta(i)?i():i;if(Ea(x)&&x>=0){const S=Ta(c)?c():c,j=Ea(S)&&S>=0,I=x>0?Xm:hO,_=x>0?Jb:pO,E=h(y)||y,A=p.bind(0,E);s();const R=I(A,x);s=()=>_(R),j&&!n&&(n=Xm(m,S)),r=o=E}else p(y)};return g.m=m,g},zte=/[^\x20\t\r\n\f]+/g,gO=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&Zf(t)){const c=t.match(zte)||[];for(i=c.length>0;o=c[s++];)i=!!n(r,o)&&i}return i},f2=(e,t)=>{gO(e,t,(n,r)=>n.remove(r))},al=(e,t)=>(gO(e,t,(n,r)=>n.add(r)),Gt(f2,e,t)),Fte={opacity:1,zIndex:1},vh=(e,t)=>{const n=e||"",r=t?parseFloat(n):parseInt(n,10);return r===r?r:0},Bte=(e,t)=>!Fte[e]&&Ea(t)?`${t}px`:t,$j=(e,t,n)=>String((t!=null?t[n]||t.getPropertyValue(n):e.style[n])||""),Hte=(e,t,n)=>{try{const{style:r}=e;fl(r[t])?r.setProperty(t,n):r[t]=Bte(t,n)}catch{}};function Co(e,t){const n=Zf(t);if($s(t)||n){let o=n?"":{};if(e){const s=Yo.getComputedStyle(e,null);o=n?$j(e,s,t):t.reduce((i,c)=>(i[c]=$j(e,s,c),i),o)}return o}e&&Xn(t,(o,s)=>Hte(e,s,t[s]))}const pf=e=>Co(e,"direction")==="rtl",Lj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,c=`${r}bottom${o}`,d=`${r}left${o}`,p=Co(e,[s,i,c,d]);return{t:vh(p[s],!0),r:vh(p[i],!0),b:vh(p[c],!0),l:vh(p[d],!0)}},Dc=(e,t)=>`translate${df(e)?`(${e.x},${e.y})`:`${t?"X":"Y"}(${e})`}`,vO="paddingTop",p2="paddingRight",h2="paddingLeft",Jm="paddingBottom",Zm="marginLeft",eg="marginRight",Ud="marginBottom",Ad="overflowX",Rd="overflowY",vi="width",bi="height",ju="hidden",Wte={w:0,h:0},h0=(e,t)=>t?{w:t[`${e}Width`],h:t[`${e}Height`]}:Wte,Vte=e=>h0("inner",e||Yo),Gd=Gt(h0,"offset"),$h=Gt(h0,"client"),tg=Gt(h0,"scroll"),ng=e=>{const t=parseFloat(Co(e,vi))||0,n=parseFloat(Co(e,bi))||0;return{w:t-ff(t),h:n-ff(n)}},ka=e=>e.getBoundingClientRect(),tx=e=>!!(e&&(e[bi]||e[vi])),bO=(e,t)=>{const n=tx(e);return!tx(t)&&n},m0=(e,t,n,r)=>{if(e&&t){let o=!0;return Xn(n,s=>{const i=r?r(e[s]):e[s],c=r?r(t[s]):t[s];i!==c&&(o=!1)}),o}return!1},xO=(e,t)=>m0(e,t,["w","h"]),yO=(e,t)=>m0(e,t,["x","y"]),Ute=(e,t)=>m0(e,t,["t","r","b","l"]),zj=(e,t,n)=>m0(e,t,[vi,bi],n&&(r=>ff(r)));let bh;const Fj="passive",Gte=()=>{if(fl(bh)){bh=!1;try{Yo.addEventListener(Fj,As,Object.defineProperty({},Fj,{get(){bh=!0}}))}catch{}}return bh},CO=e=>e.split(" "),Bj=(e,t,n,r)=>{Xn(CO(t),o=>{e.removeEventListener(o,n,r)})},Ur=(e,t,n,r)=>{var o;const s=Gte(),i=(o=s&&r&&r.S)!=null?o:s,c=r&&r.$||!1,d=r&&r.O||!1,p=s?{passive:i,capture:c}:c;return Gt(Ls,CO(t).map(h=>{const m=d?g=>{Bj(e,h,m,c),n(g)}:n;return e.addEventListener(h,m,p),Gt(Bj,e,h,m,c)}))},wO=e=>e.stopPropagation(),Hj=e=>e.preventDefault(),qte={x:0,y:0},j1=e=>{const t=e&&ka(e);return t?{x:t.left+Yo.pageYOffset,y:t.top+Yo.pageXOffset}:qte},SO=(e,t,n)=>n?n.n?-e:n.i?t-e:e:e,Kte=(e,t)=>[t&&t.i?e:0,SO(e,e,t)],Yl=(e,t)=>{const{x:n,y:r}=Ea(t)?{x:t,y:t}:t||{};Ea(n)&&(e.scrollLeft=n),Ea(r)&&(e.scrollTop=r)},g0=e=>({x:e.scrollLeft,y:e.scrollTop}),Wj=(e,t)=>{Xn($s(t)?t:[t],e)},nx=e=>{const t=new Map,n=(s,i)=>{if(s){const c=t.get(s);Wj(d=>{c&&c[d?"delete":"clear"](d)},i)}else t.forEach(c=>{c.clear()}),t.clear()},r=(s,i)=>{if(Zf(s)){const p=t.get(s)||new Set;return t.set(s,p),Wj(h=>{Ta(h)&&p.add(h)},i),Gt(n,s,i)}lO(i)&&i&&n();const c=gi(s),d=[];return Xn(c,p=>{const h=s[p];h&&Qn(d,r(p,h))}),Gt(Ls,d)},o=(s,i)=>{Xn(Vu(t.get(s)),c=>{i&&!Km(i)?c.apply(0,i):c()})};return r(e||{}),[r,n,o]},Vj=e=>JSON.stringify(e,(t,n)=>{if(Ta(n))throw 0;return n}),Uj=(e,t)=>e?`${t}`.split(".").reduce((n,r)=>n&&f0(n,r)?n[r]:void 0,e):void 0,Qte={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,autoHideSuspend:!1,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},kO=(e,t)=>{const n={},r=Qi(gi(t),gi(e));return Xn(r,o=>{const s=e[o],i=t[o];if(df(s)&&df(i))Bn(n[o]={},kO(s,i)),u2(n[o])&&delete n[o];else if(f0(t,o)&&i!==s){let c=!0;if($s(s)||$s(i))try{Vj(s)===Vj(i)&&(c=!1)}catch{}c&&(n[o]=i)}}),n},Xte=(e,t,n)=>r=>[Uj(e,r),n||Uj(t,r)!==void 0],ep="data-overlayscrollbars",jO="os-environment",_O=`${jO}-flexbox-glue`,Yte=`${_O}-max`,IO="os-scrollbar-hidden",_1=`${ep}-initialize`,Zs=ep,PO=`${Zs}-overflow-x`,EO=`${Zs}-overflow-y`,lu="overflowVisible",Jte="scrollbarHidden",Gj="scrollbarPressed",rg="updating",Ui=`${ep}-viewport`,I1="arrange",MO="scrollbarHidden",cu=lu,rx=`${ep}-padding`,Zte=cu,qj=`${ep}-content`,m2="os-size-observer",ene=`${m2}-appear`,tne=`${m2}-listener`,nne="os-trinsic-observer",rne="os-no-css-vars",one="os-theme-none",es="os-scrollbar",sne=`${es}-rtl`,ane=`${es}-horizontal`,ine=`${es}-vertical`,OO=`${es}-track`,g2=`${es}-handle`,lne=`${es}-visible`,cne=`${es}-cornerless`,Kj=`${es}-transitionless`,Qj=`${es}-interaction`,Xj=`${es}-unusable`,ox=`${es}-auto-hide`,Yj=`${ox}-hidden`,Jj=`${es}-wheel`,une=`${OO}-interactive`,dne=`${g2}-interactive`,AO={},RO={},fne=e=>{Xn(e,t=>Xn(t,(n,r)=>{AO[r]=t[r]}))},DO=(e,t,n)=>gi(e).map(r=>{const{static:o,instance:s}=e[r],[i,c,d]=n||[],p=n?s:o;if(p){const h=n?p(i,c,t):p(t);return(d||RO)[r]=h}}),Uu=e=>RO[e],pne="__osOptionsValidationPlugin",hne="__osSizeObserverPlugin",v2="__osScrollbarsHidingPlugin",mne="__osClickScrollPlugin";let P1;const Zj=(e,t,n,r)=>{_s(e,t);const o=$h(t),s=Gd(t),i=ng(n);return r&&ci(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},gne=e=>{let t=!1;const n=al(e,IO);try{t=Co(e,$te("scrollbar-width"))==="none"||Yo.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},vne=(e,t)=>{Co(e,{[Ad]:ju,[Rd]:ju,direction:"rtl"}),Yl(e,{x:0});const n=j1(e),r=j1(t);Yl(e,{x:-999});const o=j1(t);return{i:n.x===r.x,n:r.x!==o.x}},bne=(e,t)=>{const n=al(e,_O),r=ka(e),o=ka(t),s=zj(o,r,!0),i=al(e,Yte),c=ka(e),d=ka(t),p=zj(d,c,!0);return n(),i(),s&&p},xne=()=>{const{body:e}=document,n=fO(`
`)[0],r=n.firstChild,[o,,s]=nx(),[i,c]=Js({o:Zj(e,n,r),u:yO},Gt(Zj,e,n,r,!0)),[d]=c(),p=gne(n),h={x:d.x===0,y:d.y===0},m={elements:{host:null,padding:!p,viewport:w=>p&&w===w.ownerDocument.body&&w,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Bn({},Qte),b=Gt(Bn,{},g),y=Gt(Bn,{},m),x={L:d,I:h,H:p,A:Co(n,"zIndex")==="-1",P:!!ex,V:vne(n,r),U:bne(n,r),B:Gt(o,"r"),j:y,N:w=>Bn(m,w)&&y(),G:b,q:w=>Bn(g,w)&&b(),F:Bn({},m),W:Bn({},g)};return Wo(n,"style"),ci(n),Yo.addEventListener("resize",()=>{let w;if(!p&&(!h.x||!h.y)){const S=Uu(v2);w=!!(S?S.R():As)(x,i)}s("r",[w])}),x},Jo=()=>(P1||(P1=xne()),P1),b2=(e,t)=>Ta(t)?t.apply(0,e):t,yne=(e,t,n,r)=>{const o=fl(r)?n:r;return b2(e,o)||t.apply(0,e)},TO=(e,t,n,r)=>{const o=fl(r)?n:r,s=b2(e,o);return!!s&&(Wd(s)?s:t.apply(0,e))},Cne=(e,t)=>{const{nativeScrollbarsOverlaid:n,body:r}=t||{},{I:o,H:s,j:i}=Jo(),{nativeScrollbarsOverlaid:c,body:d}=i().cancel,p=n??c,h=fl(r)?d:r,m=(o.x||o.y)&&p,g=e&&(l0(h)?!s:h);return!!m||!!g},x2=new WeakMap,wne=(e,t)=>{x2.set(e,t)},Sne=e=>{x2.delete(e)},NO=e=>x2.get(e),kne=(e,t,n)=>{let r=!1;const o=n?new WeakMap:!1,s=()=>{r=!0},i=c=>{if(o&&n){const d=n.map(p=>{const[h,m]=p||[];return[m&&h?(c||dO)(h,e):[],m]});Xn(d,p=>Xn(p[0],h=>{const m=p[1],g=o.get(h)||[];if(e.contains(h)&&m){const y=Ur(h,m.trim(),x=>{r?(y(),o.delete(h)):t(x)});o.set(h,Qn(g,y))}else Ls(g),o.delete(h)}))}};return i(),[s,i]},e_=(e,t,n,r)=>{let o=!1;const{X:s,Y:i,J:c,K:d,Z:p,tt:h}=r||{},m=mO(()=>o&&n(!0),{v:33,p:99}),[g,b]=kne(e,m,c),y=s||[],x=i||[],w=Qi(y,x),S=(I,_)=>{if(!Km(_)){const M=p||As,E=h||As,A=[],R=[];let D=!1,O=!1;if(Xn(_,T=>{const{attributeName:K,target:G,type:X,oldValue:Z,addedNodes:te,removedNodes:V}=T,oe=X==="attributes",ne=X==="childList",se=e===G,re=oe&&K,ae=re?Mo(G,K||""):null,B=re&&Z!==ae,Y=d0(x,K)&&B;if(t&&(ne||!se)){const $=oe&&B,F=$&&d&&Qm(G,d),pe=(F?!M(G,K,Z,ae):!oe||$)&&!E(T,!!F,e,r);Xn(te,W=>Qn(A,W)),Xn(V,W=>Qn(A,W)),O=O||pe}!t&&se&&B&&!M(G,K,Z,ae)&&(Qn(R,K),D=D||Y)}),b(T=>Dj(A).reduce((K,G)=>(Qn(K,dO(T,G)),Qm(G,T)?Qn(K,G):K),[])),t)return!I&&O&&n(!1),[!1];if(!Km(R)||D){const T=[Dj(R),D];return!I&&n.apply(0,T),T}}},j=new Lte(Gt(S,!1));return[()=>(j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:t,childList:t,characterData:t}),o=!0,()=>{o&&(g(),j.disconnect(),o=!1)}),()=>{if(o)return m.m(),S(!0,j.takeRecords())}]},$O=(e,t,n)=>{const{nt:o,ot:s}=n||{},i=Uu(hne),{V:c}=Jo(),d=Gt(pf,e),[p]=Js({o:!1,_:!0});return()=>{const h=[],g=fO(`
`)[0],b=g.firstChild,y=x=>{const w=x instanceof ResizeObserverEntry,S=!w&&$s(x);let j=!1,I=!1,_=!0;if(w){const[M,,E]=p(x.contentRect),A=tx(M),R=bO(M,E);I=!E||R,j=!I&&!A,_=!j}else S?[,_]=x:I=x===!0;if(o&&_){const M=S?x[0]:pf(g);Yl(g,{x:SO(3333333,3333333,M&&c),y:3333333})}j||t({st:S?x:void 0,et:!S,ot:I})};if(Ym){const x=new Ym(w=>y(w.pop()));x.observe(b),Qn(h,()=>{x.disconnect()})}else if(i){const[x,w]=i(b,y,s);Qn(h,Qi([al(g,ene),Ur(g,"animationstart",x)],w))}else return As;if(o){const[x]=Js({o:void 0},d);Qn(h,Ur(g,"scroll",w=>{const S=x(),[j,I,_]=S;I&&(f2(b,"ltr rtl"),al(b,j?"rtl":"ltr"),y([!!j,I,_])),wO(w)}))}return Gt(Ls,Qn(h,_s(e,g)))}},jne=(e,t)=>{let n;const r=d=>d.h===0||d.isIntersecting||d.intersectionRatio>0,o=Fl(nne),[s]=Js({o:!1}),i=(d,p)=>{if(d){const h=s(r(d)),[,m]=h;return m&&!p&&t(h)&&[h]}},c=(d,p)=>i(p.pop(),d);return[()=>{const d=[];if(Nj)n=new Nj(Gt(c,!1),{root:e}),n.observe(o),Qn(d,()=>{n.disconnect()});else{const p=()=>{const h=Gd(o);i(h)};Qn(d,$O(o,p)()),p()}return Gt(Ls,Qn(d,_s(e,o)))},()=>n&&c(!0,n.takeRecords())]},_ne=(e,t)=>{let n,r,o,s,i;const{H:c}=Jo(),d=`[${Zs}]`,p=`[${Ui}]`,h=["tabindex"],m=["wrap","cols","rows"],g=["id","class","style","open"],b={ct:!1,rt:pf(e.lt)},{lt:y,it:x,ut:w,ft:S,_t:j,dt:I,vt:_}=e,{U:M,B:E}=Jo(),[A]=Js({u:xO,o:{w:0,h:0}},()=>{const re=I(cu,lu),ae=I(I1,""),B=ae&&g0(x);_(cu,lu),_(I1,""),_("",rg,!0);const Y=tg(w),$=tg(x),F=ng(x);return _(cu,lu,re),_(I1,"",ae),_("",rg),Yl(x,B),{w:$.w+Y.w+F.w,h:$.h+Y.h+F.h}}),R=S?m:Qi(g,m),D=mO(t,{v:()=>n,p:()=>r,g(re,ae){const[B]=re,[Y]=ae;return[Qi(gi(B),gi(Y)).reduce(($,F)=>($[F]=B[F]||Y[F],$),{})]}}),O=re=>{Xn(re||h,ae=>{if(d0(h,ae)){const B=Mo(y,ae);Zf(B)?Mo(x,ae,B):Wo(x,ae)}})},T=(re,ae)=>{const[B,Y]=re,$={ht:Y};return Bn(b,{ct:B}),!ae&&t($),$},K=({et:re,st:ae,ot:B})=>{const $=!(re&&!B&&!ae)&&c?D:t,[F,q]=ae||[];ae&&Bn(b,{rt:F}),$({et:re||B,ot:B,gt:q})},G=(re,ae)=>{const[,B]=A(),Y={bt:B};return B&&!ae&&(re?t:D)(Y),Y},X=(re,ae,B)=>{const Y={wt:ae};return ae&&!B?D(Y):j||O(re),Y},[Z,te]=w||!M?jne(y,T):[],V=!j&&$O(y,K,{ot:!0,nt:!0}),[oe,ne]=e_(y,!1,X,{Y:g,X:Qi(g,h)}),se=j&&Ym&&new Ym(re=>{const ae=re[re.length-1].contentRect;K({et:!0,ot:bO(ae,i)}),i=ae});return[()=>{O(),se&&se.observe(y);const re=V&&V(),ae=Z&&Z(),B=oe(),Y=E($=>{const[,F]=A();D({yt:$,bt:F})});return()=>{se&&se.disconnect(),re&&re(),ae&&ae(),s&&s(),B(),Y()}},({St:re,$t:ae,xt:B})=>{const Y={},[$]=re("update.ignoreMutation"),[F,q]=re("update.attributes"),[pe,W]=re("update.elementEvents"),[U,ee]=re("update.debounce"),J=W||q,ge=ae||B,he=de=>Ta($)&&$(de);if(J){o&&o(),s&&s();const[de,_e]=e_(w||x,!0,G,{X:Qi(R,F||[]),J:pe,K:d,tt:(Pe,ze)=>{const{target:ht,attributeName:Je}=Pe;return(!ze&&Je&&!j?Ote(ht,d,p):!1)||!!Kc(ht,`.${es}`)||!!he(Pe)}});s=de(),o=_e}if(ee)if(D.m(),$s(U)){const de=U[0],_e=U[1];n=Ea(de)&&de,r=Ea(_e)&&_e}else Ea(U)?(n=U,r=!1):(n=!1,r=!1);if(ge){const de=ne(),_e=te&&te(),Pe=o&&o();de&&Bn(Y,X(de[0],de[1],ge)),_e&&Bn(Y,T(_e[0],ge)),Pe&&Bn(Y,G(Pe[0],ge))}return Y},b]},sx=(e,t,n)=>Vd(e,Rte(t,n)),Ine=(e,t,n)=>{const r=ff(t),[o,s]=Kte(r,n),i=(s-e)/s,c=e/o,d=e/s,p=n?n.n?i:n.i?c:d:d;return sx(0,1,p)},LO=(e,t,n,r)=>{if(r){const c=n?"x":"y",{Ot:d,Ct:p}=r,h=p[c],m=d[c];return sx(0,1,h/(h+m))}const o=n?vi:bi,s=ka(e)[o],i=ka(t)[o];return sx(0,1,s/i)},t_=(e,t,n,r)=>{const o=LO(e,t,r);return 1/o*(1-o)*n},Pne=(e,t,n)=>{const{j:r,A:o}=Jo(),{scrollbars:s}=r(),{slot:i}=s,{Ht:c,lt:d,it:p,zt:h,It:m,At:g,_t:b}=t,{scrollbars:y}=h?{}:e,{slot:x}=y||{},w=new Map,S=U=>ex&&new ex({source:m,axis:U}),j=S("x"),I=S("y"),_=TO([c,d,p],()=>b&&g?c:d,i,x),M=U=>b&&!g&&li(U)===p,E=U=>{w.forEach((ee,J)=>{(U?d0($s(U)?U:[U],J):!0)&&((ee||[]).forEach(he=>{he&&he.cancel()}),w.delete(J))})},A=(U,ee,J)=>{const ge=J?al:f2;Xn(U,he=>{ge(he.Et,ee)})},R=(U,ee)=>{Xn(U,J=>{const[ge,he]=ee(J);Co(ge,he)})},D=U=>{const ee=U||0;return isFinite(ee)?ee:0},O=U=>`${(D(U)*100).toFixed(3)}%`,T=U=>`${D(U)}px`,K=(U,ee,J)=>{R(U,ge=>{const{Tt:he,kt:de}=ge;return[he,{[J?vi:bi]:O(LO(he,de,J,ee))}]})},G=(U,ee,J)=>{R(U,ge=>{const{Tt:he,kt:de,Et:_e}=ge,{V:Pe}=Jo(),ze=J?"x":"y",ht=J?"Left":"Top",{Ot:Je}=ee,qt=pf(_e),Pt=t_(he,de,Ine(m[`scroll${ht}`],Je[ze],J&&qt&&Pe),J);return[he,{transform:Dc(O(Pt),J)}]})},X=U=>{const{Et:ee}=U,J=M(ee)&&ee,{x:ge,y:he}=g0(m);return[J,{transform:J?Dc({x:T(ge),y:T(he)}):""}]},Z=(U,ee,J,ge)=>ee&&U.animate(J,{timeline:ee,composite:ge}),te=(U,ee,J,ge)=>Z(U,ee,{transform:[Dc(T(0),ge),Dc(T(Vd(0,J-.5)),ge)]},"add"),V=[],oe=[],ne=[],se=(U,ee,J)=>{const ge=lO(J),he=ge?J:!0,de=ge?!J:!0;he&&A(oe,U,ee),de&&A(ne,U,ee)},re=U=>{K(oe,U,!0),K(ne,U)},ae=U=>{!j&&!I&&(G(oe,U,!0),G(ne,U))},B=()=>{const U=(ee,{Et:J,kt:ge,Tt:he})=>{const de=ee&&pf(J),_e=Gt(t_,he,ge),Pe=_e(de?1:0,ee),ze=_e(de?0:1,ee);E(he),w.set(he,[Z(he,ee?j:I,Bn({transform:[Dc(O(Pe),ee),Dc(O(ze),ee)]},de?{clear:["left"]}:{}))])};oe.forEach(Gt(U,!0)),ne.forEach(Gt(U,!1))},Y=()=>{!I&&!I&&(b&&R(oe,X),b&&R(ne,X))},$=({Ot:U})=>{Qi(ne,oe).forEach(({Et:ee})=>{E(ee),M(ee)&&w.set(ee,[te(ee,j,U.x,!0),te(ee,I,U.y)])})},F=U=>{const ee=U?ane:ine,J=U?oe:ne,ge=Km(J)?Kj:"",he=Fl(`${es} ${ee} ${ge}`),de=Fl(OO),_e=Fl(g2),Pe={Et:he,kt:de,Tt:_e};return o||al(he,rne),Qn(J,Pe),Qn(V,[_s(he,de),_s(de,_e),Gt(ci,he),E,n(Pe,se,U)]),Pe},q=Gt(F,!0),pe=Gt(F,!1),W=()=>(_s(_,oe[0].Et),_s(_,ne[0].Et),Xm(()=>{se(Kj)},300),Gt(Ls,V));return q(),pe(),[{Dt:re,Mt:ae,Rt:B,Lt:$,Pt:Y,Vt:se,Ut:{P:j,Bt:oe,jt:q,Nt:Gt(R,oe)},Gt:{P:I,Bt:ne,jt:pe,Nt:Gt(R,ne)}},W]},Ene=(e,t,n)=>{const{lt:r,It:o,qt:s}=t,i=(c,d)=>{const{Tt:p,kt:h}=c,m=`scroll${d?"Left":"Top"}`,g=`client${d?"X":"Y"}`,b=d?vi:bi,y=d?"left":"top",x=d?"w":"h",w=d?"x":"y",S="pointerup pointerleave pointercancel lostpointercapture",j=(I,_)=>M=>{const{Ot:E}=n,A=Gd(h)[x]-Gd(p)[x],D=_*M/A*E[w];o[m]=I+D};return Ur(h,"pointerdown",I=>{const _=Kc(I.target,`.${g2}`)===p,M=_?p:h,E=e.scrollbars,{button:A,isPrimary:R,pointerType:D}=I,{pointers:O}=E,T=A===0&&R&&E[_?"dragScroll":"clickScroll"]&&(O||[]).includes(D);if(zl(r,Zs,Gj,!0),T){const K=!_&&I.shiftKey,G=Gt(ka,p),X=Gt(ka,h),Z=(q,pe)=>(q||G())[y]-(pe||X())[y],te=ff(ka(o)[b])/Gd(o)[x]||1,V=j(o[m]||0,1/te),oe=I[g],ne=G(),se=X(),re=ne[b],ae=Z(ne,se)+re/2,B=oe-se[y],Y=_?0:B-ae,$=q=>{Ls(F),M.releasePointerCapture(q.pointerId)},F=[Gt(zl,r,Zs,Gj),Ur(s,S,$),Ur(s,"selectstart",q=>Hj(q),{S:!1}),Ur(h,S,$),Ur(h,"pointermove",q=>{const pe=q[g]-oe;(_||K)&&V(Y+pe)})];if(K)V(Y);else if(!_){const q=Uu(mne);q&&Qn(F,q(V,Z,Y,re,B))}M.setPointerCapture(I.pointerId)}})};return(c,d,p)=>{const{Et:h}=c,[m,g]=El(333),b=!!o.scrollBy;let y=!0;return Gt(Ls,[Ur(h,"pointerenter",()=>{d(Qj,!0)}),Ur(h,"pointerleave pointercancel",()=>{d(Qj,!1)}),Ur(h,"wheel",x=>{const{deltaX:w,deltaY:S,deltaMode:j}=x;b&&y&&j===0&&li(h)===r&&o.scrollBy({left:w,top:S,behavior:"smooth"}),y=!1,d(Jj,!0),m(()=>{y=!0,d(Jj)}),Hj(x)},{S:!1,$:!0}),Ur(h,"mousedown",Gt(Ur,s,"click",wO,{O:!0,$:!0}),{$:!0}),i(c,p),g])}},Mne=(e,t,n,r,o,s)=>{let i,c,d,p,h,m=As,g=0;const[b,y]=El(),[x,w]=El(),[S,j]=El(100),[I,_]=El(100),[M,E]=El(100),[A,R]=El(()=>g),[D,O]=Pne(e,o,Ene(t,o,r)),{lt:T,Ft:K,At:G}=o,{Vt:X,Dt:Z,Mt:te,Rt:V,Lt:oe,Pt:ne}=D,se=$=>{X(ox,$,!0),X(ox,$,!1)},re=($,F)=>{if(R(),$)X(Yj);else{const q=Gt(X,Yj,!0);g>0&&!F?A(q):q()}},ae=$=>$.pointerType==="mouse",B=$=>{ae($)&&(p=c,p&&re(!0))},Y=[j,R,_,E,w,y,()=>m(),Ur(T,"pointerover",B,{O:!0}),Ur(T,"pointerenter",B),Ur(T,"pointerleave",$=>{ae($)&&(p=!1,c&&re(!1))}),Ur(T,"pointermove",$=>{ae($)&&i&&b(()=>{j(),re(!0),I(()=>{i&&re(!1)})})}),Ur(K,"scroll",$=>{x(()=>{te(r),d&&re(!0),S(()=>{d&&!p&&re(!1)})}),s($),ne()})];return[()=>Gt(Ls,Qn(Y,O())),({St:$,xt:F,Wt:q,Xt:pe})=>{const{Yt:W,Jt:U,Kt:ee}=pe||{},{gt:J,ot:ge}=q||{},{rt:he}=n,{I:de}=Jo(),{Ot:_e,Zt:Pe,Qt:ze}=r,[ht,Je]=$("showNativeOverlaidScrollbars"),[qt,Pt]=$("scrollbars.theme"),[jt,Se]=$("scrollbars.visibility"),[Fe,it]=$("scrollbars.autoHide"),[At,ke]=$("scrollbars.autoHideSuspend"),[lt]=$("scrollbars.autoHideDelay"),[Rt,zt]=$("scrollbars.dragScroll"),[Re,Qe]=$("scrollbars.clickScroll"),En=ge&&!F,Te=ze.x||ze.y,ct=W||U||J||F,ft=ee||Se,tt=ht&&de.x&&de.y,en=(ar,vn)=>{const dn=jt==="visible"||jt==="auto"&&ar==="scroll";return X(lne,dn,vn),dn};if(g=lt,En&&(At&&Te?(se(!1),m(),M(()=>{m=Ur(K,"scroll",Gt(se,!0),{O:!0})})):se(!0)),Je&&X(one,tt),Pt&&(X(h),X(qt,!0),h=qt),ke&&!At&&se(!0),it&&(i=Fe==="move",c=Fe==="leave",d=Fe!=="never",re(!d,!0)),zt&&X(dne,Rt),Qe&&X(une,Re),ft){const ar=en(Pe.x,!0),vn=en(Pe.y,!1);X(cne,!(ar&&vn))}ct&&(Z(r),te(r),V(r),ne(),oe(r),X(Xj,!_e.x,!0),X(Xj,!_e.y,!1),X(sne,he&&!G))},{},D]},One=e=>{const t=Jo(),{j:n,H:r}=t,o=Uu(v2),s=o&&o.C,{elements:i}=n(),{host:c,padding:d,viewport:p,content:h}=i,m=Wd(e),g=m?{}:e,{elements:b}=g,{host:y,padding:x,viewport:w,content:S}=b||{},j=m?e:g.target,I=Qm(j,"textarea"),_=j.ownerDocument,M=_.documentElement,E=j===_.body,A=_.defaultView,R=Gt(yne,[j]),D=Gt(TO,[j]),O=Gt(b2,[j]),T=Gt(Fl,""),K=Gt(R,T,p),G=Gt(D,T,h),X=K(w),Z=X===j,te=Z&&E,V=!Z&&G(S),oe=!Z&&Wd(X)&&X===V,ne=oe&&!!O(h),se=ne?K():X,re=ne?V:G(),B=te?M:oe?se:X,Y=I?R(T,c,y):j,$=te?B:Y,F=oe?re:V,q=_.activeElement,pe=!Z&&A.top===A&&q===j,W={Ht:j,lt:$,it:B,tn:!Z&&D(T,d,x),ut:F,nn:!Z&&!r&&s&&s(t),It:te?M:B,Ft:te?_:B,sn:A,qt:_,ft:I,At:E,zt:m,_t:Z,en:oe,dt:(Se,Fe)=>Ete(B,Z?Zs:Ui,Z?Fe:Se),vt:(Se,Fe,it)=>zl(B,Z?Zs:Ui,Z?Fe:Se,it)},U=gi(W).reduce((Se,Fe)=>{const it=W[Fe];return Qn(Se,it&&Wd(it)&&!li(it)?it:!1)},[]),ee=Se=>Se?d0(U,Se):null,{Ht:J,lt:ge,tn:he,it:de,ut:_e,nn:Pe}=W,ze=[()=>{Wo(ge,Zs),Wo(ge,_1),Wo(J,_1),E&&(Wo(M,Zs),Wo(M,_1))}],ht=I&&ee(ge);let Je=I?J:Yb([_e,de,he,ge,J].find(Se=>ee(Se)===!1));const qt=te?J:_e||de,Pt=Gt(Ls,ze);return[W,()=>{Mo(ge,Zs,Z?"viewport":"host"),Mo(he,rx,""),Mo(_e,qj,""),Z||Mo(de,Ui,"");const Se=E&&!Z?al(li(j),IO):As,Fe=it=>{_s(li(it),Yb(it)),ci(it)};if(ht&&(Tj(J,ge),Qn(ze,()=>{Tj(ge,J),ci(ge)})),_s(qt,Je),_s(ge,he),_s(he||ge,!Z&&de),_s(de,_e),Qn(ze,()=>{Se(),Wo(he,rx),Wo(_e,qj),Wo(de,PO),Wo(de,EO),Wo(de,Ui),ee(_e)&&Fe(_e),ee(de)&&Fe(de),ee(he)&&Fe(he)}),r&&!Z&&(zl(de,Ui,MO,!0),Qn(ze,Gt(Wo,de,Ui))),Pe&&(Ate(de,Pe),Qn(ze,Gt(ci,Pe))),pe){const it="tabindex",At=Mo(de,it);Mo(de,it,"-1"),de.focus();const ke=()=>At?Mo(de,it,At):Wo(de,it),lt=Ur(_,"pointerdown keydown",()=>{ke(),lt()});Qn(ze,[ke,lt])}else q&&q.focus&&q.focus();return Je=0,Pt},Pt]},Ane=({ut:e})=>({Wt:t,cn:n,xt:r})=>{const{U:o}=Jo(),{ht:s}=t||{},{ct:i}=n;(e||!o)&&(s||r)&&Co(e,{[bi]:i?"":"100%"})},Rne=({lt:e,tn:t,it:n,_t:r},o)=>{const[s,i]=Js({u:Ute,o:Lj()},Gt(Lj,e,"padding",""));return({St:c,Wt:d,cn:p,xt:h})=>{let[m,g]=i(h);const{H:b,U:y}=Jo(),{et:x,bt:w,gt:S}=d||{},{rt:j}=p,[I,_]=c("paddingAbsolute");(x||g||(h||!y&&w))&&([m,g]=s(h));const E=!r&&(_||S||g);if(E){const A=!I||!t&&!b,R=m.r+m.l,D=m.t+m.b,O={[eg]:A&&!j?-R:0,[Ud]:A?-D:0,[Zm]:A&&j?-R:0,top:A?-m.t:0,right:A?j?-m.r:"auto":0,left:A?j?"auto":-m.l:0,[vi]:A?`calc(100% + ${R}px)`:""},T={[vO]:A?m.t:0,[p2]:A?m.r:0,[Jm]:A?m.b:0,[h2]:A?m.l:0};Co(t||n,O),Co(n,T),Bn(o,{tn:m,rn:!A,k:t?T:Bn({},O,T)})}return{ln:E}}},Dne=({lt:e,tn:t,it:n,nn:r,_t:o,vt:s,At:i,sn:c},d)=>{const p=Gt(Vd,0),h="visible",m=42,g={u:xO,o:{w:0,h:0}},b={u:yO,o:{x:ju,y:ju}},y=(ae,B)=>{const Y=Yo.devicePixelRatio%1!==0?1:0,$={w:p(ae.w-B.w),h:p(ae.h-B.h)};return{w:$.w>Y?$.w:0,h:$.h>Y?$.h:0}},x=ae=>ae.indexOf(h)===0,{L:w,U:S,H:j,I}=Jo(),_=Uu(v2),M=!o&&!j&&(I.x||I.y),E=i&&o,[A,R]=Js(g,Gt(ng,n)),[D,O]=Js(g,Gt(tg,n)),[T,K]=Js(g),[G,X]=Js(g),[Z]=Js(b),te=(ae,B)=>{if(Co(n,{[bi]:""}),B){const{rn:Y,tn:$}=d,{an:F,D:q}=ae,pe=ng(e),W=$h(e),U=Co(n,"boxSizing")==="content-box",ee=Y||U?$.b+$.t:0,J=!(I.x&&U);Co(n,{[bi]:W.h+pe.h+(F.x&&J?q.x:0)-ee})}},V=(ae,B)=>{const Y=!j&&!ae?m:0,$=(he,de,_e)=>{const Pe=Co(n,he),ht=(B?B[he]:Pe)==="scroll";return[Pe,ht,ht&&!j?de?Y:_e:0,de&&!!Y]},[F,q,pe,W]=$(Ad,I.x,w.x),[U,ee,J,ge]=$(Rd,I.y,w.y);return{Zt:{x:F,y:U},an:{x:q,y:ee},D:{x:pe,y:J},M:{x:W,y:ge}}},oe=(ae,B,Y,$)=>{const F=(ee,J)=>{const ge=x(ee),he=J&&ge&&ee.replace(`${h}-`,"")||"";return[J&&!ge?ee:"",x(he)?"hidden":he]},[q,pe]=F(Y.x,B.x),[W,U]=F(Y.y,B.y);return $[Ad]=pe&&W?pe:q,$[Rd]=U&&q?U:W,V(ae,$)},ne=(ae,B,Y,$)=>{const{D:F,M:q}=ae,{x:pe,y:W}=q,{x:U,y:ee}=F,{k:J}=d,ge=B?Zm:eg,he=B?h2:p2,de=J[ge],_e=J[Ud],Pe=J[he],ze=J[Jm];$[vi]=`calc(100% + ${ee+de*-1}px)`,$[ge]=-ee+de,$[Ud]=-U+_e,Y&&($[he]=Pe+(W?ee:0),$[Jm]=ze+(pe?U:0))},[se,re]=_?_.T(M,S,n,r,d,V,ne):[()=>M,()=>[As]];return({St:ae,Wt:B,cn:Y,xt:$},{ln:F})=>{const{et:q,wt:pe,bt:W,ht:U,gt:ee,yt:J}=B||{},{ct:ge,rt:he}=Y,[de,_e]=ae("showNativeOverlaidScrollbars"),[Pe,ze]=ae("overflow"),ht=de&&I.x&&I.y,Je=!o&&!S&&(q||W||pe||_e||U),qt=q||F||W||ee||J||_e,Pt=x(Pe.x),jt=x(Pe.y),Se=Pt||jt;let Fe=R($),it=O($),At=K($),ke=X($),lt;if(_e&&j&&s(MO,Jte,!ht),Je&&(lt=V(ht),te(lt,ge)),qt){Se&&s(cu,lu,!1);const[Tr,ir]=re(ht,he,lt),[$n,Jn]=Fe=A($),[Mn,Fr]=it=D($),co=$h(n);let Nr=Mn,$r=co;Tr(),(Fr||Jn||_e)&&ir&&!ht&&se(ir,Mn,$n,he)&&($r=$h(n),Nr=tg(n));const Lo=Vte(c),Br={w:p(Vd(Mn.w,Nr.w)+$n.w),h:p(Vd(Mn.h,Nr.h)+$n.h)},ts={w:p((E?Lo.w:$r.w+p(co.w-Mn.w))+$n.w),h:p((E?Lo.h:$r.h+p(co.h-Mn.h))+$n.h)};ke=G(ts),At=T(y(Br,ts),$)}const[Rt,zt]=ke,[Re,Qe]=At,[En,Te]=it,[ct,ft]=Fe,tt={x:Re.w>0,y:Re.h>0},en=Pt&&jt&&(tt.x||tt.y)||Pt&&tt.x&&!tt.y||jt&&tt.y&&!tt.x;if(F||ee||J||ft||Te||zt||Qe||ze||_e||Je||qt){const Tr={[eg]:0,[Ud]:0,[Zm]:0,[vi]:"",[Ad]:"",[Rd]:""},ir=oe(ht,tt,Pe,Tr),$n=se(ir,En,ct,he);o||ne(ir,he,$n,Tr),Je&&te(ir,ge),o?(Mo(e,PO,Tr[Ad]),Mo(e,EO,Tr[Rd])):Co(n,Tr)}zl(e,Zs,lu,en),zl(t,rx,Zte,en),o||zl(n,Ui,cu,Se);const[vn,dn]=Z(V(ht).Zt);return Bn(d,{Zt:vn,Ct:{x:Rt.w,y:Rt.h},Ot:{x:Re.w,y:Re.h},Qt:tt}),{Kt:dn,Yt:zt,Jt:Qe}}},Tne=e=>{const[t,n,r]=One(e),o={tn:{t:0,r:0,b:0,l:0},rn:!1,k:{[eg]:0,[Ud]:0,[Zm]:0,[vO]:0,[p2]:0,[Jm]:0,[h2]:0},Ct:{x:0,y:0},Ot:{x:0,y:0},Zt:{x:ju,y:ju},Qt:{x:!1,y:!1}},{Ht:s,it:i,vt:c,_t:d}=t,{H:p,I:h,U:m}=Jo(),g=!p&&(h.x||h.y),b=[Ane(t),Rne(t,o),Dne(t,o)];return[n,y=>{const x={},S=(g||!m)&&g0(i);return c("",rg,!0),Xn(b,j=>{Bn(x,j(y,x)||{})}),c("",rg),Yl(i,S),!d&&Yl(s,0),x},o,t,r]},Nne=(e,t,n,r)=>{const[o,s,i,c,d]=Tne(e),[p,h,m]=_ne(c,S=>{w({},S)}),[g,b,,y]=Mne(e,t,m,i,c,r),x=S=>gi(S).some(j=>!!S[j]),w=(S,j)=>{const{un:I,xt:_,$t:M,fn:E}=S,A=I||{},R=!!_,D={St:Xte(t,A,R),un:A,xt:R};if(E)return b(D),!1;const O=j||h(Bn({},D,{$t:M})),T=s(Bn({},D,{cn:m,Wt:O}));b(Bn({},D,{Wt:O,Xt:T}));const K=x(O),G=x(T),X=K||G||!u2(A)||R;return X&&n(S,{Wt:O,Xt:T}),X};return[()=>{const{Ht:S,it:j,qt:I,At:_}=c,M=_?I.documentElement:S,E=g0(M),A=[p(),o(),g()];return Yl(j,E),Gt(Ls,A)},w,()=>({_n:m,dn:i}),{vn:c,hn:y},d]},ai=(e,t,n)=>{const{G:r}=Jo(),o=Wd(e),s=o?e:e.target,i=NO(s);if(t&&!i){let c=!1;const d=[],p={},h=O=>{const T=cO(O,!0),K=Uu(pne);return K?K(T,!0):T},m=Bn({},r(),h(t)),[g,b,y]=nx(),[x,w,S]=nx(n),j=(O,T)=>{S(O,T),y(O,T)},[I,_,M,E,A]=Nne(e,m,({un:O,xt:T},{Wt:K,Xt:G})=>{const{et:X,gt:Z,ht:te,bt:V,wt:oe,ot:ne}=K,{Yt:se,Jt:re,Kt:ae}=G;j("updated",[D,{updateHints:{sizeChanged:!!X,directionChanged:!!Z,heightIntrinsicChanged:!!te,overflowEdgeChanged:!!se,overflowAmountChanged:!!re,overflowStyleChanged:!!ae,contentMutation:!!V,hostMutation:!!oe,appear:!!ne},changedOptions:O||{},force:!!T}])},O=>j("scroll",[D,O])),R=O=>{Sne(s),Ls(d),c=!0,j("destroyed",[D,O]),b(),w()},D={options(O,T){if(O){const K=T?r():{},G=kO(m,Bn(K,h(O)));u2(G)||(Bn(m,G),_({un:G}))}return Bn({},m)},on:x,off:(O,T)=>{O&&T&&w(O,T)},state(){const{_n:O,dn:T}=M(),{rt:K}=O,{Ct:G,Ot:X,Zt:Z,Qt:te,tn:V,rn:oe}=T;return Bn({},{overflowEdge:G,overflowAmount:X,overflowStyle:Z,hasOverflow:te,padding:V,paddingAbsolute:oe,directionRTL:K,destroyed:c})},elements(){const{Ht:O,lt:T,tn:K,it:G,ut:X,It:Z,Ft:te}=E.vn,{Ut:V,Gt:oe}=E.hn,ne=re=>{const{Tt:ae,kt:B,Et:Y}=re;return{scrollbar:Y,track:B,handle:ae}},se=re=>{const{Bt:ae,jt:B}=re,Y=ne(ae[0]);return Bn({},Y,{clone:()=>{const $=ne(B());return _({fn:!0}),$}})};return Bn({},{target:O,host:T,padding:K||G,viewport:G,content:X||G,scrollOffsetElement:Z,scrollEventElement:te,scrollbarHorizontal:se(V),scrollbarVertical:se(oe)})},update:O=>_({xt:O,$t:!0}),destroy:Gt(R,!1),plugin:O=>p[gi(O)[0]]};return Qn(d,[A]),wne(s,D),DO(AO,ai,[D,g,p]),Cne(E.vn.At,!o&&e.cancel)?(R(!0),D):(Qn(d,I()),j("initialized",[D]),D.update(!0),D)}return i};ai.plugin=e=>{const t=$s(e),n=t?e:[e],r=n.map(o=>DO(o,ai)[0]);return fne(n),t?r:r[0]};ai.valid=e=>{const t=e&&e.elements,n=Ta(t)&&t();return qm(n)&&!!NO(n.target)};ai.env=()=>{const{L:e,I:t,H:n,V:r,U:o,A:s,P:i,F:c,W:d,j:p,N:h,G:m,q:g}=Jo();return Bn({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,scrollTimeline:i,staticDefaultInitialization:c,staticDefaultOptions:d,getDefaultInitialization:p,setDefaultInitialization:h,getDefaultOptions:m,setDefaultOptions:g})};const $ne=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,c=r?n.cancelIdleCallback:s,d=()=>{c(e),s(t)};return[(p,h)=>{d(),e=i(r?()=>{d(),t=o(p)}:p,typeof h=="object"?h:{timeout:2233})},d]},y2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=l.useMemo($ne,[]),i=l.useRef(null),c=l.useRef(r),d=l.useRef(t),p=l.useRef(n);return l.useEffect(()=>{c.current=r},[r]),l.useEffect(()=>{const{current:h}=i;d.current=t,ai.valid(h)&&h.options(t||{},!0)},[t]),l.useEffect(()=>{const{current:h}=i;p.current=n,ai.valid(h)&&h.on(n||{},!0)},[n]),l.useEffect(()=>()=>{var h;s(),(h=i.current)==null||h.destroy()},[]),l.useMemo(()=>[h=>{const m=i.current;if(ai.valid(m))return;const g=c.current,b=d.current||{},y=p.current||{},x=()=>i.current=ai(h,b,y);g?o(x,g):x()},()=>i.current],[])},Lne=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...c}=e,d=n,p=l.useRef(null),h=l.useRef(null),[m,g]=y2({options:r,events:o,defer:s});return l.useEffect(()=>{const{current:b}=p,{current:y}=h;return b&&y&&m({target:b,elements:{viewport:y,content:y}}),()=>{var x;return(x=g())==null?void 0:x.destroy()}},[m,n]),l.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),z.createElement(d,{"data-overlayscrollbars-initialize":"",ref:p,...c},z.createElement("div",{"data-overlayscrollbars-contents":"",ref:h},i))},v0=l.forwardRef(Lne);var zO={exports:{}},FO={};const as=Dx(UD),Sd=Dx(GD),zne=Dx(qD);(function(e){var t,n,r=wc&&wc.__generator||function(ie,ue){var xe,Me,ye,pt,at={label:0,sent:function(){if(1&ye[0])throw ye[1];return ye[1]},trys:[],ops:[]};return pt={next:Kt(0),throw:Kt(1),return:Kt(2)},typeof Symbol=="function"&&(pt[Symbol.iterator]=function(){return this}),pt;function Kt(gt){return function(wt){return function(Ge){if(xe)throw new TypeError("Generator is already executing.");for(;at;)try{if(xe=1,Me&&(ye=2&Ge[0]?Me.return:Ge[0]?Me.throw||((ye=Me.return)&&ye.call(Me),0):Me.next)&&!(ye=ye.call(Me,Ge[1])).done)return ye;switch(Me=0,ye&&(Ge=[2&Ge[0],ye.value]),Ge[0]){case 0:case 1:ye=Ge;break;case 4:return at.label++,{value:Ge[1],done:!1};case 5:at.label++,Me=Ge[1],Ge=[0];continue;case 7:Ge=at.ops.pop(),at.trys.pop();continue;default:if(!((ye=(ye=at.trys).length>0&&ye[ye.length-1])||Ge[0]!==6&&Ge[0]!==2)){at=0;continue}if(Ge[0]===3&&(!ye||Ge[1]>ye[0]&&Ge[1]=200&&ie.status<=299},K=function(ie){return/ion\/(vnd\.api\+)?json/.test(ie.get("content-type")||"")};function G(ie){if(!(0,D.isPlainObject)(ie))return ie;for(var ue=w({},ie),xe=0,Me=Object.entries(ue);xe"u"&&at===O&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(an,Yt){return M(ue,null,function(){var Ve,Ct,Ft,Qt,Ln,Jt,yn,hn,Hr,pr,Tt,zn,Gn,hr,Pr,er,qn,Cn,An,Rn,jn,Fn,Zt,vt,Mt,nt,mt,St,Bt,Ue,Be,Oe,$e,Ne,Ke,Nt;return r(this,function(Ot){switch(Ot.label){case 0:return Ve=Yt.signal,Ct=Yt.getState,Ft=Yt.extra,Qt=Yt.endpoint,Ln=Yt.forced,Jt=Yt.type,Hr=(hn=typeof an=="string"?{url:an}:an).url,Tt=(pr=hn.headers)===void 0?new Headers(tn.headers):pr,Gn=(zn=hn.params)===void 0?void 0:zn,Pr=(hr=hn.responseHandler)===void 0?$t??"json":hr,qn=(er=hn.validateStatus)===void 0?Ut??T:er,An=(Cn=hn.timeout)===void 0?Et:Cn,Rn=I(hn,["url","headers","params","responseHandler","validateStatus","timeout"]),jn=w(S(w({},tn),{signal:Ve}),Rn),Tt=new Headers(G(Tt)),Fn=jn,[4,ye(Tt,{getState:Ct,extra:Ft,endpoint:Qt,forced:Ln,type:Jt})];case 1:Fn.headers=Ot.sent()||Tt,Zt=function(Ze){return typeof Ze=="object"&&((0,D.isPlainObject)(Ze)||Array.isArray(Ze)||typeof Ze.toJSON=="function")},!jn.headers.has("content-type")&&Zt(jn.body)&&jn.headers.set("content-type",Ee),Zt(jn.body)&&wt(jn.headers)&&(jn.body=JSON.stringify(jn.body,et)),Gn&&(vt=~Hr.indexOf("?")?"&":"?",Mt=Kt?Kt(Gn):new URLSearchParams(G(Gn)),Hr+=vt+Mt),Hr=function(Ze,cn){if(!Ze)return cn;if(!cn)return Ze;if(function(Sn){return new RegExp("(^|:)//").test(Sn)}(cn))return cn;var wn=Ze.endsWith("/")||!cn.startsWith("?")?"/":"";return Ze=function(Sn){return Sn.replace(/\/$/,"")}(Ze),""+Ze+wn+function(Sn){return Sn.replace(/^\//,"")}(cn)}(xe,Hr),nt=new Request(Hr,jn),mt=new Request(Hr,jn),yn={request:mt},Bt=!1,Ue=An&&setTimeout(function(){Bt=!0,Yt.abort()},An),Ot.label=2;case 2:return Ot.trys.push([2,4,5,6]),[4,at(nt)];case 3:return St=Ot.sent(),[3,6];case 4:return Be=Ot.sent(),[2,{error:{status:Bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Be)},meta:yn}];case 5:return Ue&&clearTimeout(Ue),[7];case 6:Oe=St.clone(),yn.response=Oe,Ne="",Ot.label=7;case 7:return Ot.trys.push([7,9,,10]),[4,Promise.all([ln(St,Pr).then(function(Ze){return $e=Ze},function(Ze){return Ke=Ze}),Oe.text().then(function(Ze){return Ne=Ze},function(){})])];case 8:if(Ot.sent(),Ke)throw Ke;return[3,10];case 9:return Nt=Ot.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:St.status,data:Ne,error:String(Nt)},meta:yn}];case 10:return[2,qn(St,$e)?{data:$e,meta:yn}:{error:{status:St.status,data:$e},meta:yn}]}})})};function ln(an,Yt){return M(this,null,function(){var Ve;return r(this,function(Ct){switch(Ct.label){case 0:return typeof Yt=="function"?[2,Yt(an)]:(Yt==="content-type"&&(Yt=wt(an.headers)?"json":"text"),Yt!=="json"?[3,2]:[4,an.text()]);case 1:return[2,(Ve=Ct.sent()).length?JSON.parse(Ve):null];case 2:return[2,an.text()]}})})}}var Z=function(ie,ue){ue===void 0&&(ue=void 0),this.value=ie,this.meta=ue};function te(ie,ue){return ie===void 0&&(ie=0),ue===void 0&&(ue=5),M(this,null,function(){var xe,Me;return r(this,function(ye){switch(ye.label){case 0:return xe=Math.min(ie,ue),Me=~~((Math.random()+.4)*(300<=$e)}var jn=(0,ze.createAsyncThunk)(Gn+"/executeQuery",An,{getPendingMeta:function(){var vt;return(vt={startedTimeStamp:Date.now()})[ze.SHOULD_AUTOBATCH]=!0,vt},condition:function(vt,Mt){var nt,mt,St,Bt=(0,Mt.getState)(),Ue=(mt=(nt=Bt[Gn])==null?void 0:nt.queries)==null?void 0:mt[vt.queryCacheKey],Be=Ue==null?void 0:Ue.fulfilledTimeStamp,Oe=vt.originalArgs,$e=Ue==null?void 0:Ue.originalArgs,Ne=Pr[vt.endpointName];return!(!de(vt)&&((Ue==null?void 0:Ue.status)==="pending"||!Rn(vt,Bt)&&(!W(Ne)||!((St=Ne==null?void 0:Ne.forceRefetch)!=null&&St.call(Ne,{currentArg:Oe,previousArg:$e,endpointState:Ue,state:Bt})))&&Be))},dispatchConditionRejection:!0}),Fn=(0,ze.createAsyncThunk)(Gn+"/executeMutation",An,{getPendingMeta:function(){var vt;return(vt={startedTimeStamp:Date.now()})[ze.SHOULD_AUTOBATCH]=!0,vt}});function Zt(vt){return function(Mt){var nt,mt;return((mt=(nt=Mt==null?void 0:Mt.meta)==null?void 0:nt.arg)==null?void 0:mt.endpointName)===vt}}return{queryThunk:jn,mutationThunk:Fn,prefetch:function(vt,Mt,nt){return function(mt,St){var Bt=function(Ne){return"force"in Ne}(nt)&&nt.force,Ue=function(Ne){return"ifOlderThan"in Ne}(nt)&&nt.ifOlderThan,Be=function(Ne){return Ne===void 0&&(Ne=!0),qn.endpoints[vt].initiate(Mt,{forceRefetch:Ne})},Oe=qn.endpoints[vt].select(Mt)(St());if(Bt)mt(Be());else if(Ue){var $e=Oe==null?void 0:Oe.fulfilledTimeStamp;if(!$e)return void mt(Be());(Number(new Date)-Number(new Date($e)))/1e3>=Ue&&mt(Be())}else mt(Be(!1))}},updateQueryData:function(vt,Mt,nt,mt){return mt===void 0&&(mt=!0),function(St,Bt){var Ue,Be,Oe,$e=qn.endpoints[vt].select(Mt)(Bt()),Ne={patches:[],inversePatches:[],undo:function(){return St(qn.util.patchQueryData(vt,Mt,Ne.inversePatches,mt))}};if($e.status===t.uninitialized)return Ne;if("data"in $e)if((0,Pe.isDraftable)($e.data)){var Ke=(0,Pe.produceWithPatches)($e.data,nt),Nt=Ke[0],Ot=Ke[2];(Ue=Ne.patches).push.apply(Ue,Ke[1]),(Be=Ne.inversePatches).push.apply(Be,Ot),Oe=Nt}else Oe=nt($e.data),Ne.patches.push({op:"replace",path:[],value:Oe}),Ne.inversePatches.push({op:"replace",path:[],value:$e.data});return St(qn.util.patchQueryData(vt,Mt,Ne.patches,mt)),Ne}},upsertQueryData:function(vt,Mt,nt){return function(mt){var St;return mt(qn.endpoints[vt].initiate(Mt,((St={subscribe:!1,forceRefetch:!0})[he]=function(){return{data:nt}},St)))}},patchQueryData:function(vt,Mt,nt,mt){return function(St,Bt){var Ue=Pr[vt],Be=er({queryArgs:Mt,endpointDefinition:Ue,endpointName:vt});if(St(qn.internalActions.queryResultPatched({queryCacheKey:Be,patches:nt})),mt){var Oe=qn.endpoints[vt].select(Mt)(Bt()),$e=U(Ue.providesTags,Oe.data,void 0,Mt,{},Cn);St(qn.internalActions.updateProvidedBy({queryCacheKey:Be,providedTags:$e}))}}},buildMatchThunkActions:function(vt,Mt){return{matchPending:(0,_e.isAllOf)((0,_e.isPending)(vt),Zt(Mt)),matchFulfilled:(0,_e.isAllOf)((0,_e.isFulfilled)(vt),Zt(Mt)),matchRejected:(0,_e.isAllOf)((0,_e.isRejected)(vt),Zt(Mt))}}}}({baseQuery:Me,reducerPath:ye,context:xe,api:ie,serializeQueryArgs:pt,assertTagType:Ge}),et=Ee.queryThunk,Et=Ee.mutationThunk,$t=Ee.patchQueryData,Ut=Ee.updateQueryData,tn=Ee.upsertQueryData,ln=Ee.prefetch,an=Ee.buildMatchThunkActions,Yt=function(Tt){var zn=Tt.reducerPath,Gn=Tt.queryThunk,hr=Tt.mutationThunk,Pr=Tt.context,er=Pr.endpointDefinitions,qn=Pr.apiUid,Cn=Pr.extractRehydrationInfo,An=Pr.hasRehydrationInfo,Rn=Tt.assertTagType,jn=Tt.config,Fn=(0,J.createAction)(zn+"/resetApiState"),Zt=(0,J.createSlice)({name:zn+"/queries",initialState:it,reducers:{removeQueryResult:{reducer:function(Ue,Be){delete Ue[Be.payload.queryCacheKey]},prepare:(0,J.prepareAutoBatched)()},queryResultPatched:{reducer:function(Ue,Be){var Oe=Be.payload,$e=Oe.patches;jt(Ue,Oe.queryCacheKey,function(Ne){Ne.data=(0,Pt.applyPatches)(Ne.data,$e.concat())})},prepare:(0,J.prepareAutoBatched)()}},extraReducers:function(Ue){Ue.addCase(Gn.pending,function(Be,Oe){var $e,Ne=Oe.meta,Ke=Oe.meta.arg,Nt=de(Ke);(Ke.subscribe||Nt)&&(Be[$e=Ke.queryCacheKey]!=null||(Be[$e]={status:t.uninitialized,endpointName:Ke.endpointName})),jt(Be,Ke.queryCacheKey,function(Ot){Ot.status=t.pending,Ot.requestId=Nt&&Ot.requestId?Ot.requestId:Ne.requestId,Ke.originalArgs!==void 0&&(Ot.originalArgs=Ke.originalArgs),Ot.startedTimeStamp=Ne.startedTimeStamp})}).addCase(Gn.fulfilled,function(Be,Oe){var $e=Oe.meta,Ne=Oe.payload;jt(Be,$e.arg.queryCacheKey,function(Ke){var Nt;if(Ke.requestId===$e.requestId||de($e.arg)){var Ot=er[$e.arg.endpointName].merge;if(Ke.status=t.fulfilled,Ot)if(Ke.data!==void 0){var Ze=$e.fulfilledTimeStamp,cn=$e.arg,wn=$e.baseQueryMeta,Sn=$e.requestId,Er=(0,J.createNextState)(Ke.data,function(cr){return Ot(cr,Ne,{arg:cn.originalArgs,baseQueryMeta:wn,fulfilledTimeStamp:Ze,requestId:Sn})});Ke.data=Er}else Ke.data=Ne;else Ke.data=(Nt=er[$e.arg.endpointName].structuralSharing)==null||Nt?R((0,qt.isDraft)(Ke.data)?(0,Pt.original)(Ke.data):Ke.data,Ne):Ne;delete Ke.error,Ke.fulfilledTimeStamp=$e.fulfilledTimeStamp}})}).addCase(Gn.rejected,function(Be,Oe){var $e=Oe.meta,Ne=$e.condition,Ke=$e.requestId,Nt=Oe.error,Ot=Oe.payload;jt(Be,$e.arg.queryCacheKey,function(Ze){if(!Ne){if(Ze.requestId!==Ke)return;Ze.status=t.rejected,Ze.error=Ot??Nt}})}).addMatcher(An,function(Be,Oe){for(var $e=Cn(Oe).queries,Ne=0,Ke=Object.entries($e);Ne"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},jn),reducers:{middlewareRegistered:function(Ue,Be){Ue.middlewareRegistered=Ue.middlewareRegistered!=="conflict"&&qn===Be.payload||"conflict"}},extraReducers:function(Ue){Ue.addCase(ae,function(Be){Be.online=!0}).addCase(B,function(Be){Be.online=!1}).addCase(se,function(Be){Be.focused=!0}).addCase(re,function(Be){Be.focused=!1}).addMatcher(An,function(Be){return w({},Be)})}}),Bt=(0,J.combineReducers)({queries:Zt.reducer,mutations:vt.reducer,provided:Mt.reducer,subscriptions:mt.reducer,config:St.reducer});return{reducer:function(Ue,Be){return Bt(Fn.match(Be)?void 0:Ue,Be)},actions:S(w(w(w(w(w(w({},St.actions),Zt.actions),nt.actions),mt.actions),vt.actions),Mt.actions),{unsubscribeMutationResult:vt.actions.removeMutationResult,resetApiState:Fn})}}({context:xe,queryThunk:et,mutationThunk:Et,reducerPath:ye,assertTagType:Ge,config:{refetchOnFocus:gt,refetchOnReconnect:wt,refetchOnMountOrArgChange:Kt,keepUnusedDataFor:at,reducerPath:ye}}),Ve=Yt.reducer,Ct=Yt.actions;Br(ie.util,{patchQueryData:$t,updateQueryData:Ut,upsertQueryData:tn,prefetch:ln,resetApiState:Ct.resetApiState}),Br(ie.internalActions,Ct);var Ft=function(Tt){var zn=Tt.reducerPath,Gn=Tt.queryThunk,hr=Tt.api,Pr=Tt.context,er=Pr.apiUid,qn={invalidateTags:(0,ar.createAction)(zn+"/invalidateTags")},Cn=[Nr,vn,Tr,ir,Mn,co];return{middleware:function(Rn){var jn=!1,Fn=S(w({},Tt),{internalState:{currentSubscriptions:{}},refetchQuery:An}),Zt=Cn.map(function(nt){return nt(Fn)}),vt=function(nt){var mt=nt.api,St=nt.queryThunk,Bt=nt.internalState,Ue=mt.reducerPath+"/subscriptions",Be=null,Oe=!1,$e=mt.internalActions,Ne=$e.updateSubscriptionOptions,Ke=$e.unsubscribeQueryResult;return function(Nt,Ot){var Ze,cn;if(Be||(Be=JSON.parse(JSON.stringify(Bt.currentSubscriptions))),mt.util.resetApiState.match(Nt))return Be=Bt.currentSubscriptions={},[!0,!1];if(mt.internalActions.internal_probeSubscription.match(Nt)){var wn=Nt.payload;return[!1,!!((Ze=Bt.currentSubscriptions[wn.queryCacheKey])!=null&&Ze[wn.requestId])]}var Sn=function(_n,ur){var po,dr,mn,Qr,Xr,Ai,ap,ns,qa;if(Ne.match(ur)){var pa=ur.payload,Ka=pa.queryCacheKey,jo=pa.requestId;return(po=_n==null?void 0:_n[Ka])!=null&&po[jo]&&(_n[Ka][jo]=pa.options),!0}if(Ke.match(ur)){var _o=ur.payload;return jo=_o.requestId,_n[Ka=_o.queryCacheKey]&&delete _n[Ka][jo],!0}if(mt.internalActions.removeQueryResult.match(ur))return delete _n[ur.payload.queryCacheKey],!0;if(St.pending.match(ur)){var Io=ur.meta;if(jo=Io.requestId,(ho=Io.arg).subscribe)return(vs=(mn=_n[dr=ho.queryCacheKey])!=null?mn:_n[dr]={})[jo]=(Xr=(Qr=ho.subscriptionOptions)!=null?Qr:vs[jo])!=null?Xr:{},!0}if(St.rejected.match(ur)){var vs,rs=ur.meta,ho=rs.arg;if(jo=rs.requestId,rs.condition&&ho.subscribe)return(vs=(ap=_n[Ai=ho.queryCacheKey])!=null?ap:_n[Ai]={})[jo]=(qa=(ns=ho.subscriptionOptions)!=null?ns:vs[jo])!=null?qa:{},!0}return!1}(Bt.currentSubscriptions,Nt);if(Sn){Oe||(Lo(function(){var _n=JSON.parse(JSON.stringify(Bt.currentSubscriptions)),ur=(0,$r.produceWithPatches)(Be,function(){return _n});Ot.next(mt.internalActions.subscriptionsUpdated(ur[1])),Be=_n,Oe=!1}),Oe=!0);var Er=!!((cn=Nt.type)!=null&&cn.startsWith(Ue)),cr=St.rejected.match(Nt)&&Nt.meta.condition&&!!Nt.meta.arg.subscribe;return[!Er&&!cr,!1]}return[!0,!1]}}(Fn),Mt=function(nt){var mt=nt.reducerPath,St=nt.context,Bt=nt.refetchQuery,Ue=nt.internalState,Be=nt.api.internalActions.removeQueryResult;function Oe($e,Ne){var Ke=$e.getState()[mt],Nt=Ke.queries,Ot=Ue.currentSubscriptions;St.batch(function(){for(var Ze=0,cn=Object.keys(Ot);Ze{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=Q(),o=H(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=KD((t==null?void 0:t.board_id)??zs.skipToken),c=l.useMemo(()=>me([we],j=>{const I=(s??[]).map(M=>MI(j,M));return{imageUsageSummary:{isInitialImage:ta(I,M=>M.isInitialImage),isCanvasImage:ta(I,M=>M.isCanvasImage),isNodesImage:ta(I,M=>M.isNodesImage),isControlImage:ta(I,M=>M.isControlImage)}}}),[s]),[d,{isLoading:p}]=QD(),[h,{isLoading:m}]=XD(),{imageUsageSummary:g}=H(c),b=l.useCallback(()=>{t&&(d(t.board_id),n(void 0))},[t,d,n]),y=l.useCallback(()=>{t&&(h(t.board_id),n(void 0))},[t,h,n]),x=l.useCallback(()=>{n(void 0)},[n]),w=l.useRef(null),S=l.useMemo(()=>m||p||i,[m,p,i]);return t?a.jsx(Wf,{isOpen:!!t,onClose:x,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsxs(Oa,{fontSize:"lg",fontWeight:"bold",children:[r("controlnet.delete")," ",t.board_name]}),a.jsx(Ra,{children:a.jsxs(N,{direction:"column",gap:3,children:[i?a.jsx(Wg,{children:a.jsx(N,{sx:{w:"full",h:32}})}):a.jsx(zM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(je,{children:r("boards.deletedBoardsCannotbeRestored")}),a.jsx(je,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(pi,{children:a.jsxs(N,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Dt,{ref:w,onClick:x,children:r("boards.cancel")}),a.jsx(Dt,{colorScheme:"warning",isLoading:S,onClick:b,children:r("boards.deleteBoardOnly")}),a.jsx(Dt,{colorScheme:"error",isLoading:S,onClick:y,children:r("boards.deleteBoardAndImages")})]})})]})})}):null},Bne=l.memo(Fne),Hne=()=>{const{t:e}=Q(),[t,{isLoading:n}]=YD(),r=e("boards.myBoard"),o=l.useCallback(()=>{t(r)},[t,r]);return a.jsx(rt,{icon:a.jsx(Zi,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},Wne=l.memo(Hne);var BO=Cg({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),b0=Cg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),Vne=Cg({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),Une=Cg({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.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"})})});const Gne=me([we],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},Ie),qne=()=>{const e=le(),{boardSearchText:t}=H(Gne),n=l.useRef(null),{t:r}=Q(),o=l.useCallback(d=>{e(Uw(d))},[e]),s=l.useCallback(()=>{e(Uw(""))},[e]),i=l.useCallback(d=>{d.key==="Escape"&&s()},[s]),c=l.useCallback(d=>{o(d.target.value)},[o]);return l.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(B5,{children:[a.jsx(_g,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:c,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(wy,{children:a.jsx(Ia,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(Vne,{boxSize:2})})})]})},Kne=l.memo(qne);function HO(e){return JD(e)}function Qne(e){return ZD(e)}const WO=(e,t)=>{var o,s;if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROL_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload,d=c.board_id??"none",p=e.context.boardId;return d!==p}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload,d=((o=c[0])==null?void 0:o.board_id)??"none",p=e.context.boardId;return d!==p}return!1}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload;return(c.board_id??"none")!=="none"}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload;return(((s=c[0])==null?void 0:s.board_id)??"none")!=="none"}return!1}default:return!1}},Xne=e=>{const{isOver:t,label:n="Drop"}=e,r=l.useRef(Jc()),{colorMode:o}=ji();return a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Xe("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Xe("base.50","base.50")(o):Xe("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Le,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Xe("base.50","base.50")(o):Xe("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},VO=l.memo(Xne),Yne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=l.useRef(Jc()),{isOver:s,setNodeRef:i,active:c}=HO({id:o.current,disabled:r,data:n});return a.jsx(Le,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:c?"auto":"none",children:a.jsx(So,{children:WO(n,c)&&a.jsx(VO,{isOver:s,label:t})})})},C2=l.memo(Yne),Jne=({isSelected:e,isHovered:t})=>a.jsx(Le,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),w2=l.memo(Jne),Zne=()=>{const{t:e}=Q();return a.jsx(N,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Va,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:e("common.auto")})})},UO=l.memo(Zne);function S2(e){const[t,n]=l.useState(!1),[r,o]=l.useState(!1),[s,i]=l.useState(!1),[c,d]=l.useState([0,0]),p=l.useRef(null),h=H(g=>g.ui.globalContextMenuCloseTrigger);l.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),l.useEffect(()=>{n(!1),i(!1),o(!1)},[h]),WF("contextmenu",g=>{var b;(b=p.current)!=null&&b.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),d([g.pageX,g.pageY])):n(!1)});const m=l.useCallback(()=>{var g,b;(b=(g=e.menuProps)==null?void 0:g.onClose)==null||b.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Au,{...e.portalProps,children:a.jsxs(Mg,{isOpen:s,gutter:0,...e.menuProps,onClose:m,children:[a.jsx(Og,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:c[0],top:c[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const x0=e=>{const{boardName:t}=jf(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||NI("boards.uncategorized")}}});return t},ere=({board:e,setBoardToDelete:t})=>{const{t:n}=Q(),r=l.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(Kn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Zo,{}),onClick:r,children:n("boards.deleteBoard")})]})},tre=l.memo(ere),nre=()=>a.jsx(a.Fragment,{}),rre=l.memo(nre),ore=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=Q(),s=le(),i=l.useMemo(()=>me(we,({gallery:w})=>{const S=w.autoAddBoardId===t,j=w.autoAssignBoardOnClick;return{isAutoAdd:S,autoAssignBoardOnClick:j}},Ie),[t]),{isAutoAdd:c,autoAssignBoardOnClick:d}=H(i),p=x0(t),h=Pn("bulkDownload").isFeatureEnabled,[m]=$I(),g=l.useCallback(()=>{s(mg(t))},[t,s]),b=l.useCallback(async()=>{try{const w=await m({image_names:[],board_id:t}).unwrap();s(Ht({title:o("gallery.preparingDownload"),status:"success",...w.response?{description:w.response}:{}}))}catch{s(Ht({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,m,s]),y=l.useCallback(w=>{w.preventDefault()},[]),x=l.useCallback(()=>a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:y,children:a.jsxs(af,{title:p,children:[a.jsx(Kn,{icon:a.jsx(Zi,{}),isDisabled:c||d,onClick:g,children:o("boards.menuItemAutoAdd")}),h&&a.jsx(Kn,{icon:a.jsx(Wu,{}),onClickCapture:b,children:o("boards.downloadBoard")}),!e&&a.jsx(rre,{}),e&&a.jsx(tre,{board:e,setBoardToDelete:n})]})}),[d,e,p,b,g,c,h,n,y,o]);return a.jsx(S2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:x,children:r})},GO=l.memo(ore),sre=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=le(),o=l.useMemo(()=>me(we,({gallery:D})=>{const O=e.board_id===D.autoAddBoardId,T=D.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},Ie),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=H(o),[c,d]=l.useState(!1),p=l.useCallback(()=>{d(!0)},[]),h=l.useCallback(()=>{d(!1)},[]),{data:m}=Tx(e.board_id),{data:g}=Nx(e.board_id),b=l.useMemo(()=>{if(!((m==null?void 0:m.total)===void 0||(g==null?void 0:g.total)===void 0))return`${m.total} image${m.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,m]),{currentData:y}=Rs(e.cover_image_name??zs.skipToken),{board_name:x,board_id:w}=e,[S,j]=l.useState(x),I=l.useCallback(()=>{r(LI({boardId:w})),i&&r(mg(w))},[w,i,r]),[_,{isLoading:M}]=e7(),E=l.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),A=l.useCallback(async D=>{if(!D.trim()){j(x);return}if(D!==x)try{const{board_name:O}=await _({board_id:w,changes:{board_name:D}}).unwrap();j(O)}catch{j(x)}},[w,x,_]),R=l.useCallback(D=>{j(D)},[]);return a.jsx(Le,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:p,onMouseOut:h,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(GO,{board:e,board_id:w,setBoardToDelete:n,children:D=>a.jsx(Wn,{label:b,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:D,onClick:I,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(_i,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Gr,{boxSize:12,as:Zee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(UO,{}),a.jsx(w2,{isSelected:t,isHovered:c}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Lf,{value:S,isDisabled:M,submitOnBlur:!0,onChange:R,onSubmit:A,sx:{w:"full"},children:[a.jsx($f,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(Nf,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(C2,{data:E,dropLabel:a.jsx(je,{fontSize:"md",children:"Move"})})]})})})})})},are=l.memo(sre),ire=me(we,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Ie),qO=l.memo(({isSelected:e})=>{const t=le(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(ire),o=x0("none"),s=l.useCallback(()=>{t(LI({boardId:"none"})),r&&t(mg("none"))},[t,r]),[i,c]=l.useState(!1),{data:d}=Tx("none"),{data:p}=Nx("none"),h=l.useMemo(()=>{if(!((d==null?void 0:d.total)===void 0||(p==null?void 0:p.total)===void 0))return`${d.total} image${d.total===1?"":"s"}, ${p.total} asset${p.total===1?"":"s"}`},[p,d]),m=l.useCallback(()=>{c(!0)},[]),g=l.useCallback(()=>{c(!1)},[]),b=l.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Le,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:m,onMouseOut:g,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(GO,{board_id:"none",children:y=>a.jsx(Wn,{label:h,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:y,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(_i,{src:Rx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(UO,{}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(w2,{isSelected:e,isHovered:i}),a.jsx(C2,{data:b,dropLabel:a.jsx(je,{fontSize:"md",children:"Move"})})]})})})})})});qO.displayName="HoverableBoard";const lre=l.memo(qO),cre=me([we],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},Ie),ure=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=H(cre),{data:o}=jf(),s=r?o==null?void 0:o.filter(d=>d.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,c]=l.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Af,{in:t,animateOpacity:!0,children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Kne,{}),a.jsx(Wne,{})]}),a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(rl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(rf,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(lre,{isSelected:n==="none"})}),s&&s.map((d,p)=>a.jsx(rf,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(are,{board:d,isSelected:n===d.board_id,setBoardToDelete:c})},d.board_id))]})})]})}),a.jsx(Bne,{boardToDelete:i,setBoardToDelete:c})]})},dre=l.memo(ure),fre=me([we],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},Ie),pre=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=H(fre),o=x0(r),s=l.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(N,{as:nl,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(je,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(b0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},hre=l.memo(pre),mre=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Uf,{isLazy:o,...s,children:[a.jsx(Bg,{children:t}),a.jsxs(Gf,{shadow:"dark-lg",children:[r&&a.jsx(C3,{}),n]})]})},tp=l.memo(mre);function gre(e){return Ye({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const KO=De((e,t)=>{const[n,r]=l.useState(!1),{label:o,value:s,min:i=1,max:c=100,step:d=1,onChange:p,tooltipSuffix:h="",withSliderMarks:m=!1,withInput:g=!1,isInteger:b=!1,inputWidth:y=16,withReset:x=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:I,handleReset:_,sliderFormControlProps:M,sliderFormLabelProps:E,sliderMarkProps:A,sliderTrackProps:R,sliderThumbProps:D,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:K,sliderTooltipProps:G,sliderIAIIconButtonProps:X,...Z}=e,te=le(),{t:V}=Q(),[oe,ne]=l.useState(String(s));l.useEffect(()=>{ne(s)},[s]);const se=l.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),re=l.useMemo(()=>O!=null&&O.max?O.max:c,[c,O==null?void 0:O.max]),ae=l.useCallback(J=>{p(J)},[p]),B=l.useCallback(J=>{J.target.value===""&&(J.target.value=String(se));const ge=Hl(b?Math.floor(Number(J.target.value)):Number(oe),se,re),he=Pd(ge,d);p(he),ne(he)},[b,oe,se,re,p,d]),Y=l.useCallback(J=>{ne(J)},[]),$=l.useCallback(()=>{_&&_()},[_]),F=l.useCallback(J=>{J.target instanceof HTMLDivElement&&J.target.focus()},[]),q=l.useCallback(J=>{J.shiftKey&&te(Qo(!0))},[te]),pe=l.useCallback(J=>{J.shiftKey||te(Qo(!1))},[te]),W=l.useCallback(()=>r(!0),[]),U=l.useCallback(()=>r(!1),[]),ee=l.useCallback(()=>p(Number(oe)),[oe,p]);return a.jsxs(Vn,{ref:t,onClick:F,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...M,children:[o&&a.jsx(yr,{sx:g?{mb:-1.5}:{},...E,children:o}),a.jsxs(Pg,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Ny,{"aria-label":o,value:s,min:i,max:c,step:d,onChange:ae,onMouseEnter:W,onMouseLeave:U,focusThumbOnChange:!1,isDisabled:j,...Z,children:[m&&!I&&a.jsxs(a.Fragment,{children:[a.jsx(Fc,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...A,children:i}),a.jsx(Fc,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...A,children:c})]}),m&&I&&a.jsx(a.Fragment,{children:I.map((J,ge)=>ge===0?a.jsx(Fc,{value:J,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...A,children:J},J):ge===I.length-1?a.jsx(Fc,{value:J,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...A,children:J},J):a.jsx(Fc,{value:J,sx:{transform:"translateX(-50%)"},...A,children:J},J))}),a.jsx(Ly,{...R,children:a.jsx(zy,{})}),a.jsx(Wn,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${h}`,hidden:w,...G,children:a.jsx($y,{...D,zIndex:0})})]}),g&&a.jsxs(Tg,{min:se,max:re,step:d,value:oe,onChange:Y,onBlur:B,focusInputOnChange:!1,...O,children:[a.jsx($g,{onKeyDown:q,onKeyUp:pe,minWidth:y,...T}),a.jsxs(Ng,{...K,children:[a.jsx(zg,{onClick:ee}),a.jsx(Lg,{onClick:ee})]})]}),x&&a.jsx(rt,{size:"sm","aria-label":V("accessibility.reset"),tooltip:V("accessibility.reset"),icon:a.jsx(gre,{}),isDisabled:j,onClick:$,...X})]})]})});KO.displayName="IAISlider";const It=l.memo(KO),QO=l.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Wn,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Le,{ref:s,...o,children:a.jsxs(Le,{children:[a.jsx(xu,{children:e}),n&&a.jsx(xu,{size:"xs",color:"base.600",children:n})]})})}));QO.displayName="IAIMantineSelectItemWithTooltip";const pl=l.memo(QO),vre=me([we],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Ie),bre=()=>{const e=le(),{t}=Q(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(vre),o=l.useRef(null),{boards:s,hasBoards:i}=jf(void 0,{selectFromResult:({data:p})=>{const h=[{label:"None",value:"none"}];return p==null||p.forEach(({board_id:m,board_name:g})=>{h.push({label:g,value:m})}),{boards:h,hasBoards:h.length>1}}}),c=l.useCallback(p=>{p&&e(mg(p))},[e]),d=l.useCallback((p,h)=>{var m;return((m=h.label)==null?void 0:m.toLowerCase().includes(p.toLowerCase().trim()))||h.value.toLowerCase().includes(p.toLowerCase().trim())},[]);return a.jsx(sr,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:pl,disabled:!i||r,filter:d,onChange:c})},xre=l.memo(bre),yre=e=>{const{label:t,...n}=e,{colorMode:r}=ji();return a.jsx(Tf,{colorScheme:"accent",...n,children:a.jsx(je,{sx:{fontSize:"sm",color:Xe("base.800","base.200")(r)},children:t})})},Eo=l.memo(yre),Cre=me([we],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},Ie),wre=()=>{const e=le(),{t}=Q(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=H(Cre),s=l.useCallback(p=>{e(Gw(p))},[e]),i=l.useCallback(()=>{e(Gw(64))},[e]),c=l.useCallback(p=>{e(t7(p.target.checked))},[e]),d=l.useCallback(p=>e(n7(p.target.checked)),[e]);return a.jsx(tp,{triggerComponent:a.jsx(rt,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(nO,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(It,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(_r,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:c}),a.jsx(Eo,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:d}),a.jsx(xre,{})]})})},Sre=l.memo(wre),kre=e=>e.image?a.jsx(Wg,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(N,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(Ci,{size:"xl"})}),eo=e=>{const{icon:t=Xl,boxSize:n=16,sx:r,...o}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Gr,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(je,{textAlign:"center",children:e.label})]})},jre=e=>{const{sx:t,...n}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(Ci,{size:"xl"}),e.label&&a.jsx(je,{textAlign:"center",children:e.label})]})},y0=0,hl=1,Gu=2,XO=4;function YO(e,t){return n=>e(t(n))}function _re(e,t){return t(e)}function JO(e,t){return n=>e(t,n)}function n_(e,t){return()=>e(t)}function C0(e,t){return t(e),e}function Cr(...e){return e}function Ire(e){e()}function r_(e){return()=>e}function Pre(...e){return()=>{e.map(Ire)}}function k2(e){return e!==void 0}function qu(){}function Zn(e,t){return e(hl,t)}function pn(e,t){e(y0,t)}function j2(e){e(Gu)}function us(e){return e(XO)}function Lt(e,t){return Zn(e,JO(t,y0))}function xi(e,t){const n=e(hl,r=>{n(),t(r)});return n}function On(){const e=[];return(t,n)=>{switch(t){case Gu:e.splice(0,e.length);return;case hl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case y0:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function st(e){let t=e;const n=On();return(r,o)=>{switch(r){case hl:o(t);break;case y0:t=o;break;case XO:return t}return n(r,o)}}function Ere(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case hl:return s?n===s?void 0:(r(),n=s,t=Zn(e,s),t):(r(),qu);case Gu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function fs(e){return C0(On(),t=>Lt(e,t))}function Oo(e,t){return C0(st(t),n=>Lt(e,n))}function Mre(...e){return t=>e.reduceRight(_re,t)}function He(e,...t){const n=Mre(...t);return(r,o)=>{switch(r){case hl:return Zn(e,n(o));case Gu:j2(e);return}}}function ZO(e,t){return e===t}function br(e=ZO){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function rn(e){return t=>n=>{e(n)&&t(n)}}function yt(e){return t=>YO(t,e)}function ti(e){return t=>()=>t(e)}function ja(e,t){return n=>r=>n(t=e(t,r))}function _u(e){return t=>n=>{e>0?e--:t(n)}}function Xi(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function o_(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function bn(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);Zn(s,d=>{const p=n;n=n|c,t[i]=d,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>s([i].concat(t));n===o?c():r=c}}function s_(...e){return function(t,n){switch(t){case hl:return Pre(...e.map(r=>Zn(r,n)));case Gu:return;default:throw new Error(`unrecognized action ${t}`)}}}function nn(e,t=ZO){return He(e,br(t))}function ao(...e){const t=On(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);Zn(s,d=>{n[i]=d,r=r|c,r===o&&pn(t,n)})}),function(s,i){switch(s){case hl:return r===o&&i(n),Zn(t,i);case Gu:return j2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Yn(e,t=[],{singleton:n}={singleton:!0}){return{id:Ore(),constructor:e,dependencies:t,singleton:n}}const Ore=()=>Symbol();function Are(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const c=o(s.map(d=>n(d)));return i&&t.set(r,c),c};return n(e)}function Rre(e,t){const n={},r={};let o=0;const s=e.length;for(;o(w[S]=j=>{const I=x[t.methods[S]];pn(I,j)},w),{})}function h(x){return i.reduce((w,S)=>(w[S]=Ere(x[t.events[S]]),w),{})}return{Component:z.forwardRef((x,w)=>{const{children:S,...j}=x,[I]=z.useState(()=>C0(Are(e),M=>d(M,j))),[_]=z.useState(n_(h,I));return xh(()=>{for(const M of i)M in j&&Zn(_[M],j[M]);return()=>{Object.values(_).map(j2)}},[j,_,I]),xh(()=>{d(I,j)}),z.useImperativeHandle(w,r_(p(I))),z.createElement(c.Provider,{value:I},n?z.createElement(n,Rre([...r,...o,...i],j),S):S)}),usePublisher:x=>z.useCallback(JO(pn,z.useContext(c)[x]),[x]),useEmitterValue:x=>{const S=z.useContext(c)[x],[j,I]=z.useState(n_(us,S));return xh(()=>Zn(S,_=>{_!==j&&I(r_(_))}),[S,j]),j},useEmitter:(x,w)=>{const j=z.useContext(c)[x];xh(()=>Zn(j,w),[w,j])}}}const Dre=typeof document<"u"?z.useLayoutEffect:z.useEffect,Tre=Dre;var ps=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ps||{});const Nre={0:"debug",1:"log",2:"warn",3:"error"},$re=()=>typeof globalThis>"u"?window:globalThis,ml=Yn(()=>{const e=st(3);return{log:st((n,r,o=1)=>{var s;const i=(s=$re().VIRTUOSO_LOG_LEVEL)!=null?s:us(e);o>=i&&console[Nre[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function _2(e,t=!0){const n=z.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=z.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function ac(e,t=!0){return _2(e,t).callbackRef}function Lre(e,t,n,r,o,s,i){const c=z.useCallback(d=>{const p=zre(d.children,t,"offsetHeight",o);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const m=h.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:m?window.pageYOffset||document.documentElement.scrollTop:h.scrollTop,b=i?i.scrollHeight:m?document.documentElement.scrollHeight:h.scrollHeight,y=i?i.offsetHeight:m?window.innerHeight:h.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:b,viewportHeight:y}),s==null||s(Fre("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return _2(c,n)}function zre(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=m.target,b=g===window||g===document,y=b?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,x=b?document.documentElement.scrollHeight:g.scrollHeight,w=b?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:x,viewportHeight:w})};m.suppressFlushSync?S():r7.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===x-w)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);z.useEffect(()=>{const m=o||s.current;return r(o||s.current),d({target:m,suppressFlushSync:!0}),m.addEventListener("scroll",d,{passive:!0}),()=>{r(null),m.removeEventListener("scroll",d)}},[s,d,n,r,o]);function p(m){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const b=m.behavior==="smooth";let y,x,w;g===window?(x=Math.max(il(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(x=g.scrollHeight,y=il(g,"height"),w=g.scrollTop);const S=x-y;if(m.top=Math.ceil(Math.max(Math.min(S,m.top),0)),t8(y,x)||m.top===w){e({scrollTop:w,scrollHeight:x,viewportHeight:y}),b&&t(!0);return}b?(i.current=m.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(m)}function h(m){s.current.scrollBy(m)}return{scrollerRef:s,scrollByCallback:h,scrollToCallback:p}}const $o=Yn(()=>{const e=On(),t=On(),n=st(0),r=On(),o=st(0),s=On(),i=On(),c=st(0),d=st(0),p=st(0),h=st(0),m=On(),g=On(),b=st(!1);return Lt(He(e,yt(({scrollTop:y})=>y)),t),Lt(He(e,yt(({scrollHeight:y})=>y)),i),Lt(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:p,footerHeight:h,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:m,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),hf={lvl:0};function r8(e,t,n,r=hf,o=hf){return{k:e,v:t,lvl:n,l:r,r:o}}function or(e){return e===hf}function uu(){return hf}function ax(e,t){if(or(e))return hf;const{k:n,l:r,r:o}=e;if(t===n){if(or(r))return o;if(or(o))return r;{const[s,i]=o8(r);return Lh(Zr(e,{k:s,v:i,l:s8(r)}))}}else return tt&&(c=c.concat(ix(s,t,n))),r>=t&&r<=n&&c.push({k:r,v:o}),r<=n&&(c=c.concat(ix(i,t,n))),c}function Rl(e){return or(e)?[]:[...Rl(e.l),{k:e.k,v:e.v},...Rl(e.r)]}function o8(e){return or(e.r)?[e.k,e.v]:o8(e.r)}function s8(e){return or(e.r)?e.l:Lh(Zr(e,{r:s8(e.r)}))}function Zr(e,t){return r8(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function E1(e){return or(e)||e.lvl>e.r.lvl}function a_(e){return lx(i8(e))}function Lh(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(E1(t))return i8(Zr(e,{lvl:r-1}));if(!or(t)&&!or(t.r))return Zr(t.r,{l:Zr(t,{r:t.r.l}),r:Zr(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(E1(e))return lx(Zr(e,{lvl:r-1}));if(!or(n)&&!or(n.l)){const o=n.l,s=E1(o)?n.lvl-1:n.lvl;return Zr(o,{l:Zr(e,{r:o.l,lvl:r-1}),r:lx(Zr(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function w0(e,t,n){if(or(e))return[];const r=ca(e,t)[0];return Bre(ix(e,r,n))}function a8(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function lx(e){const{r:t,lvl:n}=e;return!or(t)&&!or(t.r)&&t.lvl===n&&t.r.lvl===n?Zr(t,{l:Zr(e,{r:t.l}),lvl:n+1}):e}function i8(e){const{l:t}=e;return!or(t)&&t.lvl===e.lvl?Zr(t,{r:Zr(e,{l:t.r})}):e}function og(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function l8(e,t,n){return e[og(e,t,n)]}function Hre(e,t,n,r){const o=og(e,t,r),s=og(e,n,r,o);return e.slice(o,s+1)}const I2=Yn(()=>({recalcInProgress:st(!1)}),[],{singleton:!0});function Wre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function i_(e,t){let n=0,r=0;for(;n=h||o===g)&&(e=ax(e,h)):(p=g!==o,d=!0),m>i&&i>=h&&g!==o&&(e=cs(e,i+1,g));p&&(e=cs(e,s,o))}return[e,n]}function Ure(){return{offsetTree:[],sizeTree:uu(),groupOffsetTree:uu(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function P2({index:e},t){return t===e?0:t0&&(t=Math.max(t,l8(e,r,P2).offset)),a8(Hre(e,t,n,Gre),qre)}function cx(e,t,n,r){let o=e,s=0,i=0,c=0,d=0;if(t!==0){d=og(o,t-1,P2),c=o[d].offset;const h=ca(n,t-1);s=h[0],i=h[1],o.length&&o[d].size===ca(n,t)[1]&&(d-=1),o=o.slice(0,d+1)}else o=[];for(const{start:p,value:h}of w0(n,t,1/0)){const m=p-s,g=m*i+c+m*r;o.push({offset:g,size:h,index:p}),s=p,c=g,i=h}return{offsetTree:o,lastIndex:s,lastOffset:c,lastSize:i}}function Qre(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,ps.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&or(s)&&t.length===2){const g=t[0].size,b=t[1].size;i=n.reduce((y,x)=>cs(cs(y,x,g),x+1,b),i)}else[i,c]=Vre(i,t);if(i===s)return e;const{offsetTree:d,lastIndex:p,lastSize:h,lastOffset:m}=cx(e.offsetTree,c,i,o);return{sizeTree:i,offsetTree:d,lastIndex:p,lastOffset:m,lastSize:h,groupOffsetTree:n.reduce((g,b)=>cs(g,b,gf(b,d,o)),uu()),groupIndices:n}}function gf(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=l8(t,e,P2),i=e-o,c=s*i+(i-1)*n+r;return c>0?c+n:c}function Xre(e){return typeof e.groupIndex<"u"}function c8(e,t,n){if(Xre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=u8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function u8(e,t){if(!S0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function S0(e){return!or(e.groupOffsetTree)}function Yre(e){return Rl(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const Jre={offsetHeight:"height",offsetWidth:"width"},Ua=Yn(([{log:e},{recalcInProgress:t}])=>{const n=On(),r=On(),o=Oo(r,0),s=On(),i=On(),c=st(0),d=st([]),p=st(void 0),h=st(void 0),m=st((M,E)=>il(M,Jre[E])),g=st(void 0),b=st(0),y=Ure(),x=Oo(He(n,bn(d,e,b),ja(Qre,y),br()),y),w=Oo(He(d,br(),ja((M,E)=>({prev:M.current,current:E}),{prev:[],current:[]}),yt(({prev:M})=>M)),[]);Lt(He(d,rn(M=>M.length>0),bn(x,b),yt(([M,E,A])=>{const R=M.reduce((D,O,T)=>cs(D,O,gf(O,E.offsetTree,A)||T),uu());return{...E,groupIndices:M,groupOffsetTree:R}})),x),Lt(He(r,bn(x),rn(([M,{lastIndex:E}])=>M[{startIndex:M,endIndex:E,size:A}])),n),Lt(p,h);const S=Oo(He(p,yt(M=>M===void 0)),!0);Lt(He(h,rn(M=>M!==void 0&&or(us(x).sizeTree)),yt(M=>[{startIndex:0,endIndex:0,size:M}])),n);const j=fs(He(n,bn(x),ja(({sizes:M},[E,A])=>({changed:A!==M,sizes:A}),{changed:!1,sizes:y}),yt(M=>M.changed)));Zn(He(c,ja((M,E)=>({diff:M.prev-E,prev:E}),{diff:0,prev:0}),yt(M=>M.diff)),M=>{const{groupIndices:E}=us(x);if(M>0)pn(t,!0),pn(s,M+i_(M,E));else if(M<0){const A=us(w);A.length>0&&(M-=i_(-M,A)),pn(i,M)}}),Zn(He(c,bn(e)),([M,E])=>{M<0&&E("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},ps.ERROR)});const I=fs(s);Lt(He(s,bn(x),yt(([M,E])=>{const A=E.groupIndices.length>0,R=[],D=E.lastSize;if(A){const O=mf(E.sizeTree,0);let T=0,K=0;for(;T{let oe=Z.ranges;return Z.prevSize!==0&&(oe=[...Z.ranges,{startIndex:Z.prevIndex,endIndex:te+M-1,size:Z.prevSize}]),{ranges:oe,prevIndex:te+M,prevSize:V}},{ranges:R,prevIndex:M,prevSize:0}).ranges}return Rl(E.sizeTree).reduce((O,{k:T,v:K})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+M-1,size:O.prevSize}],prevIndex:T+M,prevSize:K}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const _=fs(He(i,bn(x,b),yt(([M,{offsetTree:E},A])=>{const R=-M;return gf(R,E,A)})));return Lt(He(i,bn(x,b),yt(([M,E,A])=>{if(E.groupIndices.length>0){if(or(E.sizeTree))return E;let D=uu();const O=us(w);let T=0,K=0,G=0;for(;T<-M;){G=O[K];const Z=O[K+1]-G-1;K++,T+=Z+1}if(D=Rl(E.sizeTree).reduce((Z,{k:te,v:V})=>cs(Z,Math.max(0,te+M),V),D),T!==-M){const Z=mf(E.sizeTree,G);D=cs(D,0,Z);const te=ca(E.sizeTree,-M+1)[1];D=cs(D,1,te)}return{...E,sizeTree:D,...cx(E.offsetTree,0,D,A)}}else{const D=Rl(E.sizeTree).reduce((O,{k:T,v:K})=>cs(O,Math.max(0,T+M),K),uu());return{...E,sizeTree:D,...cx(E.offsetTree,0,D,A)}}})),x),{data:g,totalCount:r,sizeRanges:n,groupIndices:d,defaultItemSize:h,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:_,beforeUnshiftWith:I,firstItemIndex:c,gap:b,sizes:x,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:m}},Cr(ml,I2),{singleton:!0}),Zre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function d8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Zre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const np=Yn(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:c,headerHeight:d,footerHeight:p,fixedHeaderHeight:h,fixedFooterHeight:m},{log:g}])=>{const b=On(),y=st(0);let x=null,w=null,S=null;function j(){x&&(x(),x=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),pn(o,!1)}return Lt(He(b,bn(e,s,t,y,d,p,g),bn(r,h,m),yt(([[I,_,M,E,A,R,D,O],T,K,G])=>{const X=d8(I),{align:Z,behavior:te,offset:V}=X,oe=E-1,ne=c8(X,_,oe);let se=gf(ne,_.offsetTree,T)+R;Z==="end"?(se+=K+ca(_.sizeTree,ne)[1]-M+G,ne===oe&&(se+=D)):Z==="center"?se+=(K+ca(_.sizeTree,ne)[1]-M+G)/2:se-=A,V&&(se+=V);const re=ae=>{j(),ae?(O("retrying to scroll to",{location:I},ps.DEBUG),pn(b,I)):O("list did not change, scroll successful",{},ps.DEBUG)};if(j(),te==="smooth"){let ae=!1;S=Zn(n,B=>{ae=ae||B}),x=xi(c,()=>{re(ae)})}else x=xi(He(n,eoe(150)),re);return w=setTimeout(()=>{j()},1200),pn(o,!0),O("scrolling from index to",{index:ne,top:se,behavior:te},ps.DEBUG),{top:se,behavior:te}})),i),{scrollToIndex:b,topListHeight:y}},Cr(Ua,$o,ml),{singleton:!0});function eoe(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const vf="up",qd="down",toe="none",noe={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},roe=0,rp=Yn(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=st(!1),c=st(!0),d=On(),p=On(),h=st(4),m=st(roe),g=Oo(He(s_(He(nn(t),_u(1),ti(!0)),He(nn(t),_u(1),ti(!1),o_(100))),br()),!1),b=Oo(He(s_(He(s,ti(!0)),He(s,ti(!1),o_(200))),br()),!1);Lt(He(ao(nn(t),nn(m)),yt(([j,I])=>j<=I),br()),c),Lt(He(c,Xi(50)),p);const y=fs(He(ao(e,nn(n),nn(r),nn(o),nn(h)),ja((j,[{scrollTop:I,scrollHeight:_},M,E,A,R])=>{const D=I+M-_>-R,O={viewportHeight:M,scrollTop:I,scrollHeight:_};if(D){let K,G;return I>j.state.scrollTop?(K="SCROLLED_DOWN",G=j.state.scrollTop-I):(K="SIZE_DECREASED",G=j.state.scrollTop-I||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:K,scrollTopDelta:G}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Mj&&j.atBottom===I.atBottom))),x=Oo(He(e,ja((j,{scrollTop:I,scrollHeight:_,viewportHeight:M})=>{if(t8(j.scrollHeight,_))return{scrollTop:I,scrollHeight:_,jump:0,changed:!1};{const E=_-(I+M)<1;return j.scrollTop!==I&&E?{scrollHeight:_,scrollTop:I,jump:j.scrollTop-I,changed:!0}:{scrollHeight:_,scrollTop:I,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),rn(j=>j.changed),yt(j=>j.jump)),0);Lt(He(y,yt(j=>j.atBottom)),i),Lt(He(i,Xi(50)),d);const w=st(qd);Lt(He(e,yt(({scrollTop:j})=>j),br(),ja((j,I)=>us(b)?{direction:j.direction,prevScrollTop:I}:{direction:Ij.direction)),w),Lt(He(e,Xi(50),ti(toe)),w);const S=st(0);return Lt(He(g,rn(j=>!j),ti(0)),S),Lt(He(t,Xi(100),bn(g),rn(([j,I])=>!!I),ja(([j,I],[_])=>[I,_],[0,0]),yt(([j,I])=>I-j)),S),{isScrolling:g,isAtTop:c,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:d,scrollDirection:w,atBottomThreshold:h,atTopThreshold:m,scrollVelocity:S,lastJumpDueToItemResize:x}},Cr($o)),gl=Yn(([{log:e}])=>{const t=st(!1),n=fs(He(t,rn(r=>r),br()));return Zn(t,r=>{r&&us(e)("props updated",{},ps.DEBUG)}),{propsReady:t,didMount:n}},Cr(ml),{singleton:!0});function E2(e,t){e==0?t():requestAnimationFrame(()=>E2(e-1,t))}function M2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const op=Yn(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=st(!0),c=st(0),d=st(!1);return Lt(He(s,bn(c),rn(([p,h])=>!!h),ti(!1)),i),Zn(He(ao(t,s),bn(i,e,n,d),rn(([[,p],h,{sizeTree:m},g,b])=>p&&(!or(m)||k2(g))&&!h&&!b),bn(c)),([,p])=>{pn(d,!0),E2(3,()=>{xi(r,()=>pn(i,!0)),pn(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:c}},Cr(Ua,$o,np,gl),{singleton:!0});function l_(e){return e?e==="smooth"?"smooth":"auto":!1}const ooe=(e,t)=>typeof e=="function"?l_(e(t)):t&&l_(e),soe=Yn(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:c},{log:d},{scrollingInProgress:p}])=>{const h=st(!1),m=On();let g=null;function b(x){pn(o,{index:"LAST",align:"end",behavior:x})}Zn(He(ao(He(nn(e),_u(1)),c),bn(nn(h),n,s,p),yt(([[x,w],S,j,I,_])=>{let M=w&&I,E="auto";return M&&(E=ooe(S,j||_),M=M&&!!E),{totalCount:x,shouldFollow:M,followOutputBehavior:E}}),rn(({shouldFollow:x})=>x)),({totalCount:x,followOutputBehavior:w})=>{g&&(g(),g=null),g=xi(t,()=>{us(d)("following output to ",{totalCount:x},ps.DEBUG),b(w),g=null})});function y(x){const w=xi(r,S=>{x&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(us(d)("scrolling to bottom due to increased size",{},ps.DEBUG),b("auto"))});setTimeout(w,100)}return Zn(He(ao(nn(h),e,i),rn(([x,,w])=>x&&w),ja(({value:x},[,w])=>({refreshed:x===w,value:w}),{refreshed:!1,value:0}),rn(({refreshed:x})=>x),bn(h,e)),([,x])=>{y(x!==!1)}),Zn(m,()=>{y(us(h)!==!1)}),Zn(ao(nn(h),r),([x,w])=>{x&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&b("auto")}),{followOutput:h,autoscrollToBottom:m}},Cr(Ua,rp,np,op,gl,ml,$o));function aoe(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const f8=Yn(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=On(),i=On(),c=fs(He(s,yt(aoe)));return Lt(He(c,yt(d=>d.totalCount)),e),Lt(He(c,yt(d=>d.groupIndices)),t),Lt(He(ao(r,n,o),rn(([d,p])=>S0(p)),yt(([d,p,h])=>ca(p.groupOffsetTree,Math.max(d-h,0),"v")[0]),br(),yt(d=>[d])),i),{groupCounts:s,topItemsIndexes:i}},Cr(Ua,$o));function bf(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function p8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const sg="top",ag="bottom",c_="none";function u_(e,t,n){return typeof e=="number"?n===vf&&t===sg||n===qd&&t===ag?e:0:n===vf?t===sg?e.main:e.reverse:t===ag?e.main:e.reverse}function d_(e,t){return typeof e=="number"?e:e[t]||0}const O2=Yn(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=On(),i=st(0),c=st(0),d=st(0),p=Oo(He(ao(nn(e),nn(t),nn(r),nn(s,bf),nn(d),nn(i),nn(o),nn(n),nn(c)),yt(([h,m,g,[b,y],x,w,S,j,I])=>{const _=h-j,M=w+S,E=Math.max(g-_,0);let A=c_;const R=d_(I,sg),D=d_(I,ag);return b-=j,b+=g+S,y+=g+S,y-=j,b>h+M-R&&(A=vf),yh!=null),br(bf)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:i,increaseViewportBy:c,visibleRange:p}},Cr($o),{singleton:!0});function ioe(e,t,n){if(S0(t)){const r=u8(e,t);return[{index:ca(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const M1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function f_(e,t,n){if(e.length===0)return[];if(!S0(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=w0(t.groupOffsetTree,r,o);let c,d=0;for(const p of e){(!c||c.end0){p=e[0].offset;const x=e[e.length-1];h=x.offset+x.size}const m=n-d,g=c+m*i+(m-1)*r,b=p,y=g-h;return{items:f_(e,o,s),topItems:f_(t,o,s),topListHeight:t.reduce((x,w)=>w.size+x,0),offsetTop:p,offsetBottom:y,top:b,bottom:h,totalCount:n,firstItemIndex:s}}function h8(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const h of n.groupIndices){if(h-i>=e)break;i++}const c=e+i,d=M2(t,c),p=Array.from({length:c}).map((h,m)=>({index:m+d,size:0,offset:0,data:s[m+d]}));return zh(p,[],c,o,n,r)}const ic=Yn(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:c,topListHeight:d},{scrolledToInitialItem:p,initialTopMostItemIndex:h},{topListHeight:m},g,{didMount:b},{recalcInProgress:y}])=>{const x=st([]),w=st(0),S=On();Lt(s.topItemsIndexes,x);const j=Oo(He(ao(b,y,nn(i,bf),nn(t),nn(e),nn(h),p,nn(x),nn(r),nn(o),n),rn(([E,A,,R,,,,,,,D])=>{const O=D&&D.length!==R;return E&&!A&&!O}),yt(([,,[E,A],R,D,O,T,K,G,X,Z])=>{const te=D,{sizeTree:V,offsetTree:oe}=te,ne=us(w);if(R===0)return{...M1,totalCount:R};if(E===0&&A===0)return ne===0?{...M1,totalCount:R}:h8(ne,O,D,G,X,Z||[]);if(or(V))return ne>0?null:zh(ioe(M2(O,R),te,Z),[],R,X,te,G);const se=[];if(K.length>0){const $=K[0],F=K[K.length-1];let q=0;for(const pe of w0(V,$,F)){const W=pe.value,U=Math.max(pe.start,$),ee=Math.min(pe.end,F);for(let J=U;J<=ee;J++)se.push({index:J,size:W,offset:q,data:Z&&Z[J]}),q+=W}}if(!T)return zh([],se,R,X,te,G);const re=K.length>0?K[K.length-1]+1:0,ae=Kre(oe,E,A,re);if(ae.length===0)return null;const B=R-1,Y=C0([],$=>{for(const F of ae){const q=F.value;let pe=q.offset,W=F.start;const U=q.size;if(q.offset=A);J++)$.push({index:J,size:U,offset:pe,data:Z&&Z[J]}),pe+=U+X}});return zh(Y,se,R,X,te,G)}),rn(E=>E!==null),br()),M1);Lt(He(n,rn(k2),yt(E=>E==null?void 0:E.length)),t),Lt(He(j,yt(E=>E.topListHeight)),m),Lt(m,d),Lt(He(j,yt(E=>[E.top,E.bottom])),c),Lt(He(j,yt(E=>E.items)),S);const I=fs(He(j,rn(({items:E})=>E.length>0),bn(t,n),rn(([{items:E},A])=>E[E.length-1].originalIndex===A-1),yt(([,E,A])=>[E-1,A]),br(bf),yt(([E])=>E))),_=fs(He(j,Xi(200),rn(({items:E,topItems:A})=>E.length>0&&E[0].originalIndex===A.length),yt(({items:E})=>E[0].index),br())),M=fs(He(j,rn(({items:E})=>E.length>0),yt(({items:E})=>{let A=0,R=E.length-1;for(;E[A].type==="group"&&AA;)R--;return{startIndex:E[A].index,endIndex:E[R].index}}),br(p8)));return{listState:j,topItemsIndexes:x,endReached:I,startReached:_,rangeChanged:M,itemsRendered:S,initialItemCount:w,...g}},Cr(Ua,f8,O2,op,np,rp,gl,I2),{singleton:!0}),loe=Yn(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:c}])=>(Lt(He(c,bn(s),rn(([,d])=>d!==0),bn(o,e,t,r,n),yt(([[,d],p,h,m,g,b=[]])=>h8(d,p,h,m,g,b))),i),{}),Cr(Ua,op,ic,gl),{singleton:!0}),m8=Yn(([{scrollVelocity:e}])=>{const t=st(!1),n=On(),r=st(!1);return Lt(He(e,bn(r,t,n),rn(([o,s])=>!!s),yt(([o,s,i,c])=>{const{exit:d,enter:p}=s;if(i){if(d(o,c))return!1}else if(p(o,c))return!0;return i}),br()),t),Zn(He(ao(t,e,n),bn(r)),([[o,s,i],c])=>o&&c&&c.change&&c.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Cr(rp),{singleton:!0}),coe=Yn(([{topItemsIndexes:e}])=>{const t=st(0);return Lt(He(t,rn(n=>n>0),yt(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Cr(ic)),g8=Yn(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=On(),i=Oo(He(ao(e,r,t,n,o),yt(([c,d,p,h,m])=>c+d+p+h+m.offsetBottom+m.bottom)),0);return Lt(nn(i),s),{totalListHeight:i,totalListHeightChanged:s}},Cr($o,ic),{singleton:!0});function v8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const uoe=v8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),doe=Yn(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:c},{listState:d},{beforeUnshiftWith:p,shiftWithOffset:h,sizes:m,gap:g},{log:b},{recalcInProgress:y}])=>{const x=fs(He(d,bn(c),ja(([,S,j,I],[{items:_,totalCount:M,bottom:E,offsetBottom:A},R])=>{const D=E+A;let O=0;return j===M&&S.length>0&&_.length>0&&(_[0].originalIndex===0&&S[0].originalIndex===0||(O=D-I,O!==0&&(O+=R))),[O,_,M,D]},[0,[],0,0]),rn(([S])=>S!==0),bn(t,i,r,s,b,y),rn(([,S,j,I,,,_])=>!_&&!I&&S!==0&&j===vf),yt(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},ps.DEBUG),S))));function w(S){S>0?(pn(e,{top:-S,behavior:"auto"}),pn(n,0)):(pn(n,0),pn(e,{top:-S,behavior:"auto"}))}return Zn(He(x,bn(n,o)),([S,j,I])=>{I&&uoe()?pn(n,j-S):w(-S)}),Zn(He(ao(Oo(o,!1),n,y),rn(([S,j,I])=>!S&&!I&&j!==0),yt(([S,j])=>j),Xi(1)),w),Lt(He(h,yt(S=>({top:-S}))),e),Zn(He(p,bn(m,g),yt(([S,{lastSize:j,groupIndices:I,sizeTree:_},M])=>{function E(A){return A*(j+M)}if(I.length===0)return E(S);{let A=0;const R=mf(_,0);let D=0,O=0;for(;DS&&(A-=R,T=S-D+1),D+=T,A+=E(T),O++}return A}})),S=>{pn(n,S),requestAnimationFrame(()=>{pn(e,{top:S}),requestAnimationFrame(()=>{pn(n,0),pn(y,!1)})})}),{deviation:n}},Cr($o,rp,ic,Ua,ml,I2)),foe=Yn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=st(0);return Zn(He(e,bn(r),rn(([,o])=>o!==0),yt(([,o])=>({top:o}))),o=>{xi(He(n,_u(1),rn(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{pn(t,o)})})}),{initialScrollTop:r}},Cr(gl,$o,ic),{singleton:!0}),poe=Yn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=st(!1),r=Oo(He(ao(n,e,t),rn(([o])=>o),yt(([,o,s])=>Math.max(0,o-s)),Xi(0),br()),0);return{alignToBottom:n,paddingTopAddition:r}},Cr($o,g8),{singleton:!0}),A2=Yn(([{scrollTo:e,scrollContainerState:t}])=>{const n=On(),r=On(),o=On(),s=st(!1),i=st(void 0);return Lt(He(ao(n,r),yt(([{viewportHeight:c,scrollTop:d,scrollHeight:p},{offsetTop:h}])=>({scrollTop:Math.max(0,d-h),scrollHeight:p,viewportHeight:c}))),t),Lt(He(e,bn(r),yt(([c,{offsetTop:d}])=>({...c,top:c.top+d}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Cr($o)),hoe=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,moe=Yn(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:c,scrollingInProgress:d},{scrollToIndex:p}])=>{const h=On();return Lt(He(h,bn(e,o,t,s,i,c,r),bn(n),yt(([[m,g,b,y,x,w,S,j],I])=>{const{done:_,behavior:M,align:E,calculateViewLocation:A=hoe,...R}=m,D=c8(m,g,y-1),O=gf(D,g.offsetTree,I)+x+w,T=O+ca(g.sizeTree,D)[1],K=j+w,G=j+b-S,X=A({itemTop:O,itemBottom:T,viewportTop:K,viewportBottom:G,locationParams:{behavior:M,align:E,...R}});return X?_&&xi(He(d,rn(Z=>Z===!1),_u(us(d)?1:2)),_):_&&_(),X}),rn(m=>m!==null)),p),{scrollIntoView:h}},Cr(Ua,$o,np,ic,ml),{singleton:!0}),goe=Yn(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:c}])=>{const d=On(),p=st(void 0),h=st(null),m=st(null);return Lt(i,h),Lt(c,m),Zn(He(d,bn(e,n,s,h,m)),([g,b,y,x,w,S])=>{const j=Yre(b.sizeTree);x&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),Lt(He(p,rn(k2),yt(voe)),r),Lt(He(o,bn(p),rn(([,g])=>g!==void 0),br(),yt(([,g])=>g.ranges)),t),{getState:d,restoreStateFrom:p}},Cr(Ua,$o,op,gl,A2));function voe(e){return{offset:e.scrollTop,index:0,align:"start"}}const boe=Yn(([e,t,n,r,o,s,i,c,d,p])=>({...e,...t,...n,...r,...o,...s,...i,...c,...d,...p}),Cr(O2,loe,gl,m8,g8,foe,poe,A2,moe,ml)),xoe=Yn(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:c,groupIndices:d,statefulTotalCount:p,gap:h,sizes:m},{initialTopMostItemIndex:g,scrolledToInitialItem:b},y,x,w,{listState:S,topItemsIndexes:j,...I},{scrollToIndex:_},M,{topItemCount:E},{groupCounts:A},R])=>(Lt(I.rangeChanged,R.scrollSeekRangeChanged),Lt(He(R.windowViewportRect,yt(D=>D.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:c,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:b,topItemsIndexes:j,topItemCount:E,groupCounts:A,fixedItemHeight:n,defaultItemHeight:r,gap:h,...w,statefulTotalCount:p,listState:S,scrollToIndex:_,trackItemSizes:o,itemSize:s,groupIndices:d,...I,...R,...y,sizes:m,...x}),Cr(Ua,op,$o,goe,soe,ic,np,doe,coe,f8,boe)),O1="-webkit-sticky",p_="sticky",b8=v8(()=>{if(typeof document>"u")return p_;const e=document.createElement("div");return e.style.position=O1,e.style.position===O1?O1:p_});function x8(e,t){const n=z.useRef(null),r=z.useCallback(c=>{if(c===null||!c.offsetParent)return;const d=c.getBoundingClientRect(),p=d.width;let h,m;if(t){const g=t.getBoundingClientRect(),b=d.top-g.top;h=g.height-Math.max(0,b),m=b+t.scrollTop}else h=window.innerHeight-Math.max(0,d.top),m=d.top+window.pageYOffset;n.current={offsetTop:m,visibleHeight:h,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=_2(r),i=z.useCallback(()=>{r(s.current)},[r,s]);return z.useEffect(()=>{if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(i);return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const y8=z.createContext(void 0),C8=z.createContext(void 0);function w8(e){return e}const yoe=Yn(()=>{const e=st(d=>`Item ${d}`),t=st(null),n=st(d=>`Group ${d}`),r=st({}),o=st(w8),s=st("div"),i=st(qu),c=(d,p=null)=>Oo(He(r,yt(h=>h[d]),br()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:c("Footer"),HeaderComponent:c("Header"),TopItemListComponent:c("TopItemList"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),GroupComponent:c("Group","div"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder")}}),Coe=Yn(([e,t])=>({...e,...t}),Cr(xoe,yoe)),woe=({height:e})=>z.createElement("div",{style:{height:e}}),Soe={position:b8(),zIndex:1,overflowAnchor:"none"},koe={overflowAnchor:"none"},h_=z.memo(function({showTopList:t=!1}){const n=In("listState"),r=Es("sizeRanges"),o=In("useWindowScroll"),s=In("customScrollParent"),i=Es("windowScrollContainerState"),c=Es("scrollContainerState"),d=s||o?i:c,p=In("itemContent"),h=In("context"),m=In("groupContent"),g=In("trackItemSizes"),b=In("itemSize"),y=In("log"),x=Es("gap"),{callbackRef:w}=Lre(r,b,g,t?qu:d,y,x,s),[S,j]=z.useState(0);R2("deviation",X=>{S!==X&&j(X)});const I=In("EmptyPlaceholder"),_=In("ScrollSeekPlaceholder")||woe,M=In("ListComponent"),E=In("ItemComponent"),A=In("GroupComponent"),R=In("computeItemKey"),D=In("isSeeking"),O=In("groupIndices").length>0,T=In("paddingTopAddition"),K=In("scrolledToInitialItem"),G=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...K?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&I?z.createElement(I,Uo(I,h)):z.createElement(M,{...Uo(M,h),ref:w,style:G,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(X=>{const Z=X.originalIndex,te=R(Z+n.firstItemIndex,X.data,h);return D?z.createElement(_,{...Uo(_,h),key:te,index:X.index,height:X.size,type:X.type||"item",...X.type==="group"?{}:{groupIndex:X.groupIndex}}):X.type==="group"?z.createElement(A,{...Uo(A,h),key:te,"data-index":Z,"data-known-size":X.size,"data-item-index":X.index,style:Soe},m(X.index,h)):z.createElement(E,{...Uo(E,h),...Ioe(E,X.data),key:te,"data-index":Z,"data-known-size":X.size,"data-item-index":X.index,"data-item-group-index":X.groupIndex,style:koe},O?p(X.index,X.groupIndex,X.data,h):p(X.index,X.data,h))}))}),joe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},k0={width:"100%",height:"100%",position:"absolute",top:0},_oe={width:"100%",position:b8(),top:0,zIndex:1};function Uo(e,t){if(typeof e!="string")return{context:t}}function Ioe(e,t){return{item:typeof e=="string"?void 0:t}}const Poe=z.memo(function(){const t=In("HeaderComponent"),n=Es("headerHeight"),r=In("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=In("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null}),Eoe=z.memo(function(){const t=In("FooterComponent"),n=Es("footerHeight"),r=In("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=In("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null});function S8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return z.memo(function({style:s,children:i,...c}){const d=e("scrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("scrollerRef"),g=n("context"),{scrollerRef:b,scrollByCallback:y,scrollToCallback:x}=n8(d,h,p,m);return t("scrollTo",x),t("scrollBy",y),z.createElement(p,{ref:b,style:{...joe,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...Uo(p,g)},i)})}function k8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return z.memo(function({style:s,children:i,...c}){const d=e("windowScrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("totalListHeight"),g=n("deviation"),b=n("customScrollParent"),y=n("context"),{scrollerRef:x,scrollByCallback:w,scrollToCallback:S}=n8(d,h,p,qu,b);return Tre(()=>(x.current=b||window,()=>{x.current=null}),[x,b]),t("windowScrollTo",S),t("scrollBy",w),z.createElement(p,{style:{position:"relative",...s,...m!==0?{height:m+g}:{}},"data-virtuoso-scroller":!0,...c,...Uo(p,y)},i)})}const Moe=({children:e})=>{const t=z.useContext(y8),n=Es("viewportHeight"),r=Es("fixedItemHeight"),o=ac(YO(n,s=>il(s,"height")));return z.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),z.createElement("div",{style:k0,ref:o,"data-viewport-type":"element"},e)},Ooe=({children:e})=>{const t=z.useContext(y8),n=Es("windowViewportRect"),r=Es("fixedItemHeight"),o=In("customScrollParent"),s=x8(n,o);return z.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),z.createElement("div",{ref:s,style:k0,"data-viewport-type":"window"},e)},Aoe=({children:e})=>{const t=In("TopItemListComponent"),n=In("headerHeight"),r={..._oe,marginTop:`${n}px`},o=In("context");return z.createElement(t||"div",{style:r,context:o},e)},Roe=z.memo(function(t){const n=In("useWindowScroll"),r=In("topItemsIndexes").length>0,o=In("customScrollParent"),s=o||n?Noe:Toe,i=o||n?Ooe:Moe;return z.createElement(s,{...t},r&&z.createElement(Aoe,null,z.createElement(h_,{showTopList:!0})),z.createElement(i,null,z.createElement(Poe,null),z.createElement(h_,null),z.createElement(Eoe,null)))}),{Component:Doe,usePublisher:Es,useEmitterValue:In,useEmitter:R2}=e8(Coe,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Roe),Toe=S8({usePublisher:Es,useEmitterValue:In,useEmitter:R2}),Noe=k8({usePublisher:Es,useEmitterValue:In,useEmitter:R2}),$oe=Doe,m_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Loe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:g_,ceil:v_,floor:ig,min:A1,max:Kd}=Math;function zoe(e){return{...Loe,items:e}}function b_(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function Foe(e,t){return e&&e.column===t.column&&e.row===t.row}function yh(e,t){return e&&e.width===t.width&&e.height===t.height}const Boe=Yn(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:c,scrollContainerState:d,footerHeight:p,headerHeight:h},m,g,{propsReady:b,didMount:y},{windowViewportRect:x,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:I},_])=>{const M=st(0),E=st(0),A=st(m_),R=st({height:0,width:0}),D=st({height:0,width:0}),O=On(),T=On(),K=st(0),G=st(null),X=st({row:0,column:0}),Z=On(),te=On(),V=st(!1),oe=st(0),ne=st(!0),se=st(!1);Zn(He(y,bn(oe),rn(([F,q])=>!!q)),()=>{pn(ne,!1),pn(E,0)}),Zn(He(ao(y,ne,D,R,oe,se),rn(([F,q,pe,W,,U])=>F&&!q&&pe.height!==0&&W.height!==0&&!U)),([,,,,F])=>{pn(se,!0),E2(1,()=>{pn(O,F)}),xi(He(r),()=>{pn(n,[0,0]),pn(ne,!0)})}),Lt(He(te,rn(F=>F!=null&&F.scrollTop>0),ti(0)),E),Zn(He(y,bn(te),rn(([,F])=>F!=null)),([,F])=>{F&&(pn(R,F.viewport),pn(D,F==null?void 0:F.item),pn(X,F.gap),F.scrollTop>0&&(pn(V,!0),xi(He(r,_u(1)),q=>{pn(V,!1)}),pn(i,{top:F.scrollTop})))}),Lt(He(R,yt(({height:F})=>F)),o),Lt(He(ao(nn(R,yh),nn(D,yh),nn(X,(F,q)=>F&&F.column===q.column&&F.row===q.row),nn(r)),yt(([F,q,pe,W])=>({viewport:F,item:q,gap:pe,scrollTop:W}))),Z),Lt(He(ao(nn(M),t,nn(X,Foe),nn(D,yh),nn(R,yh),nn(G),nn(E),nn(V),nn(ne),nn(oe)),rn(([,,,,,,,F])=>!F),yt(([F,[q,pe],W,U,ee,J,ge,,he,de])=>{const{row:_e,column:Pe}=W,{height:ze,width:ht}=U,{width:Je}=ee;if(ge===0&&(F===0||Je===0))return m_;if(ht===0){const Rt=M2(de,F),zt=Rt===0?Math.max(ge-1,0):Rt;return zoe(b_(Rt,zt,J))}const qt=j8(Je,ht,Pe);let Pt,jt;he?q===0&&pe===0&&ge>0?(Pt=0,jt=ge-1):(Pt=qt*ig((q+_e)/(ze+_e)),jt=qt*v_((pe+_e)/(ze+_e))-1,jt=A1(F-1,Kd(jt,qt-1)),Pt=A1(jt,Kd(0,Pt))):(Pt=0,jt=-1);const Se=b_(Pt,jt,J),{top:Fe,bottom:it}=x_(ee,W,U,Se),At=v_(F/qt),lt=At*ze+(At-1)*_e-it;return{items:Se,offsetTop:Fe,offsetBottom:lt,top:Fe,bottom:it,itemHeight:ze,itemWidth:ht}})),A),Lt(He(G,rn(F=>F!==null),yt(F=>F.length)),M),Lt(He(ao(R,D,A,X),rn(([F,q,{items:pe}])=>pe.length>0&&q.height!==0&&F.height!==0),yt(([F,q,{items:pe},W])=>{const{top:U,bottom:ee}=x_(F,W,q,pe);return[U,ee]}),br(bf)),n);const re=st(!1);Lt(He(r,bn(re),yt(([F,q])=>q||F!==0)),re);const ae=fs(He(nn(A),rn(({items:F})=>F.length>0),bn(M,re),rn(([{items:F},q,pe])=>pe&&F[F.length-1].index===q-1),yt(([,F])=>F-1),br())),B=fs(He(nn(A),rn(({items:F})=>F.length>0&&F[0].index===0),ti(0),br())),Y=fs(He(nn(A),bn(V),rn(([{items:F},q])=>F.length>0&&!q),yt(([{items:F}])=>({startIndex:F[0].index,endIndex:F[F.length-1].index})),br(p8),Xi(0)));Lt(Y,g.scrollSeekRangeChanged),Lt(He(O,bn(R,D,M,X),yt(([F,q,pe,W,U])=>{const ee=d8(F),{align:J,behavior:ge,offset:he}=ee;let de=ee.index;de==="LAST"&&(de=W-1),de=Kd(0,de,A1(W-1,de));let _e=ux(q,U,pe,de);return J==="end"?_e=g_(_e-q.height+pe.height):J==="center"&&(_e=g_(_e-q.height/2+pe.height/2)),he&&(_e+=he),{top:_e,behavior:ge}})),i);const $=Oo(He(A,yt(F=>F.offsetBottom+F.bottom)),0);return Lt(He(x,yt(F=>({width:F.visibleWidth,height:F.visibleHeight}))),R),{data:G,totalCount:M,viewportDimensions:R,itemDimensions:D,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:c,windowViewportRect:x,windowScrollTo:I,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:K,scrollContainerState:d,footerHeight:p,headerHeight:h,initialItemCount:E,gap:X,restoreStateFrom:te,...g,initialTopMostItemIndex:oe,gridState:A,totalListHeight:$,...m,startReached:B,endReached:ae,rangeChanged:Y,stateChanged:Z,propsReady:b,stateRestoreInProgress:V,..._}},Cr(O2,$o,rp,m8,gl,A2,ml));function x_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=ux(e,t,n,r[0].index),i=ux(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function ux(e,t,n,r){const o=j8(e.width,n.width,t.column),s=ig(r/o),i=s*n.height+Kd(0,s-1)*t.row;return i>0?i+t.row:i}function j8(e,t,n){return Kd(1,ig((e+n)/(ig(t)+n)))}const Hoe=Yn(()=>{const e=st(p=>`Item ${p}`),t=st({}),n=st(null),r=st("virtuoso-grid-item"),o=st("virtuoso-grid-list"),s=st(w8),i=st("div"),c=st(qu),d=(p,h=null)=>Oo(He(t,yt(m=>m[p]),br()),h);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:c,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),Woe=Yn(([e,t])=>({...e,...t}),Cr(Boe,Hoe)),Voe=z.memo(function(){const t=jr("gridState"),n=jr("listClassName"),r=jr("itemClassName"),o=jr("itemContent"),s=jr("computeItemKey"),i=jr("isSeeking"),c=sa("scrollHeight"),d=jr("ItemComponent"),p=jr("ListComponent"),h=jr("ScrollSeekPlaceholder"),m=jr("context"),g=sa("itemDimensions"),b=sa("gap"),y=jr("log"),x=jr("stateRestoreInProgress"),w=ac(S=>{const j=S.parentElement.parentElement.scrollHeight;c(j);const I=S.firstChild;if(I){const{width:_,height:M}=I.getBoundingClientRect();g({width:_,height:M})}b({row:y_("row-gap",getComputedStyle(S).rowGap,y),column:y_("column-gap",getComputedStyle(S).columnGap,y)})});return x?null:z.createElement(p,{ref:w,className:n,...Uo(p,m),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,m);return i?z.createElement(h,{key:j,...Uo(h,m),index:S.index,height:t.itemHeight,width:t.itemWidth}):z.createElement(d,{...Uo(d,m),className:r,"data-index":S.index,key:j},o(S.index,S.data,m))}))}),Uoe=z.memo(function(){const t=jr("HeaderComponent"),n=sa("headerHeight"),r=jr("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=jr("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null}),Goe=z.memo(function(){const t=jr("FooterComponent"),n=sa("footerHeight"),r=jr("headerFooterTag"),o=ac(i=>n(il(i,"height"))),s=jr("context");return t?z.createElement(r,{ref:o},z.createElement(t,Uo(t,s))):null}),qoe=({children:e})=>{const t=z.useContext(C8),n=sa("itemDimensions"),r=sa("viewportDimensions"),o=ac(s=>{r(s.getBoundingClientRect())});return z.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),z.createElement("div",{style:k0,ref:o},e)},Koe=({children:e})=>{const t=z.useContext(C8),n=sa("windowViewportRect"),r=sa("itemDimensions"),o=jr("customScrollParent"),s=x8(n,o);return z.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),z.createElement("div",{ref:s,style:k0},e)},Qoe=z.memo(function({...t}){const n=jr("useWindowScroll"),r=jr("customScrollParent"),o=r||n?Joe:Yoe,s=r||n?Koe:qoe;return z.createElement(o,{...t},z.createElement(s,null,z.createElement(Uoe,null),z.createElement(Voe,null),z.createElement(Goe,null)))}),{Component:Xoe,usePublisher:sa,useEmitterValue:jr,useEmitter:_8}=e8(Woe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},Qoe),Yoe=S8({usePublisher:sa,useEmitterValue:jr,useEmitter:_8}),Joe=k8({usePublisher:sa,useEmitterValue:jr,useEmitter:_8});function y_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ps.WARN),t==="normal"?0:parseInt(t??"0",10)}const Zoe=Xoe,ese=e=>{const t=H(s=>s.gallery.galleryView),{data:n}=Tx(e),{data:r}=Nx(e),o=l.useMemo(()=>t==="images"?n==null?void 0:n.total:r==null?void 0:r.total,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},tse=({imageDTO:e})=>a.jsx(N,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Va,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),nse=l.memo(tse),D2=({postUploadAction:e,isDisabled:t})=>{const n=H(d=>d.gallery.autoAddBoardId),[r]=EI(),o=l.useCallback(d=>{const p=d[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:c}=Hy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:c}},rse=me(we,({generation:e})=>e.model,Ie),j0=()=>{const e=le(),t=Zl(),{t:n}=Q(),r=H(rse),o=l.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=l.useCallback(B=>{t({title:n("toast.parameterNotSet"),description:B,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=l.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),c=l.useCallback(B=>{t({title:n("toast.parametersNotSet"),status:"warning",description:B,duration:2500,isClosable:!0})},[n,t]),d=l.useCallback((B,Y,$,F)=>{if(Wp(B)||Vp(Y)||md($)||Bv(F)){Wp(B)&&e($d(B)),Vp(Y)&&e(Ld(Y)),md($)&&e(zd($)),md(F)&&e(Fd(F)),o();return}s()},[e,o,s]),p=l.useCallback(B=>{if(!Wp(B)){s();return}e($d(B)),o()},[e,o,s]),h=l.useCallback(B=>{if(!Vp(B)){s();return}e(Ld(B)),o()},[e,o,s]),m=l.useCallback(B=>{if(!md(B)){s();return}e(zd(B)),o()},[e,o,s]),g=l.useCallback(B=>{if(!Bv(B)){s();return}e(Fd(B)),o()},[e,o,s]),b=l.useCallback(B=>{if(!qw(B)){s();return}e(Hh(B)),o()},[e,o,s]),y=l.useCallback(B=>{if(!Hv(B)){s();return}e(Wh(B)),o()},[e,o,s]),x=l.useCallback(B=>{if(!Kw(B)){s();return}e(X1(B)),o()},[e,o,s]),w=l.useCallback(B=>{if(!Wv(B)){s();return}e(Y1(B)),o()},[e,o,s]),S=l.useCallback(B=>{if(!Qw(B)&&!si(B)){s();return}si(B)?e(Vc(null)):e(Vc(B)),o()},[e,o,s]),j=l.useCallback(B=>{if(!Vv(B)){s();return}e(Vh(B)),o()},[e,o,s]),I=l.useCallback(B=>{if(!Xw(B)){s();return}e(Wl(B)),o()},[e,o,s]),_=l.useCallback(B=>{if(!Yw(B)){s();return}e(Vl(B)),o()},[e,o,s]),M=l.useCallback(B=>{if(!Up(B)){s();return}e(Uh(B)),o()},[e,o,s]),E=l.useCallback(B=>{if(!Jw(B)){s();return}e(J1(B)),o()},[e,o,s]),A=l.useCallback(B=>{if(!Up(B)){s();return}e(Gh(B)),o()},[e,o,s]),R=l.useCallback(B=>{if(!Zw(B)){s();return}e(Z1(B)),o()},[e,o,s]),{data:D}=_f(void 0),O=l.useCallback(B=>{if(!zI(B.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:Y,model_name:$}=B.lora,F=D?o7.getSelectors().selectById(D,`${Y}/lora/${$}`):void 0;return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[D,r==null?void 0:r.base_model]),T=l.useCallback(B=>{const Y=O(B);if(!Y.lora){s(Y.error);return}e(eS({...Y.lora,weight:B.weight})),o()},[O,e,o,s]),{data:K}=$x(void 0),G=l.useCallback(B=>{if(!qh(B.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:Y,control_model:$,control_weight:F,begin_step_percent:q,end_step_percent:pe,control_mode:W,resize_mode:U}=B,ee=K?FI.getSelectors().selectById(K,`${$.base_model}/controlnet/${$.model_name}`):void 0;if(!ee)return{controlnet:null,error:"ControlNet model is not installed"};if(!((ee==null?void 0:ee.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const ge="none",he=Do.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:ee,weight:typeof F=="number"?F:gd.weight,beginStepPct:q||gd.beginStepPct,endStepPct:pe||gd.endStepPct,controlMode:W||gd.controlMode,resizeMode:U||gd.resizeMode,controlImage:(Y==null?void 0:Y.image_name)||null,processedControlImage:(Y==null?void 0:Y.image_name)||null,processorType:ge,processorNode:he,shouldAutoConfig:!0,id:Jc()},error:null}},[K,r==null?void 0:r.base_model]),X=l.useCallback(B=>{const Y=G(B);if(!Y.controlnet){s(Y.error);return}e(Sc(Y.controlnet)),o()},[G,e,o,s]),{data:Z}=Lx(void 0),te=l.useCallback(B=>{if(!qh(B.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:Y,t2i_adapter_model:$,weight:F,begin_step_percent:q,end_step_percent:pe,resize_mode:W}=B,U=Z?BI.getSelectors().selectById(Z,`${$.base_model}/t2i_adapter/${$.model_name}`):void 0;if(!U)return{controlnet:null,error:"ControlNet model is not installed"};if(!((U==null?void 0:U.base_model)===(r==null?void 0:r.base_model)))return{t2iAdapter:null,error:"ControlNet incompatible with currently-selected model"};const J="none",ge=Do.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:U,weight:typeof F=="number"?F:Gp.weight,beginStepPct:q||Gp.beginStepPct,endStepPct:pe||Gp.endStepPct,resizeMode:W||Gp.resizeMode,controlImage:(Y==null?void 0:Y.image_name)||null,processedControlImage:(Y==null?void 0:Y.image_name)||null,processorType:J,processorNode:ge,shouldAutoConfig:!0,id:Jc()},error:null}},[r==null?void 0:r.base_model,Z]),V=l.useCallback(B=>{const Y=te(B);if(!Y.t2iAdapter){s(Y.error);return}e(Sc(Y.t2iAdapter)),o()},[te,e,o,s]),{data:oe}=zx(void 0),ne=l.useCallback(B=>{if(!s7(B==null?void 0:B.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:Y,ip_adapter_model:$,weight:F,begin_step_percent:q,end_step_percent:pe}=B,W=oe?HI.getSelectors().selectById(oe,`${$.base_model}/ip_adapter/${$.model_name}`):void 0;return W?(W==null?void 0:W.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:Jc(),type:"ip_adapter",isEnabled:!0,controlImage:(Y==null?void 0:Y.image_name)??null,model:W,weight:F??Uv.weight,beginStepPct:q??Uv.beginStepPct,endStepPct:pe??Uv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[oe,r==null?void 0:r.base_model]),se=l.useCallback(B=>{const Y=ne(B);if(!Y.ipAdapter){s(Y.error);return}e(Sc(Y.ipAdapter)),o()},[ne,e,o,s]),re=l.useCallback(B=>{e(gg(B))},[e]),ae=l.useCallback(B=>{if(!B){c();return}const{cfg_scale:Y,height:$,model:F,positive_prompt:q,negative_prompt:pe,scheduler:W,vae:U,seed:ee,steps:J,width:ge,strength:he,hrf_enabled:de,hrf_strength:_e,hrf_method:Pe,positive_style_prompt:ze,negative_style_prompt:ht,refiner_model:Je,refiner_cfg_scale:qt,refiner_steps:Pt,refiner_scheduler:jt,refiner_positive_aesthetic_score:Se,refiner_negative_aesthetic_score:Fe,refiner_start:it,loras:At,controlnets:ke,ipAdapters:lt,t2iAdapters:Rt}=B;Hv(Y)&&e(Wh(Y)),Kw(F)&&e(X1(F)),Wp(q)&&e($d(q)),Vp(pe)&&e(Ld(pe)),Wv(W)&&e(Y1(W)),(Qw(U)||si(U))&&(si(U)?e(Vc(null)):e(Vc(U))),qw(ee)&&e(Hh(ee)),Vv(J)&&e(Vh(J)),Xw(ge)&&e(Wl(ge)),Yw($)&&e(Vl($)),Up(he)&&e(Uh(he)),Jw(de)&&e(J1(de)),Up(_e)&&e(Gh(_e)),Zw(Pe)&&e(Z1(Pe)),md(ze)&&e(zd(ze)),Bv(ht)&&e(Fd(ht)),a7(Je)&&e(WI(Je)),Vv(Pt)&&e(eb(Pt)),Hv(qt)&&e(tb(qt)),Wv(jt)&&e(VI(jt)),i7(Se)&&e(nb(Se)),l7(Fe)&&e(rb(Fe)),c7(it)&&e(ob(it)),e(u7()),At==null||At.forEach(zt=>{const Re=O(zt);Re.lora&&e(eS({...Re.lora,weight:zt.weight}))}),e(AI()),ke==null||ke.forEach(zt=>{const Re=G(zt);Re.controlnet&&e(Sc(Re.controlnet))}),lt==null||lt.forEach(zt=>{const Re=ne(zt);Re.ipAdapter&&e(Sc(Re.ipAdapter))}),Rt==null||Rt.forEach(zt=>{const Re=te(zt);Re.t2iAdapter&&e(Sc(Re.t2iAdapter))}),i()},[e,i,c,O,G,ne,te]);return{recallBothPrompts:d,recallPositivePrompt:p,recallNegativePrompt:h,recallSDXLPositiveStylePrompt:m,recallSDXLNegativeStylePrompt:g,recallSeed:b,recallCfgScale:y,recallModel:x,recallScheduler:w,recallVaeModel:S,recallSteps:j,recallWidth:I,recallHeight:_,recallStrength:M,recallHrfEnabled:E,recallHrfStrength:A,recallHrfMethod:R,recallLoRA:T,recallControlNet:X,recallIPAdapter:se,recallT2IAdapter:V,recallAllParameters:ae,sendToImageToImage:re}},ose=()=>l.useCallback(async t=>new Promise(n=>{const r=new Image;r.onload=()=>{const o=document.createElement("canvas");o.width=r.width,o.height=r.height;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),n(new Promise(i=>{o.toBlob(function(c){i(c)},"image/png")})))},r.crossOrigin=UI.get()?"use-credentials":"anonymous",r.src=t}),[]),I8=()=>{const e=Zl(),{t}=Q(),n=ose(),r=l.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=l.useCallback(async s=>{r||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const i=await n(s);if(!i)throw new Error("Unable to create Blob");d7(i),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(i){e({title:t("toast.problemCopyingImage"),description:String(i),status:"error",duration:2500,isClosable:!0})}},[n,r,t,e]);return{isClipboardAPIAvailable:r,copyImageToClipboard:o}};function sse(e){return Ye({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function ase(e){return Ye({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function ise(e){return Ye({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function T2(e){return Ye({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function lse(e){return Ye({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function cse(e){return Ye({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function use(e){return Ye({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function dse(e){return Ye({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function fse(e){return Ye({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function pse(e){return Ye({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 N2(e){return Ye({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function $2(e){return Ye({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function P8(e){return Ye({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}function hse(e,t,n){var r=this,o=l.useRef(null),s=l.useRef(0),i=l.useRef(null),c=l.useRef([]),d=l.useRef(),p=l.useRef(),h=l.useRef(e),m=l.useRef(!0);h.current=e;var g=typeof window<"u",b=!t&&t!==0&&g;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var y=!!(n=n||{}).leading,x=!("trailing"in n)||!!n.trailing,w="maxWait"in n,S="debounceOnServer"in n&&!!n.debounceOnServer,j=w?Math.max(+n.maxWait||0,t):null;l.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var I=l.useMemo(function(){var _=function(O){var T=c.current,K=d.current;return c.current=d.current=null,s.current=O,p.current=h.current.apply(K,T)},M=function(O,T){b&&cancelAnimationFrame(i.current),i.current=b?requestAnimationFrame(O):setTimeout(O,T)},E=function(O){if(!m.current)return!1;var T=O-o.current;return!o.current||T>=t||T<0||w&&O-s.current>=j},A=function(O){return i.current=null,x&&c.current?_(O):(c.current=d.current=null,p.current)},R=function O(){var T=Date.now();if(E(T))return A(T);if(m.current){var K=t-(T-o.current),G=w?Math.min(K,j-(T-s.current)):K;M(O,G)}},D=function(){if(g||S){var O=Date.now(),T=E(O);if(c.current=[].slice.call(arguments),d.current=r,o.current=O,T){if(!i.current&&m.current)return s.current=o.current,M(R,t),y?_(o.current):p.current;if(w)return M(R,t),_(o.current)}return i.current||M(R,t),p.current}};return D.cancel=function(){i.current&&(b?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,c.current=o.current=d.current=i.current=null},D.isPending=function(){return!!i.current},D.flush=function(){return i.current?A(Date.now()):p.current},D},[y,w,t,j,x,b,g,S]);return I}function mse(e,t){return e===t}function gse(e,t){return t}function L2(e,t,n){var r=n&&n.equalityFn||mse,o=l.useReducer(gse,e),s=o[0],i=o[1],c=hse(l.useCallback(function(p){return i(p)},[i]),t,n),d=l.useRef(e);return r(d.current,e)||(c(e),d.current=e),[s,c]}const z2=e=>{const t=H(s=>s.config.metadataFetchDebounce),[n]=L2(e,t??0),{data:r,isLoading:o}=GI(n??qI);return{metadata:r,isLoading:o}},vse=f7.injectEndpoints({endpoints:e=>({getWorkflow:e.query({query:t=>`workflows/i/${t}`,providesTags:(t,n,r)=>[{type:"Workflow",id:r}],transformResponse:t=>{if(t){const n=KI.safeParse(t);if(n.success)return n.data;ki("images").warn("Problem parsing workflow")}}})})}),{useGetWorkflowQuery:bse}=vse,F2=e=>{const t=H(s=>s.config.workflowFetchDebounce),[n]=L2(e,t??0),{data:r,isLoading:o}=bse(n??qI);return{workflow:r,isLoading:o}};Fx("gallery/requestedBoardImagesDeletion");const xse=Fx("gallery/sentImageToCanvas"),E8=Fx("gallery/sentImageToImg2Img"),yse=e=>{const{imageDTO:t}=e,n=le(),{t:r}=Q(),o=Zl(),s=Pn("unifiedCanvas").isFeatureEnabled,i=Xg(Bx),{metadata:c,isLoading:d}=z2(t==null?void 0:t.image_name),{workflow:p,isLoading:h}=F2(t==null?void 0:t.workflow_id),[m]=Hx(),[g]=Wx(),{isClipboardAPIAvailable:b,copyImageToClipboard:y}=I8(),x=l.useCallback(()=>{t&&n(vg([t]))},[n,t]),{recallBothPrompts:w,recallSeed:S,recallAllParameters:j}=j0(),I=l.useCallback(()=>{w(c==null?void 0:c.positive_prompt,c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt)},[c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt,w]),_=l.useCallback(()=>{S(c==null?void 0:c.seed)},[c==null?void 0:c.seed,S]),M=l.useCallback(()=>{p&&n(Vx(p))},[n,p]),E=l.useCallback(()=>{n(E8()),n(gg(t))},[n,t]),A=l.useCallback(()=>{n(xse()),ls.flushSync(()=>{n(ni("unifiedCanvas"))}),n(QI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),R=l.useCallback(()=>{j(c)},[c,j]),D=l.useCallback(()=>{n(XI([t])),n(Ax(!0))},[n,t]),O=l.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=l.useCallback(()=>{t&&m({imageDTOs:[t]})},[m,t]),K=l.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(Kn,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(l2,{}),children:r("common.openInNewTab")}),b&&a.jsx(Kn,{icon:a.jsx(Hu,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(Kn,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(Wu,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(Kn,{icon:h?a.jsx(Ch,{}):a.jsx(T2,{}),onClickCapture:M,isDisabled:h||!p,children:r("nodes.loadWorkflow")}),a.jsx(Kn,{icon:d?a.jsx(Ch,{}):a.jsx(ZM,{}),onClickCapture:I,isDisabled:d||(c==null?void 0:c.positive_prompt)===void 0&&(c==null?void 0:c.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(Kn,{icon:d?a.jsx(Ch,{}):a.jsx(eO,{}),onClickCapture:_,isDisabled:d||(c==null?void 0:c.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(Kn,{icon:d?a.jsx(Ch,{}):a.jsx(WM,{}),onClickCapture:R,isDisabled:d||!c,children:r("parameters.useAll")}),a.jsx(Kn,{icon:a.jsx(Ej,{}),onClickCapture:E,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(Kn,{icon:a.jsx(Ej,{}),onClickCapture:A,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(Kn,{icon:a.jsx(KM,{}),onClickCapture:D,children:r("boards.changeBoard")}),t.starred?a.jsx(Kn,{icon:i?i.off.icon:a.jsx($2,{}),onClickCapture:K,children:i?i.off.text:r("controlnet.unstarImage")}):a.jsx(Kn,{icon:i?i.on.icon:a.jsx(N2,{}),onClickCapture:T,children:i?i.on.text:"Star Image"}),a.jsx(Kn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Zo,{}),onClickCapture:x,children:r("gallery.deleteImage")})]})},M8=l.memo(yse),Ch=()=>a.jsx(N,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(Ci,{size:"xs"})}),Cse=()=>{const{t:e}=Q(),t=le(),n=H(x=>x.gallery.selection),r=Xg(Bx),o=Pn("bulkDownload").isFeatureEnabled,[s]=Hx(),[i]=Wx(),[c]=$I(),d=l.useCallback(()=>{t(XI(n)),t(Ax(!0))},[t,n]),p=l.useCallback(()=>{t(vg(n))},[t,n]),h=l.useCallback(()=>{s({imageDTOs:n})},[s,n]),m=l.useCallback(()=>{i({imageDTOs:n})},[i,n]),g=l.useCallback(async()=>{try{const x=await c({image_names:n.map(w=>w.image_name)}).unwrap();t(Ht({title:e("gallery.preparingDownload"),status:"success",...x.response?{description:x.response}:{}}))}catch{t(Ht({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,c,t]),b=l.useMemo(()=>n.every(x=>x.starred),[n]),y=l.useMemo(()=>n.every(x=>!x.starred),[n]);return a.jsxs(a.Fragment,{children:[b&&a.jsx(Kn,{icon:r?r.on.icon:a.jsx(N2,{}),onClickCapture:m,children:r?r.off.text:"Unstar All"}),(y||!b&&!y)&&a.jsx(Kn,{icon:r?r.on.icon:a.jsx($2,{}),onClickCapture:h,children:r?r.on.text:"Star All"}),o&&a.jsx(Kn,{icon:a.jsx(Wu,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(Kn,{icon:a.jsx(KM,{}),onClickCapture:d,children:e("boards.changeBoard")}),a.jsx(Kn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Zo,{}),onClickCapture:p,children:"Delete Selection"})]})},wse=l.memo(Cse),Sse=me([we],({gallery:e})=>({selectionCount:e.selection.length}),Ie),kse=({imageDTO:e,children:t})=>{const{selectionCount:n}=H(Sse),r=l.useCallback(s=>{s.preventDefault()},[]),o=l.useCallback(()=>e?n>1?a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(wse,{})}):a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(M8,{imageDTO:e})}):null,[e,n,r]);return a.jsx(S2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:o,children:t})},jse=l.memo(kse),_se=e=>{const{data:t,disabled:n,...r}=e,o=l.useRef(Jc()),{attributes:s,listeners:i,setNodeRef:c}=Qne({id:o.current,disabled:n,data:t});return a.jsx(Le,{ref:c,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},Ise=l.memo(_se),Pse=a.jsx(Gr,{as:i0,sx:{boxSize:16}}),Ese=a.jsx(eo,{icon:Xl}),Mse=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:c=!1,minSize:d=24,postUploadAction:p,imageSx:h,fitContainer:m=!1,droppableData:g,draggableData:b,dropLabel:y,isSelected:x=!1,thumbnail:w=!1,noContentFallback:S=Ese,uploadElement:j=Pse,useThumbailFallback:I,withHoverOverlay:_=!1,children:M,onMouseOver:E,onMouseOut:A,dataTestId:R}=e,{colorMode:D}=ji(),[O,T]=l.useState(!1),K=l.useCallback(V=>{E&&E(V),T(!0)},[E]),G=l.useCallback(V=>{A&&A(V),T(!1)},[A]),{getUploadButtonProps:X,getUploadInputProps:Z}=D2({postUploadAction:p,isDisabled:c}),te=c?{}:{cursor:"pointer",bg:Xe("base.200","base.700")(D),_hover:{bg:Xe("base.300","base.650")(D),color:Xe("base.500","base.300")(D)}};return a.jsx(jse,{imageDTO:t,children:V=>a.jsxs(N,{ref:V,onMouseOver:K,onMouseOut:G,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:d||void 0,minH:d||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(N,{sx:{w:"full",h:"full",position:m?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(_i,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:I?t.thumbnail_url:void 0,fallback:I?void 0:a.jsx(kre,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...h},"data-testid":R}),o&&a.jsx(nse,{imageDTO:t}),a.jsx(w2,{isSelected:x,isHovered:_?O:!1})]}),!t&&!c&&a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{minH:d,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Xe("base.500","base.500")(D),...te},...X(),children:[a.jsx("input",{...Z()}),j]})}),!t&&c&&S,t&&!i&&a.jsx(Ise,{data:b,disabled:i||!t,onClick:r}),M,!s&&a.jsx(C2,{data:g,disabled:s,dropLabel:y})]})})},ll=l.memo(Mse),Ose=()=>a.jsx(Wg,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),Ase=l.memo(Ose),Rse=me([we,Ux],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},Ie),Dse=e=>{const t=le(),{queryArgs:n,selection:r}=H(Rse),{imageDTOs:o}=YI(n,{selectFromResult:p=>({imageDTOs:p.data?p7.selectAll(p.data):[]})}),s=Pn("multiselect").isFeatureEnabled,i=l.useCallback(p=>{var h;if(e){if(!s){t(vd([e]));return}if(p.shiftKey){const m=e.image_name,g=(h=r[r.length-1])==null?void 0:h.image_name,b=o.findIndex(x=>x.image_name===g),y=o.findIndex(x=>x.image_name===m);if(b>-1&&y>-1){const x=Math.min(b,y),w=Math.max(b,y),S=o.slice(x,w+1);t(vd(r.concat(S)))}}else p.ctrlKey||p.metaKey?r.some(m=>m.image_name===e.image_name)&&r.length>1?t(vd(r.filter(m=>m.image_name!==e.image_name))):t(vd(r.concat(e))):t(vd([e]))}},[t,e,o,r,s]),c=l.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),d=l.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:d,isSelected:c,handleClick:i}},Tse=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=di("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(rt,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},du=l.memo(Tse),Nse=e=>{const t=le(),{imageName:n}=e,{currentData:r}=Rs(n),o=H(E=>E.hotkeys.shift),{t:s}=Q(),{handleClick:i,isSelected:c,selection:d,selectionCount:p}=Dse(r),h=Xg(Bx),m=l.useCallback(E=>{E.stopPropagation(),r&&t(vg([r]))},[t,r]),g=l.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:d}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,d,p]),[b]=Hx(),[y]=Wx(),x=l.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||b({imageDTOs:[r]}))},[b,y,r]),[w,S]=l.useState(!1),j=l.useCallback(()=>{S(!0)},[]),I=l.useCallback(()=>{S(!1)},[]),_=l.useMemo(()=>{if(r!=null&&r.starred)return h?h.on.icon:a.jsx($2,{size:"20"});if(!(r!=null&&r.starred)&&w)return h?h.off.icon:a.jsx(N2,{size:"20"})},[r==null?void 0:r.starred,w,h]),M=l.useMemo(()=>r!=null&&r.starred?h?h.off.text:"Unstar":r!=null&&r.starred?"":h?h.on.text:"Star",[r==null?void 0:r.starred,h]);return r?a.jsx(Le,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(N,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(ll,{onClick:i,imageDTO:r,draggableData:g,isSelected:c,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:I,children:a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:x,icon:_,tooltip:M}),w&&o&&a.jsx(du,{onClick:m,icon:a.jsx(Zo,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(Ase,{})},$se=l.memo(Nse),Lse=De((e,t)=>a.jsx(Le,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),zse=l.memo(Lse),Fse=De((e,t)=>{const n=H(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(rl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Bse=l.memo(Fse),Hse={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Wse=()=>{const{t:e}=Q(),t=l.useRef(null),[n,r]=l.useState(null),[o,s]=y2(Hse),i=H(S=>S.gallery.selectedBoardId),{currentViewTotal:c}=ese(i),d=H(Ux),{currentData:p,isFetching:h,isSuccess:m,isError:g}=YI(d),[b]=JI(),y=l.useMemo(()=>!p||!c?!1:p.ids.length{y&&b({...d,offset:(p==null?void 0:p.ids.length)??0,limit:ZI})},[y,b,d,p==null?void 0:p.ids.length]),w=l.useCallback((S,j)=>a.jsx($se,{imageName:j},j),[]);return l.useEffect(()=>{const{current:S}=t;return n&&S&&o({target:S,elements:{viewport:n}}),()=>{var j;return(j=s())==null?void 0:j.destroy()}},[n,o,s]),p?m&&(p==null?void 0:p.ids.length)===0?a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.noImagesInGallery"),icon:Xl})}):m&&p?a.jsxs(a.Fragment,{children:[a.jsx(Le,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(Zoe,{style:{height:"100%"},data:p.ids,endReached:x,components:{Item:zse,List:Bse},scrollerRef:r,itemContent:w})}),a.jsx(Dt,{onClick:x,isDisabled:!y,isLoading:h,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${c})`})]}):g?a.jsx(Le,{sx:{w:"full",h:"full"},children:a.jsx(eo,{label:e("gallery.unableToLoad"),icon:Mee})}):null:a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.loading"),icon:Xl})})},Vse=l.memo(Wse),Use=me([we],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},Ie),Gse=()=>{const{t:e}=Q(),t=l.useRef(null),n=l.useRef(null),{galleryView:r}=H(Use),o=le(),{isOpen:s,onToggle:i}=hs({defaultIsOpen:!0}),c=l.useCallback(()=>{o(tS("images"))},[o]),d=l.useCallback(()=>{o(tS("assets"))},[o]);return a.jsxs(q5,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Le,{sx:{w:"full"},children:[a.jsxs(N,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(hre,{isOpen:s,onToggle:i}),a.jsx(Sre,{})]}),a.jsx(Le,{children:a.jsx(dre,{isOpen:s})})]}),a.jsxs(N,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(N,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(tc,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(nc,{children:a.jsxs(Hn,{isAttached:!0,sx:{w:"full"},children:[a.jsx(wo,{as:Dt,size:"sm",isChecked:r==="images",onClick:c,sx:{w:"full"},leftIcon:a.jsx(Lee,{}),"data-testid":"images-tab",children:e("gallery.images")}),a.jsx(wo,{as:Dt,size:"sm",isChecked:r==="assets",onClick:d,sx:{w:"full"},leftIcon:a.jsx(Xee,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx(Vse,{})]})]})},qse=l.memo(Gse),Kse=()=>{const e=H(p=>p.system.isConnected),{data:t}=Ha(),[n,{isLoading:r}]=Gx(),o=le(),{t:s}=Q(),i=l.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),c=l.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(Ht({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Ht({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),d=l.useMemo(()=>!e||si(i),[e,i]);return{cancelQueueItem:c,isLoading:r,currentQueueItemId:i,isDisabled:d}},Qse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:c,loadingText:d,sx:p})=>i?a.jsx(rt,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,sx:p,"data-testid":e}):a.jsx(Dt,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,loadingText:d??e,flexGrow:1,sx:p,"data-testid":e,children:e}),lc=l.memo(Qse),Xse=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Kse();return a.jsx(lc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(ku,{}),onClick:r,colorScheme:"error",sx:t})},O8=l.memo(Xse),Yse=()=>{const{t:e}=Q(),t=le(),{data:n}=Ha(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=eP({fixedCacheKey:"clearQueue"}),i=l.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(Ht({title:e("queue.clearSucceeded"),status:"success"})),t(qx(void 0)),t(Kx(void 0))}catch{t(Ht({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),c=l.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:c}},Jse=De((e,t)=>{const{t:n}=Q(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:c,title:d,triggerComponent:p}=e,{isOpen:h,onOpen:m,onClose:g}=hs(),b=l.useRef(null),y=l.useCallback(()=>{o(),g()},[o,g]),x=l.useCallback(()=>{i&&i(),g()},[i,g]);return a.jsxs(a.Fragment,{children:[l.cloneElement(p,{onClick:m,ref:t}),a.jsx(Wf,{isOpen:h,leastDestructiveRef:b,onClose:g,isCentered:!0,children:a.jsx(Aa,{children:a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:d}),a.jsx(Ra,{children:c}),a.jsxs(pi,{children:[a.jsx(Dt,{ref:b,onClick:x,children:s}),a.jsx(Dt,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),_0=l.memo(Jse),Zse=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{clearQueue:r,isLoading:o,isDisabled:s}=Yse();return a.jsxs(_0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(lc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(Zo,{}),colorScheme:"error",sx:t}),children:[a.jsx(je,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(je,{children:n("queue.clearQueueAlertDialog2")})]})},B2=l.memo(Zse),eae=()=>{const e=le(),{t}=Q(),n=H(p=>p.system.isConnected),{data:r}=Ha(),[o,{isLoading:s}]=tP({fixedCacheKey:"pauseProcessor"}),i=l.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),c=l.useCallback(async()=>{if(i)try{await o().unwrap(),e(Ht({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(Ht({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),d=l.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},tae=({asIconButton:e})=>{const{t}=Q(),{pauseProcessor:n,isLoading:r,isDisabled:o}=eae();return a.jsx(lc,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(Vee,{}),onClick:n,colorScheme:"gold"})},A8=l.memo(tae),nae=me([we,lo],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:c}=t,{isConnected:d}=n,p=[];return d||p.push(fn.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(fn.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(fn.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(h=>{if(!Rr(h))return;const m=r.nodeTemplates[h.data.type];if(!m){p.push(fn.t("parameters.invoke.missingNodeTemplate"));return}const g=h7([h],r.edges);to(h.data.inputs,b=>{const y=m.inputs[b.name],x=g.some(w=>w.target===h.id&&w.targetHandle===b.name);if(!y){p.push(fn.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&b.value===void 0&&!x){p.push(fn.t("parameters.invoke.missingInputForField",{nodeLabel:h.data.label||m.title,fieldLabel:b.label||y.title}));return}})})):(o.prompts.length===0&&p.push(fn.t("parameters.invoke.noPrompts")),c||p.push(fn.t("parameters.invoke.noModelSelected")),m7(e).forEach((h,m)=>{h.isEnabled&&(h.model?h.model.base_model!==(c==null?void 0:c.base_model)&&p.push(fn.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:m+1})):p.push(fn.t("parameters.invoke.noModelForControlAdapter",{number:m+1})),(!h.controlImage||Ru(h)&&!h.processedControlImage&&h.processorType!=="none")&&p.push(fn.t("parameters.invoke.noControlImageForControlAdapter",{number:m+1})))})),{isReady:!p.length,reasons:p}},Ie),H2=()=>{const{isReady:e,reasons:t}=H(nae);return{isReady:e,reasons:t}},R8=()=>{const e=le(),t=H(lo),{isReady:n}=H2(),[r,{isLoading:o}]=bg({fixedCacheKey:"enqueueBatch"}),s=l.useMemo(()=>!n,[n]);return{queueBack:l.useCallback(()=>{s||(e(Qx()),e(nP({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},rae=me([we],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},Ie),oae=({prepend:e=!1})=>{const{t}=Q(),{isReady:n,reasons:r}=H2(),{autoAddBoardId:o}=H(rae),s=x0(o),[i,{isLoading:c}]=bg({fixedCacheKey:"enqueueBatch"}),d=l.useMemo(()=>t(c?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[c,n,e,t]);return a.jsxs(N,{flexDir:"column",gap:1,children:[a.jsx(je,{fontWeight:600,children:d}),r.length>0&&a.jsx(zf,{children:r.map((p,h)=>a.jsx(Ps,{children:a.jsx(je,{fontWeight:400,children:p})},`${p}.${h}`))}),a.jsx(T8,{}),a.jsxs(je,{fontWeight:400,fontStyle:"oblique 10deg",children:[t("parameters.invoke.addingImagesTo")," ",a.jsx(je,{as:"span",fontWeight:600,children:s||t("boards.uncategorized")})]})]})},D8=l.memo(oae),T8=l.memo(()=>a.jsx(io,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));T8.displayName="StyledDivider";const sae=()=>a.jsx(Le,{pos:"relative",w:4,h:4,children:a.jsx(_i,{src:Rx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),aae=l.memo(sae),iae=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{queueBack:r,isLoading:o,isDisabled:s}=R8();return a.jsx(lc,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(D8,{}),sx:t,icon:e?a.jsx(aae,{}):void 0})},N8=l.memo(iae),$8=()=>{const e=le(),t=H(lo),{isReady:n}=H2(),[r,{isLoading:o}]=bg({fixedCacheKey:"enqueueBatch"}),s=Pn("prependQueue").isFeatureEnabled,i=l.useMemo(()=>!n||!s,[n,s]);return{queueFront:l.useCallback(()=>{i||(e(Qx()),e(nP({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},lae=({asIconButton:e,sx:t})=>{const{t:n}=Q(),{queueFront:r,isLoading:o,isDisabled:s}=$8();return a.jsx(lc,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(D8,{prepend:!0}),icon:a.jsx(ase,{}),sx:t})},cae=l.memo(lae),uae=()=>{const e=le(),t=H(p=>p.system.isConnected),{data:n}=Ha(),{t:r}=Q(),[o,{isLoading:s}]=rP({fixedCacheKey:"resumeProcessor"}),i=l.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),c=l.useCallback(async()=>{if(!i)try{await o().unwrap(),e(Ht({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(Ht({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),d=l.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},dae=({asIconButton:e})=>{const{t}=Q(),{resumeProcessor:n,isLoading:r,isDisabled:o}=uae();return a.jsx(lc,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(Uee,{}),onClick:n,colorScheme:"green"})},L8=l.memo(dae),fae=me(we,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},Ie),pae=()=>{const{t:e}=Q(),{data:t}=Ha(),{hasSteps:n,value:r,isConnected:o}=H(fae);return a.jsx(_3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},hae=l.memo(pae),mae=()=>{const e=Pn("pauseQueue").isFeatureEnabled,t=Pn("resumeQueue").isFeatureEnabled,n=Pn("prependQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsxs(Hn,{isAttached:!0,flexGrow:2,children:[a.jsx(N8,{}),n?a.jsx(cae,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(O8,{asIconButton:!0})]}),a.jsxs(Hn,{isAttached:!0,children:[t?a.jsx(L8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(A8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(B2,{asIconButton:!0})]}),a.jsx(N,{h:3,w:"full",children:a.jsx(hae,{})}),a.jsx(F8,{})]})},z8=l.memo(mae),F8=l.memo(()=>{const{t:e}=Q(),t=le(),{hasItems:n,pending:r}=Ha(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:c}=s.queue;return{hasItems:i+c>0,pending:i}}}),o=l.useCallback(()=>{t(ni("queue"))},[t]);return a.jsxs(N,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(Pi,{}),a.jsx(nl,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});F8.displayName="QueueCounts";const{createElement:Iu,createContext:gae,forwardRef:B8,useCallback:Za,useContext:H8,useEffect:ui,useImperativeHandle:W8,useLayoutEffect:vae,useMemo:bae,useRef:is,useState:Qd}=Ox,C_=Ox["useId".toString()],Xd=vae,xae=typeof C_=="function"?C_:()=>null;let yae=0;function W2(e=null){const t=xae(),n=is(e||t||null);return n.current===null&&(n.current=""+yae++),n.current}const I0=gae(null);I0.displayName="PanelGroupContext";function V8({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:c=null,minSize:d,onCollapse:p=null,onResize:h=null,order:m=null,style:g={},tagName:b="div"}){const y=H8(I0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const x=W2(i),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:I,registerPanel:_,resizePanel:M,units:E,unregisterPanel:A}=y;d==null&&(E==="percentages"?d=10:d=0);const R=is({onCollapse:p,onResize:h});ui(()=>{R.current.onCollapse=p,R.current.onResize=h});const D=I(x,o),O=is({size:w_(D)}),T=is({callbacksRef:R,collapsedSize:n,collapsible:r,defaultSize:o,id:x,idWasAutoGenerated:i==null,maxSize:c,minSize:d,order:m});return Xd(()=>{O.current.size=w_(D),T.current.callbacksRef=R,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=x,T.current.idWasAutoGenerated=i==null,T.current.maxSize=c,T.current.minSize=d,T.current.order=m}),Xd(()=>(_(x,T),()=>{A(x)}),[m,x,_,A]),W8(s,()=>({collapse:()=>w(x),expand:()=>S(x),getCollapsed(){return O.current.size===0},getId(){return x},getSize(K){return j(x,K)},resize:(K,G)=>M(x,K,G)}),[w,S,j,x,M]),Iu(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":x,"data-panel-size":parseFloat(""+D.flexGrow).toFixed(1),id:`data-panel-id-${x}`,style:{...D,...g}})}const el=B8((e,t)=>Iu(V8,{...e,forwardedRef:t}));V8.displayName="Panel";el.displayName="forwardRef(Panel)";function w_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Jl=10;function Dd(e,t,n,r,o,s,i,c){const{id:d,panels:p,units:h}=t,m=h==="pixels"?Gi(d):NaN,{sizes:g}=c||{},b=g||s,y=Vo(p),x=b.concat();let w=0;{const I=o<0?r:n,_=y.findIndex(R=>R.current.id===I),M=y[_],E=b[_],A=dx(h,m,M,E,E+Math.abs(o),e);if(E===A)return b;A===0&&E>0&&i.set(I,E),o=o<0?E-A:A-E}let S=o<0?n:r,j=y.findIndex(I=>I.current.id===S);for(;;){const I=y[j],_=b[j],M=Math.abs(o)-Math.abs(w),E=dx(h,m,I,_,_-M,e);if(_!==E&&(E===0&&_>0&&i.set(I.current.id,_),w+=_-E,x[j]=E,w.toPrecision(Jl).localeCompare(Math.abs(o).toPrecision(Jl),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return w===0?b:(S=o<0?r:n,j=y.findIndex(I=>I.current.id===S),x[j]=b[j]+w,x)}function Tc(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:c,collapsible:d,id:p}=s.current,h=n[p];if(h!==r){n[p]=r;const{onCollapse:m,onResize:g}=i.current;g&&g(r,h),d&&m&&((h==null||h===c)&&r!==c?m(!1):h!==c&&r===c&&m(!0))}})}function Cae({groupId:e,panels:t,units:n}){const r=n==="pixels"?Gi(e):NaN,o=Vo(t),s=Array(o.length);let i=0,c=100;for(let d=0;di.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Gi(e){const t=xf(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=V2(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function U8(e,t,n){if(e.size===1)return"100";const o=Vo(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Jl)}function wae(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function xf(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function P0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Sae(e){return G8().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function G8(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function V2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function U2(e,t,n){var d,p,h,m;const r=P0(t),o=V2(e),s=r?o.indexOf(r):-1,i=((p=(d=n[s])==null?void 0:d.current)==null?void 0:p.id)??null,c=((m=(h=n[s+1])==null?void 0:h.current)==null?void 0:m.id)??null;return[i,c]}function Vo(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function dx(e,t,n,r,o,s=null){var h;let{collapsedSize:i,collapsible:c,maxSize:d,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,d!=null&&(d=d/t*100),p=p/t*100),c){if(r>i){if(o<=p/2+i)return i}else if(!((h=s==null?void 0:s.type)==null?void 0:h.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function D1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Vo(t),i=o==="pixels"?Gi(e):NaN;let c=0;for(let d=0;d{const{direction:i,panels:c}=e.current,d=xf(t);q8(d!=null,`No group found for id "${t}"`);const{height:p,width:h}=d.getBoundingClientRect(),g=V2(t).map(b=>{const y=b.getAttribute("data-panel-resize-handle-id"),x=Vo(c),[w,S]=U2(t,y,x);if(w==null||S==null)return()=>{};let j=0,I=100,_=0,M=0;x.forEach(T=>{const{id:K,maxSize:G,minSize:X}=T.current;K===w?(j=X,I=G??100):(_+=X,M+=G??100)});const E=Math.min(I,100-_),A=Math.max(j,(x.length-1)*100-M),R=U8(c,w,o);b.setAttribute("aria-valuemax",""+Math.round(E)),b.setAttribute("aria-valuemin",""+Math.round(A)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(R)));const D=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const K=x.findIndex(G=>G.current.id===w);if(K>=0){const G=x[K],X=o[K];if(X!=null){let Z=0;X.toPrecision(Jl)<=G.current.minSize.toPrecision(Jl)?Z=i==="horizontal"?h:p:Z=-(i==="horizontal"?h:p);const te=Dd(T,e.current,w,S,Z,o,s.current,null);o!==te&&r(te)}}break}}};b.addEventListener("keydown",D);const O=wae(w);return O!=null&&b.setAttribute("aria-controls",O.id),()=>{b.removeAttribute("aria-valuemax"),b.removeAttribute("aria-valuemin"),b.removeAttribute("aria-valuenow"),b.removeEventListener("keydown",D),O!=null&&b.removeAttribute("aria-controls")}});return()=>{g.forEach(b=>b())}},[e,t,n,s,r,o])}function _ae({disabled:e,handleId:t,resizeHandler:n}){ui(()=>{if(e||n==null)return;const r=P0(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=G8(),c=Sae(t);q8(c!==null);const d=s.shiftKey?c>0?c-1:i.length-1:c+1{r.removeEventListener("keydown",o)}},[e,t,n])}function T1(e,t){if(e.length!==t.length)return!1;for(let n=0;nA.current.id===_),E=r[M];if(E.current.collapsible){const A=h[M];(A===0||A.toPrecision(Jl)===E.current.minSize.toPrecision(Jl))&&(S=S<0?-E.current.minSize*y:E.current.minSize*y)}return S}else return K8(e,n,o,c,d)}function Pae(e){return e.type==="keydown"}function fx(e){return e.type.startsWith("mouse")}function px(e){return e.type.startsWith("touch")}let hx=null,Dl=null;function Q8(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function Eae(){Dl!==null&&(document.head.removeChild(Dl),hx=null,Dl=null)}function N1(e){if(hx===e)return;hx=e;const t=Q8(e);Dl===null&&(Dl=document.createElement("style"),document.head.appendChild(Dl)),Dl.innerHTML=`*{cursor: ${t}!important;}`}function Mae(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function X8(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function Y8(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function Oae(e,t,n){const r=Y8(e,n);if(r){const o=X8(t);return r[o]??null}return null}function Aae(e,t,n,r){const o=X8(t),s=Y8(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const $1={};function S_(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Td={getItem:e=>(S_(Td),Td.getItem(e)),setItem:(e,t)=>{S_(Td),Td.setItem(e,t)}};function J8({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:c,storage:d=Td,style:p={},tagName:h="div",units:m="percentages"}){const g=W2(i),[b,y]=Qd(null),[x,w]=Qd(new Map),S=is(null);is({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=is({onLayout:c});ui(()=>{j.current.onLayout=c});const I=is({}),[_,M]=Qd([]),E=is(new Map),A=is(0),R=is({direction:r,id:g,panels:x,sizes:_,units:m});W8(s,()=>({getId:()=>g,getLayout:ne=>{const{sizes:se,units:re}=R.current;if((ne??re)==="pixels"){const B=Gi(g);return se.map(Y=>Y/100*B)}else return se},setLayout:(ne,se)=>{const{id:re,panels:ae,sizes:B,units:Y}=R.current;if((se||Y)==="pixels"){const pe=Gi(re);ne=ne.map(W=>W/pe*100)}const $=I.current,F=Vo(ae),q=D1({groupId:re,panels:ae,nextSizes:ne,prevSizes:B,units:Y});T1(B,q)||(M(q),Tc(F,q,$))}}),[g]),Xd(()=>{R.current.direction=r,R.current.id=g,R.current.panels=x,R.current.sizes=_,R.current.units=m}),jae({committedValuesRef:R,groupId:g,panels:x,setSizes:M,sizes:_,panelSizeBeforeCollapse:E}),ui(()=>{const{onLayout:ne}=j.current,{panels:se,sizes:re}=R.current;if(re.length>0){ne&&ne(re);const ae=I.current,B=Vo(se);Tc(B,re,ae)}},[_]),Xd(()=>{const{id:ne,sizes:se,units:re}=R.current;if(se.length===x.size)return;let ae=null;if(e){const B=Vo(x);ae=Oae(e,B,d)}if(ae!=null){const B=D1({groupId:ne,panels:x,nextSizes:ae,prevSizes:ae,units:re});M(B)}else{const B=Cae({groupId:ne,panels:x,units:re});M(B)}},[e,x,d]),ui(()=>{if(e){if(_.length===0||_.length!==x.size)return;const ne=Vo(x);$1[e]||($1[e]=Mae(Aae,100)),$1[e](e,ne,_,d)}},[e,x,_,d]),Xd(()=>{if(m==="pixels"){const ne=new ResizeObserver(()=>{const{panels:se,sizes:re}=R.current,ae=D1({groupId:g,panels:se,nextSizes:re,prevSizes:re,units:m});T1(re,ae)||M(ae)});return ne.observe(xf(g)),()=>{ne.disconnect()}}},[g,m]);const D=Za((ne,se)=>{const{panels:re,units:ae}=R.current,Y=Vo(re).findIndex(q=>q.current.id===ne),$=_[Y];if((se??ae)==="pixels"){const q=Gi(g);return $/100*q}else return $},[g,_]),O=Za((ne,se)=>{const{panels:re}=R.current;return re.size===0?{flexBasis:0,flexGrow:se??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:U8(re,ne,_),flexShrink:1,overflow:"hidden",pointerEvents:o&&b!==null?"none":void 0}},[b,o,_]),T=Za((ne,se)=>{const{units:re}=R.current;kae(re,se),w(ae=>{if(ae.has(ne))return ae;const B=new Map(ae);return B.set(ne,se),B})},[]),K=Za(ne=>re=>{re.preventDefault();const{direction:ae,panels:B,sizes:Y}=R.current,$=Vo(B),[F,q]=U2(g,ne,$);if(F==null||q==null)return;let pe=Iae(re,g,ne,$,ae,Y,S.current);if(pe===0)return;const U=xf(g).getBoundingClientRect(),ee=ae==="horizontal";document.dir==="rtl"&&ee&&(pe=-pe);const J=ee?U.width:U.height,ge=pe/J*100,he=Dd(re,R.current,F,q,ge,Y,E.current,S.current),de=!T1(Y,he);if((fx(re)||px(re))&&A.current!=ge&&N1(de?ee?"horizontal":"vertical":ee?pe<0?"horizontal-min":"horizontal-max":pe<0?"vertical-min":"vertical-max"),de){const _e=I.current;M(he),Tc($,he,_e)}A.current=ge},[g]),G=Za(ne=>{w(se=>{if(!se.has(ne))return se;const re=new Map(se);return re.delete(ne),re})},[]),X=Za(ne=>{const{panels:se,sizes:re}=R.current,ae=se.get(ne);if(ae==null)return;const{collapsedSize:B,collapsible:Y}=ae.current;if(!Y)return;const $=Vo(se),F=$.indexOf(ae);if(F<0)return;const q=re[F];if(q===B)return;E.current.set(ne,q);const[pe,W]=R1(ne,$);if(pe==null||W==null)return;const ee=F===$.length-1?q:B-q,J=Dd(null,R.current,pe,W,ee,re,E.current,null);if(re!==J){const ge=I.current;M(J),Tc($,J,ge)}},[]),Z=Za(ne=>{const{panels:se,sizes:re}=R.current,ae=se.get(ne);if(ae==null)return;const{collapsedSize:B,minSize:Y}=ae.current,$=E.current.get(ne)||Y;if(!$)return;const F=Vo(se),q=F.indexOf(ae);if(q<0||re[q]!==B)return;const[W,U]=R1(ne,F);if(W==null||U==null)return;const J=q===F.length-1?B-$:$,ge=Dd(null,R.current,W,U,J,re,E.current,null);if(re!==ge){const he=I.current;M(ge),Tc(F,ge,he)}},[]),te=Za((ne,se,re)=>{const{id:ae,panels:B,sizes:Y,units:$}=R.current;if((re||$)==="pixels"){const ht=Gi(ae);se=se/ht*100}const F=B.get(ne);if(F==null)return;let{collapsedSize:q,collapsible:pe,maxSize:W,minSize:U}=F.current;if($==="pixels"){const ht=Gi(ae);U=U/ht*100,W!=null&&(W=W/ht*100)}const ee=Vo(B),J=ee.indexOf(F);if(J<0)return;const ge=Y[J];if(ge===se)return;pe&&se===q||(se=Math.min(W??100,Math.max(U,se)));const[he,de]=R1(ne,ee);if(he==null||de==null)return;const Pe=J===ee.length-1?ge-se:se-ge,ze=Dd(null,R.current,he,de,Pe,Y,E.current,null);if(Y!==ze){const ht=I.current;M(ze),Tc(ee,ze,ht)}},[]),V=bae(()=>({activeHandleId:b,collapsePanel:X,direction:r,expandPanel:Z,getPanelSize:D,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:K,resizePanel:te,startDragging:(ne,se)=>{if(y(ne),fx(se)||px(se)){const re=P0(ne);S.current={dragHandleRect:re.getBoundingClientRect(),dragOffset:K8(se,ne,r),sizes:R.current.sizes}}},stopDragging:()=>{Eae(),y(null),S.current=null},units:m,unregisterPanel:G}),[b,X,r,Z,D,O,g,T,K,te,m,G]),oe={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Iu(I0.Provider,{children:Iu(h,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":m,style:{...oe,...p}}),value:V})}const E0=B8((e,t)=>Iu(J8,{...e,forwardedRef:t}));J8.displayName="PanelGroup";E0.displayName="forwardRef(PanelGroup)";function mx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const c=is(null),d=is({onDragging:o});ui(()=>{d.current.onDragging=o});const p=H8(I0);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:h,direction:m,groupId:g,registerResizeHandle:b,startDragging:y,stopDragging:x}=p,w=W2(r),S=h===w,[j,I]=Qd(!1),[_,M]=Qd(null),E=Za(()=>{c.current.blur(),x();const{onDragging:D}=d.current;D&&D(!1)},[x]);ui(()=>{if(n)M(null);else{const R=b(w);M(()=>R)}},[n,w,b]),ui(()=>{if(n||_==null||!S)return;const R=K=>{_(K)},D=K=>{_(K)},T=c.current.ownerDocument;return T.body.addEventListener("contextmenu",E),T.body.addEventListener("mousemove",R),T.body.addEventListener("touchmove",R),T.body.addEventListener("mouseleave",D),window.addEventListener("mouseup",E),window.addEventListener("touchend",E),()=>{T.body.removeEventListener("contextmenu",E),T.body.removeEventListener("mousemove",R),T.body.removeEventListener("touchmove",R),T.body.removeEventListener("mouseleave",D),window.removeEventListener("mouseup",E),window.removeEventListener("touchend",E)}},[m,n,S,_,E]),_ae({disabled:n,handleId:w,resizeHandler:_});const A={cursor:Q8(m),touchAction:"none",userSelect:"none"};return Iu(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":m,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>I(!1),onFocus:()=>I(!0),onMouseDown:R=>{y(w,R.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},onMouseUp:E,onTouchCancel:E,onTouchEnd:E,onTouchStart:R=>{y(w,R.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},ref:c,role:"separator",style:{...A,...s},tabIndex:0})}mx.displayName="PanelResizeHandle";const Rae=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=di("base.100","base.850"),i=di("base.300","base.700");return t==="horizontal"?a.jsx(mx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Le,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(mx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Le,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},lg=l.memo(Rae),G2=()=>{const e=le(),t=H(o=>o.ui.panels),n=l.useCallback(o=>t[o]??"",[t]),r=l.useCallback((o,s)=>{e(g7({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const Dae=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=l.useMemo(()=>v7(n)?n:JSON.stringify(n,null,2),[n]),c=l.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),d=l.useCallback(()=>{const h=new Blob([i]),m=document.createElement("a");m.href=URL.createObjectURL(h),m.download=`${r||t}.json`,document.body.appendChild(m),m.click(),m.remove()},[i,t,r]),{t:p}=Q();return a.jsxs(N,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Le,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Wn,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(Ia,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(Wu,{}),variant:"ghost",opacity:.7,onClick:d})}),s&&a.jsx(Wn,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(Ia,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hu,{}),variant:"ghost",opacity:.7,onClick:c})})]})]})},tl=l.memo(Dae),Tae=me(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},Ie),Nae=()=>{const{data:e}=H(Tae);return e?a.jsx(tl,{data:e,label:"Node Data"}):a.jsx(eo,{label:"No node selected",icon:null})},$ae=l.memo(Nae),Lae=({children:e,maxHeight:t})=>a.jsx(N,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Le,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),cc=l.memo(Lae),zae=({output:e})=>{const{image:t}=e,{data:n}=Rs(t.image_name);return a.jsx(ll,{imageDTO:n})},Fae=l.memo(zae),Bae=me(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},Ie),Hae=()=>{const{node:e,template:t,nes:n}=H(Bae),{t:r}=Q();return!e||!n||!Rr(e)?a.jsx(eo,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(eo,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Le,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(cc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(Fae,{output:o},Vae(o,s))):a.jsx(tl,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},Wae=l.memo(Hae),Vae=(e,t)=>`${e.type}-${t}`,Uae=me(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},Ie),Gae=()=>{const{template:e}=H(Uae),{t}=Q();return e?a.jsx(tl,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(eo,{label:t("nodes.noNodeSelected"),icon:null})},qae=l.memo(Gae),q2=e=>{e.stopPropagation()},Kae=De((e,t)=>{const n=le(),r=l.useCallback(s=>{s.shiftKey&&n(Qo(!0))},[n]),o=l.useCallback(s=>{s.shiftKey||n(Qo(!1))},[n]);return a.jsx(K3,{ref:t,onPaste:q2,onKeyDown:r,onKeyUp:o,...e})}),yi=l.memo(Kae),K2=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},Ie),[e]);return H(t)},Qae=({nodeId:e})=>{const t=le(),n=K2(e),{t:r}=Q(),o=l.useCallback(s=>{t(b7({nodeId:e,notes:s.target.value}))},[t,e]);return Kh(n)?a.jsxs(Vn,{children:[a.jsx(yr,{children:r("nodes.notes")}),a.jsx(yi,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},Xae=l.memo(Qae),Z8=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.label:!1},Ie),[e]);return H(t)},eA=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},Ie),[e]);return H(t)},Yae=({nodeId:e,title:t})=>{const n=le(),r=Z8(e),o=eA(e),{t:s}=Q(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(oP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsxs(Lf,{as:N,value:i,onChange:p,onSubmit:d,w:"full",fontWeight:600,children:[a.jsx($f,{noOfLines:1}),a.jsx(Nf,{className:"nodrag",_focusVisible:{boxShadow:"none"}})]})})},Jae=l.memo(Yae),Zae=me(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t),r=n?e.nodeTemplates[n.data.type]:void 0;return{node:n,template:r}},Ie),eie=()=>{const{node:e,template:t}=H(Zae),{t:n}=Q();return!t||!Rr(e)?a.jsx(eo,{label:n("nodes.noNodeSelected"),icon:null}):a.jsx(nie,{node:e,template:t})},tie=l.memo(eie),nie=e=>{const{t}=Q(),{needsUpdate:n,updateNode:r}=sP(e.node.id);return a.jsx(Le,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(cc,{children:a.jsxs(N,{sx:{flexDir:"column",position:"relative",p:1,gap:2,w:"full"},children:[a.jsx(Jae,{nodeId:e.node.data.id}),a.jsxs(Pg,{children:[a.jsxs(Vn,{children:[a.jsx(yr,{children:"Node Type"}),a.jsx(je,{fontSize:"sm",fontWeight:600,children:e.template.title})]}),a.jsxs(N,{flexDir:"row",alignItems:"center",justifyContent:"space-between",w:"full",children:[a.jsxs(Vn,{isInvalid:n,children:[a.jsx(yr,{children:"Node Version"}),a.jsx(je,{fontSize:"sm",fontWeight:600,children:e.node.data.version})]}),n&&a.jsx(rt,{"aria-label":t("nodes.updateNode"),tooltip:t("nodes.updateNode"),icon:a.jsx(s0,{}),onClick:r})]})]}),a.jsx(Xae,{nodeId:e.node.data.id})]})})})},rie=()=>{const{t:e}=Q();return a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(wo,{children:e("common.details")}),a.jsx(wo,{children:e("common.outputs")}),a.jsx(wo,{children:e("common.data")}),a.jsx(wo,{children:e("common.template")})]}),a.jsxs($u,{children:[a.jsx(Go,{children:a.jsx(tie,{})}),a.jsx(Go,{children:a.jsx(Wae,{})}),a.jsx(Go,{children:a.jsx($ae,{})}),a.jsx(Go,{children:a.jsx(qae,{})})]})]})})},oie=l.memo(rie),sie={display:"flex",flexDirection:"row",alignItems:"center",gap:10},aie=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,c=le(),d=l.useCallback(h=>{h.shiftKey&&c(Qo(!0))},[c]),p=l.useCallback(h=>{h.shiftKey||c(Qo(!1))},[c]);return a.jsxs(Vn,{isInvalid:o,isDisabled:r,...s,style:n==="side"?sie:void 0,children:[t!==""&&a.jsx(yr,{children:t}),a.jsx(_g,{...i,onPaste:q2,onKeyDown:d,onKeyUp:p})]})},Is=l.memo(aie),iie=me(we,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:c}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:c}},Ie),lie=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=H(iie),c=le(),d=l.useCallback(w=>{c(x7(w.target.value))},[c]),p=l.useCallback(w=>{c(y7(w.target.value))},[c]),h=l.useCallback(w=>{c(C7(w.target.value))},[c]),m=l.useCallback(w=>{c(w7(w.target.value))},[c]),g=l.useCallback(w=>{c(S7(w.target.value))},[c]),b=l.useCallback(w=>{c(k7(w.target.value))},[c]),y=l.useCallback(w=>{c(j7(w.target.value))},[c]),{t:x}=Q();return a.jsx(cc,{children:a.jsxs(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Is,{label:x("nodes.workflowName"),value:t,onChange:d}),a.jsx(Is,{label:x("nodes.workflowVersion"),value:o,onChange:m})]}),a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Is,{label:x("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(Is,{label:x("nodes.workflowContact"),value:s,onChange:h})]}),a.jsx(Is,{label:x("nodes.workflowTags"),value:r,onChange:b}),a.jsxs(Vn,{as:N,sx:{flexDir:"column"},children:[a.jsx(yr,{children:x("nodes.workflowDescription")}),a.jsx(yi,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Vn,{as:N,sx:{flexDir:"column",h:"full"},children:[a.jsx(yr,{children:x("nodes.workflowNotes")}),a.jsx(yi,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},cie=l.memo(lie),tA=()=>{const e=H(r=>r.nodes),[t]=L2(e,300);return l.useMemo(()=>_7(t),[t])},uie=()=>{const e=tA(),{t}=Q();return a.jsx(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(tl,{data:e,label:t("nodes.workflow")})})},die=l.memo(uie),fie=({isSelected:e,isHovered:t})=>{const n=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Le,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},nA=l.memo(fie),rA=e=>{const t=le(),n=l.useMemo(()=>me(we,({nodes:i})=>i.mouseOverNode===e,Ie),[e]),r=H(n),o=l.useCallback(()=>{!r&&t(nS(e))},[t,e,r]),s=l.useCallback(()=>{r&&t(nS(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},oA=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},Ie),[t,e]);return H(n)},sA=(e,t,n)=>{const r=l.useMemo(()=>me(we,({nodes:s})=>{var d;const i=s.nodes.find(p=>p.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(d=c==null?void 0:c[Xx[n]][t])==null?void 0:d.title},Ie),[t,n,e]);return H(r)},aA=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Rr(s))return s==null?void 0:s.data.inputs[t]},Ie),[t,e]);return H(n)},M0=(e,t,n)=>{const r=l.useMemo(()=>me(we,({nodes:s})=>{const i=s.nodes.find(d=>d.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return c==null?void 0:c[Xx[n]][t]},Ie),[t,n,e]);return H(r)},pie=({nodeId:e,fieldName:t,kind:n})=>{const r=aA(e,t),o=M0(e,t,n),s=I7(o),{t:i}=Q(),c=l.useMemo(()=>P7(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(je,{sx:{fontWeight:600},children:c}),o&&a.jsx(je,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(je,{children:["Type: ",If[o.type].title]}),s&&a.jsxs(je,{children:["Input: ",E7(o.input)]})]})},Q2=l.memo(pie),hie=De((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,c=oA(n,r),d=sA(n,r,o),{t:p}=Q(),h=le(),[m,g]=l.useState(c||d||p("nodes.unknownField")),b=l.useCallback(async x=>{x&&(x===c||x===d)||(g(x||d||p("nodes.unknownField")),h(M7({nodeId:n,fieldName:r,label:x})))},[c,d,h,n,r,p]),y=l.useCallback(x=>{g(x)},[]);return l.useEffect(()=>{g(c||d||p("nodes.unknownField"))},[c,d,p]),a.jsx(Wn,{label:i?a.jsx(Q2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:xg,placement:"top",hasArrow:!0,children:a.jsx(N,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Lf,{value:m,onChange:y,onSubmit:b,as:N,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx($f,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(Nf,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(lA,{})]})})})}),iA=l.memo(hie),lA=l.memo(()=>{const{isEditing:e,getEditButtonProps:t}=e5(),n=l.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(N,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});lA.displayName="EditableControls";const mie=e=>{const{nodeId:t,field:n}=e,r=le(),o=l.useCallback(s=>{r(O7({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(Fy,{className:"nodrag",onChange:o,isChecked:n.value})},gie=l.memo(mie);function O0(){return(O0=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function gx(e){var t=l.useRef(e),n=l.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Pu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(k_(o.current,w,c.current)):x(!1)},y=function(){return x(!1)};function x(w){var S=d.current,j=vx(o.current),I=w?j.addEventListener:j.removeEventListener;I(S?"touchmove":"mousemove",b),I(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(j_(S),!function(_,M){return M&&!Yd(_)}(S,d.current)&&j)){if(Yd(S)){d.current=!0;var I=S.changedTouches||[];I.length&&(c.current=I[0].identifier)}j.focus(),s(k_(j,S,c.current)),x(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},x]},[i,s]),h=p[0],m=p[1],g=p[2];return l.useEffect(function(){return g},[g]),z.createElement("div",O0({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:m,tabIndex:0,role:"slider"}))}),A0=function(e){return e.filter(Boolean).join(" ")},Y2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=A0(["react-colorful__pointer",e.className]);return z.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},z.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Ao=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},uA=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Ao(e.h),s:Ao(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Ao(o/2),a:Ao(r,2)}},bx=function(e){var t=uA(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},L1=function(e){var t=uA(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},vie=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),c=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),p=s%6;return{r:Ao(255*[r,c,i,i,d,r][p]),g:Ao(255*[d,r,r,c,i,i][p]),b:Ao(255*[i,i,d,r,r,c][p]),a:Ao(o,2)}},bie=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),c=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Ao(60*(c<0?c+6:c)),s:Ao(s?i/s*100:0),v:Ao(s/255*100),a:o}},xie=z.memo(function(e){var t=e.hue,n=e.onChange,r=A0(["react-colorful__hue",e.className]);return z.createElement("div",{className:r},z.createElement(X2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Pu(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Ao(t),"aria-valuemax":"360","aria-valuemin":"0"},z.createElement(Y2,{className:"react-colorful__hue-pointer",left:t/360,color:bx({h:t,s:100,v:100,a:1})})))}),yie=z.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:bx({h:t.h,s:100,v:100,a:1})};return z.createElement("div",{className:"react-colorful__saturation",style:r},z.createElement(X2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Pu(t.s+100*o.left,0,100),v:Pu(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Ao(t.s)+"%, Brightness "+Ao(t.v)+"%"},z.createElement(Y2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:bx(t)})))}),dA=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Cie(e,t,n){var r=gx(n),o=l.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],c=l.useRef({color:t,hsva:s});l.useEffect(function(){if(!e.equal(t,c.current.color)){var p=e.toHsva(t);c.current={hsva:p,color:t},i(p)}},[t,e]),l.useEffect(function(){var p;dA(s,c.current.hsva)||e.equal(p=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:p},r(p))},[s,e,r]);var d=l.useCallback(function(p){i(function(h){return Object.assign({},h,p)})},[]);return[s,d]}var wie=typeof window<"u"?l.useLayoutEffect:l.useEffect,Sie=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},__=new Map,kie=function(e){wie(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!__.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,__.set(t,n);var r=Sie();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},jie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+L1(Object.assign({},n,{a:0}))+", "+L1(Object.assign({},n,{a:1}))+")"},s=A0(["react-colorful__alpha",t]),i=Ao(100*n.a);return z.createElement("div",{className:s},z.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),z.createElement(X2,{onMove:function(c){r({a:c.left})},onKey:function(c){r({a:Pu(n.a+c.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},z.createElement(Y2,{className:"react-colorful__alpha-pointer",left:n.a,color:L1(n)})))},_ie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=cA(e,["className","colorModel","color","onChange"]),c=l.useRef(null);kie(c);var d=Cie(n,o,s),p=d[0],h=d[1],m=A0(["react-colorful",t]);return z.createElement("div",O0({},i,{ref:c,className:m}),z.createElement(yie,{hsva:p,onChange:h}),z.createElement(xie,{hue:p.h,onChange:h}),z.createElement(jie,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},Iie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:bie,fromHsva:vie,equal:dA},fA=function(e){return z.createElement(_ie,O0({},e,{colorModel:Iie}))};const Pie=e=>{const{nodeId:t,field:n}=e,r=le(),o=l.useCallback(s=>{r(A7({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(fA,{className:"nodrag",color:n.value,onChange:o})},Eie=l.memo(Pie),pA=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=R7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},Mie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=$x(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=pA(p);h&&o(D7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Dr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},Oie=l.memo(Mie),Aie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=le(),s=l.useCallback(i=>{o(T7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(E3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},Rie=l.memo(Aie),Die=e=>{var p;const{nodeId:t,field:n}=e,r=le(),{currentData:o}=Rs(((p=n.value)==null?void 0:p.image_name)??zs.skipToken),s=l.useCallback(()=>{r(N7({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=l.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),c=l.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),d=l.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(N,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(ll,{imageDTO:o,droppableData:c,draggableData:i,postUploadAction:d,useThumbailFallback:!0,uploadElement:a.jsx(hA,{}),dropLabel:a.jsx(mA,{}),minSize:8,children:a.jsx(du,{onClick:s,icon:o?a.jsx(a0,{}):void 0,tooltip:"Reset Image"})})})},Tie=l.memo(Die),hA=l.memo(()=>a.jsx(je,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));hA.displayName="UploadElement";const mA=l.memo(()=>a.jsx(je,{fontSize:16,fontWeight:600,children:"Drop"}));mA.displayName="DropLabel";const Nie=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=$7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},$ie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=_f(),{t:i}=Q(),c=l.useMemo(()=>{if(!s)return[];const m=[];return to(s.entities,(g,b)=>{g&&m.push({value:b,label:g.model_name,group:xr[g.base_model]})}),m.sort((g,b)=>g.disabled&&!b.disabled?1:-1)},[s]),d=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=l.useCallback(m=>{if(!m)return;const g=Nie(m);g&&o(L7({nodeId:t,fieldName:n.name,value:g}))},[o,n.name,t]),h=l.useCallback((m,g)=>{var b;return((b=g.label)==null?void 0:b.toLowerCase().includes(m.toLowerCase().trim()))||g.value.toLowerCase().includes(m.toLowerCase().trim())},[]);return(s==null?void 0:s.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(je,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(sr,{className:"nowheel nodrag",value:(d==null?void 0:d.id)??null,placeholder:c.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:c,nothingFound:i("models.noMatchingLoRAs"),itemComponent:pl,disabled:c.length===0,filter:h,error:!d,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Lie=l.memo($ie),R0=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=z7.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Ku(e){const{iconMode:t=!1,...n}=e,r=le(),{t:o}=Q(),[s,{isLoading:i}]=F7(),c=l.useCallback(()=>{s().unwrap().then(d=>{r(Ht(rr({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(d=>{d&&r(Ht(rr({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})},[r,s,o]);return t?a.jsx(rt,{icon:a.jsx(s0,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:c,size:"sm",...n}):a.jsx(Dt,{isLoading:i,onClick:c,minW:"max-content",...n,children:o("modelManager.syncModels")})}const zie=e=>{var y,x;const{nodeId:t,field:n}=e,r=le(),o=Pn("syncModels").isFeatureEnabled,{t:s}=Q(),{data:i,isLoading:c}=Jd(rS),{data:d,isLoading:p}=aa(rS),h=l.useMemo(()=>c||p,[c,p]),m=l.useMemo(()=>{if(!d)return[];const w=[];return to(d.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:xr[S.base_model]})}),i&&to(i.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:xr[S.base_model]})}),w},[d,i]),g=l.useMemo(()=>{var w,S,j,I;return((d==null?void 0:d.entities[`${(w=n.value)==null?void 0:w.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(I=n.value)==null?void 0:I.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(x=n.value)==null?void 0:x.model_name,d==null?void 0:d.entities,i==null?void 0:i.entities]),b=l.useCallback(w=>{if(!w)return;const S=R0(w);S&&r(aP({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(N,{sx:{w:"full",alignItems:"center",gap:2},children:[h?a.jsx(je,{variant:"subtext",children:"Loading..."}):a.jsx(sr,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:m.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:m,error:!g,disabled:m.length===0,onChange:b,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Ku,{className:"nodrag",iconMode:!0})]})},Fie=l.memo(zie),cg=/^-?(0\.)?\.?$/,gA=De((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:c,min:d,max:p,isInteger:h=!0,formControlProps:m,formLabelProps:g,numberInputFieldProps:b,numberInputStepperProps:y,tooltipProps:x,...w}=e,S=le(),[j,I]=l.useState(String(i));l.useEffect(()=>{!j.match(cg)&&i!==Number(j)&&I(String(i))},[i,j]);const _=l.useCallback(R=>{I(R),R.match(cg)||c(h?Math.floor(Number(R)):Number(R))},[h,c]),M=l.useCallback(R=>{const D=Hl(h?Math.floor(Number(R.target.value)):Number(R.target.value),d,p);I(String(D)),c(D)},[h,p,d,c]),E=l.useCallback(R=>{R.shiftKey&&S(Qo(!0))},[S]),A=l.useCallback(R=>{R.shiftKey||S(Qo(!1))},[S]);return a.jsx(Wn,{...x,children:a.jsxs(Vn,{ref:t,isDisabled:r,isInvalid:s,...m,children:[n&&a.jsx(yr,{...g,children:n}),a.jsxs(Tg,{value:j,min:d,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:_,onBlur:M,...w,onPaste:q2,children:[a.jsx($g,{...b,onKeyDown:E,onKeyUp:A}),o&&a.jsxs(Ng,{children:[a.jsx(zg,{...y}),a.jsx(Lg,{...y})]})]})]})})});gA.displayName="IAINumberInput";const _a=l.memo(gA),Bie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=le(),[s,i]=l.useState(String(n.value)),c=l.useMemo(()=>r.type==="integer",[r.type]),d=l.useCallback(p=>{i(p),p.match(cg)||o(B7({nodeId:t,fieldName:n.name,value:c?Math.floor(Number(p)):Number(p)}))},[o,n.name,c,t]);return l.useEffect(()=>{!s.match(cg)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Tg,{onChange:d,value:s,step:c?1:.1,precision:c?0:3,children:[a.jsx($g,{className:"nodrag"}),a.jsxs(Ng,{children:[a.jsx(zg,{}),a.jsx(Lg,{})]})]})},Hie=l.memo(Bie),Wie=e=>{var m,g;const{nodeId:t,field:n}=e,r=le(),{t:o}=Q(),s=Pn("syncModels").isFeatureEnabled,{data:i,isLoading:c}=aa(Yx),d=l.useMemo(()=>{if(!i)return[];const b=[];return to(i.entities,(y,x)=>{y&&b.push({value:x,label:y.model_name,group:xr[y.base_model]})}),b},[i]),p=l.useMemo(()=>{var b,y;return(i==null?void 0:i.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(m=n.value)==null?void 0:m.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),h=l.useCallback(b=>{if(!b)return;const y=R0(b);y&&r(H7({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return c?a.jsx(sr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sr,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:d.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:d,error:!p,disabled:d.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Ku,{className:"nodrag",iconMode:!0})]})},Vie=l.memo(Wie),Uie=e=>{var g,b;const{nodeId:t,field:n}=e,r=le(),{t:o}=Q(),s=Pn("syncModels").isFeatureEnabled,{data:i}=Jd(oS),{data:c,isLoading:d}=aa(oS),p=l.useMemo(()=>{if(!c)return[];const y=[];return to(c.entities,(x,w)=>{!x||x.base_model!=="sdxl"||y.push({value:w,label:x.model_name,group:xr[x.base_model]})}),i&&to(i.entities,(x,w)=>{!x||x.base_model!=="sdxl"||y.push({value:w,label:x.model_name,group:xr[x.base_model]})}),y},[c,i]),h=l.useMemo(()=>{var y,x,w,S;return((c==null?void 0:c.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(x=n.value)==null?void 0:x.model_name}`])||(i==null?void 0:i.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(b=n.value)==null?void 0:b.model_name,c==null?void 0:c.entities,i==null?void 0:i.entities]),m=l.useCallback(y=>{if(!y)return;const x=R0(y);x&&r(aP({nodeId:t,fieldName:n.name,value:x}))},[r,n.name,t]);return d?a.jsx(sr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sr,{className:"nowheel nodrag",tooltip:h==null?void 0:h.description,value:h==null?void 0:h.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!h,disabled:p.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Ku,{className:"nodrag",iconMode:!0})]})},Gie=l.memo(Uie),qie=me([we],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:To(hg,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},Ie),Kie=e=>{const{nodeId:t,field:n}=e,r=le(),{data:o}=H(qie),s=l.useCallback(i=>{i&&r(W7({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(sr,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Qie=l.memo(Kie),Xie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=le(),s=l.useCallback(i=>{o(V7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(yi,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(Is,{onChange:s,value:n.value})},Yie=l.memo(Xie),vA=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=U7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Jie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=iP(),i=l.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),c=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),d=l.useCallback(p=>{if(!p)return;const h=vA(p);h&&o(G7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(sr,{className:"nowheel nodrag",itemComponent:pl,tooltip:c==null?void 0:c.description,value:(c==null?void 0:c.id)??"default",placeholder:"Default",data:i,onChange:d,disabled:i.length===0,error:!c,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Zie=l.memo(Jie),ele=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=q7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},tle=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=zx(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=ele(p);h&&o(K7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Dr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},nle=l.memo(tle),rle=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=Q7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({t2iAdapterModelId:e,errors:s.error.format()},"Failed to parse T2I-Adapter model id");return}return s.data},ole=e=>{const{nodeId:t,field:n}=e,r=n.value,o=le(),{data:s}=Lx(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/t2i_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return to(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=rle(p);h&&o(X7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Dr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},sle=l.memo(ole),ale=e=>{var c;const{nodeId:t,field:n}=e,r=le(),{data:o,hasBoards:s}=jf(void 0,{selectFromResult:({data:d})=>{const p=[{label:"None",value:"none"}];return d==null||d.forEach(({board_id:h,board_name:m})=>{p.push({label:m,value:h})}),{data:p,hasBoards:p.length>1}}}),i=l.useCallback(d=>{r(Y7({nodeId:t,fieldName:n.name,value:d&&d!=="none"?{board_id:d}:void 0}))},[r,n.name,t]);return a.jsx(sr,{className:"nowheel nodrag",value:((c=n.value)==null?void 0:c.board_id)??"none",data:o,onChange:i,disabled:!s})},ile=l.memo(ale),lle=({nodeId:e,fieldName:t})=>{const n=aA(e,t),r=M0(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Le,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(Yie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(gie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Hie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(Rie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(Tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(ile,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(Fie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Vie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Zie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(Lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(Oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(nle,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(sle,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(Eie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Gie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Qie,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Le,{p:1,children:a.jsxs(je,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},bA=l.memo(lle),cle=({nodeId:e,fieldName:t})=>{const n=le(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=rA(e),{t:i}=Q(),c=l.useCallback(()=>{n(lP({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(N,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Vn,{as:N,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(yr,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(iA,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(Pi,{}),a.jsx(Wn,{label:a.jsx(Q2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:xg,placement:"top",hasArrow:!0,children:a.jsx(N,{h:"full",alignItems:"center",children:a.jsx(Gr,{as:QM})})}),a.jsx(rt,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:c,icon:a.jsx(Zo,{})})]}),a.jsx(bA,{nodeId:e,fieldName:t})]}),a.jsx(nA,{isSelected:!1,isHovered:r})]})},ule=l.memo(cle),dle=me(we,({nodes:e})=>({fields:e.workflow.exposedFields}),Ie),fle=()=>{const{fields:e}=H(dle),{t}=Q();return a.jsx(Le,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(cc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(ule,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(eo,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},ple=l.memo(fle),hle=()=>{const{t:e}=Q();return a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(wo,{children:e("common.linear")}),a.jsx(wo,{children:e("common.details")}),a.jsx(wo,{children:"JSON"})]}),a.jsxs($u,{children:[a.jsx(Go,{children:a.jsx(ple,{})}),a.jsx(Go,{children:a.jsx(cie,{})}),a.jsx(Go,{children:a.jsx(die,{})})]})]})})},mle=l.memo(hle),gle={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},vle=1e3,ble=[{name:"preventOverflow",options:{padding:10}}],xA=De(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=Q(),i=H(g=>g.system.shouldEnableInformationalPopovers),c=l.useMemo(()=>gle[e],[e]),d=l.useMemo(()=>J7(Z7(c,["image","href","buttonLabel"]),r),[c,r]),p=l.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),h=l.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),m=l.useCallback(()=>{c!=null&&c.href&&window.open(c.href)},[c==null?void 0:c.href]);return i?a.jsxs(Uf,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:vle,modifiers:ble,placement:"top",...d,children:[a.jsx(Bg,{children:a.jsx(Le,{ref:o,w:"full",...n,children:t})}),a.jsx(Au,{children:a.jsxs(Gf,{w:96,children:[a.jsx(w3,{}),a.jsx(Hg,{children:a.jsxs(N,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(yo,{size:"sm",children:p}),a.jsx(io,{})]}),(c==null?void 0:c.image)&&a.jsxs(a.Fragment,{children:[a.jsx(_i,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:c.image,alt:"Optional Image"}),a.jsx(io,{})]}),h.map(g=>a.jsx(je,{children:g},g)),(c==null?void 0:c.href)&&a.jsxs(a.Fragment,{children:[a.jsx(io,{}),a.jsx(nl,{pt:1,onClick:m,leftIcon:a.jsx(l2,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Le,{ref:o,w:"full",...n,children:t})});xA.displayName="IAIInformationalPopover";const kn=l.memo(xA),xle=me([we],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:c}=e.generation,{shouldUseSliders:d}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:c,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:d}},Ie),yle=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:c}=H(xle),d=le(),{t:p}=Q(),h=l.useCallback(g=>{d(sS(g))},[d]),m=l.useCallback(()=>{d(sS(n))},[d,n]);return e||c?a.jsx(kn,{feature:"paramIterations",children:a.jsx(It,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:h,handleReset:m,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(kn,{feature:"paramIterations",children:a.jsx(_a,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:h,value:t,numberInputFieldProps:{textAlign:"center"}})})},ua=l.memo(yle),Cle=()=>{const[e,t]=l.useState(!1),[n,r]=l.useState(!1),o=l.useRef(null),s=G2(),i=l.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(N,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(z8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(ua,{asSlider:!0})}),a.jsxs(E0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(el,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(mle,{})}),a.jsx(lg,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(el,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(oie,{})})]})]})},wle=l.memo(Cle),I_=(e,t)=>{const n=l.useRef(null),[r,o]=l.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=l.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?ls.flushSync(()=>{var h;(h=n.current)==null||h.expand()}):ls.flushSync(()=>{var h;(h=n.current)==null||h.collapse()})},[]),i=l.useCallback(()=>{ls.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),c=l.useCallback(()=>{ls.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),d=l.useCallback(()=>{ls.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:d,toggle:s,expand:i,collapse:c}},Sle=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=Q(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Au,{children:a.jsx(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(rt,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(pse,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},kle=l.memo(Sle),wh={borderStartRadius:0,flexGrow:1},jle=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=Q(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Au,{children:a.jsxs(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(Hn,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(rt,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:wh,icon:a.jsx(tO,{})}),a.jsx(N8,{asIconButton:!0,sx:wh}),a.jsx(O8,{asIconButton:!0,sx:wh})]}),a.jsx(B2,{asIconButton:!0,sx:wh})]})}):null},_le=l.memo(jle),Ile=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=hs({defaultIsOpen:o}),{colorMode:c}=ji();return a.jsxs(Le,{children:[a.jsxs(N,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Xe("base.250","base.750")(c),color:Xe("base.900","base.100")(c),_hover:{bg:Xe("base.300","base.700")(c)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(So,{children:n&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(je,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(Pi,{}),a.jsx(b0,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Af,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Le,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},No=l.memo(Ile),Ple=me(we,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},Ie),Ele=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=H(Ple),s=le(),{t:i}=Q(),c=l.useCallback(p=>{s(eT(p))},[s]),d=l.useCallback(()=>{s(tT())},[s]);return a.jsx(kn,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(It,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:c,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})})},Mle=l.memo(Ele),Ole=me(we,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},Ie),Ale={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},Rle=()=>{const{t:e}=Q(),{prompts:t,parsingError:n,isLoading:r,isError:o}=H(Ole);return o?a.jsx(kn,{feature:"dynamicPrompts",children:a.jsx(N,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(eo,{icon:ise,label:"Problem generating prompts"})})}):a.jsx(kn,{feature:"dynamicPrompts",children:a.jsxs(Vn,{isInvalid:!!n,children:[a.jsxs(yr,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[e("dynamicPrompts.promptsPreview")," (",t.length,")",n&&` - ${n}`]}),a.jsxs(N,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(cc,{children:a.jsx(V5,{stylePosition:"inside",ms:0,children:t.map((s,i)=>a.jsx(Ps,{fontSize:"sm",sx:Ale,children:a.jsx(je,{as:"span",children:s})},`${s}.${i}`))})}),r&&a.jsx(N,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(Ci,{})})]})]})})},Dle=l.memo(Rle),yA=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Le,{ref:r,...n,children:a.jsxs(Le,{children:[a.jsx(je,{fontWeight:600,children:e}),t&&a.jsx(je,{size:"xs",variant:"subtext",children:t})]})}));yA.displayName="IAIMantineSelectItemWithDescription";const Tle=l.memo(yA),Nle=()=>{const e=le(),{t}=Q(),n=H(s=>s.dynamicPrompts.seedBehaviour),r=l.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=l.useCallback(s=>{s&&e(nT(s))},[e]);return a.jsx(kn,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Dr,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:Tle,onChange:o})})},$le=l.memo(Nle),Lle=()=>{const{t:e}=Q(),t=l.useMemo(()=>me(we,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=H(t);return Pn("dynamicPrompting").isFeatureEnabled?a.jsx(No,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Dle,{}),a.jsx($le,{}),a.jsx(Mle,{})]})}):null},Qu=l.memo(Lle),zle=e=>{const t=le(),{lora:n}=e,r=l.useCallback(i=>{t(rT({id:n.id,weight:i}))},[t,n.id]),o=l.useCallback(()=>{t(oT(n.id))},[t,n.id]),s=l.useCallback(()=>{t(sT(n.id))},[t,n.id]);return a.jsx(kn,{feature:"lora",children:a.jsxs(N,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(It,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(rt,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(Zo,{}),colorScheme:"error"})]})})},Fle=l.memo(zle),Ble=me(we,({lora:e})=>({lorasArray:To(e.loras)}),Ie),Hle=()=>{const{lorasArray:e}=H(Ble);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(io,{pt:1}),a.jsx(Fle,{lora:t})]},t.model_name))})},Wle=l.memo(Hle),Vle=me(we,({lora:e})=>({loras:e.loras}),Ie),Ule=()=>{const e=le(),{loras:t}=H(Vle),{data:n}=_f(),{t:r}=Q(),o=H(d=>d.generation.model),s=l.useMemo(()=>{if(!n)return[];const d=[];return to(n.entities,(p,h)=>{if(!p||h in t)return;const m=(o==null?void 0:o.base_model)!==p.base_model;d.push({value:h,label:p.model_name,disabled:m,group:xr[p.base_model],tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.label&&!h.label?1:-1),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),i=l.useCallback(d=>{if(!d)return;const p=n==null?void 0:n.entities[d];p&&e(aT(p))},[e,n==null?void 0:n.entities]),c=l.useCallback((d,p)=>{var h;return((h=p.label)==null?void 0:h.toLowerCase().includes(d.toLowerCase().trim()))||p.value.toLowerCase().includes(d.toLowerCase().trim())},[]);return(n==null?void 0:n.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(je,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:r("models.noLoRAsInstalled")})}):a.jsx(sr,{placeholder:s.length===0?"All LoRAs added":r("models.addLora"),value:null,data:s,nothingFound:"No matching LoRAs",itemComponent:pl,disabled:s.length===0,filter:c,onChange:i,"data-testid":"add-lora"})},Gle=l.memo(Ule),qle=me(we,e=>{const t=cP(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},Ie),Kle=()=>{const{t:e}=Q(),{activeLabel:t}=H(qle);return Pn("lora").isFeatureEnabled?a.jsx(No,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(Gle,{}),a.jsx(Wle,{})]})}):null},Xu=l.memo(Kle),Qle=()=>{const e=le(),t=H(o=>o.generation.shouldUseCpuNoise),{t:n}=Q(),r=l.useCallback(o=>{e(iT(o.target.checked))},[e]);return a.jsx(kn,{feature:"noiseUseCPU",children:a.jsx(_r,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},da=e=>e.generation,Xle=me(da,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},Ie),Yle=()=>{const{t:e}=Q(),{seamlessXAxis:t}=H(Xle),n=le(),r=l.useCallback(o=>{n(lT(o.target.checked))},[n]);return a.jsx(_r,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Jle=l.memo(Yle),Zle=me(da,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},Ie),ece=()=>{const{t:e}=Q(),{seamlessYAxis:t}=H(Zle),n=le(),r=l.useCallback(o=>{n(cT(o.target.checked))},[n]);return a.jsx(_r,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},tce=l.memo(ece),nce=()=>{const{t:e}=Q();return Pn("seamless").isFeatureEnabled?a.jsxs(Vn,{children:[a.jsx(yr,{children:e("parameters.seamlessTiling")})," ",a.jsxs(N,{sx:{gap:5},children:[a.jsx(Le,{flexGrow:1,children:a.jsx(Jle,{})}),a.jsx(Le,{flexGrow:1,children:a.jsx(tce,{})})]})]}):null},rce=l.memo(nce);function oce(){const e=H(d=>d.generation.clipSkip),{model:t}=H(d=>d.generation),n=le(),{t:r}=Q(),o=l.useCallback(d=>{n(aS(d))},[n]),s=l.useCallback(()=>{n(aS(0))},[n]),i=l.useMemo(()=>t?qp[t.base_model].maxClip:qp["sd-1"].maxClip,[t]),c=l.useMemo(()=>t?qp[t.base_model].markers:qp["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(kn,{feature:"clipSkip",placement:"top",children:a.jsx(It,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:c,withInput:!0,withReset:!0,handleReset:s})})}const sce=me(we,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},Ie);function Yu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=H(sce),{t:s}=Q(),i=l.useMemo(()=>{const c=[];return o||c.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&c.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?c.push(s("parameters.seamlessX&Y")):n?c.push(s("parameters.seamlessX")):r&&c.push(s("parameters.seamlessY")),c.join(", ")},[e,t,n,r,o,s]);return a.jsx(No,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(rce,{}),a.jsx(io,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(oce,{}),a.jsx(io,{pt:2})]}),a.jsx(Qle,{})]})})}const Oi=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return((o=Fs(r,e))==null?void 0:o.isEnabled)??!1},Ie),[e]);return H(t)},ace=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.model},Ie),[e]);return H(t)},CA=e=>{const{data:t}=$x(),n=l.useMemo(()=>t?FI.getSelectors().selectAll(t):[],[t]),{data:r}=Lx(),o=l.useMemo(()=>r?BI.getSelectors().selectAll(r):[],[r]),{data:s}=zx(),i=l.useMemo(()=>s?HI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?i:[]},wA=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.type},Ie),[e]);return H(t)},ice=me(we,({generation:e})=>{const{model:t}=e;return{mainModel:t}},Ie),lce=({id:e})=>{const t=Oi(e),n=wA(e),r=ace(e),o=le(),{mainModel:s}=H(ice),{t:i}=Q(),c=CA(n),d=l.useMemo(()=>{if(!c)return[];const m=[];return c.forEach(g=>{if(!g)return;const b=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);m.push({value:g.id,label:g.model_name,group:xr[g.base_model],disabled:b,tooltip:b?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),m.sort((g,b)=>g.disabled?1:b.disabled?-1:g.label.localeCompare(b.label)),m},[s==null?void 0:s.base_model,c,i]),p=l.useMemo(()=>c.find(m=>(m==null?void 0:m.id)===`${r==null?void 0:r.base_model}/${n}/${r==null?void 0:r.model_name}`),[n,r==null?void 0:r.base_model,r==null?void 0:r.model_name,c]),h=l.useCallback(m=>{if(!m)return;const g=pA(m);g&&o(uT({id:e,model:g}))},[o,e]);return a.jsx(sr,{itemComponent:pl,data:d,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:h,disabled:!t,tooltip:p==null?void 0:p.description})},cce=l.memo(lce),uce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.weight},Ie),[e]);return H(t)},dce=({id:e})=>{const t=Oi(e),n=uce(e),r=le(),{t:o}=Q(),s=l.useCallback(i=>{r(dT({id:e,weight:i}))},[r,e]);return si(n)?null:a.jsx(kn,{feature:"controlNetWeight",children:a.jsx(It,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},fce=l.memo(dce),pce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{var o;return(o=Fs(r,e))==null?void 0:o.controlImage},Ie),[e]);return H(t)},hce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o&&Ru(o)?o.processedControlImage:void 0},Ie),[e]);return H(t)},mce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o&&Ru(o)?o.processorType:void 0},Ie),[e]);return H(t)},gce=me(we,({controlAdapters:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},Ie),vce=({isSmall:e,id:t})=>{const n=pce(t),r=hce(t),o=mce(t),s=le(),{t:i}=Q(),{pendingControlImages:c,autoAddBoardId:d}=H(gce),p=H(lo),[h,m]=l.useState(!1),{currentData:g}=Rs(n??zs.skipToken),{currentData:b}=Rs(r??zs.skipToken),[y]=fT(),[x]=pT(),[w]=hT(),S=l.useCallback(()=>{s(mT({id:t,controlImage:null}))},[t,s]),j=l.useCallback(async()=>{b&&(await y({imageDTO:b,is_intermediate:!1}).unwrap(),d!=="none"?x({imageDTO:b,board_id:d}):w({imageDTO:b}))},[b,y,d,x,w]),I=l.useCallback(()=>{g&&(p==="unifiedCanvas"?s(na({width:g.width,height:g.height})):(s(Wl(g.width)),s(Vl(g.height))))},[g,p,s]),_=l.useCallback(()=>{m(!0)},[]),M=l.useCallback(()=>{m(!1)},[]),E=l.useMemo(()=>{if(g)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:g}}},[g,t]),A=l.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),R=l.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),D=g&&b&&!h&&!c.includes(t)&&o!=="none";return a.jsxs(N,{onMouseEnter:_,onMouseLeave:M,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(ll,{draggableData:E,droppableData:A,imageDTO:g,isDropDisabled:D,postUploadAction:R}),a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:D?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(ll,{draggableData:E,droppableData:A,imageDTO:b,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:S,icon:g?a.jsx(a0,{}):void 0,tooltip:i("controlnet.resetControlImage")}),a.jsx(du,{onClick:j,icon:g?a.jsx(o0,{size:16}):void 0,tooltip:i("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(du,{onClick:I,icon:g?a.jsx(Kee,{size:16}):void 0,tooltip:i("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),c.includes(t)&&a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(Ci,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},P_=l.memo(vce),Hs=()=>{const e=le();return l.useCallback((n,r)=>{e(gT({id:n,params:r}))},[e])};function Ws(e){return a.jsx(N,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const E_=Do.canny_image_processor.default,bce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=l.useCallback(()=>{i(t,{low_threshold:E_.low_threshold})},[t,i]),h=l.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),m=l.useCallback(()=>{i(t,{high_threshold:E_.high_threshold})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{isDisabled:!r,label:c("controlnet.lowThreshold"),value:o,onChange:d,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(It,{isDisabled:!r,label:c("controlnet.highThreshold"),value:s,onChange:h,handleReset:m,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},xce=l.memo(bce),yce=Do.color_map_image_processor.default,Cce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Hs(),{t:i}=Q(),c=l.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),d=l.useCallback(()=>{s(t,{color_map_tile_size:yce.color_map_tile_size})},[t,s]);return a.jsx(Ws,{children:a.jsx(It,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:c,handleReset:d,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},wce=l.memo(Cce),kd=Do.content_shuffle_image_processor.default,Sce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:c,f:d}=n,p=Hs(),{t:h}=Q(),m=l.useCallback(M=>{p(t,{detect_resolution:M})},[t,p]),g=l.useCallback(()=>{p(t,{detect_resolution:kd.detect_resolution})},[t,p]),b=l.useCallback(M=>{p(t,{image_resolution:M})},[t,p]),y=l.useCallback(()=>{p(t,{image_resolution:kd.image_resolution})},[t,p]),x=l.useCallback(M=>{p(t,{w:M})},[t,p]),w=l.useCallback(()=>{p(t,{w:kd.w})},[t,p]),S=l.useCallback(M=>{p(t,{h:M})},[t,p]),j=l.useCallback(()=>{p(t,{h:kd.h})},[t,p]),I=l.useCallback(M=>{p(t,{f:M})},[t,p]),_=l.useCallback(()=>{p(t,{f:kd.f})},[t,p]);return a.jsxs(Ws,{children:[a.jsx(It,{label:h("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.imageResolution"),value:o,onChange:b,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.w"),value:i,onChange:x,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.h"),value:c,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:h("controlnet.f"),value:d,onChange:I,handleReset:_,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},kce=l.memo(Sce),M_=Do.hed_image_processor.default,jce=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Hs(),{t:c}=Q(),d=l.useCallback(b=>{i(t,{detect_resolution:b})},[t,i]),p=l.useCallback(b=>{i(t,{image_resolution:b})},[t,i]),h=l.useCallback(b=>{i(t,{scribble:b.target.checked})},[t,i]),m=l.useCallback(()=>{i(t,{detect_resolution:M_.detect_resolution})},[t,i]),g=l.useCallback(()=>{i(t,{image_resolution:M_.image_resolution})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.detectResolution"),value:n,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(It,{label:c("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(_r,{label:c("controlnet.scribble"),isChecked:o,onChange:h,isDisabled:!s})]})},_ce=l.memo(jce),O_=Do.lineart_anime_image_processor.default,Ice=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:O_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:O_.image_resolution})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Pce=l.memo(Ice),A_=Do.lineart_image_processor.default,Ece=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,c=Hs(),{t:d}=Q(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:A_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:A_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{coarse:y.target.checked})},[t,c]);return a.jsxs(Ws,{children:[a.jsx(It,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_r,{label:d("controlnet.coarse"),isChecked:i,onChange:b,isDisabled:!r})]})},Mce=l.memo(Ece),R_=Do.mediapipe_face_processor.default,Oce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=l.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),h=l.useCallback(()=>{i(t,{max_faces:R_.max_faces})},[t,i]),m=l.useCallback(()=>{i(t,{min_confidence:R_.min_confidence})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.maxFaces"),value:o,onChange:d,handleReset:h,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.minConfidence"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ace=l.memo(Oce),D_=Do.midas_depth_image_processor.default,Rce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=l.useCallback(g=>{i(t,{bg_th:g})},[t,i]),h=l.useCallback(()=>{i(t,{a_mult:D_.a_mult})},[t,i]),m=l.useCallback(()=>{i(t,{bg_th:D_.bg_th})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.amult"),value:o,onChange:d,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.bgth"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Dce=l.memo(Rce),Sh=Do.mlsd_image_processor.default,Tce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:c}=n,d=Hs(),{t:p}=Q(),h=l.useCallback(j=>{d(t,{detect_resolution:j})},[t,d]),m=l.useCallback(j=>{d(t,{image_resolution:j})},[t,d]),g=l.useCallback(j=>{d(t,{thr_d:j})},[t,d]),b=l.useCallback(j=>{d(t,{thr_v:j})},[t,d]),y=l.useCallback(()=>{d(t,{detect_resolution:Sh.detect_resolution})},[t,d]),x=l.useCallback(()=>{d(t,{image_resolution:Sh.image_resolution})},[t,d]),w=l.useCallback(()=>{d(t,{thr_d:Sh.thr_d})},[t,d]),S=l.useCallback(()=>{d(t,{thr_v:Sh.thr_v})},[t,d]);return a.jsxs(Ws,{children:[a.jsx(It,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.w"),value:i,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.h"),value:c,onChange:b,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Nce=l.memo(Tce),T_=Do.normalbae_image_processor.default,$ce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Hs(),{t:c}=Q(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:T_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:T_.image_resolution})},[t,i]);return a.jsxs(Ws,{children:[a.jsx(It,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Lce=l.memo($ce),N_=Do.openpose_image_processor.default,zce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,c=Hs(),{t:d}=Q(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:N_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:N_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{hand_and_face:y.target.checked})},[t,c]);return a.jsxs(Ws,{children:[a.jsx(It,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_r,{label:d("controlnet.handAndFace"),isChecked:i,onChange:b,isDisabled:!r})]})},Fce=l.memo(zce),$_=Do.pidi_image_processor.default,Bce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:c}=n,d=Hs(),{t:p}=Q(),h=l.useCallback(w=>{d(t,{detect_resolution:w})},[t,d]),m=l.useCallback(w=>{d(t,{image_resolution:w})},[t,d]),g=l.useCallback(()=>{d(t,{detect_resolution:$_.detect_resolution})},[t,d]),b=l.useCallback(()=>{d(t,{image_resolution:$_.image_resolution})},[t,d]),y=l.useCallback(w=>{d(t,{scribble:w.target.checked})},[t,d]),x=l.useCallback(w=>{d(t,{safe:w.target.checked})},[t,d]);return a.jsxs(Ws,{children:[a.jsx(It,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(It,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_r,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(_r,{label:p("controlnet.safe"),isChecked:c,onChange:x,isDisabled:!r})]})},Hce=l.memo(Bce),Wce=e=>null,Vce=l.memo(Wce),SA=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o&&Ru(o)?o.processorNode:void 0},Ie),[e]);return H(t)},Uce=({id:e})=>{const t=Oi(e),n=SA(e);return n?n.type==="canny_image_processor"?a.jsx(xce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(wce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(_ce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(Mce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(kce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(Pce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(Ace,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(Dce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(Nce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(Lce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(Fce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx(Hce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(Vce,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},Gce=l.memo(Uce),qce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);if(o&&Ru(o))return o.shouldAutoConfig},Ie),[e]);return H(t)},Kce=({id:e})=>{const t=Oi(e),n=qce(e),r=le(),{t:o}=Q(),s=l.useCallback(()=>{r(vT({id:e}))},[e,r]);return si(n)?null:a.jsx(_r,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},Qce=l.memo(Kce),Xce=e=>{const{id:t}=e,n=le(),{t:r}=Q(),o=l.useCallback(()=>{n(bT({id:t}))},[t,n]),s=l.useCallback(()=>{n(xT({id:t}))},[t,n]);return a.jsxs(N,{sx:{gap:2},children:[a.jsx(rt,{size:"sm",icon:a.jsx(Xl,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(rt,{size:"sm",icon:a.jsx(JM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Yce=l.memo(Xce),Jce=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0},Ie),[e]);return H(t)},L_=e=>`${Math.round(e*100)}%`,Zce=({id:e})=>{const t=Oi(e),n=Jce(e),r=le(),{t:o}=Q(),s=l.useCallback(i=>{r(yT({id:e,beginStepPct:i[0]})),r(CT({id:e,endStepPct:i[1]}))},[r,e]);return n?a.jsx(kn,{feature:"controlNetBeginEnd",children:a.jsxs(Vn,{isDisabled:!t,children:[a.jsx(yr,{children:o("controlnet.beginEndStepPercent")}),a.jsx(Pg,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(L3,{"aria-label":["Begin Step %","End Step %!"],value:[n.beginStepPct,n.endStepPct],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!t,children:[a.jsx(z3,{children:a.jsx(F3,{})}),a.jsx(Wn,{label:L_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(Ob,{index:0})}),a.jsx(Wn,{label:L_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(Ob,{index:1})}),a.jsx(Rh,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Rh,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Rh,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},eue=l.memo(Zce),tue=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);if(o&&wT(o))return o.controlMode},Ie),[e]);return H(t)};function nue({id:e}){const t=Oi(e),n=tue(e),r=le(),{t:o}=Q(),s=[{label:o("controlnet.balanced"),value:"balanced"},{label:o("controlnet.prompt"),value:"more_prompt"},{label:o("controlnet.control"),value:"more_control"},{label:o("controlnet.megaControl"),value:"unbalanced"}],i=l.useCallback(c=>{r(ST({id:e,controlMode:c}))},[e,r]);return n?a.jsx(kn,{feature:"controlNetControlMode",children:a.jsx(Dr,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:i})}):null}const rue=e=>e.config,oue=me(rue,e=>To(Do,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),Ie),sue=({id:e})=>{const t=Oi(e),n=SA(e),r=le(),o=H(oue),{t:s}=Q(),i=l.useCallback(c=>{r(kT({id:e,processorType:c}))},[e,r]);return n?a.jsx(sr,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:i,disabled:!t}):null},aue=l.memo(sue),iue=e=>{const t=l.useMemo(()=>me(we,({controlAdapters:r})=>{const o=Fs(r,e);if(o&&Ru(o))return o.resizeMode},Ie),[e]);return H(t)};function lue({id:e}){const t=Oi(e),n=iue(e),r=le(),{t:o}=Q(),s=[{label:o("controlnet.resize"),value:"just_resize"},{label:o("controlnet.crop"),value:"crop_resize"},{label:o("controlnet.fill"),value:"fill_resize"}],i=l.useCallback(c=>{r(jT({id:e,resizeMode:c}))},[e,r]);return n?a.jsx(kn,{feature:"controlNetResizeMode",children:a.jsx(Dr,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:i})}):null}const cue=e=>{const{id:t,number:n}=e,r=wA(t),o=le(),{t:s}=Q(),i=H(lo),c=Oi(t),[d,p]=ote(!1),h=l.useCallback(()=>{o(_T({id:t}))},[t,o]),m=l.useCallback(()=>{o(IT(t))},[t,o]),g=l.useCallback(b=>{o(PT({id:t,isEnabled:b.target.checked}))},[t,o]);return r?a.jsxs(N,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(N,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(_r,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:c,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Le,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(cce,{id:t})}),i==="unifiedCanvas"&&a.jsx(Yce,{id:t}),a.jsx(rt,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:m,icon:a.jsx(Hu,{})}),a.jsx(rt,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(Zo,{})}),a.jsx(rt,{size:"sm",tooltip:s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:p,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(b0,{sx:{boxSize:4,color:"base.700",transform:d?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs(N,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(N,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(N,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:d?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(fce,{id:t}),a.jsx(eue,{id:t})]}),!d&&a.jsx(N,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(P_,{id:t,isSmall:!0})})]}),a.jsxs(N,{sx:{gap:2},children:[a.jsx(nue,{id:t}),a.jsx(lue,{id:t})]}),a.jsx(aue,{id:t})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(P_,{id:t}),a.jsx(Qce,{id:t}),a.jsx(Gce,{id:t})]})]}):null},uue=l.memo(cue),z1=e=>{const t=H(c=>{var d;return(d=c.generation.model)==null?void 0:d.base_model}),n=le(),r=CA(e),o=l.useMemo(()=>{const c=r.filter(d=>t?d.base_model===t:!0)[0];return c||r[0]},[t,r]),s=l.useMemo(()=>!o,[o]);return[l.useCallback(()=>{s||n(ET({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},due=me([we],({controlAdapters:e})=>{const t=[];let n=!1;const r=MT(e).filter(h=>h.isEnabled).length,o=OT(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=AT(e).filter(h=>h.isEnabled).length,i=RT(e).length;s>0&&t.push(`${s} ControlNet`),s>i&&(n=!0);const c=DT(e).filter(h=>h.isEnabled).length,d=TT(e).length;return c>0&&t.push(`${c} T2I`),c>d&&(n=!0),{controlAdapterIds:NT(e).map(String),activeLabel:t.join(", "),isError:n}},Ie),fue=()=>{const{t:e}=Q(),{controlAdapterIds:t,activeLabel:n}=H(due),r=Pn("controlNet").isFeatureDisabled,[o,s]=z1("controlnet"),[i,c]=z1("ip_adapter"),[d,p]=z1("t2i_adapter");return r?null:a.jsx(No,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsxs(Hn,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Dt,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(Zi,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Dt,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(Zi,{}),onClick:i,"data-testid":"add ip adapter",flexGrow:1,isDisabled:c,children:e("common.ipAdapter")}),a.jsx(Dt,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(Zi,{}),onClick:d,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:p,children:e("common.t2iAdapter")})]}),t.map((h,m)=>a.jsxs(l.Fragment,{children:[a.jsx(io,{}),a.jsx(uue,{id:h,number:m+1})]},h))]})})},Ju=l.memo(fue),pue=e=>{const{onClick:t}=e,{t:n}=Q();return a.jsx(rt,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(UM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},D0=l.memo(pue),hue="28rem",mue=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=$T(),i=l.useRef(null),{t:c}=Q(),d=H(g=>g.generation.model),p=l.useMemo(()=>{if(!s)return[];const g=[];return to(s.entities,(b,y)=>{if(!b)return;const x=(d==null?void 0:d.base_model)!==b.base_model;g.push({value:b.model_name,label:b.model_name,group:xr[b.base_model],disabled:x,tooltip:x?`${c("embedding.incompatibleModel")} ${b.base_model}`:void 0})}),g.sort((b,y)=>{var x;return b.label&&y.label?(x=b.label)!=null&&x.localeCompare(y.label)?-1:1:-1}),g.sort((b,y)=>b.disabled&&!y.disabled?1:-1)},[s,d==null?void 0:d.base_model,c]),h=l.useCallback(g=>{g&&t(g)},[t]),m=l.useCallback((g,b)=>{var y;return((y=b.label)==null?void 0:y.toLowerCase().includes(g.toLowerCase().trim()))||b.value.toLowerCase().includes(g.toLowerCase().trim())},[]);return a.jsxs(Uf,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Bg,{children:o}),a.jsx(Gf,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Hg,{sx:{p:0,w:`calc(${hue} - 2rem )`},children:p.length===0?a.jsx(N,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(je,{children:"No Embeddings Loaded"})}):a.jsx(sr,{inputRef:i,autoFocus:!0,placeholder:c("embedding.addEmbedding"),value:null,data:p,nothingFound:c("embedding.noMatchingEmbedding"),itemComponent:pl,disabled:p.length===0,onDropdownClose:r,filter:m,onChange:h})})})]})},T0=l.memo(mue),gue=()=>{const e=H(m=>m.generation.negativePrompt),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=hs(),s=le(),{t:i}=Q(),c=l.useCallback(m=>{s(Ld(m.target.value))},[s]),d=l.useCallback(m=>{m.key==="<"&&o()},[o]),p=l.useCallback(m=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let b=e.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=e.slice(g),ls.flushSync(()=>{s(Ld(b))}),t.current.selectionEnd=y,r()},[s,r,e]),h=Pn("embedding").isFeatureEnabled;return a.jsxs(Vn,{children:[a.jsx(T0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(kn,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(yi,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:c,resize:"vertical",fontSize:"sm",minH:16,...h&&{onKeyDown:d}})})}),!n&&h&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:o})})]})},kA=l.memo(gue),vue=me([we],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Nn}}),bue=()=>{const e=le(),{prompt:t}=H(vue),n=l.useRef(null),{isOpen:r,onClose:o,onOpen:s}=hs(),{t:i}=Q(),c=l.useCallback(m=>{e($d(m.target.value))},[e]);_t("alt+a",()=>{var m;(m=n.current)==null||m.focus()},[]);const d=l.useCallback(m=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let b=t.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=t.slice(g),ls.flushSync(()=>{e($d(b))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=Pn("embedding").isFeatureEnabled,h=l.useCallback(m=>{p&&m.key==="<"&&s()},[s,p]);return a.jsxs(Le,{position:"relative",children:[a.jsx(Vn,{children:a.jsx(T0,{isOpen:r,onClose:o,onSelect:d,children:a.jsx(kn,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(yi,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:c,onKeyDown:h,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:s})})]})},jA=l.memo(bue);function xue(){const e=H(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=le(),{t:n}=Q(),r=l.useCallback(()=>{t(LT(!e))},[t,e]);return a.jsx(rt,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(XM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const z_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function _A(){return a.jsxs(N,{children:[a.jsx(Le,{as:Ar.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...z_,_dark:{borderColor:"accent.500"}}}),a.jsx(Le,{as:Ar.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(XM,{size:12})}),a.jsx(Le,{as:Ar.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...z_,_dark:{borderColor:"accent.500"}}})]})}const yue=me([we],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Cue=()=>{const e=le(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=hs(),{t:s}=Q(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(yue),d=l.useCallback(g=>{e(Fd(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),ls.flushSync(()=>{e(Fd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=Pn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Le,{position:"relative",children:[a.jsx(So,{children:c&&a.jsx(Le,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(_A,{})})}),a.jsx(Vn,{children:a.jsx(T0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(yi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&h&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:o})})]})},wue=l.memo(Cue),Sue=me([we],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),kue=()=>{const e=le(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=hs(),{t:s}=Q(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(Sue),d=l.useCallback(g=>{e(zd(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),ls.flushSync(()=>{e(zd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=Pn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Le,{position:"relative",children:[a.jsx(So,{children:c&&a.jsx(Le,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(_A,{})})}),a.jsx(Vn,{children:a.jsx(T0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(yi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",minH:16})})}),!n&&h&&a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(D0,{onClick:o})})]})},jue=l.memo(kue);function J2(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(jA,{}),a.jsx(xue,{}),a.jsx(jue,{}),a.jsx(kA,{}),a.jsx(wue,{})]})}const vl=()=>{const{isRefinerAvailable:e}=aa(Yx,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},_ue=me([we],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},Ie),Iue=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=H(_ue),r=vl(),o=le(),{t:s}=Q(),i=l.useCallback(d=>o(tb(d)),[o]),c=l.useCallback(()=>o(tb(7)),[o]);return t?a.jsx(It,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:c,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(_a,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Pue=l.memo(Iue),Eue=e=>{const t=ki("models"),[n,r,o]=e.split("/"),s=zT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},Mue=me(we,e=>({model:e.sdxl.refinerModel}),Ie),Oue=()=>{const e=le(),t=Pn("syncModels").isFeatureEnabled,{model:n}=H(Mue),{t:r}=Q(),{data:o,isLoading:s}=aa(Yx),i=l.useMemo(()=>{if(!o)return[];const p=[];return to(o.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:xr[h.base_model]})}),p},[o]),c=l.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),d=l.useCallback(p=>{if(!p)return;const h=Eue(p);h&&e(WI(h))},[e]);return s?a.jsx(sr,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sr,{tooltip:c==null?void 0:c.description,label:r("sdxl.refinermodel"),value:c==null?void 0:c.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:d,w:"100%"}),t&&a.jsx(Le,{mt:7,children:a.jsx(Ku,{iconMode:!0})})]})},Aue=l.memo(Oue),Rue=me([we],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},Ie),Due=()=>{const{refinerNegativeAestheticScore:e,shift:t}=H(Rue),n=vl(),r=le(),{t:o}=Q(),s=l.useCallback(c=>r(rb(c)),[r]),i=l.useCallback(()=>r(rb(2.5)),[r]);return a.jsx(It,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Tue=l.memo(Due),Nue=me([we],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},Ie),$ue=()=>{const{refinerPositiveAestheticScore:e,shift:t}=H(Nue),n=vl(),r=le(),{t:o}=Q(),s=l.useCallback(c=>r(nb(c)),[r]),i=l.useCallback(()=>r(nb(6)),[r]);return a.jsx(It,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Lue=l.memo($ue),zue=me(we,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=To(hg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},Ie),Fue=()=>{const e=le(),{t}=Q(),{refinerScheduler:n,data:r}=H(zue),o=vl(),s=l.useCallback(i=>{i&&e(VI(i))},[e]);return a.jsx(sr,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Bue=l.memo(Fue),Hue=me([we],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},Ie),Wue=()=>{const{refinerStart:e}=H(Hue),t=le(),n=vl(),r=l.useCallback(i=>t(ob(i)),[t]),{t:o}=Q(),s=l.useCallback(()=>t(ob(.8)),[t]);return a.jsx(It,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Vue=l.memo(Wue),Uue=me([we],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},Ie),Gue=()=>{const{refinerSteps:e,shouldUseSliders:t}=H(Uue),n=vl(),r=le(),{t:o}=Q(),s=l.useCallback(c=>{r(eb(c))},[r]),i=l.useCallback(()=>{r(eb(20))},[r]);return t?a.jsx(It,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(_a,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},que=l.memo(Gue);function Kue(){const e=H(s=>s.sdxl.shouldUseSDXLRefiner),t=vl(),n=le(),{t:r}=Q(),o=l.useCallback(s=>{n(FT(s.target.checked))},[n]);return a.jsx(_r,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Que=me(we,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},Ie),Xue=()=>{const{activeLabel:e,shouldUseSliders:t}=H(Que),{t:n}=Q();return vl()?a.jsx(No,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Kue,{}),a.jsx(Aue,{}),a.jsxs(N,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(que,{}),a.jsx(Pue,{})]}),a.jsx(Bue,{}),a.jsx(Lue,{}),a.jsx(Tue,{}),a.jsx(Vue,{})]})}):a.jsx(No,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(je,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},Z2=l.memo(Xue),Yue=me([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:p}=n,{shift:h}=r;return{cfgScale:d,initial:o,min:s,sliderMax:i,inputMax:c,shouldUseSliders:p,shift:h}},Ie),Jue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=H(Yue),c=le(),{t:d}=Q(),p=l.useCallback(m=>c(Wh(m)),[c]),h=l.useCallback(()=>c(Wh(t)),[c,t]);return s?a.jsx(kn,{feature:"paramCFGScale",children:a.jsx(It,{label:d("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:h,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(kn,{feature:"paramCFGScale",children:a.jsx(_a,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Na=l.memo(Jue),Zue=me(we,e=>({model:e.generation.model}),Ie),ede=()=>{const e=le(),{t}=Q(),{model:n}=H(Zue),r=Pn("syncModels").isFeatureEnabled,{data:o,isLoading:s}=aa(iS),{data:i,isLoading:c}=Jd(iS),d=H(lo),p=l.useMemo(()=>{if(!o)return[];const g=[];return to(o.entities,(b,y)=>{b&&g.push({value:y,label:b.model_name,group:xr[b.base_model]})}),to(i==null?void 0:i.entities,(b,y)=>{!b||d==="unifiedCanvas"||d==="img2img"||g.push({value:y,label:b.model_name,group:xr[b.base_model]})}),g},[o,i,d]),h=l.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),m=l.useCallback(g=>{if(!g)return;const b=R0(g);b&&e(X1(b))},[e]);return s||c?a.jsx(sr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(kn,{feature:"paramModel",children:a.jsx(sr,{tooltip:h==null?void 0:h.description,label:t("modelManager.model"),value:h==null?void 0:h.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:m,w:"100%"})}),r&&a.jsx(Le,{mt:6,children:a.jsx(Ku,{iconMode:!0})})]})},tde=l.memo(ede),nde=me(we,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},Ie),rde=()=>{const e=le(),{t}=Q(),{model:n,vae:r}=H(nde),{data:o}=iP(),s=l.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return to(o.entities,(p,h)=>{if(!p)return;const m=(n==null?void 0:n.base_model)!==p.base_model;d.push({value:h,label:p.model_name,group:xr[p.base_model],disabled:m,tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=l.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),c=l.useCallback(d=>{if(!d||d==="default"){e(Vc(null));return}const p=vA(d);p&&e(Vc(p))},[e]);return a.jsx(kn,{feature:"paramVAE",children:a.jsx(sr,{itemComponent:pl,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:c,disabled:s.length===0,clearable:!0})})},ode=l.memo(rde),sde=me([uP,da],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=To(hg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},Ie),ade=()=>{const e=le(),{t}=Q(),{scheduler:n,data:r}=H(sde),o=l.useCallback(s=>{s&&e(Y1(s))},[e]);return a.jsx(kn,{feature:"paramScheduler",children:a.jsx(sr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},ide=l.memo(ade),lde=me(we,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},Ie),cde=["fp16","fp32"],ude=()=>{const{t:e}=Q(),t=le(),{vaePrecision:n}=H(lde),r=l.useCallback(o=>{o&&t(BT(o))},[t]);return a.jsx(kn,{feature:"paramVAEPrecision",children:a.jsx(Dr,{label:e("modelManager.vaePrecision"),value:n,data:cde,onChange:r})})},dde=l.memo(ude),fde=()=>{const e=Pn("vae").isFeatureEnabled;return a.jsxs(N,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Le,{w:"full",children:a.jsx(tde,{})}),a.jsx(Le,{w:"full",children:a.jsx(ide,{})}),e&&a.jsxs(N,{w:"full",gap:3,children:[a.jsx(ode,{}),a.jsx(dde,{})]})]})},$a=l.memo(fde),IA=[{name:fn.t("parameters.aspectRatioFree"),value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],PA=IA.map(e=>e.value);function EA(){const e=H(s=>s.generation.aspectRatio),t=le(),n=H(s=>s.generation.shouldFitToWidthHeight),r=H(lo),o=l.useCallback(s=>{t(Ys(s.value)),t(Zd(!1))},[t]);return a.jsx(Hn,{isAttached:!0,children:IA.map(s=>a.jsx(Dt,{size:"sm",isChecked:e===s.value,isDisabled:r==="img2img"?!n:!1,onClick:o.bind(null,s),children:s.name},s.name))})}const pde=me([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.height,{model:d,height:p}=e,{aspectRatio:h}=e,m=t.shift?i:c;return{model:d,height:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},Ie),hde=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(pde),d=le(),{t:p}=Q(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Vl(b)),c){const y=Ro(b*c,8);d(Wl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Vl(h)),c){const b=Ro(h*c,8);d(Wl(b))}},[d,h,c]);return a.jsx(It,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},mde=l.memo(hde),gde=me([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.width,{model:d,width:p,aspectRatio:h}=e,m=t.shift?i:c;return{model:d,width:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},Ie),vde=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(gde),d=le(),{t:p}=Q(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Wl(b)),c){const y=Ro(b/c,8);d(Vl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Wl(h)),c){const b=Ro(h/c,8);d(Vl(b))}},[d,h,c]);return a.jsx(It,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},bde=l.memo(vde),xde=me([da,lo],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},Ie);function Eu(){const{t:e}=Q(),t=le(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=H(xde),c=l.useCallback(()=>{o?(t(Zd(!1)),PA.includes(s/i)?t(Ys(s/i)):t(Ys(null))):(t(Zd(!0)),t(Ys(s/i)))},[o,s,i,t]),d=l.useCallback(()=>{t(HT()),t(Ys(null)),o&&t(Ys(i/s))},[t,o,s,i]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(kn,{feature:"paramRatio",children:a.jsxs(Vn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(yr,{children:e("parameters.aspectRatio")}),a.jsx(Pi,{}),a.jsx(EA,{}),a.jsx(rt,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(P8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:d}),a.jsx(rt,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(YM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:c})]})}),a.jsx(N,{gap:2,alignItems:"center",children:a.jsxs(N,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(bde,{isDisabled:n==="img2img"?!r:!1}),a.jsx(mde,{isDisabled:n==="img2img"?!r:!1})]})})]})}const yde=me([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c,fineStep:d,coarseStep:p}=t.sd.steps,{steps:h}=e,{shouldUseSliders:m}=n,g=r.shift?d:p;return{steps:h,initial:o,min:s,sliderMax:i,inputMax:c,step:g,shouldUseSliders:m}},Ie),Cde=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=H(yde),c=le(),{t:d}=Q(),p=l.useCallback(g=>{c(Vh(g))},[c]),h=l.useCallback(()=>{c(Vh(t))},[c,t]),m=l.useCallback(()=>{c(Qx())},[c]);return i?a.jsx(kn,{feature:"paramSteps",children:a.jsx(It,{label:d("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:h,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(kn,{feature:"paramSteps",children:a.jsx(_a,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:m})})},La=l.memo(Cde);function MA(){const e=le(),t=H(o=>o.generation.shouldFitToWidthHeight),n=l.useCallback(o=>{e(WT(o.target.checked))},[e]),{t:r}=Q();return a.jsx(_r,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function wde(){const e=H(i=>i.generation.seed),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.shouldGenerateVariations),{t:r}=Q(),o=le(),s=l.useCallback(i=>o(Hh(i)),[o]);return a.jsx(_a,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:dP,max:fP,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const Sde=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function kde(){const e=le(),t=H(o=>o.generation.shouldRandomizeSeed),{t:n}=Q(),r=l.useCallback(()=>e(Hh(Sde(dP,fP))),[e]);return a.jsx(rt,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(Gee,{})})}const jde=()=>{const e=le(),{t}=Q(),n=H(o=>o.generation.shouldRandomizeSeed),r=l.useCallback(o=>e(VT(o.target.checked)),[e]);return a.jsx(_r,{label:t("common.random"),isChecked:n,onChange:r})},_de=l.memo(jde),Ide=()=>a.jsx(kn,{feature:"paramSeed",children:a.jsxs(N,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(wde,{}),a.jsx(kde,{}),a.jsx(_de,{})]})}),za=l.memo(Ide),OA=De((e,t)=>a.jsxs(N,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(je,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));OA.displayName="SubSettingsWrapper";const Mu=l.memo(OA),Pde=me([we],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},Ie),Ede=()=>{const{sdxlImg2ImgDenoisingStrength:e}=H(Pde),t=le(),{t:n}=Q(),r=l.useCallback(s=>t(lS(s)),[t]),o=l.useCallback(()=>{t(lS(.7))},[t]);return a.jsx(kn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(It,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},AA=l.memo(Ede),Mde=me([uP,da],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ie),Ode=()=>{const{t:e}=Q(),{shouldUseSliders:t,activeLabel:n}=H(Mde);return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}),a.jsx(AA,{}),a.jsx(MA,{})]})})},Ade=l.memo(Ode),Rde=()=>a.jsxs(a.Fragment,{children:[a.jsx(J2,{}),a.jsx(Ade,{}),a.jsx(Z2,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(Yu,{})]}),Dde=l.memo(Rde),eC=()=>{const{t:e}=Q(),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.iterations),r=l.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=l.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:l.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},Tde=()=>{const{t:e}=Q(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=eC();return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx(N,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]})})})},RA=l.memo(Tde),Nde=()=>a.jsxs(a.Fragment,{children:[a.jsx(J2,{}),a.jsx(RA,{}),a.jsx(Z2,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(Yu,{})]}),$de=l.memo(Nde),Lde=()=>{const e=le(),t=H(s=>s.generation.canvasCoherenceMode),{t:n}=Q(),r=l.useMemo(()=>[{label:n("parameters.unmasked"),value:"unmasked"},{label:n("unifiedCanvas.mask"),value:"mask"},{label:n("parameters.maskEdge"),value:"edge"}],[n]),o=l.useCallback(s=>{s&&e(UT(s))},[e]);return a.jsx(kn,{feature:"compositingCoherenceMode",children:a.jsx(Dr,{label:n("parameters.coherenceMode"),data:r,value:t,onChange:o})})},zde=l.memo(Lde),Fde=()=>{const e=le(),t=H(s=>s.generation.canvasCoherenceSteps),{t:n}=Q(),r=l.useCallback(s=>{e(cS(s))},[e]),o=l.useCallback(()=>{e(cS(20))},[e]);return a.jsx(kn,{feature:"compositingCoherenceSteps",children:a.jsx(It,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Bde=l.memo(Fde),Hde=()=>{const e=le(),t=H(s=>s.generation.canvasCoherenceStrength),{t:n}=Q(),r=l.useCallback(s=>{e(uS(s))},[e]),o=l.useCallback(()=>{e(uS(.3))},[e]);return a.jsx(kn,{feature:"compositingStrength",children:a.jsx(It,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Wde=l.memo(Hde);function Vde(){const e=le(),t=H(s=>s.generation.maskBlur),{t:n}=Q(),r=l.useCallback(s=>{e(dS(s))},[e]),o=l.useCallback(()=>{e(dS(16))},[e]);return a.jsx(kn,{feature:"compositingBlur",children:a.jsx(It,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})}const Ude=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function Gde(){const e=H(o=>o.generation.maskBlurMethod),t=le(),{t:n}=Q(),r=l.useCallback(o=>{o&&t(GT(o))},[t]);return a.jsx(kn,{feature:"compositingBlurMethod",children:a.jsx(Dr,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Ude})})}const qde=()=>{const{t:e}=Q();return a.jsx(No,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Mu,{label:e("parameters.coherencePassHeader"),children:[a.jsx(zde,{}),a.jsx(Bde,{}),a.jsx(Wde,{})]}),a.jsx(io,{}),a.jsxs(Mu,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(Vde,{}),a.jsx(Gde,{})]})]})})},DA=l.memo(qde),Kde=me([we],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},Ie),Qde=()=>{const e=le(),{infillMethod:t}=H(Kde),{data:n,isLoading:r}=DI(),o=n==null?void 0:n.infill_methods,{t:s}=Q(),i=l.useCallback(c=>{e(qT(c))},[e]);return a.jsx(kn,{feature:"infillMethod",children:a.jsx(Dr,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},Xde=l.memo(Qde),Yde=me([da],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},Ie),Jde=()=>{const e=le(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=H(Yde),{t:r}=Q(),o=l.useCallback(i=>{e(fS(i))},[e]),s=l.useCallback(()=>{e(fS(2))},[e]);return a.jsx(It,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Zde=l.memo(Jde),efe=me([da],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},Ie),tfe=()=>{const e=le(),{infillTileSize:t,infillMethod:n}=H(efe),{t:r}=Q(),o=l.useCallback(i=>{e(pS(i))},[e]),s=l.useCallback(()=>{e(pS(32))},[e]);return a.jsx(It,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},nfe=l.memo(tfe),rfe=me([da],e=>{const{infillMethod:t}=e;return{infillMethod:t}},Ie);function ofe(){const{infillMethod:e}=H(rfe);return a.jsxs(N,{children:[e==="tile"&&a.jsx(nfe,{}),e==="patchmatch"&&a.jsx(Zde,{})]})}const Ir=e=>e.canvas,Vs=me([we],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),sfe=me([Ir],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},Ie),afe=()=>{const e=le(),{boundingBoxScale:t}=H(sfe),{t:n}=Q(),r=l.useCallback(o=>{e(KT(o))},[e]);return a.jsx(kn,{feature:"scaleBeforeProcessing",children:a.jsx(sr,{label:n("parameters.scaleBeforeProcessing"),data:QT,value:t,onChange:r})})},ife=l.memo(afe),lfe=me([da,Ir],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},Ie),cfe=()=>{const e=le(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(lfe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Q(),c=l.useCallback(p=>{let h=r.width;const m=Math.floor(p);o&&(h=Ro(m*o,64)),e(Qh({width:h,height:m}))},[o,e,r.width]),d=l.useCallback(()=>{let p=r.width;const h=Math.floor(s);o&&(p=Ro(h*o,64)),e(Qh({width:p,height:h}))},[o,e,s,r.width]);return a.jsx(It,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},ufe=l.memo(cfe),dfe=me([Ir,da],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},Ie),ffe=()=>{const e=le(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(dfe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Q(),c=l.useCallback(p=>{const h=Math.floor(p);let m=r.height;o&&(m=Ro(h/o,64)),e(Qh({width:h,height:m}))},[o,e,r.height]),d=l.useCallback(()=>{const p=Math.floor(s);let h=r.height;o&&(h=Ro(p/o,64)),e(Qh({width:p,height:h}))},[o,e,s,r.height]);return a.jsx(It,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},pfe=l.memo(ffe),hfe=()=>{const{t:e}=Q();return a.jsx(No,{label:e("parameters.infillScalingHeader"),children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Mu,{children:[a.jsx(Xde,{}),a.jsx(ofe,{})]}),a.jsx(io,{}),a.jsxs(Mu,{children:[a.jsx(ife,{}),a.jsx(pfe,{}),a.jsx(ufe,{})]})]})})},TA=l.memo(hfe),mfe=me([we,Vs],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Ie),gfe=()=>{const e=le(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(mfe),{t:s}=Q(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,c=l.useCallback(p=>{if(e(na({...n,height:Math.floor(p)})),o){const h=Ro(p*o,64);e(na({width:h,height:Math.floor(p)}))}},[o,n,e]),d=l.useCallback(()=>{if(e(na({...n,height:Math.floor(i)})),o){const p=Ro(i*o,64);e(na({width:p,height:Math.floor(i)}))}},[o,n,e,i]);return a.jsx(It,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},vfe=l.memo(gfe),bfe=me([we,Vs],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Ie),xfe=()=>{const e=le(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(bfe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Q(),c=l.useCallback(p=>{if(e(na({...n,width:Math.floor(p)})),o){const h=Ro(p/o,64);e(na({width:Math.floor(p),height:h}))}},[o,n,e]),d=l.useCallback(()=>{if(e(na({...n,width:Math.floor(s)})),o){const p=Ro(s/o,64);e(na({width:Math.floor(s),height:p}))}},[o,n,e,s]);return a.jsx(It,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},yfe=l.memo(xfe),Cfe=me([da,Ir],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function ug(){const e=le(),{t}=Q(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=H(Cfe),o=l.useCallback(()=>{n?(e(Zd(!1)),PA.includes(r.width/r.height)?e(Ys(r.width/r.height)):e(Ys(null))):(e(Zd(!0)),e(Ys(r.width/r.height)))},[n,r,e]),s=l.useCallback(()=>{e(XT()),e(Ys(null)),n&&e(Ys(r.height/r.width))},[e,n,r]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(kn,{feature:"paramRatio",children:a.jsxs(Vn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(yr,{children:t("parameters.aspectRatio")}),a.jsx(Pi,{}),a.jsx(EA,{}),a.jsx(rt,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(P8,{}),fontSize:20,onClick:s}),a.jsx(rt,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(YM,{}),isChecked:n,onClick:o})]})}),a.jsx(yfe,{}),a.jsx(vfe,{})]})}const wfe=me(we,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Ie),Sfe=()=>{const{t:e}=Q(),{shouldUseSliders:t,activeLabel:n}=H(wfe);return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}),a.jsx(AA,{})]})})},kfe=l.memo(Sfe);function jfe(){return a.jsxs(a.Fragment,{children:[a.jsx(J2,{}),a.jsx(kfe,{}),a.jsx(Z2,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(TA,{}),a.jsx(DA,{}),a.jsx(Yu,{})]})}function tC(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(jA,{}),a.jsx(kA,{})]})}function _fe(){const e=H(i=>i.generation.horizontalSymmetrySteps),t=H(i=>i.generation.steps),n=le(),{t:r}=Q(),o=l.useCallback(i=>{n(hS(i))},[n]),s=l.useCallback(()=>{n(hS(0))},[n]);return a.jsx(It,{label:r("parameters.hSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function Ife(){const e=H(i=>i.generation.verticalSymmetrySteps),t=H(i=>i.generation.steps),n=le(),{t:r}=Q(),o=l.useCallback(i=>{n(mS(i))},[n]),s=l.useCallback(()=>{n(mS(0))},[n]);return a.jsx(It,{label:r("parameters.vSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function Pfe(){const e=H(r=>r.generation.shouldUseSymmetry),t=le(),n=l.useCallback(r=>{t(YT(r.target.checked))},[t]);return a.jsx(_r,{label:"Enable Symmetry",isChecked:e,onChange:n})}const Efe=me(we,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),Ie),Mfe=()=>{const{t:e}=Q(),{activeLabel:t}=H(Efe);return Pn("symmetry").isFeatureEnabled?a.jsx(No,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(Pfe,{}),a.jsx(_fe,{}),a.jsx(Ife,{})]})}):null},nC=l.memo(Mfe),Ofe=me([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.img2imgStrength,{img2imgStrength:p}=e,h=t.shift?c:d;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h}},Ie),Afe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=H(Ofe),i=le(),{t:c}=Q(),d=l.useCallback(h=>i(Uh(h)),[i]),p=l.useCallback(()=>{i(Uh(t))},[i,t]);return a.jsx(kn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(It,{label:`${c("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:d,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},NA=l.memo(Afe),Rfe=()=>{const{t:e}=Q(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=eC();return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(Eu,{})]}),a.jsx(NA,{}),a.jsx(MA,{})]})})},Dfe=l.memo(Rfe),Tfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(tC,{}),a.jsx(Dfe,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(nC,{}),a.jsx(Yu,{})]}),Nfe=l.memo(Tfe),$fe=me([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.hrfStrength,{hrfStrength:p,hrfEnabled:h}=e,m=t.shift?c:d;return{hrfStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m,hrfEnabled:h}},Ie),Lfe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=H($fe),i=le(),{t:c}=Q(),d=l.useCallback(()=>{i(Gh(t))},[i,t]),p=l.useCallback(h=>{i(Gh(h))},[i]);return a.jsx(Wn,{label:c("hrf.strengthTooltip"),placement:"right",hasArrow:!0,children:a.jsx(It,{label:c("parameters.denoisingStrength"),min:n,max:r,step:o,value:e,onChange:p,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d,isDisabled:!s})})},zfe=l.memo(Lfe);function Ffe(){const e=le(),{t}=Q(),n=H(o=>o.generation.hrfEnabled),r=l.useCallback(o=>e(J1(o.target.checked)),[e]);return a.jsx(_r,{label:t("hrf.enableHrf"),isChecked:n,onChange:r,tooltip:t("hrf.enableHrfTooltip")})}const Bfe=me(we,({generation:e})=>{const{hrfMethod:t,hrfEnabled:n}=e;return{hrfMethod:t,hrfEnabled:n}},Ie),Hfe=["ESRGAN","bilinear"],Wfe=()=>{const e=le(),{t}=Q(),{hrfMethod:n,hrfEnabled:r}=H(Bfe),o=l.useCallback(s=>{s&&e(Z1(s))},[e]);return a.jsx(Dr,{label:t("hrf.upscaleMethod"),value:n,data:Hfe,onChange:o,disabled:!r})},Vfe=l.memo(Wfe),Ufe=me(we,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}},Ie);function Gfe(){const{t:e}=Q(),t=Pn("hrf").isFeatureEnabled,{hrfEnabled:n}=H(Ufe),r=l.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(No,{label:e("hrf.hrf"),activeLabel:r,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(Ffe,{}),a.jsx(zfe,{}),a.jsx(Vfe,{})]})}):null}const qfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(tC,{}),a.jsx(RA,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(nC,{}),a.jsx(Gfe,{}),a.jsx(Yu,{})]}),Kfe=l.memo(qfe),Qfe=()=>{const{t:e}=Q(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=eC();return a.jsx(No,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ua,{}),a.jsx(La,{}),a.jsx(Na,{})]}),a.jsx($a,{}),a.jsx(Le,{pt:2,children:a.jsx(za,{})}),a.jsx(ug,{})]}),a.jsx(NA,{})]})})},Xfe=l.memo(Qfe),Yfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(tC,{}),a.jsx(Xfe,{}),a.jsx(Ju,{}),a.jsx(Xu,{}),a.jsx(Qu,{}),a.jsx(nC,{}),a.jsx(TA,{}),a.jsx(DA,{}),a.jsx(Yu,{})]}),Jfe=l.memo(Yfe),Zfe=()=>{const e=H(lo),t=H(n=>n.generation.model);return e==="txt2img"?a.jsx(Fh,{children:t&&t.base_model==="sdxl"?a.jsx($de,{}):a.jsx(Kfe,{})}):e==="img2img"?a.jsx(Fh,{children:t&&t.base_model==="sdxl"?a.jsx(Dde,{}):a.jsx(Nfe,{})}):e==="unifiedCanvas"?a.jsx(Fh,{children:t&&t.base_model==="sdxl"?a.jsx(jfe,{}):a.jsx(Jfe,{})}):null},epe=l.memo(Zfe),Fh=l.memo(e=>a.jsxs(N,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(z8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(N,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Le,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(v0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(N,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Fh.displayName="ParametersPanelWrapper";const tpe=me([we],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},Ie),npe=()=>{const{initialImage:e}=H(tpe),{currentData:t}=Rs((e==null?void 0:e.imageName)??zs.skipToken),n=l.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=l.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(ll,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(eo,{label:"No initial image selected"}),dataTestId:"initial-image"})},rpe=l.memo(npe),ope=me([we],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},Ie),spe={type:"SET_INITIAL_IMAGE"},ape=()=>{const{isResetButtonDisabled:e}=H(ope),t=le(),{getUploadButtonProps:n,getUploadInputProps:r}=D2({postUploadAction:spe}),o=l.useCallback(()=>{t(JT())},[t]);return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(N,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(je,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(Pi,{}),a.jsx(rt,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(i0,{}),...n()}),a.jsx(rt,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(a0,{}),onClick:o,isDisabled:e})]}),a.jsx(rpe,{}),a.jsx("input",{...r()})]})},ipe=l.memo(ape),lpe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=Q(),o=H(s=>s.system.isConnected);return a.jsx(rt,{onClick:t,icon:a.jsx(Zo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},$A=()=>{const[e,{isLoading:t}]=bg({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=rP({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=tP({fixedCacheKey:"pauseProcessor"}),[i,{isLoading:c}]=Gx({fixedCacheKey:"cancelQueueItem"}),[d,{isLoading:p}]=eP({fixedCacheKey:"clearQueue"}),[h,{isLoading:m}]=pP({fixedCacheKey:"pruneQueue"});return t||r||s||c||p||m},cpe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function upe(){const{t:e}=Q(),t=H(o=>o.postprocessing.esrganModelName),n=le(),r=l.useCallback(o=>n(ZT(o)),[n]);return a.jsx(Dr,{label:e("models.esrganModel"),value:t,itemComponent:pl,onChange:r,data:cpe})}const dpe=e=>{const{imageDTO:t}=e,n=le(),r=$A(),{t:o}=Q(),{isOpen:s,onOpen:i,onClose:c}=hs(),{isAllowedToUpscale:d,detail:p}=eN(t),h=l.useCallback(()=>{c(),!(!t||!d)&&n(hP({imageDTO:t}))},[n,t,d,c]);return a.jsx(tp,{isOpen:s,onClose:c,triggerComponent:a.jsx(rt,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(qM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(N,{sx:{flexDirection:"column",gap:4},children:[a.jsx(upe,{}),a.jsx(Dt,{tooltip:p,size:"sm",isDisabled:!t||r||!d,onClick:h,children:o("parameters.upscaleImage")})]})})},fpe=l.memo(dpe),ppe=me([we,lo],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:c}=t,{shouldShowImageDetails:d,shouldHidePreview:p,shouldShowProgressInViewer:h}=n,{shouldFetchMetadataFromApi:m}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(c!=null&&c.progress_image)||!g,shouldShowImageDetails:d,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:h,lastSelectedImage:g,shouldFetchMetadataFromApi:m}},{memoizeOptions:{resultEqualityCheck:Nn}}),hpe=()=>{const e=le(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=H(ppe),i=Pn("upscaling").isFeatureEnabled,c=$A(),d=Zl(),{t:p}=Q(),{recallBothPrompts:h,recallSeed:m,recallAllParameters:g}=j0(),{currentData:b}=Rs((o==null?void 0:o.image_name)??zs.skipToken),{metadata:y,isLoading:x}=z2(o==null?void 0:o.image_name),{workflow:w,isLoading:S}=F2(o==null?void 0:o.workflow_id),j=l.useCallback(()=>{w&&e(Vx(w))},[e,w]),I=l.useCallback(()=>{g(y)},[y,g]);_t("a",I,[y]);const _=l.useCallback(()=>{m(y==null?void 0:y.seed)},[y==null?void 0:y.seed,m]);_t("s",_,[b]);const M=l.useCallback(()=>{h(y==null?void 0:y.positive_prompt,y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt)},[y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt,h]);_t("p",M,[b]),_t("w",j,[w]);const E=l.useCallback(()=>{e(E8()),e(gg(b))},[e,b]);_t("shift+i",E,[b]);const A=l.useCallback(()=>{b&&e(hP({imageDTO:b}))},[e,b]),R=l.useCallback(()=>{b&&e(vg([b]))},[e,b]);_t("Shift+U",()=>{A()},{enabled:()=>!!(i&&!n&&t)},[i,b,n,t]);const D=l.useCallback(()=>e(tN(!r)),[e,r]);_t("i",()=>{b?D():d({title:p("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,r,d]),_t("delete",()=>{R()},[e,b]);const O=l.useCallback(()=>{e(TI(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(Hn,{isAttached:!0,isDisabled:n,children:a.jsxs(Mg,{isLazy:!0,children:[a.jsx(Og,{as:rt,"aria-label":p("parameters.imageActions"),tooltip:p("parameters.imageActions"),isDisabled:!b,icon:a.jsx(lse,{})}),a.jsx(ql,{motionProps:fu,children:b&&a.jsx(M8,{imageDTO:b})})]})}),a.jsxs(Hn,{isAttached:!0,isDisabled:n,children:[a.jsx(rt,{isLoading:S,icon:a.jsx(T2,{}),tooltip:`${p("nodes.loadWorkflow")} (W)`,"aria-label":`${p("nodes.loadWorkflow")} (W)`,isDisabled:!w,onClick:j}),a.jsx(rt,{isLoading:x,icon:a.jsx(ZM,{}),tooltip:`${p("parameters.usePrompt")} (P)`,"aria-label":`${p("parameters.usePrompt")} (P)`,isDisabled:!(y!=null&&y.positive_prompt),onClick:M}),a.jsx(rt,{isLoading:x,icon:a.jsx(eO,{}),tooltip:`${p("parameters.useSeed")} (S)`,"aria-label":`${p("parameters.useSeed")} (S)`,isDisabled:(y==null?void 0:y.seed)===null||(y==null?void 0:y.seed)===void 0,onClick:_}),a.jsx(rt,{isLoading:x,icon:a.jsx(WM,{}),tooltip:`${p("parameters.useAll")} (A)`,"aria-label":`${p("parameters.useAll")} (A)`,isDisabled:!y,onClick:I})]}),i&&a.jsx(Hn,{isAttached:!0,isDisabled:c,children:i&&a.jsx(fpe,{imageDTO:b})}),a.jsx(Hn,{isAttached:!0,children:a.jsx(rt,{icon:a.jsx(UM,{}),tooltip:`${p("parameters.info")} (I)`,"aria-label":`${p("parameters.info")} (I)`,isChecked:r,onClick:D})}),a.jsx(Hn,{isAttached:!0,children:a.jsx(rt,{"aria-label":p("settings.displayInProgress"),tooltip:p("settings.displayInProgress"),icon:a.jsx($ee,{}),isChecked:s,onClick:O})}),a.jsx(Hn,{isAttached:!0,children:a.jsx(lpe,{onClick:R})})]})})},mpe=l.memo(hpe),gpe=me([we,Ux],(e,t)=>{var j,I;const{data:n,status:r}=nN.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?gS.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):gS.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||(o==null?void 0:o.total)===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const c={...t,offset:n.ids.length,limit:ZI},d=rN.getSelectors(),p=d.selectAll(n),h=p.findIndex(_=>_.image_name===s.image_name),m=Hl(h+1,0,p.length-1),g=Hl(h-1,0,p.length-1),b=(j=p[m])==null?void 0:j.image_name,y=(I=p[g])==null?void 0:I.image_name,x=b?d.selectById(n,b):void 0,w=y?d.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:h,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:x,prevImage:w,queryArgs:c}},{memoizeOptions:{resultEqualityCheck:Nn}}),LA=()=>{const e=le(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:c}=H(gpe),d=l.useCallback(()=>{n&&e(vS(n))},[e,n]),p=l.useCallback(()=>{t&&e(vS(t))},[e,t]),[h]=JI(),m=l.useCallback(()=>{h(s)},[h,s]);return{handlePrevImage:d,handleNextImage:p,isOnFirstImage:c===0,isOnLastImage:c!==void 0&&c===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:m,isFetching:o}};function vpe(e){return Ye({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 bpe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=Q(),c=l.useCallback(()=>navigator.clipboard.writeText(t.toString()),[t]);return t?a.jsxs(N,{gap:2,children:[n&&a.jsx(Wn,{label:`Recall ${e}`,children:a.jsx(Ia,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(vpe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Wn,{label:`Copy ${e}`,children:a.jsx(Ia,{"aria-label":`Copy ${e}`,icon:a.jsx(Hu,{}),size:"xs",variant:"ghost",fontSize:14,onClick:c})}),a.jsxs(N,{direction:o?"column":"row",children:[a.jsxs(je,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Ig,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(BO,{mx:"2px"})]}):a.jsx(je,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},Vr=l.memo(bpe),xpe=e=>{var F;const{metadata:t}=e,{t:n}=Q(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:c,recallScheduler:d,recallVaeModel:p,recallSteps:h,recallWidth:m,recallHeight:g,recallStrength:b,recallHrfEnabled:y,recallHrfStrength:x,recallHrfMethod:w,recallLoRA:S,recallControlNet:j,recallIPAdapter:I,recallT2IAdapter:_}=j0(),M=l.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),E=l.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),A=l.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),R=l.useCallback(()=>{c(t==null?void 0:t.model)},[t==null?void 0:t.model,c]),D=l.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),O=l.useCallback(()=>{g(t==null?void 0:t.height)},[t==null?void 0:t.height,g]),T=l.useCallback(()=>{d(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,d]),K=l.useCallback(()=>{p(t==null?void 0:t.vae)},[t==null?void 0:t.vae,p]),G=l.useCallback(()=>{h(t==null?void 0:t.steps)},[t==null?void 0:t.steps,h]),X=l.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),Z=l.useCallback(()=>{b(t==null?void 0:t.strength)},[t==null?void 0:t.strength,b]),te=l.useCallback(()=>{y(t==null?void 0:t.hrf_enabled)},[t==null?void 0:t.hrf_enabled,y]),V=l.useCallback(()=>{x(t==null?void 0:t.hrf_strength)},[t==null?void 0:t.hrf_strength,x]),oe=l.useCallback(()=>{w(t==null?void 0:t.hrf_method)},[t==null?void 0:t.hrf_method,w]),ne=l.useCallback(q=>{S(q)},[S]),se=l.useCallback(q=>{j(q)},[j]),re=l.useCallback(q=>{I(q)},[I]),ae=l.useCallback(q=>{_(q)},[_]),B=l.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(q=>qh(q.control_model)):[],[t==null?void 0:t.controlnets]),Y=l.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(q=>qh(q.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),$=l.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(q=>oN(q.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:(console.log(t),a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(Vr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(Vr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(Vr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:M}),t.negative_prompt&&a.jsx(Vr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:E}),t.seed!==void 0&&t.seed!==null&&a.jsx(Vr,{label:n("metadata.seed"),value:t.seed,onClick:A}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(Vr,{label:n("metadata.model"),value:t.model.model_name,onClick:R}),t.width&&a.jsx(Vr,{label:n("metadata.width"),value:t.width,onClick:D}),t.height&&a.jsx(Vr,{label:n("metadata.height"),value:t.height,onClick:O}),t.scheduler&&a.jsx(Vr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:T}),a.jsx(Vr,{label:n("metadata.vae"),value:((F=t.vae)==null?void 0:F.model_name)??"Default",onClick:K}),t.steps&&a.jsx(Vr,{label:n("metadata.steps"),value:t.steps,onClick:G}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(Vr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:X}),t.strength&&a.jsx(Vr,{label:n("metadata.strength"),value:t.strength,onClick:Z}),t.hrf_enabled&&a.jsx(Vr,{label:n("hrf.metadata.enabled"),value:t.hrf_enabled,onClick:te}),t.hrf_enabled&&t.hrf_strength&&a.jsx(Vr,{label:n("hrf.metadata.strength"),value:t.hrf_strength,onClick:V}),t.hrf_enabled&&t.hrf_method&&a.jsx(Vr,{label:n("hrf.metadata.method"),value:t.hrf_method,onClick:oe}),t.loras&&t.loras.map((q,pe)=>{if(zI(q.lora))return a.jsx(Vr,{label:"LoRA",value:`${q.lora.model_name} - ${q.weight}`,onClick:ne.bind(null,q)},pe)}),B.map((q,pe)=>{var W;return a.jsx(Vr,{label:"ControlNet",value:`${(W=q.control_model)==null?void 0:W.model_name} - ${q.control_weight}`,onClick:se.bind(null,q)},pe)}),Y.map((q,pe)=>{var W;return a.jsx(Vr,{label:"IP Adapter",value:`${(W=q.ip_adapter_model)==null?void 0:W.model_name} - ${q.weight}`,onClick:re.bind(null,q)},pe)}),$.map((q,pe)=>{var W;return a.jsx(Vr,{label:"T2I Adapter",value:`${(W=q.t2i_adapter_model)==null?void 0:W.model_name} - ${q.weight}`,onClick:ae.bind(null,q)},pe)})]}))},ype=l.memo(xpe),Cpe=({image:e})=>{const{t}=Q(),{metadata:n}=z2(e.image_name),{workflow:r}=F2(e.workflow_id);return a.jsxs(N,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(N,{gap:2,children:[a.jsx(je,{fontWeight:"semibold",children:"File:"}),a.jsxs(Ig,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(BO,{mx:"2px"})]})]}),a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(wo,{children:t("metadata.recallParameters")}),a.jsx(wo,{children:t("metadata.metadata")}),a.jsx(wo,{children:t("metadata.imageDetails")}),a.jsx(wo,{children:t("metadata.workflow")})]}),a.jsxs($u,{children:[a.jsx(Go,{children:n?a.jsx(cc,{children:a.jsx(ype,{metadata:n})}):a.jsx(eo,{label:t("metadata.noRecallParameters")})}),a.jsx(Go,{children:n?a.jsx(tl,{data:n,label:t("metadata.metadata")}):a.jsx(eo,{label:t("metadata.noMetaData")})}),a.jsx(Go,{children:e?a.jsx(tl,{data:e,label:t("metadata.imageDetails")}):a.jsx(eo,{label:t("metadata.noImageDetails")})}),a.jsx(Go,{children:r?a.jsx(tl,{data:r,label:t("metadata.workflow")}):a.jsx(eo,{label:t("nodes.noWorkflow")})})]})]})]})},wpe=l.memo(Cpe),F1={color:"base.100",pointerEvents:"auto"},Spe=()=>{const{t:e}=Q(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:c}=LA();return a.jsxs(Le,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Le,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(Ia,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(bee,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:F1})}),a.jsxs(Le,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(Ia,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(xee,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:F1}),o&&i&&!c&&a.jsx(Ia,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(vee,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:F1}),o&&i&&c&&a.jsx(N,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(Ci,{opacity:.5,size:"xl"})})]})]})},zA=l.memo(Spe),kpe=me([we,sN],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:c}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:c}},{memoizeOptions:{resultEqualityCheck:Nn}}),jpe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=H(kpe),{handlePrevImage:s,handleNextImage:i,isOnLastImage:c,handleLoadMoreImages:d,areMoreImagesAvailable:p,isFetching:h}=LA();_t("left",()=>{s()},[s]),_t("right",()=>{if(c&&p&&!h){d();return}c||i()},[c,p,d,h,i]);const{currentData:m}=Rs(t??zs.skipToken),g=l.useMemo(()=>{if(m)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:m}}},[m]),b=l.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,x]=l.useState(!1),w=l.useRef(0),{t:S}=Q(),j=l.useCallback(()=>{x(!0),window.clearTimeout(w.current)},[]),I=l.useCallback(()=>{w.current=window.setTimeout(()=>{x(!1)},500)},[]);return a.jsxs(N,{onMouseOver:j,onMouseOut:I,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(_i,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(ll,{imageDTO:m,droppableData:b,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(eo,{icon:Xl,label:S("gallery.noImageSelected")}),dataTestId:"image-preview"}),e&&m&&a.jsx(Le,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(wpe,{image:m})}),a.jsx(So,{children:!e&&m&&y&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(zA,{})},"nextPrevButtons")})]})},_pe=l.memo(jpe),Ipe=()=>a.jsxs(N,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(mpe,{}),a.jsx(_pe,{})]}),Ppe=l.memo(Ipe),Epe=()=>a.jsx(Le,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(N,{sx:{width:"100%",height:"100%"},children:a.jsx(Ppe,{})})}),FA=l.memo(Epe),Mpe=()=>{const e=l.useRef(null),t=l.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=G2();return a.jsx(Le,{sx:{w:"full",h:"full"},children:a.jsxs(E0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(el,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(ipe,{})}),a.jsx(lg,{onDoubleClick:t}),a.jsx(el,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(FA,{})})]})})},Ope=l.memo(Mpe);var Ape=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const F_=Sf(Ape);function xx(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var Rpe=Object.defineProperty,B_=Object.getOwnPropertySymbols,Dpe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,H_=(e,t,n)=>t in e?Rpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Npe=(e,t)=>{for(var n in t||(t={}))Dpe.call(t,n)&&H_(e,n,t[n]);if(B_)for(var n of B_(t))Tpe.call(t,n)&&H_(e,n,t[n]);return e};function BA(e,t){if(t===null||typeof t!="object")return{};const n=Npe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const $pe="__MANTINE_FORM_INDEX__";function W_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${$pe}`)):!1:!1}function V_(e,t,n){typeof n.value=="object"&&(n.value=Qc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function Qc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(Qc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,c){o.set(Qc(c),Qc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(Qc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function yx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],c=`${n===""?"":`${n}.`}${s}`,d=ri(c,t);let p=!1;return typeof i=="function"&&(o[c]=i(d,t,c)),typeof i=="object"&&Array.isArray(d)&&(p=!0,d.forEach((h,m)=>yx(i,t,`${c}.${m}`,o))),typeof i=="object"&&typeof d=="object"&&d!==null&&(p||yx(i,t,c,o)),o},r)}function Cx(e,t){return U_(typeof e=="function"?e(t):yx(e,t))}function kh(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=Cx(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,c)=>i===s.split(".")[c]));return{hasError:!!o,error:o?r.errors[o]:null}}function Lpe(e,{from:t,to:n},r){const o=ri(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),N0(e,s,r)}var zpe=Object.defineProperty,G_=Object.getOwnPropertySymbols,Fpe=Object.prototype.hasOwnProperty,Bpe=Object.prototype.propertyIsEnumerable,q_=(e,t,n)=>t in e?zpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hpe=(e,t)=>{for(var n in t||(t={}))Fpe.call(t,n)&&q_(e,n,t[n]);if(G_)for(var n of G_(t))Bpe.call(t,n)&&q_(e,n,t[n]);return e};function Wpe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=Hpe({},r);return Object.keys(r).every(c=>{let d,p;if(c.startsWith(o)&&(d=c,p=c.replace(o,s)),c.startsWith(s)&&(d=c.replace(s,o),p=c),d&&p){const h=i[d],m=i[p];return m===void 0?delete i[d]:i[d]=m,h===void 0?delete i[p]:i[p]=h,!1}return!0}),i}function Vpe(e,t,n){const r=ri(e,n);return Array.isArray(r)?N0(e,r.filter((o,s)=>s!==t),n):n}var Upe=Object.defineProperty,K_=Object.getOwnPropertySymbols,Gpe=Object.prototype.hasOwnProperty,qpe=Object.prototype.propertyIsEnumerable,Q_=(e,t,n)=>t in e?Upe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kpe=(e,t)=>{for(var n in t||(t={}))Gpe.call(t,n)&&Q_(e,n,t[n]);if(K_)for(var n of K_(t))qpe.call(t,n)&&Q_(e,n,t[n]);return e};function X_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function Y_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=BA(`${o}.${t}`,s));const i=Kpe({},s),c=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const p=X_(d,o);return Number.isNaN(p)?!1:p>=t}).forEach(([d,p])=>{const h=X_(d,o),m=d.replace(`${o}.${h}`,`${o}.${h+r}`);i[m]=p,c.add(m),c.has(d)||delete i[d]}),i}function Qpe(e,t,n,r){const o=ri(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),N0(e,s,r)}function J_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Xpe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Ype=Object.defineProperty,Jpe=Object.defineProperties,Zpe=Object.getOwnPropertyDescriptors,Z_=Object.getOwnPropertySymbols,ehe=Object.prototype.hasOwnProperty,the=Object.prototype.propertyIsEnumerable,eI=(e,t,n)=>t in e?Ype(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wi=(e,t)=>{for(var n in t||(t={}))ehe.call(t,n)&&eI(e,n,t[n]);if(Z_)for(var n of Z_(t))the.call(t,n)&&eI(e,n,t[n]);return e},B1=(e,t)=>Jpe(e,Zpe(t));function uc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:c=p=>p,validate:d}={}){const[p,h]=l.useState(r),[m,g]=l.useState(n),[b,y]=l.useState(e),[x,w]=l.useState(xx(t)),S=l.useRef(e),j=$=>{S.current=$},I=l.useCallback(()=>h({}),[]),_=$=>{const F=$?Wi(Wi({},b),$):b;j(F),g({})},M=l.useCallback($=>w(F=>xx(typeof $=="function"?$(F):$)),[]),E=l.useCallback(()=>w({}),[]),A=l.useCallback(()=>{y(e),E(),j(e),g({}),I()},[]),R=l.useCallback(($,F)=>M(q=>B1(Wi({},q),{[$]:F})),[]),D=l.useCallback($=>M(F=>{if(typeof $!="string")return F;const q=Wi({},F);return delete q[$],q}),[]),O=l.useCallback($=>g(F=>{if(typeof $!="string")return F;const q=BA($,F);return delete q[$],q}),[]),T=l.useCallback(($,F)=>{const q=W_($,s);O($),h(pe=>B1(Wi({},pe),{[$]:!0})),y(pe=>{const W=N0($,F,pe);if(q){const U=kh($,d,W);U.hasError?R($,U.error):D($)}return W}),!q&&o&&R($,null)},[]),K=l.useCallback($=>{y(F=>{const q=typeof $=="function"?$(F):$;return Wi(Wi({},F),q)}),o&&E()},[]),G=l.useCallback(($,F)=>{O($),y(q=>Lpe($,F,q)),w(q=>Wpe($,F,q))},[]),X=l.useCallback(($,F)=>{O($),y(q=>Vpe($,F,q)),w(q=>Y_($,F,q,-1))},[]),Z=l.useCallback(($,F,q)=>{O($),y(pe=>Qpe($,F,q,pe)),w(pe=>Y_($,q,pe,1))},[]),te=l.useCallback(()=>{const $=Cx(d,b);return w($.errors),$},[b,d]),V=l.useCallback($=>{const F=kh($,d,b);return F.hasError?R($,F.error):D($),F},[b,d]),oe=($,{type:F="input",withError:q=!0,withFocus:pe=!0}={})=>{const U={onChange:Xpe(ee=>T($,ee))};return q&&(U.error=x[$]),F==="checkbox"?U.checked=ri($,b):U.value=ri($,b),pe&&(U.onFocus=()=>h(ee=>B1(Wi({},ee),{[$]:!0})),U.onBlur=()=>{if(W_($,i)){const ee=kh($,d,b);ee.hasError?R($,ee.error):D($)}}),U},ne=($,F)=>q=>{q==null||q.preventDefault();const pe=te();pe.hasErrors?F==null||F(pe.errors,b,q):$==null||$(c(b),q)},se=$=>c($||b),re=l.useCallback($=>{$.preventDefault(),A()},[]),ae=$=>{if($){const q=ri($,m);if(typeof q=="boolean")return q;const pe=ri($,b),W=ri($,S.current);return!F_(pe,W)}return Object.keys(m).length>0?J_(m):!F_(b,S.current)},B=l.useCallback($=>J_(p,$),[p]),Y=l.useCallback($=>$?!kh($,d,b).hasError:!Cx(d,b).hasErrors,[b,d]);return{values:b,errors:x,setValues:K,setErrors:M,setFieldValue:T,setFieldError:R,clearFieldError:D,clearErrors:E,reset:A,validate:te,validateField:V,reorderListItem:G,removeListItem:X,insertListItem:Z,getInputProps:oe,onSubmit:ne,onReset:re,isDirty:ae,isTouched:B,setTouched:h,setDirty:g,resetTouched:I,resetDirty:_,isValid:Y,getTransformedValues:se}}function Or(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:c,base900:d,accent500:p,accent300:h}=Jf(),{colorMode:m}=ji(),g=l.useCallback(()=>({input:{color:Xe(d,r)(m),backgroundColor:Xe(n,d)(m),borderColor:Xe(o,i)(m),borderWidth:2,outline:"none",":focus":{borderColor:Xe(h,p)(m)}},label:{color:Xe(c,s)(m),fontWeight:"normal",marginBottom:4}}),[h,p,r,o,s,n,c,i,d,m]);return a.jsx(RM,{styles:g,...t})}const nhe=[{value:"sd-1",label:xr["sd-1"]},{value:"sd-2",label:xr["sd-2"]},{value:"sdxl",label:xr.sdxl},{value:"sdxl-refiner",label:xr["sdxl-refiner"]}];function sp(e){const{...t}=e,{t:n}=Q();return a.jsx(Dr,{label:n("modelManager.baseModel"),data:nhe,...t})}function WA(e){const{data:t}=mP(),{...n}=e;return a.jsx(Dr,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const rhe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function $0(e){const{...t}=e,{t:n}=Q();return a.jsx(Dr,{label:n("modelManager.variant"),data:rhe,...t})}function dg(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function VA(e){const{t}=Q(),n=le(),{model_path:r}=e,o=uc({initialValues:{model_name:r?dg(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=gP(),[i,c]=l.useState(!1),d=m=>{s({body:m}).unwrap().then(g=>{n(Ht(rr({title:t("modelManager.modelAdded",{modelName:m.model_name}),status:"success"}))),o.reset(),r&&n(Pf(null))}).catch(g=>{g&&n(Ht(rr({title:t("toast.modelAddFailed"),status:"error"})))})},p=l.useCallback(m=>{if(o.values.model_name===""){const g=dg(m.currentTarget.value);g&&o.setFieldValue("model_name",g)}},[o]),h=l.useCallback(()=>c(m=>!m),[]);return a.jsx("form",{onSubmit:o.onSubmit(m=>d(m)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Or,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(sp,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(Or,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p}),a.jsx(Or,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(Or,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx($0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(N,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Or,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(WA,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Eo,{isChecked:i,onChange:h,label:t("modelManager.useCustomConfig")}),a.jsx(Dt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function UA(e){const{t}=Q(),n=le(),{model_path:r}=e,[o]=gP(),s=uc({initialValues:{model_name:r?dg(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=d=>{o({body:d}).unwrap().then(p=>{n(Ht(rr({title:t("modelManager.modelAdded",{modelName:d.model_name}),status:"success"}))),s.reset(),r&&n(Pf(null))}).catch(p=>{p&&n(Ht(rr({title:t("toast.modelAddFailed"),status:"error"})))})},c=l.useCallback(d=>{if(s.values.model_name===""){const p=dg(d.currentTarget.value,!1);p&&s.setFieldValue("model_name",p)}},[s]);return a.jsx("form",{onSubmit:s.onSubmit(d=>i(d)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Or,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(sp,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(Or,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:c}),a.jsx(Or,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(Or,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx($0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Dt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}function ohe(){const[e,t]=l.useState("diffusers"),{t:n}=Q(),r=l.useCallback(s=>{s&&t(s)},[]),o=l.useMemo(()=>[{label:n("modelManager.diffusersModels"),value:"diffusers"},{label:n("modelManager.checkpointOrSafetensors"),value:"checkpoint"}],[n]);return a.jsxs(N,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Dr,{label:n("modelManager.modelType"),value:e,data:o,onChange:r}),a.jsxs(N,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(UA,{}),e==="checkpoint"&&a.jsx(VA,{})]})]})}const she=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function ahe(){const e=le(),{t}=Q(),[n,{isLoading:r}]=vP(),o=uc({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const c={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:c}).unwrap().then(d=>{e(Ht(rr({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(d=>{d&&e(Ht(rr({title:`${d.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Or,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Dr,{label:t("modelManager.predictionType"),data:she,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Dt,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function ihe(){const{t:e}=Q(),[t,n]=l.useState("simple"),r=l.useCallback(()=>n("simple"),[]),o=l.useCallback(()=>n("advanced"),[]);return a.jsxs(N,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Hn,{isAttached:!0,children:[a.jsx(Dt,{size:"sm",isChecked:t=="simple",onClick:r,children:e("common.simple")}),a.jsx(Dt,{size:"sm",isChecked:t=="advanced",onClick:o,children:e("common.advanced")})]}),a.jsxs(N,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[t==="simple"&&a.jsx(ahe,{}),t==="advanced"&&a.jsx(ohe,{})]})]})}function lhe(e){const{...t}=e;return a.jsx(jE,{w:"100%",...t,children:e.children})}function che(){const e=H(w=>w.modelmanager.searchFolder),[t,n]=l.useState(""),{data:r}=aa(Al),{foundModels:o,alreadyInstalled:s,filteredModels:i}=bP({search_path:e||""},{selectFromResult:({data:w})=>{const S=_$(r==null?void 0:r.entities),j=To(S,"path"),I=C$(w,j),_=O$(w,j);return{foundModels:w,alreadyInstalled:tI(_,t),filteredModels:tI(I,t)}}}),[c,{isLoading:d}]=vP(),p=le(),{t:h}=Q(),m=l.useCallback(w=>{const S=w.currentTarget.id.split("\\").splice(-1)[0];c({body:{location:w.currentTarget.id}}).unwrap().then(j=>{p(Ht(rr({title:`Added Model: ${S}`,status:"success"})))}).catch(j=>{j&&p(Ht(rr({title:h("toast.modelAddFailed"),status:"error"})))})},[p,c,h]),g=l.useCallback(w=>{n(w.target.value)},[]),b=l.useCallback(w=>p(Pf(w)),[p]),y=({models:w,showActions:S=!0})=>w.map(j=>a.jsxs(N,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(je,{sx:{fontWeight:600},children:j.split("\\").slice(-1)[0]}),a.jsx(je,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:j})]}),S?a.jsxs(N,{gap:2,children:[a.jsx(Dt,{id:j,onClick:m,isLoading:d,children:h("modelManager.quickAdd")}),a.jsx(Dt,{onClick:b.bind(null,j),isLoading:d,children:h("modelManager.advanced")})]}):a.jsx(je,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},j));return(()=>e?!o||o.length===0?a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(je,{variant:"subtext",children:h("modelManager.noModels")})}):a.jsxs(N,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Is,{onChange:g,label:h("modelManager.search"),labelPos:"side"}),a.jsxs(N,{p:2,gap:2,children:[a.jsxs(je,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(je,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(lhe,{offsetScrollbars:!0,children:a.jsxs(N,{gap:2,flexDirection:"column",children:[y({models:i}),y({models:s,showActions:!1})]})})]}):null)()}const tI=(e,t)=>{const n=[];return to(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function uhe(){const e=H(h=>h.modelmanager.advancedAddScanModel),{t}=Q(),n=l.useMemo(()=>[{label:t("modelManager.diffusersModels"),value:"diffusers"},{label:t("modelManager.checkpointOrSafetensors"),value:"checkpoint"}],[t]),[r,o]=l.useState("diffusers"),[s,i]=l.useState(!0);l.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(h=>e.endsWith(h))?o("checkpoint"):o("diffusers")},[e,o,s]);const c=le(),d=l.useCallback(()=>c(Pf(null)),[c]),p=l.useCallback(h=>{h&&(o(h),i(h==="checkpoint"))},[]);return e?a.jsxs(Le,{as:Ar.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(je,{size:"xl",fontWeight:600,children:s||r==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(rt,{icon:a.jsx(ku,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:d,size:"sm"})]}),a.jsx(Dr,{label:t("modelManager.modelType"),value:r,data:n,onChange:p}),s?a.jsx(VA,{model_path:e},e):a.jsx(UA,{model_path:e},e)]}):null}function dhe(){const e=le(),{t}=Q(),n=H(d=>d.modelmanager.searchFolder),{refetch:r}=bP({search_path:n||""}),o=uc({initialValues:{folder:""}}),s=l.useCallback(d=>{e(bS(d.folder))},[e]),i=l.useCallback(()=>{r()},[r]),c=l.useCallback(()=>{e(bS(null)),e(Pf(null))},[e]);return a.jsx("form",{onSubmit:o.onSubmit(d=>s(d)),style:{width:"100%"},children:a.jsxs(N,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(N,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(je,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(N,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(Is,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(N,{gap:2,children:[n?a.jsx(rt,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(s0,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(rt,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(Qee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(rt,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(Zo,{}),size:"sm",onClick:c,isDisabled:!n,colorScheme:"red"})]})]})})}const fhe=l.memo(dhe);function phe(){return a.jsxs(N,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(fhe,{}),a.jsxs(N,{gap:4,children:[a.jsx(N,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(che,{})}),a.jsx(uhe,{})]})]})}function hhe(){const[e,t]=l.useState("add"),{t:n}=Q(),r=l.useCallback(()=>t("add"),[]),o=l.useCallback(()=>t("scan"),[]);return a.jsxs(N,{flexDirection:"column",gap:4,children:[a.jsxs(Hn,{isAttached:!0,children:[a.jsx(Dt,{onClick:r,isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Dt,{onClick:o,isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(ihe,{}),e=="scan"&&a.jsx(phe,{})]})}const mhe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function ghe(){var q,pe;const{t:e}=Q(),t=le(),{data:n}=aa(Al),[r,{isLoading:o}]=aN(),[s,i]=l.useState("sd-1"),c=OS(n==null?void 0:n.entities,(W,U)=>(W==null?void 0:W.model_format)==="diffusers"&&(W==null?void 0:W.base_model)==="sd-1"),d=OS(n==null?void 0:n.entities,(W,U)=>(W==null?void 0:W.model_format)==="diffusers"&&(W==null?void 0:W.base_model)==="sd-2"),p=l.useMemo(()=>({"sd-1":c,"sd-2":d}),[c,d]),[h,m]=l.useState(((q=Object.keys(p[s]))==null?void 0:q[0])??null),[g,b]=l.useState(((pe=Object.keys(p[s]))==null?void 0:pe[1])??null),[y,x]=l.useState(null),[w,S]=l.useState(""),[j,I]=l.useState(.5),[_,M]=l.useState("weighted_sum"),[E,A]=l.useState("root"),[R,D]=l.useState(""),[O,T]=l.useState(!1),K=Object.keys(p[s]).filter(W=>W!==g&&W!==y),G=Object.keys(p[s]).filter(W=>W!==h&&W!==y),X=Object.keys(p[s]).filter(W=>W!==h&&W!==g),Z=l.useCallback(W=>{i(W),m(null),b(null)},[]),te=l.useCallback(W=>{m(W)},[]),V=l.useCallback(W=>{b(W)},[]),oe=l.useCallback(W=>{W?(x(W),M("weighted_sum")):(x(null),M("add_difference"))},[]),ne=l.useCallback(W=>S(W.target.value),[]),se=l.useCallback(W=>I(W),[]),re=l.useCallback(()=>I(.5),[]),ae=l.useCallback(W=>M(W),[]),B=l.useCallback(W=>A(W),[]),Y=l.useCallback(W=>D(W.target.value),[]),$=l.useCallback(W=>T(W.target.checked),[]),F=l.useCallback(()=>{const W=[];let U=[h,g,y];U=U.filter(J=>J!==null),U.forEach(J=>{var he;const ge=(he=J==null?void 0:J.split("/"))==null?void 0:he[2];ge&&W.push(ge)});const ee={model_names:W,merged_model_name:w!==""?w:W.join("-"),alpha:j,interp:_,force:O,merge_dest_directory:E==="root"?void 0:R};r({base_model:s,body:{body:ee}}).unwrap().then(J=>{t(Ht(rr({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(J=>{J&&t(Ht(rr({title:e("modelManager.modelsMergeFailed"),status:"error"})))})},[s,t,r,w,j,R,O,_,E,h,y,g,e]);return a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsxs(N,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(je,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(je,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(N,{columnGap:4,children:[a.jsx(Dr,{label:e("modelManager.modelType"),w:"100%",data:mhe,value:s,onChange:Z}),a.jsx(sr,{label:e("modelManager.modelOne"),w:"100%",value:h,placeholder:e("modelManager.selectModel"),data:K,onChange:te}),a.jsx(sr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:G,onChange:V}),a.jsx(sr,{label:e("modelManager.modelThree"),data:X,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:oe})]}),a.jsx(Is,{label:e("modelManager.mergedModelName"),value:w,onChange:ne}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(It,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:se,withInput:!0,withReset:!0,handleReset:re,withSliderMarks:!0}),a.jsx(je,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(N,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(je,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(om,{value:_,onChange:ae,children:a.jsx(N,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(ei,{value:"weighted_sum",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(ei,{value:"sigmoid",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(ei,{value:"inv_sigmoid",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(ei,{value:"add_difference",children:a.jsx(Wn,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(je,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(N,{columnGap:4,children:[a.jsx(je,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(om,{value:E,onChange:B,children:a.jsxs(N,{columnGap:4,children:[a.jsx(ei,{value:"root",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(ei,{value:"custom",children:a.jsx(je,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),E==="custom"&&a.jsx(Is,{label:e("modelManager.mergedModelCustomSaveLocation"),value:R,onChange:Y})]}),a.jsx(Eo,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:$,fontWeight:"500"}),a.jsx(Dt,{onClick:F,isLoading:o,isDisabled:h===null||g===null,children:e("modelManager.merge")})]})}function vhe(e){const{model:t}=e,n=le(),{t:r}=Q(),[o,{isLoading:s}]=iN(),[i,c]=l.useState("InvokeAIRoot"),[d,p]=l.useState("");l.useEffect(()=>{c("InvokeAIRoot")},[t]);const h=l.useCallback(()=>{c("InvokeAIRoot")},[]),m=l.useCallback(y=>{c(y)},[]),g=l.useCallback(y=>{p(y.target.value)},[]),b=l.useCallback(()=>{const y={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?d:void 0};if(i==="Custom"&&d===""){n(Ht(rr({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(Ht(rr({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(y).unwrap().then(()=>{n(Ht(rr({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(Ht(rr({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})},[o,d,n,t.base_model,t.model_name,i,r]);return a.jsxs(_0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:b,cancelCallback:h,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Dt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsx(je,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(zf,{children:[a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Ps,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(je,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsxs(N,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(je,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(om,{value:i,onChange:m,children:a.jsxs(N,{gap:4,children:[a.jsx(ei,{value:"InvokeAIRoot",children:a.jsx(Wn,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(ei,{value:"Custom",children:a.jsx(Wn,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(N,{flexDirection:"column",rowGap:2,children:[a.jsx(je,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Is,{value:d,onChange:g,width:"full"})]})]})]})}function bhe(e){const{model:t}=e,[n,{isLoading:r}]=xP(),{data:o}=mP(),[s,i]=l.useState(!1);l.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const c=le(),{t:d}=Q(),p=uc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:g=>g.trim().length===0?"Must provide a path":null}}),h=l.useCallback(()=>i(g=>!g),[]),m=l.useCallback(g=>{const b={base_model:t.base_model,model_name:t.model_name,body:g};n(b).unwrap().then(y=>{p.setValues(y),c(Ht(rr({title:d("modelManager.modelUpdated"),status:"success"})))}).catch(y=>{p.reset(),c(Ht(rr({title:d("modelManager.modelUpdateFailed"),status:"error"})))})},[p,c,t.base_model,t.model_name,d,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(je,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(je,{fontSize:"sm",color:"base.400",children:[xr[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Va,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(vhe,{model:t})]}),a.jsx(io,{}),a.jsx(N,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(g=>m(g)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:d("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(Or,{label:d("modelManager.description"),...p.getInputProps("description")}),a.jsx(sp,{required:!0,...p.getInputProps("base_model")}),a.jsx($0,{required:!0,...p.getInputProps("variant")}),a.jsx(Or,{required:!0,label:d("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(Or,{label:d("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(N,{flexDirection:"column",gap:2,children:[s?a.jsx(Or,{required:!0,label:d("modelManager.config"),...p.getInputProps("config")}):a.jsx(WA,{required:!0,...p.getInputProps("config")}),a.jsx(Eo,{isChecked:s,onChange:h,label:"Use Custom Config"})]}),a.jsx(Dt,{type:"submit",isLoading:r,children:d("modelManager.updateModel")})]})})})]})}function xhe(e){const{model:t}=e,[n,{isLoading:r}]=xP(),o=le(),{t:s}=Q(),i=uc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Ht(rr({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Ht(rr({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(je,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(je,{fontSize:"sm",color:"base.400",children:[xr[t.base_model]," Model"]})]}),a.jsx(io,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Or,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(sp,{required:!0,...i.getInputProps("base_model")}),a.jsx($0,{required:!0,...i.getInputProps("variant")}),a.jsx(Or,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Or,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(Dt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function yhe(e){const{model:t}=e,[n,{isLoading:r}]=lN(),o=le(),{t:s}=Q(),i=uc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Ht(rr({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Ht(rr({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(je,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(je,{fontSize:"sm",color:"base.400",children:[xr[t.base_model]," Model ⋅"," ",cN[t.model_format]," format"]})]}),a.jsx(io,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Or,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Or,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(sp,{...i.getInputProps("base_model")}),a.jsx(Or,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Dt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function Che(e){const{t}=Q(),n=le(),[r]=uN(),[o]=dN(),{model:s,isSelected:i,setSelectedModelId:c}=e,d=l.useCallback(()=>{c(s.id)},[s.id,c]),p=l.useCallback(()=>{const h={main:r,lora:o,onnx:r}[s.model_type];h(s).unwrap().then(m=>{n(Ht(rr({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(m=>{m&&n(Ht(rr({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),c(void 0)},[r,o,s,c,n,t]);return a.jsxs(N,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(N,{as:Dt,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:d,children:a.jsxs(N,{gap:4,alignItems:"center",children:[a.jsx(Va,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:fN[s.base_model]}),a.jsx(Wn,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(je,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(_0,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(rt,{icon:a.jsx(Une,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(N,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const whe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=Q(),[o,s]=l.useState(""),[i,c]=l.useState("all"),{filteredDiffusersModels:d,isLoadingDiffusersModels:p}=aa(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredDiffusersModels:jd(I,"main","diffusers",o),isLoadingDiffusersModels:_})}),{filteredCheckpointModels:h,isLoadingCheckpointModels:m}=aa(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredCheckpointModels:jd(I,"main","checkpoint",o),isLoadingCheckpointModels:_})}),{filteredLoraModels:g,isLoadingLoraModels:b}=_f(void 0,{selectFromResult:({data:I,isLoading:_})=>({filteredLoraModels:jd(I,"lora",void 0,o),isLoadingLoraModels:_})}),{filteredOnnxModels:y,isLoadingOnnxModels:x}=Jd(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredOnnxModels:jd(I,"onnx","onnx",o),isLoadingOnnxModels:_})}),{filteredOliveModels:w,isLoadingOliveModels:S}=Jd(Al,{selectFromResult:({data:I,isLoading:_})=>({filteredOliveModels:jd(I,"onnx","olive",o),isLoadingOliveModels:_})}),j=l.useCallback(I=>{s(I.target.value)},[]);return a.jsx(N,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(N,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Hn,{isAttached:!0,children:[a.jsx(Dt,{onClick:c.bind(null,"all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(Dt,{size:"sm",onClick:c.bind(null,"lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(Is,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(N,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Wc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&d.length>0&&a.jsx(Hc,{title:"Diffusers",modelList:d,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),m&&a.jsx(Wc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!m&&h.length>0&&a.jsx(Hc,{title:"Checkpoints",modelList:h,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),b&&a.jsx(Wc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!b&&g.length>0&&a.jsx(Hc,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Wc,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&w.length>0&&a.jsx(Hc,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),x&&a.jsx(Wc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!x&&y.length>0&&a.jsx(Hc,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},She=l.memo(whe),jd=(e,t,n,r)=>{const o=[];return to(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),c=n===void 0||s.model_format===n,d=s.model_type===t;i&&c&&d&&o.push(s)}),o},rC=l.memo(e=>a.jsx(N,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));rC.displayName="StyledModelContainer";const Hc=l.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(rC,{children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(je,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(Che,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});Hc.displayName="ModelListWrapper";const Wc=l.memo(({loadingMessage:e})=>a.jsx(rC,{children:a.jsxs(N,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(Ci,{}),a.jsx(je,{variant:"subtext",children:e||"Fetching..."})]})}));Wc.displayName="FetchingModelsLoader";function khe(){const[e,t]=l.useState(),{mainModel:n}=aa(Al,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=_f(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(N,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(She,{selectedModelId:e,setSelectedModelId:t}),a.jsx(jhe,{model:o})]})}const jhe=e=>{const{t}=Q(),{model:n}=e;return(n==null?void 0:n.model_format)==="checkpoint"?a.jsx(bhe,{model:n},n.id):(n==null?void 0:n.model_format)==="diffusers"?a.jsx(xhe,{model:n},n.id):(n==null?void 0:n.model_type)==="lora"?a.jsx(yhe,{model:n},n.id):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(je,{variant:"subtext",children:t("modelManager.noModelSelected")})})};function _he(){const{t:e}=Q();return a.jsxs(N,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(je,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(je,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Ku,{})]})}function Ihe(){return a.jsx(N,{children:a.jsx(_he,{})})}const Phe=()=>{const{t:e}=Q(),t=l.useMemo(()=>[{id:"modelManager",label:e("modelManager.modelManager"),content:a.jsx(khe,{})},{id:"importModels",label:e("modelManager.importModels"),content:a.jsx(hhe,{})},{id:"mergeModels",label:e("modelManager.mergeModels"),content:a.jsx(ghe,{})},{id:"settings",label:e("modelManager.settings"),content:a.jsx(Ihe,{})}],[e]);return a.jsxs(tc,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(nc,{children:t.map(n=>a.jsx(wo,{sx:{borderTopRadius:"base"},children:n.label},n.id))}),a.jsx($u,{sx:{w:"full",h:"full"},children:t.map(n=>a.jsx(Go,{sx:{w:"full",h:"full"},children:n.content},n.id))})]})},Ehe=l.memo(Phe),Mhe=me([e=>e.nodes],e=>e.nodeTemplates),Ohe=()=>{const e=H(Mhe),t=Jx();return l.useCallback(n=>{var d;let r=window.innerWidth/2,o=window.innerHeight/2;const s=(d=document.querySelector("#workflow-editor"))==null?void 0:d.getBoundingClientRect();s&&(r=s.width/2-sb/2,o=s.height/2-sb/2);const i=t.project({x:r,y:o}),c=e[n];return pN(n,i,c)},[e,t])},GA=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(je,{fontWeight:600,children:e}),a.jsx(je,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));GA.displayName="AddNodePopoverSelectItem";const Ahe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},Rhe=()=>{const e=le(),t=Ohe(),n=Zl(),{t:r}=Q(),o=H(w=>w.nodes.currentConnectionFieldType),s=H(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),i=me([we],({nodes:w})=>{const S=o?S$(w.nodeTemplates,I=>{const _=s=="source"?I.inputs:I.outputs;return ta(_,M=>{const E=s=="source"?o:M.type,A=s=="target"?o:M.type;return Zx(E,A)})}):To(w.nodeTemplates),j=To(S,I=>({label:I.title,value:I.type,description:I.description,tags:I.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((I,_)=>I.label.localeCompare(_.label)),{data:j,t:r}},Ie),{data:c}=H(i),d=H(w=>w.nodes.isAddNodePopoverOpen),p=l.useRef(null),h=l.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(hN(S))},[e,t,n,r]),m=l.useCallback(w=>{w&&h(w)},[h]),g=l.useCallback(()=>{e(mN())},[e]),b=l.useCallback(()=>{e(yP())},[e]),y=l.useCallback(w=>{w.preventDefault(),b(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[b]),x=l.useCallback(()=>{g()},[g]);return _t(["shift+a","space"],y),_t(["escape"],x),a.jsxs(Uf,{initialFocusRef:p,isOpen:d,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(y3,{children:a.jsx(N,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(Gf,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Hg,{sx:{p:0},children:a.jsx(sr,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:c,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:GA,filter:Ahe,onChange:m,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},Dhe=l.memo(Rhe),The=()=>{const e=Jx(),t=H(r=>r.nodes.shouldValidateGraph);return l.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var b,y;const c=e.getEdges(),d=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),h=e.getNode(s);if(!(p&&h&&p.data&&h.data))return!1;const m=(b=p.data.outputs[o])==null?void 0:b.type,g=(y=h.data.inputs[i])==null?void 0:y.type;return!m||!g||r===s?!1:t?c.find(x=>{x.target===s&&x.targetHandle===i&&x.source===r&&x.sourceHandle})||c.find(x=>x.target===s&&x.targetHandle===i)&&g!=="CollectionItem"||!Zx(m,g)?!1:CP(r,s,d,c):!0},[e,t])},yf=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,Nhe=me(we,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=yf(n&&r?If[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),$he=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:c}=H(Nhe),d={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=ey(d);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:c,d:p,style:{opacity:.8}})})},Lhe=l.memo($he),qA=(e,t,n,r,o)=>me(we,({nodes:s})=>{var g,b;const i=s.nodes.find(y=>y.id===e),c=s.nodes.find(y=>y.id===n),d=Rr(i)&&Rr(c),p=(i==null?void 0:i.selected)||(c==null?void 0:c.selected)||o,h=d?(b=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:b.type:void 0,m=h&&s.shouldColorEdges?yf(If[h].color):yf("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:m}},Ie),zhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:c,selected:d,source:p,target:h,sourceHandleId:m,targetHandleId:g})=>{const b=l.useMemo(()=>qA(p,m,h,g,d),[d,p,m,h,g]),{isSelected:y,shouldAnimate:x}=H(b),[w,S,j]=ey({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:I}=Jf();return a.jsxs(a.Fragment,{children:[a.jsx(wP,{path:w,markerEnd:i,style:{strokeWidth:y?3:2,stroke:I,opacity:y?.8:.5,animation:x?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:x?5:"none"}}),(c==null?void 0:c.count)&&c.count>1&&a.jsx(gN,{children:a.jsx(N,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Va,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:c.count})})})]})},Fhe=l.memo(zhe),Bhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:c,source:d,target:p,sourceHandleId:h,targetHandleId:m})=>{const g=l.useMemo(()=>qA(d,h,p,m,c),[d,h,p,m,c]),{isSelected:b,shouldAnimate:y,stroke:x}=H(g),[w]=ey({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(wP,{path:w,markerEnd:i,style:{strokeWidth:b?3:2,stroke:x,opacity:b?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},Hhe=l.memo(Bhe),Whe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:c}=rA(t),d=l.useMemo(()=>me(we,({nodes:j})=>{var I;return((I=j.nodeExecutionStates[t])==null?void 0:I.status)===oi.IN_PROGRESS}),[t]),p=H(d),[h,m,g,b]=ea("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=le(),x=di(h,m),w=H(j=>j.nodes.nodeOpacity),S=l.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(vN(t)),y(SP())},[y,t]);return a.jsxs(Le,{onClick:S,onMouseEnter:c,onMouseLeave:i,className:Du,sx:{h:"full",position:"relative",borderRadius:"base",w:n??sb,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${b}, ${b}`,zIndex:-1}}),a.jsx(Le,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?x:void 0,zIndex:-1}}),r,a.jsx(nA,{isSelected:o,isHovered:s})]})},L0=l.memo(Whe),Vhe=me(we,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Uhe=e=>{const{progressImage:t,imageDTO:n}=bN(Vhe);return t?a.jsx(H1,{nodeProps:e,children:a.jsx(_i,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(H1,{nodeProps:e,children:a.jsx(ll,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(H1,{nodeProps:e,children:a.jsx(eo,{})})},Ghe=l.memo(Uhe),H1=e=>{const[t,n]=l.useState(!1),r=l.useCallback(()=>{n(!0)},[]),o=l.useCallback(()=>{n(!1)},[]);return a.jsx(L0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(N,{onMouseEnter:r,onMouseLeave:o,className:Du,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(je,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(N,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(zA,{})},"nextPrevButtons")]})]})})},oC=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!si(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>si(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},qhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=To(s.inputs).filter(c=>(["any","direct"].includes(c.input)||ty.includes(c.type))&&kP.includes(c.type));return oC(i)},Ie),[e]);return H(t)},Khe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=To(s.inputs).filter(c=>c.input==="connection"&&!ty.includes(c.type)||!kP.includes(c.type));return oC(i)},Ie),[e]);return H(t)},Qhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];return s?oC(To(s.outputs)):[]},Ie),[e]);return H(t)},sC=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?ta(o.data.outputs,s=>xN.includes(s.type)&&o.data.type!=="image"):!1},Ie),[e]);return H(t)},Xhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.embedWorkflow:!1},Ie),[e]);return H(t)},Yhe=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s?s.withWorkflow:!1},Ie),[e]);return H(t)},Jhe=({nodeId:e})=>{const t=le(),n=Yhe(e),r=Xhe(e),o=l.useCallback(s=>{t(yN({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Vn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(yr,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(Tf,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Zhe=l.memo(Jhe),eme=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.isIntermediate:!1},Ie),[e]);return H(t)},tme=({nodeId:e})=>{const t=le(),n=sC(e),r=eme(e),o=l.useCallback(s=>{t(CN({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Vn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(yr,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(Tf,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},nme=l.memo(tme),rme=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.useCache:!1},Ie),[e]);return H(t)},ome=({nodeId:e})=>{const t=le(),n=rme(e),r=l.useCallback(o=>{t(wN({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Vn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(yr,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(Tf,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},sme=l.memo(ome),ame=({nodeId:e})=>{const t=sC(e),n=Pn("invocationCache").isFeatureEnabled;return a.jsxs(N,{className:Du,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(sme,{nodeId:e}),t&&a.jsx(Zhe,{nodeId:e}),t&&a.jsx(nme,{nodeId:e})]})},ime=l.memo(ame),lme=({nodeId:e,isOpen:t})=>{const n=le(),r=SN(),o=l.useCallback(()=>{n(kN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(rt,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(b0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},aC=l.memo(lme),cme=({nodeId:e,title:t})=>{const n=le(),r=Z8(e),o=eA(e),{t:s}=Q(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(oP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Lf,{as:N,value:i,onChange:p,onSubmit:d,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx($f,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(Nf,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(ume,{})]})})},KA=l.memo(cme);function ume(){const{isEditing:e,getEditButtonProps:t}=e5(),n=l.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Le,{className:Du,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const dme=({nodeId:e})=>{const t=K2(e),{base400:n,base600:r}=Jf(),o=di(n,r),s=l.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Kh(t)?a.jsxs(a.Fragment,{children:[a.jsx(Ed,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Uc.Left,style:{...s,left:"-0.5rem"}}),To(t.inputs,i=>a.jsx(Ed,{type:"target",id:i.name,isConnectable:!1,position:Uc.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Ed,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Uc.Right,style:{...s,right:"-0.5rem"}}),To(t.outputs,i=>a.jsx(Ed,{type:"source",id:i.name,isConnectable:!1,position:Uc.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},fme=l.memo(dme),pme=e=>{const t=l.useMemo(()=>me(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},Ie),[e]);return H(t)},hme=({nodeId:e})=>{const{needsUpdate:t}=sP(e);return a.jsx(Wn,{label:a.jsx(QA,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(Gr,{as:QM,sx:{boxSize:4,w:8,color:t?"error.400":"base.400"}})})},mme=l.memo(hme),QA=l.memo(({nodeId:e})=>{const t=K2(e),n=pme(e),{t:r}=Q(),o=l.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=l.useMemo(()=>!Kh(t)||!n?null:t.version?n.version?xS(t.version,n.version,"<")?a.jsxs(je,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):xS(t.version,n.version,">")?a.jsxs(je,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(je,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(je,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(je,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return Kh(t)?a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(je,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(je,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(je,{children:t.notes})]}):a.jsx(je,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});QA.displayName="TooltipContent";const W1=3,nI={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},gme=({nodeId:e})=>{const t=l.useMemo(()=>me(we,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=H(t);return n?a.jsx(Wn,{label:a.jsx(XA,{nodeExecutionState:n}),placement:"top",children:a.jsx(N,{className:Du,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(YA,{nodeExecutionState:n})})}):null},vme=l.memo(gme),XA=l.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=Q();return t===oi.PENDING?a.jsx(je,{children:"Pending"}):t===oi.IN_PROGRESS?r?a.jsxs(N,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(_i,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Va,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(je,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(je,{children:o("nodes.executionStateInProgress")}):t===oi.COMPLETED?a.jsx(je,{children:o("nodes.executionStateCompleted")}):t===oi.FAILED?a.jsx(je,{children:o("nodes.executionStateError")}):null});XA.displayName="TooltipLabel";const YA=l.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===oi.PENDING?a.jsx(Gr,{as:Pee,sx:{boxSize:W1,color:"base.600",_dark:{color:"base.300"}}}):n===oi.IN_PROGRESS?t===null?a.jsx(Pb,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:nI}):a.jsx(Pb,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:nI}):n===oi.COMPLETED?a.jsx(Gr,{as:VM,sx:{boxSize:W1,color:"ok.600",_dark:{color:"ok.300"}}}):n===oi.FAILED?a.jsx(Gr,{as:Oee,sx:{boxSize:W1,color:"error.600",_dark:{color:"error.300"}}}):null});YA.displayName="StatusIcon";const bme=({nodeId:e,isOpen:t})=>a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(aC,{nodeId:e,isOpen:t}),a.jsx(KA,{nodeId:e}),a.jsxs(N,{alignItems:"center",children:[a.jsx(vme,{nodeId:e}),a.jsx(mme,{nodeId:e})]}),!t&&a.jsx(fme,{nodeId:e})]}),xme=l.memo(bme),yme=(e,t,n,r)=>me(we,o=>{if(!r)return fn.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:c,edges:d}=o.nodes;if(!i||!s)return fn.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:h,handleId:m}=i;if(!p||!h||!m)return fn.t("nodes.noConnectionData");const g=n==="target"?r:s,b=n==="source"?r:s;if(e===h)return fn.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?fn.t("nodes.cannotConnectOutputToOutput"):fn.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:h,x=n==="target"?t:m,w=n==="source"?e:h,S=n==="source"?t:m;return d.find(I=>{I.target===y&&I.targetHandle===x&&I.source===w&&I.sourceHandle})?fn.t("nodes.cannotDuplicateConnection"):d.find(I=>I.target===y&&I.targetHandle===x)&&g!=="CollectionItem"?fn.t("nodes.inputMayOnlyHaveOneConnection"):Zx(b,g)?CP(p==="source"?h:e,p==="source"?e:h,c,d)?null:fn.t("nodes.connectionWouldCreateCycle"):fn.t("nodes.fieldTypesMustMatch")}),Cme=(e,t,n)=>{const r=l.useMemo(()=>me(we,({nodes:s})=>{var c;const i=s.nodes.find(d=>d.id===e);if(Rr(i))return(c=i==null?void 0:i.data[Xx[n]][t])==null?void 0:c.type},Ie),[t,n,e]);return H(r)},wme=me(we,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),JA=({nodeId:e,fieldName:t,kind:n})=>{const r=Cme(e,t,n),o=l.useMemo(()=>me(we,({nodes:g})=>!!g.edges.filter(b=>(n==="input"?b.target:b.source)===e&&(n==="input"?b.targetHandle:b.sourceHandle)===t).length),[t,n,e]),s=l.useMemo(()=>yme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=l.useMemo(()=>me(we,({nodes:g})=>{var b,y,x;return((b=g.connectionStartParams)==null?void 0:b.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((x=g.connectionStartParams)==null?void 0:x.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),c=H(o),d=H(wme),p=H(i),h=H(s),m=l.useMemo(()=>!!(d&&h&&!p),[h,d,p]);return{isConnected:c,isConnectionInProgress:d,isConnectionStartField:p,connectionError:h,shouldDim:m}},Sme=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},Ie),[t,e]);return H(n)},kme=(e,t)=>{const n=l.useMemo(()=>me(we,({nodes:o})=>{const s=o.nodes.find(d=>d.id===e);if(!Rr(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],c=i==null?void 0:i.inputs[t];return c==null?void 0:c.input},Ie),[t,e]);return H(n)},jme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=le(),s=oA(e,t),i=sA(e,t,n),c=kme(e,t),{t:d}=Q(),p=l.useCallback(S=>{S.preventDefault()},[]),h=l.useMemo(()=>me(we,({nodes:S})=>({isExposed:!!S.workflow.exposedFields.find(I=>I.nodeId===e&&I.fieldName===t)}),Ie),[t,e]),m=l.useMemo(()=>["any","direct"].includes(c??"__UNKNOWN_INPUT__"),[c]),{isExposed:g}=H(h),b=l.useCallback(()=>{o(jN({nodeId:e,fieldName:t}))},[o,t,e]),y=l.useCallback(()=>{o(lP({nodeId:e,fieldName:t}))},[o,t,e]),x=l.useMemo(()=>{const S=[];return m&&!g&&S.push(a.jsx(Kn,{icon:a.jsx(Zi,{}),onClick:b,children:"Add to Linear View"},`${e}.${t}.expose-field`)),m&&g&&S.push(a.jsx(Kn,{icon:a.jsx(Hee,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),S},[t,b,y,g,m,e]),w=l.useCallback(()=>x.length?a.jsx(ql,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:p,children:a.jsx(af,{title:s||i||d("nodes.unknownField"),children:x})}):null,[i,s,x,p,d]);return a.jsx(S2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:w,children:r})},_me=l.memo(jme),Ime=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:c}=t,{color:d,title:p}=If[c],h=l.useMemo(()=>{const g=_N.includes(c),b=ty.includes(c),y=IN.includes(c),x=yf(d),w={backgroundColor:g||b?"var(--invokeai-colors-base-900)":x,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||b?4:0,borderStyle:"solid",borderColor:x,borderRadius:y?4:"100%",zIndex:1};return n==="target"?w.insetInlineStart="-1rem":w.insetInlineEnd="-1rem",r&&!o&&s&&(w.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?w.cursor="grab":w.cursor="not-allowed":w.cursor="crosshair",w},[s,n,r,o,c,d]),m=l.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Wn,{label:m,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:xg,children:a.jsx(Ed,{type:n,id:i,position:n==="target"?Uc.Left:Uc.Right,style:h})})},ZA=l.memo(Ime),Pme=({nodeId:e,fieldName:t})=>{const n=M0(e,t,"input"),r=Sme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:c,shouldDim:d}=JA({nodeId:e,fieldName:t,kind:"input"}),p=l.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(wx,{shouldDim:d,children:a.jsxs(Vn,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(wx,{shouldDim:d,children:[a.jsxs(Vn,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(_me,{nodeId:e,fieldName:t,kind:"input",children:h=>a.jsx(yr,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(iA,{ref:h,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Le,{children:a.jsx(bA,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(ZA,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:c})]})},rI=l.memo(Pme),wx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));wx.displayName="InputFieldWrapper";const Eme=({nodeId:e,fieldName:t})=>{const n=M0(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:c}=JA({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(Sx,{shouldDim:c,children:a.jsxs(Vn,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(Sx,{shouldDim:c,children:[a.jsx(Wn,{label:a.jsx(Q2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:xg,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Vn,{isDisabled:r,pe:2,children:a.jsx(yr,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(ZA,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},Mme=l.memo(Eme),Sx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));Sx.displayName="OutputFieldWrapper";const Ome=e=>{const t=sC(e),n=Pn("invocationCache").isFeatureEnabled;return l.useMemo(()=>t||n,[t,n])},Ame=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Khe(e),i=qhe(e),c=Ome(e),d=Qhe(e);return a.jsxs(L0,{nodeId:e,selected:o,children:[a.jsx(xme,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(N,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:c?0:"base"},children:a.jsxs(N,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(rl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,h)=>a.jsx(rf,{gridColumnStart:1,gridRowStart:h+1,children:a.jsx(rI,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),d.map((p,h)=>a.jsx(rf,{gridColumnStart:2,gridRowStart:h+1,children:a.jsx(Mme,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(rI,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),c&&a.jsx(ime,{nodeId:e})]})]})},Rme=l.memo(Ame),Dme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(L0,{nodeId:e,selected:o,children:[a.jsxs(N,{className:Du,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(aC,{nodeId:e,isOpen:t}),a.jsx(je,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(N,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Le,{children:[a.jsx(je,{as:"span",children:"Unknown node type: "}),a.jsx(je,{as:"span",fontWeight:600,children:r})]})})]}),Tme=l.memo(Dme),Nme=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,c=l.useMemo(()=>me(we,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return H(c)?a.jsx(Rme,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(Tme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},$me=l.memo(Nme),Lme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=le(),c=l.useCallback(d=>{i(PN({nodeId:t,value:d.target.value}))},[i,t]);return a.jsxs(L0,{nodeId:t,selected:r,children:[a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(aC,{nodeId:t,isOpen:s}),a.jsx(KA,{nodeId:t,title:"Notes"}),a.jsx(Le,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(N,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(N,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(yi,{value:o,onChange:c,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},zme=l.memo(Lme),Fme=["Delete","Backspace"],Bme={collapsed:Fhe,default:Hhe},Hme={invocation:$me,current_image:Ghe,notes:zme},Wme={hideAttribution:!0},Vme=me(we,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},Ie),Ume=()=>{const e=le(),t=H(O=>O.nodes.nodes),n=H(O=>O.nodes.edges),r=H(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=H(Vme),i=l.useRef(null),c=l.useRef(),d=The(),[p]=ea("radii",["base"]),h=l.useCallback(O=>{e(EN(O))},[e]),m=l.useCallback(O=>{e(MN(O))},[e]),g=l.useCallback((O,T)=>{e(ON(T))},[e]),b=l.useCallback(O=>{e(yS(O))},[e]),y=l.useCallback(()=>{e(AN({cursorPosition:c.current}))},[e]),x=l.useCallback(O=>{e(RN(O))},[e]),w=l.useCallback(O=>{e(DN(O))},[e]),S=l.useCallback(({nodes:O,edges:T})=>{e(TN(O?O.map(K=>K.id):[])),e(NN(T?T.map(K=>K.id):[]))},[e]),j=l.useCallback((O,T)=>{e($N(T))},[e]),I=l.useCallback(()=>{e(SP())},[e]),_=l.useCallback(O=>{CS.set(O),O.fitView()},[]),M=l.useCallback(O=>{var K,G;const T=(K=i.current)==null?void 0:K.getBoundingClientRect();if(T){const X=(G=CS.get())==null?void 0:G.project({x:O.clientX-T.left,y:O.clientY-T.top});c.current=X}},[]),E=l.useRef(),A=l.useCallback((O,T,K)=>{E.current=O,e(LN(T.id)),e(zN())},[e]),R=l.useCallback((O,T)=>{e(yS(T))},[e]),D=l.useCallback((O,T,K)=>{var G,X;!("touches"in O)&&((G=E.current)==null?void 0:G.clientX)===O.clientX&&((X=E.current)==null?void 0:X.clientY)===O.clientY&&e(FN(T)),E.current=void 0},[e]);return _t(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(BN())}),_t(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(HN())}),_t(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(WN({cursorPosition:c.current}))}),a.jsx(VN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Hme,edgeTypes:Bme,nodes:t,edges:n,onInit:_,onMouseMove:M,onNodesChange:h,onEdgesChange:m,onEdgesDelete:x,onEdgeUpdate:R,onEdgeUpdateStart:A,onEdgeUpdateEnd:D,onNodesDelete:w,onConnectStart:g,onConnect:b,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Lhe,onSelectionChange:S,isValidConnection:d,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Wme,style:{borderRadius:p},onPaneClick:I,deleteKeyCode:Fme,selectionMode:s,children:a.jsx(Y$,{})})},Gme=me(we,e=>{const t=e.nodes.nodes,n=e.nodes.nodeTemplates;return t.some(o=>{const s=n[o.data.type];return UN(o,s)})},Ie),qme=()=>H(Gme),Kme=()=>{const e=le(),{t}=Q(),n=qme(),r=l.useCallback(()=>{e(yP())},[e]),o=l.useCallback(()=>{e(GN())},[e]);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:[a.jsx(rt,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Zi,{}),onClick:r}),n&&a.jsx(Dt,{leftIcon:a.jsx(s0,{}),onClick:o,children:t("nodes.updateAllNodes")})]})},Qme=l.memo(Kme),Xme=()=>{const e=le(),t=Q3("nodes"),{t:n}=Q();return l.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const c=JSON.parse(String(i)),d=KI.safeParse(c);if(!d.success){const{message:p}=qN(d.error,{prefix:n("nodes.workflowValidation")});t.error({error:KN(d.error)},p),e(Ht(rr({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Vx(d.data)),s.abort()}catch{e(Ht(rr({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Yme=l.memo(e=>e.error.issues[0]?a.jsx(je,{children:wS(e.error.issues[0],{prefix:null}).toString()}):a.jsx(zf,{children:e.error.issues.map((t,n)=>a.jsx(Ps,{children:a.jsx(je,{children:wS(t,{prefix:null}).toString()})},n))}));Yme.displayName="WorkflowValidationErrorContent";const Jme=()=>{const{t:e}=Q(),t=l.useRef(null),n=Xme();return a.jsx(vM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(rt,{icon:a.jsx(i0,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Zme=l.memo(Jme),ege=()=>{const{t:e}=Q(),t=le(),{isOpen:n,onOpen:r,onClose:o}=hs(),s=l.useRef(null),i=H(d=>d.nodes.nodes.length),c=l.useCallback(()=>{t(QN()),t(Ht(rr({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(rt,{icon:a.jsx(Zo,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Wf,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Aa,{}),a.jsxs(Vf,{children:[a.jsx(Oa,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Ra,{py:4,children:a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsx(je,{children:e("nodes.resetWorkflowDesc")}),a.jsx(je,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(pi,{children:[a.jsx(nl,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(nl,{colorScheme:"error",ml:3,onClick:c,children:e("common.accept")})]})]})]})]})},tge=l.memo(ege),nge=()=>{const{t:e}=Q(),t=tA(),n=l.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(rt,{icon:a.jsx(Wu,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},rge=l.memo(nge),oge=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(rge,{}),a.jsx(Zme,{}),a.jsx(tge,{})]}),sge=l.memo(oge),age=()=>a.jsx(N,{sx:{gap:2,flexDir:"column"},children:To(If,({title:e,description:t,color:n},r)=>a.jsx(Wn,{label:t,children:a.jsx(Va,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),ige=l.memo(age),lge=()=>{const{t:e}=Q(),t=le(),n=l.useCallback(()=>{t(XN())},[t]);return a.jsx(Dt,{leftIcon:a.jsx(Jee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},cge=l.memo(lge),_d={fontWeight:600},uge=me(we,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===YN.Full}},Ie),dge=De((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=hs(),s=le(),{shouldAnimateEdges:i,shouldValidateGraph:c,shouldSnapToGrid:d,shouldColorEdges:p,selectionModeIsChecked:h}=H(uge),m=l.useCallback(S=>{s(JN(S.target.checked))},[s]),g=l.useCallback(S=>{s(ZN(S.target.checked))},[s]),b=l.useCallback(S=>{s(e9(S.target.checked))},[s]),y=l.useCallback(S=>{s(t9(S.target.checked))},[s]),x=l.useCallback(S=>{s(n9(S.target.checked))},[s]),{t:w}=Q();return a.jsxs(a.Fragment,{children:[a.jsx(rt,{ref:t,"aria-label":w("nodes.workflowSettings"),tooltip:w("nodes.workflowSettings"),icon:a.jsx(GM,{}),onClick:r}),a.jsxs(vu,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Aa,{}),a.jsxs(bu,{children:[a.jsx(Oa,{children:w("nodes.workflowSettings")}),a.jsx(Rg,{}),a.jsx(Ra,{children:a.jsxs(N,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(yo,{size:"sm",children:w("parameters.general")}),a.jsx(_r,{formLabelProps:_d,onChange:g,isChecked:i,label:w("nodes.animatedEdges"),helperText:w("nodes.animatedEdgesHelp")}),a.jsx(io,{}),a.jsx(_r,{formLabelProps:_d,isChecked:d,onChange:b,label:w("nodes.snapToGrid"),helperText:w("nodes.snapToGridHelp")}),a.jsx(io,{}),a.jsx(_r,{formLabelProps:_d,isChecked:p,onChange:y,label:w("nodes.colorCodeEdges"),helperText:w("nodes.colorCodeEdgesHelp")}),a.jsx(_r,{formLabelProps:_d,isChecked:h,onChange:x,label:w("nodes.fullyContainNodes"),helperText:w("nodes.fullyContainNodesHelp")}),a.jsx(yo,{size:"sm",pt:4,children:w("common.advanced")}),a.jsx(_r,{formLabelProps:_d,isChecked:c,onChange:m,label:w("nodes.validateConnections"),helperText:w("nodes.validateConnectionsHelp")}),a.jsx(cge,{})]})})]})]})]})}),fge=l.memo(dge),pge=()=>{const e=H(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(fge,{}),e&&a.jsx(ige,{})]})},hge=l.memo(pge);function mge(){const e=le(),t=H(o=>o.nodes.nodeOpacity),{t:n}=Q(),r=l.useCallback(o=>{e(r9(o))},[e]);return a.jsx(N,{alignItems:"center",children:a.jsxs(Ny,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Ly,{children:a.jsx(zy,{})}),a.jsx($y,{})]})})}const gge=()=>{const{t:e}=Q(),{zoomIn:t,zoomOut:n,fitView:r}=Jx(),o=le(),s=H(h=>h.nodes.shouldShowMinimapPanel),i=l.useCallback(()=>{t()},[t]),c=l.useCallback(()=>{n()},[n]),d=l.useCallback(()=>{r()},[r]),p=l.useCallback(()=>{o(o9(!s))},[s,o]);return a.jsxs(Hn,{isAttached:!0,orientation:"vertical",children:[a.jsx(rt,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(use,{})}),a.jsx(rt,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:c,icon:a.jsx(cse,{})}),a.jsx(rt,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:d,icon:a.jsx(qM,{})}),a.jsx(rt,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(Bee,{})})]})},vge=l.memo(gge),bge=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(vge,{}),a.jsx(mge,{})]}),xge=l.memo(bge),yge=Ae(U$),Cge=()=>{const e=H(r=>r.nodes.shouldShowMinimapPanel),t=di("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=di("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(yge,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},wge=l.memo(Cge),Sge=()=>{const e=H(n=>n.nodes.isReady),{t}=Q();return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(So,{children:e&&a.jsxs(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(Ume,{}),a.jsx(Dhe,{}),a.jsx(Qme,{}),a.jsx(sge,{}),a.jsx(hge,{}),a.jsx(xge,{}),a.jsx(wge,{})]})}),a.jsx(So,{children:!e&&a.jsx(Ar.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(eo,{label:t("nodes.loadingNodes"),icon:dse})})})})]})},kge=l.memo(Sge),jge=()=>a.jsx(s9,{children:a.jsx(kge,{})}),_ge=l.memo(jge),Ige=()=>{const{t:e}=Q(),t=le(),{data:n}=Ef(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=a9({fixedCacheKey:"clearInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Ht({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(Ht({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Pge=()=>{const{t:e}=Q(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=Ige();return a.jsx(Dt,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},Ege=l.memo(Pge),Mge=()=>{const{t:e}=Q(),t=le(),{data:n}=Ef(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=i9({fixedCacheKey:"disableInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Ht({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(Ht({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Oge=()=>{const{t:e}=Q(),t=le(),{data:n}=Ef(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=l9({fixedCacheKey:"enableInvocationCache"}),i=l.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Ht({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(Ht({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Age=()=>{const{t:e}=Q(),{data:t}=Ef(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Oge(),{disableInvocationCache:s,isDisabled:i,isLoading:c}=Mge();return t!=null&&t.enabled?a.jsx(Dt,{isDisabled:i,isLoading:c,onClick:s,children:e("invocationCache.disable")}):a.jsx(Dt,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},Rge=l.memo(Age),Dge=({children:e,...t})=>a.jsx(W3,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),eR=l.memo(Dge),Tge={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},Nge=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(H3,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Tge,...r,children:[a.jsx(V3,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(U3,{children:t})]}),Ca=l.memo(Nge),$ge=()=>{const{t:e}=Q(),{data:t}=Ef(void 0);return a.jsxs(eR,{children:[a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(Ca,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(Hn,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(Ege,{}),a.jsx(Rge,{})]})]})},Lge=l.memo($ge),tR=e=>{const t=H(c=>c.system.isConnected),[n,{isLoading:r}]=Gx(),o=le(),{t:s}=Q();return{cancelQueueItem:l.useCallback(async()=>{try{await n(e).unwrap(),o(Ht({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Ht({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},nR=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),oI={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},zge=({status:e})=>{const{t}=Q();return a.jsx(Va,{colorScheme:oI[e].colorScheme,children:t(oI[e].translationKey)})},Fge=l.memo(zge),Bge=e=>{const t=H(d=>d.system.isConnected),{isCanceled:n}=c9({batch_id:e},{selectFromResult:({data:d})=>d?{isCanceled:(d==null?void 0:d.in_progress)===0&&(d==null?void 0:d.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=u9({fixedCacheKey:"cancelByBatchIds"}),s=le(),{t:i}=Q();return{cancelBatch:l.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(Ht({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(Ht({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},Hge=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=Q(),{cancelBatch:s,isLoading:i,isCanceled:c}=Bge(n),{cancelQueueItem:d,isLoading:p}=tR(r),{data:h}=d9(r),m=l.useMemo(()=>{if(!h)return o("common.loading");if(!h.completed_at||!h.started_at)return o(`queue.${h.status}`);const g=nR(h.started_at,h.completed_at);return h.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[h,o]);return a.jsxs(N,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(N,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(jh,{label:o("queue.status"),data:m}),a.jsx(jh,{label:o("queue.item"),data:r}),a.jsx(jh,{label:o("queue.batch"),data:n}),a.jsx(jh,{label:o("queue.session"),data:t}),a.jsxs(Hn,{size:"xs",orientation:"vertical",children:[a.jsx(Dt,{onClick:d,isLoading:p,isDisabled:h?["canceled","completed","failed"].includes(h.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(ku,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Dt,{onClick:s,isLoading:i,isDisabled:c,"aria-label":o("queue.cancelBatch"),icon:a.jsx(ku,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(h==null?void 0:h.error)&&a.jsxs(N,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(yo,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:h.error})]}),a.jsx(N,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:h?a.jsx(cc,{children:a.jsx(tl,{label:"Queue Item",data:h})}):a.jsx(Ci,{opacity:.5})})]})},Wge=l.memo(Hge),jh=({label:e,data:t})=>a.jsxs(N,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(yo,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(je,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),Sa={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},sI={bg:"base.300",_dark:{bg:"base.750"}},Vge={_hover:sI,"&[aria-selected='true']":sI},Uge=({index:e,item:t,context:n})=>{const{t:r}=Q(),o=l.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=tR(t.item_id),c=l.useCallback(m=>{m.stopPropagation(),s()},[s]),d=l.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=l.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${nR(t.started_at,t.completed_at)}s`,[t]),h=l.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(N,{flexDir:"column","aria-selected":d,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Vge,"data-testid":"queue-item",children:[a.jsxs(N,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(N,{w:Sa.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(je,{variant:"subtext",children:e+1})}),a.jsx(N,{w:Sa.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Fge,{status:t.status})}),a.jsx(N,{w:Sa.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(N,{w:Sa.batchId,flexShrink:0,children:a.jsx(je,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(N,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(N,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(m=>m.node_path!=="metadata_accumulator").map(({node_path:m,field_name:g,value:b})=>a.jsxs(je,{as:"span",children:[a.jsxs(je,{as:"span",fontWeight:600,children:[m,".",g]}),": ",b]},`${t.item_id}.${m}.${g}.${b}`))})}),a.jsx(N,{alignItems:"center",w:Sa.actions,pe:3,children:a.jsx(Hn,{size:"xs",variant:"ghost",children:a.jsx(rt,{onClick:c,isDisabled:h,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(ku,{})})})})]}),a.jsx(Af,{in:d,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Wge,{queueItemDTO:t})})]})},Gge=l.memo(Uge),qge=l.memo(De((e,t)=>a.jsx(N,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Kge=l.memo(qge),Qge=()=>{const{t:e}=Q();return a.jsxs(N,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(N,{w:Sa.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(je,{variant:"subtext",children:"#"})}),a.jsx(N,{ps:.5,w:Sa.statusBadge,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.status")})}),a.jsx(N,{ps:.5,w:Sa.time,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.time")})}),a.jsx(N,{ps:.5,w:Sa.batchId,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.batch")})}),a.jsx(N,{ps:.5,w:Sa.fieldValues,alignItems:"center",children:a.jsx(je,{variant:"subtext",children:e("queue.batchFieldValues")})})]})},Xge=l.memo(Qge),Yge={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Jge=me(we,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},Ie),Zge=(e,t)=>t.item_id,e0e={List:Kge},t0e=(e,t,n)=>a.jsx(Gge,{index:e,item:t,context:n}),n0e=()=>{const{listCursor:e,listPriority:t}=H(Jge),n=le(),r=l.useRef(null),[o,s]=l.useState(null),[i,c]=y2(Yge),{t:d}=Q();l.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=c())==null?void 0:j.destroy()}},[o,i,c]);const{data:p,isLoading:h}=f9({cursor:e,priority:t}),m=l.useMemo(()=>p?p9.getSelectors().selectAll(p):[],[p]),g=l.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=m[m.length-1];S&&(n(qx(S.item_id)),n(Kx(S.priority)))},[n,p==null?void 0:p.has_more,m]),[b,y]=l.useState([]),x=l.useCallback(S=>{y(j=>j.includes(S)?j.filter(I=>I!==S):[...j,S])},[]),w=l.useMemo(()=>({openQueueItems:b,toggleQueueItem:x}),[b,x]);return h?a.jsx(jre,{}):m.length?a.jsxs(N,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Xge,{}),a.jsx(N,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx($oe,{data:m,endReached:g,scrollerRef:s,itemContent:t0e,computeItemKey:Zge,components:e0e,context:w})})]}):a.jsx(N,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(yo,{color:"base.400",_dark:{color:"base.500"},children:d("queue.queueEmpty")})})},r0e=l.memo(n0e),o0e=()=>{const{data:e}=Ha(),{t}=Q();return a.jsxs(eR,{"data-testid":"queue-status",children:[a.jsx(Ca,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(Ca,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(Ca,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(Ca,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(Ca,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(Ca,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},s0e=l.memo(o0e);function a0e(e){return Ye({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const i0e=()=>{const e=le(),{t}=Q(),n=H(d=>d.system.isConnected),[r,{isLoading:o}]=pP({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Ha(void 0,{selectFromResult:({data:d})=>d?{finishedCount:d.queue.completed+d.queue.canceled+d.queue.failed}:{finishedCount:0}}),i=l.useCallback(async()=>{if(s)try{const d=await r().unwrap();e(Ht({title:t("queue.pruneSucceeded",{item_count:d.deleted}),status:"success"})),e(qx(void 0)),e(Kx(void 0))}catch{e(Ht({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),c=l.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:c}},l0e=({asIconButton:e})=>{const{t}=Q(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=i0e();return a.jsx(lc,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(a0e,{}),onClick:n,colorScheme:"blue"})},c0e=l.memo(l0e),u0e=()=>{const e=Pn("pauseQueue").isFeatureEnabled,t=Pn("resumeQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(Hn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(L8,{}):a.jsx(a.Fragment,{}),e?a.jsx(A8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(Hn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(c0e,{}),a.jsx(B2,{})]})]})},d0e=l.memo(u0e),f0e=()=>{const e=Pn("invocationCache").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsx(d0e,{}),a.jsx(s0e,{}),e&&a.jsx(Lge,{})]}),a.jsx(Le,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(r0e,{})})]})},p0e=l.memo(f0e),h0e=()=>a.jsx(p0e,{}),m0e=l.memo(h0e),g0e=()=>a.jsx(FA,{}),v0e=l.memo(g0e);var kx={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=SS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=SS;e.exports=r.Konva})(kx,kx.exports);var b0e=kx.exports;const Cf=Sf(b0e);var rR={exports:{}};/** + * @license React + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var x0e=function(t){var n={},r=l,o=Ih,s=Object.assign;function i(u){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;vce||k[L]!==P[ce]){var be=` +`+k[L].replace(" at new "," at ");return u.displayName&&be.includes("")&&(be=be.replace("",u.displayName)),be}while(1<=L&&0<=ce);break}}}finally{tn=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?Ut(u):""}var an=Object.prototype.hasOwnProperty,Yt=[],Ve=-1;function Ct(u){return{current:u}}function Ft(u){0>Ve||(u.current=Yt[Ve],Yt[Ve]=null,Ve--)}function Qt(u,f){Ve++,Yt[Ve]=u.current,u.current=f}var Ln={},Jt=Ct(Ln),yn=Ct(!1),hn=Ln;function Hr(u,f){var v=u.type.contextTypes;if(!v)return Ln;var C=u.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===f)return C.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in v)k[P]=f[P];return C&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=f,u.__reactInternalMemoizedMaskedChildContext=k),k}function pr(u){return u=u.childContextTypes,u!=null}function Tt(){Ft(yn),Ft(Jt)}function zn(u,f,v){if(Jt.current!==Ln)throw Error(i(168));Qt(Jt,f),Qt(yn,v)}function Gn(u,f,v){var C=u.stateNode;if(f=f.childContextTypes,typeof C.getChildContext!="function")return v;C=C.getChildContext();for(var k in C)if(!(k in f))throw Error(i(108,R(u)||"Unknown",k));return s({},v,C)}function hr(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Ln,hn=Jt.current,Qt(Jt,u),Qt(yn,yn.current),!0}function Pr(u,f,v){var C=u.stateNode;if(!C)throw Error(i(169));v?(u=Gn(u,f,hn),C.__reactInternalMemoizedMergedChildContext=u,Ft(yn),Ft(Jt),Qt(Jt,u)):Ft(yn),Qt(yn,v)}var er=Math.clz32?Math.clz32:An,qn=Math.log,Cn=Math.LN2;function An(u){return u>>>=0,u===0?32:31-(qn(u)/Cn|0)|0}var Rn=64,jn=4194304;function Fn(u){switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Zt(u,f){var v=u.pendingLanes;if(v===0)return 0;var C=0,k=u.suspendedLanes,P=u.pingedLanes,L=v&268435455;if(L!==0){var ce=L&~k;ce!==0?C=Fn(ce):(P&=L,P!==0&&(C=Fn(P)))}else L=v&~k,L!==0?C=Fn(L):P!==0&&(C=Fn(P));if(C===0)return 0;if(f!==0&&f!==C&&!(f&k)&&(k=C&-C,P=f&-f,k>=P||k===16&&(P&4194240)!==0))return f;if(C&4&&(C|=v&16),f=u.entangledLanes,f!==0)for(u=u.entanglements,f&=C;0v;v++)f.push(u);return f}function Bt(u,f,v){u.pendingLanes|=f,f!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,f=31-er(f),u[f]=v}function Ue(u,f){var v=u.pendingLanes&~f;u.pendingLanes=f,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=f,u.mutableReadLanes&=f,u.entangledLanes&=f,f=u.entanglements;var C=u.eventTimes;for(u=u.expirationTimes;0>=L,k-=L,rs=1<<32-er(f)+k|v<Dn?(so=sn,sn=null):so=sn.sibling;var Tn=ut(ve,sn,Ce[Dn],dt);if(Tn===null){sn===null&&(sn=so);break}u&&sn&&Tn.alternate===null&&f(ve,sn),fe=P(Tn,fe,Dn),un===null?Wt=Tn:un.sibling=Tn,un=Tn,sn=so}if(Dn===Ce.length)return v(ve,sn),mr&&xl(ve,Dn),Wt;if(sn===null){for(;DnDn?(so=sn,sn=null):so=sn.sibling;var Fi=ut(ve,sn,Tn.value,dt);if(Fi===null){sn===null&&(sn=so);break}u&&sn&&Fi.alternate===null&&f(ve,sn),fe=P(Fi,fe,Dn),un===null?Wt=Fi:un.sibling=Fi,un=Fi,sn=so}if(Tn.done)return v(ve,sn),mr&&xl(ve,Dn),Wt;if(sn===null){for(;!Tn.done;Dn++,Tn=Ce.next())Tn=on(ve,Tn.value,dt),Tn!==null&&(fe=P(Tn,fe,Dn),un===null?Wt=Tn:un.sibling=Tn,un=Tn);return mr&&xl(ve,Dn),Wt}for(sn=C(ve,sn);!Tn.done;Dn++,Tn=Ce.next())Tn=fr(sn,ve,Dn,Tn.value,dt),Tn!==null&&(u&&Tn.alternate!==null&&sn.delete(Tn.key===null?Dn:Tn.key),fe=P(Tn,fe,Dn),un===null?Wt=Tn:un.sibling=Tn,un=Tn);return u&&sn.forEach(function(qR){return f(ve,qR)}),mr&&xl(ve,Dn),Wt}function Ja(ve,fe,Ce,dt){if(typeof Ce=="object"&&Ce!==null&&Ce.type===h&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case d:e:{for(var Wt=Ce.key,un=fe;un!==null;){if(un.key===Wt){if(Wt=Ce.type,Wt===h){if(un.tag===7){v(ve,un.sibling),fe=k(un,Ce.props.children),fe.return=ve,ve=fe;break e}}else if(un.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===I&&kC(Wt)===un.type){v(ve,un.sibling),fe=k(un,Ce.props),fe.ref=ed(ve,un,Ce),fe.return=ve,ve=fe;break e}v(ve,un);break}else f(ve,un);un=un.sibling}Ce.type===h?(fe=_l(Ce.props.children,ve.mode,dt,Ce.key),fe.return=ve,ve=fe):(dt=Fp(Ce.type,Ce.key,Ce.props,null,ve.mode,dt),dt.ref=ed(ve,fe,Ce),dt.return=ve,ve=dt)}return L(ve);case p:e:{for(un=Ce.key;fe!==null;){if(fe.key===un)if(fe.tag===4&&fe.stateNode.containerInfo===Ce.containerInfo&&fe.stateNode.implementation===Ce.implementation){v(ve,fe.sibling),fe=k(fe,Ce.children||[]),fe.return=ve,ve=fe;break e}else{v(ve,fe);break}else f(ve,fe);fe=fe.sibling}fe=Fv(Ce,ve.mode,dt),fe.return=ve,ve=fe}return L(ve);case I:return un=Ce._init,Ja(ve,fe,un(Ce._payload),dt)}if(Z(Ce))return tr(ve,fe,Ce,dt);if(E(Ce))return Ho(ve,fe,Ce,dt);hp(ve,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,fe!==null&&fe.tag===6?(v(ve,fe.sibling),fe=k(fe,Ce),fe.return=ve,ve=fe):(v(ve,fe),fe=zv(Ce,ve.mode,dt),fe.return=ve,ve=fe),L(ve)):v(ve,fe)}return Ja}var mc=jC(!0),_C=jC(!1),td={},ys=Ct(td),nd=Ct(td),gc=Ct(td);function ma(u){if(u===td)throw Error(i(174));return u}function Z0(u,f){Qt(gc,f),Qt(nd,u),Qt(ys,td),u=V(f),Ft(ys),Qt(ys,u)}function vc(){Ft(ys),Ft(nd),Ft(gc)}function IC(u){var f=ma(gc.current),v=ma(ys.current);f=oe(v,u.type,f),v!==f&&(Qt(nd,u),Qt(ys,f))}function ev(u){nd.current===u&&(Ft(ys),Ft(nd))}var wr=Ct(0);function mp(u){for(var f=u;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Br(v)||ts(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var tv=[];function nv(){for(var u=0;uv?v:4,u(!0);var C=rv.transition;rv.transition={};try{u(!1),f()}finally{Oe=v,rv.transition=C}}function UC(){return Cs().memoizedState}function yR(u,f,v){var C=$i(u);if(v={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null},GC(u))qC(f,v);else if(v=gC(u,f,v,C),v!==null){var k=bo();ws(v,u,C,k),KC(v,f,C)}}function CR(u,f,v){var C=$i(u),k={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null};if(GC(u))qC(f,k);else{var P=u.alternate;if(u.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var L=f.lastRenderedState,ce=P(L,v);if(k.hasEagerState=!0,k.eagerState=ce,dr(ce,L)){var be=f.interleaved;be===null?(k.next=k,Q0(f)):(k.next=be.next,be.next=k),f.interleaved=k;return}}catch{}finally{}v=gC(u,f,k,C),v!==null&&(k=bo(),ws(v,u,C,k),KC(v,f,C))}}function GC(u){var f=u.alternate;return u===Sr||f!==null&&f===Sr}function qC(u,f){rd=vp=!0;var v=u.pending;v===null?f.next=f:(f.next=v.next,v.next=f),u.pending=f}function KC(u,f,v){if(v&4194240){var C=f.lanes;C&=u.pendingLanes,v|=C,f.lanes=v,Be(u,v)}}var yp={readContext:xs,useCallback:mo,useContext:mo,useEffect:mo,useImperativeHandle:mo,useInsertionEffect:mo,useLayoutEffect:mo,useMemo:mo,useReducer:mo,useRef:mo,useState:mo,useDebugValue:mo,useDeferredValue:mo,useTransition:mo,useMutableSource:mo,useSyncExternalStore:mo,useId:mo,unstable_isNewReconciler:!1},wR={readContext:xs,useCallback:function(u,f){return ga().memoizedState=[u,f===void 0?null:f],u},useContext:xs,useEffect:$C,useImperativeHandle:function(u,f,v){return v=v!=null?v.concat([u]):null,bp(4194308,4,FC.bind(null,f,u),v)},useLayoutEffect:function(u,f){return bp(4194308,4,u,f)},useInsertionEffect:function(u,f){return bp(4,2,u,f)},useMemo:function(u,f){var v=ga();return f=f===void 0?null:f,u=u(),v.memoizedState=[u,f],u},useReducer:function(u,f,v){var C=ga();return f=v!==void 0?v(f):f,C.memoizedState=C.baseState=f,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:f},C.queue=u,u=u.dispatch=yR.bind(null,Sr,u),[C.memoizedState,u]},useRef:function(u){var f=ga();return u={current:u},f.memoizedState=u},useState:TC,useDebugValue:uv,useDeferredValue:function(u){return ga().memoizedState=u},useTransition:function(){var u=TC(!1),f=u[0];return u=xR.bind(null,u[1]),ga().memoizedState=u,[f,u]},useMutableSource:function(){},useSyncExternalStore:function(u,f,v){var C=Sr,k=ga();if(mr){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),oo===null)throw Error(i(349));Cl&30||MC(C,f,v)}k.memoizedState=v;var P={value:v,getSnapshot:f};return k.queue=P,$C(AC.bind(null,C,P,u),[u]),C.flags|=2048,ad(9,OC.bind(null,C,P,v,f),void 0,null),v},useId:function(){var u=ga(),f=oo.identifierPrefix;if(mr){var v=ho,C=rs;v=(C&~(1<<32-er(C)-1)).toString(32)+v,f=":"+f+"R"+v,v=od++,0Ov&&(f.flags|=128,C=!0,cd(k,!1),f.lanes=4194304)}else{if(!C)if(u=mp(P),u!==null){if(f.flags|=128,C=!0,u=u.updateQueue,u!==null&&(f.updateQueue=u,f.flags|=4),cd(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!mr)return go(f),null}else 2*Ze()-k.renderingStartTime>Ov&&v!==1073741824&&(f.flags|=128,C=!0,cd(k,!1),f.lanes=4194304);k.isBackwards?(P.sibling=f.child,f.child=P):(u=k.last,u!==null?u.sibling=P:f.child=P,k.last=P)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Ze(),f.sibling=null,u=wr.current,Qt(wr,C?u&1|2:u&1),f):(go(f),null);case 22:case 23:return Nv(),v=f.memoizedState!==null,u!==null&&u.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?ss&1073741824&&(go(f),ee&&f.subtreeFlags&6&&(f.flags|=8192)):go(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function MR(u,f){switch(B0(f),f.tag){case 1:return pr(f.type)&&Tt(),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return vc(),Ft(yn),Ft(Jt),nv(),u=f.flags,u&65536&&!(u&128)?(f.flags=u&-65537|128,f):null;case 5:return ev(f),null;case 13:if(Ft(wr),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(i(340));fc()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return Ft(wr),null;case 4:return vc(),null;case 10:return q0(f.type._context),null;case 22:case 23:return Nv(),null;case 24:return null;default:return null}}var jp=!1,vo=!1,OR=typeof WeakSet=="function"?WeakSet:Set,bt=null;function xc(u,f){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){gr(u,f,C)}else v.current=null}function xv(u,f,v){try{v()}catch(C){gr(u,f,C)}}var pw=!1;function AR(u,f){for(ne(u.containerInfo),bt=f;bt!==null;)if(u=bt,f=u.child,(u.subtreeFlags&1028)!==0&&f!==null)f.return=u,bt=f;else for(;bt!==null;){u=bt;try{var v=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var C=v.memoizedProps,k=v.memoizedState,P=u.stateNode,L=P.getSnapshotBeforeUpdate(u.elementType===u.type?C:Gs(u.type,C),k);P.__reactInternalSnapshotBeforeUpdate=L}break;case 3:ee&&dn(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ce){gr(u,u.return,ce)}if(f=u.sibling,f!==null){f.return=u.return,bt=f;break}bt=u.return}return v=pw,pw=!1,v}function ud(u,f,v){var C=f.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var k=C=C.next;do{if((k.tag&u)===u){var P=k.destroy;k.destroy=void 0,P!==void 0&&xv(f,v,P)}k=k.next}while(k!==C)}}function _p(u,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&u)===u){var C=v.create;v.destroy=C()}v=v.next}while(v!==f)}}function yv(u){var f=u.ref;if(f!==null){var v=u.stateNode;switch(u.tag){case 5:u=te(v);break;default:u=v}typeof f=="function"?f(u):f.current=u}}function hw(u){var f=u.alternate;f!==null&&(u.alternate=null,hw(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&Pe(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function mw(u){return u.tag===5||u.tag===3||u.tag===4}function gw(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||mw(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function Cv(u,f,v){var C=u.tag;if(C===5||C===6)u=u.stateNode,f?En(v,u,f):lt(v,u);else if(C!==4&&(u=u.child,u!==null))for(Cv(u,f,v),u=u.sibling;u!==null;)Cv(u,f,v),u=u.sibling}function wv(u,f,v){var C=u.tag;if(C===5||C===6)u=u.stateNode,f?Qe(v,u,f):ke(v,u);else if(C!==4&&(u=u.child,u!==null))for(wv(u,f,v),u=u.sibling;u!==null;)wv(u,f,v),u=u.sibling}var uo=null,qs=!1;function ba(u,f,v){for(v=v.child;v!==null;)Sv(u,f,v),v=v.sibling}function Sv(u,f,v){if(_n&&typeof _n.onCommitFiberUnmount=="function")try{_n.onCommitFiberUnmount(cr,v)}catch{}switch(v.tag){case 5:vo||xc(v,f);case 6:if(ee){var C=uo,k=qs;uo=null,ba(u,f,v),uo=C,qs=k,uo!==null&&(qs?ct(uo,v.stateNode):Te(uo,v.stateNode))}else ba(u,f,v);break;case 18:ee&&uo!==null&&(qs?Ge(uo,v.stateNode):wt(uo,v.stateNode));break;case 4:ee?(C=uo,k=qs,uo=v.stateNode.containerInfo,qs=!0,ba(u,f,v),uo=C,qs=k):(J&&(C=v.stateNode.containerInfo,k=ir(C),Mn(C,k)),ba(u,f,v));break;case 0:case 11:case 14:case 15:if(!vo&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,L=P.destroy;P=P.tag,L!==void 0&&(P&2||P&4)&&xv(v,f,L),k=k.next}while(k!==C)}ba(u,f,v);break;case 1:if(!vo&&(xc(v,f),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ce){gr(v,f,ce)}ba(u,f,v);break;case 21:ba(u,f,v);break;case 22:v.mode&1?(vo=(C=vo)||v.memoizedState!==null,ba(u,f,v),vo=C):ba(u,f,v);break;default:ba(u,f,v)}}function vw(u){var f=u.updateQueue;if(f!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new OR),f.forEach(function(C){var k=BR.bind(null,u,C);v.has(C)||(v.add(C),C.then(k,k))})}}function Ks(u,f){var v=f.deletions;if(v!==null)for(var C=0;C";case Pp:return":has("+(_v(u)||"")+")";case Ep:return'[role="'+u.value+'"]';case Op:return'"'+u.value+'"';case Mp:return'[data-testname="'+u.value+'"]';default:throw Error(i(365))}}function Sw(u,f){var v=[];u=[u,0];for(var C=0;Ck&&(k=L),C&=~P}if(C=k,C=Ze()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*DR(C/1960))-C,10u?16:u,Ni===null)var C=!1;else{if(u=Ni,Ni=null,Np=0,gn&6)throw Error(i(331));var k=gn;for(gn|=4,bt=u.current;bt!==null;){var P=bt,L=P.child;if(bt.flags&16){var ce=P.deletions;if(ce!==null){for(var be=0;beZe()-Mv?Sl(u,0):Ev|=v),Bo(u,f)}function Aw(u,f){f===0&&(u.mode&1?(f=jn,jn<<=1,!(jn&130023424)&&(jn=4194304)):f=1);var v=bo();u=ha(u,f),u!==null&&(Bt(u,f,v),Bo(u,v))}function FR(u){var f=u.memoizedState,v=0;f!==null&&(v=f.retryLane),Aw(u,v)}function BR(u,f){var v=0;switch(u.tag){case 13:var C=u.stateNode,k=u.memoizedState;k!==null&&(v=k.retryLane);break;case 19:C=u.stateNode;break;default:throw Error(i(314))}C!==null&&C.delete(f),Aw(u,v)}var Rw;Rw=function(u,f,v){if(u!==null)if(u.memoizedProps!==f.pendingProps||yn.current)zo=!0;else{if(!(u.lanes&v)&&!(f.flags&128))return zo=!1,PR(u,f,v);zo=!!(u.flags&131072)}else zo=!1,mr&&f.flags&1048576&&uC(f,jo,f.index);switch(f.lanes=0,f.tag){case 2:var C=f.type;wp(u,f),u=f.pendingProps;var k=Hr(f,Jt.current);hc(f,v),k=sv(null,f,C,u,k,v);var P=av();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,pr(C)?(P=!0,hr(f)):P=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,X0(f),k.updater=pp,f.stateNode=k,k._reactInternals=f,J0(f,C,u,v),f=hv(null,f,C,!0,P,v)):(f.tag=0,mr&&P&&F0(f),Po(null,f,k,v),f=f.child),f;case 16:C=f.elementType;e:{switch(wp(u,f),u=f.pendingProps,k=C._init,C=k(C._payload),f.type=C,k=f.tag=WR(C),u=Gs(C,u),k){case 0:f=pv(null,f,C,u,v);break e;case 1:f=sw(null,f,C,u,v);break e;case 11:f=ew(null,f,C,u,v);break e;case 14:f=tw(null,f,C,Gs(C.type,u),v);break e}throw Error(i(306,C,""))}return f;case 0:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),pv(u,f,C,k,v);case 1:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),sw(u,f,C,k,v);case 3:e:{if(aw(f),u===null)throw Error(i(387));C=f.pendingProps,P=f.memoizedState,k=P.element,vC(u,f),fp(f,C,null,v);var L=f.memoizedState;if(C=L.element,ge&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){k=bc(Error(i(423)),f),f=iw(u,f,C,v,k);break e}else if(C!==k){k=bc(Error(i(424)),f),f=iw(u,f,C,v,k);break e}else for(ge&&(bs=ue(f.stateNode.containerInfo),os=f,mr=!0,Us=null,Zu=!1),v=_C(f,null,C,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(fc(),C===k){f=Xa(u,f,v);break e}Po(u,f,C,v)}f=f.child}return f;case 5:return IC(f),u===null&&W0(f),C=f.type,k=f.pendingProps,P=u!==null?u.memoizedProps:null,L=k.children,$(C,k)?L=null:P!==null&&$(C,P)&&(f.flags|=32),ow(u,f),Po(u,f,L,v),f.child;case 6:return u===null&&W0(f),null;case 13:return lw(u,f,v);case 4:return Z0(f,f.stateNode.containerInfo),C=f.pendingProps,u===null?f.child=mc(f,null,C,v):Po(u,f,C,v),f.child;case 11:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),ew(u,f,C,k,v);case 7:return Po(u,f,f.pendingProps,v),f.child;case 8:return Po(u,f,f.pendingProps.children,v),f.child;case 12:return Po(u,f,f.pendingProps.children,v),f.child;case 10:e:{if(C=f.type._context,k=f.pendingProps,P=f.memoizedProps,L=k.value,mC(f,C,L),P!==null)if(dr(P.value,L)){if(P.children===k.children&&!yn.current){f=Xa(u,f,v);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var ce=P.dependencies;if(ce!==null){L=P.child;for(var be=ce.firstContext;be!==null;){if(be.context===C){if(P.tag===1){be=Qa(-1,v&-v),be.tag=2;var We=P.updateQueue;if(We!==null){We=We.shared;var xt=We.pending;xt===null?be.next=be:(be.next=xt.next,xt.next=be),We.pending=be}}P.lanes|=v,be=P.alternate,be!==null&&(be.lanes|=v),K0(P.return,v,f),ce.lanes|=v;break}be=be.next}}else if(P.tag===10)L=P.type===f.type?null:P.child;else if(P.tag===18){if(L=P.return,L===null)throw Error(i(341));L.lanes|=v,ce=L.alternate,ce!==null&&(ce.lanes|=v),K0(L,v,f),L=P.sibling}else L=P.child;if(L!==null)L.return=P;else for(L=P;L!==null;){if(L===f){L=null;break}if(P=L.sibling,P!==null){P.return=L.return,L=P;break}L=L.return}P=L}Po(u,f,k.children,v),f=f.child}return f;case 9:return k=f.type,C=f.pendingProps.children,hc(f,v),k=xs(k),C=C(k),f.flags|=1,Po(u,f,C,v),f.child;case 14:return C=f.type,k=Gs(C,f.pendingProps),k=Gs(C.type,k),tw(u,f,C,k,v);case 15:return nw(u,f,f.type,f.pendingProps,v);case 17:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Gs(C,k),wp(u,f),f.tag=1,pr(C)?(u=!0,hr(f)):u=!1,hc(f,v),wC(f,C,k),J0(f,C,k,v),hv(null,f,C,!0,u,v);case 19:return uw(u,f,v);case 22:return rw(u,f,v)}throw Error(i(156,f.tag))};function Dw(u,f){return Ne(u,f)}function HR(u,f,v,C){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ss(u,f,v,C){return new HR(u,f,v,C)}function Lv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function WR(u){if(typeof u=="function")return Lv(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===j)return 14}return 2}function zi(u,f){var v=u.alternate;return v===null?(v=Ss(u.tag,f,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=f,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&14680064,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,f=u.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function Fp(u,f,v,C,k,P){var L=2;if(C=u,typeof u=="function")Lv(u)&&(L=1);else if(typeof u=="string")L=5;else e:switch(u){case h:return _l(v.children,k,P,f);case m:L=8,k|=8;break;case g:return u=Ss(12,v,f,k|2),u.elementType=g,u.lanes=P,u;case w:return u=Ss(13,v,f,k),u.elementType=w,u.lanes=P,u;case S:return u=Ss(19,v,f,k),u.elementType=S,u.lanes=P,u;case _:return Bp(v,k,P,f);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case b:L=10;break e;case y:L=9;break e;case x:L=11;break e;case j:L=14;break e;case I:L=16,C=null;break e}throw Error(i(130,u==null?u:typeof u,""))}return f=Ss(L,v,f,k),f.elementType=u,f.type=C,f.lanes=P,f}function _l(u,f,v,C){return u=Ss(7,u,C,f),u.lanes=v,u}function Bp(u,f,v,C){return u=Ss(22,u,C,f),u.elementType=_,u.lanes=v,u.stateNode={isHidden:!1},u}function zv(u,f,v){return u=Ss(6,u,null,f),u.lanes=v,u}function Fv(u,f,v){return f=Ss(4,u.children!==null?u.children:[],u.key,f),f.lanes=v,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}function VR(u,f,v,C,k){this.tag=f,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=W,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=St(0),this.expirationTimes=St(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=St(0),this.identifierPrefix=C,this.onRecoverableError=k,ge&&(this.mutableSourceEagerHydrationData=null)}function Tw(u,f,v,C,k,P,L,ce,be){return u=new VR(u,f,v,ce,be),f===1?(f=1,P===!0&&(f|=8)):f=0,P=Ss(3,null,null,f),u.current=P,P.stateNode=u,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},X0(P),u}function Nw(u){if(!u)return Ln;u=u._reactInternals;e:{if(D(u)!==u||u.tag!==1)throw Error(i(170));var f=u;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(pr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(u.tag===1){var v=u.type;if(pr(v))return Gn(u,v,f)}return f}function $w(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(i(188)):(u=Object.keys(u).join(","),Error(i(268,u)));return u=K(f),u===null?null:u.stateNode}function Lw(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v=We&&P>=on&&k<=xt&&L<=ut){u.splice(f,1);break}else if(C!==We||v.width!==be.width||utL){if(!(P!==on||v.height!==be.height||xtk)){We>C&&(be.width+=We-C,be.x=C),xtP&&(be.height+=on-P,be.y=P),utv&&(v=L)),L ")+` + +No matching component was found for: + `)+u.join(" > ")}return null},n.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return te(u.child.stateNode);default:return u.child.stateNode}},n.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:UR,findFiberByHostInstance:u.findFiberByHostInstance||GR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{cr=f.inject(u),_n=f}catch{}u=!!f.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,f,v,C){if(!Je)throw Error(i(363));u=Iv(u,f);var k=At(u,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(u,f){var v=f._getVersion;v=v(f._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[f,v]:u.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(u,f){var v=Oe;try{return Oe=u,f()}finally{Oe=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,f,v,C){var k=f.current,P=bo(),L=$i(k);return v=Nw(v),f.context===null?f.context=v:f.pendingContext=v,f=Qa(P,L),f.payload={element:u},C=C===void 0?null:C,C!==null&&(f.callback=C),u=Di(k,f,L),u!==null&&(ws(u,k,L,P),dp(u,k,L)),L},n};rR.exports=x0e;var y0e=rR.exports;const C0e=Sf(y0e);var oR={exports:{}},dc={};/** + * @license React + * react-reconciler-constants.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */dc.ConcurrentRoot=1;dc.ContinuousEventPriority=4;dc.DefaultEventPriority=16;dc.DiscreteEventPriority=1;dc.IdleEventPriority=536870912;dc.LegacyRoot=0;oR.exports=dc;var sR=oR.exports;const aI={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let iI=!1,lI=!1;const iC=".react-konva-event",w0e=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. +Position of a node will be changed during drag&drop, so you should update state of the react app as well. +Consider to add onDragMove or onDragEnd events. +For more info see: https://github.com/konvajs/react-konva/issues/256 +`,S0e=`ReactKonva: You are using "zIndex" attribute for a Konva node. +react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. +For more info see: https://github.com/konvajs/react-konva/issues/194 +`,k0e={};function z0(e,t,n=k0e){if(!iI&&"zIndex"in t&&(console.warn(S0e),iI=!0),!lI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(w0e),lI=!0)}for(var s in n)if(!aI[s]){var i=s.slice(0,2)==="on",c=n[s]!==t[s];if(i&&c){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e.off(d,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var h=t._useStrictMode,m={},g=!1;const b={};for(var s in t)if(!aI[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t[s]&&(b[d]=t[s])}!i&&(t[s]!==n[s]||h&&t[s]!==e.getAttr(s))&&(g=!0,m[s]=t[s])}g&&(e.setAttrs(m),bl(e));for(var d in b)e.on(d+iC,b[d])}function bl(e){if(!h9.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const aR={},j0e={};Cf.Node.prototype._applyProps=z0;function _0e(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),bl(e)}function I0e(e,t,n){let r=Cf[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=Cf.Group);const o={},s={};for(var i in t){var c=i.slice(0,2)==="on";c?s[i]=t[i]:o[i]=t[i]}const d=new r(o);return z0(d,s),d}function P0e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function E0e(e,t,n){return!1}function M0e(e){return e}function O0e(){return null}function A0e(){return null}function R0e(e,t,n,r){return j0e}function D0e(){}function T0e(e){}function N0e(e,t){return!1}function $0e(){return aR}function L0e(){return aR}const z0e=setTimeout,F0e=clearTimeout,B0e=-1;function H0e(e,t){return!1}const W0e=!1,V0e=!0,U0e=!0;function G0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function q0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function iR(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),bl(e)}function K0e(e,t,n){iR(e,t,n)}function Q0e(e,t){t.destroy(),t.off(iC),bl(e)}function X0e(e,t){t.destroy(),t.off(iC),bl(e)}function Y0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function J0e(e,t,n){}function Z0e(e,t,n,r,o){z0(e,o,r)}function eve(e){e.hide(),bl(e)}function tve(e){}function nve(e,t){(t.visible==null||t.visible)&&e.show()}function rve(e,t){}function ove(e){}function sve(){}const ave=()=>sR.DefaultEventPriority,ive=Object.freeze(Object.defineProperty({__proto__:null,appendChild:G0e,appendChildToContainer:q0e,appendInitialChild:_0e,cancelTimeout:F0e,clearContainer:ove,commitMount:J0e,commitTextUpdate:Y0e,commitUpdate:Z0e,createInstance:I0e,createTextInstance:P0e,detachDeletedInstance:sve,finalizeInitialChildren:E0e,getChildHostContext:L0e,getCurrentEventPriority:ave,getPublicInstance:M0e,getRootHostContext:$0e,hideInstance:eve,hideTextInstance:tve,idlePriority:Ih.unstable_IdlePriority,insertBefore:iR,insertInContainerBefore:K0e,isPrimaryRenderer:W0e,noTimeout:B0e,now:Ih.unstable_now,prepareForCommit:O0e,preparePortalMount:A0e,prepareUpdate:R0e,removeChild:Q0e,removeChildFromContainer:X0e,resetAfterCommit:D0e,resetTextContent:T0e,run:Ih.unstable_runWithPriority,scheduleTimeout:z0e,shouldDeprioritizeSubtree:N0e,shouldSetTextContent:H0e,supportsMutation:U0e,unhideInstance:nve,unhideTextInstance:rve,warnsIfNotActing:V0e},Symbol.toStringTag,{value:"Module"}));var lve=Object.defineProperty,cve=Object.defineProperties,uve=Object.getOwnPropertyDescriptors,cI=Object.getOwnPropertySymbols,dve=Object.prototype.hasOwnProperty,fve=Object.prototype.propertyIsEnumerable,uI=(e,t,n)=>t in e?lve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dI=(e,t)=>{for(var n in t||(t={}))dve.call(t,n)&&uI(e,n,t[n]);if(cI)for(var n of cI(t))fve.call(t,n)&&uI(e,n,t[n]);return e},pve=(e,t)=>cve(e,uve(t));function lR(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=lR(r,t,n);if(o)return o;r=t?null:r.sibling}}function cR(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const lC=cR(l.createContext(null));class uR extends l.Component{render(){return l.createElement(lC.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:fI,ReactCurrentDispatcher:pI}=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function hve(){const e=l.useContext(lC);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=l.useId();return l.useMemo(()=>{for(const r of[fI==null?void 0:fI.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=lR(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function mve(){var e,t;const n=hve(),[r]=l.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==lC&&!r.has(s)&&r.set(s,(t=pI==null?void 0:pI.current)==null?void 0:t.readContext(cR(s))),o=o.return}return r}function gve(){const e=mve();return l.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>l.createElement(t,null,l.createElement(n.Provider,pve(dI({},r),{value:e.get(n)}))),t=>l.createElement(uR,dI({},t))),[e])}function vve(e){const t=z.useRef({});return z.useLayoutEffect(()=>{t.current=e}),z.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const bve=e=>{const t=z.useRef(),n=z.useRef(),r=z.useRef(),o=vve(e),s=gve(),i=c=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(c):d.current=c)};return z.useLayoutEffect(()=>(n.current=new Cf.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Nd.createContainer(n.current,sR.LegacyRoot,!1,null),Nd.updateContainer(z.createElement(s,{},e.children),r.current),()=>{Cf.isBrowser&&(i(null),Nd.updateContainer(null,r.current,null),n.current.destroy())}),[]),z.useLayoutEffect(()=>{i(n.current),z0(n.current,e,o),Nd.updateContainer(z.createElement(s,{},e.children),r.current,null)}),z.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Id="Layer",Fa="Group",Ba="Rect",Il="Circle",fg="Line",dR="Image",xve="Text",yve="Transformer",Nd=C0e(ive);Nd.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:z.version,rendererPackageName:"react-konva"});const Cve=z.forwardRef((e,t)=>z.createElement(uR,{},z.createElement(bve,{...e,forwardedRef:t}))),wve=me([Ir,Vs],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),Sve=()=>{const e=le(),{tool:t,isStaging:n,isMovingBoundingBox:r}=H(wve);return{handleDragStart:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Xh(!0))},[e,r,n,t]),handleDragMove:l.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(jP(s))},[e,r,n,t]),handleDragEnd:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Xh(!1))},[e,r,n,t])}},kve=me([Ir,lo,Vs],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:c,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:c,shouldSnapToGrid:d}},{memoizeOptions:{resultEqualityCheck:Nn}}),jve=()=>{const e=le(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=H(kve),c=l.useRef(null),d=_P(),p=()=>e(IP());_t(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(ny(!s));_t(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),_t(["n"],()=>{e(Yh(!i))},{enabled:!0,preventDefault:!0},[i]),_t("esc",()=>{e(m9())},{enabled:()=>!0,preventDefault:!0}),_t("shift+h",()=>{e(g9(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),_t(["space"],m=>{m.repeat||(d==null||d.container().focus(),r!=="move"&&(c.current=r,e(Zc("move"))),r==="move"&&c.current&&c.current!=="move"&&(e(Zc(c.current)),c.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,c])},cC=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},fR=()=>{const e=le(),t=ab(),n=_P();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=v9.pixelRatio,[s,i,c,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||i===void 0||c===void 0||d===void 0||e(b9({r:s,g:i,b:c,a:d}))},commitColorUnderCursor:()=>{e(x9())}}},_ve=me([lo,Ir,Vs],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Ive=e=>{const t=le(),{tool:n,isStaging:r}=H(_ve),{commitColorUnderCursor:o}=fR();return l.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Xh(!0));return}if(n==="colorPicker"){o();return}const i=cC(e.current);i&&(s.evt.preventDefault(),t(PP(!0)),t(y9([i.x,i.y])))},[e,n,r,t,o])},Pve=me([lo,Ir,Vs],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Eve=(e,t,n)=>{const r=le(),{isDrawing:o,tool:s,isStaging:i}=H(Pve),{updateColorUnderCursor:c}=fR();return l.useCallback(()=>{if(!e.current)return;const d=cC(e.current);if(d){if(r(C9(d)),n.current=d,s==="colorPicker"){c();return}!o||s==="move"||i||(t.current=!0,r(EP([d.x,d.y])))}},[t,r,o,i,n,e,s,c])},Mve=()=>{const e=le();return l.useCallback(()=>{e(w9())},[e])},Ove=me([lo,Ir,Vs],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Ave=(e,t)=>{const n=le(),{tool:r,isDrawing:o,isStaging:s}=H(Ove);return l.useCallback(()=>{if(r==="move"||s){n(Xh(!1));return}if(!t.current&&o&&e.current){const i=cC(e.current);if(!i)return;n(EP([i.x,i.y]))}else t.current=!1;n(PP(!1))},[t,n,o,s,e,r])},Rve=me([Ir],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Nn}}),Dve=e=>{const t=le(),{isMoveStageKeyHeld:n,stageScale:r}=H(Rve);return l.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let c=o.evt.deltaY;o.evt.ctrlKey&&(c=-c);const d=Hl(r*j9**c,k9,S9),p={x:s.x-i.x*d,y:s.y-i.y*d};t(_9(d)),t(jP(p))},[e,n,r,t])},Tve=me(Ir,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Nn}}),Nve=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(Tve);return a.jsxs(Fa,{children:[a.jsx(Ba,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(Ba,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},$ve=l.memo(Nve),Lve=me([Ir],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),zve=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=H(Lve),{colorMode:r}=ji(),[o,s]=l.useState([]),[i,c]=ea("colors",["base.800","base.200"]),d=l.useCallback(p=>p/e,[e]);return l.useLayoutEffect(()=>{const{width:p,height:h}=n,{x:m,y:g}=t,b={x1:0,y1:0,x2:p,y2:h,offset:{x:d(m),y:d(g)}},y={x:Math.ceil(d(m)/64)*64,y:Math.ceil(d(g)/64)*64},x={x1:-y.x,y1:-y.y,x2:d(p)-y.x+64,y2:d(h)-y.y+64},S={x1:Math.min(b.x1,x.x1),y1:Math.min(b.y1,x.y1),x2:Math.max(b.x2,x.x2),y2:Math.max(b.y2,x.y2)},j=S.x2-S.x1,I=S.y2-S.y1,_=Math.round(j/64)+1,M=Math.round(I/64)+1,E=kS(0,_).map(R=>a.jsx(fg,{x:S.x1+R*64,y:S.y1,points:[0,0,0,I],stroke:r==="dark"?i:c,strokeWidth:1},`x_${R}`)),A=kS(0,M).map(R=>a.jsx(fg,{x:S.x1,y:S.y1+R*64,points:[0,0,j,0],stroke:r==="dark"?i:c,strokeWidth:1},`y_${R}`));s(E.concat(A))},[e,t,n,d,r,i,c]),a.jsx(Fa,{children:o})},Fve=l.memo(zve),Bve=me([we],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Nn}}),Hve=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=H(Bve),[o,s]=l.useState(null);return l.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(dR,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},Wve=l.memo(Hve),Bl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Vve=me(Ir,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Bl(t)}}),hI=e=>`data:image/svg+xml;utf8, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`.replaceAll("black",e),Uve=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(Vve),[i,c]=l.useState(null),[d,p]=l.useState(0),h=l.useRef(null),m=l.useCallback(()=>{p(d+1),setTimeout(m,500)},[d]);return l.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{c(g)},g.src=hI(n)},[i,n]),l.useEffect(()=>{i&&(i.src=hI(n))},[i,n]),l.useEffect(()=>{const g=setInterval(()=>p(b=>(b+1)%5),50);return()=>clearInterval(g)},[]),!i||!kc(r.x)||!kc(r.y)||!kc(s)||!kc(o.width)||!kc(o.height)?null:a.jsx(Ba,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:kc(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Gve=l.memo(Uve),qve=me([Ir],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Nn}}),Kve=e=>{const{...t}=e,{objects:n}=H(qve);return a.jsx(Fa,{listening:!1,...t,children:n.filter(I9).map((r,o)=>a.jsx(fg,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},Qve=l.memo(Kve);var Pl=l,Xve=function(t,n,r){const o=Pl.useRef("loading"),s=Pl.useRef(),[i,c]=Pl.useState(0),d=Pl.useRef(),p=Pl.useRef(),h=Pl.useRef();return(d.current!==t||p.current!==n||h.current!==r)&&(o.current="loading",s.current=void 0,d.current=t,p.current=n,h.current=r),Pl.useLayoutEffect(function(){if(!t)return;var m=document.createElement("img");function g(){o.current="loaded",s.current=m,c(Math.random())}function b(){o.current="failed",s.current=void 0,c(Math.random())}return m.addEventListener("load",g),m.addEventListener("error",b),n&&(m.crossOrigin=n),r&&(m.referrerPolicy=r),m.src=t,function(){m.removeEventListener("load",g),m.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const Yve=Sf(Xve),Jve=({canvasImage:e})=>{const[t,n,r,o]=ea("colors",["base.400","base.500","base.700","base.900"]),s=di(t,n),i=di(r,o),{t:c}=Q();return a.jsxs(Fa,{children:[a.jsx(Ba,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(xve,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:c("common.imageFailedToLoad"),fill:i})]})},Zve=l.memo(Jve),e1e=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=Rs(r??zs.skipToken),[i,c]=Yve((o==null?void 0:o.image_url)??"",UI.get()?"use-credentials":"anonymous");return s||c==="failed"?a.jsx(Zve,{canvasImage:e.canvasImage}):a.jsx(dR,{x:t,y:n,image:i,listening:!1})},pR=l.memo(e1e),t1e=me([Ir],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Nn}}),n1e=()=>{const{objects:e}=H(t1e);return e?a.jsx(Fa,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(P9(t))return a.jsx(pR,{canvasImage:t},n);if(E9(t)){const r=a.jsx(fg,{points:t.points,stroke:t.color?Bl(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(Fa,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(M9(t))return a.jsx(Ba,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Bl(t.color)},n);if(O9(t))return a.jsx(Ba,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},r1e=l.memo(n1e),o1e=me([Ir],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:c,boundingBox:d}=t.stagingArea;return{currentStagingAreaImage:c.length>0&&i!==void 0?c[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===c.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(d==null?void 0:d.x)??o.x,y:(d==null?void 0:d.y)??o.y,width:(d==null?void 0:d.width)??s.width,height:(d==null?void 0:d.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Nn}}),s1e=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:c,height:d}=H(o1e);return a.jsxs(Fa,{...t,children:[r&&n&&a.jsx(pR,{canvasImage:n}),o&&a.jsxs(Fa,{children:[a.jsx(Ba,{x:s,y:i,width:c,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(Ba,{x:s,y:i,width:c,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},a1e=l.memo(s1e),i1e=me([Ir],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},Ie),l1e=()=>{const e=le(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=H(i1e),{t:s}=Q(),i=l.useCallback(()=>{e(jS(!0))},[e]),c=l.useCallback(()=>{e(jS(!1))},[e]),d=l.useCallback(()=>e(A9()),[e]),p=l.useCallback(()=>e(R9()),[e]),h=l.useCallback(()=>e(D9()),[e]);_t(["left"],d,{enabled:()=>!0,preventDefault:!0}),_t(["right"],p,{enabled:()=>!0,preventDefault:!0}),_t(["enter"],()=>h,{enabled:()=>!0,preventDefault:!0});const{data:m}=Rs((t==null?void 0:t.imageName)??zs.skipToken),g=l.useCallback(()=>{e(T9(!n))},[e,n]),b=l.useCallback(()=>{m&&e(N9({imageDTO:m}))},[e,m]),y=l.useCallback(()=>{e($9())},[e]);return t?a.jsxs(N,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:c,children:[a.jsxs(Hn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(rt,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(yee,{}),onClick:d,colorScheme:"accent",isDisabled:!n}),a.jsx(Dt,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(rt,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(Cee,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(Hn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(rt,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(VM,{}),onClick:h,colorScheme:"accent"}),a.jsx(rt,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(Dee,{}):a.jsx(Ree,{}),onClick:g,colorScheme:"accent"}),a.jsx(rt,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!m||!m.is_intermediate,icon:a.jsx(o0,{}),onClick:b,colorScheme:"accent"}),a.jsx(rt,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(ku,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},c1e=l.memo(l1e),u1e=()=>{const e=H(c=>c.canvas.layerState),t=H(c=>c.canvas.boundingBoxCoordinates),n=H(c=>c.canvas.boundingBoxDimensions),r=H(c=>c.canvas.isMaskEnabled),o=H(c=>c.canvas.shouldPreserveMaskedArea),[s,i]=l.useState();return l.useEffect(()=>{i(void 0)},[e,t,n,r,o]),ate(async()=>{const c=await L9(e,t,n,r,o);if(!c)return;const{baseImageData:d,maskImageData:p}=c,h=z9(d,p);i(h)},1e3,[e,t,n,r,o]),s},d1e=()=>{const e=u1e(),{t}=Q(),n=l.useMemo(()=>({txt2img:t("common.txt2img"),img2img:t("common.img2img"),inpaint:t("common.inpaint"),outpaint:t("common.outpaint")}),[t]);return a.jsxs(Le,{children:[t("accessibility.mode"),":"," ",e?n[e]:"..."]})},f1e=l.memo(d1e),Xc=e=>Math.round(e*100)/100,p1e=me([Ir],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Xc(n)}, ${Xc(r)})`}},{memoizeOptions:{resultEqualityCheck:Nn}});function h1e(){const{cursorCoordinatesString:e}=H(p1e),{t}=Q();return a.jsx(Le,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const jx="var(--invokeai-colors-warning-500)",m1e=me([Ir],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:c,height:d},boundingBoxCoordinates:{x:p,y:h},stageScale:m,shouldShowCanvasDebugInfo:g,layer:b,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:x}=e;let w="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&c*d<512*512)&&(w=jx),{activeLayerColor:b==="mask"?jx:"inherit",layer:b,boundingBoxColor:w,boundingBoxCoordinatesString:`(${Xc(p)}, ${Xc(h)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${c}×${d}`,canvasCoordinatesString:`${Xc(r)}×${Xc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(m*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:x}},{memoizeOptions:{resultEqualityCheck:Nn}}),g1e=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:c,canvasDimensionsString:d,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:m,shouldPreserveMaskedArea:g}=H(m1e),{t:b}=Q();return a.jsxs(N,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(f1e,{}),a.jsx(Le,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${b(`unifiedCanvas.${t}`)}`}),a.jsx(Le,{children:`${b("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsxs(Le,{style:{color:jx},children:[b("unifiedCanvas.preserveMaskedArea"),": ",b("common.on")]}),m&&a.jsx(Le,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Le,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&a.jsxs(a.Fragment,{children:[a.jsx(Le,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Le,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),a.jsx(Le,{children:`${b("unifiedCanvas.canvasPosition")}: ${c}`}),a.jsx(h1e,{})]})]})},v1e=l.memo(g1e),b1e=me([we],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:c,tool:d,shouldSnapToGrid:p}=e,{aspectRatio:h}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:d,hitStrokeWidth:20/o,aspectRatio:h}},{memoizeOptions:{resultEqualityCheck:Nn}}),x1e=e=>{const{...t}=e,n=le(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:c,stageScale:d,shouldSnapToGrid:p,tool:h,hitStrokeWidth:m,aspectRatio:g}=H(b1e),b=l.useRef(null),y=l.useRef(null),[x,w]=l.useState(!1);l.useEffect(()=>{var G;!b.current||!y.current||(b.current.nodes([y.current]),(G=b.current.getLayer())==null||G.batchDraw())},[]);const S=64*d;_t("N",()=>{n(Yh(!p))});const j=l.useCallback(G=>{if(!p){n(Gv({x:Math.floor(G.target.x()),y:Math.floor(G.target.y())}));return}const X=G.target.x(),Z=G.target.y(),te=Ro(X,64),V=Ro(Z,64);G.target.x(te),G.target.y(V),n(Gv({x:te,y:V}))},[n,p]),I=l.useCallback(()=>{if(!y.current)return;const G=y.current,X=G.scaleX(),Z=G.scaleY(),te=Math.round(G.width()*X),V=Math.round(G.height()*Z),oe=Math.round(G.x()),ne=Math.round(G.y());if(g){const se=Ro(te/g,64);n(na({width:te,height:se}))}else n(na({width:te,height:V}));n(Gv({x:p?Pd(oe,64):oe,y:p?Pd(ne,64):ne})),G.scaleX(1),G.scaleY(1)},[n,p,g]),_=l.useCallback((G,X,Z)=>{const te=G.x%S,V=G.y%S;return{x:Pd(X.x,S)+te,y:Pd(X.y,S)+V}},[S]),M=l.useCallback(()=>{n(qv(!0))},[n]),E=l.useCallback(()=>{n(qv(!1)),n(Kv(!1)),n(Kp(!1)),w(!1)},[n]),A=l.useCallback(()=>{n(Kv(!0))},[n]),R=l.useCallback(()=>{n(qv(!1)),n(Kv(!1)),n(Kp(!1)),w(!1)},[n]),D=l.useCallback(()=>{w(!0)},[]),O=l.useCallback(()=>{!c&&!i&&w(!1)},[i,c]),T=l.useCallback(()=>{n(Kp(!0))},[n]),K=l.useCallback(()=>{n(Kp(!1))},[n]);return a.jsxs(Fa,{...t,children:[a.jsx(Ba,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:K,onMouseOut:K}),a.jsx(Ba,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:m,listening:!s&&h==="move",onDragStart:A,onDragEnd:R,onDragMove:j,onMouseDown:A,onMouseOut:O,onMouseOver:D,onMouseEnter:D,onMouseUp:R,onTransform:I,onTransformEnd:E,ref:y,stroke:x?"rgba(255,255,255,0.7)":"white",strokeWidth:(x?8:1)/d,width:o.width,x:r.x,y:r.y}),a.jsx(yve,{anchorCornerRadius:3,anchorDragBoundFunc:_,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:A,onDragEnd:R,onMouseDown:M,onMouseUp:E,onTransformEnd:E,ref:b,rotateEnabled:!1})]})},y1e=l.memo(x1e),C1e=me(Ir,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:c,shouldShowBrush:d,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:m,stageDimensions:g,boundingBoxCoordinates:b,boundingBoxDimensions:y,shouldRestrictStrokesToBox:x}=e,w=x?{clipX:b.x,clipY:b.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:_S/m,colorPickerInnerRadius:(_S-ib+1)/m,maskColorString:Bl({...o,a:.5}),brushColorString:Bl(s),colorPickerColorString:Bl(r),tool:i,layer:c,shouldShowBrush:d,shouldDrawBrushPreview:!(p||h||!t)&&d,strokeWidth:1.5/m,dotRadius:1.5/m,clip:w}},{memoizeOptions:{resultEqualityCheck:Nn}}),w1e=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:c,shouldDrawBrushPreview:d,dotRadius:p,strokeWidth:h,brushColorString:m,colorPickerColorString:g,colorPickerInnerRadius:b,colorPickerOuterRadius:y,clip:x}=H(C1e);return d?a.jsxs(Fa,{listening:!1,...x,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:y,stroke:m,strokeWidth:ib,strokeScaleEnabled:!1}),a.jsx(Il,{x:n,y:r,radius:b,stroke:g,strokeWidth:ib,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:o,fill:c==="mask"?s:m,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),a.jsx(Il,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(Il,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},S1e=l.memo(w1e),k1e=me([Ir,Vs],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:c,stageDimensions:d,stageCoordinates:p,tool:h,isMovingStage:m,shouldShowIntermediates:g,shouldShowGrid:b,shouldRestrictStrokesToBox:y,shouldAntialias:x}=e;let w="none";return h==="move"||t?m?w="grabbing":w="grab":s?w=void 0:y&&!i&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||c,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:p,stageCursor:w,stageDimensions:d,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:g,shouldAntialias:x}},Ie),j1e=Ae(Cve,{shouldForwardProp:e=>!["sx"].includes(e)}),_1e=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:c,tool:d,isStaging:p,shouldShowIntermediates:h,shouldAntialias:m}=H(k1e);jve();const g=le(),b=l.useRef(null),y=l.useRef(null),x=l.useRef(null),w=l.useCallback(G=>{F9(G),y.current=G},[]),S=l.useCallback(G=>{B9(G),x.current=G},[]),j=l.useRef({x:0,y:0}),I=l.useRef(!1),_=Dve(y),M=Ive(y),E=Ave(y,I),A=Eve(y,I,j),R=Mve(),{handleDragStart:D,handleDragMove:O,handleDragEnd:T}=Sve(),K=l.useCallback(G=>G.evt.preventDefault(),[]);return l.useEffect(()=>{if(!b.current)return;const G=new ResizeObserver(te=>{for(const V of te)if(V.contentBoxSize){const{width:oe,height:ne}=V.contentRect;g(IS({width:oe,height:ne}))}});G.observe(b.current);const{width:X,height:Z}=b.current.getBoundingClientRect();return g(IS({width:X,height:Z})),()=>{G.disconnect()}},[g]),a.jsxs(N,{id:"canvas-container",ref:b,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Le,{sx:{position:"absolute"},children:a.jsxs(j1e,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:c,y:c},onTouchStart:M,onTouchMove:A,onTouchEnd:E,onMouseDown:M,onMouseLeave:R,onMouseMove:A,onMouseUp:E,onDragStart:D,onDragMove:O,onDragEnd:T,onContextMenu:K,onWheel:_,draggable:(d==="move"||p)&&!t,children:[a.jsx(Id,{id:"grid",visible:r,children:a.jsx(Fve,{})}),a.jsx(Id,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:m,children:a.jsx(r1e,{})}),a.jsxs(Id,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Qve,{visible:!0,listening:!1}),a.jsx(Gve,{listening:!1})]}),a.jsx(Id,{children:a.jsx($ve,{})}),a.jsxs(Id,{id:"preview",imageSmoothingEnabled:m,children:[!p&&a.jsx(S1e,{visible:d!=="move",listening:!1}),a.jsx(a1e,{visible:p}),h&&a.jsx(Wve,{}),a.jsx(y1e,{visible:n&&!p})]})]})}),a.jsx(v1e,{}),a.jsx(c1e,{})]})},I1e=l.memo(_1e);function P1e(e,t,n=250){const[r,o]=l.useState(0);return l.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const V1={width:6,height:6,borderColor:"base.100"},E1e={".react-colorful__hue-pointer":V1,".react-colorful__saturation-pointer":V1,".react-colorful__alpha-pointer":V1,gap:2,flexDir:"column"},_h="4.2rem",M1e=e=>{const{color:t,onChange:n,withNumberInput:r,...o}=e,s=l.useCallback(p=>n({...t,r:p}),[t,n]),i=l.useCallback(p=>n({...t,g:p}),[t,n]),c=l.useCallback(p=>n({...t,b:p}),[t,n]),d=l.useCallback(p=>n({...t,a:p}),[t,n]);return a.jsxs(N,{sx:E1e,children:[a.jsx(fA,{color:t,onChange:n,style:{width:"100%"},...o}),r&&a.jsxs(N,{children:[a.jsx(_a,{value:t.r,onChange:s,min:0,max:255,step:1,label:"Red",w:_h}),a.jsx(_a,{value:t.g,onChange:i,min:0,max:255,step:1,label:"Green",w:_h}),a.jsx(_a,{value:t.b,onChange:c,min:0,max:255,step:1,label:"Blue",w:_h}),a.jsx(_a,{value:t.a,onChange:d,step:.1,min:0,max:1,label:"Alpha",w:_h,isInteger:!1})]})]})},hR=l.memo(M1e),O1e=me([Ir,Vs],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Bl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Nn}}),A1e=()=>{const e=le(),{t}=Q(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=H(O1e);_t(["q"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[n]),_t(["shift+c"],()=>{d()},{enabled:()=>!i,preventDefault:!0},[]),_t(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const c=l.useCallback(()=>{e(MP(n==="mask"?"base":"mask"))},[e,n]),d=l.useCallback(()=>{e(IP())},[e]),p=l.useCallback(()=>{e(ny(!o))},[e,o]),h=l.useCallback(async()=>{e(H9())},[e]),m=l.useCallback(b=>{e(W9(b.target.checked))},[e]),g=l.useCallback(b=>{e(V9(b))},[e]);return a.jsx(tp,{triggerComponent:a.jsx(Hn,{children:a.jsx(rt,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(JM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Eo,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(Eo,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:m}),a.jsx(Le,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(hR,{color:r,onChange:g})}),a.jsx(Dt,{size:"sm",leftIcon:a.jsx(o0,{}),onClick:h,children:"Save Mask"}),a.jsxs(Dt,{size:"sm",leftIcon:a.jsx(Zo,{}),onClick:d,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},R1e=l.memo(A1e),D1e=me([we,lo],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Nn}});function T1e(){const e=le(),{canRedo:t,activeTabName:n}=H(D1e),{t:r}=Q(),o=l.useCallback(()=>{e(U9())},[e]);return _t(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(rt,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(qee,{}),onClick:o,isDisabled:!t})}const N1e=()=>{const e=H(Vs),t=le(),{t:n}=Q(),r=l.useCallback(()=>t(G9()),[t]);return a.jsxs(_0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Dt,{size:"sm",leftIcon:a.jsx(Zo,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},$1e=l.memo(N1e),L1e=me([Ir],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Nn}}),z1e=()=>{const e=le(),{t}=Q(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:c,shouldSnapToGrid:d,shouldRestrictStrokesToBox:p,shouldAntialias:h}=H(L1e);_t(["n"],()=>{e(Yh(!d))},{enabled:!0,preventDefault:!0},[d]);const m=l.useCallback(_=>e(Yh(_.target.checked)),[e]),g=l.useCallback(_=>e(q9(_.target.checked)),[e]),b=l.useCallback(_=>e(K9(_.target.checked)),[e]),y=l.useCallback(_=>e(Q9(_.target.checked)),[e]),x=l.useCallback(_=>e(X9(_.target.checked)),[e]),w=l.useCallback(_=>e(Y9(_.target.checked)),[e]),S=l.useCallback(_=>e(J9(_.target.checked)),[e]),j=l.useCallback(_=>e(Z9(_.target.checked)),[e]),I=l.useCallback(_=>e(e$(_.target.checked)),[e]);return a.jsx(tp,{isLazy:!1,triggerComponent:a.jsx(rt,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(nO,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Eo,{label:t("unifiedCanvas.showIntermediates"),isChecked:c,onChange:g}),a.jsx(Eo,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:b}),a.jsx(Eo,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:m}),a.jsx(Eo,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y}),a.jsx(Eo,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:x}),a.jsx(Eo,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:w}),a.jsx(Eo,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:S}),a.jsx(Eo,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:j}),a.jsx(Eo,{label:t("unifiedCanvas.antialiasing"),isChecked:h,onChange:I}),a.jsx($1e,{})]})})},F1e=l.memo(z1e),B1e=me([we,Vs],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Nn}}),H1e=()=>{const e=le(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=H(B1e),{t:s}=Q();_t(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),_t(["e"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[t]),_t(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),_t(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),_t(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),_t(["BracketLeft"],()=>{r-5<=5?e(Qp(Math.max(r-1,1))):e(Qp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),_t(["BracketRight"],()=>{e(Qp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),_t(["Shift+BracketLeft"],()=>{e(Qv({...n,a:Hl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),_t(["Shift+BracketRight"],()=>{e(Qv({...n,a:Hl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=l.useCallback(()=>{e(Zc("brush"))},[e]),c=l.useCallback(()=>{e(Zc("eraser"))},[e]),d=l.useCallback(()=>{e(Zc("colorPicker"))},[e]),p=l.useCallback(()=>{e(t$())},[e]),h=l.useCallback(()=>{e(n$())},[e]),m=l.useCallback(b=>{e(Qp(b))},[e]),g=l.useCallback(b=>{e(Qv(b))},[e]);return a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(Wee,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(Eee,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:c}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(Tee,{}),isDisabled:o,onClick:p}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Zi,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),a.jsx(rt,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(Aee,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),a.jsx(tp,{triggerComponent:a.jsx(rt,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(tO,{})}),children:a.jsxs(N,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(N,{gap:4,justifyContent:"space-between",children:a.jsx(It,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:m,sliderNumberInputProps:{max:500}})}),a.jsx(Le,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(hR,{withNumberInput:!0,color:n,onChange:g})})]})})]})},W1e=l.memo(H1e),V1e=me([we,lo],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Nn}});function U1e(){const e=le(),{t}=Q(),{canUndo:n,activeTabName:r}=H(V1e),o=l.useCallback(()=>{e(r$())},[e]);return _t(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(rt,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(a0,{}),onClick:o,isDisabled:!n})}const G1e=me([we,Vs],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),q1e=()=>{const e=le(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=H(G1e),s=ab(),{t:i}=Q(),{isClipboardAPIAvailable:c}=I8(),{getUploadButtonProps:d,getUploadInputProps:p}=D2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});_t(["v"],()=>{h()},{enabled:()=>!t,preventDefault:!0},[]),_t(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),_t(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),_t(["shift+s"],()=>{x()},{enabled:()=>!t,preventDefault:!0},[s]),_t(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&c,preventDefault:!0},[s,c]),_t(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const h=l.useCallback(()=>{e(Zc("move"))},[e]),m=P1e(()=>g(!1),()=>g(!0)),g=(I=!1)=>{const _=ab();if(!_)return;const M=_.getClientRect({skipTransform:!0});e(c$({contentRect:M,shouldScaleTo1:I}))},b=l.useCallback(()=>{e(RI())},[e]),y=l.useCallback(()=>{e(o$())},[e]),x=l.useCallback(()=>{e(s$())},[e]),w=l.useCallback(()=>{c&&e(a$())},[e,c]),S=l.useCallback(()=>{e(i$())},[e]),j=l.useCallback(I=>{const _=I;e(MP(_)),_==="mask"&&!n&&e(ny(!0))},[e,n]);return a.jsxs(N,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Le,{w:24,children:a.jsx(Dr,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:l$,onChange:j,disabled:t})}),a.jsx(R1e,{}),a.jsx(W1e,{}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(wee,{}),isChecked:o==="move"||t,onClick:h}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(_ee,{}),onClick:m})]}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(Fee,{}),onClick:y,isDisabled:t}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(o0,{}),onClick:x,isDisabled:t}),c&&a.jsx(rt,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hu,{}),onClick:w,isDisabled:t}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(Wu,{}),onClick:S,isDisabled:t})]}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(U1e,{}),a.jsx(T1e,{})]}),a.jsxs(Hn,{isAttached:!0,children:[a.jsx(rt,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(i0,{}),isDisabled:t,...d()}),a.jsx("input",{...p()}),a.jsx(rt,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(Zo,{}),onClick:b,colorScheme:"error",isDisabled:t})]}),a.jsx(Hn,{isAttached:!0,children:a.jsx(F1e,{})})]})},K1e=l.memo(q1e),mI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Q1e=()=>{const{t:e}=Q(),{isOver:t,setNodeRef:n,active:r}=HO({id:"unifiedCanvas",data:mI});return a.jsxs(N,{layerStyle:"first",ref:n,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(K1e,{}),a.jsx(I1e,{}),WO(mI,r)&&a.jsx(VO,{isOver:t,label:e("toast.setCanvasInitialImage")})]})},X1e=l.memo(Q1e),Y1e=()=>a.jsx(X1e,{}),J1e=l.memo(Y1e),Z1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Gr,{as:Nee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(v0e,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Gr,{as:Xl,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Ope,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Gr,{as:fse,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(J1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Gr,{as:T2,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(_ge,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Gr,{as:Iee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Ehe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Gr,{as:Yee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(m0e,{})}],ebe=me([we],({config:e})=>{const{disabledTabs:t}=e;return Z1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Nn}}),tbe=448,nbe=448,rbe=360,obe=["modelManager","queue"],sbe=["modelManager","queue"],abe=()=>{const e=H(u$),t=H(lo),n=H(ebe),{t:r}=Q(),o=le(),s=l.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=l.useMemo(()=>n.map(O=>a.jsx(Wn,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(wo,{onClick:s,children:[a.jsx(UP,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),c=l.useMemo(()=>n.map(O=>a.jsx(Go,{children:O.content},O.id)),[n]),d=l.useCallback(O=>{const T=n[O];T&&o(ni(T.id))},[o,n]),{minSize:p,isCollapsed:h,setIsCollapsed:m,ref:g,reset:b,expand:y,collapse:x,toggle:w}=I_(tbe,"pixels"),{ref:S,minSize:j,isCollapsed:I,setIsCollapsed:_,reset:M,expand:E,collapse:A,toggle:R}=I_(rbe,"pixels");_t("f",()=>{I||h?(E(),y()):(x(),A())},[o,I,h]),_t(["t","o"],()=>{w()},[o]),_t("g",()=>{R()},[o]);const D=G2();return a.jsxs(tc,{variant:"appTabs",defaultIndex:e,index:e,onChange:d,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(nc,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(Pi,{})]}),a.jsxs(E0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:D,units:"pixels",children:[!sbe.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(el,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:m,collapsible:!0,children:t==="nodes"?a.jsx(wle,{}):a.jsx(epe,{})}),a.jsx(lg,{onDoubleClick:b,collapsedDirection:h?"left":void 0}),a.jsx(_le,{isSidePanelCollapsed:h,sidePanelRef:g})]}),a.jsx(el,{id:"main",order:1,minSize:nbe,children:a.jsx($u,{style:{height:"100%",width:"100%"},children:c})}),!obe.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(lg,{onDoubleClick:M,collapsedDirection:I?"right":void 0}),a.jsx(el,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:_,collapsible:!0,children:a.jsx(qse,{})}),a.jsx(kle,{isGalleryCollapsed:I,galleryPanelRef:S})]})]})]})},ibe=l.memo(abe),lbe=l.createContext(null),U1={didCatch:!1,error:null};class cbe extends l.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=U1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function dbe(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const fbe=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),pbe=new Map(fbe),hbe=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],_x=new WeakSet,mbe=e=>{_x.add(e);const t=e.toJSON();return _x.delete(e),t},gbe=e=>pbe.get(e)??Error,mR=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c})=>{if(!n)if(Array.isArray(e))n=[];else if(!c&&gI(e)){const p=gbe(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!_x.has(e))return mbe(e);const d=p=>mR({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c});for(const[p,h]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(h)){n[p]="[object Buffer]";continue}if(h!==null&&typeof h=="object"&&typeof h.pipe=="function"){n[p]="[object Stream]";continue}if(typeof h!="function"){if(!h||typeof h!="object"){try{n[p]=h}catch{}continue}if(!t.includes(e[p])){s++,n[p]=d(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:h}of hbe)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:gI(e[p])?d(e[p]):e[p],enumerable:r?!0:h,configurable:!0,writable:!0});return n};function vbe(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?mR({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e}function gI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const bbe=({error:e,resetErrorBoundary:t})=>{const n=d$(),r=l.useCallback(()=>{const s=JSON.stringify(vbe(e),null,2);navigator.clipboard.writeText(`\`\`\` +${s} +\`\`\``),n({title:"Error Copied"})},[e,n]),o=l.useMemo(()=>dbe({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(N,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(yo,{children:"Something went wrong"}),a.jsx(N,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(je,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(N,{sx:{gap:4},children:[a.jsx(Dt,{leftIcon:a.jsx(sse,{}),onClick:t,children:"Reset UI"}),a.jsx(Dt,{leftIcon:a.jsx(Hu,{}),onClick:r,children:"Copy Error"}),a.jsx(Ig,{href:o,isExternal:!0,children:a.jsx(Dt,{leftIcon:a.jsx(l2,{}),children:"Create Issue"})})]})]})})},xbe=l.memo(bbe),ybe=me([we],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Nn}}),Cbe=()=>{const e=le(),{shift:t,ctrl:n,meta:r}=H(ybe),{queueBack:o,isDisabled:s,isLoading:i}=R8();_t(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:c,isDisabled:d,isLoading:p}=$8();return _t(["ctrl+shift+enter","meta+shift+enter"],c,{enabled:()=>!d&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[c,d,p]),_t("*",()=>{Th("shift")?!t&&e(Qo(!0)):t&&e(Qo(!1)),Th("ctrl")?!n&&e(PS(!0)):n&&e(PS(!1)),Th("meta")?!r&&e(ES(!0)):r&&e(ES(!1))},{keyup:!0,keydown:!0},[t,n,r]),_t("1",()=>{e(ni("txt2img"))}),_t("2",()=>{e(ni("img2img"))}),_t("3",()=>{e(ni("unifiedCanvas"))}),_t("4",()=>{e(ni("nodes"))}),_t("5",()=>{e(ni("modelManager"))}),null},wbe=l.memo(Cbe),Sbe=e=>{const t=le(),{recallAllParameters:n}=j0(),r=Zl(),{currentData:o}=Rs((e==null?void 0:e.imageName)??zs.skipToken),{currentData:s}=GI((e==null?void 0:e.imageName)??zs.skipToken),i=l.useCallback(()=>{o&&(t(QI(o)),t(ni("unifiedCanvas")),r({title:NI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),c=l.useCallback(()=>{o&&t(gg(o))},[t,o]),d=l.useCallback(()=>{s&&n(s.metadata)},[s]);return l.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),l.useEffect(()=>{e&&e.action==="sendToImg2Img"&&c()},[e,c]),l.useEffect(()=>{e&&e.action==="useAllParameters"&&d()},[e,d]),{handleSendToCanvas:i,handleSendToImg2Img:c,handleUseAllMetadata:d}},kbe=e=>(Sbe(e.selectedImage),null),jbe=l.memo(kbe),_be={},Ibe=({config:e=_be,selectedImage:t})=>{const n=H(sO),r=Q3("system"),o=le(),s=l.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);l.useEffect(()=>{fn.changeLanguage(n)},[n]),l.useEffect(()=>{cP(e)&&(r.info({config:e},"Received config"),o(f$(e)))},[o,e,r]),l.useEffect(()=>{o(p$())},[o]);const i=Xg(m$);return a.jsxs(cbe,{onReset:s,FallbackComponent:xbe,children:[a.jsx(rl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(AG,{children:a.jsxs(rl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(jte,{}),a.jsx(N,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(ibe,{})})]})})}),a.jsx(fee,{}),a.jsx(lee,{}),a.jsx(h$,{}),a.jsx(wbe,{}),a.jsx(jbe,{selectedImage:t})]})},Rbe=l.memo(Ibe);export{Rbe as default}; diff --git a/invokeai/frontend/web/dist/assets/App-cd19f6f7.js b/invokeai/frontend/web/dist/assets/App-cd19f6f7.js deleted file mode 100644 index c8e97d7480..0000000000 --- a/invokeai/frontend/web/dist/assets/App-cd19f6f7.js +++ /dev/null @@ -1,171 +0,0 @@ -import{a as Ou,b as mI,S as gI,c as vI,d as bI,e as N1,f as xI,i as $1,g as BA,h as yI,j as CI,k as HA,l as gx,m as WA,n as VA,o as Ew,p as wI,t as UA,q as GA,r as qA,s as KA,u as QA,v as l,w as a,x as vx,y as $h,z as XA,A as YA,B as JA,C as ZA,P as eD,D as bx,E as tD,F as nD,G as rD,H as oD,I as Oe,J as zr,K as Hn,L as Ee,M as jt,N as pr,O as rt,Q as pf,R as yo,T as Or,U as Qr,V as ar,W as bi,X as ll,Y as qt,Z as _s,_ as Yc,$ as xi,a0 as yi,a1 as og,a2 as xx,a3 as hf,a4 as mr,a5 as sD,a6 as B,a7 as Mw,a8 as aD,a9 as SI,aa as L1,ab as mf,ac as Ru,ad as iD,ae as kI,af as jI,ag as _I,ah as Ks,ai as lD,aj as de,ak as Ce,al as Tn,am as H,an as cD,ao as Ow,ap as uD,aq as dD,ar as fD,as as Ci,at as Te,au as N,av as vo,aw as ro,ax as _e,ay as Zl,az as J,aA as II,aB as pD,aC as hD,aD as mD,aE as gD,aF as rs,aG as yx,aH as wi,aI as oe,aJ as Uo,aK as gf,aL as vD,aM as bD,aN as Rw,aO as Cx,aP as Se,aQ as Qs,aR as xD,aS as PI,aT as EI,aU as Aw,aV as yD,aW as CD,aX as wD,aY as Si,aZ as wx,a_ as on,a$ as SD,b0 as kD,b1 as Fa,b2 as MI,b3 as OI,b4 as Bt,b5 as sg,b6 as jD,b7 as Dw,b8 as RI,b9 as _D,ba as ID,bb as PD,bc as ED,bd as MD,be as OD,bf as RD,bg as AI,bh as AD,bi as DD,bj as TD,bk as ND,bl as $D,bm as pu,bn as Sx,bo as LD,bp as zD,bq as FD,br as Cc,bs as BD,bt as HD,bu as WD,bv as VD,bw as Tw,bx as UD,by as GD,bz as Jc,bA as DI,bB as TI,bC as ag,bD as kx,bE as jx,bF as Ps,bG as NI,bH as qD,bI as Bl,bJ as _d,bK as Nw,bL as KD,bM as QD,bN as XD,bO as Ap,bP as Dp,bQ as pd,bR as Pv,bS as Rd,bT as Ad,bU as Dd,bV as Td,bW as $w,bX as Lh,bY as Ev,bZ as zh,b_ as Lw,b$ as z1,c0 as Mv,c1 as F1,c2 as zw,c3 as Wc,c4 as Ov,c5 as Fh,c6 as Fw,c7 as Hl,c8 as Bw,c9 as Wl,ca as Tp,cb as Bh,cc as Hw,cd as B1,ce as Hh,cf as Ww,cg as H1,ch as vf,ci as $I,cj as YD,ck as Vw,cl as _x,cm as Wh,cn as LI,co as Oo,cp as hd,cq as wc,cr as Ix,cs as zI,ct as Np,cu as Px,cv as JD,cw as FI,cx as Rv,cy as ig,cz as ZD,cA as BI,cB as W1,cC as V1,cD as HI,cE as e7,cF as U1,cG as t7,cH as G1,cI as n7,cJ as q1,cK as r7,cL as WI,cM as o7,cN as VI,cO as UI,cP as s7,cQ as GI,cR as Ex,cS as Mx,cT as Ox,cU as Rx,cV as lg,cW as Ax,cX as ti,cY as qI,cZ as KI,c_ as Dx,c$ as QI,d0 as a7,d1 as md,d2 as di,d3 as XI,d4 as YI,d5 as Uw,d6 as Tx,d7 as JI,d8 as Nx,d9 as $x,da as ZI,db as Rr,dc as i7,dd as Kr,de as l7,df as Au,dg as cg,dh as Lx,di as eP,dj as tP,dk as c7,dl as u7,dm as d7,dn as Vh,dp as nP,dq as rP,dr as f7,ds as p7,dt as h7,du as m7,dv as g7,dw as v7,dx as b7,dy as x7,dz as Gw,dA as zx,dB as y7,dC as C7,dD as bf,dE as w7,dF as S7,dG as ug,dH as k7,dI as j7,dJ as _7,dK as I7,dL as gr,dM as P7,dN as E7,dO as M7,dP as O7,dQ as R7,dR as A7,dS as Zn,dT as Wd,dU as qw,dV as na,dW as oP,dX as D7,dY as Fx,dZ as T7,d_ as Kw,d$ as N7,e0 as $7,e1 as L7,e2 as sP,e3 as z7,e4 as F7,e5 as B7,e6 as H7,e7 as W7,e8 as V7,e9 as aP,ea as U7,eb as G7,ec as Qw,ed as q7,ee as K7,ef as Q7,eg as X7,eh as Y7,ei as J7,ej as Z7,ek as iP,el as eT,em as tT,en as nT,eo as Xw,ep as $p,eq as Rs,er as rT,es as oT,et as sT,eu as aT,ev as iT,ew as lT,ex as Xs,ey as cT,ez as uT,eA as dT,eB as fT,eC as pT,eD as hT,eE as mT,eF as gT,eG as vT,eH as bT,eI as xT,eJ as yT,eK as CT,eL as wT,eM as ST,eN as kT,eO as jT,eP as _T,eQ as IT,eR as PT,eS as ET,eT as MT,eU as OT,eV as RT,eW as AT,eX as Yw,eY as lP,eZ as DT,e_ as Us,e$ as Vd,f0 as Mo,f1 as TT,f2 as NT,f3 as cP,f4 as uP,f5 as $T,f6 as Jw,f7 as LT,f8 as Zw,f9 as eS,fa as tS,fb as zT,fc as FT,fd as nS,fe as rS,ff as BT,fg as HT,fh as Uh,fi as WT,fj as oS,fk as sS,fl as VT,fm as UT,fn as dP,fo as GT,fp as qT,fq as fP,fr as KT,fs as QT,ft as aS,fu as XT,fv as iS,fw as YT,fx as JT,fy as pP,fz as hP,fA as xf,fB as mP,fC as Ol,fD as gP,fE as lS,fF as ZT,fG as eN,fH as vP,fI as tN,fJ as nN,fK as rN,fL as oN,fM as sN,fN as Bx,fO as K1,fP as aN,fQ as iN,fR as lN,fS as bP,fT as Hx,fU as xP,fV as Wx,fW as yP,fX as cN,fY as ri,fZ as uN,f_ as CP,f$ as Du,g0 as dN,g1 as Vx,g2 as wP,g3 as fN,g4 as pN,g5 as hN,g6 as mN,g7 as gN,g8 as vN,g9 as Id,ga as Vc,gb as cS,gc as bN,gd as xN,ge as yN,gf as CN,gg as wN,gh as SN,gi as kN,gj as uS,gk as jN,gl as _N,gm as IN,gn as PN,go as EN,gp as MN,gq as dS,gr as ON,gs as RN,gt as AN,gu as DN,gv as TN,gw as NN,gx as $N,gy as LN,gz as zN,gA as fS,gB as FN,gC as BN,gD as HN,gE as WN,gF as VN,gG as UN,gH as GN,gI as qN,gJ as KN,gK as QN,gL as XN,gM as YN,gN as JN,gO as yf,gP as ZN,gQ as e9,gR as t9,gS as n9,gT as r9,gU as o9,gV as s9,gW as a9,gX as pS,gY as Sh,gZ as i9,g_ as Gh,g$ as SP,h0 as qh,h1 as l9,h2 as c9,h3 as Zc,h4 as kP,h5 as jP,h6 as Ux,h7 as u9,h8 as d9,h9 as f9,ha as Q1,hb as _P,hc as p9,hd as h9,he as IP,hf as m9,hg as g9,hh as v9,hi as b9,hj as x9,hk as hS,hl as Sc,hm as y9,hn as C9,ho as w9,hp as S9,hq as k9,hr as mS,hs as j9,ht as _9,hu as I9,hv as P9,hw as E9,hx as M9,hy as O9,hz as R9,hA as Av,hB as Dv,hC as Tv,hD as Lp,hE as gS,hF as X1,hG as vS,hH as A9,hI as D9,hJ as PP,hK as T9,hL as N9,hM as $9,hN as L9,hO as z9,hP as F9,hQ as B9,hR as H9,hS as W9,hT as V9,hU as U9,hV as G9,hW as q9,hX as K9,hY as Q9,hZ as zp,h_ as Nv,h$ as X9,i0 as Y9,i1 as J9,i2 as Z9,i3 as e$,i4 as t$,i5 as n$,i6 as r$,i7 as o$,i8 as bS,i9 as xS,ia as s$,ib as a$,ic as i$,id as l$}from"./index-c553e366.js";import{u as EP,a as ki,b as c$,r as Ge,f as u$,g as yS,c as Xt,d as Nr}from"./MantineProvider-094ba0de.js";var d$=200;function f$(e,t,n,r){var o=-1,s=vI,i=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Ou(t,mI(n))),r?(s=bI,i=!1):t.length>=d$&&(s=N1,i=!1,t=new gI(t));e:for(;++o=120&&h.length>=120)?new gI(i&&h):void 0}h=e[0];var m=-1,g=c[0];e:for(;++m{r.has(s)&&n(o,s)})}function P$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const MP=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:g,selected:b})=>{const{background:y,backgroundColor:x}=s||{},C=i||y||x;return a.jsx("rect",{className:vx(["react-flow__minimap-node",{selected:b},p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:C,stroke:c,strokeWidth:d,shapeRendering:m,onClick:g?S=>g(S,e):void 0})};MP.displayName="MiniMapNode";var E$=l.memo(MP);const M$=e=>e.nodeOrigin,O$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),$v=e=>e instanceof Function?e:()=>e;function R$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=E$,onClick:i}){const c=$h(O$,bx),d=$h(M$),p=$v(t),h=$v(e),m=$v(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:c.map(b=>{const{x:y,y:x}=XA(b,d).positionAbsolute;return a.jsx(s,{x:y,y:x,width:b.width,height:b.height,style:b.style,selected:b.selected,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:g,onClick:i,id:b.id},b.id)})})}var A$=l.memo(R$);const D$=200,T$=150,N$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?rD(oD(t,e.nodeOrigin),n):n,rfId:e.rfId}},$$="react-flow__minimap-desc";function OP({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:b,pannable:y=!1,zoomable:x=!1,ariaLabel:C="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const I=YA(),P=l.useRef(null),{boundingRect:M,viewBB:R,rfId:A}=$h(N$,bx),D=(e==null?void 0:e.width)??D$,O=(e==null?void 0:e.height)??T$,T=M.width/D,Y=M.height/O,z=Math.max(T,Y),W=z*D,Q=z*O,U=_*z,L=M.x-(W-M.width)/2-U,ee=M.y-(Q-M.height)/2-U,K=W+U*2,Z=Q+U*2,se=`${$$}-${A}`,fe=l.useRef(0);fe.current=z,l.useEffect(()=>{if(P.current){const V=JA(P.current),F=q=>{const{transform:ne,d3Selection:pe,d3Zoom:le}=I.getState();if(q.sourceEvent.type!=="wheel"||!pe||!le)return;const we=-q.sourceEvent.deltaY*(q.sourceEvent.deltaMode===1?.05:q.sourceEvent.deltaMode?1:.002)*j,ve=ne[2]*Math.pow(2,we);le.scaleTo(pe,ve)},X=q=>{const{transform:ne,d3Selection:pe,d3Zoom:le,translateExtent:we,width:ve,height:he}=I.getState();if(q.sourceEvent.type!=="mousemove"||!pe||!le)return;const Ne=fe.current*Math.max(1,ne[2])*(S?-1:1),De={x:ne[0]-q.sourceEvent.movementX*Ne,y:ne[1]-q.sourceEvent.movementY*Ne},qe=[[0,0],[ve,he]],Mt=tD.translate(De.x,De.y).scale(ne[2]),ot=le.constrain()(Mt,qe,we);le.transform(pe,ot)},ue=ZA().on("zoom",y?X:null).on("zoom.wheel",x?F:null);return V.call(ue),()=>{V.on("zoom",null)}}},[y,x,S,j]);const G=g?V=>{const F=nD(V);g(V,{x:F[0],y:F[1]})}:void 0,te=b?(V,F)=>{const X=I.getState().nodeInternals.get(F);b(V,X)}:void 0;return a.jsx(eD,{position:m,style:e,className:vx(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:D,height:O,viewBox:`${L} ${ee} ${K} ${Z}`,role:"img","aria-labelledby":se,ref:P,onClick:G,children:[C&&a.jsx("title",{id:se,children:C}),a.jsx(A$,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:c}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${L-U},${ee-U}h${K+U*2}v${Z+U*2}h${-K-U*2}z - M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})]})})}OP.displayName="MiniMap";var L$=l.memo(OP),Ys;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ys||(Ys={}));function z$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function F$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const B$={[Ys.Dots]:"#91919a",[Ys.Lines]:"#eee",[Ys.Cross]:"#e2e2e2"},H$={[Ys.Dots]:1,[Ys.Lines]:1,[Ys.Cross]:6},W$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function RP({id:e,variant:t=Ys.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:c,className:d}){const p=l.useRef(null),{transform:h,patternId:m}=$h(W$,bx),g=i||B$[t],b=r||H$[t],y=t===Ys.Dots,x=t===Ys.Cross,C=Array.isArray(n)?n:[n,n],S=[C[0]*h[2]||1,C[1]*h[2]||1],j=b*h[2],_=x?[j,j]:S,I=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:vx(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:m+e,x:h[0]%S[0],y:h[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`,children:y?a.jsx(F$,{color:g,radius:j/s}):a.jsx(z$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`})]})}RP.displayName="Background";var V$=l.memo(RP);function U$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var G$=U$();const AP=1/60*1e3,q$=typeof performance<"u"?()=>performance.now():()=>Date.now(),DP=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(q$()),AP);function K$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,c={schedule:(d,p=!1,h=!1)=>{const m=h&&o,g=m?t:n;return p&&i.add(d),g.indexOf(d)===-1&&(g.push(d),m&&o&&(r=t.length)),d},cancel:d=>{const p=n.indexOf(d);p!==-1&&n.splice(p,1),i.delete(d)},process:d=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=K$(()=>Ud=!0),e),{}),X$=Cf.reduce((e,t)=>{const n=dg[t];return e[t]=(r,o=!1,s=!1)=>(Ud||Z$(),n.schedule(r,o,s)),e},{}),Y$=Cf.reduce((e,t)=>(e[t]=dg[t].cancel,e),{});Cf.reduce((e,t)=>(e[t]=()=>dg[t].process(eu),e),{});const J$=e=>dg[e].process(eu),TP=e=>{Ud=!1,eu.delta=Y1?AP:Math.max(Math.min(e-eu.timestamp,Q$),1),eu.timestamp=e,J1=!0,Cf.forEach(J$),J1=!1,Ud&&(Y1=!1,DP(TP))},Z$=()=>{Ud=!0,Y1=!0,J1||DP(TP)},wS=()=>eu;function fg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=l.Children.toArray(e.path),i=Oe((c,d)=>a.jsx(zr,{ref:d,viewBox:t,...o,...c,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}var eL=Object.defineProperty,tL=(e,t,n)=>t in e?eL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Er=(e,t,n)=>(tL(e,typeof t!="symbol"?t+"":t,n),n);function SS(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var nL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function kS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function jS(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var Z1=typeof window<"u"?l.useLayoutEffect:l.useEffect,Kh=e=>e,rL=class{constructor(){Er(this,"descendants",new Map),Er(this,"register",e=>{if(e!=null)return nL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Er(this,"unregister",e=>{this.descendants.delete(e);const t=SS(Array.from(this.descendants.keys()));this.assignIndex(t)}),Er(this,"destroy",()=>{this.descendants.clear()}),Er(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Er(this,"count",()=>this.descendants.size),Er(this,"enabledCount",()=>this.enabledValues().length),Er(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Er(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Er(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Er(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Er(this,"first",()=>this.item(0)),Er(this,"firstEnabled",()=>this.enabledItem(0)),Er(this,"last",()=>this.item(this.descendants.size-1)),Er(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Er(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Er(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Er(this,"next",(e,t=!0)=>{const n=kS(e,this.count(),t);return this.item(n)}),Er(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=kS(r,this.enabledCount(),t);return this.enabledItem(o)}),Er(this,"prev",(e,t=!0)=>{const n=jS(e,this.count()-1,t);return this.item(n)}),Er(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=jS(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Er(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=SS(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function oL(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function gn(...e){return t=>{e.forEach(n=>{oL(n,t)})}}function sL(...e){return l.useMemo(()=>gn(...e),e)}function aL(){const e=l.useRef(new rL);return Z1(()=>()=>e.current.destroy()),e.current}var[iL,NP]=Hn({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function lL(e){const t=NP(),[n,r]=l.useState(-1),o=l.useRef(null);Z1(()=>()=>{o.current&&t.unregister(o.current)},[]),Z1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Kh(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:gn(s,o)}}function Gx(){return[Kh(iL),()=>Kh(NP()),()=>aL(),o=>lL(o)]}var[cL,pg]=Hn({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[uL,qx]=Hn({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[dL,dbe,fL,pL]=Gx(),Dc=Oe(function(t,n){const{getButtonProps:r}=qx(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...pg().button};return a.jsx(Ee.button,{...o,className:jt("chakra-accordion__button",t.className),__css:i})});Dc.displayName="AccordionButton";function wf(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,b)=>g!==b}=e,s=pr(r),i=pr(o),[c,d]=l.useState(n),p=t!==void 0,h=p?t:c,m=pr(g=>{const y=typeof g=="function"?g(h):g;i(h,y)&&(p||d(y),s(y))},[p,s,h,i]);return[h,m]}function hL(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;vL(e),bL(e);const c=fL(),[d,p]=l.useState(-1);l.useEffect(()=>()=>{p(-1)},[]);const[h,m]=wf({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:i,getAccordionItemProps:b=>{let y=!1;return b!==null&&(y=Array.isArray(h)?h.includes(b):h===b),{isOpen:y,onChange:C=>{if(b!==null)if(o&&Array.isArray(h)){const S=C?h.concat(b):h.filter(j=>j!==b);m(S)}else C?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:c}}var[mL,Kx]=Hn({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function gL(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=Kx(),c=l.useRef(null),d=l.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;xL(e);const{register:g,index:b,descendants:y}=pL({disabled:t&&!n}),{isOpen:x,onChange:C}=s(b===-1?null:b);yL({isOpen:x,isDisabled:t});const S=()=>{C==null||C(!0)},j=()=>{C==null||C(!1)},_=l.useCallback(()=>{C==null||C(!x),i(b)},[b,i,x,C]),I=l.useCallback(A=>{const O={ArrowDown:()=>{const T=y.nextEnabled(b);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(b);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[A.key];O&&(A.preventDefault(),O(A))},[y,b]),P=l.useCallback(()=>{i(b)},[i,b]),M=l.useCallback(function(D={},O=null){return{...D,type:"button",ref:gn(g,c,O),id:h,disabled:!!t,"aria-expanded":!!x,"aria-controls":m,onClick:rt(D.onClick,_),onFocus:rt(D.onFocus,P),onKeyDown:rt(D.onKeyDown,I)}},[h,t,x,_,P,I,m,g]),R=l.useCallback(function(D={},O=null){return{...D,ref:O,role:"region",id:m,"aria-labelledby":h,hidden:!x}},[h,x,m]);return{isOpen:x,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:R,htmlProps:o}}function vL(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;pf({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function bL(e){pf({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function xL(e){pf({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. - `})}function yL(e){pf({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Tc(e){const{isOpen:t,isDisabled:n}=qx(),{reduceMotion:r}=Kx(),o=jt("chakra-accordion__icon",e.className),s=pg(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(zr,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Tc.displayName="AccordionIcon";var Nc=Oe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=gL(t),d={...pg().container,overflowAnchor:"none"},p=l.useMemo(()=>i,[i]);return a.jsx(uL,{value:p,children:a.jsx(Ee.div,{ref:n,...s,className:jt("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Nc.displayName="AccordionItem";var Uc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Dl={enter:{duration:.2,ease:Uc.easeOut},exit:{duration:.1,ease:Uc.easeIn}},si={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},CL=e=>e!=null&&parseInt(e.toString(),10)>0,_S={exit:{height:{duration:.2,ease:Uc.ease},opacity:{duration:.3,ease:Uc.ease}},enter:{height:{duration:.3,ease:Uc.ease},opacity:{duration:.4,ease:Uc.ease}}},wL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:CL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(_S.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:si.enter(_S.enter,o)}}},Sf=l.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:c,className:d,transition:p,transitionEnd:h,...m}=e,[g,b]=l.useState(!1);l.useEffect(()=>{const j=setTimeout(()=>{b(!0)});return()=>clearTimeout(j)},[]),pf({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,x={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:y?"block":"none"}}},C=r?n:!0,S=n||r?"enter":"exit";return a.jsx(yo,{initial:!1,custom:x,children:C&&a.jsx(Or.div,{ref:t,...m,className:jt("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:x,variants:wL,initial:r?"exit":!1,animate:S,exit:"exit"})})});Sf.displayName="Collapse";var SL={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:si.enter(Dl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:si.exit(Dl.exit,n),transitionEnd:t==null?void 0:t.exit}}},$P={initial:"exit",animate:"enter",exit:"exit",variants:SL},kL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:c,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,g={transition:i,transitionEnd:c,delay:d};return a.jsx(yo,{custom:g,children:m&&a.jsx(Or.div,{ref:n,className:jt("chakra-fade",s),custom:g,...$P,animate:h,...p})})});kL.displayName="Fade";var jL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(Dl.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:si.enter(Dl.enter,n),transitionEnd:e==null?void 0:e.enter}}},LP={initial:"exit",animate:"enter",exit:"exit",variants:jL},_L=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:c,transition:d,transitionEnd:p,delay:h,...m}=t,g=r?o&&r:!0,b=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:d,transitionEnd:p,delay:h};return a.jsx(yo,{custom:y,children:g&&a.jsx(Or.div,{ref:n,className:jt("chakra-offset-slide",c),...LP,animate:b,custom:y,...m})})});_L.displayName="ScaleFade";var IL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(Dl.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:si.enter(Dl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const c={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:si.exit(Dl.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},eb={initial:"initial",animate:"enter",exit:"exit",variants:IL},PL=l.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:c=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...g}=t,b=r?o&&r:!0,y=o||r?"enter":"exit",x={offsetX:c,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return a.jsx(yo,{custom:x,children:b&&a.jsx(Or.div,{ref:n,className:jt("chakra-offset-slide",i),custom:x,...eb,animate:y,...g})})});PL.displayName="SlideFade";var $c=Oe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=Kx(),{getPanelProps:c,isOpen:d}=qx(),p=c(s,n),h=jt("chakra-accordion__panel",r),m=pg();i||delete p.hidden;const g=a.jsx(Ee.div,{...p,__css:m.panel,className:h});return i?g:a.jsx(Sf,{in:d,...o,children:g})});$c.displayName="AccordionPanel";var zP=Oe(function({children:t,reduceMotion:n,...r},o){const s=Qr("Accordion",r),i=ar(r),{htmlProps:c,descendants:d,...p}=hL(i),h=l.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(dL,{value:d,children:a.jsx(mL,{value:h,children:a.jsx(cL,{value:s,children:a.jsx(Ee.div,{ref:o,...c,className:jt("chakra-accordion",r.className),__css:s.root,children:t})})})})});zP.displayName="Accordion";function hg(e){return l.Children.toArray(e).filter(t=>l.isValidElement(t))}var[EL,ML]=Hn({strict:!1,name:"ButtonGroupContext"}),OL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},RL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},zn=Oe(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:c="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,g=jt("chakra-button__group",i),b=l.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...d?OL[h]:RL[h](c)};const x=h==="vertical";return a.jsx(EL,{value:b,children:a.jsx(Ee.div,{ref:n,role:"group",__css:y,className:g,"data-attached":d?"":void 0,"data-orientation":h,flexDir:x?"column":void 0,...m})})});zn.displayName="ButtonGroup";function AL(e){const[t,n]=l.useState(!e);return{ref:l.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function tb(e){const{children:t,className:n,...r}=e,o=l.isValidElement(t)?l.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=jt("chakra-button__icon",n);return a.jsx(Ee.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}tb.displayName="ButtonIcon";function nb(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(bi,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...c}=e,d=jt("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=l.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(Ee.div,{className:d,...c,__css:h,children:o})}nb.displayName="ButtonSpinner";var tl=Oe((e,t)=>{const n=ML(),r=ll("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:c,leftIcon:d,rightIcon:p,loadingText:h,iconSpacing:m="0.5rem",type:g,spinner:b,spinnerPlacement:y="start",className:x,as:C,...S}=ar(e),j=l.useMemo(()=>{const M={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:M}}},[r,n]),{ref:_,type:I}=AL(C),P={rightIcon:p,leftIcon:d,iconSpacing:m,children:c};return a.jsxs(Ee.button,{ref:sL(t,_),as:C,type:g??I,"data-active":qt(i),"data-loading":qt(s),__css:j,className:jt("chakra-button",x),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(nb,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:m,children:b}),s?h||a.jsx(Ee.span,{opacity:0,children:a.jsx(IS,{...P})}):a.jsx(IS,{...P}),s&&y==="end"&&a.jsx(nb,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:m,children:b})]})});tl.displayName="Button";function IS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(tb,{marginEnd:o,children:t}),r,n&&a.jsx(tb,{marginStart:o,children:n})]})}var _a=Oe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,c=n||r,d=l.isValidElement(c)?l.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(tl,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:d})});_a.displayName="IconButton";var[fbe,DL]=Hn({name:"CheckboxGroupContext",strict:!1});function TL(e){const[t,n]=l.useState(e),[r,o]=l.useState(!1);return e!==t&&(o(!0),n(e)),r}function NL(e){return a.jsx(Ee.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function $L(e){return a.jsx(Ee.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function LL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?$L:NL;return n||t?a.jsx(Ee.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[zL,FP]=Hn({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[FL,kf]=Hn({strict:!1,name:"FormControlContext"});function BL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,c=l.useId(),d=t||`field-${c}`,p=`${d}-label`,h=`${d}-feedback`,m=`${d}-helptext`,[g,b]=l.useState(!1),[y,x]=l.useState(!1),[C,S]=l.useState(!1),j=l.useCallback((R={},A=null)=>({id:m,...R,ref:gn(A,D=>{D&&x(!0)})}),[m]),_=l.useCallback((R={},A=null)=>({...R,ref:A,"data-focus":qt(C),"data-disabled":qt(o),"data-invalid":qt(r),"data-readonly":qt(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:d}),[d,o,C,r,s,p]),I=l.useCallback((R={},A=null)=>({id:h,...R,ref:gn(A,D=>{D&&b(!0)}),"aria-live":"polite"}),[h]),P=l.useCallback((R={},A=null)=>({...R,...i,ref:A,role:"group"}),[i]),M=l.useCallback((R={},A=null)=>({...R,ref:A,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!C,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:b,hasHelpText:y,setHasHelpText:x,id:d,labelId:p,feedbackId:h,helpTextId:m,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:I,getRootProps:P,getLabelProps:_,getRequiredIndicatorProps:M}}var Bn=Oe(function(t,n){const r=Qr("Form",t),o=ar(t),{getRootProps:s,htmlProps:i,...c}=BL(o),d=jt("chakra-form-control",t.className);return a.jsx(FL,{value:c,children:a.jsx(zL,{value:r,children:a.jsx(Ee.div,{...s({},n),className:d,__css:r.container})})})});Bn.displayName="FormControl";var BP=Oe(function(t,n){const r=kf(),o=FP(),s=jt("chakra-form__helper-text",t.className);return a.jsx(Ee.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});BP.displayName="FormHelperText";var vr=Oe(function(t,n){var r;const o=ll("FormLabel",t),s=ar(t),{className:i,children:c,requiredIndicator:d=a.jsx(HP,{}),optionalIndicator:p=null,...h}=s,m=kf(),g=(r=m==null?void 0:m.getLabelProps(h,n))!=null?r:{ref:n,...h};return a.jsxs(Ee.label,{...g,className:jt("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,m!=null&&m.isRequired?d:p]})});vr.displayName="FormLabel";var HP=Oe(function(t,n){const r=kf(),o=FP();if(!(r!=null&&r.isRequired))return null;const s=jt("chakra-form__required-indicator",t.className);return a.jsx(Ee.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});HP.displayName="RequiredIndicator";function Qx(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=Xx(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":_s(n),"aria-required":_s(o),"aria-readonly":_s(r)}}function Xx(e){var t,n,r;const o=kf(),{id:s,disabled:i,readOnly:c,required:d,isRequired:p,isInvalid:h,isReadOnly:m,isDisabled:g,onFocus:b,onBlur:y,...x}=e,C=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&C.push(o.feedbackId),o!=null&&o.hasHelpText&&C.push(o.helpTextId),{...x,"aria-describedby":C.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=c??m)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=d??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:rt(o==null?void 0:o.onFocus,b),onBlur:rt(o==null?void 0:o.onBlur,y)}}var Yx={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},WP=Ee("span",{baseStyle:Yx});WP.displayName="VisuallyHidden";var HL=Ee("input",{baseStyle:Yx});HL.displayName="VisuallyHiddenInput";const WL=()=>typeof document<"u";let PS=!1,jf=null,Vl=!1,rb=!1;const ob=new Set;function Jx(e,t){ob.forEach(n=>n(e,t))}const VL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function UL(e){return!(e.metaKey||!VL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ES(e){Vl=!0,UL(e)&&(jf="keyboard",Jx("keyboard",e))}function kc(e){if(jf="pointer",e.type==="mousedown"||e.type==="pointerdown"){Vl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;Jx("pointer",e)}}function GL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function qL(e){GL(e)&&(Vl=!0,jf="virtual")}function KL(e){e.target===window||e.target===document||(!Vl&&!rb&&(jf="virtual",Jx("virtual",e)),Vl=!1,rb=!1)}function QL(){Vl=!1,rb=!0}function MS(){return jf!=="pointer"}function XL(){if(!WL()||PS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Vl=!0,e.apply(this,n)},document.addEventListener("keydown",ES,!0),document.addEventListener("keyup",ES,!0),document.addEventListener("click",qL,!0),window.addEventListener("focus",KL,!0),window.addEventListener("blur",QL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",kc,!0),document.addEventListener("pointermove",kc,!0),document.addEventListener("pointerup",kc,!0)):(document.addEventListener("mousedown",kc,!0),document.addEventListener("mousemove",kc,!0),document.addEventListener("mouseup",kc,!0)),PS=!0}function VP(e){XL(),e(MS());const t=()=>e(MS());return ob.add(t),()=>{ob.delete(t)}}function YL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function UP(e={}){const t=Xx(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:c,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:g,onChange:b,isIndeterminate:y,name:x,value:C,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":I,...P}=e,M=YL(P,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=pr(b),A=pr(c),D=pr(d),[O,T]=l.useState(!1),[Y,z]=l.useState(!1),[W,Q]=l.useState(!1),[U,L]=l.useState(!1);l.useEffect(()=>VP(T),[]);const ee=l.useRef(null),[K,Z]=l.useState(!0),[se,fe]=l.useState(!!h),G=m!==void 0,te=G?m:se,V=l.useCallback(he=>{if(r||n){he.preventDefault();return}G||fe(te?he.target.checked:y?!0:he.target.checked),R==null||R(he)},[r,n,te,G,y,R]);Yc(()=>{ee.current&&(ee.current.indeterminate=!!y)},[y]),xi(()=>{n&&z(!1)},[n,z]),Yc(()=>{const he=ee.current;if(!(he!=null&&he.form))return;const Ne=()=>{fe(!!h)};return he.form.addEventListener("reset",Ne),()=>{var De;return(De=he.form)==null?void 0:De.removeEventListener("reset",Ne)}},[]);const F=n&&!g,X=l.useCallback(he=>{he.key===" "&&L(!0)},[L]),ue=l.useCallback(he=>{he.key===" "&&L(!1)},[L]);Yc(()=>{if(!ee.current)return;ee.current.checked!==te&&fe(ee.current.checked)},[ee.current]);const q=l.useCallback((he={},Ne=null)=>{const De=qe=>{Y&&qe.preventDefault(),L(!0)};return{...he,ref:Ne,"data-active":qt(U),"data-hover":qt(W),"data-checked":qt(te),"data-focus":qt(Y),"data-focus-visible":qt(Y&&O),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r),"aria-hidden":!0,onMouseDown:rt(he.onMouseDown,De),onMouseUp:rt(he.onMouseUp,()=>L(!1)),onMouseEnter:rt(he.onMouseEnter,()=>Q(!0)),onMouseLeave:rt(he.onMouseLeave,()=>Q(!1))}},[U,te,n,Y,O,W,y,s,r]),ne=l.useCallback((he={},Ne=null)=>({...he,ref:Ne,"data-active":qt(U),"data-hover":qt(W),"data-checked":qt(te),"data-focus":qt(Y),"data-focus-visible":qt(Y&&O),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r)}),[U,te,n,Y,O,W,y,s,r]),pe=l.useCallback((he={},Ne=null)=>({...M,...he,ref:gn(Ne,De=>{De&&Z(De.tagName==="LABEL")}),onClick:rt(he.onClick,()=>{var De;K||((De=ee.current)==null||De.click(),requestAnimationFrame(()=>{var qe;(qe=ee.current)==null||qe.focus({preventScroll:!0})}))}),"data-disabled":qt(n),"data-checked":qt(te),"data-invalid":qt(s)}),[M,n,te,s,K]),le=l.useCallback((he={},Ne=null)=>({...he,ref:gn(ee,Ne),type:"checkbox",name:x,value:C,id:i,tabIndex:S,onChange:rt(he.onChange,V),onBlur:rt(he.onBlur,A,()=>z(!1)),onFocus:rt(he.onFocus,D,()=>z(!0)),onKeyDown:rt(he.onKeyDown,X),onKeyUp:rt(he.onKeyUp,ue),required:o,checked:te,disabled:F,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":I?!!I:s,"aria-describedby":p,"aria-disabled":n,style:Yx}),[x,C,i,V,A,D,X,ue,o,te,F,r,j,_,I,s,p,n,S]),we=l.useCallback((he={},Ne=null)=>({...he,ref:Ne,onMouseDown:rt(he.onMouseDown,JL),"data-disabled":qt(n),"data-checked":qt(te),"data-invalid":qt(s)}),[te,n,s]);return{state:{isInvalid:s,isFocused:Y,isChecked:te,isActive:U,isHovered:W,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:pe,getCheckboxProps:q,getIndicatorProps:ne,getInputProps:le,getLabelProps:we,htmlProps:M}}function JL(e){e.preventDefault(),e.stopPropagation()}var ZL={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},ez={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},tz=yi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),nz=yi({from:{opacity:0},to:{opacity:1}}),rz=yi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),_f=Oe(function(t,n){const r=DL(),o={...r,...t},s=Qr("Checkbox",o),i=ar(t),{spacing:c="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:g=a.jsx(LL,{}),isChecked:b,isDisabled:y=r==null?void 0:r.isDisabled,onChange:x,inputProps:C,...S}=i;let j=b;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=x;r!=null&&r.onChange&&i.value&&(_=og(r.onChange,x));const{state:I,getInputProps:P,getCheckboxProps:M,getLabelProps:R,getRootProps:A}=UP({...S,isDisabled:y,isChecked:j,onChange:_}),D=TL(I.isChecked),O=l.useMemo(()=>({animation:D?I.isIndeterminate?`${nz} 20ms linear, ${rz} 200ms linear`:`${tz} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,D,I.isIndeterminate,s.icon]),T=l.cloneElement(g,{__css:O,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return a.jsxs(Ee.label,{__css:{...ez,...s.container},className:jt("chakra-checkbox",d),...A(),children:[a.jsx("input",{className:"chakra-checkbox__input",...P(C,n)}),a.jsx(Ee.span,{__css:{...ZL,...s.control},className:"chakra-checkbox__control",...M(),children:T}),p&&a.jsx(Ee.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:c,...s.label},children:p})]})});_f.displayName="Checkbox";function oz(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function Zx(e,t){let n=oz(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function sb(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function Qh(e,t,n){return(e-t)*100/(n-t)}function GP(e,t,n){return(n-t)*e+t}function ab(e,t,n){const r=Math.round((e-t)/n)*n+t,o=sb(n);return Zx(r,o)}function tu(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=Lv(r,s,n))!=null?O:""}),g=typeof o<"u",b=g?o:h,y=qP(Bi(b),s),x=n??y,C=l.useCallback(O=>{O!==b&&(g||m(O.toString()),p==null||p(O.toString(),Bi(O)))},[p,g,b]),S=l.useCallback(O=>{let T=O;return d&&(T=tu(T,i,c)),Zx(T,x)},[x,d,c,i]),j=l.useCallback((O=s)=>{let T;b===""?T=Bi(O):T=Bi(b)+O,T=S(T),C(T)},[S,s,C,b]),_=l.useCallback((O=s)=>{let T;b===""?T=Bi(-O):T=Bi(b)-O,T=S(T),C(T)},[S,s,C,b]),I=l.useCallback(()=>{var O;let T;r==null?T="":T=(O=Lv(r,s,n))!=null?O:i,C(T)},[r,n,s,C,i]),P=l.useCallback(O=>{var T;const Y=(T=Lv(O,s,x))!=null?T:i;C(Y)},[x,s,C,i]),M=Bi(b);return{isOutOfRange:M>c||M" `}),[iz,ey]=Hn({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),QP={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},If=Oe(function(t,n){const{getInputProps:r}=ey(),o=KP(),s=r(t,n),i=jt("chakra-editable__input",t.className);return a.jsx(Ee.input,{...s,__css:{outline:0,...QP,...o.input},className:i})});If.displayName="EditableInput";var Pf=Oe(function(t,n){const{getPreviewProps:r}=ey(),o=KP(),s=r(t,n),i=jt("chakra-editable__preview",t.className);return a.jsx(Ee.span,{...s,__css:{cursor:"text",display:"inline-block",...QP,...o.preview},className:i})});Pf.displayName="EditablePreview";function Tl(e,t,n,r){const o=pr(n);return l.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function lz(e){return"current"in e}var XP=()=>typeof window<"u";function cz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var uz=e=>XP()&&e.test(navigator.vendor),dz=e=>XP()&&e.test(cz()),fz=()=>dz(/mac|iphone|ipad|ipod/i),pz=()=>fz()&&uz(/apple/i);function YP(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Tl(o,"pointerdown",s=>{if(!pz()||!r)return;const i=s.target,d=(n??[t]).some(p=>{const h=lz(p)?p.current:p;return(h==null?void 0:h.contains(i))||h===i});o().activeElement!==i&&d&&(s.preventDefault(),i.focus())})}function OS(e,t){return e?e===t||e.contains(t):!1}function hz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:c,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:g,onEdit:b,finalFocusRef:y,...x}=e,C=pr(b),S=!!(d&&!i),[j,_]=l.useState(S),[I,P]=wf({defaultValue:c||"",value:s,onChange:t}),[M,R]=l.useState(I),A=l.useRef(null),D=l.useRef(null),O=l.useRef(null),T=l.useRef(null),Y=l.useRef(null);YP({ref:A,enabled:j,elements:[T,Y]});const z=!j&&!i;Yc(()=>{var q,ne;j&&((q=A.current)==null||q.focus(),m&&((ne=A.current)==null||ne.select()))},[]),xi(()=>{var q,ne,pe,le;if(!j){y?(q=y.current)==null||q.focus():(ne=O.current)==null||ne.focus();return}(pe=A.current)==null||pe.focus(),m&&((le=A.current)==null||le.select()),C==null||C()},[j,C,m]);const W=l.useCallback(()=>{z&&_(!0)},[z]),Q=l.useCallback(()=>{R(I)},[I]),U=l.useCallback(()=>{_(!1),P(M),n==null||n(M),o==null||o(M)},[n,o,P,M]),L=l.useCallback(()=>{_(!1),R(I),r==null||r(I),o==null||o(M)},[I,r,o,M]);l.useEffect(()=>{if(j)return;const q=A.current;(q==null?void 0:q.ownerDocument.activeElement)===q&&(q==null||q.blur())},[j]);const ee=l.useCallback(q=>{P(q.currentTarget.value)},[P]),K=l.useCallback(q=>{const ne=q.key,le={Escape:U,Enter:we=>{!we.shiftKey&&!we.metaKey&&L()}}[ne];le&&(q.preventDefault(),le(q))},[U,L]),Z=l.useCallback(q=>{const ne=q.key,le={Escape:U}[ne];le&&(q.preventDefault(),le(q))},[U]),se=I.length===0,fe=l.useCallback(q=>{var ne;if(!j)return;const pe=q.currentTarget.ownerDocument,le=(ne=q.relatedTarget)!=null?ne:pe.activeElement,we=OS(T.current,le),ve=OS(Y.current,le);!we&&!ve&&(h?L():U())},[h,L,U,j]),G=l.useCallback((q={},ne=null)=>{const pe=z&&p?0:void 0;return{...q,ref:gn(ne,D),children:se?g:I,hidden:j,"aria-disabled":_s(i),tabIndex:pe,onFocus:rt(q.onFocus,W,Q)}},[i,j,z,p,se,W,Q,g,I]),te=l.useCallback((q={},ne=null)=>({...q,hidden:!j,placeholder:g,ref:gn(ne,A),disabled:i,"aria-disabled":_s(i),value:I,onBlur:rt(q.onBlur,fe),onChange:rt(q.onChange,ee),onKeyDown:rt(q.onKeyDown,K),onFocus:rt(q.onFocus,Q)}),[i,j,fe,ee,K,Q,g,I]),V=l.useCallback((q={},ne=null)=>({...q,hidden:!j,placeholder:g,ref:gn(ne,A),disabled:i,"aria-disabled":_s(i),value:I,onBlur:rt(q.onBlur,fe),onChange:rt(q.onChange,ee),onKeyDown:rt(q.onKeyDown,Z),onFocus:rt(q.onFocus,Q)}),[i,j,fe,ee,Z,Q,g,I]),F=l.useCallback((q={},ne=null)=>({"aria-label":"Edit",...q,type:"button",onClick:rt(q.onClick,W),ref:gn(ne,O),disabled:i}),[W,i]),X=l.useCallback((q={},ne=null)=>({...q,"aria-label":"Submit",ref:gn(Y,ne),type:"button",onClick:rt(q.onClick,L),disabled:i}),[L,i]),ue=l.useCallback((q={},ne=null)=>({"aria-label":"Cancel",id:"cancel",...q,ref:gn(T,ne),type:"button",onClick:rt(q.onClick,U),disabled:i}),[U,i]);return{isEditing:j,isDisabled:i,isValueEmpty:se,value:I,onEdit:W,onCancel:U,onSubmit:L,getPreviewProps:G,getInputProps:te,getTextareaProps:V,getEditButtonProps:F,getSubmitButtonProps:X,getCancelButtonProps:ue,htmlProps:x}}var Ef=Oe(function(t,n){const r=Qr("Editable",t),o=ar(t),{htmlProps:s,...i}=hz(o),{isEditing:c,onSubmit:d,onCancel:p,onEdit:h}=i,m=jt("chakra-editable",t.className),g=xx(t.children,{isEditing:c,onSubmit:d,onCancel:p,onEdit:h});return a.jsx(iz,{value:i,children:a.jsx(az,{value:r,children:a.jsx(Ee.div,{ref:n,...s,className:m,children:g})})})});Ef.displayName="Editable";function JP(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=ey();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var ZP={exports:{}},mz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",gz=mz,vz=gz;function e5(){}function t5(){}t5.resetWarningCache=e5;var bz=function(){function e(r,o,s,i,c,d){if(d!==vz){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:t5,resetWarningCache:e5};return n.PropTypes=n,n};ZP.exports=bz();var xz=ZP.exports;const Jn=hf(xz);var ib="data-focus-lock",n5="data-focus-lock-disabled",yz="data-no-focus-lock",Cz="data-autofocus-inside",wz="data-no-autofocus";function Sz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function kz(e,t){var n=l.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function r5(e,t){return kz(t||null,function(n){return e.forEach(function(r){return Sz(r,n)})})}var zv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Ca=function(){return Ca=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){i={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function lb(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(Lz)},zz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],oy=zz.join(","),Fz="".concat(oy,", [data-focus-guard]"),C5=function(e,t){return Ba((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?Fz:oy)?[r]:[],C5(r))},[])},Bz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?mg([e.contentDocument.body],t):[e]},mg=function(e,t){return e.reduce(function(n,r){var o,s=C5(r,t),i=(o=[]).concat.apply(o,s.map(function(c){return Bz(c,t)}));return n.concat(i,r.parentNode?Ba(r.parentNode.querySelectorAll(oy)).filter(function(c){return c===r}):[])},[])},Hz=function(e){var t=e.querySelectorAll("[".concat(Cz,"]"));return Ba(t).map(function(n){return mg([n])}).reduce(function(n,r){return n.concat(r)},[])},sy=function(e,t){return Ba(e).filter(function(n){return m5(t,n)}).filter(function(n){return Tz(n)})},AS=function(e,t){return t===void 0&&(t=new Map),Ba(e).filter(function(n){return g5(t,n)})},ub=function(e,t,n){return y5(sy(mg(e,n),t),!0,n)},DS=function(e,t){return y5(sy(mg(e),t),!1)},Wz=function(e,t){return sy(Hz(e),t)},nu=function(e,t){return e.shadowRoot?nu(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Ba(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?nu(o,t):!1}return nu(n,t)})},Vz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,c){return!t.has(c)})},w5=function(e){return e.parentNode?w5(e.parentNode):e},ay=function(e){var t=Xh(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(ib);return n.push.apply(n,o?Vz(Ba(w5(r).querySelectorAll("[".concat(ib,'="').concat(o,'"]:not([').concat(n5,'="disabled"])')))):[r]),n},[])},Uz=function(e){try{return e()}catch{return}},Gd=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Gd(t.shadowRoot):t instanceof HTMLIFrameElement&&Uz(function(){return t.contentWindow.document})?Gd(t.contentWindow.document):t}},Gz=function(e,t){return e===t},qz=function(e,t){return!!Ba(e.querySelectorAll("iframe")).some(function(n){return Gz(n,t)})},S5=function(e,t){return t===void 0&&(t=Gd(f5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:ay(e).some(function(n){return nu(n,t)||qz(n,t)})},Kz=function(e){e===void 0&&(e=document);var t=Gd(e);return t?Ba(e.querySelectorAll("[".concat(yz,"]"))).some(function(n){return nu(n,t)}):!1},Qz=function(e,t){return t.filter(x5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},iy=function(e,t){return x5(e)&&e.name?Qz(e,t):e},Xz=function(e){var t=new Set;return e.forEach(function(n){return t.add(iy(n,e))}),e.filter(function(n){return t.has(n)})},TS=function(e){return e[0]&&e.length>1?iy(e[0],e):e[0]},NS=function(e,t){return e.length>1?e.indexOf(iy(e[t],e)):t},k5="NEW_FOCUS",Yz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],c=ry(n);if(!(n&&e.indexOf(n)>=0)){var d=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):d,h=r?e.indexOf(r):-1,m=d-p,g=t.indexOf(s),b=t.indexOf(i),y=Xz(t),x=n!==void 0?y.indexOf(n):-1,C=x-(r?y.indexOf(r):d),S=NS(e,0),j=NS(e,o-1);if(d===-1||h===-1)return k5;if(!m&&h>=0)return h;if(d<=g&&c&&Math.abs(m)>1)return j;if(d>=b&&c&&Math.abs(m)>1)return S;if(m&&Math.abs(C)>1)return h;if(d<=g)return j;if(d>b)return S;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},Jz=function(e){return function(t){var n,r=(n=v5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Zz=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=AS(r.filter(Jz(n)));return o&&o.length?TS(o):TS(AS(t))},db=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&db(e.parentNode.host||e.parentNode,t),t},Fv=function(e,t){for(var n=db(e),r=db(t),o=0;o=0)return s}return!1},j5=function(e,t,n){var r=Xh(e),o=Xh(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(c){i=Fv(i||c,c)||i,n.filter(Boolean).forEach(function(d){var p=Fv(s,d);p&&(!i||nu(p,i)?i=p:i=Fv(p,i))})}),i},eF=function(e,t){return e.reduce(function(n,r){return n.concat(Wz(r,t))},[])},tF=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter($z)},nF=function(e,t){var n=Gd(Xh(e).length>0?document:f5(e).ownerDocument),r=ay(e).filter(Yh),o=j5(n||e,e,r),s=new Map,i=DS(r,s),c=ub(r,s).filter(function(b){var y=b.node;return Yh(y)});if(!(!c[0]&&(c=i,!c[0]))){var d=DS([o],s).map(function(b){var y=b.node;return y}),p=tF(d,c),h=p.map(function(b){var y=b.node;return y}),m=Yz(h,d,n,t);if(m===k5){var g=Zz(i,h,eF(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},rF=function(e){var t=ay(e).filter(Yh),n=j5(e,e,t),r=new Map,o=ub([n],r,!0),s=ub(t,r).filter(function(i){var c=i.node;return Yh(c)}).map(function(i){var c=i.node;return c});return o.map(function(i){var c=i.node,d=i.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:ry(c)}})},oF=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},Bv=0,Hv=!1,_5=function(e,t,n){n===void 0&&(n={});var r=nF(e,t);if(!Hv&&r){if(Bv>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Hv=!0,setTimeout(function(){Hv=!1},1);return}Bv++,oF(r.node,n.focusOptions),Bv--}};function ly(e){setTimeout(e,1)}var sF=function(){return document&&document.activeElement===document.body},aF=function(){return sF()||Kz()},ru=null,Gc=null,ou=null,qd=!1,iF=function(){return!0},lF=function(t){return(ru.whiteList||iF)(t)},cF=function(t,n){ou={observerNode:t,portaledElement:n}},uF=function(t){return ou&&ou.portaledElement===t};function $S(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var dF=function(t){return t&&"current"in t?t.current:t},fF=function(t){return t?!!qd:qd==="meanwhile"},pF=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},hF=function(t,n){return n.some(function(r){return pF(t,r,r)})},Jh=function(){var t=!1;if(ru){var n=ru,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,c=n.crossFrame,d=n.focusOptions,p=r||ou&&ou.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(i.map(dF).filter(Boolean));if((!h||lF(h))&&(o||fF(c)||!aF()||!Gc&&s)&&(p&&!(S5(m)||h&&hF(h,m)||uF(h))&&(document&&!Gc&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=_5(m,Gc,{focusOptions:d}),ou={})),qd=!1,Gc=document&&document.activeElement),document){var g=document&&document.activeElement,b=rF(m),y=b.map(function(x){var C=x.node;return C}).indexOf(g);y>-1&&(b.filter(function(x){var C=x.guard,S=x.node;return C&&S.dataset.focusAutoGuard}).forEach(function(x){var C=x.node;return C.removeAttribute("tabIndex")}),$S(y,b.length,1,b),$S(y,-1,-1,b))}}}return t},I5=function(t){Jh()&&t&&(t.stopPropagation(),t.preventDefault())},cy=function(){return ly(Jh)},mF=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||cF(r,n)},gF=function(){return null},P5=function(){qd="just",ly(function(){qd="meanwhile"})},vF=function(){document.addEventListener("focusin",I5),document.addEventListener("focusout",cy),window.addEventListener("blur",P5)},bF=function(){document.removeEventListener("focusin",I5),document.removeEventListener("focusout",cy),window.removeEventListener("blur",P5)};function xF(e){return e.filter(function(t){var n=t.disabled;return!n})}function yF(e){var t=e.slice(-1)[0];t&&!ru&&vF();var n=ru,r=n&&t&&t.id===n.id;ru=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Gc=null,(!r||n.observed!==t.observed)&&t.onActivation(),Jh(),ly(Jh)):(bF(),Gc=null)}c5.assignSyncMedium(mF);u5.assignMedium(cy);_z.assignMedium(function(e){return e({moveFocusInside:_5,focusInside:S5})});const CF=Mz(xF,yF)(gF);var E5=l.forwardRef(function(t,n){return l.createElement(d5,mr({sideCar:CF,ref:n},t))}),M5=d5.propTypes||{};M5.sideCar;P$(M5,["sideCar"]);E5.propTypes={};const LS=E5;function O5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function uy(e){var t;if(!O5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function wF(e){var t,n;return(n=(t=R5(e))==null?void 0:t.defaultView)!=null?n:window}function R5(e){return O5(e)?e.ownerDocument:document}function SF(e){return R5(e).activeElement}function kF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function jF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function A5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:uy(e)&&kF(e)?e:A5(jF(e))}var D5=e=>e.hasAttribute("tabindex"),_F=e=>D5(e)&&e.tabIndex===-1;function IF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function T5(e){return e.parentElement&&T5(e.parentElement)?!0:e.hidden}function PF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function N5(e){if(!uy(e)||T5(e)||IF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():PF(e)?!0:D5(e)}function EF(e){return e?uy(e)&&N5(e)&&!_F(e):!1}var MF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],OF=MF.join(),RF=e=>e.offsetWidth>0&&e.offsetHeight>0;function $5(e){const t=Array.from(e.querySelectorAll(OF));return t.unshift(e),t.filter(n=>N5(n)&&RF(n))}var zS,AF=(zS=LS.default)!=null?zS:LS,L5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=l.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&$5(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),m=l.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),g=o&&!n;return a.jsx(AF,{crossFrame:p,persistentFocus:d,autoFocus:c,disabled:i,onActivation:h,onDeactivation:m,returnFocus:g,children:s})};L5.displayName="FocusLock";var DF=G$?l.useLayoutEffect:l.useEffect;function fb(e,t=[]){const n=l.useRef(e);return DF(()=>{n.current=e}),l.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function TF(e,t,n,r){const o=fb(t);return l.useEffect(()=>{var s;const i=(s=Mw(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Mw(n))!=null?s:document).removeEventListener(e,o,r)}}function NF(e,t){const n=l.useId();return l.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function $F(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ls(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=fb(n),i=fb(t),[c,d]=l.useState(e.defaultIsOpen||!1),[p,h]=$F(r,c),m=NF(o,"disclosure"),g=l.useCallback(()=>{p||d(!1),i==null||i()},[p,i]),b=l.useCallback(()=>{p||d(!0),s==null||s()},[p,s]),y=l.useCallback(()=>{(h?g:b)()},[h,b,g]);return{isOpen:!!h,onOpen:b,onClose:g,onToggle:y,isControlled:p,getButtonProps:(x={})=>({...x,"aria-expanded":h,"aria-controls":m,onClick:aD(x.onClick,y)}),getDisclosureProps:(x={})=>({...x,hidden:!h,id:m})}}var[LF,zF]=Hn({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),z5=Oe(function(t,n){const r=Qr("Input",t),{children:o,className:s,...i}=ar(t),c=jt("chakra-input__group",s),d={},p=hg(o),h=r.field;p.forEach(g=>{var b,y;r&&(h&&g.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&g.type.id==="InputRightElement"&&(d.paddingEnd=(y=h.height)!=null?y:h.h),g.type.id==="InputRightAddon"&&(d.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(g=>{var b,y;const x=SI({size:((b=g.props)==null?void 0:b.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?l.cloneElement(g,x):l.cloneElement(g,Object.assign(x,d,g.props))});return a.jsx(Ee.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(LF,{value:r,children:m})})});z5.displayName="InputGroup";var FF=Ee("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),gg=Oe(function(t,n){var r,o;const{placement:s="left",...i}=t,c=zF(),d=c.field,h={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=d==null?void 0:d.height)!=null?r:d==null?void 0:d.h,height:(o=d==null?void 0:d.height)!=null?o:d==null?void 0:d.h,fontSize:d==null?void 0:d.fontSize,...c.element};return a.jsx(FF,{ref:n,__css:h,...i})});gg.id="InputElement";gg.displayName="InputElement";var F5=Oe(function(t,n){const{className:r,...o}=t,s=jt("chakra-input__left-element",r);return a.jsx(gg,{ref:n,placement:"left",className:s,...o})});F5.id="InputLeftElement";F5.displayName="InputLeftElement";var dy=Oe(function(t,n){const{className:r,...o}=t,s=jt("chakra-input__right-element",r);return a.jsx(gg,{ref:n,placement:"right",className:s,...o})});dy.id="InputRightElement";dy.displayName="InputRightElement";var vg=Oe(function(t,n){const{htmlSize:r,...o}=t,s=Qr("Input",o),i=ar(o),c=Qx(i),d=jt("chakra-input",t.className);return a.jsx(Ee.input,{size:r,...c,__css:s.field,ref:n,className:d})});vg.displayName="Input";vg.id="Input";var bg=Oe(function(t,n){const r=ll("Link",t),{className:o,isExternal:s,...i}=ar(t);return a.jsx(Ee.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:jt("chakra-link",o),...i,__css:r})});bg.displayName="Link";var[BF,B5]=Hn({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),fy=Oe(function(t,n){const r=Qr("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:c,...d}=ar(t),p=hg(o),m=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return a.jsx(BF,{value:r,children:a.jsx(Ee.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...m},...d,children:p})})});fy.displayName="List";var H5=Oe((e,t)=>{const{as:n,...r}=e;return a.jsx(fy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});H5.displayName="OrderedList";var Mf=Oe(function(t,n){const{as:r,...o}=t;return a.jsx(fy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});Mf.displayName="UnorderedList";var ws=Oe(function(t,n){const r=B5();return a.jsx(Ee.li,{ref:n,...t,__css:r.item})});ws.displayName="ListItem";var HF=Oe(function(t,n){const r=B5();return a.jsx(zr,{ref:n,role:"presentation",...t,__css:r.icon})});HF.displayName="ListIcon";var nl=Oe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:c,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:g,templateColumns:b,...y}=t,x={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:c,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return a.jsx(Ee.div,{ref:n,__css:x,...y})});nl.displayName="Grid";function W5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):L1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ji=Ee("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ji.displayName="Spacer";var V5=e=>a.jsx(Ee.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});V5.displayName="StackItem";function WF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":W5(n,o=>r[o])}}var py=Oe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:c,children:d,divider:p,className:h,shouldWrapChildren:m,...g}=e,b=n?"row":r??"column",y=l.useMemo(()=>WF({spacing:i,direction:b}),[i,b]),x=!!p,C=!m&&!x,S=l.useMemo(()=>{const _=hg(d);return C?_:_.map((I,P)=>{const M=typeof I.key<"u"?I.key:P,R=P+1===_.length,D=m?a.jsx(V5,{children:I},M):I;if(!x)return D;const O=l.cloneElement(p,{__css:y}),T=R?null:O;return a.jsxs(l.Fragment,{children:[D,T]},M)})},[p,y,x,C,m,d]),j=jt("chakra-stack",h);return a.jsx(Ee.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:x?void 0:i,className:j,...g,children:S})});py.displayName="Stack";var U5=Oe((e,t)=>a.jsx(py,{align:"center",...e,direction:"column",ref:t}));U5.displayName="VStack";var xg=Oe((e,t)=>a.jsx(py,{align:"center",...e,direction:"row",ref:t}));xg.displayName="HStack";function FS(e){return W5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Kd=Oe(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:c,rowSpan:d,rowStart:p,...h}=t,m=SI({gridArea:r,gridColumn:FS(o),gridRow:FS(d),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:c});return a.jsx(Ee.div,{ref:n,__css:m,...h})});Kd.displayName="GridItem";var Ha=Oe(function(t,n){const r=ll("Badge",t),{className:o,...s}=ar(t);return a.jsx(Ee.span,{ref:n,className:jt("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ha.displayName="Badge";var no=Oe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:c,borderStyle:d,borderColor:p,...h}=ll("Divider",t),{className:m,orientation:g="horizontal",__css:b,...y}=ar(t),x={vertical:{borderLeftWidth:r||i||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return a.jsx(Ee.hr,{ref:n,"aria-orientation":g,...y,__css:{...h,border:"0",borderColor:p,borderStyle:d,...x[g],...b},className:jt("chakra-divider",m)})});no.displayName="Divider";function VF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function UF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=l.useState([]),s=l.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};l.useEffect(()=>i,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(VF(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),c()}}}return d}function GF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function qF(){const e=l.useRef(new Map),t=e.current,n=l.useCallback((o,s,i,c)=>{e.current.set(i,{type:s,el:o,options:c}),o.addEventListener(s,i,c)},[]),r=l.useCallback((o,s,i,c)=>{o.removeEventListener(s,i,c),e.current.delete(i)},[]);return l.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function Wv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function G5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:c,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:g,onMouseLeave:b,...y}=e,[x,C]=l.useState(!0),[S,j]=l.useState(!1),_=qF(),I=L=>{L&&L.tagName!=="BUTTON"&&C(!1)},P=x?m:m||0,M=n&&!r,R=l.useCallback(L=>{if(n){L.stopPropagation(),L.preventDefault();return}L.currentTarget.focus(),d==null||d(L)},[n,d]),A=l.useCallback(L=>{S&&Wv(L)&&(L.preventDefault(),L.stopPropagation(),j(!1),_.remove(document,"keyup",A,!1))},[S,_]),D=l.useCallback(L=>{if(p==null||p(L),n||L.defaultPrevented||L.metaKey||!Wv(L.nativeEvent)||x)return;const ee=o&&L.key==="Enter";s&&L.key===" "&&(L.preventDefault(),j(!0)),ee&&(L.preventDefault(),L.currentTarget.click()),_.add(document,"keyup",A,!1)},[n,x,p,o,s,_,A]),O=l.useCallback(L=>{if(h==null||h(L),n||L.defaultPrevented||L.metaKey||!Wv(L.nativeEvent)||x)return;s&&L.key===" "&&(L.preventDefault(),j(!1),L.currentTarget.click())},[s,x,n,h]),T=l.useCallback(L=>{L.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),Y=l.useCallback(L=>{if(L.button!==0)return;if(n){L.stopPropagation(),L.preventDefault();return}x||j(!0),L.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),i==null||i(L)},[n,x,i,_,T]),z=l.useCallback(L=>{L.button===0&&(x||j(!1),c==null||c(L))},[c,x]),W=l.useCallback(L=>{if(n){L.preventDefault();return}g==null||g(L)},[n,g]),Q=l.useCallback(L=>{S&&(L.preventDefault(),j(!1)),b==null||b(L)},[S,b]),U=gn(t,I);return x?{...y,ref:U,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:R,onMouseDown:i,onMouseUp:c,onKeyUp:h,onKeyDown:p,onMouseOver:g,onMouseLeave:b}:{...y,ref:U,role:"button","data-active":qt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:P,onClick:R,onMouseDown:Y,onMouseUp:z,onKeyUp:O,onKeyDown:D,onMouseOver:W,onMouseLeave:Q}}function KF(e){const t=e.current;if(!t)return!1;const n=SF(t);return!n||t.contains(n)?!1:!!EF(n)}function q5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;xi(()=>{if(!s||KF(e))return;const i=(o==null?void 0:o.current)||e.current;let c;if(i)return c=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var QF={preventScroll:!0,shouldFocus:!1};function XF(e,t=QF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=YF(e)?e.current:e,c=o&&s,d=l.useRef(c),p=l.useRef(s);Yc(()=>{!p.current&&s&&(d.current=c),p.current=s},[s,c]);const h=l.useCallback(()=>{if(!(!s||!i||!d.current)&&(d.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var m;(m=n.current)==null||m.focus({preventScroll:r})});else{const m=$5(i);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,i,n]);xi(()=>{h()},[h]),Tl(i,"transitionend",h)}function YF(e){return"current"in e}var jc=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Fr={arrowShadowColor:jc("--popper-arrow-shadow-color"),arrowSize:jc("--popper-arrow-size","8px"),arrowSizeHalf:jc("--popper-arrow-size-half"),arrowBg:jc("--popper-arrow-bg"),transformOrigin:jc("--popper-transform-origin"),arrowOffset:jc("--popper-arrow-offset")};function JF(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var ZF={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},eB=e=>ZF[e],BS={scroll:!0,resize:!0};function tB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...BS,...e}}:t={enabled:e,options:BS},t}var nB={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},rB={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{HS(e)},effect:({state:e})=>()=>{HS(e)}},HS=e=>{e.elements.popper.style.setProperty(Fr.transformOrigin.var,eB(e.placement))},oB={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{sB(e)}},sB=e=>{var t;if(!e.placement)return;const n=aB(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Fr.arrowSize.varRef,height:Fr.arrowSize.varRef,zIndex:-1});const r={[Fr.arrowSizeHalf.var]:`calc(${Fr.arrowSize.varRef} / 2 - 1px)`,[Fr.arrowOffset.var]:`calc(${Fr.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},aB=e=>{if(e.startsWith("top"))return{property:"bottom",value:Fr.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Fr.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Fr.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Fr.arrowOffset.varRef}},iB={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{WS(e)},effect:({state:e})=>()=>{WS(e)}},WS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=JF(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Fr.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},lB={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},cB={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function uB(e,t="ltr"){var n,r;const o=((n=lB[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=cB[e])!=null?r:o}var Wo="top",Es="bottom",Ms="right",Vo="left",hy="auto",Of=[Wo,Es,Ms,Vo],hu="start",Qd="end",dB="clippingParents",K5="viewport",gd="popper",fB="reference",VS=Of.reduce(function(e,t){return e.concat([t+"-"+hu,t+"-"+Qd])},[]),Q5=[].concat(Of,[hy]).reduce(function(e,t){return e.concat([t,t+"-"+hu,t+"-"+Qd])},[]),pB="beforeRead",hB="read",mB="afterRead",gB="beforeMain",vB="main",bB="afterMain",xB="beforeWrite",yB="write",CB="afterWrite",wB=[pB,hB,mB,gB,vB,bB,xB,yB,CB];function Pa(e){return e?(e.nodeName||"").toLowerCase():null}function cs(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ul(e){var t=cs(e).Element;return e instanceof t||e instanceof Element}function Is(e){var t=cs(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function my(e){if(typeof ShadowRoot>"u")return!1;var t=cs(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function SB(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Is(s)||!Pa(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var c=o[i];c===!1?s.removeAttribute(i):s.setAttribute(i,c===!0?"":c)}))})}function kB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=i.reduce(function(d,p){return d[p]="",d},{});!Is(o)||!Pa(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const jB={name:"applyStyles",enabled:!0,phase:"write",fn:SB,effect:kB,requires:["computeStyles"]};function Ia(e){return e.split("-")[0]}var Nl=Math.max,Zh=Math.min,mu=Math.round;function pb(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function X5(){return!/^((?!chrome|android).)*safari/i.test(pb())}function gu(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Is(e)&&(o=e.offsetWidth>0&&mu(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&mu(r.height)/e.offsetHeight||1);var i=Ul(e)?cs(e):window,c=i.visualViewport,d=!X5()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/o,h=(r.top+(d&&c?c.offsetTop:0))/s,m=r.width/o,g=r.height/s;return{width:m,height:g,top:h,right:p+m,bottom:h+g,left:p,x:p,y:h}}function gy(e){var t=gu(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Y5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&my(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fi(e){return cs(e).getComputedStyle(e)}function _B(e){return["table","td","th"].indexOf(Pa(e))>=0}function cl(e){return((Ul(e)?e.ownerDocument:e.document)||window.document).documentElement}function yg(e){return Pa(e)==="html"?e:e.assignedSlot||e.parentNode||(my(e)?e.host:null)||cl(e)}function US(e){return!Is(e)||fi(e).position==="fixed"?null:e.offsetParent}function IB(e){var t=/firefox/i.test(pb()),n=/Trident/i.test(pb());if(n&&Is(e)){var r=fi(e);if(r.position==="fixed")return null}var o=yg(e);for(my(o)&&(o=o.host);Is(o)&&["html","body"].indexOf(Pa(o))<0;){var s=fi(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Rf(e){for(var t=cs(e),n=US(e);n&&_B(n)&&fi(n).position==="static";)n=US(n);return n&&(Pa(n)==="html"||Pa(n)==="body"&&fi(n).position==="static")?t:n||IB(e)||t}function vy(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Nd(e,t,n){return Nl(e,Zh(t,n))}function PB(e,t,n){var r=Nd(e,t,n);return r>n?n:r}function J5(){return{top:0,right:0,bottom:0,left:0}}function Z5(e){return Object.assign({},J5(),e)}function e3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var EB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Z5(typeof t!="number"?t:e3(t,Of))};function MB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,c=Ia(n.placement),d=vy(c),p=[Vo,Ms].indexOf(c)>=0,h=p?"height":"width";if(!(!s||!i)){var m=EB(o.padding,n),g=gy(s),b=d==="y"?Wo:Vo,y=d==="y"?Es:Ms,x=n.rects.reference[h]+n.rects.reference[d]-i[d]-n.rects.popper[h],C=i[d]-n.rects.reference[d],S=Rf(s),j=S?d==="y"?S.clientHeight||0:S.clientWidth||0:0,_=x/2-C/2,I=m[b],P=j-g[h]-m[y],M=j/2-g[h]/2+_,R=Nd(I,M,P),A=d;n.modifiersData[r]=(t={},t[A]=R,t.centerOffset=R-M,t)}}function OB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||Y5(t.elements.popper,o)&&(t.elements.arrow=o))}const RB={name:"arrow",enabled:!0,phase:"main",fn:MB,effect:OB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vu(e){return e.split("-")[1]}var AB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function DB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:mu(n*o)/o||0,y:mu(r*o)/o||0}}function GS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,m=e.isFixed,g=i.x,b=g===void 0?0:g,y=i.y,x=y===void 0?0:y,C=typeof h=="function"?h({x:b,y:x}):{x:b,y:x};b=C.x,x=C.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Vo,I=Wo,P=window;if(p){var M=Rf(n),R="clientHeight",A="clientWidth";if(M===cs(n)&&(M=cl(n),fi(M).position!=="static"&&c==="absolute"&&(R="scrollHeight",A="scrollWidth")),M=M,o===Wo||(o===Vo||o===Ms)&&s===Qd){I=Es;var D=m&&M===P&&P.visualViewport?P.visualViewport.height:M[R];x-=D-r.height,x*=d?1:-1}if(o===Vo||(o===Wo||o===Es)&&s===Qd){_=Ms;var O=m&&M===P&&P.visualViewport?P.visualViewport.width:M[A];b-=O-r.width,b*=d?1:-1}}var T=Object.assign({position:c},p&&AB),Y=h===!0?DB({x:b,y:x},cs(n)):{x:b,y:x};if(b=Y.x,x=Y.y,d){var z;return Object.assign({},T,(z={},z[I]=j?"0":"",z[_]=S?"0":"",z.transform=(P.devicePixelRatio||1)<=1?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",z))}return Object.assign({},T,(t={},t[I]=j?x+"px":"",t[_]=S?b+"px":"",t.transform="",t))}function TB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:Ia(t.placement),variation:vu(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,GS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,GS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const NB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:TB,data:{}};var Fp={passive:!0};function $B(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,c=i===void 0?!0:i,d=cs(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,Fp)}),c&&d.addEventListener("resize",n.update,Fp),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,Fp)}),c&&d.removeEventListener("resize",n.update,Fp)}}const LB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:$B,data:{}};var zB={left:"right",right:"left",bottom:"top",top:"bottom"};function kh(e){return e.replace(/left|right|bottom|top/g,function(t){return zB[t]})}var FB={start:"end",end:"start"};function qS(e){return e.replace(/start|end/g,function(t){return FB[t]})}function by(e){var t=cs(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function xy(e){return gu(cl(e)).left+by(e).scrollLeft}function BB(e,t){var n=cs(e),r=cl(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;var p=X5();(p||!p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:i,x:c+xy(e),y:d}}function HB(e){var t,n=cl(e),r=by(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Nl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Nl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+xy(e),d=-r.scrollTop;return fi(o||n).direction==="rtl"&&(c+=Nl(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:c,y:d}}function yy(e){var t=fi(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function t3(e){return["html","body","#document"].indexOf(Pa(e))>=0?e.ownerDocument.body:Is(e)&&yy(e)?e:t3(yg(e))}function $d(e,t){var n;t===void 0&&(t=[]);var r=t3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=cs(r),i=o?[s].concat(s.visualViewport||[],yy(r)?r:[]):r,c=t.concat(i);return o?c:c.concat($d(yg(i)))}function hb(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function WB(e,t){var n=gu(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function KS(e,t,n){return t===K5?hb(BB(e,n)):Ul(t)?WB(t,n):hb(HB(cl(e)))}function VB(e){var t=$d(yg(e)),n=["absolute","fixed"].indexOf(fi(e).position)>=0,r=n&&Is(e)?Rf(e):e;return Ul(r)?t.filter(function(o){return Ul(o)&&Y5(o,r)&&Pa(o)!=="body"}):[]}function UB(e,t,n,r){var o=t==="clippingParents"?VB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],c=s.reduce(function(d,p){var h=KS(e,p,r);return d.top=Nl(h.top,d.top),d.right=Zh(h.right,d.right),d.bottom=Zh(h.bottom,d.bottom),d.left=Nl(h.left,d.left),d},KS(e,i,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function n3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Ia(r):null,s=r?vu(r):null,i=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case Wo:d={x:i,y:t.y-n.height};break;case Es:d={x:i,y:t.y+t.height};break;case Ms:d={x:t.x+t.width,y:c};break;case Vo:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=o?vy(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case hu:d[p]=d[p]-(t[h]/2-n[h]/2);break;case Qd:d[p]=d[p]+(t[h]/2-n[h]/2);break}}return d}function Xd(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?dB:c,p=n.rootBoundary,h=p===void 0?K5:p,m=n.elementContext,g=m===void 0?gd:m,b=n.altBoundary,y=b===void 0?!1:b,x=n.padding,C=x===void 0?0:x,S=Z5(typeof C!="number"?C:e3(C,Of)),j=g===gd?fB:gd,_=e.rects.popper,I=e.elements[y?j:g],P=UB(Ul(I)?I:I.contextElement||cl(e.elements.popper),d,h,i),M=gu(e.elements.reference),R=n3({reference:M,element:_,strategy:"absolute",placement:o}),A=hb(Object.assign({},_,R)),D=g===gd?A:M,O={top:P.top-D.top+S.top,bottom:D.bottom-P.bottom+S.bottom,left:P.left-D.left+S.left,right:D.right-P.right+S.right},T=e.modifiersData.offset;if(g===gd&&T){var Y=T[o];Object.keys(O).forEach(function(z){var W=[Ms,Es].indexOf(z)>=0?1:-1,Q=[Wo,Es].indexOf(z)>=0?"y":"x";O[z]+=Y[Q]*W})}return O}function GB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?Q5:d,h=vu(r),m=h?c?VS:VS.filter(function(y){return vu(y)===h}):Of,g=m.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=m);var b=g.reduce(function(y,x){return y[x]=Xd(e,{placement:x,boundary:o,rootBoundary:s,padding:i})[Ia(x)],y},{});return Object.keys(b).sort(function(y,x){return b[y]-b[x]})}function qB(e){if(Ia(e)===hy)return[];var t=kh(e);return[qS(e),t,qS(t)]}function KB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!0:i,d=n.fallbackPlacements,p=n.padding,h=n.boundary,m=n.rootBoundary,g=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,x=n.allowedAutoPlacements,C=t.options.placement,S=Ia(C),j=S===C,_=d||(j||!y?[kh(C)]:qB(C)),I=[C].concat(_).reduce(function(te,V){return te.concat(Ia(V)===hy?GB(t,{placement:V,boundary:h,rootBoundary:m,padding:p,flipVariations:y,allowedAutoPlacements:x}):V)},[]),P=t.rects.reference,M=t.rects.popper,R=new Map,A=!0,D=I[0],O=0;O=0,Q=W?"width":"height",U=Xd(t,{placement:T,boundary:h,rootBoundary:m,altBoundary:g,padding:p}),L=W?z?Ms:Vo:z?Es:Wo;P[Q]>M[Q]&&(L=kh(L));var ee=kh(L),K=[];if(s&&K.push(U[Y]<=0),c&&K.push(U[L]<=0,U[ee]<=0),K.every(function(te){return te})){D=T,A=!1;break}R.set(T,K)}if(A)for(var Z=y?3:1,se=function(V){var F=I.find(function(X){var ue=R.get(X);if(ue)return ue.slice(0,V).every(function(q){return q})});if(F)return D=F,"break"},fe=Z;fe>0;fe--){var G=se(fe);if(G==="break")break}t.placement!==D&&(t.modifiersData[r]._skip=!0,t.placement=D,t.reset=!0)}}const QB={name:"flip",enabled:!0,phase:"main",fn:KB,requiresIfExists:["offset"],data:{_skip:!1}};function QS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function XS(e){return[Wo,Ms,Es,Vo].some(function(t){return e[t]>=0})}function XB(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=Xd(t,{elementContext:"reference"}),c=Xd(t,{altBoundary:!0}),d=QS(i,r),p=QS(c,o,s),h=XS(d),m=XS(p);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":m})}const YB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:XB};function JB(e,t,n){var r=Ia(e),o=[Vo,Wo].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],c=s[1];return i=i||0,c=(c||0)*o,[Vo,Ms].indexOf(r)>=0?{x:c,y:i}:{x:i,y:c}}function ZB(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=Q5.reduce(function(h,m){return h[m]=JB(m,t.rects,s),h},{}),c=i[t.placement],d=c.x,p=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const eH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ZB};function tH(e){var t=e.state,n=e.name;t.modifiersData[n]=n3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const nH={name:"popperOffsets",enabled:!0,phase:"read",fn:tH,data:{}};function rH(e){return e==="x"?"y":"x"}function oH(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,c=i===void 0?!1:i,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,m=n.padding,g=n.tether,b=g===void 0?!0:g,y=n.tetherOffset,x=y===void 0?0:y,C=Xd(t,{boundary:d,rootBoundary:p,padding:m,altBoundary:h}),S=Ia(t.placement),j=vu(t.placement),_=!j,I=vy(S),P=rH(I),M=t.modifiersData.popperOffsets,R=t.rects.reference,A=t.rects.popper,D=typeof x=="function"?x(Object.assign({},t.rects,{placement:t.placement})):x,O=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Y={x:0,y:0};if(M){if(s){var z,W=I==="y"?Wo:Vo,Q=I==="y"?Es:Ms,U=I==="y"?"height":"width",L=M[I],ee=L+C[W],K=L-C[Q],Z=b?-A[U]/2:0,se=j===hu?R[U]:A[U],fe=j===hu?-A[U]:-R[U],G=t.elements.arrow,te=b&&G?gy(G):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:J5(),F=V[W],X=V[Q],ue=Nd(0,R[U],te[U]),q=_?R[U]/2-Z-ue-F-O.mainAxis:se-ue-F-O.mainAxis,ne=_?-R[U]/2+Z+ue+X+O.mainAxis:fe+ue+X+O.mainAxis,pe=t.elements.arrow&&Rf(t.elements.arrow),le=pe?I==="y"?pe.clientTop||0:pe.clientLeft||0:0,we=(z=T==null?void 0:T[I])!=null?z:0,ve=L+q-we-le,he=L+ne-we,Ne=Nd(b?Zh(ee,ve):ee,L,b?Nl(K,he):K);M[I]=Ne,Y[I]=Ne-L}if(c){var De,qe=I==="x"?Wo:Vo,Mt=I==="x"?Es:Ms,ot=M[P],an=P==="y"?"height":"width",pt=ot+C[qe],vt=ot-C[Mt],ke=[Wo,Vo].indexOf(S)!==-1,Be=(De=T==null?void 0:T[P])!=null?De:0,Ot=ke?pt:ot-R[an]-A[an]-Be+O.altAxis,Ht=ke?ot+R[an]+A[an]-Be-O.altAxis:vt,je=b&&ke?PB(Ot,ot,Ht):Nd(b?Ot:pt,ot,b?Ht:vt);M[P]=je,Y[P]=je-ot}t.modifiersData[r]=Y}}const sH={name:"preventOverflow",enabled:!0,phase:"main",fn:oH,requiresIfExists:["offset"]};function aH(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function iH(e){return e===cs(e)||!Is(e)?by(e):aH(e)}function lH(e){var t=e.getBoundingClientRect(),n=mu(t.width)/e.offsetWidth||1,r=mu(t.height)/e.offsetHeight||1;return n!==1||r!==1}function cH(e,t,n){n===void 0&&(n=!1);var r=Is(t),o=Is(t)&&lH(t),s=cl(t),i=gu(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((Pa(t)!=="body"||yy(s))&&(c=iH(t)),Is(t)?(d=gu(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=xy(s))),{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function uH(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(c){if(!n.has(c)){var d=t.get(c);d&&o(d)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function dH(e){var t=uH(e);return wB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function fH(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function pH(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var YS={placement:"bottom",modifiers:[],strategy:"absolute"};function JS(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=l.useCallback(()=>{var O;!t||!y.current||!x.current||((O=j.current)==null||O.call(j),C.current=gH(y.current,x.current,{placement:S,modifiers:[iB,oB,rB,{...nB,enabled:!!g},{name:"eventListeners",...tB(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:c??[0,d]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!m,options:{boundary:h}},...n??[]],strategy:o}),C.current.forceUpdate(),j.current=C.current.destroy)},[S,t,n,g,i,s,c,d,p,m,h,o]);l.useEffect(()=>()=>{var O;!y.current&&!x.current&&((O=C.current)==null||O.destroy(),C.current=null)},[]);const I=l.useCallback(O=>{y.current=O,_()},[_]),P=l.useCallback((O={},T=null)=>({...O,ref:gn(I,T)}),[I]),M=l.useCallback(O=>{x.current=O,_()},[_]),R=l.useCallback((O={},T=null)=>({...O,ref:gn(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),A=l.useCallback((O={},T=null)=>{const{size:Y,shadowColor:z,bg:W,style:Q,...U}=O;return{...U,ref:T,"data-popper-arrow":"",style:vH(O)}},[]),D=l.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=C.current)==null||O.update()},forceUpdate(){var O;(O=C.current)==null||O.forceUpdate()},transformOrigin:Fr.transformOrigin.varRef,referenceRef:I,popperRef:M,getPopperProps:R,getArrowProps:A,getArrowInnerProps:D,getReferenceProps:P}}function vH(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function wy(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=pr(n),i=pr(t),[c,d]=l.useState(e.defaultIsOpen||!1),p=r!==void 0?r:c,h=r!==void 0,m=l.useId(),g=o??`disclosure-${m}`,b=l.useCallback(()=>{h||d(!1),i==null||i()},[h,i]),y=l.useCallback(()=>{h||d(!0),s==null||s()},[h,s]),x=l.useCallback(()=>{p?b():y()},[p,y,b]);function C(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var I;(I=j.onClick)==null||I.call(j,_),x()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:b,onToggle:x,isControlled:h,getButtonProps:C,getDisclosureProps:S}}function bH(e){const{ref:t,handler:n,enabled:r=!0}=e,o=pr(n),i=l.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;l.useEffect(()=>{if(!r)return;const c=m=>{Vv(m,t)&&(i.isPointerDown=!0)},d=m=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&Vv(m,t)&&(i.isPointerDown=!1,o(m))},p=m=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&Vv(m,t)&&(i.isPointerDown=!1,o(m))},h=r3(t.current);return h.addEventListener("mousedown",c,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",c,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",c,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",c,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function Vv(e,t){var n;const r=e.target;return r&&!r3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function r3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function o3(e){const{isOpen:t,ref:n}=e,[r,o]=l.useState(t),[s,i]=l.useState(!1);return l.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Tl(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=wF(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Sy(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[xH,yH,CH,wH]=Gx(),[SH,Af]=Hn({strict:!1,name:"MenuContext"});function kH(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function s3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function ZS(e){return s3(e).activeElement===e}function jH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:c,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:g="unmount",direction:b,computePositionOnMount:y=!1,...x}=e,C=l.useRef(null),S=l.useRef(null),j=CH(),_=l.useCallback(()=>{requestAnimationFrame(()=>{var G;(G=C.current)==null||G.focus({preventScroll:!1})})},[]),I=l.useCallback(()=>{const G=setTimeout(()=>{var te;if(o)(te=o.current)==null||te.focus();else{const V=j.firstEnabled();V&&z(V.index)}});ee.current.add(G)},[j,o]),P=l.useCallback(()=>{const G=setTimeout(()=>{const te=j.lastEnabled();te&&z(te.index)});ee.current.add(G)},[j]),M=l.useCallback(()=>{h==null||h(),s?I():_()},[s,I,_,h]),{isOpen:R,onOpen:A,onClose:D,onToggle:O}=wy({isOpen:c,defaultIsOpen:d,onClose:p,onOpen:M});bH({enabled:R&&r,ref:C,handler:G=>{var te;(te=S.current)!=null&&te.contains(G.target)||D()}});const T=Cy({...x,enabled:R||y,placement:m,direction:b}),[Y,z]=l.useState(-1);xi(()=>{R||z(-1)},[R]),q5(C,{focusRef:S,visible:R,shouldFocus:!0});const W=o3({isOpen:R,ref:C}),[Q,U]=kH(t,"menu-button","menu-list"),L=l.useCallback(()=>{A(),_()},[A,_]),ee=l.useRef(new Set([]));RH(()=>{ee.current.forEach(G=>clearTimeout(G)),ee.current.clear()});const K=l.useCallback(()=>{A(),I()},[I,A]),Z=l.useCallback(()=>{A(),P()},[A,P]),se=l.useCallback(()=>{var G,te;const V=s3(C.current),F=(G=C.current)==null?void 0:G.contains(V.activeElement);if(!(R&&!F))return;const ue=(te=j.item(Y))==null?void 0:te.node;ue==null||ue.focus()},[R,Y,j]),fe=l.useRef(null);return{openAndFocusMenu:L,openAndFocusFirstItem:K,openAndFocusLastItem:Z,onTransitionEnd:se,unstable__animationState:W,descendants:j,popper:T,buttonId:Q,menuId:U,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:R,onToggle:O,onOpen:A,onClose:D,menuRef:C,buttonRef:S,focusedIndex:Y,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:z,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:fe}}function _H(e={},t=null){const n=Af(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,c=l.useCallback(d=>{const p=d.key,m={Enter:s,ArrowDown:s,ArrowUp:i}[p];m&&(d.preventDefault(),d.stopPropagation(),m(d))},[s,i]);return{...e,ref:gn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":qt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:rt(e.onClick,r),onKeyDown:rt(e.onKeyDown,c)}}function mb(e){var t;return MH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function IH(e={},t=null){const n=Af();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:c,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,g=yH(),b=UF({preventDefault:S=>S.key!==" "&&mb(S.target)}),y=l.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,I={Tab:M=>M.preventDefault(),Escape:c,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(I){S.preventDefault(),I(S);return}const P=b(M=>{const R=GF(g.values(),M,A=>{var D,O;return(O=(D=A==null?void 0:A.node)==null?void 0:D.textContent)!=null?O:""},g.item(r));if(R){const A=g.indexOf(R.node);o(A)}});mb(S.target)&&P(S)},[g,r,b,c,o]),x=l.useRef(!1);i&&(x.current=!0);const C=Sy({wasSelected:x.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:gn(s,t),children:C?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:rt(e.onKeyDown,y)}}function PH(e={}){const{popper:t,isOpen:n}=Af();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function EH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:c,isFocusable:d,closeOnSelect:p,type:h,...m}=e,g=Af(),{setFocusedIndex:b,focusedIndex:y,closeOnSelect:x,onClose:C,menuRef:S,isOpen:j,menuId:_,rafId:I}=g,P=l.useRef(null),M=`${_}-menuitem-${l.useId()}`,{index:R,register:A}=wH({disabled:c&&!d}),D=l.useCallback(L=>{n==null||n(L),!c&&b(R)},[b,R,c,n]),O=l.useCallback(L=>{r==null||r(L),P.current&&!ZS(P.current)&&D(L)},[D,r]),T=l.useCallback(L=>{o==null||o(L),!c&&b(-1)},[b,c,o]),Y=l.useCallback(L=>{s==null||s(L),mb(L.currentTarget)&&(p??x)&&C()},[C,s,x,p]),z=l.useCallback(L=>{i==null||i(L),b(R)},[b,i,R]),W=R===y,Q=c&&!d;xi(()=>{j&&(W&&!Q&&P.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var L;(L=P.current)==null||L.focus(),I.current=null})):S.current&&!ZS(S.current)&&S.current.focus({preventScroll:!0}))},[W,Q,S,j]);const U=G5({onClick:Y,onFocus:z,onMouseEnter:D,onMouseMove:O,onMouseLeave:T,ref:gn(A,P,t),isDisabled:c,isFocusable:d});return{...m,...U,type:h??U.type,id:M,role:"menuitem",tabIndex:W?0:-1}}function MH(e){var t;if(!OH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function OH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function RH(e,t=[]){return l.useEffect(()=>()=>e(),t)}var[AH,$u]=Hn({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Cg=e=>{const{children:t}=e,n=Qr("Menu",e),r=ar(e),{direction:o}=mf(),{descendants:s,...i}=jH({...r,direction:o}),c=l.useMemo(()=>i,[i]),{isOpen:d,onClose:p,forceUpdate:h}=c;return a.jsx(xH,{value:s,children:a.jsx(SH,{value:c,children:a.jsx(AH,{value:n,children:xx(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Cg.displayName="Menu";var a3=Oe((e,t)=>{const n=$u();return a.jsx(Ee.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});a3.displayName="MenuCommand";var DH=Oe((e,t)=>{const{type:n,...r}=e,o=$u(),s=r.as||n?n??void 0:"button",i=l.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(Ee.button,{ref:t,type:s,...r,__css:i})}),i3=e=>{const{className:t,children:n,...r}=e,o=$u(),s=l.Children.only(n),i=l.isValidElement(s)?l.cloneElement(s,{focusable:"false","aria-hidden":!0,className:jt("chakra-menu__icon",s.props.className)}):null,c=jt("chakra-menu__icon-wrapper",t);return a.jsx(Ee.span,{className:c,...r,__css:o.icon,children:i})};i3.displayName="MenuIcon";var Vn=Oe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...c}=e,d=EH(c,t),h=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(DH,{...d,className:jt("chakra-menu__menuitem",d.className),children:[n&&a.jsx(i3,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&a.jsx(a3,{marginStart:s,children:o})]})});Vn.displayName="MenuItem";var TH={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},NH=Ee(Or.div),Gl=Oe(function(t,n){var r,o;const{rootProps:s,motionProps:i,...c}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Af(),m=IH(c,n),g=PH(s),b=$u();return a.jsx(Ee.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:a.jsx(NH,{variants:TH,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...i,className:jt("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:og(h.onComplete,m.onAnimationComplete)})})});Gl.displayName="MenuList";var Yd=Oe((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=jt("chakra-menu__group__title",o),c=$u();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(Ee.p,{className:i,...s,__css:c.groupTitle,children:n}),r]})});Yd.displayName="MenuGroup";var $H=Oe((e,t)=>{const n=$u();return a.jsx(Ee.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),wg=Oe((e,t)=>{const{children:n,as:r,...o}=e,s=_H(o,t),i=r||$H;return a.jsx(i,{...s,className:jt("chakra-menu__menu-button",e.className),children:a.jsx(Ee.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});wg.displayName="MenuButton";var LH={slideInBottom:{...eb,custom:{offsetY:16,reverse:!0}},slideInRight:{...eb,custom:{offsetX:16,reverse:!0}},scale:{...LP,custom:{initialScale:.95,reverse:!0}},none:{}},zH=Ee(Or.section),FH=e=>LH[e||"none"],l3=l.forwardRef((e,t)=>{const{preset:n,motionProps:r=FH(n),...o}=e;return a.jsx(zH,{ref:t,...r,...o})});l3.displayName="ModalTransition";var BH=Object.defineProperty,HH=(e,t,n)=>t in e?BH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WH=(e,t,n)=>(HH(e,typeof t!="symbol"?t+"":t,n),n),VH=class{constructor(){WH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},gb=new VH;function c3(e,t){const[n,r]=l.useState(0);return l.useEffect(()=>{const o=e.current;if(o){if(t){const s=gb.add(o);r(s)}return()=>{gb.remove(o),r(0)}}},[t,e]),n}var UH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_c=new WeakMap,Bp=new WeakMap,Hp={},Uv=0,u3=function(e){return e&&(e.host||u3(e.parentNode))},GH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=u3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},qH=function(e,t,n,r){var o=GH(t,Array.isArray(e)?e:[e]);Hp[n]||(Hp[n]=new WeakMap);var s=Hp[n],i=[],c=new Set,d=new Set(o),p=function(m){!m||c.has(m)||(c.add(m),p(m.parentNode))};o.forEach(p);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))h(g);else{var b=g.getAttribute(r),y=b!==null&&b!=="false",x=(_c.get(g)||0)+1,C=(s.get(g)||0)+1;_c.set(g,x),s.set(g,C),i.push(g),x===1&&y&&Bp.set(g,!0),C===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return h(t),c.clear(),Uv++,function(){i.forEach(function(m){var g=_c.get(m)-1,b=s.get(m)-1;_c.set(m,g),s.set(m,b),g||(Bp.has(m)||m.removeAttribute(r),Bp.delete(m)),b||m.removeAttribute(n)}),Uv--,Uv||(_c=new WeakMap,_c=new WeakMap,Bp=new WeakMap,Hp={})}},KH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||UH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),qH(r,o,n,"aria-hidden")):function(){return null}};function QH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:c,onEsc:d}=e,p=l.useRef(null),h=l.useRef(null),[m,g,b]=YH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");XH(p,t&&i);const y=c3(p,t),x=l.useRef(null),C=l.useCallback(D=>{x.current=D.target},[]),S=l.useCallback(D=>{D.key==="Escape"&&(D.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[j,_]=l.useState(!1),[I,P]=l.useState(!1),M=l.useCallback((D={},O=null)=>({role:"dialog",...D,ref:gn(O,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":I?b:void 0,onClick:rt(D.onClick,T=>T.stopPropagation())}),[b,I,m,g,j]),R=l.useCallback(D=>{D.stopPropagation(),x.current===D.target&&gb.isTopModal(p.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),A=l.useCallback((D={},O=null)=>({...D,ref:gn(O,h),onClick:rt(D.onClick,R),onKeyDown:rt(D.onKeyDown,S),onMouseDown:rt(D.onMouseDown,C)}),[S,C,R]);return{isOpen:t,onClose:n,headerId:g,bodyId:b,setBodyMounted:P,setHeaderMounted:_,dialogRef:p,overlayRef:h,getDialogProps:M,getDialogContainerProps:A,index:y}}function XH(e,t){const n=e.current;l.useEffect(()=>{if(!(!e.current||!t))return KH(e.current)},[t,e,n])}function YH(e,...t){const n=l.useId(),r=e||n;return l.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[JH,Lu]=Hn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ZH,ql]=Hn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),bu=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b,onCloseComplete:y}=t,x=Qr("Modal",t),S={...QH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:g,lockFocusAcrossFrames:b};return a.jsx(ZH,{value:S,children:a.jsx(JH,{value:x,children:a.jsx(yo,{onExitComplete:y,children:S.isOpen&&a.jsx(Ru,{...n,children:r})})})})};bu.displayName="Modal";var jh="right-scroll-bar-position",_h="width-before-scroll-bar",eW="with-scroll-bars-hidden",tW="--removed-body-scroll-bar-size",d3=i5(),Gv=function(){},Sg=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:Gv,onWheelCapture:Gv,onTouchMoveCapture:Gv}),o=r[0],s=r[1],i=e.forwardProps,c=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,b=e.noIsolation,y=e.inert,x=e.allowPinchZoom,C=e.as,S=C===void 0?"div":C,j=e.gapMode,_=o5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=g,P=r5([n,t]),M=Ca(Ca({},_),o);return l.createElement(l.Fragment,null,h&&l.createElement(I,{sideCar:d3,removeScrollBar:p,shards:m,noIsolation:b,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:j}),i?l.cloneElement(l.Children.only(c),Ca(Ca({},M),{ref:P})):l.createElement(S,Ca({},M,{className:d,ref:P}),c))});Sg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Sg.classNames={fullWidth:_h,zeroRight:jh};var ek,nW=function(){if(ek)return ek;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=nW();return t&&e.setAttribute("nonce",t),e}function oW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var aW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rW())&&(oW(t,n),sW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iW=function(){var e=aW();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},f3=function(){var e=iW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},lW={left:0,top:0,right:0,gap:0},qv=function(e){return parseInt(e||"",10)||0},cW=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[qv(n),qv(r),qv(o)]},uW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lW;var t=cW(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dW=f3(),fW=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),` - .`.concat(eW,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(o,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(i,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(jh,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(_h,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(jh," .").concat(jh,` { - right: 0 `).concat(r,`; - } - - .`).concat(_h," .").concat(_h,` { - margin-right: 0 `).concat(r,`; - } - - body { - `).concat(tW,": ").concat(c,`px; - } -`)},pW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=l.useMemo(function(){return uW(o)},[o]);return l.createElement(dW,{styles:fW(s,!t,o,n?"":"!important")})},vb=!1;if(typeof window<"u")try{var Wp=Object.defineProperty({},"passive",{get:function(){return vb=!0,!0}});window.addEventListener("test",Wp,Wp),window.removeEventListener("test",Wp,Wp)}catch{vb=!1}var Ic=vb?{passive:!1}:!1,hW=function(e){return e.tagName==="TEXTAREA"},p3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!hW(e)&&n[t]==="visible")},mW=function(e){return p3(e,"overflowY")},gW=function(e){return p3(e,"overflowX")},tk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=h3(e,r);if(o){var s=m3(e,r),i=s[1],c=s[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},vW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},bW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},h3=function(e,t){return e==="v"?mW(t):gW(t)},m3=function(e,t){return e==="v"?vW(t):bW(t)},xW=function(e,t){return e==="h"&&t==="rtl"?-1:1},yW=function(e,t,n,r,o){var s=xW(e,window.getComputedStyle(t).direction),i=s*r,c=n.target,d=t.contains(c),p=!1,h=i>0,m=0,g=0;do{var b=m3(e,c),y=b[0],x=b[1],C=b[2],S=x-C-s*y;(y||S)&&h3(e,c)&&(m+=S,g+=y),c=c.parentNode}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(h&&(o&&m===0||!o&&i>m)||!h&&(o&&g===0||!o&&-i>g))&&(p=!0),p},Vp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nk=function(e){return[e.deltaX,e.deltaY]},rk=function(e){return e&&"current"in e?e.current:e},CW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wW=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},SW=0,Pc=[];function kW(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),o=l.useState(SW++)[0],s=l.useState(f3)[0],i=l.useRef(e);l.useEffect(function(){i.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var x=lb([e.lockRef.current],(e.shards||[]).map(rk),!0).filter(Boolean);return x.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=l.useCallback(function(x,C){if("touches"in x&&x.touches.length===2)return!i.current.allowPinchZoom;var S=Vp(x),j=n.current,_="deltaX"in x?x.deltaX:j[0]-S[0],I="deltaY"in x?x.deltaY:j[1]-S[1],P,M=x.target,R=Math.abs(_)>Math.abs(I)?"h":"v";if("touches"in x&&R==="h"&&M.type==="range")return!1;var A=tk(R,M);if(!A)return!0;if(A?P=R:(P=R==="v"?"h":"v",A=tk(R,M)),!A)return!1;if(!r.current&&"changedTouches"in x&&(_||I)&&(r.current=P),!P)return!0;var D=r.current||P;return yW(D,C,x,D==="h"?_:I,!0)},[]),d=l.useCallback(function(x){var C=x;if(!(!Pc.length||Pc[Pc.length-1]!==s)){var S="deltaY"in C?nk(C):Vp(C),j=t.current.filter(function(P){return P.name===C.type&&P.target===C.target&&CW(P.delta,S)})[0];if(j&&j.should){C.cancelable&&C.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(rk).filter(Boolean).filter(function(P){return P.contains(C.target)}),I=_.length>0?c(C,_[0]):!i.current.noIsolation;I&&C.cancelable&&C.preventDefault()}}},[]),p=l.useCallback(function(x,C,S,j){var _={name:x,delta:C,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(I){return I!==_})},1)},[]),h=l.useCallback(function(x){n.current=Vp(x),r.current=void 0},[]),m=l.useCallback(function(x){p(x.type,nk(x),x.target,c(x,e.lockRef.current))},[]),g=l.useCallback(function(x){p(x.type,Vp(x),x.target,c(x,e.lockRef.current))},[]);l.useEffect(function(){return Pc.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",d,Ic),document.addEventListener("touchmove",d,Ic),document.addEventListener("touchstart",h,Ic),function(){Pc=Pc.filter(function(x){return x!==s}),document.removeEventListener("wheel",d,Ic),document.removeEventListener("touchmove",d,Ic),document.removeEventListener("touchstart",h,Ic)}},[]);var b=e.removeScrollBar,y=e.inert;return l.createElement(l.Fragment,null,y?l.createElement(s,{styles:wW(o)}):null,b?l.createElement(pW,{gapMode:e.gapMode}):null)}const jW=jz(d3,kW);var g3=l.forwardRef(function(e,t){return l.createElement(Sg,Ca({},e,{ref:t,sideCar:jW}))});g3.classNames=Sg.classNames;const _W=g3;function IW(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:c,returnFocusOnClose:d,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:m}=ql(),[g,b]=iD();l.useEffect(()=>{!g&&b&&setTimeout(b)},[g,b]);const y=c3(r,m);return a.jsx(L5,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:c,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:h,children:a.jsx(_W,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var xu=Oe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:c,getDialogContainerProps:d}=ql(),p=c(i,t),h=d(o),m=jt("chakra-modal__content",n),g=Lu(),b={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:x}=ql();return a.jsx(IW,{children:a.jsx(Ee.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(l3,{preset:x,motionProps:s,className:m,...p,__css:b,children:r})})})});xu.displayName="ModalContent";function Df(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(bu,{...n,initialFocusRef:t})}var Tf=Oe((e,t)=>a.jsx(xu,{ref:t,role:"alertdialog",...e})),pi=Oe((e,t)=>{const{className:n,...r}=e,o=jt("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Lu().footer};return a.jsx(Ee.footer,{ref:t,...r,__css:i,className:o})});pi.displayName="ModalFooter";var Ea=Oe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=ql();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=jt("chakra-modal__header",n),d={flex:0,...Lu().header};return a.jsx(Ee.header,{ref:t,className:i,id:o,...r,__css:d})});Ea.displayName="ModalHeader";var PW=Ee(Or.div),Ma=Oe((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=jt("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Lu().overlay},{motionPreset:p}=ql(),m=o||(p==="none"?{}:$P);return a.jsx(PW,{...m,__css:d,ref:t,className:i,...s})});Ma.displayName="ModalOverlay";var Oa=Oe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=ql();l.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=jt("chakra-modal__body",n),c=Lu();return a.jsx(Ee.div,{ref:t,className:i,id:o,...r,__css:c.body})});Oa.displayName="ModalBody";var kg=Oe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=ql(),i=jt("chakra-modal__close-btn",r),c=Lu();return a.jsx(kI,{ref:t,__css:c.closeButton,className:i,onClick:rt(n,d=>{d.stopPropagation(),s()}),...o})});kg.displayName="ModalCloseButton";var EW=e=>a.jsx(zr,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),MW=e=>a.jsx(zr,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function ok(e,t,n,r){l.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],c=new s.MutationObserver(d=>{for(const p of d)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return c.observe(e.current,{attributes:!0,attributeFilter:i}),()=>c.disconnect()})}function OW(e,t){const n=pr(e);l.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var RW=50,sk=300;function AW(e,t){const[n,r]=l.useState(!1),[o,s]=l.useState(null),[i,c]=l.useState(!0),d=l.useRef(null),p=()=>clearTimeout(d.current);OW(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?RW:null);const h=l.useCallback(()=>{i&&e(),d.current=setTimeout(()=>{c(!1),r(!0),s("increment")},sk)},[e,i]),m=l.useCallback(()=>{i&&t(),d.current=setTimeout(()=>{c(!1),r(!0),s("decrement")},sk)},[t,i]),g=l.useCallback(()=>{c(!0),r(!1),p()},[]);return l.useEffect(()=>()=>p(),[]),{up:h,down:m,stop:g,isSpinning:n}}var DW=/^[Ee0-9+\-.]$/;function TW(e){return DW.test(e)}function NW(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function $W(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:c,isDisabled:d,isRequired:p,isInvalid:h,pattern:m="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:b,id:y,onChange:x,precision:C,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":I,onFocus:P,onBlur:M,onInvalid:R,getAriaValueText:A,isValidCharacter:D,format:O,parse:T,...Y}=e,z=pr(P),W=pr(M),Q=pr(R),U=pr(D??TW),L=pr(A),ee=sz(e),{update:K,increment:Z,decrement:se}=ee,[fe,G]=l.useState(!1),te=!(c||d),V=l.useRef(null),F=l.useRef(null),X=l.useRef(null),ue=l.useRef(null),q=l.useCallback(je=>je.split("").filter(U).join(""),[U]),ne=l.useCallback(je=>{var ht;return(ht=T==null?void 0:T(je))!=null?ht:je},[T]),pe=l.useCallback(je=>{var ht;return((ht=O==null?void 0:O(je))!=null?ht:je).toString()},[O]);xi(()=>{(ee.valueAsNumber>s||ee.valueAsNumber{if(!V.current)return;if(V.current.value!=ee.value){const ht=ne(V.current.value);ee.setValue(q(ht))}},[ne,q]);const le=l.useCallback((je=i)=>{te&&Z(je)},[Z,te,i]),we=l.useCallback((je=i)=>{te&&se(je)},[se,te,i]),ve=AW(le,we);ok(X,"disabled",ve.stop,ve.isSpinning),ok(ue,"disabled",ve.stop,ve.isSpinning);const he=l.useCallback(je=>{if(je.nativeEvent.isComposing)return;const At=ne(je.currentTarget.value);K(q(At)),F.current={start:je.currentTarget.selectionStart,end:je.currentTarget.selectionEnd}},[K,q,ne]),Ne=l.useCallback(je=>{var ht,At,_t;z==null||z(je),F.current&&(je.target.selectionStart=(At=F.current.start)!=null?At:(ht=je.currentTarget.value)==null?void 0:ht.length,je.currentTarget.selectionEnd=(_t=F.current.end)!=null?_t:je.currentTarget.selectionStart)},[z]),De=l.useCallback(je=>{if(je.nativeEvent.isComposing)return;NW(je,U)||je.preventDefault();const ht=qe(je)*i,At=je.key,Re={ArrowUp:()=>le(ht),ArrowDown:()=>we(ht),Home:()=>K(o),End:()=>K(s)}[At];Re&&(je.preventDefault(),Re(je))},[U,i,le,we,K,o,s]),qe=je=>{let ht=1;return(je.metaKey||je.ctrlKey)&&(ht=.1),je.shiftKey&&(ht=10),ht},Mt=l.useMemo(()=>{const je=L==null?void 0:L(ee.value);if(je!=null)return je;const ht=ee.value.toString();return ht||void 0},[ee.value,L]),ot=l.useCallback(()=>{let je=ee.value;if(ee.value==="")return;/^[eE]/.test(ee.value.toString())?ee.setValue(""):(ee.valueAsNumbers&&(je=s),ee.cast(je))},[ee,s,o]),an=l.useCallback(()=>{G(!1),n&&ot()},[n,G,ot]),pt=l.useCallback(()=>{t&&requestAnimationFrame(()=>{var je;(je=V.current)==null||je.focus()})},[t]),vt=l.useCallback(je=>{je.preventDefault(),ve.up(),pt()},[pt,ve]),ke=l.useCallback(je=>{je.preventDefault(),ve.down(),pt()},[pt,ve]);Tl(()=>V.current,"wheel",je=>{var ht,At;const Re=((At=(ht=V.current)==null?void 0:ht.ownerDocument)!=null?At:document).activeElement===V.current;if(!b||!Re)return;je.preventDefault();const Xe=qe(je)*i,_n=Math.sign(je.deltaY);_n===-1?le(Xe):_n===1&&we(Xe)},{passive:!1});const Be=l.useCallback((je={},ht=null)=>{const At=d||r&&ee.isAtMax;return{...je,ref:gn(ht,X),role:"button",tabIndex:-1,onPointerDown:rt(je.onPointerDown,_t=>{_t.button!==0||At||vt(_t)}),onPointerLeave:rt(je.onPointerLeave,ve.stop),onPointerUp:rt(je.onPointerUp,ve.stop),disabled:At,"aria-disabled":_s(At)}},[ee.isAtMax,r,vt,ve.stop,d]),Ot=l.useCallback((je={},ht=null)=>{const At=d||r&&ee.isAtMin;return{...je,ref:gn(ht,ue),role:"button",tabIndex:-1,onPointerDown:rt(je.onPointerDown,_t=>{_t.button!==0||At||ke(_t)}),onPointerLeave:rt(je.onPointerLeave,ve.stop),onPointerUp:rt(je.onPointerUp,ve.stop),disabled:At,"aria-disabled":_s(At)}},[ee.isAtMin,r,ke,ve.stop,d]),Ht=l.useCallback((je={},ht=null)=>{var At,_t,Re,Xe;return{name:S,inputMode:g,type:"text",pattern:m,"aria-labelledby":I,"aria-label":_,"aria-describedby":j,id:y,disabled:d,...je,readOnly:(At=je.readOnly)!=null?At:c,"aria-readonly":(_t=je.readOnly)!=null?_t:c,"aria-required":(Re=je.required)!=null?Re:p,required:(Xe=je.required)!=null?Xe:p,ref:gn(V,ht),value:pe(ee.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(ee.valueAsNumber)?void 0:ee.valueAsNumber,"aria-invalid":_s(h??ee.isOutOfRange),"aria-valuetext":Mt,autoComplete:"off",autoCorrect:"off",onChange:rt(je.onChange,he),onKeyDown:rt(je.onKeyDown,De),onFocus:rt(je.onFocus,Ne,()=>G(!0)),onBlur:rt(je.onBlur,W,an)}},[S,g,m,I,_,pe,j,y,d,p,c,h,ee.value,ee.valueAsNumber,ee.isOutOfRange,o,s,Mt,he,De,Ne,W,an]);return{value:pe(ee.value),valueAsNumber:ee.valueAsNumber,isFocused:fe,isDisabled:d,isReadOnly:c,getIncrementButtonProps:Be,getDecrementButtonProps:Ot,getInputProps:Ht,htmlProps:Y}}var[LW,jg]=Hn({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[zW,ky]=Hn({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),_g=Oe(function(t,n){const r=Qr("NumberInput",t),o=ar(t),s=Xx(o),{htmlProps:i,...c}=$W(s),d=l.useMemo(()=>c,[c]);return a.jsx(zW,{value:d,children:a.jsx(LW,{value:r,children:a.jsx(Ee.div,{...i,ref:n,className:jt("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});_g.displayName="NumberInput";var Ig=Oe(function(t,n){const r=jg();return a.jsx(Ee.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});Ig.displayName="NumberInputStepper";var Pg=Oe(function(t,n){const{getInputProps:r}=ky(),o=r(t,n),s=jg();return a.jsx(Ee.input,{...o,className:jt("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Pg.displayName="NumberInputField";var v3=Ee("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Eg=Oe(function(t,n){var r;const o=jg(),{getDecrementButtonProps:s}=ky(),i=s(t,n);return a.jsx(v3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(EW,{})})});Eg.displayName="NumberDecrementStepper";var Mg=Oe(function(t,n){var r;const{getIncrementButtonProps:o}=ky(),s=o(t,n),i=jg();return a.jsx(v3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(MW,{})})});Mg.displayName="NumberIncrementStepper";var[FW,ec]=Hn({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[BW,Og]=Hn({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Rg(e){const t=l.Children.only(e.children),{getTriggerProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}Rg.displayName="PopoverTrigger";var Ec={click:"click",hover:"hover"};function HW(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:c,arrowShadowColor:d,trigger:p=Ec.click,openDelay:h=200,closeDelay:m=200,isLazy:g,lazyBehavior:b="unmount",computePositionOnMount:y,...x}=e,{isOpen:C,onClose:S,onOpen:j,onToggle:_}=wy(e),I=l.useRef(null),P=l.useRef(null),M=l.useRef(null),R=l.useRef(!1),A=l.useRef(!1);C&&(A.current=!0);const[D,O]=l.useState(!1),[T,Y]=l.useState(!1),z=l.useId(),W=o??z,[Q,U,L,ee]=["popover-trigger","popover-content","popover-header","popover-body"].map(he=>`${he}-${W}`),{referenceRef:K,getArrowProps:Z,getPopperProps:se,getArrowInnerProps:fe,forceUpdate:G}=Cy({...x,enabled:C||!!y}),te=o3({isOpen:C,ref:M});YP({enabled:C,ref:P}),q5(M,{focusRef:P,visible:C,shouldFocus:s&&p===Ec.click}),XF(M,{focusRef:r,visible:C,shouldFocus:i&&p===Ec.click});const V=Sy({wasSelected:A.current,enabled:g,mode:b,isSelected:te.present}),F=l.useCallback((he={},Ne=null)=>{const De={...he,style:{...he.style,transformOrigin:Fr.transformOrigin.varRef,[Fr.arrowSize.var]:c?`${c}px`:void 0,[Fr.arrowShadowColor.var]:d},ref:gn(M,Ne),children:V?he.children:null,id:U,tabIndex:-1,role:"dialog",onKeyDown:rt(he.onKeyDown,qe=>{n&&qe.key==="Escape"&&S()}),onBlur:rt(he.onBlur,qe=>{const Mt=ak(qe),ot=Kv(M.current,Mt),an=Kv(P.current,Mt);C&&t&&(!ot&&!an)&&S()}),"aria-labelledby":D?L:void 0,"aria-describedby":T?ee:void 0};return p===Ec.hover&&(De.role="tooltip",De.onMouseEnter=rt(he.onMouseEnter,()=>{R.current=!0}),De.onMouseLeave=rt(he.onMouseLeave,qe=>{qe.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>S(),m))})),De},[V,U,D,L,T,ee,p,n,S,C,t,m,d,c]),X=l.useCallback((he={},Ne=null)=>se({...he,style:{visibility:C?"visible":"hidden",...he.style}},Ne),[C,se]),ue=l.useCallback((he,Ne=null)=>({...he,ref:gn(Ne,I,K)}),[I,K]),q=l.useRef(),ne=l.useRef(),pe=l.useCallback(he=>{I.current==null&&K(he)},[K]),le=l.useCallback((he={},Ne=null)=>{const De={...he,ref:gn(P,Ne,pe),id:Q,"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":U};return p===Ec.click&&(De.onClick=rt(he.onClick,_)),p===Ec.hover&&(De.onFocus=rt(he.onFocus,()=>{q.current===void 0&&j()}),De.onBlur=rt(he.onBlur,qe=>{const Mt=ak(qe),ot=!Kv(M.current,Mt);C&&t&&ot&&S()}),De.onKeyDown=rt(he.onKeyDown,qe=>{qe.key==="Escape"&&S()}),De.onMouseEnter=rt(he.onMouseEnter,()=>{R.current=!0,q.current=window.setTimeout(()=>j(),h)}),De.onMouseLeave=rt(he.onMouseLeave,()=>{R.current=!1,q.current&&(clearTimeout(q.current),q.current=void 0),ne.current=window.setTimeout(()=>{R.current===!1&&S()},m)})),De},[Q,C,U,p,pe,_,j,t,S,h,m]);l.useEffect(()=>()=>{q.current&&clearTimeout(q.current),ne.current&&clearTimeout(ne.current)},[]);const we=l.useCallback((he={},Ne=null)=>({...he,id:L,ref:gn(Ne,De=>{O(!!De)})}),[L]),ve=l.useCallback((he={},Ne=null)=>({...he,id:ee,ref:gn(Ne,De=>{Y(!!De)})}),[ee]);return{forceUpdate:G,isOpen:C,onAnimationComplete:te.onComplete,onClose:S,getAnchorProps:ue,getArrowProps:Z,getArrowInnerProps:fe,getPopoverPositionerProps:X,getPopoverProps:F,getTriggerProps:le,getHeaderProps:we,getBodyProps:ve}}function Kv(e,t){return e===t||(e==null?void 0:e.contains(t))}function ak(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Nf(e){const t=Qr("Popover",e),{children:n,...r}=ar(e),o=mf(),s=HW({...r,direction:o.direction});return a.jsx(FW,{value:s,children:a.jsx(BW,{value:t,children:xx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Nf.displayName="Popover";function b3(e){const t=l.Children.only(e.children),{getAnchorProps:n}=ec();return l.cloneElement(t,n(t.props,t.ref))}b3.displayName="PopoverAnchor";var Qv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function x3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:c}=e,{getArrowProps:d,getArrowInnerProps:p}=ec(),h=Og(),m=(t=n??r)!=null?t:o,g=s??i;return a.jsx(Ee.div,{...d(),className:"chakra-popover__arrow-positioner",children:a.jsx(Ee.div,{className:jt("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":Qv("colors",c),"--popper-arrow-bg":Qv("colors",m),"--popper-arrow-shadow":Qv("shadows",g),...h.arrow}})})}x3.displayName="PopoverArrow";var Ag=Oe(function(t,n){const{getBodyProps:r}=ec(),o=Og();return a.jsx(Ee.div,{...r(t,n),className:jt("chakra-popover__body",t.className),__css:o.body})});Ag.displayName="PopoverBody";var y3=Oe(function(t,n){const{onClose:r}=ec(),o=Og();return a.jsx(kI,{size:"sm",onClick:r,className:jt("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});y3.displayName="PopoverCloseButton";function WW(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var VW={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},UW=Ee(Or.section),C3=Oe(function(t,n){const{variants:r=VW,...o}=t,{isOpen:s}=ec();return a.jsx(UW,{ref:n,variants:WW(r),initial:!1,animate:s?"enter":"exit",...o})});C3.displayName="PopoverTransition";var $f=Oe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:c,onAnimationComplete:d}=ec(),p=Og(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(Ee.div,{...c(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(C3,{...o,...i(s,n),onAnimationComplete:og(d,s.onAnimationComplete),className:jt("chakra-popover__content",t.className),__css:h})})});$f.displayName="PopoverContent";var bb=e=>a.jsx(Ee.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});bb.displayName="Circle";function GW(e,t,n){return(e-t)*100/(n-t)}var qW=yi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),KW=yi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QW=yi({"0%":{left:"-40%"},"100%":{left:"100%"}}),XW=yi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function w3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:c="progressbar"}=e,d=GW(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,d):o})(),role:c},percent:d,value:t}}var S3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(Ee.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${KW} 2s linear infinite`:void 0},...r})};S3.displayName="Shape";var xb=Oe((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:c,value:d,capIsRound:p,children:h,thickness:m="10px",color:g="#0078d4",trackColor:b="#edebe9",isIndeterminate:y,...x}=e,C=w3({min:s,max:o,value:d,valueText:i,getValueText:c,isIndeterminate:y}),S=y?void 0:((n=C.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${qW} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},I={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(Ee.div,{ref:t,className:"chakra-progress",...C.bind,...x,__css:I,children:[a.jsxs(S3,{size:r,isIndeterminate:y,children:[a.jsx(bb,{stroke:b,strokeWidth:m,className:"chakra-progress__track"}),a.jsx(bb,{stroke:g,strokeWidth:m,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:C.value===0&&!y?0:void 0,..._})]}),h]})});xb.displayName="CircularProgress";var[YW,JW]=Hn({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),ZW=Oe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...c}=e,d=w3({value:o,min:n,max:r,isIndeterminate:s,role:i}),h={height:"100%",...JW().filledTrack};return a.jsx(Ee.div,{ref:t,style:{width:`${d.percent}%`,...c.style},...d.bind,...c,__css:h})}),k3=Oe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:c,children:d,borderRadius:p,isIndeterminate:h,"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,title:y,role:x,...C}=ar(e),S=Qr("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${XW} 1s linear infinite`},M={...!h&&i&&c&&_,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${QW} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...S.track};return a.jsx(Ee.div,{ref:t,borderRadius:j,__css:R,...C,children:a.jsxs(YW,{value:S,children:[a.jsx(ZW,{"aria-label":m,"aria-labelledby":g,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:h,css:M,borderRadius:j,title:y,role:x}),d]})})});k3.displayName="Progress";function eV(e){return e&&L1(e)&&L1(e.target)}function tV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:c,...d}=e,[p,h]=l.useState(r||""),m=typeof n<"u",g=m?n:p,b=l.useRef(null),y=l.useCallback(()=>{const P=b.current;if(!P)return;let M="input:not(:disabled):checked";const R=P.querySelector(M);if(R){R.focus();return}M="input:not(:disabled)";const A=P.querySelector(M);A==null||A.focus()},[]),C=`radio-${l.useId()}`,S=o||C,j=l.useCallback(P=>{const M=eV(P)?P.target.value:P;m||h(M),t==null||t(String(M))},[t,m]),_=l.useCallback((P={},M=null)=>({...P,ref:gn(M,b),role:"radiogroup"}),[]),I=l.useCallback((P={},M=null)=>({...P,ref:M,name:S,[c?"checked":"isChecked"]:g!=null?P.value===g:void 0,onChange(A){j(A)},"data-radiogroup":!0}),[c,S,j,g]);return{getRootProps:_,getRadioProps:I,name:S,ref:b,focus:y,setValue:h,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:d}}var[nV,j3]=Hn({name:"RadioGroupContext",strict:!1}),em=Oe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:c,isFocusable:d,...p}=e,{value:h,onChange:m,getRootProps:g,name:b,htmlProps:y}=tV(p),x=l.useMemo(()=>({name:b,size:r,onChange:m,colorScheme:n,value:h,variant:o,isDisabled:c,isFocusable:d}),[b,r,m,n,h,o,c,d]);return a.jsx(nV,{value:x,children:a.jsx(Ee.div,{...g(y,t),className:jt("chakra-radio-group",i),children:s})})});em.displayName="RadioGroup";var rV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function oV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:c,isInvalid:d,name:p,value:h,id:m,"data-radiogroup":g,"aria-describedby":b,...y}=e,x=`radio-${l.useId()}`,C=kf(),j=!!j3()||!!g;let I=!!C&&!j?C.id:x;I=m??I;const P=o??(C==null?void 0:C.isDisabled),M=s??(C==null?void 0:C.isReadOnly),R=i??(C==null?void 0:C.isRequired),A=d??(C==null?void 0:C.isInvalid),[D,O]=l.useState(!1),[T,Y]=l.useState(!1),[z,W]=l.useState(!1),[Q,U]=l.useState(!1),[L,ee]=l.useState(!!t),K=typeof n<"u",Z=K?n:L;l.useEffect(()=>VP(O),[]);const se=l.useCallback(pe=>{if(M||P){pe.preventDefault();return}K||ee(pe.target.checked),c==null||c(pe)},[K,P,M,c]),fe=l.useCallback(pe=>{pe.key===" "&&U(!0)},[U]),G=l.useCallback(pe=>{pe.key===" "&&U(!1)},[U]),te=l.useCallback((pe={},le=null)=>({...pe,ref:le,"data-active":qt(Q),"data-hover":qt(z),"data-disabled":qt(P),"data-invalid":qt(A),"data-checked":qt(Z),"data-focus":qt(T),"data-focus-visible":qt(T&&D),"data-readonly":qt(M),"aria-hidden":!0,onMouseDown:rt(pe.onMouseDown,()=>U(!0)),onMouseUp:rt(pe.onMouseUp,()=>U(!1)),onMouseEnter:rt(pe.onMouseEnter,()=>W(!0)),onMouseLeave:rt(pe.onMouseLeave,()=>W(!1))}),[Q,z,P,A,Z,T,M,D]),{onFocus:V,onBlur:F}=C??{},X=l.useCallback((pe={},le=null)=>{const we=P&&!r;return{...pe,id:I,ref:le,type:"radio",name:p,value:h,onChange:rt(pe.onChange,se),onBlur:rt(F,pe.onBlur,()=>Y(!1)),onFocus:rt(V,pe.onFocus,()=>Y(!0)),onKeyDown:rt(pe.onKeyDown,fe),onKeyUp:rt(pe.onKeyUp,G),checked:Z,disabled:we,readOnly:M,required:R,"aria-invalid":_s(A),"aria-disabled":_s(we),"aria-required":_s(R),"data-readonly":qt(M),"aria-describedby":b,style:rV}},[P,r,I,p,h,se,F,V,fe,G,Z,M,R,A,b]);return{state:{isInvalid:A,isFocused:T,isChecked:Z,isActive:Q,isHovered:z,isDisabled:P,isReadOnly:M,isRequired:R},getCheckboxProps:te,getRadioProps:te,getInputProps:X,getLabelProps:(pe={},le=null)=>({...pe,ref:le,onMouseDown:rt(pe.onMouseDown,sV),"data-disabled":qt(P),"data-checked":qt(Z),"data-invalid":qt(A)}),getRootProps:(pe,le=null)=>({...pe,ref:le,"data-disabled":qt(P),"data-checked":qt(Z),"data-invalid":qt(A)}),htmlProps:y}}function sV(e){e.preventDefault(),e.stopPropagation()}function aV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Za=Oe((e,t)=>{var n;const r=j3(),{onChange:o,value:s}=e,i=Qr("Radio",{...r,...e}),c=ar(e),{spacing:d="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:m=r==null?void 0:r.isFocusable,inputProps:g,...b}=c;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let x=o;r!=null&&r.onChange&&s!=null&&(x=og(r.onChange,o));const C=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:I,htmlProps:P}=oV({...b,isChecked:y,isFocusable:m,isDisabled:h,onChange:x,name:C}),[M,R]=aV(P,jI),A=j(R),D=S(g,t),O=_(),T=Object.assign({},M,I()),Y={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},z={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},W={userSelect:"none",marginStart:d,...i.label};return a.jsxs(Ee.label,{className:"chakra-radio",...T,__css:Y,children:[a.jsx("input",{className:"chakra-radio__input",...D}),a.jsx(Ee.span,{className:"chakra-radio__control",...A,__css:z}),p&&a.jsx(Ee.span,{className:"chakra-radio__label",...O,__css:W,children:p})]})});Za.displayName="Radio";var _3=Oe(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(Ee.select,{...i,ref:n,className:jt("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});_3.displayName="SelectField";function iV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var I3=Oe((e,t)=>{var n;const r=Qr("Select",e),{rootProps:o,placeholder:s,icon:i,color:c,height:d,h:p,minH:h,minHeight:m,iconColor:g,iconSize:b,...y}=ar(e),[x,C]=iV(y,jI),S=Qx(C),j={width:"100%",height:"fit-content",position:"relative",color:c},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(Ee.div,{className:"chakra-select__wrapper",__css:j,...x,...o,children:[a.jsx(_3,{ref:t,height:p??d,minH:h??m,placeholder:s,...S,__css:_,children:e.children}),a.jsx(P3,{"data-disabled":qt(S.disabled),...(g||c)&&{color:g||c},__css:r.icon,...b&&{fontSize:b},children:i})]})});I3.displayName="Select";var lV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),cV=Ee("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),P3=e=>{const{children:t=a.jsx(lV,{}),...n}=e,r=l.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(cV,{...n,className:"chakra-select__icon-wrapper",children:l.isValidElement(t)?r:null})};P3.displayName="SelectIcon";function uV(){const e=l.useRef(!0);return l.useEffect(()=>{e.current=!1},[]),e.current}function dV(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}var fV=Ee("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),yb=_I("skeleton-start-color"),Cb=_I("skeleton-end-color"),pV=yi({from:{opacity:0},to:{opacity:1}}),hV=yi({from:{borderColor:yb.reference,background:yb.reference},to:{borderColor:Cb.reference,background:Cb.reference}}),Dg=Oe((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=ll("Skeleton",n),o=uV(),{startColor:s="",endColor:i="",isLoaded:c,fadeDuration:d,speed:p,className:h,fitContent:m,...g}=ar(n),[b,y]=Ks("colors",[s,i]),x=dV(c),C=jt("chakra-skeleton",h),S={...b&&{[yb.variable]:b},...y&&{[Cb.variable]:y}};if(c){const j=o||x?"none":`${pV} ${d}s`;return a.jsx(Ee.div,{ref:t,className:C,__css:{animation:j},...g})}return a.jsx(fV,{ref:t,className:C,...g,__css:{width:m?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${hV}`}})});Dg.displayName="Skeleton";var xs=e=>e?"":void 0,su=e=>e?!0:void 0,ul=(...e)=>e.filter(Boolean).join(" ");function au(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function mV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Pd(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Ih={width:0,height:0},Up=e=>e||Ih;function E3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=x=>{var C;const S=(C=r[x])!=null?C:Ih;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Pd({orientation:t,vertical:{bottom:`calc(${n[x]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[x]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((x,C)=>Up(x).height>Up(C).height?x:C,Ih):r.reduce((x,C)=>Up(x).width>Up(C).width?x:C,Ih),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Pd({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},d={position:"absolute",...Pd({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,h=[0,o?100-n[0]:n[0]],m=p?h:n;let g=m[0];!p&&o&&(g=100-g);const b=Math.abs(m[m.length-1]-m[0]),y={...d,...Pd({orientation:t,vertical:o?{height:`${b}%`,top:`${g}%`}:{height:`${b}%`,bottom:`${g}%`},horizontal:o?{width:`${b}%`,right:`${g}%`}:{width:`${b}%`,left:`${g}%`}})};return{trackStyle:d,innerTrackStyle:y,rootStyle:c,getThumbStyle:s}}function M3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function gV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function vV(e){const t=xV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function O3(e){return!!e.touches}function bV(e){return O3(e)&&e.touches.length>1}function xV(e){var t;return(t=e.view)!=null?t:window}function yV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function CV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function R3(e,t="page"){return O3(e)?yV(e,t):CV(e,t)}function wV(e){return t=>{const n=vV(t);(!n||n&&t.button===0)&&e(t)}}function SV(e,t=!1){function n(o){e(o,{point:R3(o)})}return t?wV(n):n}function Ph(e,t,n,r){return gV(e,t,SV(n,t==="pointerdown"),r)}var kV=Object.defineProperty,jV=(e,t,n)=>t in e?kV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t,n)=>(jV(e,typeof t!="symbol"?t+"":t,n),n),_V=class{constructor(e,t,n){Ws(this,"history",[]),Ws(this,"startEvent",null),Ws(this,"lastEvent",null),Ws(this,"lastEventInfo",null),Ws(this,"handlers",{}),Ws(this,"removeListeners",()=>{}),Ws(this,"threshold",3),Ws(this,"win"),Ws(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Xv(this.lastEventInfo,this.history),d=this.startEvent!==null,p=MV(c.offset,{x:0,y:0})>=this.threshold;if(!d&&!p)return;const{timestamp:h}=wS();this.history.push({...c.point,timestamp:h});const{onStart:m,onMove:g}=this.handlers;d||(m==null||m(this.lastEvent,c),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,c)}),Ws(this,"onPointerMove",(c,d)=>{this.lastEvent=c,this.lastEventInfo=d,X$.update(this.updatePoint,!0)}),Ws(this,"onPointerUp",(c,d)=>{const p=Xv(d,this.history),{onEnd:h,onSessionEnd:m}=this.handlers;m==null||m(c,p),this.end(),!(!h||!this.startEvent)&&(h==null||h(c,p))});var r;if(this.win=(r=e.view)!=null?r:window,bV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:R3(e)},{timestamp:s}=wS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,Xv(o,this.history)),this.removeListeners=EV(Ph(this.win,"pointermove",this.onPointerMove),Ph(this.win,"pointerup",this.onPointerUp),Ph(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Y$.update(this.updatePoint)}};function ik(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xv(e,t){return{point:e.point,delta:ik(e.point,t[t.length-1]),offset:ik(e.point,t[0]),velocity:PV(t,.1)}}var IV=e=>e*1e3;function PV(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>IV(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function EV(...e){return t=>e.reduce((n,r)=>r(n),t)}function Yv(e,t){return Math.abs(e-t)}function lk(e){return"x"in e&&"y"in e}function MV(e,t){if(typeof e=="number"&&typeof t=="number")return Yv(e,t);if(lk(e)&&lk(t)){const n=Yv(e.x,t.x),r=Yv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function A3(e){const t=l.useRef(null);return t.current=e,t}function D3(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:c}=t,d=!!(n||r||o||s||i),p=l.useRef(null),h=A3({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(m,g){p.current=null,o==null||o(m,g)}});l.useEffect(()=>{var m;(m=p.current)==null||m.updateHandlers(h.current)}),l.useEffect(()=>{const m=e.current;if(!m||!d)return;function g(b){p.current=new _V(b,h.current,c)}return Ph(m,"pointerdown",g)},[e,d,h,c]),l.useEffect(()=>()=>{var m;(m=p.current)==null||m.end(),p.current=null},[])}function OV(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,c;if("borderBoxSize"in s){const d=s.borderBoxSize,p=Array.isArray(d)?d[0]:d;i=p.inlineSize,c=p.blockSize}else i=e.offsetWidth,c=e.offsetHeight;t({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var RV=globalThis!=null&&globalThis.document?l.useLayoutEffect:l.useEffect;function AV(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function T3({getNodes:e,observeMutation:t=!0}){const[n,r]=l.useState([]),[o,s]=l.useState(0);return RV(()=>{const i=e(),c=i.map((d,p)=>OV(d,h=>{r(m=>[...m.slice(0,p),h,...m.slice(p+1)])}));if(t){const d=i[0];c.push(AV(d,()=>{s(p=>p+1)}))}return()=>{c.forEach(d=>{d==null||d()})}},[o]),n}function DV(e){return typeof e=="object"&&e!==null&&"current"in e}function TV(e){const[t]=T3({observeMutation:!1,getNodes(){return[DV(e)?e.current:e]}});return t}function NV(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:c="ltr",orientation:d="horizontal",id:p,isDisabled:h,isReadOnly:m,onChangeStart:g,onChangeEnd:b,step:y=1,getAriaValueText:x,"aria-valuetext":C,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:I=!0,minStepsBetweenThumbs:P=0,...M}=e,R=pr(g),A=pr(b),D=pr(x),O=M3({isReversed:i,direction:c,orientation:d}),[T,Y]=wf({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[z,W]=l.useState(!1),[Q,U]=l.useState(!1),[L,ee]=l.useState(-1),K=!(h||m),Z=l.useRef(T),se=T.map(Me=>tu(Me,t,n)),fe=P*y,G=$V(se,t,n,fe),te=l.useRef({eventSource:null,value:[],valueBounds:[]});te.current.value=se,te.current.valueBounds=G;const V=se.map(Me=>n-Me+t),X=(O?V:se).map(Me=>Qh(Me,t,n)),ue=d==="vertical",q=l.useRef(null),ne=l.useRef(null),pe=T3({getNodes(){const Me=ne.current,Ze=Me==null?void 0:Me.querySelectorAll("[role=slider]");return Ze?Array.from(Ze):[]}}),le=l.useId(),ve=mV(p??le),he=l.useCallback(Me=>{var Ze,Ye;if(!q.current)return;te.current.eventSource="pointer";const ut=q.current.getBoundingClientRect(),{clientX:Ut,clientY:xr}=(Ye=(Ze=Me.touches)==null?void 0:Ze[0])!=null?Ye:Me,yn=ue?ut.bottom-xr:Ut-ut.left,hn=ue?ut.height:ut.width;let oo=yn/hn;return O&&(oo=1-oo),GP(oo,t,n)},[ue,O,n,t]),Ne=(n-t)/10,De=y||(n-t)/100,qe=l.useMemo(()=>({setValueAtIndex(Me,Ze){if(!K)return;const Ye=te.current.valueBounds[Me];Ze=parseFloat(ab(Ze,Ye.min,De)),Ze=tu(Ze,Ye.min,Ye.max);const ut=[...te.current.value];ut[Me]=Ze,Y(ut)},setActiveIndex:ee,stepUp(Me,Ze=De){const Ye=te.current.value[Me],ut=O?Ye-Ze:Ye+Ze;qe.setValueAtIndex(Me,ut)},stepDown(Me,Ze=De){const Ye=te.current.value[Me],ut=O?Ye+Ze:Ye-Ze;qe.setValueAtIndex(Me,ut)},reset(){Y(Z.current)}}),[De,O,Y,K]),Mt=l.useCallback(Me=>{const Ze=Me.key,ut={ArrowRight:()=>qe.stepUp(L),ArrowUp:()=>qe.stepUp(L),ArrowLeft:()=>qe.stepDown(L),ArrowDown:()=>qe.stepDown(L),PageUp:()=>qe.stepUp(L,Ne),PageDown:()=>qe.stepDown(L,Ne),Home:()=>{const{min:Ut}=G[L];qe.setValueAtIndex(L,Ut)},End:()=>{const{max:Ut}=G[L];qe.setValueAtIndex(L,Ut)}}[Ze];ut&&(Me.preventDefault(),Me.stopPropagation(),ut(Me),te.current.eventSource="keyboard")},[qe,L,Ne,G]),{getThumbStyle:ot,rootStyle:an,trackStyle:pt,innerTrackStyle:vt}=l.useMemo(()=>E3({isReversed:O,orientation:d,thumbRects:pe,thumbPercents:X}),[O,d,X,pe]),ke=l.useCallback(Me=>{var Ze;const Ye=Me??L;if(Ye!==-1&&I){const ut=ve.getThumb(Ye),Ut=(Ze=ne.current)==null?void 0:Ze.ownerDocument.getElementById(ut);Ut&&setTimeout(()=>Ut.focus())}},[I,L,ve]);xi(()=>{te.current.eventSource==="keyboard"&&(A==null||A(te.current.value))},[se,A]);const Be=Me=>{const Ze=he(Me)||0,Ye=te.current.value.map(hn=>Math.abs(hn-Ze)),ut=Math.min(...Ye);let Ut=Ye.indexOf(ut);const xr=Ye.filter(hn=>hn===ut);xr.length>1&&Ze>te.current.value[Ut]&&(Ut=Ut+xr.length-1),ee(Ut),qe.setValueAtIndex(Ut,Ze),ke(Ut)},Ot=Me=>{if(L==-1)return;const Ze=he(Me)||0;ee(L),qe.setValueAtIndex(L,Ze),ke(L)};D3(ne,{onPanSessionStart(Me){K&&(W(!0),Be(Me),R==null||R(te.current.value))},onPanSessionEnd(){K&&(W(!1),A==null||A(te.current.value))},onPan(Me){K&&Ot(Me)}});const Ht=l.useCallback((Me={},Ze=null)=>({...Me,...M,id:ve.root,ref:gn(Ze,ne),tabIndex:-1,"aria-disabled":su(h),"data-focused":xs(Q),style:{...Me.style,...an}}),[M,h,Q,an,ve]),je=l.useCallback((Me={},Ze=null)=>({...Me,ref:gn(Ze,q),id:ve.track,"data-disabled":xs(h),style:{...Me.style,...pt}}),[h,pt,ve]),ht=l.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ve.innerTrack,style:{...Me.style,...vt}}),[vt,ve]),At=l.useCallback((Me,Ze=null)=>{var Ye;const{index:ut,...Ut}=Me,xr=se[ut];if(xr==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${ut}\`. The \`value\` or \`defaultValue\` length is : ${se.length}`);const yn=G[ut];return{...Ut,ref:Ze,role:"slider",tabIndex:K?0:void 0,id:ve.getThumb(ut),"data-active":xs(z&&L===ut),"aria-valuetext":(Ye=D==null?void 0:D(xr))!=null?Ye:C==null?void 0:C[ut],"aria-valuemin":yn.min,"aria-valuemax":yn.max,"aria-valuenow":xr,"aria-orientation":d,"aria-disabled":su(h),"aria-readonly":su(m),"aria-label":S==null?void 0:S[ut],"aria-labelledby":S!=null&&S[ut]||j==null?void 0:j[ut],style:{...Me.style,...ot(ut)},onKeyDown:au(Me.onKeyDown,Mt),onFocus:au(Me.onFocus,()=>{U(!0),ee(ut)}),onBlur:au(Me.onBlur,()=>{U(!1),ee(-1)})}},[ve,se,G,K,z,L,D,C,d,h,m,S,j,ot,Mt,U]),_t=l.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ve.output,htmlFor:se.map((Ye,ut)=>ve.getThumb(ut)).join(" "),"aria-live":"off"}),[ve,se]),Re=l.useCallback((Me,Ze=null)=>{const{value:Ye,...ut}=Me,Ut=!(Yen),xr=Ye>=se[0]&&Ye<=se[se.length-1];let yn=Qh(Ye,t,n);yn=O?100-yn:yn;const hn={position:"absolute",pointerEvents:"none",...Pd({orientation:d,vertical:{bottom:`${yn}%`},horizontal:{left:`${yn}%`}})};return{...ut,ref:Ze,id:ve.getMarker(Me.value),role:"presentation","aria-hidden":!0,"data-disabled":xs(h),"data-invalid":xs(!Ut),"data-highlighted":xs(xr),style:{...Me.style,...hn}}},[h,O,n,t,d,se,ve]),Xe=l.useCallback((Me,Ze=null)=>{const{index:Ye,...ut}=Me;return{...ut,ref:Ze,id:ve.getInput(Ye),type:"hidden",value:se[Ye],name:Array.isArray(_)?_[Ye]:`${_}-${Ye}`}},[_,se,ve]);return{state:{value:se,isFocused:Q,isDragging:z,getThumbPercent:Me=>X[Me],getThumbMinValue:Me=>G[Me].min,getThumbMaxValue:Me=>G[Me].max},actions:qe,getRootProps:Ht,getTrackProps:je,getInnerTrackProps:ht,getThumbProps:At,getMarkerProps:Re,getInputProps:Xe,getOutputProps:_t}}function $V(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,c=s===e.length-1?n:e[s+1]-r;return{min:i,max:c}})}var[LV,Tg]=Hn({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[zV,Ng]=Hn({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),N3=Oe(function(t,n){const r={orientation:"horizontal",...t},o=Qr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getRootProps:c,...d}=NV(s),p=l.useMemo(()=>({...d,name:r.name}),[d,r.name]);return a.jsx(LV,{value:p,children:a.jsx(zV,{value:o,children:a.jsx(Ee.div,{...c({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});N3.displayName="RangeSlider";var wb=Oe(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Tg(),i=Ng(),c=r(t,n);return a.jsxs(Ee.div,{...c,className:ul("chakra-slider__thumb",t.className),__css:i.thumb,children:[c.children,s&&a.jsx("input",{...o({index:t.index})})]})});wb.displayName="RangeSliderThumb";var $3=Oe(function(t,n){const{getTrackProps:r}=Tg(),o=Ng(),s=r(t,n);return a.jsx(Ee.div,{...s,className:ul("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});$3.displayName="RangeSliderTrack";var L3=Oe(function(t,n){const{getInnerTrackProps:r}=Tg(),o=Ng(),s=r(t,n);return a.jsx(Ee.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});L3.displayName="RangeSliderFilledTrack";var Eh=Oe(function(t,n){const{getMarkerProps:r}=Tg(),o=Ng(),s=r(t,n);return a.jsx(Ee.div,{...s,className:ul("chakra-slider__marker",t.className),__css:o.mark})});Eh.displayName="RangeSliderMark";function FV(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:c,direction:d="ltr",orientation:p="horizontal",id:h,isDisabled:m,isReadOnly:g,onChangeStart:b,onChangeEnd:y,step:x=1,getAriaValueText:C,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:I,focusThumbOnChange:P=!0,...M}=e,R=pr(b),A=pr(y),D=pr(C),O=M3({isReversed:c,direction:d,orientation:p}),[T,Y]=wf({value:s,defaultValue:i??HV(n,r),onChange:o}),[z,W]=l.useState(!1),[Q,U]=l.useState(!1),L=!(m||g),ee=(r-n)/10,K=x||(r-n)/100,Z=tu(T,n,r),se=r-Z+n,G=Qh(O?se:Z,n,r),te=p==="vertical",V=A3({min:n,max:r,step:x,isDisabled:m,value:Z,isInteractive:L,isReversed:O,isVertical:te,eventSource:null,focusThumbOnChange:P,orientation:p}),F=l.useRef(null),X=l.useRef(null),ue=l.useRef(null),q=l.useId(),ne=h??q,[pe,le]=[`slider-thumb-${ne}`,`slider-track-${ne}`],we=l.useCallback(Re=>{var Xe,_n;if(!F.current)return;const Me=V.current;Me.eventSource="pointer";const Ze=F.current.getBoundingClientRect(),{clientX:Ye,clientY:ut}=(_n=(Xe=Re.touches)==null?void 0:Xe[0])!=null?_n:Re,Ut=te?Ze.bottom-ut:Ye-Ze.left,xr=te?Ze.height:Ze.width;let yn=Ut/xr;O&&(yn=1-yn);let hn=GP(yn,Me.min,Me.max);return Me.step&&(hn=parseFloat(ab(hn,Me.min,Me.step))),hn=tu(hn,Me.min,Me.max),hn},[te,O,V]),ve=l.useCallback(Re=>{const Xe=V.current;Xe.isInteractive&&(Re=parseFloat(ab(Re,Xe.min,K)),Re=tu(Re,Xe.min,Xe.max),Y(Re))},[K,Y,V]),he=l.useMemo(()=>({stepUp(Re=K){const Xe=O?Z-Re:Z+Re;ve(Xe)},stepDown(Re=K){const Xe=O?Z+Re:Z-Re;ve(Xe)},reset(){ve(i||0)},stepTo(Re){ve(Re)}}),[ve,O,Z,K,i]),Ne=l.useCallback(Re=>{const Xe=V.current,Me={ArrowRight:()=>he.stepUp(),ArrowUp:()=>he.stepUp(),ArrowLeft:()=>he.stepDown(),ArrowDown:()=>he.stepDown(),PageUp:()=>he.stepUp(ee),PageDown:()=>he.stepDown(ee),Home:()=>ve(Xe.min),End:()=>ve(Xe.max)}[Re.key];Me&&(Re.preventDefault(),Re.stopPropagation(),Me(Re),Xe.eventSource="keyboard")},[he,ve,ee,V]),De=(t=D==null?void 0:D(Z))!=null?t:S,qe=TV(X),{getThumbStyle:Mt,rootStyle:ot,trackStyle:an,innerTrackStyle:pt}=l.useMemo(()=>{const Re=V.current,Xe=qe??{width:0,height:0};return E3({isReversed:O,orientation:Re.orientation,thumbRects:[Xe],thumbPercents:[G]})},[O,qe,G,V]),vt=l.useCallback(()=>{V.current.focusThumbOnChange&&setTimeout(()=>{var Xe;return(Xe=X.current)==null?void 0:Xe.focus()})},[V]);xi(()=>{const Re=V.current;vt(),Re.eventSource==="keyboard"&&(A==null||A(Re.value))},[Z,A]);function ke(Re){const Xe=we(Re);Xe!=null&&Xe!==V.current.value&&Y(Xe)}D3(ue,{onPanSessionStart(Re){const Xe=V.current;Xe.isInteractive&&(W(!0),vt(),ke(Re),R==null||R(Xe.value))},onPanSessionEnd(){const Re=V.current;Re.isInteractive&&(W(!1),A==null||A(Re.value))},onPan(Re){V.current.isInteractive&&ke(Re)}});const Be=l.useCallback((Re={},Xe=null)=>({...Re,...M,ref:gn(Xe,ue),tabIndex:-1,"aria-disabled":su(m),"data-focused":xs(Q),style:{...Re.style,...ot}}),[M,m,Q,ot]),Ot=l.useCallback((Re={},Xe=null)=>({...Re,ref:gn(Xe,F),id:le,"data-disabled":xs(m),style:{...Re.style,...an}}),[m,le,an]),Ht=l.useCallback((Re={},Xe=null)=>({...Re,ref:Xe,style:{...Re.style,...pt}}),[pt]),je=l.useCallback((Re={},Xe=null)=>({...Re,ref:gn(Xe,X),role:"slider",tabIndex:L?0:void 0,id:pe,"data-active":xs(z),"aria-valuetext":De,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Z,"aria-orientation":p,"aria-disabled":su(m),"aria-readonly":su(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Re.style,...Mt(0)},onKeyDown:au(Re.onKeyDown,Ne),onFocus:au(Re.onFocus,()=>U(!0)),onBlur:au(Re.onBlur,()=>U(!1))}),[L,pe,z,De,n,r,Z,p,m,g,j,_,Mt,Ne]),ht=l.useCallback((Re,Xe=null)=>{const _n=!(Re.valuer),Me=Z>=Re.value,Ze=Qh(Re.value,n,r),Ye={position:"absolute",pointerEvents:"none",...BV({orientation:p,vertical:{bottom:O?`${100-Ze}%`:`${Ze}%`},horizontal:{left:O?`${100-Ze}%`:`${Ze}%`}})};return{...Re,ref:Xe,role:"presentation","aria-hidden":!0,"data-disabled":xs(m),"data-invalid":xs(!_n),"data-highlighted":xs(Me),style:{...Re.style,...Ye}}},[m,O,r,n,p,Z]),At=l.useCallback((Re={},Xe=null)=>({...Re,ref:Xe,type:"hidden",value:Z,name:I}),[I,Z]);return{state:{value:Z,isFocused:Q,isDragging:z},actions:he,getRootProps:Be,getTrackProps:Ot,getInnerTrackProps:Ht,getThumbProps:je,getMarkerProps:ht,getInputProps:At}}function BV(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function HV(e,t){return t"}),[VV,Lg]=Hn({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),jy=Oe((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Qr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getInputProps:c,getRootProps:d,...p}=FV(s),h=d(),m=c({},t);return a.jsx(WV,{value:p,children:a.jsx(VV,{value:o,children:a.jsxs(Ee.div,{...h,className:ul("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...m})]})})})});jy.displayName="Slider";var _y=Oe((e,t)=>{const{getThumbProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__thumb",e.className),__css:r.thumb})});_y.displayName="SliderThumb";var Iy=Oe((e,t)=>{const{getTrackProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__track",e.className),__css:r.track})});Iy.displayName="SliderTrack";var Py=Oe((e,t)=>{const{getInnerTrackProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__filled-track",e.className),__css:r.filledTrack})});Py.displayName="SliderFilledTrack";var Lc=Oe((e,t)=>{const{getMarkerProps:n}=$g(),r=Lg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:ul("chakra-slider__marker",e.className),__css:r.mark})});Lc.displayName="SliderMark";var[UV,z3]=Hn({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),F3=Oe(function(t,n){const r=Qr("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...c}=ar(t);return a.jsx(UV,{value:r,children:a.jsx(Ee.div,{ref:n,...c,className:jt("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});F3.displayName="Stat";var B3=Oe(function(t,n){return a.jsx(Ee.div,{...t,ref:n,role:"group",className:jt("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});B3.displayName="StatGroup";var H3=Oe(function(t,n){const r=z3();return a.jsx(Ee.dt,{ref:n,...t,className:jt("chakra-stat__label",t.className),__css:r.label})});H3.displayName="StatLabel";var W3=Oe(function(t,n){const r=z3();return a.jsx(Ee.dd,{ref:n,...t,className:jt("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});W3.displayName="StatNumber";var Ey=Oe(function(t,n){const r=Qr("Switch",t),{spacing:o="0.5rem",children:s,...i}=ar(t),{getIndicatorProps:c,getInputProps:d,getCheckboxProps:p,getRootProps:h,getLabelProps:m}=UP(i),g=l.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=l.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=l.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(Ee.label,{...h(),className:jt("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...d({},n)}),a.jsx(Ee.span,{...p(),className:"chakra-switch__track",__css:b,children:a.jsx(Ee.span,{__css:r.thumb,className:"chakra-switch__thumb",...c()})}),s&&a.jsx(Ee.span,{className:"chakra-switch__label",...m(),__css:y,children:s})]})});Ey.displayName="Switch";var[GV,qV,KV,QV]=Gx();function XV(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:c="unmount",orientation:d="horizontal",direction:p="ltr",...h}=e,[m,g]=l.useState(n??0),[b,y]=wf({defaultValue:n??0,value:o,onChange:r});l.useEffect(()=>{o!=null&&g(o)},[o]);const x=KV(),C=l.useId();return{id:`tabs-${(t=e.id)!=null?t:C}`,selectedIndex:b,focusedIndex:m,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:c,orientation:d,descendants:x,direction:p,htmlProps:h}}var[YV,zg]=Hn({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function JV(e){const{focusedIndex:t,orientation:n,direction:r}=zg(),o=qV(),s=l.useCallback(i=>{const c=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},d=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},h=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},m=n==="horizontal",g=n==="vertical",b=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",x=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>m&&d(),[x]:()=>m&&c(),ArrowDown:()=>g&&c(),ArrowUp:()=>g&&d(),Home:p,End:h}[b];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:rt(e.onKeyDown,s)}}function ZV(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:c,selectedIndex:d}=zg(),{index:p,register:h}=QV({disabled:t&&!n}),m=p===d,g=()=>{o(p)},b=()=>{c(p),!s&&!(t&&n)&&o(p)},y=G5({...r,ref:gn(h,e.ref),isDisabled:t,isFocusable:n,onClick:rt(e.onClick,g)}),x="button";return{...y,id:V3(i,p),role:"tab",tabIndex:m?0:-1,type:x,"aria-selected":m,"aria-controls":U3(i,p),onFocus:t?void 0:rt(e.onFocus,b)}}var[eU,tU]=Hn({});function nU(e){const t=zg(),{id:n,selectedIndex:r}=t,s=hg(e.children).map((i,c)=>l.createElement(eU,{key:c,value:{isSelected:c===r,id:U3(n,c),tabId:V3(n,c),selectedIndex:r}},i));return{...e,children:s}}function rU(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=zg(),{isSelected:s,id:i,tabId:c}=tU(),d=l.useRef(!1);s&&(d.current=!0);const p=Sy({wasSelected:d.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":c,hidden:!s,id:i}}function V3(e,t){return`${e}--tab-${t}`}function U3(e,t){return`${e}--tabpanel-${t}`}var[oU,Fg]=Hn({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),tc=Oe(function(t,n){const r=Qr("Tabs",t),{children:o,className:s,...i}=ar(t),{htmlProps:c,descendants:d,...p}=XV(i),h=l.useMemo(()=>p,[p]),{isFitted:m,...g}=c;return a.jsx(GV,{value:d,children:a.jsx(YV,{value:h,children:a.jsx(oU,{value:r,children:a.jsx(Ee.div,{className:jt("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});tc.displayName="Tabs";var nc=Oe(function(t,n){const r=JV({...t,ref:n}),s={display:"flex",...Fg().tablist};return a.jsx(Ee.div,{...r,className:jt("chakra-tabs__tablist",t.className),__css:s})});nc.displayName="TabList";var Ho=Oe(function(t,n){const r=rU({...t,ref:n}),o=Fg();return a.jsx(Ee.div,{outline:"0",...r,className:jt("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});Ho.displayName="TabPanel";var zu=Oe(function(t,n){const r=nU(t),o=Fg();return a.jsx(Ee.div,{...r,width:"100%",ref:n,className:jt("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});zu.displayName="TabPanels";var xo=Oe(function(t,n){const r=Fg(),o=ZV({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(Ee.button,{...o,className:jt("chakra-tabs__tab",t.className),__css:s})});xo.displayName="Tab";function sU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var aU=["h","minH","height","minHeight"],G3=Oe((e,t)=>{const n=ll("Textarea",e),{className:r,rows:o,...s}=ar(e),i=Qx(s),c=o?sU(n,aU):n;return a.jsx(Ee.textarea,{ref:t,rows:o,...i,className:jt("chakra-textarea",r),__css:c})});G3.displayName="Textarea";var iU={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},Sb=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Mh=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function lU(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:c=!0,onOpen:d,onClose:p,placement:h,id:m,isOpen:g,defaultIsOpen:b,arrowSize:y=10,arrowShadowColor:x,arrowPadding:C,modifiers:S,isDisabled:j,gutter:_,offset:I,direction:P,...M}=e,{isOpen:R,onOpen:A,onClose:D}=wy({isOpen:g,defaultIsOpen:b,onOpen:d,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:Y,getArrowProps:z}=Cy({enabled:R,placement:h,arrowPadding:C,modifiers:S,gutter:_,offset:I,direction:P}),W=l.useId(),U=`tooltip-${m??W}`,L=l.useRef(null),ee=l.useRef(),K=l.useCallback(()=>{ee.current&&(clearTimeout(ee.current),ee.current=void 0)},[]),Z=l.useRef(),se=l.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),fe=l.useCallback(()=>{se(),D()},[D,se]),G=cU(L,fe),te=l.useCallback(()=>{if(!j&&!ee.current){R&&G();const le=Mh(L);ee.current=le.setTimeout(A,t)}},[G,j,R,A,t]),V=l.useCallback(()=>{K();const le=Mh(L);Z.current=le.setTimeout(fe,n)},[n,fe,K]),F=l.useCallback(()=>{R&&r&&V()},[r,V,R]),X=l.useCallback(()=>{R&&i&&V()},[i,V,R]),ue=l.useCallback(le=>{R&&le.key==="Escape"&&V()},[R,V]);Tl(()=>Sb(L),"keydown",c?ue:void 0),Tl(()=>{const le=L.current;if(!le)return null;const we=A5(le);return we.localName==="body"?Mh(L):we},"scroll",()=>{R&&s&&fe()},{passive:!0,capture:!0}),l.useEffect(()=>{j&&(K(),R&&D())},[j,R,D,K]),l.useEffect(()=>()=>{K(),se()},[K,se]),Tl(()=>L.current,"pointerleave",V);const q=l.useCallback((le={},we=null)=>({...le,ref:gn(L,we,O),onPointerEnter:rt(le.onPointerEnter,he=>{he.pointerType!=="touch"&&te()}),onClick:rt(le.onClick,F),onPointerDown:rt(le.onPointerDown,X),onFocus:rt(le.onFocus,te),onBlur:rt(le.onBlur,V),"aria-describedby":R?U:void 0}),[te,V,X,R,U,F,O]),ne=l.useCallback((le={},we=null)=>T({...le,style:{...le.style,[Fr.arrowSize.var]:y?`${y}px`:void 0,[Fr.arrowShadowColor.var]:x}},we),[T,y,x]),pe=l.useCallback((le={},we=null)=>{const ve={...le.style,position:"relative",transformOrigin:Fr.transformOrigin.varRef};return{ref:we,...M,...le,id:U,role:"tooltip",style:ve}},[M,U]);return{isOpen:R,show:te,hide:V,getTriggerProps:q,getTooltipProps:pe,getTooltipPositionerProps:ne,getArrowProps:z,getArrowInnerProps:Y}}var Jv="chakra-ui:close-tooltip";function cU(e,t){return l.useEffect(()=>{const n=Sb(e);return n.addEventListener(Jv,t),()=>n.removeEventListener(Jv,t)},[t,e]),()=>{const n=Sb(e),r=Mh(e);n.dispatchEvent(new r.CustomEvent(Jv))}}function uU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function dU(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var fU=Ee(Or.div),Fn=Oe((e,t)=>{var n,r;const o=ll("Tooltip",e),s=ar(e),i=mf(),{children:c,label:d,shouldWrapChildren:p,"aria-label":h,hasArrow:m,bg:g,portalProps:b,background:y,backgroundColor:x,bgColor:C,motionProps:S,...j}=s,_=(r=(n=y??x)!=null?n:g)!=null?r:C;if(_){o.bg=_;const T=lD(i,"colors",_);o[Fr.arrowBg.var]=T}const I=lU({...j,direction:i.direction}),P=typeof c=="string"||p;let M;if(P)M=a.jsx(Ee.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:c});else{const T=l.Children.only(c);M=l.cloneElement(T,I.getTriggerProps(T.props,T.ref))}const R=!!h,A=I.getTooltipProps({},t),D=R?uU(A,["role","id"]):A,O=dU(A,["role","id"]);return d?a.jsxs(a.Fragment,{children:[M,a.jsx(yo,{children:I.isOpen&&a.jsx(Ru,{...b,children:a.jsx(Ee.div,{...I.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(fU,{variants:iU,initial:"exit",animate:"enter",exit:"exit",...S,...D,__css:o,children:[d,R&&a.jsx(Ee.span,{srOnly:!0,...O,children:h}),m&&a.jsx(Ee.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(Ee.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:c})});Fn.displayName="Tooltip";function Bg(e,t={}){let n=l.useCallback(o=>t.keys?I$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return l.useSyncExternalStore(n,r,r)}const pU=de(Ce,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),q3=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=H(pU);return l.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${cD[t]}`)):localStorage.setItem("ROARR_LOG","false"),Ow.ROARR.write=uD.createLogWriter()},[t,n]),l.useEffect(()=>{const o={...dD};fD.set(Ow.Roarr.child(o))},[]),l.useMemo(()=>Ci(e),[e])};var hU=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Lf(e,t){var n=mU(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function mU(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=hU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var gU=[".DS_Store","Thumbs.db"];function vU(e){return Tu(this,void 0,void 0,function(){return Nu(this,function(t){return tm(e)&&bU(e.dataTransfer)?[2,wU(e.dataTransfer,e.type)]:xU(e)?[2,yU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,CU(e)]:[2,[]]})})}function bU(e){return tm(e)}function xU(e){return tm(e)&&tm(e.target)}function tm(e){return typeof e=="object"&&e!==null}function yU(e){return kb(e.target.files).map(function(t){return Lf(t)})}function CU(e){return Tu(this,void 0,void 0,function(){var t;return Nu(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Lf(r)})]}})})}function wU(e,t){return Tu(this,void 0,void 0,function(){var n,r;return Nu(this,function(o){switch(o.label){case 0:return e.items?(n=kb(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(SU))]):[3,2];case 1:return r=o.sent(),[2,ck(K3(r))];case 2:return[2,ck(kb(e.files).map(function(s){return Lf(s)}))]}})})}function ck(e){return e.filter(function(t){return gU.indexOf(t.name)===-1})}function kb(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,hk(n)];if(e.sizen)return[!1,hk(n)]}return[!0,null]}function El(e){return e!=null}function zU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,c=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(d){var p=J3(d,n),h=Jd(p,1),m=h[0],g=Z3(d,r,o),b=Jd(g,1),y=b[0],x=c?c(d):null;return m&&y&&!x})}function nm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Gp(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function gk(e){e.preventDefault()}function FU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function BU(e){return e.indexOf("Edge/")!==-1}function HU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return FU(e)||BU(e)}function ba(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sG(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var My=l.forwardRef(function(e,t){var n=e.children,r=rm(e,KU),o=Oy(r),s=o.open,i=rm(o,QU);return l.useImperativeHandle(t,function(){return{open:s}},[s]),B.createElement(l.Fragment,null,n(wr(wr({},i),{},{open:s})))});My.displayName="Dropzone";var r6={disabled:!1,getFilesFromEvent:vU,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};My.defaultProps=r6;My.propTypes={children:Jn.func,accept:Jn.objectOf(Jn.arrayOf(Jn.string)),multiple:Jn.bool,preventDropOnDocument:Jn.bool,noClick:Jn.bool,noKeyboard:Jn.bool,noDrag:Jn.bool,noDragEventsBubbling:Jn.bool,minSize:Jn.number,maxSize:Jn.number,maxFiles:Jn.number,disabled:Jn.bool,getFilesFromEvent:Jn.func,onFileDialogCancel:Jn.func,onFileDialogOpen:Jn.func,useFsAccessApi:Jn.bool,autoFocus:Jn.bool,onDragEnter:Jn.func,onDragLeave:Jn.func,onDragOver:Jn.func,onDrop:Jn.func,onDropAccepted:Jn.func,onDropRejected:Jn.func,onError:Jn.func,validator:Jn.func};var Pb={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Oy(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=wr(wr({},r6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,c=t.multiple,d=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,m=t.onDragOver,g=t.onDrop,b=t.onDropAccepted,y=t.onDropRejected,x=t.onFileDialogCancel,C=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,I=t.noClick,P=t.noKeyboard,M=t.noDrag,R=t.noDragEventsBubbling,A=t.onError,D=t.validator,O=l.useMemo(function(){return UU(n)},[n]),T=l.useMemo(function(){return VU(n)},[n]),Y=l.useMemo(function(){return typeof C=="function"?C:bk},[C]),z=l.useMemo(function(){return typeof x=="function"?x:bk},[x]),W=l.useRef(null),Q=l.useRef(null),U=l.useReducer(aG,Pb),L=Zv(U,2),ee=L[0],K=L[1],Z=ee.isFocused,se=ee.isFileDialogActive,fe=l.useRef(typeof window<"u"&&window.isSecureContext&&S&&WU()),G=function(){!fe.current&&se&&setTimeout(function(){if(Q.current){var Be=Q.current.files;Be.length||(K({type:"closeDialog"}),z())}},300)};l.useEffect(function(){return window.addEventListener("focus",G,!1),function(){window.removeEventListener("focus",G,!1)}},[Q,se,z,fe]);var te=l.useRef([]),V=function(Be){W.current&&W.current.contains(Be.target)||(Be.preventDefault(),te.current=[])};l.useEffect(function(){return _&&(document.addEventListener("dragover",gk,!1),document.addEventListener("drop",V,!1)),function(){_&&(document.removeEventListener("dragover",gk),document.removeEventListener("drop",V))}},[W,_]),l.useEffect(function(){return!r&&j&&W.current&&W.current.focus(),function(){}},[W,j,r]);var F=l.useCallback(function(ke){A?A(ke):console.error(ke)},[A]),X=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke),te.current=[].concat(JU(te.current),[ke.target]),Gp(ke)&&Promise.resolve(o(ke)).then(function(Be){if(!(nm(ke)&&!R)){var Ot=Be.length,Ht=Ot>0&&zU({files:Be,accept:O,minSize:i,maxSize:s,multiple:c,maxFiles:d,validator:D}),je=Ot>0&&!Ht;K({isDragAccept:Ht,isDragReject:je,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ke)}}).catch(function(Be){return F(Be)})},[o,p,F,R,O,i,s,c,d,D]),ue=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke);var Be=Gp(ke);if(Be&&ke.dataTransfer)try{ke.dataTransfer.dropEffect="copy"}catch{}return Be&&m&&m(ke),!1},[m,R]),q=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke);var Be=te.current.filter(function(Ht){return W.current&&W.current.contains(Ht)}),Ot=Be.indexOf(ke.target);Ot!==-1&&Be.splice(Ot,1),te.current=Be,!(Be.length>0)&&(K({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Gp(ke)&&h&&h(ke))},[W,h,R]),ne=l.useCallback(function(ke,Be){var Ot=[],Ht=[];ke.forEach(function(je){var ht=J3(je,O),At=Zv(ht,2),_t=At[0],Re=At[1],Xe=Z3(je,i,s),_n=Zv(Xe,2),Me=_n[0],Ze=_n[1],Ye=D?D(je):null;if(_t&&Me&&!Ye)Ot.push(je);else{var ut=[Re,Ze];Ye&&(ut=ut.concat(Ye)),Ht.push({file:je,errors:ut.filter(function(Ut){return Ut})})}}),(!c&&Ot.length>1||c&&d>=1&&Ot.length>d)&&(Ot.forEach(function(je){Ht.push({file:je,errors:[LU]})}),Ot.splice(0)),K({acceptedFiles:Ot,fileRejections:Ht,type:"setFiles"}),g&&g(Ot,Ht,Be),Ht.length>0&&y&&y(Ht,Be),Ot.length>0&&b&&b(Ot,Be)},[K,c,O,i,s,d,g,b,y,D]),pe=l.useCallback(function(ke){ke.preventDefault(),ke.persist(),ot(ke),te.current=[],Gp(ke)&&Promise.resolve(o(ke)).then(function(Be){nm(ke)&&!R||ne(Be,ke)}).catch(function(Be){return F(Be)}),K({type:"reset"})},[o,ne,F,R]),le=l.useCallback(function(){if(fe.current){K({type:"openDialog"}),Y();var ke={multiple:c,types:T};window.showOpenFilePicker(ke).then(function(Be){return o(Be)}).then(function(Be){ne(Be,null),K({type:"closeDialog"})}).catch(function(Be){GU(Be)?(z(Be),K({type:"closeDialog"})):qU(Be)?(fe.current=!1,Q.current?(Q.current.value=null,Q.current.click()):F(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):F(Be)});return}Q.current&&(K({type:"openDialog"}),Y(),Q.current.value=null,Q.current.click())},[K,Y,z,S,ne,F,T,c]),we=l.useCallback(function(ke){!W.current||!W.current.isEqualNode(ke.target)||(ke.key===" "||ke.key==="Enter"||ke.keyCode===32||ke.keyCode===13)&&(ke.preventDefault(),le())},[W,le]),ve=l.useCallback(function(){K({type:"focus"})},[]),he=l.useCallback(function(){K({type:"blur"})},[]),Ne=l.useCallback(function(){I||(HU()?setTimeout(le,0):le())},[I,le]),De=function(Be){return r?null:Be},qe=function(Be){return P?null:De(Be)},Mt=function(Be){return M?null:De(Be)},ot=function(Be){R&&Be.stopPropagation()},an=l.useMemo(function(){return function(){var ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Be=ke.refKey,Ot=Be===void 0?"ref":Be,Ht=ke.role,je=ke.onKeyDown,ht=ke.onFocus,At=ke.onBlur,_t=ke.onClick,Re=ke.onDragEnter,Xe=ke.onDragOver,_n=ke.onDragLeave,Me=ke.onDrop,Ze=rm(ke,XU);return wr(wr(Ib({onKeyDown:qe(ba(je,we)),onFocus:qe(ba(ht,ve)),onBlur:qe(ba(At,he)),onClick:De(ba(_t,Ne)),onDragEnter:Mt(ba(Re,X)),onDragOver:Mt(ba(Xe,ue)),onDragLeave:Mt(ba(_n,q)),onDrop:Mt(ba(Me,pe)),role:typeof Ht=="string"&&Ht!==""?Ht:"presentation"},Ot,W),!r&&!P?{tabIndex:0}:{}),Ze)}},[W,we,ve,he,Ne,X,ue,q,pe,P,M,r]),pt=l.useCallback(function(ke){ke.stopPropagation()},[]),vt=l.useMemo(function(){return function(){var ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Be=ke.refKey,Ot=Be===void 0?"ref":Be,Ht=ke.onChange,je=ke.onClick,ht=rm(ke,YU),At=Ib({accept:O,multiple:c,type:"file",style:{display:"none"},onChange:De(ba(Ht,pe)),onClick:De(ba(je,pt)),tabIndex:-1},Ot,Q);return wr(wr({},At),ht)}},[Q,n,c,pe,r]);return wr(wr({},ee),{},{isFocused:Z&&!r,getRootProps:an,getInputProps:vt,rootRef:W,inputRef:Q,open:De(le)})}function aG(e,t){switch(t.type){case"focus":return wr(wr({},e),{},{isFocused:!0});case"blur":return wr(wr({},e),{},{isFocused:!1});case"openDialog":return wr(wr({},Pb),{},{isFileDialogActive:!0});case"closeDialog":return wr(wr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return wr(wr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return wr(wr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return wr({},Pb);default:return e}}function bk(){}function Eb(){return Eb=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 pG=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,c=n.shift,d=n.ctrl,p=n.keys,h=t.key,m=t.code,g=t.ctrlKey,b=t.metaKey,y=t.shiftKey,x=t.altKey,C=Ui(m),S=h.toLowerCase();if(!r){if(o===!x&&S!=="alt"||c===!y&&S!=="shift")return!1;if(i){if(!b&&!g)return!1}else if(s===!b&&S!=="meta"&&S!=="os"||d===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(C))?!0:p?Oh(p):!p},hG=l.createContext(void 0),mG=function(){return l.useContext(hG)};function l6(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&&l6(e[r],t[r])},!0):e===t}var gG=l.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),vG=function(){return l.useContext(gG)};function bG(e){var t=l.useRef(void 0);return l6(t.current,e)||(t.current=e),t.current}var xk=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},xG=typeof window<"u"?l.useLayoutEffect:l.useEffect;function It(e,t,n,r){var o=l.useRef(null),s=l.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,c=Ry(e)?e.join(i==null?void 0:i.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,p=l.useCallback(t,d??[]),h=l.useRef(p);d?h.current=p:h.current=t;var m=bG(i),g=vG(),b=g.enabledScopes,y=mG();return xG(function(){if(!((m==null?void 0:m.enabled)===!1||!fG(b,m==null?void 0:m.scopes))){var x=function(I,P){var M;if(P===void 0&&(P=!1),!(dG(I)&&!i6(I,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(I))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){xk(I);return}(M=I.target)!=null&&M.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||e1(c,m==null?void 0:m.splitKey).forEach(function(R){var A,D=t1(R,m==null?void 0:m.combinationKey);if(pG(I,D,m==null?void 0:m.ignoreModifiers)||(A=D.keys)!=null&&A.includes("*")){if(P&&s.current)return;if(cG(I,D,m==null?void 0:m.preventDefault),!uG(I,D,m==null?void 0:m.enabled)){xk(I);return}h.current(I,D),P||(s.current=!0)}})}},C=function(I){I.key!==void 0&&(s6(Ui(I.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&x(I))},S=function(I){I.key!==void 0&&(a6(Ui(I.code)),s.current=!1,m!=null&&m.keyup&&x(I,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",C),y&&e1(c,m==null?void 0:m.splitKey).forEach(function(_){return y.addHotkey(t1(_,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",C),y&&e1(c,m==null?void 0:m.splitKey).forEach(function(_){return y.removeHotkey(t1(_,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[c,m,b]),o}const yG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return It("esc",()=>{r(!1)}),a.jsxs(Te,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(N,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(vo,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(vo,{size:"lg",children:"Invalid Upload"}),a.jsx(vo,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},CG=l.memo(yG),wG=de([Ce,ro],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},_e),SG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=H(wG),o=Zl(),{t:s}=J(),[i,c]=l.useState(!1),[d]=II(),p=l.useCallback(I=>{c(!0),o({title:s("toast.uploadFailed"),description:I.errors.map(P=>P.message).join(` -`),status:"error"})},[s,o]),h=l.useCallback(async I=>{d({file:I,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,d]),m=l.useCallback((I,P)=>{if(P.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}P.forEach(M=>{p(M)}),I.forEach(M=>{h(M)})},[s,o,h,p]),g=l.useCallback(()=>{c(!0)},[]),{getRootProps:b,getInputProps:y,isDragAccept:x,isDragReject:C,isDragActive:S,inputRef:j}=Oy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:m,onDragOver:g,multiple:!1});l.useEffect(()=>{const I=async P=>{var M,R;j.current&&(M=P.clipboardData)!=null&&M.files&&(j.current.files=P.clipboardData.files,(R=j.current)==null||R.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",I),()=>{document.removeEventListener("paste",I)}},[j]);const _=l.useCallback(I=>{I.key},[]);return a.jsxs(Te,{...b({style:{}}),onKeyDown:_,children:[a.jsx("input",{...y()}),t,a.jsx(yo,{children:S&&i&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(CG,{isDragAccept:x,isDragReject:C,setIsHandlingUpload:c})},"image-upload-overlay")})]})},kG=l.memo(SG),jG=Oe((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:c,...d}=e;return a.jsx(Fn,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(tl,{ref:t,colorScheme:c?"accent":"base",...d,children:n})})}),Rt=l.memo(jG);function _G(e){const t=l.createContext(null);return[({children:o,value:s})=>B.createElement(t.Provider,{value:s},o),()=>{const o=l.useContext(t);if(o===null)throw new Error(e);return o}]}function c6(e){return Array.isArray(e)?e:[e]}const IG=()=>{};function PG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||IG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function u6({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function d6(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==B.Fragment:!1}function f6(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const OG=pD({key:"mantine",prepend:!0});function RG(){return EP()||OG}var AG=Object.defineProperty,yk=Object.getOwnPropertySymbols,DG=Object.prototype.hasOwnProperty,TG=Object.prototype.propertyIsEnumerable,Ck=(e,t,n)=>t in e?AG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NG=(e,t)=>{for(var n in t||(t={}))DG.call(t,n)&&Ck(e,n,t[n]);if(yk)for(var n of yk(t))TG.call(t,n)&&Ck(e,n,t[n]);return e};const n1="ref";function $G(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(n1 in n))return{args:e,ref:t};t=n[n1];const r=NG({},n);return delete r[n1],{args:[r],ref:t}}const{cssFactory:LG}=(()=>{function e(n,r,o){const s=[],i=gD(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:c,args:d}=$G(i),p=hD(d,r.registered);return mD(r,p,!1),`${r.key}-${p.name}${c===void 0?"":` ${c}`}`};return{css:o,cx:(...i)=>e(r.registered,o,p6(i))}}return{cssFactory:t}})();function h6(){const e=RG();return MG(()=>LG({cache:e}),[e])}function zG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((c,d)=>(Object.keys(d.classNames).forEach(p=>{typeof c[p]!="string"?c[p]=`${d.classNames[p]}`:c[p]=`${c[p]} ${d.classNames[p]}`}),c),{});return Object.keys(t).reduce((c,d)=>(c[d]=e(t[d],i[d],r!=null&&r[d],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${d}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${d}`:null),c),{})}var FG=Object.defineProperty,wk=Object.getOwnPropertySymbols,BG=Object.prototype.hasOwnProperty,HG=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?FG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))BG.call(t,n)&&Sk(e,n,t[n]);if(wk)for(var n of wk(t))HG.call(t,n)&&Sk(e,n,t[n]);return e};function Mb(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=r1(r1({},e[n]),t[n]):e[n]=r1({},t[n])}),e}function kk(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>Mb(s,i),{}):o(e)}function WG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&Mb(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&Mb(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function Co(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=ki(),i=c$(o==null?void 0:o.name),c=EP(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:h}=h6(),m=t(s,r,d),g=kk(o==null?void 0:o.styles,s,r,d),b=kk(i,s,r,d),y=WG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),x=Object.fromEntries(Object.keys(m).map(C=>{const S=h({[p(m[C])]:!(o!=null&&o.unstyled)},p(y[C]),p(b[C]),p(g[C]));return[C,S]}));return{classes:zG({cx:h,classes:x,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:c}),cx:h,theme:s}}return n}function jk(e){return`___ref-${e||""}`}var VG=Object.defineProperty,UG=Object.defineProperties,GG=Object.getOwnPropertyDescriptors,_k=Object.getOwnPropertySymbols,qG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,Ik=(e,t,n)=>t in e?VG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vd=(e,t)=>{for(var n in t||(t={}))qG.call(t,n)&&Ik(e,n,t[n]);if(_k)for(var n of _k(t))KG.call(t,n)&&Ik(e,n,t[n]);return e},bd=(e,t)=>UG(e,GG(t));const xd={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Ge(10)})`},transitionProperty:"transform, opacity"},qp={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Ge(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:bd(vd({},xd),{common:{transformOrigin:"center center"}}),"pop-bottom-left":bd(vd({},xd),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":bd(vd({},xd),{common:{transformOrigin:"bottom right"}}),"pop-top-left":bd(vd({},xd),{common:{transformOrigin:"top left"}}),"pop-top-right":bd(vd({},xd),{common:{transformOrigin:"top right"}})},Pk=["mousedown","touchstart"];function QG(e,t,n){const r=l.useRef();return l.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const c=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!c&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||Pk).forEach(s=>document.addEventListener(s,o)),()=>{(t||Pk).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function XG(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function YG(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function JG(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=l.useState(n?t:YG(e,t)),s=l.useRef();return l.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),XG(s.current,i=>o(i.matches))},[e]),r}const m6=typeof document<"u"?l.useLayoutEffect:l.useEffect;function Js(e,t){const n=l.useRef(!1);l.useEffect(()=>()=>{n.current=!1},[]),l.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function ZG({opened:e,shouldReturnFocus:t=!0}){const n=l.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Js(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const eq=/input|select|textarea|button|object/,g6="a, input, select, textarea, button, object, [tabindex]";function tq(e){return e.style.display==="none"}function nq(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(tq(n))return!1;n=n.parentNode}return!0}function v6(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Ob(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(v6(e));return(eq.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&nq(e)}function b6(e){const t=v6(e);return(Number.isNaN(t)||t>=0)&&Ob(e)}function rq(e){return Array.from(e.querySelectorAll(g6)).filter(b6)}function oq(e,t){const n=rq(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Dy(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function sq(e,t="body > :not(script)"){const n=Dy(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),c=o.getAttribute("data-hidden"),d=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!c&&!d&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:c||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function aq(e=!0){const t=l.useRef(),n=l.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const c=Array.from(s.querySelectorAll(g6));i=c.find(b6)||c.find(Ob)||null,!i&&Ob(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=l.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=sq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return l.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&oq(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const iq=B["useId".toString()]||(()=>{});function lq(){const e=iq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Ty(e){const t=lq(),[n,r]=l.useState(t);return m6(()=>{r(Dy())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function Ek(e,t,n){l.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function x6(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function cq(...e){return t=>{e.forEach(n=>x6(n,t))}}function zf(...e){return l.useCallback(cq(...e),e)}function Zd({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=l.useState(t!==void 0?t:n),i=c=>{s(c),r==null||r(c)};return e!==void 0?[e,r,!0]:[o,i,!1]}function y6(e,t){return JG("(prefers-reduced-motion: reduce)",e,t)}const uq=e=>e<.5?2*e*e:-1+(4-2*e)*e,dq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,d=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),h=m=>p[m]-d[m];if(e==="y"){const m=h("top");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.height*(s?0:1)||!s?b:0}const g=i?d.height:window.innerHeight;if(r==="end"){const b=m+o-g+p.height;return b>=-p.height*(s?0:1)||!s?b:0}return r==="center"?m-g/2+p.height/2:0}if(e==="x"){const m=h("left");if(m===0)return 0;if(r==="start"){const b=m-o;return b<=p.width||!s?b:0}const g=i?d.width:window.innerWidth;if(r==="end"){const b=m+o-g+p.width;return b>=-p.width||!s?b:0}return r==="center"?m-g/2+p.width/2:0}return 0},fq=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},pq=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function C6({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=uq,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const c=l.useRef(0),d=l.useRef(0),p=l.useRef(!1),h=l.useRef(null),m=l.useRef(null),g=y6(),b=()=>{c.current&&cancelAnimationFrame(c.current)},y=l.useCallback(({alignment:C="start"}={})=>{var S;p.current=!1,c.current&&b();const j=(S=fq({parent:h.current,axis:t}))!=null?S:0,_=dq({parent:h.current,target:m.current,axis:t,alignment:C,offset:o,isList:i})-(h.current?0:j);function I(){d.current===0&&(d.current=performance.now());const M=performance.now()-d.current,R=g||e===0?1:M/e,A=j+_*r(R);pq({parent:h.current,axis:t,distance:A}),!p.current&&R<1?c.current=requestAnimationFrame(I):(typeof n=="function"&&n(),d.current=0,c.current=0,b())}I()},[t,e,r,i,o,n,g]),x=()=>{s&&(p.current=!0)};return Ek("wheel",x,{passive:!0}),Ek("touchmove",x,{passive:!0}),l.useEffect(()=>b,[]),{scrollableRef:h,targetRef:m,scrollIntoView:y,cancel:b}}var Mk=Object.getOwnPropertySymbols,hq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,gq=(e,t)=>{var n={};for(var r in e)hq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mk)for(var r of Mk(e))t.indexOf(r)<0&&mq.call(e,r)&&(n[r]=e[r]);return n};function Hg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:C,c:S,opacity:j,ff:_,fz:I,fw:P,lts:M,ta:R,lh:A,fs:D,tt:O,td:T,w:Y,miw:z,maw:W,h:Q,mih:U,mah:L,bgsz:ee,bgp:K,bgr:Z,bga:se,pos:fe,top:G,left:te,bottom:V,right:F,inset:X,display:ue}=t,q=gq(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:u$({m:n,mx:r,my:o,mt:s,mb:i,ml:c,mr:d,p,px:h,py:m,pt:g,pb:b,pl:y,pr:x,bg:C,c:S,opacity:j,ff:_,fz:I,fw:P,lts:M,ta:R,lh:A,fs:D,tt:O,td:T,w:Y,miw:z,maw:W,h:Q,mih:U,mah:L,bgsz:ee,bgp:K,bgr:Z,bga:se,pos:fe,top:G,left:te,bottom:V,right:F,inset:X,display:ue}),rest:q}}function vq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>yS(Xt({size:r,sizes:t.breakpoints}))-yS(Xt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function bq({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return vq(e,t).reduce((i,c)=>{if(c==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(h=>{i[h]=p}),i):(i[r]=p,i)}const d=n(e[c],t);return Array.isArray(r)?(i[t.fn.largerThan(c)]={},r.forEach(p=>{i[t.fn.largerThan(c)][p]=d}),i):(i[t.fn.largerThan(c)]={[r]:d},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function xq(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function yq(e){return Ge(e)}function Cq(e){return e}function wq(e,t){return Xt({size:e,sizes:t.fontSizes})}const Sq=["-xs","-sm","-md","-lg","-xl"];function kq(e,t){return Sq.includes(e)?`calc(${Xt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Xt({size:e,sizes:t.spacing})}const jq={identity:Cq,color:xq,size:yq,fontSize:wq,spacing:kq},_q={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var Iq=Object.defineProperty,Ok=Object.getOwnPropertySymbols,Pq=Object.prototype.hasOwnProperty,Eq=Object.prototype.propertyIsEnumerable,Rk=(e,t,n)=>t in e?Iq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ak=(e,t)=>{for(var n in t||(t={}))Pq.call(t,n)&&Rk(e,n,t[n]);if(Ok)for(var n of Ok(t))Eq.call(t,n)&&Rk(e,n,t[n]);return e};function Dk(e,t,n=_q){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(bq({value:e[s],getValue:jq[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=Ak(Ak({},o[i]),s[i]):o[i]=s[i]}),o),{})}function Tk(e,t){return typeof e=="function"?e(t):e}function Mq(e,t,n){const r=ki(),{css:o,cx:s}=h6();return Array.isArray(e)?s(n,o(Dk(t,r)),e.map(i=>o(Tk(i,r)))):s(n,o(Tk(e,r)),o(Dk(t,r)))}var Oq=Object.defineProperty,om=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,S6=Object.prototype.propertyIsEnumerable,Nk=(e,t,n)=>t in e?Oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rq=(e,t)=>{for(var n in t||(t={}))w6.call(t,n)&&Nk(e,n,t[n]);if(om)for(var n of om(t))S6.call(t,n)&&Nk(e,n,t[n]);return e},Aq=(e,t)=>{var n={};for(var r in e)w6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&om)for(var r of om(e))t.indexOf(r)<0&&S6.call(e,r)&&(n[r]=e[r]);return n};const k6=l.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,c=Aq(n,["className","component","style","sx"]);const{systemStyles:d,rest:p}=Hg(c),h=o||"div";return B.createElement(h,Rq({ref:t,className:Mq(i,d,r),style:s},p))});k6.displayName="@mantine/core/Box";const Go=k6;var Dq=Object.defineProperty,Tq=Object.defineProperties,Nq=Object.getOwnPropertyDescriptors,$k=Object.getOwnPropertySymbols,$q=Object.prototype.hasOwnProperty,Lq=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?Dq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zk=(e,t)=>{for(var n in t||(t={}))$q.call(t,n)&&Lk(e,n,t[n]);if($k)for(var n of $k(t))Lq.call(t,n)&&Lk(e,n,t[n]);return e},zq=(e,t)=>Tq(e,Nq(t)),Fq=Co(e=>({root:zq(zk(zk({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const Bq=Fq;var Hq=Object.defineProperty,sm=Object.getOwnPropertySymbols,j6=Object.prototype.hasOwnProperty,_6=Object.prototype.propertyIsEnumerable,Fk=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wq=(e,t)=>{for(var n in t||(t={}))j6.call(t,n)&&Fk(e,n,t[n]);if(sm)for(var n of sm(t))_6.call(t,n)&&Fk(e,n,t[n]);return e},Vq=(e,t)=>{var n={};for(var r in e)j6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sm)for(var r of sm(e))t.indexOf(r)<0&&_6.call(e,r)&&(n[r]=e[r]);return n};const I6=l.forwardRef((e,t)=>{const n=Nr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,c=Vq(n,["className","component","unstyled","variant"]),{classes:d,cx:p}=Bq(null,{name:"UnstyledButton",unstyled:s,variant:i});return B.createElement(Go,Wq({component:o,ref:t,className:p(d.root,r),type:o==="button"?"button":void 0},c))});I6.displayName="@mantine/core/UnstyledButton";const Uq=I6;var Gq=Object.defineProperty,qq=Object.defineProperties,Kq=Object.getOwnPropertyDescriptors,Bk=Object.getOwnPropertySymbols,Qq=Object.prototype.hasOwnProperty,Xq=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rb=(e,t)=>{for(var n in t||(t={}))Qq.call(t,n)&&Hk(e,n,t[n]);if(Bk)for(var n of Bk(t))Xq.call(t,n)&&Hk(e,n,t[n]);return e},Wk=(e,t)=>qq(e,Kq(t));const Yq=["subtle","filled","outline","light","default","transparent","gradient"],Kp={xs:Ge(18),sm:Ge(22),md:Ge(28),lg:Ge(34),xl:Ge(44)};function Jq({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:Yq.includes(e)?Rb({border:`${Ge(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var Zq=Co((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:Wk(Rb({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Xt({size:s,sizes:Kp}),minHeight:Xt({size:s,sizes:Kp}),width:Xt({size:s,sizes:Kp}),minWidth:Xt({size:s,sizes:Kp})},Jq({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":Wk(Rb({content:'""'},e.fn.cover(Ge(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const eK=Zq;var tK=Object.defineProperty,am=Object.getOwnPropertySymbols,P6=Object.prototype.hasOwnProperty,E6=Object.prototype.propertyIsEnumerable,Vk=(e,t,n)=>t in e?tK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uk=(e,t)=>{for(var n in t||(t={}))P6.call(t,n)&&Vk(e,n,t[n]);if(am)for(var n of am(t))E6.call(t,n)&&Vk(e,n,t[n]);return e},Gk=(e,t)=>{var n={};for(var r in e)P6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&am)for(var r of am(e))t.indexOf(r)<0&&E6.call(e,r)&&(n[r]=e[r]);return n};function nK(e){var t=e,{size:n,color:r}=t,o=Gk(t,["size","color"]);const s=o,{style:i}=s,c=Gk(s,["style"]);return B.createElement("svg",Uk({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Uk({width:n},i)},c),B.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},B.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var rK=Object.defineProperty,im=Object.getOwnPropertySymbols,M6=Object.prototype.hasOwnProperty,O6=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?rK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kk=(e,t)=>{for(var n in t||(t={}))M6.call(t,n)&&qk(e,n,t[n]);if(im)for(var n of im(t))O6.call(t,n)&&qk(e,n,t[n]);return e},Qk=(e,t)=>{var n={};for(var r in e)M6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&im)for(var r of im(e))t.indexOf(r)<0&&O6.call(e,r)&&(n[r]=e[r]);return n};function oK(e){var t=e,{size:n,color:r}=t,o=Qk(t,["size","color"]);const s=o,{style:i}=s,c=Qk(s,["style"]);return B.createElement("svg",Kk({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:Kk({width:n,height:n},i)},c),B.createElement("g",{fill:"none",fillRule:"evenodd"},B.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},B.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),B.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},B.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var sK=Object.defineProperty,lm=Object.getOwnPropertySymbols,R6=Object.prototype.hasOwnProperty,A6=Object.prototype.propertyIsEnumerable,Xk=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yk=(e,t)=>{for(var n in t||(t={}))R6.call(t,n)&&Xk(e,n,t[n]);if(lm)for(var n of lm(t))A6.call(t,n)&&Xk(e,n,t[n]);return e},Jk=(e,t)=>{var n={};for(var r in e)R6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lm)for(var r of lm(e))t.indexOf(r)<0&&A6.call(e,r)&&(n[r]=e[r]);return n};function aK(e){var t=e,{size:n,color:r}=t,o=Jk(t,["size","color"]);const s=o,{style:i}=s,c=Jk(s,["style"]);return B.createElement("svg",Yk({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Yk({width:n},i)},c),B.createElement("circle",{cx:"15",cy:"15",r:"15"},B.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},B.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),B.createElement("circle",{cx:"105",cy:"15",r:"15"},B.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),B.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var iK=Object.defineProperty,cm=Object.getOwnPropertySymbols,D6=Object.prototype.hasOwnProperty,T6=Object.prototype.propertyIsEnumerable,Zk=(e,t,n)=>t in e?iK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lK=(e,t)=>{for(var n in t||(t={}))D6.call(t,n)&&Zk(e,n,t[n]);if(cm)for(var n of cm(t))T6.call(t,n)&&Zk(e,n,t[n]);return e},cK=(e,t)=>{var n={};for(var r in e)D6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&cm)for(var r of cm(e))t.indexOf(r)<0&&T6.call(e,r)&&(n[r]=e[r]);return n};const o1={bars:nK,oval:oK,dots:aK},uK={xs:Ge(18),sm:Ge(22),md:Ge(36),lg:Ge(44),xl:Ge(58)},dK={size:"md"};function N6(e){const t=Nr("Loader",dK,e),{size:n,color:r,variant:o}=t,s=cK(t,["size","color","variant"]),i=ki(),c=o in o1?o:i.loader;return B.createElement(Go,lK({role:"presentation",component:o1[c]||o1.bars,size:Xt({size:n,sizes:uK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}N6.displayName="@mantine/core/Loader";var fK=Object.defineProperty,um=Object.getOwnPropertySymbols,$6=Object.prototype.hasOwnProperty,L6=Object.prototype.propertyIsEnumerable,e4=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t4=(e,t)=>{for(var n in t||(t={}))$6.call(t,n)&&e4(e,n,t[n]);if(um)for(var n of um(t))L6.call(t,n)&&e4(e,n,t[n]);return e},pK=(e,t)=>{var n={};for(var r in e)$6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&um)for(var r of um(e))t.indexOf(r)<0&&L6.call(e,r)&&(n[r]=e[r]);return n};const hK={color:"gray",size:"md",variant:"subtle"},z6=l.forwardRef((e,t)=>{const n=Nr("ActionIcon",hK,e),{className:r,color:o,children:s,radius:i,size:c,variant:d,gradient:p,disabled:h,loaderProps:m,loading:g,unstyled:b,__staticSelector:y}=n,x=pK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:C,cx:S,theme:j}=eK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:b,size:c,variant:d}),_=B.createElement(N6,t4({color:j.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},m));return B.createElement(Uq,t4({className:S(C.root,r),ref:t,disabled:h,"data-disabled":h||void 0,"data-loading":g||void 0,unstyled:b},x),g?_:s)});z6.displayName="@mantine/core/ActionIcon";const mK=z6;var gK=Object.defineProperty,vK=Object.defineProperties,bK=Object.getOwnPropertyDescriptors,dm=Object.getOwnPropertySymbols,F6=Object.prototype.hasOwnProperty,B6=Object.prototype.propertyIsEnumerable,n4=(e,t,n)=>t in e?gK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xK=(e,t)=>{for(var n in t||(t={}))F6.call(t,n)&&n4(e,n,t[n]);if(dm)for(var n of dm(t))B6.call(t,n)&&n4(e,n,t[n]);return e},yK=(e,t)=>vK(e,bK(t)),CK=(e,t)=>{var n={};for(var r in e)F6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dm)for(var r of dm(e))t.indexOf(r)<0&&B6.call(e,r)&&(n[r]=e[r]);return n};function H6(e){const t=Nr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=CK(t,["children","target","className","innerRef"]),c=ki(),[d,p]=l.useState(!1),h=l.useRef();return m6(()=>(p(!0),h.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(h.current),()=>{!r&&document.body.removeChild(h.current)}),[r]),d?rs.createPortal(B.createElement("div",yK(xK({className:o,dir:c.dir},i),{ref:s}),n),h.current):null}H6.displayName="@mantine/core/Portal";var wK=Object.defineProperty,fm=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,V6=Object.prototype.propertyIsEnumerable,r4=(e,t,n)=>t in e?wK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SK=(e,t)=>{for(var n in t||(t={}))W6.call(t,n)&&r4(e,n,t[n]);if(fm)for(var n of fm(t))V6.call(t,n)&&r4(e,n,t[n]);return e},kK=(e,t)=>{var n={};for(var r in e)W6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fm)for(var r of fm(e))t.indexOf(r)<0&&V6.call(e,r)&&(n[r]=e[r]);return n};function U6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=kK(t,["withinPortal","children"]);return n?B.createElement(H6,SK({},o),r):B.createElement(B.Fragment,null,r)}U6.displayName="@mantine/core/OptionalPortal";var jK=Object.defineProperty,pm=Object.getOwnPropertySymbols,G6=Object.prototype.hasOwnProperty,q6=Object.prototype.propertyIsEnumerable,o4=(e,t,n)=>t in e?jK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s4=(e,t)=>{for(var n in t||(t={}))G6.call(t,n)&&o4(e,n,t[n]);if(pm)for(var n of pm(t))q6.call(t,n)&&o4(e,n,t[n]);return e},_K=(e,t)=>{var n={};for(var r in e)G6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&q6.call(e,r)&&(n[r]=e[r]);return n};function K6(e){const t=e,{width:n,height:r,style:o}=t,s=_K(t,["width","height","style"]);return B.createElement("svg",s4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:s4({width:n,height:r},o)},s),B.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}K6.displayName="@mantine/core/CloseIcon";var IK=Object.defineProperty,hm=Object.getOwnPropertySymbols,Q6=Object.prototype.hasOwnProperty,X6=Object.prototype.propertyIsEnumerable,a4=(e,t,n)=>t in e?IK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PK=(e,t)=>{for(var n in t||(t={}))Q6.call(t,n)&&a4(e,n,t[n]);if(hm)for(var n of hm(t))X6.call(t,n)&&a4(e,n,t[n]);return e},EK=(e,t)=>{var n={};for(var r in e)Q6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&X6.call(e,r)&&(n[r]=e[r]);return n};const MK={xs:Ge(12),sm:Ge(16),md:Ge(20),lg:Ge(28),xl:Ge(34)},OK={size:"sm"},Y6=l.forwardRef((e,t)=>{const n=Nr("CloseButton",OK,e),{iconSize:r,size:o,children:s}=n,i=EK(n,["iconSize","size","children"]),c=Ge(r||MK[o]);return B.createElement(mK,PK({ref:t,__staticSelector:"CloseButton",size:o},i),s||B.createElement(K6,{width:c,height:c}))});Y6.displayName="@mantine/core/CloseButton";const J6=Y6;var RK=Object.defineProperty,AK=Object.defineProperties,DK=Object.getOwnPropertyDescriptors,i4=Object.getOwnPropertySymbols,TK=Object.prototype.hasOwnProperty,NK=Object.prototype.propertyIsEnumerable,l4=(e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qp=(e,t)=>{for(var n in t||(t={}))TK.call(t,n)&&l4(e,n,t[n]);if(i4)for(var n of i4(t))NK.call(t,n)&&l4(e,n,t[n]);return e},$K=(e,t)=>AK(e,DK(t));function LK({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function zK({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function FK(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function BK({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var HK=Co((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:c,weight:d,transform:p,align:h,strikethrough:m,italic:g},{size:b})=>{const y=e.fn.variant({variant:"gradient",gradient:c});return{root:$K(Qp(Qp(Qp(Qp({},e.fn.fontStyles()),e.fn.focusStyles()),FK(n)),BK({theme:e,truncate:r})),{color:zK({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":Xt({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:LK({underline:i,strikethrough:m}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:p,textAlign:h,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const WK=HK;var VK=Object.defineProperty,mm=Object.getOwnPropertySymbols,Z6=Object.prototype.hasOwnProperty,eE=Object.prototype.propertyIsEnumerable,c4=(e,t,n)=>t in e?VK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UK=(e,t)=>{for(var n in t||(t={}))Z6.call(t,n)&&c4(e,n,t[n]);if(mm)for(var n of mm(t))eE.call(t,n)&&c4(e,n,t[n]);return e},GK=(e,t)=>{var n={};for(var r in e)Z6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&eE.call(e,r)&&(n[r]=e[r]);return n};const qK={variant:"text"},tE=l.forwardRef((e,t)=>{const n=Nr("Text",qK,e),{className:r,size:o,weight:s,transform:i,color:c,align:d,variant:p,lineClamp:h,truncate:m,gradient:g,inline:b,inherit:y,underline:x,strikethrough:C,italic:S,classNames:j,styles:_,unstyled:I,span:P,__staticSelector:M}=n,R=GK(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:A,cx:D}=WK({color:c,lineClamp:h,truncate:m,inline:b,inherit:y,underline:x,strikethrough:C,italic:S,weight:s,transform:i,align:d,gradient:g},{unstyled:I,name:M||"Text",variant:p,size:o});return B.createElement(Go,UK({ref:t,className:D(A.root,{[A.gradient]:p==="gradient"},r),component:P?"span":"div"},R))});tE.displayName="@mantine/core/Text";const yu=tE,Xp={xs:Ge(1),sm:Ge(2),md:Ge(3),lg:Ge(4),xl:Ge(5)};function Yp(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var KK=Co((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Ge(1),borderTop:`${Xt({size:n,sizes:Xp})} ${r} ${Yp(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Xt({size:n,sizes:Xp})} ${r} ${Yp(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Ge(Xt({size:n,sizes:Xp})),borderTopColor:Yp(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Ge(Xt({size:n,sizes:Xp})),borderLeftColor:Yp(e,t),borderLeftStyle:r}}));const QK=KK;var XK=Object.defineProperty,YK=Object.defineProperties,JK=Object.getOwnPropertyDescriptors,gm=Object.getOwnPropertySymbols,nE=Object.prototype.hasOwnProperty,rE=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?XK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d4=(e,t)=>{for(var n in t||(t={}))nE.call(t,n)&&u4(e,n,t[n]);if(gm)for(var n of gm(t))rE.call(t,n)&&u4(e,n,t[n]);return e},ZK=(e,t)=>YK(e,JK(t)),eQ=(e,t)=>{var n={};for(var r in e)nE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&rE.call(e,r)&&(n[r]=e[r]);return n};const tQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Ab=l.forwardRef((e,t)=>{const n=Nr("Divider",tQ,e),{className:r,color:o,orientation:s,size:i,label:c,labelPosition:d,labelProps:p,variant:h,styles:m,classNames:g,unstyled:b}=n,y=eQ(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:x,cx:C}=QK({color:o},{classNames:g,styles:m,unstyled:b,name:"Divider",variant:h,size:i}),S=s==="vertical",j=s==="horizontal",_=!!c&&j,I=!(p!=null&&p.color);return B.createElement(Go,d4({ref:t,className:C(x.root,{[x.vertical]:S,[x.horizontal]:j,[x.withLabel]:_},r),role:"separator"},y),_&&B.createElement(yu,ZK(d4({},p),{size:(p==null?void 0:p.size)||"xs",mt:Ge(2),className:C(x.label,x[d],{[x.labelDefaultStyles]:I})}),c))});Ab.displayName="@mantine/core/Divider";var nQ=Object.defineProperty,rQ=Object.defineProperties,oQ=Object.getOwnPropertyDescriptors,f4=Object.getOwnPropertySymbols,sQ=Object.prototype.hasOwnProperty,aQ=Object.prototype.propertyIsEnumerable,p4=(e,t,n)=>t in e?nQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h4=(e,t)=>{for(var n in t||(t={}))sQ.call(t,n)&&p4(e,n,t[n]);if(f4)for(var n of f4(t))aQ.call(t,n)&&p4(e,n,t[n]);return e},iQ=(e,t)=>rQ(e,oQ(t)),lQ=Co((e,t,{size:n})=>({item:iQ(h4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:Xt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":h4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const cQ=lQ;var uQ=Object.defineProperty,m4=Object.getOwnPropertySymbols,dQ=Object.prototype.hasOwnProperty,fQ=Object.prototype.propertyIsEnumerable,g4=(e,t,n)=>t in e?uQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pQ=(e,t)=>{for(var n in t||(t={}))dQ.call(t,n)&&g4(e,n,t[n]);if(m4)for(var n of m4(t))fQ.call(t,n)&&g4(e,n,t[n]);return e};function Ny({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:c,onItemSelect:d,itemsRefs:p,itemComponent:h,size:m,nothingFound:g,creatable:b,createLabel:y,unstyled:x,variant:C}){const{classes:S}=cQ(null,{classNames:n,styles:r,unstyled:x,name:i,variant:C,size:m}),j=[],_=[];let I=null;const P=(R,A)=>{const D=typeof o=="function"?o(R.value):!1;return B.createElement(h,pQ({key:R.value,className:S.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===A||void 0,"data-selected":!R.disabled&&D||void 0,selected:D,onMouseEnter:()=>c(A),id:`${s}-${A}`,role:"option",tabIndex:-1,"aria-selected":t===A,ref:O=>{p&&p.current&&(p.current[R.value]=O)},onMouseDown:R.disabled?null:O=>{O.preventDefault(),d(R)},disabled:R.disabled,variant:C},R))};let M=null;if(e.forEach((R,A)=>{R.creatable?I=A:R.group?(M!==R.group&&(M=R.group,_.push(B.createElement("div",{className:S.separator,key:`__mantine-divider-${A}`},B.createElement(Ab,{classNames:{label:S.separatorLabel},label:R.group})))),_.push(P(R,A))):j.push(P(R,A))}),b){const R=e[I];j.push(B.createElement("div",{key:Dy(),className:S.item,"data-hovered":t===I||void 0,onMouseEnter:()=>c(I),onMouseDown:A=>{A.preventDefault(),d(R)},tabIndex:-1,ref:A=>{p&&p.current&&(p.current[R.value]=A)}},y))}return _.length>0&&j.length>0&&j.unshift(B.createElement("div",{className:S.separator,key:"empty-group-separator"},B.createElement(Ab,null))),_.length>0||j.length>0?B.createElement(B.Fragment,null,_,j):B.createElement(yu,{size:m,unstyled:x,className:S.nothingFound},g)}Ny.displayName="@mantine/core/SelectItems";var hQ=Object.defineProperty,vm=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,v4=(e,t,n)=>t in e?hQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mQ=(e,t)=>{for(var n in t||(t={}))oE.call(t,n)&&v4(e,n,t[n]);if(vm)for(var n of vm(t))sE.call(t,n)&&v4(e,n,t[n]);return e},gQ=(e,t)=>{var n={};for(var r in e)oE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&sE.call(e,r)&&(n[r]=e[r]);return n};const $y=l.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=gQ(n,["label","value"]);return B.createElement("div",mQ({ref:t},s),r||o)});$y.displayName="@mantine/core/DefaultItem";function vQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function aE(...e){return t=>e.forEach(n=>vQ(n,t))}function rc(...e){return l.useCallback(aE(...e),e)}const iE=l.forwardRef((e,t)=>{const{children:n,...r}=e,o=l.Children.toArray(n),s=o.find(xQ);if(s){const i=s.props.children,c=o.map(d=>d===s?l.Children.count(i)>1?l.Children.only(null):l.isValidElement(i)?i.props.children:null:d);return l.createElement(Db,mr({},r,{ref:t}),l.isValidElement(i)?l.cloneElement(i,void 0,c):null)}return l.createElement(Db,mr({},r,{ref:t}),n)});iE.displayName="Slot";const Db=l.forwardRef((e,t)=>{const{children:n,...r}=e;return l.isValidElement(n)?l.cloneElement(n,{...yQ(r,n.props),ref:aE(t,n.ref)}):l.Children.count(n)>1?l.Children.only(null):null});Db.displayName="SlotClone";const bQ=({children:e})=>l.createElement(l.Fragment,null,e);function xQ(e){return l.isValidElement(e)&&e.type===bQ}function yQ(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{s(...c),o(...c)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const CQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Ff=CQ.reduce((e,t)=>{const n=l.forwardRef((r,o)=>{const{asChild:s,...i}=r,c=s?iE:t;return l.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),l.createElement(c,mr({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Tb=globalThis!=null&&globalThis.document?l.useLayoutEffect:()=>{};function wQ(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Bf=e=>{const{present:t,children:n}=e,r=SQ(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=rc(r.ref,o.ref);return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null};Bf.displayName="Presence";function SQ(e){const[t,n]=l.useState(),r=l.useRef({}),o=l.useRef(e),s=l.useRef("none"),i=e?"mounted":"unmounted",[c,d]=wQ(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const p=Jp(r.current);s.current=c==="mounted"?p:"none"},[c]),Tb(()=>{const p=r.current,h=o.current;if(h!==e){const g=s.current,b=Jp(p);e?d("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?d("UNMOUNT"):d(h&&g!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Tb(()=>{if(t){const p=m=>{const b=Jp(r.current).includes(m.animationName);m.target===t&&b&&rs.flushSync(()=>d("ANIMATION_END"))},h=m=>{m.target===t&&(s.current=Jp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:l.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function Jp(e){return(e==null?void 0:e.animationName)||"none"}function kQ(e,t=[]){let n=[];function r(s,i){const c=l.createContext(i),d=n.length;n=[...n,i];function p(m){const{scope:g,children:b,...y}=m,x=(g==null?void 0:g[e][d])||c,C=l.useMemo(()=>y,Object.values(y));return l.createElement(x.Provider,{value:C},b)}function h(m,g){const b=(g==null?void 0:g[e][d])||c,y=l.useContext(b);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,h]}const o=()=>{const s=n.map(i=>l.createContext(i));return function(c){const d=(c==null?void 0:c[e])||s;return l.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,jQ(o,...t)]}function jQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((c,{useScope:d,scopeName:p})=>{const m=d(s)[`__scope${p}`];return{...c,...m}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ml(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const _Q=l.createContext(void 0);function IQ(e){const t=l.useContext(_Q);return e||t||"ltr"}function PQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function $l(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function EQ(e,t){return l.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const lE="ScrollArea",[cE,pbe]=kQ(lE),[MQ,As]=cE(lE),OQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[c,d]=l.useState(null),[p,h]=l.useState(null),[m,g]=l.useState(null),[b,y]=l.useState(null),[x,C]=l.useState(null),[S,j]=l.useState(0),[_,I]=l.useState(0),[P,M]=l.useState(!1),[R,A]=l.useState(!1),D=rc(t,T=>d(T)),O=IQ(o);return l.createElement(MQ,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:c,viewport:p,onViewportChange:h,content:m,onContentChange:g,scrollbarX:b,onScrollbarXChange:y,scrollbarXEnabled:P,onScrollbarXEnabledChange:M,scrollbarY:x,onScrollbarYChange:C,scrollbarYEnabled:R,onScrollbarYEnabledChange:A,onCornerWidthChange:j,onCornerHeightChange:I},l.createElement(Ff.div,mr({dir:O},i,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),RQ="ScrollAreaViewport",AQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=As(RQ,n),i=l.useRef(null),c=rc(t,i,s.onViewportChange);return l.createElement(l.Fragment,null,l.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),l.createElement(Ff.div,mr({"data-radix-scroll-area-viewport":""},o,{ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),l.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),_i="ScrollAreaScrollbar",DQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(_i,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,c=e.orientation==="horizontal";return l.useEffect(()=>(c?s(!0):i(!0),()=>{c?s(!1):i(!1)}),[c,s,i]),o.type==="hover"?l.createElement(TQ,mr({},r,{ref:t,forceMount:n})):o.type==="scroll"?l.createElement(NQ,mr({},r,{ref:t,forceMount:n})):o.type==="auto"?l.createElement(uE,mr({},r,{ref:t,forceMount:n})):o.type==="always"?l.createElement(Ly,mr({},r,{ref:t})):null}),TQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(_i,e.__scopeScrollArea),[s,i]=l.useState(!1);return l.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const p=()=>{window.clearTimeout(d),i(!0)},h=()=>{d=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",h)}}},[o.scrollArea,o.scrollHideDelay]),l.createElement(Bf,{present:n||s},l.createElement(uE,mr({"data-state":s?"visible":"hidden"},r,{ref:t})))}),NQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(_i,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Vg(()=>d("SCROLL_END"),100),[c,d]=EQ("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return l.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,o.scrollHideDelay,d]),l.useEffect(()=>{const p=o.viewport,h=s?"scrollLeft":"scrollTop";if(p){let m=p[h];const g=()=>{const b=p[h];m!==b&&(d("SCROLL"),i()),m=b};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,d,i]),l.createElement(Bf,{present:n||c!=="hidden"},l.createElement(Ly,mr({"data-state":c==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:$l(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$l(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),uE=l.forwardRef((e,t)=>{const n=As(_i,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=l.useState(!1),c=e.orientation==="horizontal",d=Vg(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=As(_i,e.__scopeScrollArea),s=l.useRef(null),i=l.useRef(0),[c,d]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=hE(c.viewport,c.content),h={...r,sizes:c,onSizesChange:d,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function m(g,b){return VQ(g,i.current,c,b)}return n==="horizontal"?l.createElement($Q,mr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,b=b4(g,c,o.dir);s.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=m(g,o.dir))}})):n==="vertical"?l.createElement(LQ,mr({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,b=b4(g,c);s.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=m(g))}})):null}),$Q=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(_i,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarXChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(fE,mr({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollLeft+h.deltaX;e.onWheelScroll(g),gE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:bm(i.paddingLeft),paddingEnd:bm(i.paddingRight)}})}}))}),LQ=l.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(_i,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),p=rc(t,d,s.onScrollbarYChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),l.createElement(fE,mr({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wg(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(s.viewport){const g=s.viewport.scrollTop+h.deltaY;e.onWheelScroll(g),gE(g,m)&&h.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:bm(i.paddingTop),paddingEnd:bm(i.paddingBottom)}})}}))}),[zQ,dE]=cE(_i),fE=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:p,onWheelScroll:h,onResize:m,...g}=e,b=As(_i,n),[y,x]=l.useState(null),C=rc(t,D=>x(D)),S=l.useRef(null),j=l.useRef(""),_=b.viewport,I=r.content-r.viewport,P=Ml(h),M=Ml(d),R=Vg(m,10);function A(D){if(S.current){const O=D.clientX-S.current.left,T=D.clientY-S.current.top;p({x:O,y:T})}}return l.useEffect(()=>{const D=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&P(O,I)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[_,y,I,P]),l.useEffect(M,[r,M]),Cu(y,R),Cu(b.content,R),l.createElement(zQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ml(s),onThumbPointerUp:Ml(i),onThumbPositionChange:M,onThumbPointerDown:Ml(c)},l.createElement(Ff.div,mr({},g,{ref:C,style:{position:"absolute",...g.style},onPointerDown:$l(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",A(D))}),onPointerMove:$l(e.onPointerMove,A),onPointerUp:$l(e.onPointerUp,D=>{const O=D.target;O.hasPointerCapture(D.pointerId)&&O.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Nb="ScrollAreaThumb",FQ=l.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=dE(Nb,e.__scopeScrollArea);return l.createElement(Bf,{present:n||o.hasThumb},l.createElement(BQ,mr({ref:t},r)))}),BQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=As(Nb,n),i=dE(Nb,n),{onThumbPositionChange:c}=i,d=rc(t,m=>i.onThumbChange(m)),p=l.useRef(),h=Vg(()=>{p.current&&(p.current(),p.current=void 0)},100);return l.useEffect(()=>{const m=s.viewport;if(m){const g=()=>{if(h(),!p.current){const b=UQ(m,c);p.current=b,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[s.viewport,h,c]),l.createElement(Ff.div,mr({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$l(e.onPointerDownCapture,m=>{const b=m.target.getBoundingClientRect(),y=m.clientX-b.left,x=m.clientY-b.top;i.onThumbPointerDown({x:y,y:x})}),onPointerUp:$l(e.onPointerUp,i.onThumbPointerUp)}))}),pE="ScrollAreaCorner",HQ=l.forwardRef((e,t)=>{const n=As(pE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.createElement(WQ,mr({},e,{ref:t})):null}),WQ=l.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=As(pE,n),[s,i]=l.useState(0),[c,d]=l.useState(0),p=!!(s&&c);return Cu(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),d(m)}),Cu(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),i(m)}),p?l.createElement(Ff.div,mr({},r,{ref:t,style:{width:s,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function bm(e){return e?parseInt(e,10):0}function hE(e,t){const n=e/t;return isNaN(n)?0:n}function Wg(e){const t=hE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function VQ(e,t,n,r="ltr"){const o=Wg(n),s=o/2,i=t||s,c=o-i,d=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-c,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return mE([d,p],m)(e)}function b4(e,t,n="ltr"){const r=Wg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,c=s-r,d=n==="ltr"?[0,i]:[i*-1,0],p=PQ(e,d);return mE([0,i],[0,c])(p)}function mE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function gE(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,c=n.top!==s.top;(i||c)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Vg(e,t){const n=Ml(e),r=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),l.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Cu(e,t){const n=Ml(t);Tb(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const GQ=OQ,qQ=AQ,x4=DQ,y4=FQ,KQ=HQ;var QQ=Co((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Ge(t):void 0,paddingBottom:n?Ge(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Ge(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${jk("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Ge(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Ge(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:jk("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Ge(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Ge(44),minHeight:Ge(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const XQ=QQ;var YQ=Object.defineProperty,JQ=Object.defineProperties,ZQ=Object.getOwnPropertyDescriptors,xm=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,bE=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?YQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$b=(e,t)=>{for(var n in t||(t={}))vE.call(t,n)&&C4(e,n,t[n]);if(xm)for(var n of xm(t))bE.call(t,n)&&C4(e,n,t[n]);return e},xE=(e,t)=>JQ(e,ZQ(t)),yE=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&bE.call(e,r)&&(n[r]=e[r]);return n};const CE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},Ug=l.forwardRef((e,t)=>{const n=Nr("ScrollArea",CE,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:c,scrollHideDelay:d,type:p,dir:h,offsetScrollbars:m,viewportRef:g,onScrollPositionChange:b,unstyled:y,variant:x,viewportProps:C}=n,S=yE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=l.useState(!1),I=ki(),{classes:P,cx:M}=XQ({scrollbarSize:c,offsetScrollbars:m,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:x});return B.createElement(GQ,{type:p==="never"?"always":p,scrollHideDelay:d,dir:h||I.dir,ref:t,asChild:!0},B.createElement(Go,$b({className:M(P.root,o)},S),B.createElement(qQ,xE($b({},C),{className:P.viewport,ref:g,onScroll:typeof b=="function"?({currentTarget:R})=>b({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),B.createElement(x4,{orientation:"horizontal",className:P.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},B.createElement(y4,{className:P.thumb})),B.createElement(x4,{orientation:"vertical",className:P.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},B.createElement(y4,{className:P.thumb})),B.createElement(KQ,{className:P.corner})))}),wE=l.forwardRef((e,t)=>{const n=Nr("ScrollAreaAutosize",CE,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:c,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,sx:y,variant:x,viewportProps:C}=n,S=yE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return B.createElement(Go,xE($b({},S),{ref:t,sx:[{display:"flex"},...c6(y)]}),B.createElement(Go,{sx:{display:"flex",flexDirection:"column",flex:1}},B.createElement(Ug,{classNames:o,styles:s,scrollHideDelay:c,scrollbarSize:i,type:d,dir:p,offsetScrollbars:h,viewportRef:m,onScrollPositionChange:g,unstyled:b,variant:x,viewportProps:C},r)))});wE.displayName="@mantine/core/ScrollAreaAutosize";Ug.displayName="@mantine/core/ScrollArea";Ug.Autosize=wE;const SE=Ug;var eX=Object.defineProperty,tX=Object.defineProperties,nX=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,w4=(e,t,n)=>t in e?eX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S4=(e,t)=>{for(var n in t||(t={}))kE.call(t,n)&&w4(e,n,t[n]);if(ym)for(var n of ym(t))jE.call(t,n)&&w4(e,n,t[n]);return e},rX=(e,t)=>tX(e,nX(t)),oX=(e,t)=>{var n={};for(var r in e)kE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&jE.call(e,r)&&(n[r]=e[r]);return n};const Gg=l.forwardRef((e,t)=>{var n=e,{style:r}=n,o=oX(n,["style"]);return B.createElement(SE,rX(S4({},o),{style:S4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Gg.displayName="@mantine/core/SelectScrollArea";var sX=Co(()=>({dropdown:{},itemsWrapper:{padding:Ge(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const aX=sX;function Fu(e){return e.split("-")[1]}function zy(e){return e==="y"?"height":"width"}function Zs(e){return e.split("-")[0]}function dl(e){return["top","bottom"].includes(Zs(e))?"x":"y"}function k4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,c=dl(t),d=zy(c),p=r[d]/2-o[d]/2,h=c==="x";let m;switch(Zs(t)){case"top":m={x:s,y:r.y-o.height};break;case"bottom":m={x:s,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:i};break;case"left":m={x:r.x-o.width,y:i};break;default:m={x:r.x,y:r.y}}switch(Fu(t)){case"start":m[c]-=p*(n&&h?-1:1);break;case"end":m[c]+=p*(n&&h?-1:1)}return m}const iX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),d=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:m}=k4(p,r,d),g=r,b={},y=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c}=t,{element:d,padding:p=0}=hi(e,t)||{};if(d==null)return{};const h=Fy(p),m={x:n,y:r},g=dl(o),b=zy(g),y=await i.getDimensions(d),x=g==="y",C=x?"top":"left",S=x?"bottom":"right",j=x?"clientHeight":"clientWidth",_=s.reference[b]+s.reference[g]-m[g]-s.floating[b],I=m[g]-s.reference[g],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let M=P?P[j]:0;M&&await(i.isElement==null?void 0:i.isElement(P))||(M=c.floating[j]||s.floating[b]);const R=_/2-I/2,A=M/2-y[b]/2-1,D=rl(h[C],A),O=rl(h[S],A),T=D,Y=M-y[b]-O,z=M/2-y[b]/2+R,W=Lb(T,z,Y),Q=Fu(o)!=null&&z!=W&&s.reference[b]/2-(ze.concat(t,t+"-start",t+"-end"),[]);const cX={left:"right",right:"left",bottom:"top",top:"bottom"};function Cm(e){return e.replace(/left|right|bottom|top/g,t=>cX[t])}function uX(e,t,n){n===void 0&&(n=!1);const r=Fu(e),o=dl(e),s=zy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Cm(i)),{main:i,cross:Cm(i)}}const dX={start:"end",end:"start"};function s1(e){return e.replace(/start|end/g,t=>dX[t])}const fX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:c,elements:d}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...x}=hi(e,t),C=Zs(r),S=Zs(i)===i,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),_=m||(S||!y?[Cm(i)]:function(T){const Y=Cm(T);return[s1(T),Y,s1(Y)]}(i));m||b==="none"||_.push(...function(T,Y,z,W){const Q=Fu(T);let U=function(L,ee,K){const Z=["left","right"],se=["right","left"],fe=["top","bottom"],G=["bottom","top"];switch(L){case"top":case"bottom":return K?ee?se:Z:ee?Z:se;case"left":case"right":return ee?fe:G;default:return[]}}(Zs(T),z==="start",W);return Q&&(U=U.map(L=>L+"-"+Q),Y&&(U=U.concat(U.map(s1)))),U}(i,y,b,j));const I=[i,..._],P=await By(t,x),M=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(P[C]),h){const{main:T,cross:Y}=uX(r,s,j);M.push(P[T],P[Y])}if(R=[...R,{placement:r,overflows:M}],!M.every(T=>T<=0)){var A,D;const T=(((A=o.flip)==null?void 0:A.index)||0)+1,Y=I[T];if(Y)return{data:{index:T,overflows:R},reset:{placement:Y}};let z=(D=R.filter(W=>W.overflows[0]<=0).sort((W,Q)=>W.overflows[1]-Q.overflows[1])[0])==null?void 0:D.placement;if(!z)switch(g){case"bestFit":{var O;const W=(O=R.map(Q=>[Q.placement,Q.overflows.filter(U=>U>0).reduce((U,L)=>U+L,0)]).sort((Q,U)=>Q[1]-U[1])[0])==null?void 0:O[0];W&&(z=W);break}case"initialPlacement":z=i}if(r!==z)return{reset:{placement:z}}}return{}}}};function _4(e){const t=rl(...e.map(r=>r.left)),n=rl(...e.map(r=>r.top));return{x:t,y:n,width:xa(...e.map(r=>r.right))-t,height:xa(...e.map(r=>r.bottom))-n}}const pX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:c=2,x:d,y:p}=hi(e,t),h=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),m=function(x){const C=x.slice().sort((_,I)=>_.y-I.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([I]):S[S.length-1].push(I),j=I}return S.map(_=>wu(_4(_)))}(h),g=wu(_4(h)),b=Fy(c),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(m.length===2&&m[0].left>m[1].right&&d!=null&&p!=null)return m.find(x=>d>x.left-b.left&&dx.top-b.top&&p=2){if(dl(n)==="x"){const P=m[0],M=m[m.length-1],R=Zs(n)==="top",A=P.top,D=M.bottom,O=R?P.left:M.left,T=R?P.right:M.right;return{top:A,bottom:D,left:O,right:T,width:T-O,height:D-A,x:O,y:A}}const x=Zs(n)==="left",C=xa(...m.map(P=>P.right)),S=rl(...m.map(P=>P.left)),j=m.filter(P=>x?P.left===S:P.right===C),_=j[0].top,I=j[j.length-1].bottom;return{top:_,bottom:I,left:S,right:C,width:C-S,height:I-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},hX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:c,platform:d,elements:p}=s,h=await(d.isRTL==null?void 0:d.isRTL(p.floating)),m=Zs(c),g=Fu(c),b=dl(c)==="x",y=["left","top"].includes(m)?-1:1,x=h&&b?-1:1,C=hi(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof C=="number"?{mainAxis:C,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...C};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),b?{x:j*x,y:S*y}:{x:S*y,y:j*x}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function _E(e){return e==="x"?"y":"x"}const mX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:C=>{let{x:S,y:j}=C;return{x:S,y:j}}},...d}=hi(e,t),p={x:n,y:r},h=await By(t,d),m=dl(Zs(o)),g=_E(m);let b=p[m],y=p[g];if(s){const C=m==="y"?"bottom":"right";b=Lb(b+h[m==="y"?"top":"left"],b,b-h[C])}if(i){const C=g==="y"?"bottom":"right";y=Lb(y+h[g==="y"?"top":"left"],y,y-h[C])}const x=c.fn({...t,[m]:b,[g]:y});return{...x,data:{x:x.x-n,y:x.y-r}}}}},gX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:p=!0}=hi(e,t),h={x:n,y:r},m=dl(o),g=_E(m);let b=h[m],y=h[g];const x=hi(c,t),C=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const _=m==="y"?"height":"width",I=s.reference[m]-s.floating[_]+C.mainAxis,P=s.reference[m]+s.reference[_]-C.mainAxis;bP&&(b=P)}if(p){var S,j;const _=m==="y"?"width":"height",I=["top","left"].includes(Zs(o)),P=s.reference[g]-s.floating[_]+(I&&((S=i.offset)==null?void 0:S[g])||0)+(I?0:C.crossAxis),M=s.reference[g]+s.reference[_]+(I?0:((j=i.offset)==null?void 0:j[g])||0)-(I?C.crossAxis:0);yM&&(y=M)}return{[m]:b,[g]:y}}}},vX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=hi(e,t),d=await By(t,c),p=Zs(n),h=Fu(n),m=dl(n)==="x",{width:g,height:b}=r.floating;let y,x;p==="top"||p==="bottom"?(y=p,x=h===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=p,y=h==="end"?"top":"bottom");const C=b-d[y],S=g-d[x],j=!t.middlewareData.shift;let _=C,I=S;if(m){const M=g-d.left-d.right;I=h||j?rl(S,M):M}else{const M=b-d.top-d.bottom;_=h||j?rl(C,M):M}if(j&&!h){const M=xa(d.left,0),R=xa(d.right,0),A=xa(d.top,0),D=xa(d.bottom,0);m?I=g-2*(M!==0||R!==0?M+R:xa(d.left,d.right)):_=b-2*(A!==0||D!==0?A+D:xa(d.top,d.bottom))}await i({...t,availableWidth:I,availableHeight:_});const P=await o.getDimensions(s.floating);return g!==P.width||b!==P.height?{reset:{rects:!0}}:{}}}};function ss(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ra(e){return ss(e).getComputedStyle(e)}function IE(e){return e instanceof ss(e).Node}function ol(e){return IE(e)?(e.nodeName||"").toLowerCase():"#document"}function ra(e){return e instanceof HTMLElement||e instanceof ss(e).HTMLElement}function I4(e){return typeof ShadowRoot<"u"&&(e instanceof ss(e).ShadowRoot||e instanceof ShadowRoot)}function ef(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ra(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function bX(e){return["table","td","th"].includes(ol(e))}function zb(e){const t=Hy(),n=Ra(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Hy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function qg(e){return["html","body","#document"].includes(ol(e))}const Fb=Math.min,iu=Math.max,wm=Math.round,Zp=Math.floor,sl=e=>({x:e,y:e});function PE(e){const t=Ra(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ra(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=wm(n)!==s||wm(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function ai(e){return e instanceof Element||e instanceof ss(e).Element}function Wy(e){return ai(e)?e:e.contextElement}function lu(e){const t=Wy(e);if(!ra(t))return sl(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=PE(t);let i=(s?wm(n.width):n.width)/r,c=(s?wm(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),c&&Number.isFinite(c)||(c=1),{x:i,y:c}}const xX=sl(0);function EE(e){const t=ss(e);return Hy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:xX}function Kl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wy(e);let i=sl(1);t&&(r?ai(r)&&(i=lu(r)):i=lu(e));const c=function(g,b,y){return b===void 0&&(b=!1),!(!y||b&&y!==ss(g))&&b}(s,n,r)?EE(s):sl(0);let d=(o.left+c.x)/i.x,p=(o.top+c.y)/i.y,h=o.width/i.x,m=o.height/i.y;if(s){const g=ss(s),b=r&&ai(r)?ss(r):r;let y=g.frameElement;for(;y&&r&&b!==g;){const x=lu(y),C=y.getBoundingClientRect(),S=getComputedStyle(y),j=C.left+(y.clientLeft+parseFloat(S.paddingLeft))*x.x,_=C.top+(y.clientTop+parseFloat(S.paddingTop))*x.y;d*=x.x,p*=x.y,h*=x.x,m*=x.y,d+=j,p+=_,y=ss(y).frameElement}}return wu({width:h,height:m,x:d,y:p})}function Kg(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ii(e){var t;return(t=(IE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ME(e){return Kl(ii(e)).left+Kg(e).scrollLeft}function Su(e){if(ol(e)==="html")return e;const t=e.assignedSlot||e.parentNode||I4(e)&&e.host||ii(e);return I4(t)?t.host:t}function OE(e){const t=Su(e);return qg(t)?e.ownerDocument?e.ownerDocument.body:e.body:ra(t)&&ef(t)?t:OE(t)}function Sm(e,t){var n;t===void 0&&(t=[]);const r=OE(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=ss(r);return o?t.concat(s,s.visualViewport||[],ef(r)?r:[]):t.concat(r,Sm(r))}function P4(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=ss(o),c=ii(o),d=i.visualViewport;let p=c.clientWidth,h=c.clientHeight,m=0,g=0;if(d){p=d.width,h=d.height;const b=Hy();(!b||b&&s==="fixed")&&(m=d.offsetLeft,g=d.offsetTop)}return{width:p,height:h,x:m,y:g}}(e,n);else if(t==="document")r=function(o){const s=ii(o),i=Kg(o),c=o.ownerDocument.body,d=iu(s.scrollWidth,s.clientWidth,c.scrollWidth,c.clientWidth),p=iu(s.scrollHeight,s.clientHeight,c.scrollHeight,c.clientHeight);let h=-i.scrollLeft+ME(o);const m=-i.scrollTop;return Ra(c).direction==="rtl"&&(h+=iu(s.clientWidth,c.clientWidth)-d),{width:d,height:p,x:h,y:m}}(ii(e));else if(ai(t))r=function(o,s){const i=Kl(o,!0,s==="fixed"),c=i.top+o.clientTop,d=i.left+o.clientLeft,p=ra(o)?lu(o):sl(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:d*p.x,y:c*p.y}}(t,n);else{const o=EE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return wu(r)}function RE(e,t){const n=Su(e);return!(n===t||!ai(n)||qg(n))&&(Ra(n).position==="fixed"||RE(n,t))}function yX(e,t,n){const r=ra(t),o=ii(t),s=n==="fixed",i=Kl(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=sl(0);if(r||!r&&!s)if((ol(t)!=="body"||ef(o))&&(c=Kg(t)),ra(t)){const p=Kl(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&(d.x=ME(o));return{x:i.left+c.scrollLeft-d.x,y:i.top+c.scrollTop-d.y,width:i.width,height:i.height}}function E4(e,t){return ra(e)&&Ra(e).position!=="fixed"?t?t(e):e.offsetParent:null}function M4(e,t){const n=ss(e);if(!ra(e))return n;let r=E4(e,t);for(;r&&bX(r)&&Ra(r).position==="static";)r=E4(r,t);return r&&(ol(r)==="html"||ol(r)==="body"&&Ra(r).position==="static"&&!zb(r))?n:r||function(o){let s=Su(o);for(;ra(s)&&!qg(s);){if(zb(s))return s;s=Su(s)}return null}(e)||n}const CX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=ra(n),s=ii(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},c=sl(1);const d=sl(0);if((o||!o&&r!=="fixed")&&((ol(n)!=="body"||ef(s))&&(i=Kg(n)),ra(n))){const p=Kl(n);c=lu(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-i.scrollLeft*c.x+d.x,y:t.y*c.y-i.scrollTop*c.y+d.y}},getDocumentElement:ii,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(d,p){const h=p.get(d);if(h)return h;let m=Sm(d).filter(x=>ai(x)&&ol(x)!=="body"),g=null;const b=Ra(d).position==="fixed";let y=b?Su(d):d;for(;ai(y)&&!qg(y);){const x=Ra(y),C=zb(y);C||x.position!=="fixed"||(g=null),(b?!C&&!g:!C&&x.position==="static"&&g&&["absolute","fixed"].includes(g.position)||ef(y)&&!C&&RE(d,y))?m=m.filter(S=>S!==y):g=x,y=Su(y)}return p.set(d,m),m}(t,this._c):[].concat(n),r],i=s[0],c=s.reduce((d,p)=>{const h=P4(t,p,o);return d.top=iu(h.top,d.top),d.right=Fb(h.right,d.right),d.bottom=Fb(h.bottom,d.bottom),d.left=iu(h.left,d.left),d},P4(t,i,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:M4,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||M4,s=this.getDimensions;return{reference:yX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return PE(e)},getScale:lu,isElement:ai,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function wX(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,p=Wy(e),h=o||s?[...p?Sm(p):[],...Sm(t)]:[];h.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const m=p&&c?function(C,S){let j,_=null;const I=ii(C);function P(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(R,A){R===void 0&&(R=!1),A===void 0&&(A=1),P();const{left:D,top:O,width:T,height:Y}=C.getBoundingClientRect();if(R||S(),!T||!Y)return;const z={rootMargin:-Zp(O)+"px "+-Zp(I.clientWidth-(D+T))+"px "+-Zp(I.clientHeight-(O+Y))+"px "+-Zp(D)+"px",threshold:iu(0,Fb(1,A))||1};let W=!0;function Q(U){const L=U[0].intersectionRatio;if(L!==A){if(!W)return M();L?M(!1,L):j=setTimeout(()=>{M(!1,1e-7)},100)}W=!1}try{_=new IntersectionObserver(Q,{...z,root:I.ownerDocument})}catch{_=new IntersectionObserver(Q,z)}_.observe(C)}(!0),P}(p,n):null;let g,b=-1,y=null;i&&(y=new ResizeObserver(C=>{let[S]=C;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!d&&y.observe(p),y.observe(t));let x=d?Kl(e):null;return d&&function C(){const S=Kl(e);!x||S.x===x.x&&S.y===x.y&&S.width===x.width&&S.height===x.height||n(),x=S,g=requestAnimationFrame(C)}(),n(),()=>{h.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),m&&m(),y&&y.disconnect(),y=null,d&&cancelAnimationFrame(g)}}const SX=(e,t,n)=>{const r=new Map,o={platform:CX,...n},s={...o.platform,_c:r};return iX(e,t,{...o,platform:s})},kX=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?j4({element:t.current,padding:n}).fn(o):{}:t?j4({element:t,padding:n}).fn(o):{}}}};var Rh=typeof document<"u"?l.useLayoutEffect:l.useEffect;function km(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,o;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(!km(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!km(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function O4(e){const t=l.useRef(e);return Rh(()=>{t.current=e}),t}function jX(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[c,d]=l.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=l.useState(r);km(p,r)||h(r);const m=l.useRef(null),g=l.useRef(null),b=l.useRef(c),y=O4(s),x=O4(o),[C,S]=l.useState(null),[j,_]=l.useState(null),I=l.useCallback(O=>{m.current!==O&&(m.current=O,S(O))},[]),P=l.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=l.useCallback(()=>{if(!m.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};x.current&&(O.platform=x.current),SX(m.current,g.current,O).then(T=>{const Y={...T,isPositioned:!0};R.current&&!km(b.current,Y)&&(b.current=Y,rs.flushSync(()=>{d(Y)}))})},[p,t,n,x]);Rh(()=>{i===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[i]);const R=l.useRef(!1);Rh(()=>(R.current=!0,()=>{R.current=!1}),[]),Rh(()=>{if(C&&j){if(y.current)return y.current(C,j,M);M()}},[C,j,M,y]);const A=l.useMemo(()=>({reference:m,floating:g,setReference:I,setFloating:P}),[I,P]),D=l.useMemo(()=>({reference:C,floating:j}),[C,j]);return l.useMemo(()=>({...c,update:M,refs:A,elements:D,reference:I,floating:P}),[c,M,A,D,I,P])}var _X=typeof document<"u"?l.useLayoutEffect:l.useEffect;function IX(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const PX=l.createContext(null),EX=()=>l.useContext(PX);function MX(e){return(e==null?void 0:e.ownerDocument)||document}function OX(e){return MX(e).defaultView||window}function eh(e){return e?e instanceof OX(e).Element:!1}const RX=yx["useInsertionEffect".toString()],AX=RX||(e=>e());function DX(e){const t=l.useRef(()=>{});return AX(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;oIX())[0],[p,h]=l.useState(null),m=l.useCallback(S=>{const j=eh(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=l.useCallback(S=>{(eh(S)||S===null)&&(i.current=S,h(S)),(eh(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!eh(S))&&o.refs.setReference(S)},[o.refs]),b=l.useMemo(()=>({...o.refs,setReference:g,setPositionReference:m,domReference:i}),[o.refs,g,m]),y=l.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),x=DX(n),C=l.useMemo(()=>({...o,refs:b,elements:y,dataRef:c,nodeId:r,events:d,open:t,onOpenChange:x}),[o,r,d,t,x,b,y]);return _X(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=C)}),l.useMemo(()=>({...o,context:C,refs:b,reference:g,positionReference:m}),[o,b,C,g,m])}function NX({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=l.useState(0);l.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return wX(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Js(()=>{t.update()},r),Js(()=>{s(i=>i+1)},[e])}function $X(e){const t=[hX(e.offset)];return e.middlewares.shift&&t.push(mX({limiter:gX()})),e.middlewares.flip&&t.push(fX()),e.middlewares.inline&&t.push(pX()),t.push(kX({element:e.arrowRef,padding:e.arrowOffset})),t}function LX(e){const[t,n]=Zd({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,c;t?((i=e.onClose)==null||i.call(e),n(!1)):((c=e.onOpen)==null||c.call(e),n(!0))},s=TX({placement:e.position,middleware:[...$X(e),...e.width==="target"?[vX({apply({rects:i}){var c,d;Object.assign((d=(c=s.refs.floating.current)==null?void 0:c.style)!=null?d:{},{width:`${i.reference.width}px`})}})]:[]]});return NX({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Js(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Js(()=>{var i,c;e.opened?(c=e.onOpen)==null||c.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const AE={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[zX,DE]=_G(AE.context);var FX=Object.defineProperty,BX=Object.defineProperties,HX=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,TE=Object.prototype.hasOwnProperty,NE=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?FX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,th=(e,t)=>{for(var n in t||(t={}))TE.call(t,n)&&R4(e,n,t[n]);if(jm)for(var n of jm(t))NE.call(t,n)&&R4(e,n,t[n]);return e},WX=(e,t)=>BX(e,HX(t)),VX=(e,t)=>{var n={};for(var r in e)TE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&NE.call(e,r)&&(n[r]=e[r]);return n};const UX={refProp:"ref",popupType:"dialog"},$E=l.forwardRef((e,t)=>{const n=Nr("PopoverTarget",UX,e),{children:r,refProp:o,popupType:s}=n,i=VX(n,["children","refProp","popupType"]);if(!d6(r))throw new Error(AE.children);const c=i,d=DE(),p=zf(d.reference,r.ref,t),h=d.withRoles?{"aria-haspopup":s,"aria-expanded":d.opened,"aria-controls":d.getDropdownId(),id:d.getTargetId()}:{};return l.cloneElement(r,th(WX(th(th(th({},c),h),d.targetProps),{className:p6(d.targetProps.className,c.className,r.props.className),[o]:p}),d.controlled?null:{onClick:d.onToggle}))});$E.displayName="@mantine/core/PopoverTarget";var GX=Co((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const qX=GX;var KX=Object.defineProperty,A4=Object.getOwnPropertySymbols,QX=Object.prototype.hasOwnProperty,XX=Object.prototype.propertyIsEnumerable,D4=(e,t,n)=>t in e?KX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mc=(e,t)=>{for(var n in t||(t={}))QX.call(t,n)&&D4(e,n,t[n]);if(A4)for(var n of A4(t))XX.call(t,n)&&D4(e,n,t[n]);return e};const T4={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function YX({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in qp?Mc(Mc(Mc({transitionProperty:qp[e].transitionProperty},o),qp[e].common),qp[e][T4[t]]):null:Mc(Mc(Mc({transitionProperty:e.transitionProperty},o),e.common),e[T4[t]])}function JX({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:c}){const d=ki(),p=y6(),h=d.respectReducedMotion?p:!1,[m,g]=l.useState(h?0:e),[b,y]=l.useState(r?"entered":"exited"),x=l.useRef(-1),C=S=>{const j=S?o:s,_=S?i:c;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(x.current);const I=h?0:S?e:t;if(g(I),I===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const P=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);x.current=window.setTimeout(()=>{window.clearTimeout(P),typeof _=="function"&&_(),y(S?"entered":"exited")},I)}};return Js(()=>{C(r)},[r]),l.useEffect(()=>()=>window.clearTimeout(x.current),[]),{transitionDuration:m,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function LE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h}){const{transitionDuration:m,transitionStatus:g,transitionTimingFunction:b}=JX({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:c,onEntered:d,onEnter:p,onExited:h});return m===0?o?B.createElement(B.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:B.createElement(B.Fragment,null,s(YX({transition:t,duration:m,state:g,timingFunction:b})))}LE.displayName="@mantine/core/Transition";function zE({children:e,active:t=!0,refProp:n="ref"}){const r=aq(t),o=zf(r,e==null?void 0:e.ref);return d6(e)?l.cloneElement(e,{[n]:o}):e}zE.displayName="@mantine/core/FocusTrap";var ZX=Object.defineProperty,eY=Object.defineProperties,tY=Object.getOwnPropertyDescriptors,N4=Object.getOwnPropertySymbols,nY=Object.prototype.hasOwnProperty,rY=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?ZX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t)=>{for(var n in t||(t={}))nY.call(t,n)&&$4(e,n,t[n]);if(N4)for(var n of N4(t))rY.call(t,n)&&$4(e,n,t[n]);return e},nh=(e,t)=>eY(e,tY(t));function L4(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function z4(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const oY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function sY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:c}){const[d,p="center"]=e.split("-"),h={width:Ge(t),height:Ge(t),transform:"rotate(45deg)",position:"absolute",[oY[d]]:Ge(r)},m=Ge(-t/2);return d==="left"?nh(Li(Li({},h),L4(p,i,n,o)),{right:m,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?nh(Li(Li({},h),L4(p,i,n,o)),{left:m,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?nh(Li(Li({},h),z4(p,s,n,o,c)),{bottom:m,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?nh(Li(Li({},h),z4(p,s,n,o,c)),{top:m,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var aY=Object.defineProperty,iY=Object.defineProperties,lY=Object.getOwnPropertyDescriptors,_m=Object.getOwnPropertySymbols,FE=Object.prototype.hasOwnProperty,BE=Object.prototype.propertyIsEnumerable,F4=(e,t,n)=>t in e?aY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cY=(e,t)=>{for(var n in t||(t={}))FE.call(t,n)&&F4(e,n,t[n]);if(_m)for(var n of _m(t))BE.call(t,n)&&F4(e,n,t[n]);return e},uY=(e,t)=>iY(e,lY(t)),dY=(e,t)=>{var n={};for(var r in e)FE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_m)for(var r of _m(e))t.indexOf(r)<0&&BE.call(e,r)&&(n[r]=e[r]);return n};const HE=l.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,visible:d,arrowX:p,arrowY:h}=n,m=dY(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=ki();return d?B.createElement("div",uY(cY({},m),{ref:t,style:sY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:c,dir:g.dir,arrowX:p,arrowY:h})})):null});HE.displayName="@mantine/core/FloatingArrow";var fY=Object.defineProperty,pY=Object.defineProperties,hY=Object.getOwnPropertyDescriptors,Im=Object.getOwnPropertySymbols,WE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?fY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t)=>{for(var n in t||(t={}))WE.call(t,n)&&B4(e,n,t[n]);if(Im)for(var n of Im(t))VE.call(t,n)&&B4(e,n,t[n]);return e},rh=(e,t)=>pY(e,hY(t)),mY=(e,t)=>{var n={};for(var r in e)WE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Im)for(var r of Im(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};const gY={};function UE(e){var t;const n=Nr("PopoverDropdown",gY,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,c=mY(n,["style","className","children","onKeyDownCapture"]),d=DE(),{classes:p,cx:h}=qX({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),m=ZG({opened:d.opened,shouldReturnFocus:d.returnFocus}),g=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:B.createElement(U6,rh(Oc({},d.portalProps),{withinPortal:d.withinPortal}),B.createElement(LE,rh(Oc({mounted:d.opened},d.transitionProps),{transition:d.transitionProps.transition||"fade",duration:(t=d.transitionProps.duration)!=null?t:150,keepMounted:d.keepMounted,exitDuration:typeof d.transitionProps.exitDuration=="number"?d.transitionProps.exitDuration:d.transitionProps.duration}),b=>{var y,x;return B.createElement(zE,{active:d.trapFocus},B.createElement(Go,Oc(rh(Oc({},g),{tabIndex:-1,ref:d.floating,style:rh(Oc(Oc({},r),b),{zIndex:d.zIndex,top:(y=d.y)!=null?y:0,left:(x=d.x)!=null?x:0,width:d.width==="target"?void 0:Ge(d.width)}),className:h(p.dropdown,o),onKeyDownCapture:PG(d.onClose,{active:d.closeOnEscape,onTrigger:m,onKeyDown:i}),"data-position":d.placement}),c),s,B.createElement(HE,{ref:d.arrowRef,arrowX:d.arrowX,arrowY:d.arrowY,visible:d.withArrow,position:d.placement,arrowSize:d.arrowSize,arrowRadius:d.arrowRadius,arrowOffset:d.arrowOffset,arrowPosition:d.arrowPosition,className:p.arrow})))}))}UE.displayName="@mantine/core/PopoverDropdown";function vY(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var H4=Object.getOwnPropertySymbols,bY=Object.prototype.hasOwnProperty,xY=Object.prototype.propertyIsEnumerable,yY=(e,t)=>{var n={};for(var r in e)bY.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&H4)for(var r of H4(e))t.indexOf(r)<0&&xY.call(e,r)&&(n[r]=e[r]);return n};const CY={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Ay("popover"),__staticSelector:"Popover",width:"max-content"};function Bu(e){var t,n,r,o,s,i;const c=l.useRef(null),d=Nr("Popover",CY,e),{children:p,position:h,offset:m,onPositionChange:g,positionDependencies:b,opened:y,transitionProps:x,width:C,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:I,arrowRadius:P,arrowPosition:M,unstyled:R,classNames:A,styles:D,closeOnClickOutside:O,withinPortal:T,portalProps:Y,closeOnEscape:z,clickOutsideEvents:W,trapFocus:Q,onClose:U,onOpen:L,onChange:ee,zIndex:K,radius:Z,shadow:se,id:fe,defaultOpened:G,__staticSelector:te,withRoles:V,disabled:F,returnFocus:X,variant:ue,keepMounted:q}=d,ne=yY(d,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[pe,le]=l.useState(null),[we,ve]=l.useState(null),he=Ty(fe),Ne=ki(),De=LX({middlewares:S,width:C,position:vY(Ne.dir,h),offset:typeof m=="number"?m+(j?_/2:0):m,arrowRef:c,arrowOffset:I,onPositionChange:g,positionDependencies:b,opened:y,defaultOpened:G,onChange:ee,onOpen:L,onClose:U});QG(()=>De.opened&&O&&De.onClose(),W,[pe,we]);const qe=l.useCallback(ot=>{le(ot),De.floating.reference(ot)},[De.floating.reference]),Mt=l.useCallback(ot=>{ve(ot),De.floating.floating(ot)},[De.floating.floating]);return B.createElement(zX,{value:{returnFocus:X,disabled:F,controlled:De.controlled,reference:qe,floating:Mt,x:De.floating.x,y:De.floating.y,arrowX:(r=(n=(t=De.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=De.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:De.opened,arrowRef:c,transitionProps:x,width:C,withArrow:j,arrowSize:_,arrowOffset:I,arrowRadius:P,arrowPosition:M,placement:De.floating.placement,trapFocus:Q,withinPortal:T,portalProps:Y,zIndex:K,radius:Z,shadow:se,closeOnEscape:z,onClose:De.onClose,onToggle:De.onToggle,getTargetId:()=>`${he}-target`,getDropdownId:()=>`${he}-dropdown`,withRoles:V,targetProps:ne,__staticSelector:te,classNames:A,styles:D,unstyled:R,variant:ue,keepMounted:q}},p)}Bu.Target=$E;Bu.Dropdown=UE;Bu.displayName="@mantine/core/Popover";var wY=Object.defineProperty,Pm=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?wY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SY=(e,t)=>{for(var n in t||(t={}))GE.call(t,n)&&W4(e,n,t[n]);if(Pm)for(var n of Pm(t))qE.call(t,n)&&W4(e,n,t[n]);return e},kY=(e,t)=>{var n={};for(var r in e)GE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pm)for(var r of Pm(e))t.indexOf(r)<0&&qE.call(e,r)&&(n[r]=e[r]);return n};function jY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:c,__staticSelector:d,styles:p,classNames:h,unstyled:m}=t,g=kY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=aX(null,{name:d,styles:p,classNames:h,unstyled:m});return B.createElement(Bu.Dropdown,SY({p:0,onMouseDown:y=>y.preventDefault()},g),B.createElement("div",{style:{maxHeight:Ge(o),display:"flex"}},B.createElement(Go,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==Gg?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:c},B.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function Qi({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:c,switchDirectionOnFlip:d,zIndex:p,dropdownPosition:h,positionDependencies:m=[],classNames:g,styles:b,unstyled:y,readOnly:x,variant:C}){return B.createElement(Bu,{unstyled:y,classNames:g,styles:b,width:"target",withRoles:!1,opened:e,middlewares:{flip:h==="flip",shift:!1},position:h==="flip"?"bottom":h,positionDependencies:m,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:x,onPositionChange:S=>d&&(c==null?void 0:c(S==="top"?"column-reverse":"column")),variant:C},s)}Qi.Target=Bu.Target;Qi.Dropdown=jY;var _Y=Object.defineProperty,IY=Object.defineProperties,PY=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,QE=Object.prototype.propertyIsEnumerable,V4=(e,t,n)=>t in e?_Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oh=(e,t)=>{for(var n in t||(t={}))KE.call(t,n)&&V4(e,n,t[n]);if(Em)for(var n of Em(t))QE.call(t,n)&&V4(e,n,t[n]);return e},EY=(e,t)=>IY(e,PY(t)),MY=(e,t)=>{var n={};for(var r in e)KE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&QE.call(e,r)&&(n[r]=e[r]);return n};function XE(e,t,n){const r=Nr(e,t,n),{label:o,description:s,error:i,required:c,classNames:d,styles:p,className:h,unstyled:m,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:C,wrapperProps:S,id:j,size:_,style:I,inputContainer:P,inputWrapperOrder:M,withAsterisk:R,variant:A}=r,D=MY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=Ty(j),{systemStyles:T,rest:Y}=Hg(D),z=oh({label:o,description:s,error:i,required:c,classNames:d,className:h,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:C,unstyled:m,styles:p,id:O,size:_,style:I,inputContainer:P,inputWrapperOrder:M,withAsterisk:R,variant:A},S);return EY(oh({},Y),{classNames:d,styles:p,unstyled:m,wrapperProps:oh(oh({},z),T),inputProps:{required:c,classNames:d,styles:p,unstyled:m,id:O,size:_,__staticSelector:g,error:i,variant:A}})}var OY=Co((e,t,{size:n})=>({label:{display:"inline-block",fontSize:Xt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const RY=OY;var AY=Object.defineProperty,Mm=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?AY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DY=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&U4(e,n,t[n]);if(Mm)for(var n of Mm(t))JE.call(t,n)&&U4(e,n,t[n]);return e},TY=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mm)for(var r of Mm(e))t.indexOf(r)<0&&JE.call(e,r)&&(n[r]=e[r]);return n};const NY={labelElement:"label",size:"sm"},Vy=l.forwardRef((e,t)=>{const n=Nr("InputLabel",NY,e),{labelElement:r,children:o,required:s,size:i,classNames:c,styles:d,unstyled:p,className:h,htmlFor:m,__staticSelector:g,variant:b,onMouseDown:y}=n,x=TY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:C,cx:S}=RY(null,{name:["InputWrapper",g],classNames:c,styles:d,unstyled:p,variant:b,size:i});return B.createElement(Go,DY({component:r,ref:t,className:S(C.label,h),htmlFor:r==="label"?m:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},x),o,s&&B.createElement("span",{className:C.required,"aria-hidden":!0}," *"))});Vy.displayName="@mantine/core/InputLabel";var $Y=Co((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${Ge(2)})`,lineHeight:1.2,display:"block"}}));const LY=$Y;var zY=Object.defineProperty,Om=Object.getOwnPropertySymbols,ZE=Object.prototype.hasOwnProperty,eM=Object.prototype.propertyIsEnumerable,G4=(e,t,n)=>t in e?zY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FY=(e,t)=>{for(var n in t||(t={}))ZE.call(t,n)&&G4(e,n,t[n]);if(Om)for(var n of Om(t))eM.call(t,n)&&G4(e,n,t[n]);return e},BY=(e,t)=>{var n={};for(var r in e)ZE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Om)for(var r of Om(e))t.indexOf(r)<0&&eM.call(e,r)&&(n[r]=e[r]);return n};const HY={size:"sm"},Uy=l.forwardRef((e,t)=>{const n=Nr("InputError",HY,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=BY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=LY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return B.createElement(yu,FY({className:b(g.error,o),ref:t},m),r)});Uy.displayName="@mantine/core/InputError";var WY=Co((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${Ge(2)})`,lineHeight:1.2,display:"block"}}));const VY=WY;var UY=Object.defineProperty,Rm=Object.getOwnPropertySymbols,tM=Object.prototype.hasOwnProperty,nM=Object.prototype.propertyIsEnumerable,q4=(e,t,n)=>t in e?UY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,GY=(e,t)=>{for(var n in t||(t={}))tM.call(t,n)&&q4(e,n,t[n]);if(Rm)for(var n of Rm(t))nM.call(t,n)&&q4(e,n,t[n]);return e},qY=(e,t)=>{var n={};for(var r in e)tM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rm)for(var r of Rm(e))t.indexOf(r)<0&&nM.call(e,r)&&(n[r]=e[r]);return n};const KY={size:"sm"},Gy=l.forwardRef((e,t)=>{const n=Nr("InputDescription",KY,e),{children:r,className:o,classNames:s,styles:i,unstyled:c,size:d,__staticSelector:p,variant:h}=n,m=qY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=VY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:c,variant:h,size:d});return B.createElement(yu,GY({color:"dimmed",className:b(g.description,o),ref:t,unstyled:c},m),r)});Gy.displayName="@mantine/core/InputDescription";const rM=l.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),QY=rM.Provider,XY=()=>l.useContext(rM);function YY(e,{hasDescription:t,hasError:n}){const r=e.findIndex(d=>d==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var JY=Object.defineProperty,ZY=Object.defineProperties,eJ=Object.getOwnPropertyDescriptors,K4=Object.getOwnPropertySymbols,tJ=Object.prototype.hasOwnProperty,nJ=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?JY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rJ=(e,t)=>{for(var n in t||(t={}))tJ.call(t,n)&&Q4(e,n,t[n]);if(K4)for(var n of K4(t))nJ.call(t,n)&&Q4(e,n,t[n]);return e},oJ=(e,t)=>ZY(e,eJ(t)),sJ=Co(e=>({root:oJ(rJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const aJ=sJ;var iJ=Object.defineProperty,lJ=Object.defineProperties,cJ=Object.getOwnPropertyDescriptors,Am=Object.getOwnPropertySymbols,oM=Object.prototype.hasOwnProperty,sM=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?iJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t)=>{for(var n in t||(t={}))oM.call(t,n)&&X4(e,n,t[n]);if(Am)for(var n of Am(t))sM.call(t,n)&&X4(e,n,t[n]);return e},Y4=(e,t)=>lJ(e,cJ(t)),uJ=(e,t)=>{var n={};for(var r in e)oM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&sM.call(e,r)&&(n[r]=e[r]);return n};const dJ={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},aM=l.forwardRef((e,t)=>{const n=Nr("InputWrapper",dJ,e),{className:r,label:o,children:s,required:i,id:c,error:d,description:p,labelElement:h,labelProps:m,descriptionProps:g,errorProps:b,classNames:y,styles:x,size:C,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:I,withAsterisk:P,variant:M}=n,R=uJ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:A,cx:D}=aJ(null,{classNames:y,styles:x,name:["InputWrapper",j],unstyled:_,variant:M,size:C}),O={classNames:y,styles:x,unstyled:_,size:C,variant:M,__staticSelector:j},T=typeof P=="boolean"?P:i,Y=c?`${c}-error`:b==null?void 0:b.id,z=c?`${c}-description`:g==null?void 0:g.id,Q=`${!!d&&typeof d!="boolean"?Y:""} ${p?z:""}`,U=Q.trim().length>0?Q.trim():void 0,L=o&&B.createElement(Vy,zi(zi({key:"label",labelElement:h,id:c?`${c}-label`:void 0,htmlFor:c,required:T},O),m),o),ee=p&&B.createElement(Gy,Y4(zi(zi({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||z}),p),K=B.createElement(l.Fragment,{key:"input"},S(s)),Z=typeof d!="boolean"&&d&&B.createElement(Uy,Y4(zi(zi({},b),O),{size:(b==null?void 0:b.size)||O.size,key:"error",id:(b==null?void 0:b.id)||Y}),d),se=I.map(fe=>{switch(fe){case"label":return L;case"input":return K;case"description":return ee;case"error":return Z;default:return null}});return B.createElement(QY,{value:zi({describedBy:U},YY(I,{hasDescription:!!ee,hasError:!!Z}))},B.createElement(Go,zi({className:D(A.root,r),ref:t},R),se))});aM.displayName="@mantine/core/InputWrapper";var fJ=Object.defineProperty,Dm=Object.getOwnPropertySymbols,iM=Object.prototype.hasOwnProperty,lM=Object.prototype.propertyIsEnumerable,J4=(e,t,n)=>t in e?fJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pJ=(e,t)=>{for(var n in t||(t={}))iM.call(t,n)&&J4(e,n,t[n]);if(Dm)for(var n of Dm(t))lM.call(t,n)&&J4(e,n,t[n]);return e},hJ=(e,t)=>{var n={};for(var r in e)iM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dm)for(var r of Dm(e))t.indexOf(r)<0&&lM.call(e,r)&&(n[r]=e[r]);return n};const mJ={},cM=l.forwardRef((e,t)=>{const n=Nr("InputPlaceholder",mJ,e),{sx:r}=n,o=hJ(n,["sx"]);return B.createElement(Go,pJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...c6(r)],ref:t},o))});cM.displayName="@mantine/core/InputPlaceholder";var gJ=Object.defineProperty,vJ=Object.defineProperties,bJ=Object.getOwnPropertyDescriptors,Z4=Object.getOwnPropertySymbols,xJ=Object.prototype.hasOwnProperty,yJ=Object.prototype.propertyIsEnumerable,ej=(e,t,n)=>t in e?gJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sh=(e,t)=>{for(var n in t||(t={}))xJ.call(t,n)&&ej(e,n,t[n]);if(Z4)for(var n of Z4(t))yJ.call(t,n)&&ej(e,n,t[n]);return e},a1=(e,t)=>vJ(e,bJ(t));const bs={xs:Ge(30),sm:Ge(36),md:Ge(42),lg:Ge(50),xl:Ge(60)},CJ=["default","filled","unstyled"];function wJ({theme:e,variant:t}){return CJ.includes(t)?t==="default"?{border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Ge(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Ge(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var SJ=Co((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:c,offsetTop:d,pointer:p},{variant:h,size:m})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,b=h==="default"||h==="filled"?{minHeight:Xt({size:m,sizes:bs}),paddingLeft:`calc(${Xt({size:m,sizes:bs})} / 3)`,paddingRight:s?o||Xt({size:m,sizes:bs}):`calc(${Xt({size:m,sizes:bs})} / 3)`,borderRadius:e.fn.radius(n)}:h==="unstyled"&&s?{paddingRight:o||Xt({size:m,sizes:bs})}:null;return{wrapper:{position:"relative",marginTop:d?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:c?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:a1(sh(sh(a1(sh({},e.fn.fontStyles()),{height:t?h==="unstyled"?void 0:"auto":Xt({size:m,sizes:bs}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Xt({size:m,sizes:bs})} - ${Ge(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Xt({size:m,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),wJ({theme:e,variant:h})),b),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Ge(i):Xt({size:m,sizes:bs})},"&::placeholder":a1(sh({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Ge(i):Xt({size:m,sizes:bs}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||Xt({size:m,sizes:bs})}}});const kJ=SJ;var jJ=Object.defineProperty,_J=Object.defineProperties,IJ=Object.getOwnPropertyDescriptors,Tm=Object.getOwnPropertySymbols,uM=Object.prototype.hasOwnProperty,dM=Object.prototype.propertyIsEnumerable,tj=(e,t,n)=>t in e?jJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ah=(e,t)=>{for(var n in t||(t={}))uM.call(t,n)&&tj(e,n,t[n]);if(Tm)for(var n of Tm(t))dM.call(t,n)&&tj(e,n,t[n]);return e},nj=(e,t)=>_J(e,IJ(t)),PJ=(e,t)=>{var n={};for(var r in e)uM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&dM.call(e,r)&&(n[r]=e[r]);return n};const EJ={size:"sm",variant:"default"},oc=l.forwardRef((e,t)=>{const n=Nr("Input",EJ,e),{className:r,error:o,required:s,disabled:i,variant:c,icon:d,style:p,rightSectionWidth:h,iconWidth:m,rightSection:g,rightSectionProps:b,radius:y,size:x,wrapperProps:C,classNames:S,styles:j,__staticSelector:_,multiline:I,sx:P,unstyled:M,pointer:R}=n,A=PJ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:D,offsetTop:O,describedBy:T}=XY(),{classes:Y,cx:z}=kJ({radius:y,multiline:I,invalid:!!o,rightSectionWidth:h?Ge(h):void 0,iconWidth:m,withRightSection:!!g,offsetBottom:D,offsetTop:O,pointer:R},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:c,size:x}),{systemStyles:W,rest:Q}=Hg(A);return B.createElement(Go,ah(ah({className:z(Y.wrapper,r),sx:P,style:p},W),C),d&&B.createElement("div",{className:Y.icon},d),B.createElement(Go,nj(ah({component:"input"},Q),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:Y.input})),g&&B.createElement("div",nj(ah({},b),{className:Y.rightSection}),g))});oc.displayName="@mantine/core/Input";oc.Wrapper=aM;oc.Label=Vy;oc.Description=Gy;oc.Error=Uy;oc.Placeholder=cM;const ku=oc;var MJ=Object.defineProperty,Nm=Object.getOwnPropertySymbols,fM=Object.prototype.hasOwnProperty,pM=Object.prototype.propertyIsEnumerable,rj=(e,t,n)=>t in e?MJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oj=(e,t)=>{for(var n in t||(t={}))fM.call(t,n)&&rj(e,n,t[n]);if(Nm)for(var n of Nm(t))pM.call(t,n)&&rj(e,n,t[n]);return e},OJ=(e,t)=>{var n={};for(var r in e)fM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&pM.call(e,r)&&(n[r]=e[r]);return n};const RJ={multiple:!1},hM=l.forwardRef((e,t)=>{const n=Nr("FileButton",RJ,e),{onChange:r,children:o,multiple:s,accept:i,name:c,form:d,resetRef:p,disabled:h,capture:m,inputProps:g}=n,b=OJ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=l.useRef(),x=()=>{!h&&y.current.click()},C=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return x6(p,()=>{y.current.value=""}),B.createElement(B.Fragment,null,o(oj({onClick:x},b)),B.createElement("input",oj({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:C,ref:zf(t,y),name:c,form:d,capture:m},g)))});hM.displayName="@mantine/core/FileButton";const mM={xs:Ge(16),sm:Ge(22),md:Ge(26),lg:Ge(30),xl:Ge(36)},AJ={xs:Ge(10),sm:Ge(12),md:Ge(14),lg:Ge(16),xl:Ge(18)};var DJ=Co((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:Xt({size:o,sizes:mM}),paddingLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?Xt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:Xt({size:o,sizes:AJ}),borderRadius:Xt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Ge(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const TJ=DJ;var NJ=Object.defineProperty,$m=Object.getOwnPropertySymbols,gM=Object.prototype.hasOwnProperty,vM=Object.prototype.propertyIsEnumerable,sj=(e,t,n)=>t in e?NJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$J=(e,t)=>{for(var n in t||(t={}))gM.call(t,n)&&sj(e,n,t[n]);if($m)for(var n of $m(t))vM.call(t,n)&&sj(e,n,t[n]);return e},LJ=(e,t)=>{var n={};for(var r in e)gM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&vM.call(e,r)&&(n[r]=e[r]);return n};const zJ={xs:16,sm:22,md:24,lg:26,xl:30};function bM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:c,readOnly:d,size:p,radius:h="sm",variant:m,unstyled:g}=t,b=LJ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:x}=TJ({disabled:c,readOnly:d,radius:h},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:m});return B.createElement("div",$J({className:x(y.defaultValue,s)},b),B.createElement("span",{className:y.defaultValueLabel},n),!c&&!d&&B.createElement(J6,{"aria-hidden":!0,onMouseDown:i,size:zJ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}bM.displayName="@mantine/core/MultiSelect/DefaultValue";function FJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const d=[];for(let p=0;ph===e[p].value&&!e[p].disabled))&&d.push(e[p]);return d}const c=[];for(let d=0;dp===e[d].value&&!e[d].disabled),e[d])&&c.push(e[d]),!(c.length>=n));d+=1);return c}var BJ=Object.defineProperty,Lm=Object.getOwnPropertySymbols,xM=Object.prototype.hasOwnProperty,yM=Object.prototype.propertyIsEnumerable,aj=(e,t,n)=>t in e?BJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ij=(e,t)=>{for(var n in t||(t={}))xM.call(t,n)&&aj(e,n,t[n]);if(Lm)for(var n of Lm(t))yM.call(t,n)&&aj(e,n,t[n]);return e},HJ=(e,t)=>{var n={};for(var r in e)xM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&yM.call(e,r)&&(n[r]=e[r]);return n};const WJ={xs:Ge(14),sm:Ge(18),md:Ge(20),lg:Ge(24),xl:Ge(28)};function VJ(e){var t=e,{size:n,error:r,style:o}=t,s=HJ(t,["size","error","style"]);const i=ki(),c=Xt({size:n,sizes:WJ});return B.createElement("svg",ij({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:ij({color:r?i.colors.red[6]:i.colors.gray[6],width:c,height:c},o),"data-chevron":!0},s),B.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var UJ=Object.defineProperty,GJ=Object.defineProperties,qJ=Object.getOwnPropertyDescriptors,lj=Object.getOwnPropertySymbols,KJ=Object.prototype.hasOwnProperty,QJ=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?UJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XJ=(e,t)=>{for(var n in t||(t={}))KJ.call(t,n)&&cj(e,n,t[n]);if(lj)for(var n of lj(t))QJ.call(t,n)&&cj(e,n,t[n]);return e},YJ=(e,t)=>GJ(e,qJ(t));function CM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?B.createElement(J6,YJ(XJ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):B.createElement(VJ,{error:o,size:r})}CM.displayName="@mantine/core/SelectRightSection";var JJ=Object.defineProperty,ZJ=Object.defineProperties,eZ=Object.getOwnPropertyDescriptors,zm=Object.getOwnPropertySymbols,wM=Object.prototype.hasOwnProperty,SM=Object.prototype.propertyIsEnumerable,uj=(e,t,n)=>t in e?JJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i1=(e,t)=>{for(var n in t||(t={}))wM.call(t,n)&&uj(e,n,t[n]);if(zm)for(var n of zm(t))SM.call(t,n)&&uj(e,n,t[n]);return e},dj=(e,t)=>ZJ(e,eZ(t)),tZ=(e,t)=>{var n={};for(var r in e)wM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&SM.call(e,r)&&(n[r]=e[r]);return n};function kM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=tZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const c=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&B.createElement(CM,i1({},i)),styles:dj(i1({},c),{rightSection:dj(i1({},c==null?void 0:c.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var nZ=Object.defineProperty,rZ=Object.defineProperties,oZ=Object.getOwnPropertyDescriptors,fj=Object.getOwnPropertySymbols,sZ=Object.prototype.hasOwnProperty,aZ=Object.prototype.propertyIsEnumerable,pj=(e,t,n)=>t in e?nZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iZ=(e,t)=>{for(var n in t||(t={}))sZ.call(t,n)&&pj(e,n,t[n]);if(fj)for(var n of fj(t))aZ.call(t,n)&&pj(e,n,t[n]);return e},lZ=(e,t)=>rZ(e,oZ(t)),cZ=Co((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${Xt({size:n,sizes:bs})} - ${Ge(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Xt({size:n,sizes:bs})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Ge(2)}) calc(${e.spacing.xs} / 2)`},searchInput:lZ(iZ({},e.fn.fontStyles()),{flex:1,minWidth:Ge(60),backgroundColor:"transparent",border:0,outline:0,fontSize:Xt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:Xt({size:n,sizes:mM}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const uZ=cZ;var dZ=Object.defineProperty,fZ=Object.defineProperties,pZ=Object.getOwnPropertyDescriptors,Fm=Object.getOwnPropertySymbols,jM=Object.prototype.hasOwnProperty,_M=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?dZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))jM.call(t,n)&&hj(e,n,t[n]);if(Fm)for(var n of Fm(t))_M.call(t,n)&&hj(e,n,t[n]);return e},mj=(e,t)=>fZ(e,pZ(t)),hZ=(e,t)=>{var n={};for(var r in e)jM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&_M.call(e,r)&&(n[r]=e[r]);return n};function mZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function gZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function gj(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const vZ={size:"sm",valueComponent:bM,itemComponent:$y,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:mZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:gZ,switchDirectionOnFlip:!1,zIndex:Ay("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},IM=l.forwardRef((e,t)=>{const n=Nr("MultiSelect",vZ,e),{className:r,style:o,required:s,label:i,description:c,size:d,error:p,classNames:h,styles:m,wrapperProps:g,value:b,defaultValue:y,data:x,onChange:C,valueComponent:S,itemComponent:j,id:_,transitionProps:I,maxDropdownHeight:P,shadow:M,nothingFound:R,onFocus:A,onBlur:D,searchable:O,placeholder:T,filter:Y,limit:z,clearSearchOnChange:W,clearable:Q,clearSearchOnBlur:U,variant:L,onSearchChange:ee,searchValue:K,disabled:Z,initiallyOpened:se,radius:fe,icon:G,rightSection:te,rightSectionWidth:V,creatable:F,getCreateLabel:X,shouldCreate:ue,onCreate:q,sx:ne,dropdownComponent:pe,onDropdownClose:le,onDropdownOpen:we,maxSelectedValues:ve,withinPortal:he,portalProps:Ne,switchDirectionOnFlip:De,zIndex:qe,selectOnBlur:Mt,name:ot,dropdownPosition:an,errorProps:pt,labelProps:vt,descriptionProps:ke,form:Be,positionDependencies:Ot,onKeyDown:Ht,unstyled:je,inputContainer:ht,inputWrapperOrder:At,readOnly:_t,withAsterisk:Re,clearButtonProps:Xe,hoverOnSearchChange:_n,disableSelectedItemFiltering:Me}=n,Ze=hZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:Ye,cx:ut,theme:Ut}=uZ({invalid:!!p},{name:"MultiSelect",classNames:h,styles:m,unstyled:je,size:d,variant:L}),{systemStyles:xr,rest:yn}=Hg(Ze),hn=l.useRef(),oo=l.useRef({}),Dr=Ty(_),[nr,rr]=l.useState(se),[or,Xr]=l.useState(-1),[Xo,so]=l.useState("column"),[ao,$s]=Zd({value:K,defaultValue:"",finalValue:void 0,onChange:ee}),[Yr,ca]=l.useState(!1),{scrollIntoView:Ls,targetRef:Ua,scrollableRef:ua}=C6({duration:0,offset:5,cancelable:!1,isList:!0}),re=F&&typeof X=="function";let ie=null;const be=x.map(He=>typeof He=="string"?{label:He,value:He}:He),Pe=u6({data:be}),[xe,ft]=Zd({value:gj(b,x),defaultValue:gj(y,x),finalValue:[],onChange:C}),it=l.useRef(!!ve&&ve{if(!_t){const Ct=xe.filter(zt=>zt!==He);ft(Ct),ve&&Ct.length{$s(He.currentTarget.value),!Z&&!it.current&&O&&rr(!0)},wt=He=>{typeof A=="function"&&A(He),!Z&&!it.current&&O&&rr(!0)},We=FJ({data:Pe,searchable:O,searchValue:ao,limit:z,filter:Y,value:xe,disableSelectedItemFiltering:Me});re&&ue(ao,Pe)&&(ie=X(ao),We.push({label:ao,value:ao,creatable:!0}));const Ie=Math.min(or,We.length-1),et=(He,Ct,zt)=>{let Qt=He;for(;zt(Qt);)if(Qt=Ct(Qt),!We[Qt].disabled)return Qt;return He};Js(()=>{Xr(_n&&ao?0:-1)},[ao,_n]),Js(()=>{!Z&&xe.length>x.length&&rr(!1),ve&&xe.length=ve&&(it.current=!0,rr(!1))},[xe]);const Et=He=>{if(!_t)if(W&&$s(""),xe.includes(He.value))Kt(He.value);else{if(He.creatable&&typeof q=="function"){const Ct=q(He.value);typeof Ct<"u"&&Ct!==null&&ft(typeof Ct=="string"?[...xe,Ct]:[...xe,Ct.value])}else ft([...xe,He.value]);xe.length===ve-1&&(it.current=!0,rr(!1)),We.length===1&&rr(!1)}},Tt=He=>{typeof D=="function"&&D(He),Mt&&We[Ie]&&nr&&Et(We[Ie]),U&&$s(""),rr(!1)},Vt=He=>{if(Yr||(Ht==null||Ht(He),_t)||He.key!=="Backspace"&&ve&&it.current)return;const Ct=Xo==="column",zt=()=>{Xr(Nn=>{var Jt;const vn=et(Nn,fn=>fn+1,fn=>fn{Xr(Nn=>{var Jt;const vn=et(Nn,fn=>fn-1,fn=>fn>0);return nr&&(Ua.current=oo.current[(Jt=We[vn])==null?void 0:Jt.value],Ls({alignment:Ct?"start":"end"})),vn})};switch(He.key){case"ArrowUp":{He.preventDefault(),rr(!0),Ct?Qt():zt();break}case"ArrowDown":{He.preventDefault(),rr(!0),Ct?zt():Qt();break}case"Enter":{He.preventDefault(),We[Ie]&&nr?Et(We[Ie]):rr(!0);break}case" ":{O||(He.preventDefault(),We[Ie]&&nr?Et(We[Ie]):rr(!0));break}case"Backspace":{xe.length>0&&ao.length===0&&(ft(xe.slice(0,-1)),rr(!0),ve&&(it.current=!1));break}case"Home":{if(!O){He.preventDefault(),nr||rr(!0);const Nn=We.findIndex(Jt=>!Jt.disabled);Xr(Nn),Ls({alignment:Ct?"end":"start"})}break}case"End":{if(!O){He.preventDefault(),nr||rr(!0);const Nn=We.map(Jt=>!!Jt.disabled).lastIndexOf(!1);Xr(Nn),Ls({alignment:Ct?"end":"start"})}break}case"Escape":rr(!1)}},Zt=xe.map(He=>{let Ct=Pe.find(zt=>zt.value===He&&!zt.disabled);return!Ct&&re&&(Ct={value:He,label:He}),Ct}).filter(He=>!!He).map((He,Ct)=>B.createElement(S,mj(Rc({},He),{variant:L,disabled:Z,className:Ye.value,readOnly:_t,onRemove:zt=>{zt.preventDefault(),zt.stopPropagation(),Kt(He.value)},key:He.value,size:d,styles:m,classNames:h,radius:fe,index:Ct}))),ln=He=>xe.includes(He),sn=()=>{var He;$s(""),ft([]),(He=hn.current)==null||He.focus(),ve&&(it.current=!1)},Yt=!_t&&(We.length>0?nr:nr&&!!R);return Js(()=>{const He=Yt?we:le;typeof He=="function"&&He()},[Yt]),B.createElement(ku.Wrapper,Rc(Rc({required:s,id:Dr,label:i,error:p,description:c,size:d,className:r,style:o,classNames:h,styles:m,__staticSelector:"MultiSelect",sx:ne,errorProps:pt,descriptionProps:ke,labelProps:vt,inputContainer:ht,inputWrapperOrder:At,unstyled:je,withAsterisk:Re,variant:L},xr),g),B.createElement(Qi,{opened:Yt,transitionProps:I,shadow:"sm",withinPortal:he,portalProps:Ne,__staticSelector:"MultiSelect",onDirectionChange:so,switchDirectionOnFlip:De,zIndex:qe,dropdownPosition:an,positionDependencies:[...Ot,ao],classNames:h,styles:m,unstyled:je,variant:L},B.createElement(Qi.Target,null,B.createElement("div",{className:Ye.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":nr&&Yt?`${Dr}-items`:null,"aria-controls":Dr,"aria-expanded":nr,onMouseLeave:()=>Xr(-1),tabIndex:-1},B.createElement("input",{type:"hidden",name:ot,value:xe.join(","),form:Be,disabled:Z}),B.createElement(ku,Rc({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:L,disabled:Z,error:p,required:s,radius:fe,icon:G,unstyled:je,onMouseDown:He=>{var Ct;He.preventDefault(),!Z&&!it.current&&rr(!nr),(Ct=hn.current)==null||Ct.focus()},classNames:mj(Rc({},h),{input:ut({[Ye.input]:!O},h==null?void 0:h.input)})},kM({theme:Ut,rightSection:te,rightSectionWidth:V,styles:m,size:d,shouldClear:Q&&xe.length>0,onClear:sn,error:p,disabled:Z,clearButtonProps:Xe,readOnly:_t})),B.createElement("div",{className:Ye.values,"data-clearable":Q||void 0},Zt,B.createElement("input",Rc({ref:zf(t,hn),type:"search",id:Dr,className:ut(Ye.searchInput,{[Ye.searchInputPointer]:!O,[Ye.searchInputInputHidden]:!nr&&xe.length>0||!O&&xe.length>0,[Ye.searchInputEmpty]:xe.length===0}),onKeyDown:Vt,value:ao,onChange:mt,onFocus:wt,onBlur:Tt,readOnly:!O||it.current||_t,placeholder:xe.length===0?T:void 0,disabled:Z,"data-mantine-stop-propagation":nr,autoComplete:"off",onCompositionStart:()=>ca(!0),onCompositionEnd:()=>ca(!1)},yn)))))),B.createElement(Qi.Dropdown,{component:pe||Gg,maxHeight:P,direction:Xo,id:Dr,innerRef:ua,__staticSelector:"MultiSelect",classNames:h,styles:m},B.createElement(Ny,{data:We,hovered:Ie,classNames:h,styles:m,uuid:Dr,__staticSelector:"MultiSelect",onItemHover:Xr,onItemSelect:Et,itemsRefs:oo,itemComponent:j,size:d,nothingFound:R,isItemSelected:ln,creatable:F&&!!ie,createLabel:ie,unstyled:je,variant:L}))))});IM.displayName="@mantine/core/MultiSelect";var bZ=Object.defineProperty,xZ=Object.defineProperties,yZ=Object.getOwnPropertyDescriptors,Bm=Object.getOwnPropertySymbols,PM=Object.prototype.hasOwnProperty,EM=Object.prototype.propertyIsEnumerable,vj=(e,t,n)=>t in e?bZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l1=(e,t)=>{for(var n in t||(t={}))PM.call(t,n)&&vj(e,n,t[n]);if(Bm)for(var n of Bm(t))EM.call(t,n)&&vj(e,n,t[n]);return e},CZ=(e,t)=>xZ(e,yZ(t)),wZ=(e,t)=>{var n={};for(var r in e)PM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&EM.call(e,r)&&(n[r]=e[r]);return n};const SZ={type:"text",size:"sm",__staticSelector:"TextInput"},MM=l.forwardRef((e,t)=>{const n=XE("TextInput",SZ,e),{inputProps:r,wrapperProps:o}=n,s=wZ(n,["inputProps","wrapperProps"]);return B.createElement(ku.Wrapper,l1({},o),B.createElement(ku,CZ(l1(l1({},r),s),{ref:t})))});MM.displayName="@mantine/core/TextInput";function kZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const c=s!=null&&e.find(p=>p.value===s)||null;if(c&&!i&&(c==null?void 0:c.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(c),h=p+n,m=h-e.length;return m>0?e.slice(p-m):e.slice(p,h)}return e}const d=[];for(let p=0;p=n));p+=1);return d}var jZ=Co(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const _Z=jZ;var IZ=Object.defineProperty,PZ=Object.defineProperties,EZ=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,OM=Object.prototype.hasOwnProperty,RM=Object.prototype.propertyIsEnumerable,bj=(e,t,n)=>t in e?IZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yd=(e,t)=>{for(var n in t||(t={}))OM.call(t,n)&&bj(e,n,t[n]);if(Hm)for(var n of Hm(t))RM.call(t,n)&&bj(e,n,t[n]);return e},c1=(e,t)=>PZ(e,EZ(t)),MZ=(e,t)=>{var n={};for(var r in e)OM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&RM.call(e,r)&&(n[r]=e[r]);return n};function OZ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function RZ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const AZ={required:!1,size:"sm",shadow:"sm",itemComponent:$y,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:OZ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:RZ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Ay("popover"),positionDependencies:[],dropdownPosition:"flip"},qy=l.forwardRef((e,t)=>{const n=XE("Select",AZ,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:c,defaultValue:d,onChange:p,itemComponent:h,onKeyDown:m,onBlur:g,onFocus:b,transitionProps:y,initiallyOpened:x,unstyled:C,classNames:S,styles:j,filter:_,maxDropdownHeight:I,searchable:P,clearable:M,nothingFound:R,limit:A,disabled:D,onSearchChange:O,searchValue:T,rightSection:Y,rightSectionWidth:z,creatable:W,getCreateLabel:Q,shouldCreate:U,selectOnBlur:L,onCreate:ee,dropdownComponent:K,onDropdownClose:Z,onDropdownOpen:se,withinPortal:fe,portalProps:G,switchDirectionOnFlip:te,zIndex:V,name:F,dropdownPosition:X,allowDeselect:ue,placeholder:q,filterDataOnExactSearchMatch:ne,form:pe,positionDependencies:le,readOnly:we,clearButtonProps:ve,hoverOnSearchChange:he}=n,Ne=MZ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:De,cx:qe,theme:Mt}=_Z(),[ot,an]=l.useState(x),[pt,vt]=l.useState(-1),ke=l.useRef(),Be=l.useRef({}),[Ot,Ht]=l.useState("column"),je=Ot==="column",{scrollIntoView:ht,targetRef:At,scrollableRef:_t}=C6({duration:0,offset:5,cancelable:!1,isList:!0}),Re=ue===void 0?M:ue,Xe=ie=>{if(ot!==ie){an(ie);const be=ie?se:Z;typeof be=="function"&&be()}},_n=W&&typeof Q=="function";let Me=null;const Ze=i.map(ie=>typeof ie=="string"?{label:ie,value:ie}:ie),Ye=u6({data:Ze}),[ut,Ut,xr]=Zd({value:c,defaultValue:d,finalValue:null,onChange:p}),yn=Ye.find(ie=>ie.value===ut),[hn,oo]=Zd({value:T,defaultValue:(yn==null?void 0:yn.label)||"",finalValue:void 0,onChange:O}),Dr=ie=>{oo(ie),P&&typeof O=="function"&&O(ie)},nr=()=>{var ie;we||(Ut(null),xr||Dr(""),(ie=ke.current)==null||ie.focus())};l.useEffect(()=>{const ie=Ye.find(be=>be.value===ut);ie?Dr(ie.label):(!_n||!ut)&&Dr("")},[ut]),l.useEffect(()=>{yn&&(!P||!ot)&&Dr(yn.label)},[yn==null?void 0:yn.label]);const rr=ie=>{if(!we)if(Re&&(yn==null?void 0:yn.value)===ie.value)Ut(null),Xe(!1);else{if(ie.creatable&&typeof ee=="function"){const be=ee(ie.value);typeof be<"u"&&be!==null&&Ut(typeof be=="string"?be:be.value)}else Ut(ie.value);xr||Dr(ie.label),vt(-1),Xe(!1),ke.current.focus()}},or=kZ({data:Ye,searchable:P,limit:A,searchValue:hn,filter:_,filterDataOnExactSearchMatch:ne,value:ut});_n&&U(hn,or)&&(Me=Q(hn),or.push({label:hn,value:hn,creatable:!0}));const Xr=(ie,be,Pe)=>{let xe=ie;for(;Pe(xe);)if(xe=be(xe),!or[xe].disabled)return xe;return ie};Js(()=>{vt(he&&hn?0:-1)},[hn,he]);const Xo=ut?or.findIndex(ie=>ie.value===ut):0,so=!we&&(or.length>0?ot:ot&&!!R),ao=()=>{vt(ie=>{var be;const Pe=Xr(ie,xe=>xe-1,xe=>xe>0);return At.current=Be.current[(be=or[Pe])==null?void 0:be.value],so&&ht({alignment:je?"start":"end"}),Pe})},$s=()=>{vt(ie=>{var be;const Pe=Xr(ie,xe=>xe+1,xe=>xewindow.setTimeout(()=>{var ie;At.current=Be.current[(ie=or[Xo])==null?void 0:ie.value],ht({alignment:je?"end":"start"})},50);Js(()=>{so&&Yr()},[so]);const ca=ie=>{switch(typeof m=="function"&&m(ie),ie.key){case"ArrowUp":{ie.preventDefault(),ot?je?ao():$s():(vt(Xo),Xe(!0),Yr());break}case"ArrowDown":{ie.preventDefault(),ot?je?$s():ao():(vt(Xo),Xe(!0),Yr());break}case"Home":{if(!P){ie.preventDefault(),ot||Xe(!0);const be=or.findIndex(Pe=>!Pe.disabled);vt(be),so&&ht({alignment:je?"end":"start"})}break}case"End":{if(!P){ie.preventDefault(),ot||Xe(!0);const be=or.map(Pe=>!!Pe.disabled).lastIndexOf(!1);vt(be),so&&ht({alignment:je?"end":"start"})}break}case"Escape":{ie.preventDefault(),Xe(!1),vt(-1);break}case" ":{P||(ie.preventDefault(),or[pt]&&ot?rr(or[pt]):(Xe(!0),vt(Xo),Yr()));break}case"Enter":P||ie.preventDefault(),or[pt]&&ot&&(ie.preventDefault(),rr(or[pt]))}},Ls=ie=>{typeof g=="function"&&g(ie);const be=Ye.find(Pe=>Pe.value===ut);L&&or[pt]&&ot&&rr(or[pt]),Dr((be==null?void 0:be.label)||""),Xe(!1)},Ua=ie=>{typeof b=="function"&&b(ie),P&&Xe(!0)},ua=ie=>{we||(Dr(ie.currentTarget.value),M&&ie.currentTarget.value===""&&Ut(null),vt(-1),Xe(!0))},re=()=>{we||(Xe(!ot),ut&&!ot&&vt(Xo))};return B.createElement(ku.Wrapper,c1(yd({},o),{__staticSelector:"Select"}),B.createElement(Qi,{opened:so,transitionProps:y,shadow:s,withinPortal:fe,portalProps:G,__staticSelector:"Select",onDirectionChange:Ht,switchDirectionOnFlip:te,zIndex:V,dropdownPosition:X,positionDependencies:[...le,hn],classNames:S,styles:j,unstyled:C,variant:r.variant},B.createElement(Qi.Target,null,B.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":so?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":so,onMouseLeave:()=>vt(-1),tabIndex:-1},B.createElement("input",{type:"hidden",name:F,value:ut||"",form:pe,disabled:D}),B.createElement(ku,yd(c1(yd(yd({autoComplete:"off",type:"search"},r),Ne),{ref:zf(t,ke),onKeyDown:ca,__staticSelector:"Select",value:hn,placeholder:q,onChange:ua,"aria-autocomplete":"list","aria-controls":so?`${r.id}-items`:null,"aria-activedescendant":pt>=0?`${r.id}-${pt}`:null,onMouseDown:re,onBlur:Ls,onFocus:Ua,readOnly:!P||we,disabled:D,"data-mantine-stop-propagation":so,name:null,classNames:c1(yd({},S),{input:qe({[De.input]:!P},S==null?void 0:S.input)})}),kM({theme:Mt,rightSection:Y,rightSectionWidth:z,styles:j,size:r.size,shouldClear:M&&!!yn,onClear:nr,error:o.error,clearButtonProps:ve,disabled:D,readOnly:we}))))),B.createElement(Qi.Dropdown,{component:K||Gg,maxHeight:I,direction:Ot,id:r.id,innerRef:_t,__staticSelector:"Select",classNames:S,styles:j},B.createElement(Ny,{data:or,hovered:pt,classNames:S,styles:j,isItemSelected:ie=>ie===ut,uuid:r.id,__staticSelector:"Select",onItemHover:vt,onItemSelect:rr,itemsRefs:Be,itemComponent:h,size:r.size,nothingFound:R,creatable:_n&&!!Me,createLabel:Me,"aria-label":o.label,unstyled:C,variant:r.variant}))))});qy.displayName="@mantine/core/Select";const Hf=()=>{const[e,t,n,r,o,s,i,c,d,p,h,m,g,b,y,x,C,S,j,_,I,P,M,R,A,D,O,T,Y,z,W,Q,U,L,ee,K,Z,se,fe,G,te,V,F,X,ue,q,ne,pe,le,we,ve,he,Ne,De,qe,Mt,ot,an,pt,vt,ke,Be,Ot,Ht,je,ht,At,_t,Re,Xe,_n,Me,Ze,Ye,ut,Ut]=Ks("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:c,base450:d,base500:p,base550:h,base600:m,base650:g,base700:b,base750:y,base800:x,base850:C,base900:S,base950:j,accent50:_,accent100:I,accent150:P,accent200:M,accent250:R,accent300:A,accent350:D,accent400:O,accent450:T,accent500:Y,accent550:z,accent600:W,accent650:Q,accent700:U,accent750:L,accent800:ee,accent850:K,accent900:Z,accent950:se,baseAlpha50:fe,baseAlpha100:G,baseAlpha150:te,baseAlpha200:V,baseAlpha250:F,baseAlpha300:X,baseAlpha350:ue,baseAlpha400:q,baseAlpha450:ne,baseAlpha500:pe,baseAlpha550:le,baseAlpha600:we,baseAlpha650:ve,baseAlpha700:he,baseAlpha750:Ne,baseAlpha800:De,baseAlpha850:qe,baseAlpha900:Mt,baseAlpha950:ot,accentAlpha50:an,accentAlpha100:pt,accentAlpha150:vt,accentAlpha200:ke,accentAlpha250:Be,accentAlpha300:Ot,accentAlpha350:Ht,accentAlpha400:je,accentAlpha450:ht,accentAlpha500:At,accentAlpha550:_t,accentAlpha600:Re,accentAlpha650:Xe,accentAlpha700:_n,accentAlpha750:Me,accentAlpha800:Ze,accentAlpha850:Ye,accentAlpha900:ut,accentAlpha950:Ut}},Ke=(e,t)=>n=>n==="light"?e:t,AM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Hf(),{colorMode:x}=wi(),[C]=Ks("shadows",["dark-lg"]),[S,j,_]=Ks("space",[1,2,6]),[I]=Ks("radii",["base"]),[P]=Ks("lineHeights",["base"]);return l.useCallback(()=>({label:{color:Ke(c,r)(x)},separatorLabel:{color:Ke(s,s)(x),"::after":{borderTopColor:Ke(r,c)(x)}},input:{border:"unset",backgroundColor:Ke(e,p)(x),borderRadius:I,borderStyle:"solid",borderWidth:"2px",borderColor:Ke(n,d)(x),color:Ke(p,t)(x),minHeight:"unset",lineHeight:P,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(x)},"&:focus":{borderColor:Ke(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(x)},"&:focus-within":{borderColor:Ke(h,y)(x)},"&[data-disabled]":{backgroundColor:Ke(r,c)(x),color:Ke(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Ke(t,p)(x),color:Ke(p,t)(x),button:{color:Ke(p,t)(x)},"&:hover":{backgroundColor:Ke(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,d)(x),borderColor:Ke(n,d)(x),boxShadow:C},item:{backgroundColor:Ke(n,d)(x),color:Ke(d,n)(x),padding:6,"&[data-hovered]":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)},"&[data-active]":{backgroundColor:Ke(r,c)(x),"&:hover":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)}},"&[data-selected]":{backgroundColor:Ke(g,y)(x),color:Ke(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Ke(b,b)(x),color:Ke("white",e)(x)}},"&[data-disabled]":{color:Ke(s,i)(x),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ke(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,C,x,P,I,S,j,_])},DM=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:c,...d}=e,p=oe(),[h,m]=l.useState(""),g=l.useCallback(C=>{C.shiftKey&&p(Uo(!0))},[p]),b=l.useCallback(C=>{C.shiftKey||p(Uo(!1))},[p]),y=l.useCallback(C=>{s&&s(C)},[s]),x=AM();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Bn,{ref:t,isDisabled:c,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(vr,{children:i}),a.jsx(qy,{ref:o,disabled:c,searchValue:h,onSearchChange:m,onChange:y,onKeyDown:g,onKeyUp:b,searchable:n,maxDropdownHeight:300,styles:x,...d})]})})});DM.displayName="IAIMantineSearchableSelect";const tr=l.memo(DM),DZ=de([Ce],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},_e),TZ=()=>{const e=oe(),[t,n]=l.useState(),{data:r,isFetching:o}=gf(),{imagesToChange:s,isModalOpen:i}=H(DZ),[c]=vD(),[d]=bD(),{t:p}=J(),h=l.useMemo(()=>{const x=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(C=>x.push({label:C.board_name,value:C.board_id})),x},[r,p]),m=l.useCallback(()=>{e(Rw()),e(Cx(!1))},[e]),g=l.useCallback(()=>{!s.length||!t||(t==="none"?d({imageDTOs:s}):c({imageDTOs:s,board_id:t}),n(null),e(Rw()))},[c,e,s,d,t]),b=l.useCallback(x=>n(x),[]),y=l.useRef(null);return a.jsx(Df,{isOpen:i,onClose:m,leastDestructiveRef:y,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Oa,{children:a.jsxs(N,{sx:{flexDir:"column",gap:4},children:[a.jsxs(Se,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(tr,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:b,value:t,data:h})]})}),a.jsxs(pi,{children:[a.jsx(Rt,{ref:y,onClick:m,children:p("boards.cancel")}),a.jsx(Rt,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},NZ=l.memo(TZ),TM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:c,...d}=e;return a.jsx(Fn,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Bn,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(N,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(N,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(vr,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(Ey,{...d})]}),c&&a.jsx(BP,{children:a.jsx(Se,{variant:"subtext",children:c})})]})})})};TM.displayName="IAISwitch";const jr=l.memo(TM),$Z=e=>{const{t}=J(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Qs(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(Se,{children:r}),a.jsxs(Mf,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(ws,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(ws,{children:t("common.unifiedCanvas")}),n.isControlImage&&a.jsx(ws,{children:t("common.controlNet")}),n.isNodesImage&&a.jsx(ws,{children:t("common.nodeEditor")})]}),a.jsx(Se,{children:o})]})},NM=l.memo($Z),LZ=de([Ce,xD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:c,isModalOpen:d}=o,p=(c??[]).map(({image_name:m})=>PI(e,m)),h={isInitialImage:Qs(p,m=>m.isInitialImage),isCanvasImage:Qs(p,m=>m.isCanvasImage),isNodesImage:Qs(p,m=>m.isNodesImage),isControlImage:Qs(p,m=>m.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:c,imagesUsage:t,isModalOpen:d,imageUsageSummary:h}},_e),zZ=()=>{const e=oe(),{t}=J(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:c}=H(LZ),d=l.useCallback(g=>e(EI(!g.target.checked)),[e]),p=l.useCallback(()=>{e(Aw()),e(yD(!1))},[e]),h=l.useCallback(()=>{!o.length||!s.length||(e(Aw()),e(CD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),m=l.useRef(null);return a.jsx(Df,{isOpen:i,onClose:p,leastDestructiveRef:m,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Oa,{children:a.jsxs(N,{direction:"column",gap:3,children:[a.jsx(NM,{imageUsage:c}),a.jsx(no,{}),a.jsx(Se,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(Se,{children:t("common.areYouSure")}),a.jsx(jr,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:d})]})}),a.jsxs(pi,{children:[a.jsx(Rt,{ref:m,onClick:p,children:"Cancel"}),a.jsx(Rt,{colorScheme:"error",onClick:h,ml:3,children:"Delete"})]})]})})})},FZ=l.memo(zZ),$M=Oe((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Fn,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(_a,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});$M.displayName="IAIIconButton";const tt=l.memo($M);var LM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},xj=B.createContext&&B.createContext(LM),Xi=globalThis&&globalThis.__assign||function(){return Xi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=H(i=>i.config.disabledTabs),n=H(i=>i.config.disabledFeatures),r=H(i=>i.config.disabledSDFeatures),o=l.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=l.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function Pee(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(nl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(nl,{children:[a.jsx(Se,{fontWeight:600,children:t}),r&&a.jsx(Se,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Te,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function Eee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ls(),{t:o}=J(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],c=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],d=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],h=m=>a.jsx(N,{flexDir:"column",gap:4,children:m.map((g,b)=>a.jsxs(N,{flexDir:"column",px:2,gap:4,children:[a.jsx(Pee,{title:g.title,description:g.desc,hotkey:g.hotkey}),b{const{data:t}=wD(),n=l.useRef(null),r=eO(n);return a.jsxs(N,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(Si,{src:wx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(N,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(Se,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(yo,{children:e&&r&&t&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(Se,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},$ee=l.memo(Nee),tO=Oe((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...c}=e,d=AM();return a.jsx(Fn,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Bn,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(vr,{children:o}),a.jsx(qy,{disabled:s,ref:r,styles:d,...c})]})})});tO.displayName="IAIMantineSelect";const Ar=l.memo(tO),Lee={ar:on.t("common.langArabic",{lng:"ar"}),nl:on.t("common.langDutch",{lng:"nl"}),en:on.t("common.langEnglish",{lng:"en"}),fr:on.t("common.langFrench",{lng:"fr"}),de:on.t("common.langGerman",{lng:"de"}),he:on.t("common.langHebrew",{lng:"he"}),it:on.t("common.langItalian",{lng:"it"}),ja:on.t("common.langJapanese",{lng:"ja"}),ko:on.t("common.langKorean",{lng:"ko"}),pl:on.t("common.langPolish",{lng:"pl"}),pt_BR:on.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:on.t("common.langPortuguese",{lng:"pt"}),ru:on.t("common.langRussian",{lng:"ru"}),zh_CN:on.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:on.t("common.langSpanish",{lng:"es"}),uk:on.t("common.langUkranian",{lng:"ua"})},zee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},nO=de(Ce,({system:e})=>e.language,_e);function Vs(e){const{t}=J(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...c}=e;return a.jsxs(N,{justifyContent:"space-between",py:1,children:[a.jsxs(N,{gap:2,alignItems:"center",children:[a.jsx(Se,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ha,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(jr,{...c})]})}const Fee=e=>a.jsx(N,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),zc=l.memo(Fee);function Bee(){const{t:e}=J(),t=oe(),{data:n}=SD(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=kD(),{data:s}=Fa(),i=s&&(s.queue.in_progress>0||s.queue.pending>0),c=l.useCallback(()=>{i||r().unwrap().then(d=>{t(MI()),t(OI()),t(Bt({title:e("settings.intermediatesCleared",{count:d}),status:"info"}))}).catch(()=>{t(Bt({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,i]);return a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Rt,{tooltip:i?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:c,isLoading:o,isDisabled:!n||i,children:e("settings.clearIntermediatesWithCount",{count:n??0})}),a.jsx(Se,{fontWeight:"bold",children:e("settings.clearIntermediatesDesc1")}),a.jsx(Se,{variant:"subtext",children:e("settings.clearIntermediatesDesc2")}),a.jsx(Se,{variant:"subtext",children:e("settings.clearIntermediatesDesc3")})]})}const Hee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:c,base800:d,base900:p,accent200:h,accent300:m,accent400:g,accent500:b,accent600:y}=Hf(),{colorMode:x}=wi(),[C]=Ks("shadows",["dark-lg"]);return l.useCallback(()=>({label:{color:Ke(c,r)(x)},separatorLabel:{color:Ke(s,s)(x),"::after":{borderTopColor:Ke(r,c)(x)}},searchInput:{":placeholder":{color:Ke(r,c)(x)}},input:{backgroundColor:Ke(e,p)(x),borderWidth:"2px",borderColor:Ke(n,d)(x),color:Ke(p,t)(x),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(x)},"&:focus":{borderColor:Ke(m,y)(x)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(x)},"&:focus-within":{borderColor:Ke(h,y)(x)},"&[data-disabled]":{backgroundColor:Ke(r,c)(x),color:Ke(i,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Ke(n,d)(x),color:Ke(p,t)(x),button:{color:Ke(p,t)(x)},"&:hover":{backgroundColor:Ke(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,d)(x),borderColor:Ke(n,d)(x),boxShadow:C},item:{backgroundColor:Ke(n,d)(x),color:Ke(d,n)(x),padding:6,"&[data-hovered]":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)},"&[data-active]":{backgroundColor:Ke(r,c)(x),"&:hover":{color:Ke(p,t)(x),backgroundColor:Ke(r,c)(x)}},"&[data-selected]":{backgroundColor:Ke(g,y)(x),color:Ke(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Ke(b,b)(x),color:Ke("white",e)(x)}},"&[data-disabled]":{color:Ke(s,i)(x),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ke(p,t)(x)}}}),[h,m,g,b,y,t,n,r,o,e,s,i,c,d,p,C,x])},rO=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...c}=e,d=oe(),p=l.useCallback(g=>{g.shiftKey&&d(Uo(!0))},[d]),h=l.useCallback(g=>{g.shiftKey||d(Uo(!1))},[d]),m=Hee();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Bn,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(vr,{children:s}),a.jsx(IM,{ref:o,disabled:i,onKeyDown:p,onKeyUp:h,searchable:n,maxDropdownHeight:300,styles:m,...c})]})})});rO.displayName="IAIMantineMultiSelect";const Wee=l.memo(rO),Vee=Ro(sg,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function Uee(){const e=oe(),{t}=J(),n=H(o=>o.ui.favoriteSchedulers),r=l.useCallback(o=>{e(jD(o))},[e]);return a.jsx(Wee,{label:t("settings.favoriteSchedulers"),value:n,data:Vee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const Gee=de([Ce],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:h,shouldShowProgressInViewer:m,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:h,shouldShowProgressInViewer:m,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),qee=({children:e,config:t})=>{const n=oe(),{t:r}=J(),[o,s]=l.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,c=(t==null?void 0:t.shouldShowResetWebUiText)??!0,d=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;l.useEffect(()=>{i||n(Dw(!1))},[i,n]);const{isNSFWCheckerAvailable:h,isWatermarkerAvailable:m}=RI(void 0,{selectFromResult:({data:ne})=>({isNSFWCheckerAvailable:(ne==null?void 0:ne.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(ne==null?void 0:ne.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:b,onClose:y}=ls(),{isOpen:x,onOpen:C,onClose:S}=ls(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:I,shouldShowProgressInViewer:P,consoleLogLevel:M,shouldLogToConsole:R,shouldAntialiasProgressImage:A,shouldUseNSFWChecker:D,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:Y}=H(Gee),z=l.useCallback(()=>{Object.keys(window.localStorage).forEach(ne=>{(_D.includes(ne)||ne.startsWith(ID))&&localStorage.removeItem(ne)}),y(),C(),setInterval(()=>s(ne=>ne-1),1e3)},[y,C]);l.useEffect(()=>{o<=0&&window.location.reload()},[o]);const W=l.useCallback(ne=>{n(PD(ne))},[n]),Q=l.useCallback(ne=>{n(ED(ne))},[n]),U=l.useCallback(ne=>{n(Dw(ne.target.checked))},[n]),{colorMode:L,toggleColorMode:ee}=wi(),K=jn("localization").isFeatureEnabled,Z=H(nO),se=l.useCallback(ne=>{n(EI(ne.target.checked))},[n]),fe=l.useCallback(ne=>{n(MD(ne.target.checked))},[n]),G=l.useCallback(ne=>{n(OD(ne.target.checked))},[n]),te=l.useCallback(ne=>{n(RD(ne.target.checked))},[n]),V=l.useCallback(ne=>{n(AI(ne.target.checked))},[n]),F=l.useCallback(ne=>{n(AD(ne.target.checked))},[n]),X=l.useCallback(ne=>{n(DD(ne.target.checked))},[n]),ue=l.useCallback(ne=>{n(TD(ne.target.checked))},[n]),q=l.useCallback(ne=>{n(ND(ne.target.checked))},[n]);return a.jsxs(a.Fragment,{children:[l.cloneElement(e,{onClick:b}),a.jsxs(bu,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Ma,{}),a.jsxs(xu,{children:[a.jsx(Ea,{bg:"none",children:r("common.settingsLabel")}),a.jsx(kg,{}),a.jsx(Oa,{children:a.jsxs(N,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.general")}),a.jsx(Vs,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:se})]}),a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.generation")}),a.jsx(Uee,{}),a.jsx(Vs,{label:"Enable NSFW Checker",isDisabled:!h,isChecked:D,onChange:fe}),a.jsx(Vs,{label:"Enable Invisible Watermark",isDisabled:!m,isChecked:O,onChange:G})]}),a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.ui")}),a.jsx(Vs,{label:r("common.darkMode"),isChecked:L==="dark",onChange:ee}),a.jsx(Vs,{label:r("settings.useSlidersForAll"),isChecked:I,onChange:te}),a.jsx(Vs,{label:r("settings.showProgressInViewer"),isChecked:P,onChange:V}),a.jsx(Vs,{label:r("settings.antialiasProgressImages"),isChecked:A,onChange:F}),a.jsx(Vs,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:X}),p&&a.jsx(Ar,{disabled:!K,label:r("common.languagePickerLabel"),value:Z,data:Object.entries(Lee).map(([ne,pe])=>({value:ne,label:pe})),onChange:Q}),a.jsx(Vs,{label:"Enable informational popovers",isChecked:Y,onChange:ue})]}),i&&a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.developer")}),a.jsx(Vs,{label:r("settings.shouldLogToConsole"),isChecked:R,onChange:U}),a.jsx(Ar,{disabled:!R,label:r("settings.consoleLogLevel"),onChange:W,value:M,data:$D.concat()}),a.jsx(Vs,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:q})]}),d&&a.jsx(Bee,{}),a.jsxs(zc,{children:[a.jsx(vo,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Rt,{colorScheme:"error",onClick:z,children:r("settings.resetWebUI")}),c&&a.jsxs(a.Fragment,{children:[a.jsx(Se,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(Se,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(pi,{children:a.jsx(Rt,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(bu,{closeOnOverlayClick:!1,isOpen:x,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Ma,{backdropFilter:"blur(40px)"}),a.jsxs(xu,{children:[a.jsx(Ea,{}),a.jsx(Oa,{children:a.jsx(N,{justifyContent:"center",children:a.jsx(Se,{fontSize:"lg",children:a.jsxs(Se,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(pi,{})]})]})]})},Kee=l.memo(qee),Qee=de(Ce,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:zee[n]}},_e),Sj={ok:"green.400",working:"yellow.400",error:"red.400"},kj={ok:"green.600",working:"yellow.500",error:"red.500"},Xee=()=>{const{isConnected:e,statusTranslationKey:t}=H(Qee),{t:n}=J(),r=l.useRef(null),{data:o}=Fa(),s=l.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=eO(r);return a.jsxs(N,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(yo,{children:i&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(Se,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:kj[s],_dark:{color:Sj[s]}},children:n(t)})},"statusText")}),a.jsx(zr,{as:ZZ,sx:{boxSize:"0.5rem",color:kj[s],_dark:{color:Sj[s]}}})]})},Yee=l.memo(Xee),Jee=()=>{const{t:e}=J(),t=jn("bugLink").isFeatureEnabled,n=jn("discordLink").isFeatureEnabled,r=jn("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx($ee,{}),a.jsx(ji,{}),a.jsx(Yee,{}),a.jsxs(Cg,{children:[a.jsx(wg,{as:tt,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(YZ,{}),sx:{boxSize:8}}),a.jsxs(Gl,{motionProps:pu,children:[a.jsxs(Yd,{title:e("common.communityLabel"),children:[r&&a.jsx(Vn,{as:"a",href:o,target:"_blank",icon:a.jsx(VZ,{}),children:e("common.githubLabel")}),t&&a.jsx(Vn,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(JZ,{}),children:e("common.reportBugLabel")}),n&&a.jsx(Vn,{as:"a",href:s,target:"_blank",icon:a.jsx(WZ,{}),children:e("common.discordLabel")})]}),a.jsxs(Yd,{title:e("common.settingsLabel"),children:[a.jsx(Eee,{children:a.jsx(Vn,{as:"button",icon:a.jsx(pee,{}),children:e("common.hotkeysLabel")})}),a.jsx(Kee,{children:a.jsx(Vn,{as:"button",icon:a.jsx(WM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Zee=l.memo(Jee);/*! - * OverlayScrollbars - * Version: 2.2.1 - * - * Copyright (c) Rene Haas | KingSora. - * https://github.com/KingSora - * - * Released under the MIT license. - */function Dn(e,t){if(e0(e))for(let n=0;nt(e[n],n,e));return e}function bo(e,t){const n=fl(t);if(sa(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?Pj(e,s,t):t.reduce((i,c)=>(i[c]=Pj(e,s,c),i),o)}return o}e&&Dn(us(t),o=>mte(e,o,t[o]))}const Gs=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const c=(h,m)=>{const g=s,b=h,y=m||(r?!r(g,b):g!==b);return(y||o)&&(s=b,i=g),[s,y,i]};return[t?h=>c(t(s,i),h):c,h=>[s,!!h,i]]},Wf=()=>typeof window<"u",oO=Wf()&&Node.ELEMENT_NODE,{toString:ete,hasOwnProperty:u1}=Object.prototype,Ii=e=>e===void 0,Zg=e=>e===null,tte=e=>Ii(e)||Zg(e)?`${e}`:ete.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Ji=e=>typeof e=="number",fl=e=>typeof e=="string",Qy=e=>typeof e=="boolean",oa=e=>typeof e=="function",sa=e=>Array.isArray(e),tf=e=>typeof e=="object"&&!sa(e)&&!Zg(e),e0=e=>{const t=!!e&&e.length,n=Ji(t)&&t>-1&&t%1==0;return sa(e)||!oa(e)&&n?t>0&&tf(e)?t-1 in e:!0:!1},Bb=e=>{if(!e||!tf(e)||tte(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=u1.call(e,n),i=o&&u1.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return Ii(t)||u1.call(e,t)},Wm=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===oO:!1},t0=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===oO:!1},Xy=(e,t,n)=>e.indexOf(t,n),Gn=(e,t,n)=>(!n&&!fl(t)&&e0(t)?Array.prototype.push.apply(e,t):e.push(t),e),Xl=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Gn(n,r)}):Dn(e,r=>{Gn(n,r)}),n)},Yy=e=>!!e&&e.length===0,Wa=(e,t,n)=>{Dn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},n0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),us=e=>e?Object.keys(e):[],kr=(e,t,n,r,o,s,i)=>{const c=[t,n,r,o,s,i];return(typeof e!="object"||Zg(e))&&!oa(e)&&(e={}),Dn(c,d=>{Dn(us(d),p=>{const h=d[p];if(e===h)return!0;const m=sa(h);if(h&&(Bb(h)||m)){const g=e[p];let b=g;m&&!sa(g)?b=[]:!m&&!Bb(g)&&(b={}),e[p]=kr(b,h)}else e[p]=h})}),e},Jy=e=>{for(const t in e)return!1;return!0},sO=(e,t,n,r)=>{if(Ii(r))return n?n[e]:t;n&&(fl(r)||Ji(r))&&(n[e]=r)},go=(e,t,n)=>{if(Ii(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},zo=(e,t)=>{e&&e.removeAttribute(t)},Ll=(e,t,n,r)=>{if(n){const o=go(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Xl(s).join(" ").trim();go(e,t,i)}},nte=(e,t,n)=>{const r=go(e,t)||"";return new Set(r.split(" ")).has(n)},ea=(e,t)=>sO("scrollLeft",0,e,t),li=(e,t)=>sO("scrollTop",0,e,t),Hb=Wf()&&Element.prototype,aO=(e,t)=>{const n=[],r=t?t0(t)?t:null:document;return r?Gn(n,r.querySelectorAll(e)):n},rte=(e,t)=>{const n=t?t0(t)?t:null:document;return n?n.querySelector(e):null},Vm=(e,t)=>t0(e)?(Hb.matches||Hb.msMatchesSelector).call(e,t):!1,Zy=e=>e?Xl(e.childNodes):[],mi=e=>e?e.parentElement:null,qc=(e,t)=>{if(t0(e)){const n=Hb.closest;if(n)return n.call(e,t);do{if(Vm(e,t))return e;e=mi(e)}while(e)}return null},ote=(e,t,n)=>{const r=e&&qc(e,t),o=e&&rte(n,r),s=qc(o,t)===r;return r&&o?r===e||o===e||s&&qc(qc(e,n),t)!==r:!1},e2=(e,t,n)=>{if(n&&e){let r=t,o;e0(n)?(o=document.createDocumentFragment(),Dn(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},Ss=(e,t)=>{e2(e,null,t)},ste=(e,t)=>{e2(mi(e),e,t)},jj=(e,t)=>{e2(mi(e),e&&e.nextSibling,t)},Aa=e=>{if(e0(e))Dn(Xl(e),t=>Aa(t));else if(e){const t=mi(e);t&&t.removeChild(e)}},zl=e=>{const t=document.createElement("div");return e&&go(t,"class",e),t},iO=e=>{const t=zl();return t.innerHTML=e.trim(),Dn(Zy(t),n=>Aa(n))},Wb=e=>e.charAt(0).toUpperCase()+e.slice(1),ate=()=>zl().style,ite=["-webkit-","-moz-","-o-","-ms-"],lte=["WebKit","Moz","O","MS","webkit","moz","o","ms"],d1={},f1={},cte=e=>{let t=f1[e];if(n0(f1,e))return t;const n=Wb(e),r=ate();return Dn(ite,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Wb(s)+n].find(c=>r[c]!==void 0))}),f1[e]=t||""},Vf=e=>{if(Wf()){let t=d1[e]||window[e];return n0(d1,e)||(Dn(lte,n=>(t=t||window[n+Wb(e)],!t)),d1[e]=t),t}},ute=Vf("MutationObserver"),_j=Vf("IntersectionObserver"),Kc=Vf("ResizeObserver"),lO=Vf("cancelAnimationFrame"),cO=Vf("requestAnimationFrame"),Um=Wf()&&window.setTimeout,Vb=Wf()&&window.clearTimeout,dte=/[^\x20\t\r\n\f]+/g,uO=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&fl(t)){const c=t.match(dte)||[];for(i=c.length>0;o=c[s++];)i=!!n(r,o)&&i}return i},t2=(e,t)=>{uO(e,t,(n,r)=>n.remove(r))},ci=(e,t)=>(uO(e,t,(n,r)=>n.add(r)),t2.bind(0,e,t)),r0=(e,t,n,r)=>{if(e&&t){let o=!0;return Dn(n,s=>{const i=r?r(e[s]):e[s],c=r?r(t[s]):t[s];i!==c&&(o=!1)}),o}return!1},dO=(e,t)=>r0(e,t,["w","h"]),fO=(e,t)=>r0(e,t,["x","y"]),fte=(e,t)=>r0(e,t,["t","r","b","l"]),Ij=(e,t,n)=>r0(e,t,["width","height"],n&&(r=>Math.round(r))),ys=()=>{},Fc=e=>{let t;const n=e?Um:cO,r=e?Vb:lO;return[o=>{r(t),t=n(o,oa(e)?e():e)},()=>r(t)]},n2=(e,t)=>{let n,r,o,s=ys;const{v:i,g:c,p:d}=t||{},p=function(y){s(),Vb(n),n=r=void 0,s=ys,e.apply(this,y)},h=b=>d&&r?d(r,b):b,m=()=>{s!==ys&&p(h(o)||o)},g=function(){const y=Xl(arguments),x=oa(i)?i():i;if(Ji(x)&&x>=0){const S=oa(c)?c():c,j=Ji(S)&&S>=0,_=x>0?Um:cO,I=x>0?Vb:lO,M=h(y)||y,R=p.bind(0,M);s();const A=_(R,x);s=()=>I(A),j&&!n&&(n=Um(m,S)),r=o=M}else p(y)};return g.m=m,g},pte={opacity:1,zindex:1},ih=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},hte=(e,t)=>!pte[e.toLowerCase()]&&Ji(t)?`${t}px`:t,Pj=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],mte=(e,t,n)=>{try{const{style:r}=e;Ii(r[t])?r.setProperty(t,n):r[t]=hte(t,n)}catch{}},nf=e=>bo(e,"direction")==="rtl",Ej=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,c=`${r}bottom${o}`,d=`${r}left${o}`,p=bo(e,[s,i,c,d]);return{t:ih(p[s],!0),r:ih(p[i],!0),b:ih(p[c],!0),l:ih(p[d],!0)}},{round:Mj}=Math,r2={w:0,h:0},rf=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:r2,Ah=e=>e?{w:e.clientWidth,h:e.clientHeight}:r2,Gm=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:r2,qm=e=>{const t=parseFloat(bo(e,"height"))||0,n=parseFloat(bo(e,"width"))||0;return{w:n-Mj(n),h:t-Mj(t)}},Sa=e=>e.getBoundingClientRect();let lh;const gte=()=>{if(Ii(lh)){lh=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){lh=!0}}))}catch{}}return lh},pO=e=>e.split(" "),vte=(e,t,n,r)=>{Dn(pO(t),o=>{e.removeEventListener(o,n,r)})},Gr=(e,t,n,r)=>{var o;const s=gte(),i=(o=s&&r&&r.S)!=null?o:s,c=r&&r.$||!1,d=r&&r.C||!1,p=[],h=s?{passive:i,capture:c}:c;return Dn(pO(t),m=>{const g=d?b=>{e.removeEventListener(m,g,c),n&&n(b)}:n;Gn(p,vte.bind(null,e,m,g,c)),e.addEventListener(m,g,h)}),Wa.bind(0,p)},hO=e=>e.stopPropagation(),mO=e=>e.preventDefault(),bte={x:0,y:0},p1=e=>{const t=e?Sa(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:bte},Oj=(e,t)=>{Dn(sa(t)?t:[t],e)},o2=e=>{const t=new Map,n=(s,i)=>{if(s){const c=t.get(s);Oj(d=>{c&&c[d?"delete":"clear"](d)},i)}else t.forEach(c=>{c.clear()}),t.clear()},r=(s,i)=>{if(fl(s)){const p=t.get(s)||new Set;return t.set(s,p),Oj(h=>{oa(h)&&p.add(h)},i),n.bind(0,s,i)}Qy(i)&&i&&n();const c=us(s),d=[];return Dn(c,p=>{const h=s[p];h&&Gn(d,r(p,h))}),Wa.bind(0,d)},o=(s,i)=>{const c=t.get(s);Dn(Xl(c),d=>{i&&!Yy(i)?d.apply(0,i):d()})};return r(e||{}),[r,n,o]},Rj=e=>JSON.stringify(e,(t,n)=>{if(oa(n))throw new Error;return n}),xte={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},gO=(e,t)=>{const n={},r=us(t).concat(us(e));return Dn(r,o=>{const s=e[o],i=t[o];if(tf(s)&&tf(i))kr(n[o]={},gO(s,i)),Jy(n[o])&&delete n[o];else if(n0(t,o)&&i!==s){let c=!0;if(sa(s)||sa(i))try{Rj(s)===Rj(i)&&(c=!1)}catch{}c&&(n[o]=i)}}),n},vO="os-environment",bO=`${vO}-flexbox-glue`,yte=`${bO}-max`,xO="os-scrollbar-hidden",h1="data-overlayscrollbars-initialize",qs="data-overlayscrollbars",yO=`${qs}-overflow-x`,CO=`${qs}-overflow-y`,cu="overflowVisible",Cte="scrollbarHidden",Aj="scrollbarPressed",Km="updating",Hi="data-overlayscrollbars-viewport",m1="arrange",wO="scrollbarHidden",uu=cu,Ub="data-overlayscrollbars-padding",wte=uu,Dj="data-overlayscrollbars-content",s2="os-size-observer",Ste=`${s2}-appear`,kte=`${s2}-listener`,jte="os-trinsic-observer",_te="os-no-css-vars",Ite="os-theme-none",Ko="os-scrollbar",Pte=`${Ko}-rtl`,Ete=`${Ko}-horizontal`,Mte=`${Ko}-vertical`,SO=`${Ko}-track`,a2=`${Ko}-handle`,Ote=`${Ko}-visible`,Rte=`${Ko}-cornerless`,Tj=`${Ko}-transitionless`,Nj=`${Ko}-interaction`,$j=`${Ko}-unusable`,Lj=`${Ko}-auto-hidden`,zj=`${Ko}-wheel`,Ate=`${SO}-interactive`,Dte=`${a2}-interactive`,kO={},Yl=()=>kO,Tte=e=>{const t=[];return Dn(sa(e)?e:[e],n=>{const r=us(n);Dn(r,o=>{Gn(t,kO[o]=n[o])})}),t},Nte="__osOptionsValidationPlugin",$te="__osSizeObserverPlugin",i2="__osScrollbarsHidingPlugin",Lte="__osClickScrollPlugin";let g1;const Fj=(e,t,n,r)=>{Ss(e,t);const o=Ah(t),s=rf(t),i=qm(n);return r&&Aa(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},zte=e=>{let t=!1;const n=ci(e,xO);try{t=bo(e,cte("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},Fte=(e,t)=>{const n="hidden";bo(e,{overflowX:n,overflowY:n,direction:"rtl"}),ea(e,0);const r=p1(e),o=p1(t);ea(e,-999);const s=p1(t);return{i:r.x===o.x,n:o.x!==s.x}},Bte=(e,t)=>{const n=ci(e,bO),r=Sa(e),o=Sa(t),s=Ij(o,r,!0),i=ci(e,yte),c=Sa(e),d=Sa(t),p=Ij(d,c,!0);return n(),i(),s&&p},Hte=()=>{const{body:e}=document,n=iO(`
`)[0],r=n.firstChild,[o,,s]=o2(),[i,c]=Gs({o:Fj(e,n,r),u:fO},Fj.bind(0,e,n,r,!0)),[d]=c(),p=zte(n),h={x:d.x===0,y:d.y===0},m={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=kr({},xte),b=kr.bind(0,{},g),y=kr.bind(0,{},m),x={k:d,A:h,I:p,L:bo(n,"zIndex")==="-1",B:Fte(n,r),V:Bte(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>kr(m,j)&&y(),F:b,G:j=>kr(g,j)&&b(),X:kr({},m),U:kr({},g)},C=window.addEventListener,S=n2(j=>s(j?"z":"r"),{v:33,g:99});if(zo(n,"style"),Aa(n),C("resize",S.bind(0,!1)),!p&&(!h.x||!h.y)){let j;C("resize",()=>{const _=Yl()[i2];j=j||_&&_.R(),j&&j(x,i,S.bind(0,!0))})}return x},Qo=()=>(g1||(g1=Hte()),g1),l2=(e,t)=>oa(t)?t.apply(0,e):t,Wte=(e,t,n,r)=>{const o=Ii(r)?n:r;return l2(e,o)||t.apply(0,e)},jO=(e,t,n,r)=>{const o=Ii(r)?n:r,s=l2(e,o);return!!s&&(Wm(s)?s:t.apply(0,e))},Vte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Qo(),{nativeScrollbarsOverlaid:c,body:d}=t,p=r??c,h=Ii(o)?d:o,m=(s.x||s.y)&&p,g=e&&(Zg(h)?!i:h);return!!m||!!g},c2=new WeakMap,Ute=(e,t)=>{c2.set(e,t)},Gte=e=>{c2.delete(e)},_O=e=>c2.get(e),Bj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&n0(n,r)?n[r]:void 0,e):void 0,Gb=(e,t,n)=>r=>[Bj(e,r),n||Bj(t,r)!==void 0],IO=e=>{let t=e;return[()=>t,n=>{t=kr({},t,n)}]},ch="tabindex",uh=zl.bind(0,""),v1=e=>{Ss(mi(e),Zy(e)),Aa(e)},qte=e=>{const t=Qo(),{N:n,I:r}=t,o=Yl()[i2],s=o&&o.T,{elements:i}=n(),{host:c,padding:d,viewport:p,content:h}=i,m=Wm(e),g=m?{}:e,{elements:b}=g,{host:y,padding:x,viewport:C,content:S}=b||{},j=m?e:g.target,_=Vm(j,"textarea"),I=j.ownerDocument,P=I.documentElement,M=j===I.body,R=I.defaultView,A=Wte.bind(0,[j]),D=jO.bind(0,[j]),O=l2.bind(0,[j]),T=A.bind(0,uh,p),Y=D.bind(0,uh,h),z=T(C),W=z===j,Q=W&&M,U=!W&&Y(S),L=!W&&Wm(z)&&z===U,ee=L&&!!O(h),K=ee?T():z,Z=ee?U:Y(),fe=Q?P:L?K:z,G=_?A(uh,c,y):j,te=Q?fe:G,V=L?Z:U,F=I.activeElement,X=!W&&R.top===R&&F===j,ue={W:j,Z:te,J:fe,K:!W&&D(uh,d,x),tt:V,nt:!W&&!r&&s&&s(t),ot:Q?P:fe,st:Q?I:fe,et:R,ct:I,rt:_,it:M,lt:m,ut:W,dt:L,ft:(pt,vt)=>nte(fe,W?qs:Hi,W?vt:pt),_t:(pt,vt,ke)=>Ll(fe,W?qs:Hi,W?vt:pt,ke)},q=us(ue).reduce((pt,vt)=>{const ke=ue[vt];return Gn(pt,ke&&!mi(ke)?ke:!1)},[]),ne=pt=>pt?Xy(q,pt)>-1:null,{W:pe,Z:le,K:we,J:ve,tt:he,nt:Ne}=ue,De=[()=>{zo(le,qs),zo(le,h1),zo(pe,h1),M&&(zo(P,qs),zo(P,h1))}],qe=_&&ne(le);let Mt=_?pe:Zy([he,ve,we,le,pe].find(pt=>ne(pt)===!1));const ot=Q?pe:he||ve;return[ue,()=>{go(le,qs,W?"viewport":"host"),go(we,Ub,""),go(he,Dj,""),W||go(ve,Hi,"");const pt=M&&!W?ci(mi(j),xO):ys;if(qe&&(jj(pe,le),Gn(De,()=>{jj(le,pe),Aa(le)})),Ss(ot,Mt),Ss(le,we),Ss(we||le,!W&&ve),Ss(ve,he),Gn(De,()=>{pt(),zo(we,Ub),zo(he,Dj),zo(ve,yO),zo(ve,CO),zo(ve,Hi),ne(he)&&v1(he),ne(ve)&&v1(ve),ne(we)&&v1(we)}),r&&!W&&(Ll(ve,Hi,wO,!0),Gn(De,zo.bind(0,ve,Hi))),Ne&&(ste(ve,Ne),Gn(De,Aa.bind(0,Ne))),X){const vt=go(ve,ch);go(ve,ch,"-1"),ve.focus();const ke=()=>vt?go(ve,ch,vt):zo(ve,ch),Be=Gr(I,"pointerdown keydown",()=>{ke(),Be()});Gn(De,[ke,Be])}else F&&F.focus&&F.focus();Mt=0},Wa.bind(0,De)]},Kte=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Qo(),{ht:i}=r(),{vt:c}=o,d=(n||!s)&&c;return d&&bo(n,{height:i?"":"100%"}),{gt:d,wt:d}}},Qte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:c}=e,[d,p]=Gs({u:fte,o:Ej()},Ej.bind(0,o,"padding",""));return(h,m,g)=>{let[b,y]=p(g);const{I:x,V:C}=Qo(),{bt:S}=n(),{gt:j,wt:_,yt:I}=h,[P,M]=m("paddingAbsolute");(j||y||!C&&_)&&([b,y]=d(g));const A=!c&&(M||I||y);if(A){const D=!P||!s&&!x,O=b.r+b.l,T=b.t+b.b,Y={marginRight:D&&!S?-O:0,marginBottom:D?-T:0,marginLeft:D&&S?-O:0,top:D?-b.t:0,right:D?S?-b.r:"auto":0,left:D?S?"auto":-b.l:0,width:D?`calc(100% + ${O}px)`:""},z={paddingTop:D?b.t:0,paddingRight:D?b.r:0,paddingBottom:D?b.b:0,paddingLeft:D?b.l:0};bo(s||i,Y),bo(i,z),r({K:b,St:!D,P:s?z:kr({},Y,z)})}return{xt:A}}},{max:qb}=Math,Wi=qb.bind(0,0),PO="visible",Hj="hidden",Xte=42,dh={u:dO,o:{w:0,h:0}},Yte={u:fO,o:{x:Hj,y:Hj}},Jte=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Wi(e.w-t.w),h:Wi(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},fh=e=>e.indexOf(PO)===0,Zte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:c,ut:d,_t:p,it:h,et:m}=e,{k:g,V:b,I:y,A:x}=Qo(),C=Yl()[i2],S=!d&&!y&&(x.x||x.y),j=h&&d,[_,I]=Gs(dh,qm.bind(0,i)),[P,M]=Gs(dh,Gm.bind(0,i)),[R,A]=Gs(dh),[D,O]=Gs(dh),[T]=Gs(Yte),Y=(ee,K)=>{if(bo(i,{height:""}),K){const{St:Z,K:se}=n(),{$t:fe,D:G}=ee,te=qm(o),V=Ah(o),F=bo(i,"boxSizing")==="content-box",X=Z||F?se.b+se.t:0,ue=!(x.x&&F);bo(i,{height:V.h+te.h+(fe.x&&ue?G.x:0)-X})}},z=(ee,K)=>{const Z=!y&&!ee?Xte:0,se=(ne,pe,le)=>{const we=bo(i,ne),he=(K?K[ne]:we)==="scroll";return[we,he,he&&!y?pe?Z:le:0,pe&&!!Z]},[fe,G,te,V]=se("overflowX",x.x,g.x),[F,X,ue,q]=se("overflowY",x.y,g.y);return{Ct:{x:fe,y:F},$t:{x:G,y:X},D:{x:te,y:ue},M:{x:V,y:q}}},W=(ee,K,Z,se)=>{const fe=(X,ue)=>{const q=fh(X),ne=ue&&q&&X.replace(`${PO}-`,"")||"";return[ue&&!q?X:"",fh(ne)?"hidden":ne]},[G,te]=fe(Z.x,K.x),[V,F]=fe(Z.y,K.y);return se.overflowX=te&&V?te:G,se.overflowY=F&&G?F:V,z(ee,se)},Q=(ee,K,Z,se)=>{const{D:fe,M:G}=ee,{x:te,y:V}=G,{x:F,y:X}=fe,{P:ue}=n(),q=K?"marginLeft":"marginRight",ne=K?"paddingLeft":"paddingRight",pe=ue[q],le=ue.marginBottom,we=ue[ne],ve=ue.paddingBottom;se.width=`calc(100% + ${X+-1*pe}px)`,se[q]=-X+pe,se.marginBottom=-F+le,Z&&(se[ne]=we+(V?X:0),se.paddingBottom=ve+(te?F:0))},[U,L]=C?C.H(S,b,i,c,n,z,Q):[()=>S,()=>[ys]];return(ee,K,Z)=>{const{gt:se,Ot:fe,wt:G,xt:te,vt:V,yt:F}=ee,{ht:X,bt:ue}=n(),[q,ne]=K("showNativeOverlaidScrollbars"),[pe,le]=K("overflow"),we=q&&x.x&&x.y,ve=!d&&!b&&(se||G||fe||ne||V),he=fh(pe.x),Ne=fh(pe.y),De=he||Ne;let qe=I(Z),Mt=M(Z),ot=A(Z),an=O(Z),pt;if(ne&&y&&p(wO,Cte,!we),ve&&(pt=z(we),Y(pt,X)),se||te||G||F||ne){De&&p(uu,cu,!1);const[Me,Ze]=L(we,ue,pt),[Ye,ut]=qe=_(Z),[Ut,xr]=Mt=P(Z),yn=Ah(i);let hn=Ut,oo=yn;Me(),(xr||ut||ne)&&Ze&&!we&&U(Ze,Ut,Ye,ue)&&(oo=Ah(i),hn=Gm(i));const Dr={w:Wi(qb(Ut.w,hn.w)+Ye.w),h:Wi(qb(Ut.h,hn.h)+Ye.h)},nr={w:Wi((j?m.innerWidth:oo.w+Wi(yn.w-Ut.w))+Ye.w),h:Wi((j?m.innerHeight+Ye.h:oo.h+Wi(yn.h-Ut.h))+Ye.h)};an=D(nr),ot=R(Jte(Dr,nr),Z)}const[vt,ke]=an,[Be,Ot]=ot,[Ht,je]=Mt,[ht,At]=qe,_t={x:Be.w>0,y:Be.h>0},Re=he&&Ne&&(_t.x||_t.y)||he&&_t.x&&!_t.y||Ne&&_t.y&&!_t.x;if(te||F||At||je||ke||Ot||le||ne||ve){const Me={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Ze=W(we,_t,pe,Me),Ye=U(Ze,Ht,ht,ue);d||Q(Ze,ue,Ye,Me),ve&&Y(Ze,X),d?(go(o,yO,Me.overflowX),go(o,CO,Me.overflowY)):bo(i,Me)}Ll(o,qs,cu,Re),Ll(s,Ub,wte,Re),d||Ll(i,Hi,uu,De);const[Xe,_n]=T(z(we).Ct);return r({Ct:Xe,zt:{x:vt.w,y:vt.h},Tt:{x:Be.w,y:Be.h},Et:_t}),{It:_n,At:ke,Lt:Ot}}},Wj=(e,t,n)=>{const r={},o=t||{},s=us(e).concat(us(o));return Dn(s,i=>{const c=e[i],d=o[i];r[i]=!!(n||c||d)}),r},ene=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:c,V:d}=Qo(),p=!i&&(c.x||c.y),h=[Kte(e,t),Qte(e,t),Zte(e,t)];return(m,g,b)=>{const y=Wj(kr({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},b),x=p||!d,C=x&&ea(r),S=x&&li(r);o("",Km,!0);let j=y;return Dn(h,_=>{j=Wj(j,_(j,m,!!b)||{},b)}),ea(r,C),li(r,S),o("",Km),s||(ea(n,0),li(n,0)),j}},tne=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=c=>{if(n){const d=n.reduce((p,h)=>{if(h){const[m,g]=h,b=g&&m&&(c?c(m):aO(m,e));b&&b.length&&g&&fl(g)&&Gn(p,[b,g.trim()],!0)}return p},[]);Dn(d,p=>Dn(p[0],h=>{const m=p[1],g=r.get(h)||[];if(e.contains(h)){const y=Gr(h,m,x=>{o?(y(),r.delete(h)):t(x)});r.set(h,Gn(g,y))}else Wa(g),r.delete(h)}))}};return n&&(r=new WeakMap,i()),[s,i]},Vj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:c,Mt:d,Rt:p,kt:h}=r||{},m=n2(()=>{o&&n(!0)},{v:33,g:99}),[g,b]=tne(e,m,c),y=s||[],x=i||[],C=y.concat(x),S=(_,I)=>{const P=p||ys,M=h||ys,R=new Set,A=new Set;let D=!1,O=!1;if(Dn(_,T=>{const{attributeName:Y,target:z,type:W,oldValue:Q,addedNodes:U,removedNodes:L}=T,ee=W==="attributes",K=W==="childList",Z=e===z,se=ee&&fl(Y)?go(z,Y):0,fe=se!==0&&Q!==se,G=Xy(x,Y)>-1&&fe;if(t&&(K||!Z)){const te=!ee,V=ee&&fe,F=V&&d&&Vm(z,d),ue=(F?!P(z,Y,Q,se):te||V)&&!M(T,!!F,e,r);Dn(U,q=>R.add(q)),Dn(L,q=>R.add(q)),O=O||ue}!t&&Z&&fe&&!P(z,Y,Q,se)&&(A.add(Y),D=D||G)}),R.size>0&&b(T=>Xl(R).reduce((Y,z)=>(Gn(Y,aO(T,z)),Vm(z,T)?Gn(Y,z):Y),[])),t)return!I&&O&&n(!1),[!1];if(A.size>0||D){const T=[Xl(A),D];return!I&&n.apply(0,T),T}},j=new ute(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:C,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){m.m();const _=j.takeRecords();return!Yy(_)&&S(_,!0)}}]},ph=3333333,hh=e=>e&&(e.height||e.width),EO=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Yl()[$te],{B:i}=Qo(),d=iO(`
`)[0],p=d.firstChild,h=nf.bind(0,e),[m]=Gs({o:void 0,_:!0,u:(x,C)=>!(!x||!hh(x)&&hh(C))}),g=x=>{const C=sa(x)&&x.length>0&&tf(x[0]),S=!C&&Qy(x[0]);let j=!1,_=!1,I=!0;if(C){const[P,,M]=m(x.pop().contentRect),R=hh(P),A=hh(M);j=!M||!R,_=!A&&R,I=!j}else S?[,I]=x:_=x===!0;if(r&&I){const P=S?x[0]:nf(d);ea(d,P?i.n?-ph:i.i?0:ph:ph),li(d,ph)}j||t({gt:!S,Yt:S?x:void 0,Vt:!!_})},b=[];let y=o?g:!1;return[()=>{Wa(b),Aa(d)},()=>{if(Kc){const x=new Kc(g);x.observe(p),Gn(b,()=>{x.disconnect()})}else if(s){const[x,C]=s.O(p,g,o);y=x,Gn(b,C)}if(r){const[x]=Gs({o:void 0},h);Gn(b,Gr(d,"scroll",C=>{const S=x(),[j,_,I]=S;_&&(t2(p,"ltr rtl"),j?ci(p,"rtl"):ci(p,"ltr"),g([!!j,_,I])),hO(C)}))}y&&(ci(d,Ste),Gn(b,Gr(d,"animationstart",y,{C:!!Kc}))),(Kc||s)&&Ss(e,d)}]},nne=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,rne=(e,t)=>{let n;const r=zl(jte),o=[],[s]=Gs({o:!1}),i=(d,p)=>{if(d){const h=s(nne(d)),[,m]=h;if(m)return!p&&t(h),[h]}},c=(d,p)=>{if(d&&d.length>0)return i(d.pop(),p)};return[()=>{Wa(o),Aa(r)},()=>{if(_j)n=new _j(d=>c(d),{root:e}),n.observe(r),Gn(o,()=>{n.disconnect()});else{const d=()=>{const m=rf(r);i(m)},[p,h]=EO(r,d);Gn(o,p),h(),d()}Ss(e,r)},()=>{if(n)return c(n.takeRecords(),!0)}]},Uj=`[${qs}]`,one=`[${Hi}]`,b1=["tabindex"],Gj=["wrap","cols","rows"],x1=["id","class","style","open"],sne=(e,t,n)=>{let r,o,s;const{Z:i,J:c,tt:d,rt:p,ut:h,ft:m,_t:g}=e,{V:b}=Qo(),[y]=Gs({u:dO,o:{w:0,h:0}},()=>{const W=m(uu,cu),Q=m(m1,""),U=Q&&ea(c),L=Q&&li(c);g(uu,cu),g(m1,""),g("",Km,!0);const ee=Gm(d),K=Gm(c),Z=qm(c);return g(uu,cu,W),g(m1,"",Q),g("",Km),ea(c,U),li(c,L),{w:K.w+ee.w+Z.w,h:K.h+ee.h+Z.h}}),x=p?Gj:x1.concat(Gj),C=n2(n,{v:()=>r,g:()=>o,p(W,Q){const[U]=W,[L]=Q;return[us(U).concat(us(L)).reduce((ee,K)=>(ee[K]=U[K]||L[K],ee),{})]}}),S=W=>{Dn(W||b1,Q=>{if(Xy(b1,Q)>-1){const U=go(i,Q);fl(U)?go(c,Q,U):zo(c,Q)}})},j=(W,Q)=>{const[U,L]=W,ee={vt:L};return t({ht:U}),!Q&&n(ee),ee},_=({gt:W,Yt:Q,Vt:U})=>{const L=!W||U?n:C;let ee=!1;if(Q){const[K,Z]=Q;ee=Z,t({bt:K})}L({gt:W,yt:ee})},I=(W,Q)=>{const[,U]=y(),L={wt:U};return U&&!Q&&(W?n:C)(L),L},P=(W,Q,U)=>{const L={Ot:Q};return Q?!U&&C(L):h||S(W),L},[M,R,A]=d||!b?rne(i,j):[ys,ys,ys],[D,O]=h?[ys,ys]:EO(i,_,{Vt:!0,Bt:!0}),[T,Y]=Vj(i,!1,P,{Pt:x1,Ht:x1.concat(b1)}),z=h&&Kc&&new Kc(_.bind(0,{gt:!0}));return z&&z.observe(i),S(),[()=>{M(),D(),s&&s[0](),z&&z.disconnect(),T()},()=>{O(),R()},()=>{const W={},Q=Y(),U=A(),L=s&&s[1]();return Q&&kr(W,P.apply(0,Gn(Q,!0))),U&&kr(W,j.apply(0,Gn(U,!0))),L&&kr(W,I.apply(0,Gn(L,!0))),W},W=>{const[Q]=W("update.ignoreMutation"),[U,L]=W("update.attributes"),[ee,K]=W("update.elementEvents"),[Z,se]=W("update.debounce"),fe=K||L,G=te=>oa(Q)&&Q(te);if(fe&&(s&&(s[1](),s[0]()),s=Vj(d||c,!0,I,{Ht:x.concat(U||[]),Dt:ee,Mt:Uj,kt:(te,V)=>{const{target:F,attributeName:X}=te;return(!V&&X&&!h?ote(F,Uj,one):!1)||!!qc(F,`.${Ko}`)||!!G(te)}})),se)if(C.m(),sa(Z)){const te=Z[0],V=Z[1];r=Ji(te)&&te,o=Ji(V)&&V}else Ji(Z)?(r=Z,o=!1):(r=!1,o=!1)}]},qj={x:0,y:0},ane=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:qj,Tt:qj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:nf(e.Z)}),ine=(e,t)=>{const n=Gb(t,{}),[r,o,s]=o2(),[i,c,d]=qte(e),p=IO(ane(i)),[h,m]=p,g=ene(i,p),b=(_,I,P)=>{const R=us(_).some(A=>_[A])||!Jy(I)||P;return R&&s("u",[_,I,P]),R},[y,x,C,S]=sne(i,m,_=>b(g(n,_),{},!1)),j=h.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:I}=i,P=ea(_),M=li(_);x(),c(),ea(I,P),li(I,M)},j.qt=i,[(_,I)=>{const P=Gb(t,_,I);return S(P),b(g(P,C(),I),_,!!I)},j,()=>{o(),y(),d()}]},{round:Kj}=Math,lne=e=>{const{width:t,height:n}=Sa(e),{w:r,h:o}=rf(e);return{x:Kj(t)/r||1,y:Kj(n)/o||1}},cne=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:c}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(c||[]).includes(i)},une=(e,t)=>Gr(e,"mousedown",Gr.bind(0,t,"click",hO,{C:!0,$:!0}),{$:!0}),Qj="pointerup pointerleave pointercancel lostpointercapture",dne=(e,t,n,r,o,s,i)=>{const{B:c}=Qo(),{Ft:d,Gt:p,Xt:h}=r,m=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,b=i?"width":"height",y=i?"left":"top",x=i?"w":"h",C=i?"x":"y",S=(j,_)=>I=>{const{Tt:P}=s(),M=rf(p)[x]-rf(d)[x],A=_*I/M*P[C],O=nf(h)&&i?c.n||c.i?1:-1:1;o[m]=j+A*O};return Gr(p,"pointerdown",j=>{const _=qc(j.target,`.${a2}`)===d,I=_?d:p;if(Ll(t,qs,Aj,!0),cne(j,e,_)){const P=!_&&j.shiftKey,M=()=>Sa(d),R=()=>Sa(p),A=(K,Z)=>(K||M())[y]-(Z||R())[y],D=S(o[m]||0,1/lne(o)[C]),O=j[g],T=M(),Y=R(),z=T[b],W=A(T,Y)+z/2,Q=O-Y[y],U=_?0:Q-W,L=K=>{Wa(ee),I.releasePointerCapture(K.pointerId)},ee=[Ll.bind(0,t,qs,Aj),Gr(n,Qj,L),Gr(n,"selectstart",K=>mO(K),{S:!1}),Gr(p,Qj,L),Gr(p,"pointermove",K=>{const Z=K[g]-O;(_||P)&&D(U+Z)})];if(P)D(U);else if(!_){const K=Yl()[Lte];K&&Gn(ee,K.O(D,A,U,z,Q))}I.setPointerCapture(j.pointerId)}})},fne=(e,t)=>(n,r,o,s,i,c)=>{const{Xt:d}=n,[p,h]=Fc(333),m=!!i.scrollBy;let g=!0;return Wa.bind(0,[Gr(d,"pointerenter",()=>{r(Nj,!0)}),Gr(d,"pointerleave pointercancel",()=>{r(Nj)}),Gr(d,"wheel",b=>{const{deltaX:y,deltaY:x,deltaMode:C}=b;m&&g&&C===0&&mi(d)===s&&i.scrollBy({left:y,top:x,behavior:"smooth"}),g=!1,r(zj,!0),p(()=>{g=!0,r(zj)}),mO(b)},{S:!1,$:!0}),une(d,o),dne(e,s,o,n,i,t,c),h])},{min:Kb,max:Xj,abs:pne,round:hne}=Math,MO=(e,t,n,r)=>{if(r){const c=n?"x":"y",{Tt:d,zt:p}=r,h=p[c],m=d[c];return Xj(0,Kb(1,h/(h+m)))}const o=n?"width":"height",s=Sa(e)[o],i=Sa(t)[o];return Xj(0,Kb(1,s/i))},mne=(e,t,n,r,o,s)=>{const{B:i}=Qo(),c=s?"x":"y",d=s?"Left":"Top",{Tt:p}=r,h=hne(p[c]),m=pne(n[`scroll${d}`]),g=s&&o,b=i.i?m:h-m,x=Kb(1,(g?b:m)/h),C=MO(e,t,s);return 1/C*(1-C)*x},gne=(e,t,n)=>{const{N:r,L:o}=Qo(),{scrollbars:s}=r(),{slot:i}=s,{ct:c,W:d,Z:p,J:h,lt:m,ot:g,it:b,ut:y}=t,{scrollbars:x}=m?{}:e,{slot:C}=x||{},S=jO([d,p,h],()=>y&&b?d:p,i,C),j=(U,L,ee)=>{const K=ee?ci:t2;Dn(U,Z=>{K(Z.Xt,L)})},_=(U,L)=>{Dn(U,ee=>{const[K,Z]=L(ee);bo(K,Z)})},I=(U,L,ee)=>{_(U,K=>{const{Ft:Z,Gt:se}=K;return[Z,{[ee?"width":"height"]:`${(100*MO(Z,se,ee,L)).toFixed(3)}%`}]})},P=(U,L,ee)=>{const K=ee?"X":"Y";_(U,Z=>{const{Ft:se,Gt:fe,Xt:G}=Z,te=mne(se,fe,g,L,nf(G),ee);return[se,{transform:te===te?`translate${K}(${(100*te).toFixed(3)}%)`:""}]})},M=[],R=[],A=[],D=(U,L,ee)=>{const K=Qy(ee),Z=K?ee:!0,se=K?!ee:!0;Z&&j(R,U,L),se&&j(A,U,L)},O=U=>{I(R,U,!0),I(A,U)},T=U=>{P(R,U,!0),P(A,U)},Y=U=>{const L=U?Ete:Mte,ee=U?R:A,K=Yy(ee)?Tj:"",Z=zl(`${Ko} ${L} ${K}`),se=zl(SO),fe=zl(a2),G={Xt:Z,Gt:se,Ft:fe};return o||ci(Z,_te),Ss(Z,se),Ss(se,fe),Gn(ee,G),Gn(M,[Aa.bind(0,Z),n(G,D,c,p,g,U)]),G},z=Y.bind(0,!0),W=Y.bind(0,!1),Q=()=>{Ss(S,R[0].Xt),Ss(S,A[0].Xt),Um(()=>{D(Tj)},300)};return z(),W(),[{Ut:O,Wt:T,Zt:D,Jt:{Kt:R,Qt:z,tn:_.bind(0,R)},nn:{Kt:A,Qt:W,tn:_.bind(0,A)}},Q,Wa.bind(0,M)]},vne=(e,t,n,r)=>{let o,s,i,c,d,p=0;const h=IO({}),[m]=h,[g,b]=Fc(),[y,x]=Fc(),[C,S]=Fc(100),[j,_]=Fc(100),[I,P]=Fc(()=>p),[M,R,A]=gne(e,n.qt,fne(t,n)),{Z:D,J:O,ot:T,st:Y,ut:z,it:W}=n.qt,{Jt:Q,nn:U,Zt:L,Ut:ee,Wt:K}=M,{tn:Z}=Q,{tn:se}=U,fe=X=>{const{Xt:ue}=X,q=z&&!W&&mi(ue)===O&&ue;return[q,{transform:q?`translate(${ea(T)}px, ${li(T)}px)`:""}]},G=(X,ue)=>{if(P(),X)L(Lj);else{const q=()=>L(Lj,!0);p>0&&!ue?I(q):q()}},te=()=>{c=s,c&&G(!0)},V=[S,P,_,x,b,A,Gr(D,"pointerover",te,{C:!0}),Gr(D,"pointerenter",te),Gr(D,"pointerleave",()=>{c=!1,s&&G(!1)}),Gr(D,"pointermove",()=>{o&&g(()=>{S(),G(!0),j(()=>{o&&G(!1)})})}),Gr(Y,"scroll",X=>{y(()=>{K(n()),i&&G(!0),C(()=>{i&&!c&&G(!1)})}),r(X),z&&Z(fe),z&&se(fe)})],F=m.bind(0);return F.qt=M,F.Nt=R,[(X,ue,q)=>{const{At:ne,Lt:pe,It:le,yt:we}=q,{A:ve}=Qo(),he=Gb(t,X,ue),Ne=n(),{Tt:De,Ct:qe,bt:Mt}=Ne,[ot,an]=he("showNativeOverlaidScrollbars"),[pt,vt]=he("scrollbars.theme"),[ke,Be]=he("scrollbars.visibility"),[Ot,Ht]=he("scrollbars.autoHide"),[je]=he("scrollbars.autoHideDelay"),[ht,At]=he("scrollbars.dragScroll"),[_t,Re]=he("scrollbars.clickScroll"),Xe=ne||pe||we,_n=le||Be,Me=ot&&ve.x&&ve.y,Ze=(Ye,ut)=>{const Ut=ke==="visible"||ke==="auto"&&Ye==="scroll";return L(Ote,Ut,ut),Ut};if(p=je,an&&L(Ite,Me),vt&&(L(d),L(pt,!0),d=pt),Ht&&(o=Ot==="move",s=Ot==="leave",i=Ot!=="never",G(!i,!0)),At&&L(Dte,ht),Re&&L(Ate,_t),_n){const Ye=Ze(qe.x,!0),ut=Ze(qe.y,!1);L(Rte,!(Ye&&ut))}Xe&&(ee(Ne),K(Ne),L($j,!De.x,!0),L($j,!De.y,!1),L(Pte,Mt&&!W))},F,Wa.bind(0,V)]},OO=(e,t,n)=>{oa(e)&&e(t||void 0,n||void 0)},qi=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Qo(),c=Yl(),d=Wm(e),p=d?e:e.target,h=_O(p);if(t&&!h){let m=!1;const g=z=>{const W=Yl()[Nte],Q=W&&W.O;return Q?Q(z,!0):z},b=kr({},r(),g(t)),[y,x,C]=o2(n),[S,j,_]=ine(e,b),[I,P,M]=vne(e,b,j,z=>C("scroll",[Y,z])),R=(z,W)=>S(z,!!W),A=R.bind(0,{},!0),D=s(A),O=i(A),T=z=>{Gte(p),D(),O(),M(),_(),m=!0,C("destroyed",[Y,!!z]),x()},Y={options(z,W){if(z){const Q=W?r():{},U=gO(b,kr(Q,g(z)));Jy(U)||(kr(b,U),R(U))}return kr({},b)},on:y,off:(z,W)=>{z&&W&&x(z,W)},state(){const{zt:z,Tt:W,Ct:Q,Et:U,K:L,St:ee,bt:K}=j();return kr({},{overflowEdge:z,overflowAmount:W,overflowStyle:Q,hasOverflow:U,padding:L,paddingAbsolute:ee,directionRTL:K,destroyed:m})},elements(){const{W:z,Z:W,K:Q,J:U,tt:L,ot:ee,st:K}=j.qt,{Jt:Z,nn:se}=P.qt,fe=te=>{const{Ft:V,Gt:F,Xt:X}=te;return{scrollbar:X,track:F,handle:V}},G=te=>{const{Kt:V,Qt:F}=te,X=fe(V[0]);return kr({},X,{clone:()=>{const ue=fe(F());return I({},!0,{}),ue}})};return kr({},{target:z,host:W,padding:Q||U,viewport:U,content:L||U,scrollOffsetElement:ee,scrollEventElement:K,scrollbarHorizontal:G(Z),scrollbarVertical:G(se)})},update:z=>R({},z),destroy:T.bind(0)};return j.jt((z,W,Q)=>{I(W,Q,z)}),Ute(p,Y),Dn(us(c),z=>OO(c[z],0,Y)),Vte(j.qt.it,o().cancel,!d&&e.cancel)?(T(!0),Y):(j.Nt(),P.Nt(),C("initialized",[Y]),j.jt((z,W,Q)=>{const{gt:U,yt:L,vt:ee,At:K,Lt:Z,It:se,wt:fe,Ot:G}=z;C("updated",[Y,{updateHints:{sizeChanged:U,directionChanged:L,heightIntrinsicChanged:ee,overflowEdgeChanged:K,overflowAmountChanged:Z,overflowStyleChanged:se,contentMutation:fe,hostMutation:G},changedOptions:W,force:Q}])}),Y.update(!0),Y)}return h};qi.plugin=e=>{Dn(Tte(e),t=>OO(t,qi))};qi.valid=e=>{const t=e&&e.elements,n=oa(t)&&t();return Bb(n)&&!!_O(n.target)};qi.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:c,N:d,q:p,F:h,G:m}=Qo();return kr({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:c,getDefaultInitialization:d,setDefaultInitialization:p,getDefaultOptions:h,setDefaultOptions:m})};const bne=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,c=r?n.cancelIdleCallback:s,d=()=>{c(e),s(t)};return[(p,h)=>{d(),e=i(r?()=>{d(),t=o(p)}:p,typeof h=="object"?h:{timeout:2233})},d]},u2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=l.useMemo(bne,[]),i=l.useRef(null),c=l.useRef(r),d=l.useRef(t),p=l.useRef(n);return l.useEffect(()=>{c.current=r},[r]),l.useEffect(()=>{const{current:h}=i;d.current=t,qi.valid(h)&&h.options(t||{},!0)},[t]),l.useEffect(()=>{const{current:h}=i;p.current=n,qi.valid(h)&&h.on(n||{},!0)},[n]),l.useEffect(()=>()=>{var h;s(),(h=i.current)==null||h.destroy()},[]),l.useMemo(()=>[h=>{const m=i.current;if(qi.valid(m))return;const g=c.current,b=d.current||{},y=p.current||{},x=()=>i.current=qi(h,b,y);g?o(x,g):x()},()=>i.current],[])},xne=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...c}=e,d=n,p=l.useRef(null),h=l.useRef(null),[m,g]=u2({options:r,events:o,defer:s});return l.useEffect(()=>{const{current:b}=p,{current:y}=h;return b&&y&&m({target:b,elements:{viewport:y,content:y}}),()=>{var x;return(x=g())==null?void 0:x.destroy()}},[m,n]),l.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),B.createElement(d,{"data-overlayscrollbars-initialize":"",ref:p,...c},B.createElement("div",{ref:h},i))},o0=l.forwardRef(xne);var RO={exports:{}},AO={};const ts=Sx(LD),Cd=Sx(zD),yne=Sx(FD);(function(e){var t,n,r=Cc&&Cc.__generator||function(re,ie){var be,Pe,xe,ft,it={label:0,sent:function(){if(1&xe[0])throw xe[1];return xe[1]},trys:[],ops:[]};return ft={next:Kt(0),throw:Kt(1),return:Kt(2)},typeof Symbol=="function"&&(ft[Symbol.iterator]=function(){return this}),ft;function Kt(mt){return function(wt){return function(We){if(be)throw new TypeError("Generator is already executing.");for(;it;)try{if(be=1,Pe&&(xe=2&We[0]?Pe.return:We[0]?Pe.throw||((xe=Pe.return)&&xe.call(Pe),0):Pe.next)&&!(xe=xe.call(Pe,We[1])).done)return xe;switch(Pe=0,xe&&(We=[2&We[0],xe.value]),We[0]){case 0:case 1:xe=We;break;case 4:return it.label++,{value:We[1],done:!1};case 5:it.label++,Pe=We[1],We=[0];continue;case 7:We=it.ops.pop(),it.trys.pop();continue;default:if(!((xe=(xe=it.trys).length>0&&xe[xe.length-1])||We[0]!==6&&We[0]!==2)){it=0;continue}if(We[0]===3&&(!xe||We[1]>xe[0]&&We[1]=200&&re.status<=299},Y=function(re){return/ion\/(vnd\.api\+)?json/.test(re.get("content-type")||"")};function z(re){if(!(0,D.isPlainObject)(re))return re;for(var ie=C({},re),be=0,Pe=Object.entries(ie);be"u"&&it===O&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(sn,Yt){return P(ie,null,function(){var He,Ct,zt,Qt,Nn,Jt,vn,fn,Br,cr,Dt,$n,Wn,ur,Ir,Kn,Qn,bn,On,Ln,In,Pn,Je,Nt,kt,lt,St,Gt,bt,st,Le,Ae,ze,Ve,nt,Ft;return r(this,function($t){switch($t.label){case 0:return He=Yt.signal,Ct=Yt.getState,zt=Yt.extra,Qt=Yt.endpoint,Nn=Yt.forced,Jt=Yt.type,Br=(fn=typeof sn=="string"?{url:sn}:sn).url,Dt=(cr=fn.headers)===void 0?new Headers(Zt.headers):cr,Wn=($n=fn.params)===void 0?void 0:$n,Ir=(ur=fn.responseHandler)===void 0?Tt??"json":ur,Qn=(Kn=fn.validateStatus)===void 0?Vt??T:Kn,On=(bn=fn.timeout)===void 0?Et:bn,Ln=_(fn,["url","headers","params","responseHandler","validateStatus","timeout"]),In=C(S(C({},Zt),{signal:He}),Ln),Dt=new Headers(z(Dt)),Pn=In,[4,xe(Dt,{getState:Ct,extra:zt,endpoint:Qt,forced:Nn,type:Jt})];case 1:Pn.headers=$t.sent()||Dt,Je=function(Ue){return typeof Ue=="object"&&((0,D.isPlainObject)(Ue)||Array.isArray(Ue)||typeof Ue.toJSON=="function")},!In.headers.has("content-type")&&Je(In.body)&&In.headers.set("content-type",Ie),Je(In.body)&&wt(In.headers)&&(In.body=JSON.stringify(In.body,et)),Wn&&(Nt=~Br.indexOf("?")?"&":"?",kt=Kt?Kt(Wn):new URLSearchParams(z(Wn)),Br+=Nt+kt),Br=function(Ue,cn){if(!Ue)return cn;if(!cn)return Ue;if(function(Cn){return new RegExp("(^|:)//").test(Cn)}(cn))return cn;var En=Ue.endsWith("/")||!cn.startsWith("?")?"/":"";return Ue=function(Cn){return Cn.replace(/\/$/,"")}(Ue),""+Ue+En+function(Cn){return Cn.replace(/^\//,"")}(cn)}(be,Br),lt=new Request(Br,In),St=lt.clone(),vn={request:St},bt=!1,st=On&&setTimeout(function(){bt=!0,Yt.abort()},On),$t.label=2;case 2:return $t.trys.push([2,4,5,6]),[4,it(lt)];case 3:return Gt=$t.sent(),[3,6];case 4:return Le=$t.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Le)},meta:vn}];case 5:return st&&clearTimeout(st),[7];case 6:Ae=Gt.clone(),vn.response=Ae,Ve="",$t.label=7;case 7:return $t.trys.push([7,9,,10]),[4,Promise.all([ln(Gt,Ir).then(function(Ue){return ze=Ue},function(Ue){return nt=Ue}),Ae.text().then(function(Ue){return Ve=Ue},function(){})])];case 8:if($t.sent(),nt)throw nt;return[3,10];case 9:return Ft=$t.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Gt.status,data:Ve,error:String(Ft)},meta:vn}];case 10:return[2,Qn(Gt,ze)?{data:ze,meta:vn}:{error:{status:Gt.status,data:ze},meta:vn}]}})})};function ln(sn,Yt){return P(this,null,function(){var He;return r(this,function(Ct){switch(Ct.label){case 0:return typeof Yt=="function"?[2,Yt(sn)]:(Yt==="content-type"&&(Yt=wt(sn.headers)?"json":"text"),Yt!=="json"?[3,2]:[4,sn.text()]);case 1:return[2,(He=Ct.sent()).length?JSON.parse(He):null];case 2:return[2,sn.text()]}})})}}var Q=function(re,ie){ie===void 0&&(ie=void 0),this.value=re,this.meta=ie};function U(re,ie){return re===void 0&&(re=0),ie===void 0&&(ie=5),P(this,null,function(){var be,Pe;return r(this,function(xe){switch(xe.label){case 0:return be=Math.min(re,ie),Pe=~~((Math.random()+.4)*(300<=Ae)}var Ln=(0,qe.createAsyncThunk)(Wn+"/executeQuery",bn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je},condition:function(Je,Nt){var kt,lt,St,Gt=(0,Nt.getState)(),bt=(lt=(kt=Gt[Wn])==null?void 0:kt.queries)==null?void 0:lt[Je.queryCacheKey],st=bt==null?void 0:bt.fulfilledTimeStamp,Le=Je.originalArgs,Ae=bt==null?void 0:bt.originalArgs,ze=Ir[Je.endpointName];return!(!he(Je)&&((bt==null?void 0:bt.status)==="pending"||!On(Je,Gt)&&(!q(ze)||!((St=ze==null?void 0:ze.forceRefetch)!=null&&St.call(ze,{currentArg:Le,previousArg:Ae,endpointState:bt,state:Gt})))&&st))},dispatchConditionRejection:!0}),In=(0,qe.createAsyncThunk)(Wn+"/executeMutation",bn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je}});function Pn(Je){return function(Nt){var kt,lt;return((lt=(kt=Nt==null?void 0:Nt.meta)==null?void 0:kt.arg)==null?void 0:lt.endpointName)===Je}}return{queryThunk:Ln,mutationThunk:In,prefetch:function(Je,Nt,kt){return function(lt,St){var Gt=function(ze){return"force"in ze}(kt)&&kt.force,bt=function(ze){return"ifOlderThan"in ze}(kt)&&kt.ifOlderThan,st=function(ze){return ze===void 0&&(ze=!0),Qn.endpoints[Je].initiate(Nt,{forceRefetch:ze})},Le=Qn.endpoints[Je].select(Nt)(St());if(Gt)lt(st());else if(bt){var Ae=Le==null?void 0:Le.fulfilledTimeStamp;if(!Ae)return void lt(st());(Number(new Date)-Number(new Date(Ae)))/1e3>=bt&<(st())}else lt(st(!1))}},updateQueryData:function(Je,Nt,kt){return function(lt,St){var Gt,bt,st=Qn.endpoints[Je].select(Nt)(St()),Le={patches:[],inversePatches:[],undo:function(){return lt(Qn.util.patchQueryData(Je,Nt,Le.inversePatches))}};if(st.status===t.uninitialized)return Le;if("data"in st)if((0,De.isDraftable)(st.data)){var Ae=(0,De.produceWithPatches)(st.data,kt),ze=Ae[2];(Gt=Le.patches).push.apply(Gt,Ae[1]),(bt=Le.inversePatches).push.apply(bt,ze)}else{var Ve=kt(st.data);Le.patches.push({op:"replace",path:[],value:Ve}),Le.inversePatches.push({op:"replace",path:[],value:st.data})}return lt(Qn.util.patchQueryData(Je,Nt,Le.patches)),Le}},upsertQueryData:function(Je,Nt,kt){return function(lt){var St;return lt(Qn.endpoints[Je].initiate(Nt,((St={subscribe:!1,forceRefetch:!0})[ve]=function(){return{data:kt}},St)))}},patchQueryData:function(Je,Nt,kt){return function(lt){lt(Qn.internalActions.queryResultPatched({queryCacheKey:Kn({queryArgs:Nt,endpointDefinition:Ir[Je],endpointName:Je}),patches:kt}))}},buildMatchThunkActions:function(Je,Nt){return{matchPending:(0,Ne.isAllOf)((0,Ne.isPending)(Je),Pn(Nt)),matchFulfilled:(0,Ne.isAllOf)((0,Ne.isFulfilled)(Je),Pn(Nt)),matchRejected:(0,Ne.isAllOf)((0,Ne.isRejected)(Je),Pn(Nt))}}}}({baseQuery:Pe,reducerPath:xe,context:be,api:re,serializeQueryArgs:ft}),et=Ie.queryThunk,Et=Ie.mutationThunk,Tt=Ie.patchQueryData,Vt=Ie.updateQueryData,Zt=Ie.upsertQueryData,ln=Ie.prefetch,sn=Ie.buildMatchThunkActions,Yt=function(Dt){var $n=Dt.reducerPath,Wn=Dt.queryThunk,ur=Dt.mutationThunk,Ir=Dt.context,Kn=Ir.endpointDefinitions,Qn=Ir.apiUid,bn=Ir.extractRehydrationInfo,On=Ir.hasRehydrationInfo,Ln=Dt.assertTagType,In=Dt.config,Pn=(0,le.createAction)($n+"/resetApiState"),Je=(0,le.createSlice)({name:$n+"/queries",initialState:Ot,reducers:{removeQueryResult:{reducer:function(st,Le){delete st[Le.payload.queryCacheKey]},prepare:(0,le.prepareAutoBatched)()},queryResultPatched:function(st,Le){var Ae=Le.payload,ze=Ae.patches;vt(st,Ae.queryCacheKey,function(Ve){Ve.data=(0,pt.applyPatches)(Ve.data,ze.concat())})}},extraReducers:function(st){st.addCase(Wn.pending,function(Le,Ae){var ze,Ve=Ae.meta,nt=Ae.meta.arg,Ft=he(nt);(nt.subscribe||Ft)&&(Le[ze=nt.queryCacheKey]!=null||(Le[ze]={status:t.uninitialized,endpointName:nt.endpointName})),vt(Le,nt.queryCacheKey,function($t){$t.status=t.pending,$t.requestId=Ft&&$t.requestId?$t.requestId:Ve.requestId,nt.originalArgs!==void 0&&($t.originalArgs=nt.originalArgs),$t.startedTimeStamp=Ve.startedTimeStamp})}).addCase(Wn.fulfilled,function(Le,Ae){var ze=Ae.meta,Ve=Ae.payload;vt(Le,ze.arg.queryCacheKey,function(nt){var Ft;if(nt.requestId===ze.requestId||he(ze.arg)){var $t=Kn[ze.arg.endpointName].merge;if(nt.status=t.fulfilled,$t)if(nt.data!==void 0){var Ue=ze.fulfilledTimeStamp,cn=ze.arg,En=ze.baseQueryMeta,Cn=ze.requestId,Pr=(0,le.createNextState)(nt.data,function(ir){return $t(ir,Ve,{arg:cn.originalArgs,baseQueryMeta:En,fulfilledTimeStamp:Ue,requestId:Cn})});nt.data=Pr}else nt.data=Ve;else nt.data=(Ft=Kn[ze.arg.endpointName].structuralSharing)==null||Ft?A((0,an.isDraft)(nt.data)?(0,pt.original)(nt.data):nt.data,Ve):Ve;delete nt.error,nt.fulfilledTimeStamp=ze.fulfilledTimeStamp}})}).addCase(Wn.rejected,function(Le,Ae){var ze=Ae.meta,Ve=ze.condition,nt=ze.requestId,Ft=Ae.error,$t=Ae.payload;vt(Le,ze.arg.queryCacheKey,function(Ue){if(!Ve){if(Ue.requestId!==nt)return;Ue.status=t.rejected,Ue.error=$t??Ft}})}).addMatcher(On,function(Le,Ae){for(var ze=bn(Ae).queries,Ve=0,nt=Object.entries(ze);Ve"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},In),reducers:{middlewareRegistered:function(st,Le){st.middlewareRegistered=st.middlewareRegistered!=="conflict"&&Qn===Le.payload||"conflict"}},extraReducers:function(st){st.addCase(fe,function(Le){Le.online=!0}).addCase(G,function(Le){Le.online=!1}).addCase(Z,function(Le){Le.focused=!0}).addCase(se,function(Le){Le.focused=!1}).addMatcher(On,function(Le){return C({},Le)})}}),bt=(0,le.combineReducers)({queries:Je.reducer,mutations:Nt.reducer,provided:kt.reducer,subscriptions:St.reducer,config:Gt.reducer});return{reducer:function(st,Le){return bt(Pn.match(Le)?void 0:st,Le)},actions:S(C(C(C(C(C({},Gt.actions),Je.actions),lt.actions),St.actions),Nt.actions),{unsubscribeMutationResult:Nt.actions.removeMutationResult,resetApiState:Pn})}}({context:be,queryThunk:et,mutationThunk:Et,reducerPath:xe,assertTagType:We,config:{refetchOnFocus:mt,refetchOnReconnect:wt,refetchOnMountOrArgChange:Kt,keepUnusedDataFor:it,reducerPath:xe}}),He=Yt.reducer,Ct=Yt.actions;Yr(re.util,{patchQueryData:Tt,updateQueryData:Vt,upsertQueryData:Zt,prefetch:ln,resetApiState:Ct.resetApiState}),Yr(re.internalActions,Ct);var zt=function(Dt){var $n=Dt.reducerPath,Wn=Dt.queryThunk,ur=Dt.api,Ir=Dt.context,Kn=Ir.apiUid,Qn={invalidateTags:(0,xr.createAction)($n+"/invalidateTags")},bn=[so,yn,oo,Dr,or,Xo];return{middleware:function(Ln){var In=!1,Pn=S(C({},Dt),{internalState:{currentSubscriptions:{}},refetchQuery:On}),Je=bn.map(function(lt){return lt(Pn)}),Nt=function(lt){var St=lt.api,Gt=lt.queryThunk,bt=lt.internalState,st=St.reducerPath+"/subscriptions",Le=null,Ae=!1,ze=St.internalActions,Ve=ze.updateSubscriptionOptions,nt=ze.unsubscribeQueryResult;return function(Ft,$t){var Ue,cn;if(Le||(Le=JSON.parse(JSON.stringify(bt.currentSubscriptions))),St.util.resetApiState.match(Ft))return Le=bt.currentSubscriptions={},[!0,!1];if(St.internalActions.internal_probeSubscription.match(Ft)){var En=Ft.payload;return[!1,!!((Ue=bt.currentSubscriptions[En.queryCacheKey])!=null&&Ue[En.requestId])]}var Cn=function(Sn,sr){var wo,xn,Xn,io,Hr,Ei,Xf,Yo,Ga;if(Ve.match(sr)){var da=sr.payload,qa=da.queryCacheKey,So=da.requestId;return(wo=Sn==null?void 0:Sn[qa])!=null&&wo[So]&&(Sn[qa][So]=da.options),!0}if(nt.match(sr)){var ko=sr.payload;return So=ko.requestId,Sn[qa=ko.queryCacheKey]&&delete Sn[qa][So],!0}if(St.internalActions.removeQueryResult.match(sr))return delete Sn[sr.payload.queryCacheKey],!0;if(Gt.pending.match(sr)){var jo=sr.meta;if(So=jo.requestId,(uo=jo.arg).subscribe)return(ds=(Xn=Sn[xn=uo.queryCacheKey])!=null?Xn:Sn[xn]={})[So]=(Hr=(io=uo.subscriptionOptions)!=null?io:ds[So])!=null?Hr:{},!0}if(Gt.rejected.match(sr)){var ds,Jo=sr.meta,uo=Jo.arg;if(So=Jo.requestId,Jo.condition&&uo.subscribe)return(ds=(Xf=Sn[Ei=uo.queryCacheKey])!=null?Xf:Sn[Ei]={})[So]=(Ga=(Yo=uo.subscriptionOptions)!=null?Yo:ds[So])!=null?Ga:{},!0}return!1}(bt.currentSubscriptions,Ft);if(Cn){Ae||($s(function(){var Sn=JSON.parse(JSON.stringify(bt.currentSubscriptions)),sr=(0,ao.produceWithPatches)(Le,function(){return Sn});$t.next(St.internalActions.subscriptionsUpdated(sr[1])),Le=Sn,Ae=!1}),Ae=!0);var Pr=!!((cn=Ft.type)!=null&&cn.startsWith(st)),ir=Gt.rejected.match(Ft)&&Ft.meta.condition&&!!Ft.meta.arg.subscribe;return[!Pr&&!ir,!1]}return[!0,!1]}}(Pn),kt=function(lt){var St=lt.reducerPath,Gt=lt.context,bt=lt.refetchQuery,st=lt.internalState,Le=lt.api.internalActions.removeQueryResult;function Ae(ze,Ve){var nt=ze.getState()[St],Ft=nt.queries,$t=st.currentSubscriptions;Gt.batch(function(){for(var Ue=0,cn=Object.keys($t);Ue{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=J(),o=H(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=BD((t==null?void 0:t.board_id)??Os.skipToken),c=l.useMemo(()=>de([Ce],j=>{const _=(s??[]).map(P=>PI(j,P));return{imageUsageSummary:{isInitialImage:Qs(_,P=>P.isInitialImage),isCanvasImage:Qs(_,P=>P.isCanvasImage),isNodesImage:Qs(_,P=>P.isNodesImage),isControlImage:Qs(_,P=>P.isControlImage)}}}),[s]),[d,{isLoading:p}]=HD(),[h,{isLoading:m}]=WD(),{imageUsageSummary:g}=H(c),b=l.useCallback(()=>{t&&(d(t.board_id),n(void 0))},[t,d,n]),y=l.useCallback(()=>{t&&(h(t.board_id),n(void 0))},[t,h,n]),x=l.useCallback(()=>{n(void 0)},[n]),C=l.useRef(null),S=l.useMemo(()=>m||p||i,[m,p,i]);return t?a.jsx(Df,{isOpen:!!t,onClose:x,leastDestructiveRef:C,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsxs(Ea,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(Oa,{children:a.jsxs(N,{direction:"column",gap:3,children:[i?a.jsx(Dg,{children:a.jsx(N,{sx:{w:"full",h:32}})}):a.jsx(NM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(Se,{children:"Deleted boards cannot be restored."}),a.jsx(Se,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(pi,{children:a.jsxs(N,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Rt,{ref:C,onClick:x,children:"Cancel"}),a.jsx(Rt,{colorScheme:"warning",isLoading:S,onClick:b,children:"Delete Board Only"}),a.jsx(Rt,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},wne=l.memo(Cne),Sne=()=>{const{t:e}=J(),[t,{isLoading:n}]=VD(),r=e("boards.myBoard"),o=l.useCallback(()=>{t(r)},[t,r]);return a.jsx(tt,{icon:a.jsx(Yi,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},kne=l.memo(Sne);var DO=fg({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),s0=fg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),jne=fg({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),_ne=fg({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.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"})})});const Ine=de([Ce],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},_e),Pne=()=>{const e=oe(),{boardSearchText:t}=H(Ine),n=l.useRef(null),{t:r}=J(),o=l.useCallback(d=>{e(Tw(d))},[e]),s=l.useCallback(()=>{e(Tw(""))},[e]),i=l.useCallback(d=>{d.key==="Escape"&&s()},[s]),c=l.useCallback(d=>{o(d.target.value)},[o]);return l.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(z5,{children:[a.jsx(vg,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:c,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(dy,{children:a.jsx(_a,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(jne,{boxSize:2})})})]})},Ene=l.memo(Pne);function TO(e){return UD(e)}function Mne(e){return GD(e)}const NO=(e,t)=>{var o,s;if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROL_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload,d=c.board_id??"none",p=e.context.boardId;return d!==p}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload,d=((o=c[0])==null?void 0:o.board_id)??"none",p=e.context.boardId;return d!==p}return!1}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:c}=t.data.current.payload;return(c.board_id??"none")!=="none"}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload;return(((s=c[0])==null?void 0:s.board_id)??"none")!=="none"}return!1}default:return!1}},One=e=>{const{isOver:t,label:n="Drop"}=e,r=l.useRef(Jc()),{colorMode:o}=wi();return a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ke("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(N,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ke("base.50","base.50")(o):Ke("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Te,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ke("base.50","base.50")(o):Ke("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},$O=l.memo(One),Rne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=l.useRef(Jc()),{isOver:s,setNodeRef:i,active:c}=TO({id:o.current,disabled:r,data:n});return a.jsx(Te,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:c?"auto":"none",children:a.jsx(yo,{children:NO(n,c)&&a.jsx($O,{isOver:s,label:t})})})},d2=l.memo(Rne),Ane=({isSelected:e,isHovered:t})=>a.jsx(Te,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),f2=l.memo(Ane),Dne=()=>{const{t:e}=J();return a.jsx(N,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ha,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:e("common.auto")})})},LO=l.memo(Dne);function p2(e){const[t,n]=l.useState(!1),[r,o]=l.useState(!1),[s,i]=l.useState(!1),[c,d]=l.useState([0,0]),p=l.useRef(null),h=H(g=>g.ui.globalContextMenuCloseTrigger);l.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),l.useEffect(()=>{n(!1),i(!1),o(!1)},[h]),TF("contextmenu",g=>{var b;(b=p.current)!=null&&b.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),d([g.pageX,g.pageY])):n(!1)});const m=l.useCallback(()=>{var g,b;(b=(g=e.menuProps)==null?void 0:g.onClose)==null||b.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Ru,{...e.portalProps,children:a.jsxs(Cg,{isOpen:s,gutter:0,...e.menuProps,onClose:m,children:[a.jsx(wg,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:c[0],top:c[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const a0=e=>{const{boardName:t}=gf(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||DI("boards.uncategorized")}}});return t},Tne=({board:e,setBoardToDelete:t})=>{const n=l.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(Vn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClick:n,children:"Delete Board"})]})},Nne=l.memo(Tne),$ne=()=>a.jsx(a.Fragment,{}),Lne=l.memo($ne),zne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=J(),s=oe(),i=l.useMemo(()=>de(Ce,({gallery:C})=>{const S=C.autoAddBoardId===t,j=C.autoAssignBoardOnClick;return{isAutoAdd:S,autoAssignBoardOnClick:j}},_e),[t]),{isAutoAdd:c,autoAssignBoardOnClick:d}=H(i),p=a0(t),h=jn("bulkDownload").isFeatureEnabled,[m]=TI(),g=l.useCallback(()=>{s(ag(t))},[t,s]),b=l.useCallback(async()=>{try{const C=await m({image_names:[],board_id:t}).unwrap();s(Bt({title:o("gallery.preparingDownload"),status:"success",...C.response?{description:C.response}:{}}))}catch{s(Bt({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,m,s]),y=l.useCallback(C=>{C.preventDefault()},[]),x=l.useCallback(()=>a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:y,children:a.jsxs(Yd,{title:p,children:[a.jsx(Vn,{icon:a.jsx(Yi,{}),isDisabled:c||d,onClick:g,children:o("boards.menuItemAutoAdd")}),h&&a.jsx(Vn,{icon:a.jsx(Wu,{}),onClickCapture:b,children:o("boards.downloadBoard")}),!e&&a.jsx(Lne,{}),e&&a.jsx(Nne,{board:e,setBoardToDelete:n})]})}),[d,e,p,b,g,c,h,n,y,o]);return a.jsx(p2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:x,children:r})},zO=l.memo(zne),Fne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=oe(),o=l.useMemo(()=>de(Ce,({gallery:D})=>{const O=e.board_id===D.autoAddBoardId,T=D.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},_e),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=H(o),[c,d]=l.useState(!1),p=l.useCallback(()=>{d(!0)},[]),h=l.useCallback(()=>{d(!1)},[]),{data:m}=kx(e.board_id),{data:g}=jx(e.board_id),b=l.useMemo(()=>{if(!((m==null?void 0:m.total)===void 0||(g==null?void 0:g.total)===void 0))return`${m.total} image${m.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,m]),{currentData:y}=Ps(e.cover_image_name??Os.skipToken),{board_name:x,board_id:C}=e,[S,j]=l.useState(x),_=l.useCallback(()=>{r(NI({boardId:C})),i&&r(ag(C))},[C,i,r]),[I,{isLoading:P}]=qD(),M=l.useMemo(()=>({id:C,actionType:"ADD_TO_BOARD",context:{boardId:C}}),[C]),R=l.useCallback(async D=>{if(!D.trim()){j(x);return}if(D!==x)try{const{board_name:O}=await I({board_id:C,changes:{board_name:D}}).unwrap();j(O)}catch{j(x)}},[C,x,I]),A=l.useCallback(D=>{j(D)},[]);return a.jsx(Te,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:p,onMouseOut:h,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(zO,{board:e,board_id:C,setBoardToDelete:n,children:D=>a.jsx(Fn,{label:b,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:D,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(Si,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(zr,{boxSize:12,as:Iee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(LO,{}),a.jsx(f2,{isSelected:t,isHovered:c}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Ef,{value:S,isDisabled:P,submitOnBlur:!0,onChange:A,onSubmit:R,sx:{w:"full"},children:[a.jsx(Pf,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(If,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(d2,{data:M,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})},Bne=l.memo(Fne),Hne=de(Ce,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},_e),FO=l.memo(({isSelected:e})=>{const t=oe(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(Hne),o=a0("none"),s=l.useCallback(()=>{t(NI({boardId:"none"})),r&&t(ag("none"))},[t,r]),[i,c]=l.useState(!1),{data:d}=kx("none"),{data:p}=jx("none"),h=l.useMemo(()=>{if(!((d==null?void 0:d.total)===void 0||(p==null?void 0:p.total)===void 0))return`${d.total} image${d.total===1?"":"s"}, ${p.total} asset${p.total===1?"":"s"}`},[p,d]),m=l.useCallback(()=>{c(!0)},[]),g=l.useCallback(()=>{c(!1)},[]),b=l.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Te,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(N,{onMouseOver:m,onMouseOut:g,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(zO,{board_id:"none",children:y=>a.jsx(Fn,{label:h,openDelay:1e3,hasArrow:!0,children:a.jsxs(N,{ref:y,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Si,{src:wx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(LO,{}),a.jsx(N,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(f2,{isSelected:e,isHovered:i}),a.jsx(d2,{data:b,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})});FO.displayName="HoverableBoard";const Wne=l.memo(FO),Vne=de([Ce],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},_e),Une=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=H(Vne),{data:o}=gf(),s=r?o==null?void 0:o.filter(d=>d.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,c]=l.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Sf,{in:t,animateOpacity:!0,children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Ene,{}),a.jsx(kne,{})]}),a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(nl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Kd,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(Wne,{isSelected:n==="none"})}),s&&s.map((d,p)=>a.jsx(Kd,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(Bne,{board:d,isSelected:n===d.board_id,setBoardToDelete:c})},d.board_id))]})})]})}),a.jsx(wne,{boardToDelete:i,setBoardToDelete:c})]})},Gne=l.memo(Une),qne=de([Ce],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},_e),Kne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=H(qne),o=a0(r),s=l.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(N,{as:tl,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(Se,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(s0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},Qne=l.memo(Kne),Xne=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Nf,{isLazy:o,...s,children:[a.jsx(Rg,{children:t}),a.jsxs($f,{shadow:"dark-lg",children:[r&&a.jsx(x3,{}),n]})]})},Uf=l.memo(Xne);function Yne(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const BO=Oe((e,t)=>{const[n,r]=l.useState(!1),{label:o,value:s,min:i=1,max:c=100,step:d=1,onChange:p,tooltipSuffix:h="",withSliderMarks:m=!1,withInput:g=!1,isInteger:b=!1,inputWidth:y=16,withReset:x=!1,hideTooltip:C=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:I,sliderFormControlProps:P,sliderFormLabelProps:M,sliderMarkProps:R,sliderTrackProps:A,sliderThumbProps:D,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:Y,sliderTooltipProps:z,sliderIAIIconButtonProps:W,...Q}=e,U=oe(),{t:L}=J(),[ee,K]=l.useState(String(s));l.useEffect(()=>{K(s)},[s]);const Z=l.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),se=l.useMemo(()=>O!=null&&O.max?O.max:c,[c,O==null?void 0:O.max]),fe=l.useCallback(le=>{p(le)},[p]),G=l.useCallback(le=>{le.target.value===""&&(le.target.value=String(Z));const we=Bl(b?Math.floor(Number(le.target.value)):Number(ee),Z,se),ve=_d(we,d);p(ve),K(ve)},[b,ee,Z,se,p,d]),te=l.useCallback(le=>{K(le)},[]),V=l.useCallback(()=>{I&&I()},[I]),F=l.useCallback(le=>{le.target instanceof HTMLDivElement&&le.target.focus()},[]),X=l.useCallback(le=>{le.shiftKey&&U(Uo(!0))},[U]),ue=l.useCallback(le=>{le.shiftKey||U(Uo(!1))},[U]),q=l.useCallback(()=>r(!0),[]),ne=l.useCallback(()=>r(!1),[]),pe=l.useCallback(()=>p(Number(ee)),[ee,p]);return a.jsxs(Bn,{ref:t,onClick:F,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...P,children:[o&&a.jsx(vr,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(xg,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(jy,{"aria-label":o,value:s,min:i,max:c,step:d,onChange:fe,onMouseEnter:q,onMouseLeave:ne,focusThumbOnChange:!1,isDisabled:j,...Q,children:[m&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Lc,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:i}),a.jsx(Lc,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:c})]}),m&&_&&a.jsx(a.Fragment,{children:_.map((le,we)=>we===0?a.jsx(Lc,{value:le,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:le},le):we===_.length-1?a.jsx(Lc,{value:le,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:le},le):a.jsx(Lc,{value:le,sx:{transform:"translateX(-50%)"},...R,children:le},le))}),a.jsx(Iy,{...A,children:a.jsx(Py,{})}),a.jsx(Fn,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${h}`,hidden:C,...z,children:a.jsx(_y,{...D,zIndex:0})})]}),g&&a.jsxs(_g,{min:Z,max:se,step:d,value:ee,onChange:te,onBlur:G,focusInputOnChange:!1,...O,children:[a.jsx(Pg,{onKeyDown:X,onKeyUp:ue,minWidth:y,...T}),a.jsxs(Ig,{...Y,children:[a.jsx(Mg,{onClick:pe}),a.jsx(Eg,{onClick:pe})]})]}),x&&a.jsx(tt,{size:"sm","aria-label":L("accessibility.reset"),tooltip:L("accessibility.reset"),icon:a.jsx(Yne,{}),isDisabled:j,onClick:V,...W})]})]})});BO.displayName="IAISlider";const Pt=l.memo(BO),HO=l.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Fn,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Te,{ref:s,...o,children:a.jsxs(Te,{children:[a.jsx(yu,{children:e}),n&&a.jsx(yu,{size:"xs",color:"base.600",children:n})]})})}));HO.displayName="IAIMantineSelectItemWithTooltip";const pl=l.memo(HO),Jne=de([Ce],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},_e),Zne=()=>{const e=oe(),{t}=J(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(Jne),o=l.useRef(null),{boards:s,hasBoards:i}=gf(void 0,{selectFromResult:({data:p})=>{const h=[{label:"None",value:"none"}];return p==null||p.forEach(({board_id:m,board_name:g})=>{h.push({label:g,value:m})}),{boards:h,hasBoards:h.length>1}}}),c=l.useCallback(p=>{p&&e(ag(p))},[e]),d=l.useCallback((p,h)=>{var m;return((m=h.label)==null?void 0:m.toLowerCase().includes(p.toLowerCase().trim()))||h.value.toLowerCase().includes(p.toLowerCase().trim())},[]);return a.jsx(tr,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:pl,disabled:!i||r,filter:d,onChange:c})},ere=l.memo(Zne),tre=e=>{const{label:t,...n}=e,{colorMode:r}=wi();return a.jsx(_f,{colorScheme:"accent",...n,children:a.jsx(Se,{sx:{fontSize:"sm",color:Ke("base.800","base.200")(r)},children:t})})},Io=l.memo(tre),nre=de([Ce],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},_e),rre=()=>{const e=oe(),{t}=J(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=H(nre),s=l.useCallback(p=>{e(Nw(p))},[e]),i=l.useCallback(()=>{e(Nw(64))},[e]),c=l.useCallback(p=>{e(KD(p.target.checked))},[e]),d=l.useCallback(p=>e(QD(p.target.checked)),[e]);return a.jsx(Uf,{triggerComponent:a.jsx(tt,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(ZM,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Pt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(jr,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:c}),a.jsx(Io,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:d}),a.jsx(ere,{})]})})},ore=l.memo(rre),sre=e=>e.image?a.jsx(Dg,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(N,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(bi,{size:"xl"})}),qr=e=>{const{icon:t=Ql,boxSize:n=16,sx:r,...o}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(zr,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},are=e=>{const{sx:t,...n}=e;return a.jsxs(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(bi,{size:"xl"}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},i0=0,hl=1,Vu=2,WO=4;function VO(e,t){return n=>e(t(n))}function ire(e,t){return t(e)}function UO(e,t){return n=>e(t,n)}function Yj(e,t){return()=>e(t)}function l0(e,t){return t(e),e}function br(...e){return e}function lre(e){e()}function Jj(e){return()=>e}function cre(...e){return()=>{e.map(lre)}}function h2(e){return e!==void 0}function Uu(){}function qn(e,t){return e(hl,t)}function dn(e,t){e(i0,t)}function m2(e){e(Vu)}function ks(e){return e(WO)}function Lt(e,t){return qn(e,UO(t,i0))}function gi(e,t){const n=e(hl,r=>{n(),t(r)});return n}function Mn(){const e=[];return(t,n)=>{switch(t){case Vu:e.splice(0,e.length);return;case hl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case i0:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function at(e){let t=e;const n=Mn();return(r,o)=>{switch(r){case hl:o(t);break;case i0:t=o;break;case WO:return t}return n(r,o)}}function ure(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case hl:return s?n===s?void 0:(r(),n=s,t=qn(e,s),t):(r(),Uu);case Vu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function as(e){return l0(Mn(),t=>Lt(e,t))}function Po(e,t){return l0(at(t),n=>Lt(e,n))}function dre(...e){return t=>e.reduceRight(ire,t)}function $e(e,...t){const n=dre(...t);return(r,o)=>{switch(r){case hl:return qn(e,n(o));case Vu:m2(e);return}}}function GO(e,t){return e===t}function hr(e=GO){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function tn(e){return t=>n=>{e(n)&&t(n)}}function yt(e){return t=>VO(t,e)}function ei(e){return t=>()=>t(e)}function ka(e,t){return n=>r=>n(t=e(t,r))}function _u(e){return t=>n=>{e>0?e--:t(n)}}function Ki(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Zj(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function mn(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);qn(s,d=>{const p=n;n=n|c,t[i]=d,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>s([i].concat(t));n===o?c():r=c}}function e_(...e){return function(t,n){switch(t){case hl:return cre(...e.map(r=>qn(r,n)));case Vu:return;default:throw new Error(`unrecognized action ${t}`)}}}function en(e,t=GO){return $e(e,hr(t))}function to(...e){const t=Mn(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);qn(s,d=>{n[i]=d,r=r|c,r===o&&dn(t,n)})}),function(s,i){switch(s){case hl:return r===o&&i(n),qn(t,i);case Vu:return m2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Un(e,t=[],{singleton:n}={singleton:!0}){return{id:fre(),constructor:e,dependencies:t,singleton:n}}const fre=()=>Symbol();function pre(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const c=o(s.map(d=>n(d)));return i&&t.set(r,c),c};return n(e)}function hre(e,t){const n={},r={};let o=0;const s=e.length;for(;o(C[S]=j=>{const _=x[t.methods[S]];dn(_,j)},C),{})}function h(x){return i.reduce((C,S)=>(C[S]=ure(x[t.events[S]]),C),{})}return{Component:B.forwardRef((x,C)=>{const{children:S,...j}=x,[_]=B.useState(()=>l0(pre(e),P=>d(P,j))),[I]=B.useState(Yj(h,_));return mh(()=>{for(const P of i)P in j&&qn(I[P],j[P]);return()=>{Object.values(I).map(m2)}},[j,I,_]),mh(()=>{d(_,j)}),B.useImperativeHandle(C,Jj(p(_))),B.createElement(c.Provider,{value:_},n?B.createElement(n,hre([...r,...o,...i],j),S):S)}),usePublisher:x=>B.useCallback(UO(dn,B.useContext(c)[x]),[x]),useEmitterValue:x=>{const S=B.useContext(c)[x],[j,_]=B.useState(Yj(ks,S));return mh(()=>qn(S,I=>{I!==j&&_(Jj(I))}),[S,j]),j},useEmitter:(x,C)=>{const j=B.useContext(c)[x];mh(()=>qn(j,C),[C,j])}}}const mre=typeof document<"u"?B.useLayoutEffect:B.useEffect,gre=mre;var is=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(is||{});const vre={0:"debug",1:"log",2:"warn",3:"error"},bre=()=>typeof globalThis>"u"?window:globalThis,ml=Un(()=>{const e=at(3);return{log:at((n,r,o=1)=>{var s;const i=(s=bre().VIRTUOSO_LOG_LEVEL)!=null?s:ks(e);o>=i&&console[vre[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function g2(e,t=!0){const n=B.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=B.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function sc(e,t=!0){return g2(e,t).callbackRef}function xre(e,t,n,r,o,s,i){const c=B.useCallback(d=>{const p=yre(d.children,t,"offsetHeight",o);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const m=h.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:m?window.pageYOffset||document.documentElement.scrollTop:h.scrollTop,b=i?i.scrollHeight:m?document.documentElement.scrollHeight:h.scrollHeight,y=i?i.offsetHeight:m?window.innerHeight:h.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:b,viewportHeight:y}),s==null||s(Cre("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return g2(c,n)}function yre(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=m.target,b=g===window||g===document,y=b?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,x=b?document.documentElement.scrollHeight:g.scrollHeight,C=b?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:x,viewportHeight:C})};m.suppressFlushSync?S():XD.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===x-C)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);B.useEffect(()=>{const m=o||s.current;return r(o||s.current),d({target:m,suppressFlushSync:!0}),m.addEventListener("scroll",d,{passive:!0}),()=>{r(null),m.removeEventListener("scroll",d)}},[s,d,n,r,o]);function p(m){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const b=m.behavior==="smooth";let y,x,C;g===window?(x=Math.max(al(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,C=document.documentElement.scrollTop):(x=g.scrollHeight,y=al(g,"height"),C=g.scrollTop);const S=x-y;if(m.top=Math.ceil(Math.max(Math.min(S,m.top),0)),KO(y,x)||m.top===C){e({scrollTop:C,scrollHeight:x,viewportHeight:y}),b&&t(!0);return}b?(i.current=m.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(m)}function h(m){s.current.scrollBy(m)}return{scrollerRef:s,scrollByCallback:h,scrollToCallback:p}}const Do=Un(()=>{const e=Mn(),t=Mn(),n=at(0),r=Mn(),o=at(0),s=Mn(),i=Mn(),c=at(0),d=at(0),p=at(0),h=at(0),m=Mn(),g=Mn(),b=at(!1);return Lt($e(e,yt(({scrollTop:y})=>y)),t),Lt($e(e,yt(({scrollHeight:y})=>y)),i),Lt(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:p,footerHeight:h,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:m,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),of={lvl:0};function XO(e,t,n,r=of,o=of){return{k:e,v:t,lvl:n,l:r,r:o}}function er(e){return e===of}function du(){return of}function Qb(e,t){if(er(e))return of;const{k:n,l:r,r:o}=e;if(t===n){if(er(r))return o;if(er(o))return r;{const[s,i]=YO(r);return Dh(Ur(e,{k:s,v:i,l:JO(r)}))}}else return tt&&(c=c.concat(Xb(s,t,n))),r>=t&&r<=n&&c.push({k:r,v:o}),r<=n&&(c=c.concat(Xb(i,t,n))),c}function Rl(e){return er(e)?[]:[...Rl(e.l),{k:e.k,v:e.v},...Rl(e.r)]}function YO(e){return er(e.r)?[e.k,e.v]:YO(e.r)}function JO(e){return er(e.r)?e.l:Dh(Ur(e,{r:JO(e.r)}))}function Ur(e,t){return XO(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function y1(e){return er(e)||e.lvl>e.r.lvl}function t_(e){return Yb(e8(e))}function Dh(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(y1(t))return e8(Ur(e,{lvl:r-1}));if(!er(t)&&!er(t.r))return Ur(t.r,{l:Ur(t,{r:t.r.l}),r:Ur(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(y1(e))return Yb(Ur(e,{lvl:r-1}));if(!er(n)&&!er(n.l)){const o=n.l,s=y1(o)?n.lvl-1:n.lvl;return Ur(o,{l:Ur(e,{r:o.l,lvl:r-1}),r:Yb(Ur(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function c0(e,t,n){if(er(e))return[];const r=aa(e,t)[0];return wre(Xb(e,r,n))}function ZO(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function Yb(e){const{r:t,lvl:n}=e;return!er(t)&&!er(t.r)&&t.lvl===n&&t.r.lvl===n?Ur(t,{l:Ur(e,{r:t.l}),lvl:n+1}):e}function e8(e){const{l:t}=e;return!er(t)&&t.lvl===e.lvl?Ur(t,{r:Ur(e,{l:t.r})}):e}function Qm(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function t8(e,t,n){return e[Qm(e,t,n)]}function Sre(e,t,n,r){const o=Qm(e,t,r),s=Qm(e,n,r,o);return e.slice(o,s+1)}const v2=Un(()=>({recalcInProgress:at(!1)}),[],{singleton:!0});function kre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function n_(e,t){let n=0,r=0;for(;n=h||o===g)&&(e=Qb(e,h)):(p=g!==o,d=!0),m>i&&i>=h&&g!==o&&(e=os(e,i+1,g));p&&(e=os(e,s,o))}return[e,n]}function _re(){return{offsetTree:[],sizeTree:du(),groupOffsetTree:du(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function b2({index:e},t){return t===e?0:t0&&(t=Math.max(t,t8(e,r,b2).offset)),ZO(Sre(e,t,n,Ire),Pre)}function Jb(e,t,n,r){let o=e,s=0,i=0,c=0,d=0;if(t!==0){d=Qm(o,t-1,b2),c=o[d].offset;const h=aa(n,t-1);s=h[0],i=h[1],o.length&&o[d].size===aa(n,t)[1]&&(d-=1),o=o.slice(0,d+1)}else o=[];for(const{start:p,value:h}of c0(n,t,1/0)){const m=p-s,g=m*i+c+m*r;o.push({offset:g,size:h,index:p}),s=p,c=g,i=h}return{offsetTree:o,lastIndex:s,lastOffset:c,lastSize:i}}function Mre(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,is.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&er(s)&&t.length===2){const g=t[0].size,b=t[1].size;i=n.reduce((y,x)=>os(os(y,x,g),x+1,b),i)}else[i,c]=jre(i,t);if(i===s)return e;const{offsetTree:d,lastIndex:p,lastSize:h,lastOffset:m}=Jb(e.offsetTree,c,i,o);return{sizeTree:i,offsetTree:d,lastIndex:p,lastOffset:m,lastSize:h,groupOffsetTree:n.reduce((g,b)=>os(g,b,af(b,d,o)),du()),groupIndices:n}}function af(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=t8(t,e,b2),i=e-o,c=s*i+(i-1)*n+r;return c>0?c+n:c}function Ore(e){return typeof e.groupIndex<"u"}function n8(e,t,n){if(Ore(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=r8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function r8(e,t){if(!u0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function u0(e){return!er(e.groupOffsetTree)}function Rre(e){return Rl(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const Are={offsetHeight:"height",offsetWidth:"width"},Va=Un(([{log:e},{recalcInProgress:t}])=>{const n=Mn(),r=Mn(),o=Po(r,0),s=Mn(),i=Mn(),c=at(0),d=at([]),p=at(void 0),h=at(void 0),m=at((P,M)=>al(P,Are[M])),g=at(void 0),b=at(0),y=_re(),x=Po($e(n,mn(d,e,b),ka(Mre,y),hr()),y),C=Po($e(d,hr(),ka((P,M)=>({prev:P.current,current:M}),{prev:[],current:[]}),yt(({prev:P})=>P)),[]);Lt($e(d,tn(P=>P.length>0),mn(x,b),yt(([P,M,R])=>{const A=P.reduce((D,O,T)=>os(D,O,af(O,M.offsetTree,R)||T),du());return{...M,groupIndices:P,groupOffsetTree:A}})),x),Lt($e(r,mn(x),tn(([P,{lastIndex:M}])=>P[{startIndex:P,endIndex:M,size:R}])),n),Lt(p,h);const S=Po($e(p,yt(P=>P===void 0)),!0);Lt($e(h,tn(P=>P!==void 0&&er(ks(x).sizeTree)),yt(P=>[{startIndex:0,endIndex:0,size:P}])),n);const j=as($e(n,mn(x),ka(({sizes:P},[M,R])=>({changed:R!==P,sizes:R}),{changed:!1,sizes:y}),yt(P=>P.changed)));qn($e(c,ka((P,M)=>({diff:P.prev-M,prev:M}),{diff:0,prev:0}),yt(P=>P.diff)),P=>{const{groupIndices:M}=ks(x);if(P>0)dn(t,!0),dn(s,P+n_(P,M));else if(P<0){const R=ks(C);R.length>0&&(P-=n_(-P,R)),dn(i,P)}}),qn($e(c,mn(e)),([P,M])=>{P<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},is.ERROR)});const _=as(s);Lt($e(s,mn(x),yt(([P,M])=>{const R=M.groupIndices.length>0,A=[],D=M.lastSize;if(R){const O=sf(M.sizeTree,0);let T=0,Y=0;for(;T{let ee=Q.ranges;return Q.prevSize!==0&&(ee=[...Q.ranges,{startIndex:Q.prevIndex,endIndex:U+P-1,size:Q.prevSize}]),{ranges:ee,prevIndex:U+P,prevSize:L}},{ranges:A,prevIndex:P,prevSize:0}).ranges}return Rl(M.sizeTree).reduce((O,{k:T,v:Y})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+P-1,size:O.prevSize}],prevIndex:T+P,prevSize:Y}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const I=as($e(i,mn(x,b),yt(([P,{offsetTree:M},R])=>{const A=-P;return af(A,M,R)})));return Lt($e(i,mn(x,b),yt(([P,M,R])=>{if(M.groupIndices.length>0){if(er(M.sizeTree))return M;let D=du();const O=ks(C);let T=0,Y=0,z=0;for(;T<-P;){z=O[Y];const Q=O[Y+1]-z-1;Y++,T+=Q+1}if(D=Rl(M.sizeTree).reduce((Q,{k:U,v:L})=>os(Q,Math.max(0,U+P),L),D),T!==-P){const Q=sf(M.sizeTree,z);D=os(D,0,Q);const U=aa(M.sizeTree,-P+1)[1];D=os(D,1,U)}return{...M,sizeTree:D,...Jb(M.offsetTree,0,D,R)}}else{const D=Rl(M.sizeTree).reduce((O,{k:T,v:Y})=>os(O,Math.max(0,T+P),Y),du());return{...M,sizeTree:D,...Jb(M.offsetTree,0,D,R)}}})),x),{data:g,totalCount:r,sizeRanges:n,groupIndices:d,defaultItemSize:h,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:I,beforeUnshiftWith:_,firstItemIndex:c,gap:b,sizes:x,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:m}},br(ml,v2),{singleton:!0}),Dre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function o8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Dre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Gf=Un(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:c,headerHeight:d,footerHeight:p,fixedHeaderHeight:h,fixedFooterHeight:m},{log:g}])=>{const b=Mn(),y=at(0);let x=null,C=null,S=null;function j(){x&&(x(),x=null),S&&(S(),S=null),C&&(clearTimeout(C),C=null),dn(o,!1)}return Lt($e(b,mn(e,s,t,y,d,p,g),mn(r,h,m),yt(([[_,I,P,M,R,A,D,O],T,Y,z])=>{const W=o8(_),{align:Q,behavior:U,offset:L}=W,ee=M-1,K=n8(W,I,ee);let Z=af(K,I.offsetTree,T)+A;Q==="end"?(Z+=Y+aa(I.sizeTree,K)[1]-P+z,K===ee&&(Z+=D)):Q==="center"?Z+=(Y+aa(I.sizeTree,K)[1]-P+z)/2:Z-=R,L&&(Z+=L);const se=fe=>{j(),fe?(O("retrying to scroll to",{location:_},is.DEBUG),dn(b,_)):O("list did not change, scroll successful",{},is.DEBUG)};if(j(),U==="smooth"){let fe=!1;S=qn(n,G=>{fe=fe||G}),x=gi(c,()=>{se(fe)})}else x=gi($e(n,Tre(150)),se);return C=setTimeout(()=>{j()},1200),dn(o,!0),O("scrolling from index to",{index:K,top:Z,behavior:U},is.DEBUG),{top:Z,behavior:U}})),i),{scrollToIndex:b,topListHeight:y}},br(Va,Do,ml),{singleton:!0});function Tre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const lf="up",Ld="down",Nre="none",$re={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Lre=0,qf=Un(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=at(!1),c=at(!0),d=Mn(),p=Mn(),h=at(4),m=at(Lre),g=Po($e(e_($e(en(t),_u(1),ei(!0)),$e(en(t),_u(1),ei(!1),Zj(100))),hr()),!1),b=Po($e(e_($e(s,ei(!0)),$e(s,ei(!1),Zj(200))),hr()),!1);Lt($e(to(en(t),en(m)),yt(([j,_])=>j<=_),hr()),c),Lt($e(c,Ki(50)),p);const y=as($e(to(e,en(n),en(r),en(o),en(h)),ka((j,[{scrollTop:_,scrollHeight:I},P,M,R,A])=>{const D=_+P-I>-A,O={viewportHeight:P,scrollTop:_,scrollHeight:I};if(D){let Y,z;return _>j.state.scrollTop?(Y="SCROLLED_DOWN",z=j.state.scrollTop-_):(Y="SIZE_DECREASED",z=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:Y,scrollTopDelta:z}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Pj&&j.atBottom===_.atBottom))),x=Po($e(e,ka((j,{scrollTop:_,scrollHeight:I,viewportHeight:P})=>{if(KO(j.scrollHeight,I))return{scrollTop:_,scrollHeight:I,jump:0,changed:!1};{const M=I-(_+P)<1;return j.scrollTop!==_&&M?{scrollHeight:I,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:I,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),tn(j=>j.changed),yt(j=>j.jump)),0);Lt($e(y,yt(j=>j.atBottom)),i),Lt($e(i,Ki(50)),d);const C=at(Ld);Lt($e(e,yt(({scrollTop:j})=>j),hr(),ka((j,_)=>ks(b)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),C),Lt($e(e,Ki(50),ei(Nre)),C);const S=at(0);return Lt($e(g,tn(j=>!j),ei(0)),S),Lt($e(t,Ki(100),mn(g),tn(([j,_])=>!!_),ka(([j,_],[I])=>[_,I],[0,0]),yt(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:c,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:d,scrollDirection:C,atBottomThreshold:h,atTopThreshold:m,scrollVelocity:S,lastJumpDueToItemResize:x}},br(Do)),gl=Un(([{log:e}])=>{const t=at(!1),n=as($e(t,tn(r=>r),hr()));return qn(t,r=>{r&&ks(e)("props updated",{},is.DEBUG)}),{propsReady:t,didMount:n}},br(ml),{singleton:!0});function x2(e,t){e==0?t():requestAnimationFrame(()=>x2(e-1,t))}function y2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Kf=Un(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=at(!0),c=at(0),d=at(!1);return Lt($e(s,mn(c),tn(([p,h])=>!!h),ei(!1)),i),qn($e(to(t,s),mn(i,e,n,d),tn(([[,p],h,{sizeTree:m},g,b])=>p&&(!er(m)||h2(g))&&!h&&!b),mn(c)),([,p])=>{dn(d,!0),x2(3,()=>{gi(r,()=>dn(i,!0)),dn(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:c}},br(Va,Do,Gf,gl),{singleton:!0});function r_(e){return e?e==="smooth"?"smooth":"auto":!1}const zre=(e,t)=>typeof e=="function"?r_(e(t)):t&&r_(e),Fre=Un(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:c},{log:d},{scrollingInProgress:p}])=>{const h=at(!1),m=Mn();let g=null;function b(x){dn(o,{index:"LAST",align:"end",behavior:x})}qn($e(to($e(en(e),_u(1)),c),mn(en(h),n,s,p),yt(([[x,C],S,j,_,I])=>{let P=C&&_,M="auto";return P&&(M=zre(S,j||I),P=P&&!!M),{totalCount:x,shouldFollow:P,followOutputBehavior:M}}),tn(({shouldFollow:x})=>x)),({totalCount:x,followOutputBehavior:C})=>{g&&(g(),g=null),g=gi(t,()=>{ks(d)("following output to ",{totalCount:x},is.DEBUG),b(C),g=null})});function y(x){const C=gi(r,S=>{x&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(ks(d)("scrolling to bottom due to increased size",{},is.DEBUG),b("auto"))});setTimeout(C,100)}return qn($e(to(en(h),e,i),tn(([x,,C])=>x&&C),ka(({value:x},[,C])=>({refreshed:x===C,value:C}),{refreshed:!1,value:0}),tn(({refreshed:x})=>x),mn(h,e)),([,x])=>{y(x!==!1)}),qn(m,()=>{y(ks(h)!==!1)}),qn(to(en(h),r),([x,C])=>{x&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&b("auto")}),{followOutput:h,autoscrollToBottom:m}},br(Va,qf,Gf,Kf,gl,ml,Do));function Bre(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const s8=Un(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Mn(),i=Mn(),c=as($e(s,yt(Bre)));return Lt($e(c,yt(d=>d.totalCount)),e),Lt($e(c,yt(d=>d.groupIndices)),t),Lt($e(to(r,n,o),tn(([d,p])=>u0(p)),yt(([d,p,h])=>aa(p.groupOffsetTree,Math.max(d-h,0),"v")[0]),hr(),yt(d=>[d])),i),{groupCounts:s,topItemsIndexes:i}},br(Va,Do));function cf(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function a8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Xm="top",Ym="bottom",o_="none";function s_(e,t,n){return typeof e=="number"?n===lf&&t===Xm||n===Ld&&t===Ym?e:0:n===lf?t===Xm?e.main:e.reverse:t===Ym?e.main:e.reverse}function a_(e,t){return typeof e=="number"?e:e[t]||0}const C2=Un(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Mn(),i=at(0),c=at(0),d=at(0),p=Po($e(to(en(e),en(t),en(r),en(s,cf),en(d),en(i),en(o),en(n),en(c)),yt(([h,m,g,[b,y],x,C,S,j,_])=>{const I=h-j,P=C+S,M=Math.max(g-I,0);let R=o_;const A=a_(_,Xm),D=a_(_,Ym);return b-=j,b+=g+S,y+=g+S,y-=j,b>h+P-A&&(R=lf),yh!=null),hr(cf)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:i,increaseViewportBy:c,visibleRange:p}},br(Do),{singleton:!0});function Hre(e,t,n){if(u0(t)){const r=r8(e,t);return[{index:aa(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const i_={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function l_(e,t,n){if(e.length===0)return[];if(!u0(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=c0(t.groupOffsetTree,r,o);let c,d=0;for(const p of e){(!c||c.end0){p=e[0].offset;const x=e[e.length-1];h=x.offset+x.size}const m=n-d,g=c+m*i+(m-1)*r,b=p,y=g-h;return{items:l_(e,o,s),topItems:l_(t,o,s),topListHeight:t.reduce((x,C)=>C.size+x,0),offsetTop:p,offsetBottom:y,top:b,bottom:h,totalCount:n,firstItemIndex:s}}const ac=Un(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:c,topListHeight:d},{scrolledToInitialItem:p,initialTopMostItemIndex:h},{topListHeight:m},g,{didMount:b},{recalcInProgress:y}])=>{const x=at([]),C=Mn();Lt(s.topItemsIndexes,x);const S=Po($e(to(b,y,en(i,cf),en(t),en(e),en(h),p,en(x),en(r),en(o),n),tn(([P,M,,R,,,,,,,A])=>{const D=A&&A.length!==R;return P&&!M&&!D}),yt(([,,[P,M],R,A,D,O,T,Y,z,W])=>{const Q=A,{sizeTree:U,offsetTree:L}=Q;if(R===0||P===0&&M===0)return{...i_,totalCount:R};if(er(U))return Th(Hre(y2(D,R),Q,W),[],R,z,Q,Y);const ee=[];if(T.length>0){const G=T[0],te=T[T.length-1];let V=0;for(const F of c0(U,G,te)){const X=F.value,ue=Math.max(F.start,G),q=Math.min(F.end,te);for(let ne=ue;ne<=q;ne++)ee.push({index:ne,size:X,offset:V,data:W&&W[ne]}),V+=X}}if(!O)return Th([],ee,R,z,Q,Y);const K=T.length>0?T[T.length-1]+1:0,Z=Ere(L,P,M,K);if(Z.length===0)return null;const se=R-1,fe=l0([],G=>{for(const te of Z){const V=te.value;let F=V.offset,X=te.start;const ue=V.size;if(V.offset=M);ne++)G.push({index:ne,size:ue,offset:F,data:W&&W[ne]}),F+=ue+z}});return Th(fe,ee,R,z,Q,Y)}),tn(P=>P!==null),hr()),i_);Lt($e(n,tn(h2),yt(P=>P==null?void 0:P.length)),t),Lt($e(S,yt(P=>P.topListHeight)),m),Lt(m,d),Lt($e(S,yt(P=>[P.top,P.bottom])),c),Lt($e(S,yt(P=>P.items)),C);const j=as($e(S,tn(({items:P})=>P.length>0),mn(t,n),tn(([{items:P},M])=>P[P.length-1].originalIndex===M-1),yt(([,P,M])=>[P-1,M]),hr(cf),yt(([P])=>P))),_=as($e(S,Ki(200),tn(({items:P,topItems:M})=>P.length>0&&P[0].originalIndex===M.length),yt(({items:P})=>P[0].index),hr())),I=as($e(S,tn(({items:P})=>P.length>0),yt(({items:P})=>{let M=0,R=P.length-1;for(;P[M].type==="group"&&MM;)R--;return{startIndex:P[M].index,endIndex:P[R].index}}),hr(a8)));return{listState:S,topItemsIndexes:x,endReached:j,startReached:_,rangeChanged:I,itemsRendered:C,...g}},br(Va,s8,C2,Kf,Gf,qf,gl,v2),{singleton:!0}),Wre=Un(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const c=at(0);return Lt($e(i,mn(c),tn(([,d])=>d!==0),mn(o,e,t,r,n),yt(([[,d],p,h,m,g,b=[]])=>{let y=0;if(h.groupIndices.length>0)for(const j of h.groupIndices){if(j-y>=d)break;y++}const x=d+y,C=y2(p,x),S=Array.from({length:x}).map((j,_)=>({index:_+C,size:0,offset:0,data:b[_+C]}));return Th(S,[],x,g,h,m)})),s),{initialItemCount:c}},br(Va,Kf,ac,gl),{singleton:!0}),i8=Un(([{scrollVelocity:e}])=>{const t=at(!1),n=Mn(),r=at(!1);return Lt($e(e,mn(r,t,n),tn(([o,s])=>!!s),yt(([o,s,i,c])=>{const{exit:d,enter:p}=s;if(i){if(d(o,c))return!1}else if(p(o,c))return!0;return i}),hr()),t),qn($e(to(t,e,n),mn(r)),([[o,s,i],c])=>o&&c&&c.change&&c.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},br(qf),{singleton:!0}),Vre=Un(([{topItemsIndexes:e}])=>{const t=at(0);return Lt($e(t,tn(n=>n>0),yt(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},br(ac)),l8=Un(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Mn(),i=Po($e(to(e,r,t,n,o),yt(([c,d,p,h,m])=>c+d+p+h+m.offsetBottom+m.bottom)),0);return Lt(en(i),s),{totalListHeight:i,totalListHeightChanged:s}},br(Do,ac),{singleton:!0});function c8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const Ure=c8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Gre=Un(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:c},{listState:d},{beforeUnshiftWith:p,shiftWithOffset:h,sizes:m,gap:g},{log:b},{recalcInProgress:y}])=>{const x=as($e(d,mn(c),ka(([,S,j,_],[{items:I,totalCount:P,bottom:M,offsetBottom:R},A])=>{const D=M+R;let O=0;return j===P&&S.length>0&&I.length>0&&(I[0].originalIndex===0&&S[0].originalIndex===0||(O=D-_,O!==0&&(O+=A))),[O,I,P,D]},[0,[],0,0]),tn(([S])=>S!==0),mn(t,i,r,s,b,y),tn(([,S,j,_,,,I])=>!I&&!_&&S!==0&&j===lf),yt(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},is.DEBUG),S))));function C(S){S>0?(dn(e,{top:-S,behavior:"auto"}),dn(n,0)):(dn(n,0),dn(e,{top:-S,behavior:"auto"}))}return qn($e(x,mn(n,o)),([S,j,_])=>{_&&Ure()?dn(n,j-S):C(-S)}),qn($e(to(Po(o,!1),n,y),tn(([S,j,_])=>!S&&!_&&j!==0),yt(([S,j])=>j),Ki(1)),C),Lt($e(h,yt(S=>({top:-S}))),e),qn($e(p,mn(m,g),yt(([S,{lastSize:j,groupIndices:_,sizeTree:I},P])=>{function M(R){return R*(j+P)}if(_.length===0)return M(S);{let R=0;const A=sf(I,0);let D=0,O=0;for(;DS&&(R-=A,T=S-D+1),D+=T,R+=M(T),O++}return R}})),S=>{dn(n,S),requestAnimationFrame(()=>{dn(e,{top:S}),requestAnimationFrame(()=>{dn(n,0),dn(y,!1)})})}),{deviation:n}},br(Do,qf,ac,Va,ml,v2)),qre=Un(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=at(0);return qn($e(e,mn(r),tn(([,o])=>o!==0),yt(([,o])=>({top:o}))),o=>{gi($e(n,_u(1),tn(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{dn(t,o)})})}),{initialScrollTop:r}},br(gl,Do,ac),{singleton:!0}),Kre=Un(([{viewportHeight:e},{totalListHeight:t}])=>{const n=at(!1),r=Po($e(to(n,e,t),tn(([o])=>o),yt(([,o,s])=>Math.max(0,o-s)),Ki(0),hr()),0);return{alignToBottom:n,paddingTopAddition:r}},br(Do,l8),{singleton:!0}),w2=Un(([{scrollTo:e,scrollContainerState:t}])=>{const n=Mn(),r=Mn(),o=Mn(),s=at(!1),i=at(void 0);return Lt($e(to(n,r),yt(([{viewportHeight:c,scrollTop:d,scrollHeight:p},{offsetTop:h}])=>({scrollTop:Math.max(0,d-h),scrollHeight:p,viewportHeight:c}))),t),Lt($e(e,mn(r),yt(([c,{offsetTop:d}])=>({...c,top:c.top+d}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},br(Do)),Qre=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,Xre=Un(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:c,scrollingInProgress:d},{scrollToIndex:p}])=>{const h=Mn();return Lt($e(h,mn(e,o,t,s,i,c,r),mn(n),yt(([[m,g,b,y,x,C,S,j],_])=>{const{done:I,behavior:P,align:M,calculateViewLocation:R=Qre,...A}=m,D=n8(m,g,y-1),O=af(D,g.offsetTree,_)+x+C,T=O+aa(g.sizeTree,D)[1],Y=j+C,z=j+b-S,W=R({itemTop:O,itemBottom:T,viewportTop:Y,viewportBottom:z,locationParams:{behavior:P,align:M,...A}});return W?I&&gi($e(d,tn(Q=>Q===!1),_u(ks(d)?1:2)),I):I&&I(),W}),tn(m=>m!==null)),p),{scrollIntoView:h}},br(Va,Do,Gf,ac,ml),{singleton:!0}),Yre=Un(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:c}])=>{const d=Mn(),p=at(void 0),h=at(null),m=at(null);return Lt(i,h),Lt(c,m),qn($e(d,mn(e,n,s,h,m)),([g,b,y,x,C,S])=>{const j=Rre(b.sizeTree);x&&C!==null&&S!==null&&(y=C.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),Lt($e(p,tn(h2),yt(Jre)),r),Lt($e(o,mn(p),tn(([,g])=>g!==void 0),hr(),yt(([,g])=>g.ranges)),t),{getState:d,restoreStateFrom:p}},br(Va,Do,Kf,gl,w2));function Jre(e){return{offset:e.scrollTop,index:0,align:"start"}}const Zre=Un(([e,t,n,r,o,s,i,c,d,p])=>({...e,...t,...n,...r,...o,...s,...i,...c,...d,...p}),br(C2,Wre,gl,i8,l8,qre,Kre,w2,Xre,ml)),eoe=Un(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:c,groupIndices:d,statefulTotalCount:p,gap:h,sizes:m},{initialTopMostItemIndex:g,scrolledToInitialItem:b},y,x,C,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:I},P,{topItemCount:M},{groupCounts:R},A])=>(Lt(_.rangeChanged,A.scrollSeekRangeChanged),Lt($e(A.windowViewportRect,yt(D=>D.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:c,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:b,topItemsIndexes:j,topItemCount:M,groupCounts:R,fixedItemHeight:n,defaultItemHeight:r,gap:h,...C,statefulTotalCount:p,listState:S,scrollToIndex:I,trackItemSizes:o,itemSize:s,groupIndices:d,..._,...A,...y,sizes:m,...x}),br(Va,Kf,Do,Yre,Fre,ac,Gf,Gre,Vre,s8,Zre)),C1="-webkit-sticky",c_="sticky",u8=c8(()=>{if(typeof document>"u")return c_;const e=document.createElement("div");return e.style.position=C1,e.style.position===C1?C1:c_});function d8(e,t){const n=B.useRef(null),r=B.useCallback(c=>{if(c===null||!c.offsetParent)return;const d=c.getBoundingClientRect(),p=d.width;let h,m;if(t){const g=t.getBoundingClientRect(),b=d.top-g.top;h=g.height-Math.max(0,b),m=b+t.scrollTop}else h=window.innerHeight-Math.max(0,d.top),m=d.top+window.pageYOffset;n.current={offsetTop:m,visibleHeight:h,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=g2(r),i=B.useCallback(()=>{r(s.current)},[r,s]);return B.useEffect(()=>{if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(i);return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const f8=B.createContext(void 0),p8=B.createContext(void 0);function h8(e){return e}const toe=Un(()=>{const e=at(d=>`Item ${d}`),t=at(null),n=at(d=>`Group ${d}`),r=at({}),o=at(h8),s=at("div"),i=at(Uu),c=(d,p=null)=>Po($e(r,yt(h=>h[d]),hr()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:c("Footer"),HeaderComponent:c("Header"),TopItemListComponent:c("TopItemList"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),GroupComponent:c("Group","div"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder")}}),noe=Un(([e,t])=>({...e,...t}),br(eoe,toe)),roe=({height:e})=>B.createElement("div",{style:{height:e}}),ooe={position:u8(),zIndex:1,overflowAnchor:"none"},soe={overflowAnchor:"none"},u_=B.memo(function({showTopList:t=!1}){const n=kn("listState"),r=js("sizeRanges"),o=kn("useWindowScroll"),s=kn("customScrollParent"),i=js("windowScrollContainerState"),c=js("scrollContainerState"),d=s||o?i:c,p=kn("itemContent"),h=kn("context"),m=kn("groupContent"),g=kn("trackItemSizes"),b=kn("itemSize"),y=kn("log"),x=js("gap"),{callbackRef:C}=xre(r,b,g,t?Uu:d,y,x,s),[S,j]=B.useState(0);S2("deviation",W=>{S!==W&&j(W)});const _=kn("EmptyPlaceholder"),I=kn("ScrollSeekPlaceholder")||roe,P=kn("ListComponent"),M=kn("ItemComponent"),R=kn("GroupComponent"),A=kn("computeItemKey"),D=kn("isSeeking"),O=kn("groupIndices").length>0,T=kn("paddingTopAddition"),Y=kn("scrolledToInitialItem"),z=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...Y?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?B.createElement(_,Bo(_,h)):B.createElement(P,{...Bo(P,h),ref:C,style:z,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(W=>{const Q=W.originalIndex,U=A(Q+n.firstItemIndex,W.data,h);return D?B.createElement(I,{...Bo(I,h),key:U,index:W.index,height:W.size,type:W.type||"item",...W.type==="group"?{}:{groupIndex:W.groupIndex}}):W.type==="group"?B.createElement(R,{...Bo(R,h),key:U,"data-index":Q,"data-known-size":W.size,"data-item-index":W.index,style:ooe},m(W.index,h)):B.createElement(M,{...Bo(M,h),key:U,"data-index":Q,"data-known-size":W.size,"data-item-index":W.index,"data-item-group-index":W.groupIndex,item:W.data,style:soe},O?p(W.index,W.groupIndex,W.data,h):p(W.index,W.data,h))}))}),aoe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},d0={width:"100%",height:"100%",position:"absolute",top:0},ioe={width:"100%",position:u8(),top:0,zIndex:1};function Bo(e,t){if(typeof e!="string")return{context:t}}const loe=B.memo(function(){const t=kn("HeaderComponent"),n=js("headerHeight"),r=kn("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=kn("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null}),coe=B.memo(function(){const t=kn("FooterComponent"),n=js("footerHeight"),r=kn("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=kn("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null});function m8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return B.memo(function({style:s,children:i,...c}){const d=e("scrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("scrollerRef"),g=n("context"),{scrollerRef:b,scrollByCallback:y,scrollToCallback:x}=QO(d,h,p,m);return t("scrollTo",x),t("scrollBy",y),B.createElement(p,{ref:b,style:{...aoe,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...Bo(p,g)},i)})}function g8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return B.memo(function({style:s,children:i,...c}){const d=e("windowScrollContainerState"),p=n("ScrollerComponent"),h=e("smoothScrollTargetReached"),m=n("totalListHeight"),g=n("deviation"),b=n("customScrollParent"),y=n("context"),{scrollerRef:x,scrollByCallback:C,scrollToCallback:S}=QO(d,h,p,Uu,b);return gre(()=>(x.current=b||window,()=>{x.current=null}),[x,b]),t("windowScrollTo",S),t("scrollBy",C),B.createElement(p,{style:{position:"relative",...s,...m!==0?{height:m+g}:{}},"data-virtuoso-scroller":!0,...c,...Bo(p,y)},i)})}const uoe=({children:e})=>{const t=B.useContext(f8),n=js("viewportHeight"),r=js("fixedItemHeight"),o=sc(VO(n,s=>al(s,"height")));return B.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),B.createElement("div",{style:d0,ref:o,"data-viewport-type":"element"},e)},doe=({children:e})=>{const t=B.useContext(f8),n=js("windowViewportRect"),r=js("fixedItemHeight"),o=kn("customScrollParent"),s=d8(n,o);return B.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),B.createElement("div",{ref:s,style:d0,"data-viewport-type":"window"},e)},foe=({children:e})=>{const t=kn("TopItemListComponent"),n=kn("headerHeight"),r={...ioe,marginTop:`${n}px`},o=kn("context");return B.createElement(t||"div",{style:r,context:o},e)},poe=B.memo(function(t){const n=kn("useWindowScroll"),r=kn("topItemsIndexes").length>0,o=kn("customScrollParent"),s=o||n?goe:moe,i=o||n?doe:uoe;return B.createElement(s,{...t},r&&B.createElement(foe,null,B.createElement(u_,{showTopList:!0})),B.createElement(i,null,B.createElement(loe,null),B.createElement(u_,null),B.createElement(coe,null)))}),{Component:hoe,usePublisher:js,useEmitterValue:kn,useEmitter:S2}=qO(noe,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},poe),moe=m8({usePublisher:js,useEmitterValue:kn,useEmitter:S2}),goe=g8({usePublisher:js,useEmitterValue:kn,useEmitter:S2}),voe=hoe,d_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},boe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:f_,ceil:p_,floor:Jm,min:w1,max:zd}=Math;function xoe(e){return{...boe,items:e}}function h_(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function yoe(e,t){return e&&e.column===t.column&&e.row===t.row}function gh(e,t){return e&&e.width===t.width&&e.height===t.height}const Coe=Un(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:c,scrollContainerState:d,footerHeight:p,headerHeight:h},m,g,{propsReady:b,didMount:y},{windowViewportRect:x,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},I])=>{const P=at(0),M=at(0),R=at(d_),A=at({height:0,width:0}),D=at({height:0,width:0}),O=Mn(),T=Mn(),Y=at(0),z=at(null),W=at({row:0,column:0}),Q=Mn(),U=Mn(),L=at(!1),ee=at(0),K=at(!0),Z=at(!1);qn($e(y,mn(ee),tn(([F,X])=>!!X)),()=>{dn(K,!1),dn(M,0)}),qn($e(to(y,K,D,A,ee,Z),tn(([F,X,ue,q,,ne])=>F&&!X&&ue.height!==0&&q.height!==0&&!ne)),([,,,,F])=>{dn(Z,!0),x2(1,()=>{dn(O,F)}),gi($e(r),()=>{dn(n,[0,0]),dn(K,!0)})}),Lt($e(U,tn(F=>F!=null&&F.scrollTop>0),ei(0)),M),qn($e(y,mn(U),tn(([,F])=>F!=null)),([,F])=>{F&&(dn(A,F.viewport),dn(D,F==null?void 0:F.item),dn(W,F.gap),F.scrollTop>0&&(dn(L,!0),gi($e(r,_u(1)),X=>{dn(L,!1)}),dn(i,{top:F.scrollTop})))}),Lt($e(A,yt(({height:F})=>F)),o),Lt($e(to(en(A,gh),en(D,gh),en(W,(F,X)=>F&&F.column===X.column&&F.row===X.row),en(r)),yt(([F,X,ue,q])=>({viewport:F,item:X,gap:ue,scrollTop:q}))),Q),Lt($e(to(en(P),t,en(W,yoe),en(D,gh),en(A,gh),en(z),en(M),en(L),en(K),en(ee)),tn(([,,,,,,,F])=>!F),yt(([F,[X,ue],q,ne,pe,le,we,,ve,he])=>{const{row:Ne,column:De}=q,{height:qe,width:Mt}=ne,{width:ot}=pe;if(we===0&&(F===0||ot===0))return d_;if(Mt===0){const At=y2(he,F),_t=At===0?Math.max(we-1,0):At;return xoe(h_(At,_t,le))}const an=v8(ot,Mt,De);let pt,vt;ve?X===0&&ue===0&&we>0?(pt=0,vt=we-1):(pt=an*Jm((X+Ne)/(qe+Ne)),vt=an*p_((ue+Ne)/(qe+Ne))-1,vt=w1(F-1,zd(vt,an-1)),pt=w1(vt,zd(0,pt))):(pt=0,vt=-1);const ke=h_(pt,vt,le),{top:Be,bottom:Ot}=m_(pe,q,ne,ke),Ht=p_(F/an),ht=Ht*qe+(Ht-1)*Ne-Ot;return{items:ke,offsetTop:Be,offsetBottom:ht,top:Be,bottom:Ot,itemHeight:qe,itemWidth:Mt}})),R),Lt($e(z,tn(F=>F!==null),yt(F=>F.length)),P),Lt($e(to(A,D,R,W),tn(([F,X,{items:ue}])=>ue.length>0&&X.height!==0&&F.height!==0),yt(([F,X,{items:ue},q])=>{const{top:ne,bottom:pe}=m_(F,q,X,ue);return[ne,pe]}),hr(cf)),n);const se=at(!1);Lt($e(r,mn(se),yt(([F,X])=>X||F!==0)),se);const fe=as($e(en(R),tn(({items:F})=>F.length>0),mn(P,se),tn(([{items:F},X,ue])=>ue&&F[F.length-1].index===X-1),yt(([,F])=>F-1),hr())),G=as($e(en(R),tn(({items:F})=>F.length>0&&F[0].index===0),ei(0),hr())),te=as($e(en(R),mn(L),tn(([{items:F},X])=>F.length>0&&!X),yt(([{items:F}])=>({startIndex:F[0].index,endIndex:F[F.length-1].index})),hr(a8),Ki(0)));Lt(te,g.scrollSeekRangeChanged),Lt($e(O,mn(A,D,P,W),yt(([F,X,ue,q,ne])=>{const pe=o8(F),{align:le,behavior:we,offset:ve}=pe;let he=pe.index;he==="LAST"&&(he=q-1),he=zd(0,he,w1(q-1,he));let Ne=Zb(X,ne,ue,he);return le==="end"?Ne=f_(Ne-X.height+ue.height):le==="center"&&(Ne=f_(Ne-X.height/2+ue.height/2)),ve&&(Ne+=ve),{top:Ne,behavior:we}})),i);const V=Po($e(R,yt(F=>F.offsetBottom+F.bottom)),0);return Lt($e(x,yt(F=>({width:F.visibleWidth,height:F.visibleHeight}))),A),{data:z,totalCount:P,viewportDimensions:A,itemDimensions:D,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:c,windowViewportRect:x,windowScrollTo:_,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,deviation:Y,scrollContainerState:d,footerHeight:p,headerHeight:h,initialItemCount:M,gap:W,restoreStateFrom:U,...g,initialTopMostItemIndex:ee,gridState:R,totalListHeight:V,...m,startReached:G,endReached:fe,rangeChanged:te,stateChanged:Q,propsReady:b,stateRestoreInProgress:L,...I}},br(C2,Do,qf,i8,gl,w2,ml));function m_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Zb(e,t,n,r[0].index),i=Zb(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function Zb(e,t,n,r){const o=v8(e.width,n.width,t.column),s=Jm(r/o),i=s*n.height+zd(0,s-1)*t.row;return i>0?i+t.row:i}function v8(e,t,n){return zd(1,Jm((e+n)/(Jm(t)+n)))}const woe=Un(()=>{const e=at(p=>`Item ${p}`),t=at({}),n=at(null),r=at("virtuoso-grid-item"),o=at("virtuoso-grid-list"),s=at(h8),i=at("div"),c=at(Uu),d=(p,h=null)=>Po($e(t,yt(m=>m[p]),hr()),h);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:c,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),Soe=Un(([e,t])=>({...e,...t}),br(Coe,woe)),koe=B.memo(function(){const t=Sr("gridState"),n=Sr("listClassName"),r=Sr("itemClassName"),o=Sr("itemContent"),s=Sr("computeItemKey"),i=Sr("isSeeking"),c=ta("scrollHeight"),d=Sr("ItemComponent"),p=Sr("ListComponent"),h=Sr("ScrollSeekPlaceholder"),m=Sr("context"),g=ta("itemDimensions"),b=ta("gap"),y=Sr("log"),x=Sr("stateRestoreInProgress"),C=sc(S=>{const j=S.parentElement.parentElement.scrollHeight;c(j);const _=S.firstChild;if(_){const{width:I,height:P}=_.getBoundingClientRect();g({width:I,height:P})}b({row:g_("row-gap",getComputedStyle(S).rowGap,y),column:g_("column-gap",getComputedStyle(S).columnGap,y)})});return x?null:B.createElement(p,{ref:C,className:n,...Bo(p,m),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,m);return i?B.createElement(h,{key:j,...Bo(h,m),index:S.index,height:t.itemHeight,width:t.itemWidth}):B.createElement(d,{...Bo(d,m),className:r,"data-index":S.index,key:j},o(S.index,S.data,m))}))}),joe=B.memo(function(){const t=Sr("HeaderComponent"),n=ta("headerHeight"),r=Sr("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=Sr("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null}),_oe=B.memo(function(){const t=Sr("FooterComponent"),n=ta("footerHeight"),r=Sr("headerFooterTag"),o=sc(i=>n(al(i,"height"))),s=Sr("context");return t?B.createElement(r,{ref:o},B.createElement(t,Bo(t,s))):null}),Ioe=({children:e})=>{const t=B.useContext(p8),n=ta("itemDimensions"),r=ta("viewportDimensions"),o=sc(s=>{r(s.getBoundingClientRect())});return B.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),B.createElement("div",{style:d0,ref:o},e)},Poe=({children:e})=>{const t=B.useContext(p8),n=ta("windowViewportRect"),r=ta("itemDimensions"),o=Sr("customScrollParent"),s=d8(n,o);return B.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),B.createElement("div",{ref:s,style:d0},e)},Eoe=B.memo(function({...t}){const n=Sr("useWindowScroll"),r=Sr("customScrollParent"),o=r||n?Roe:Ooe,s=r||n?Poe:Ioe;return B.createElement(o,{...t},B.createElement(s,null,B.createElement(joe,null),B.createElement(koe,null),B.createElement(_oe,null)))}),{Component:Moe,usePublisher:ta,useEmitterValue:Sr,useEmitter:b8}=qO(Soe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},Eoe),Ooe=m8({usePublisher:ta,useEmitterValue:Sr,useEmitter:b8}),Roe=g8({usePublisher:ta,useEmitterValue:Sr,useEmitter:b8});function g_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,is.WARN),t==="normal"?0:parseInt(t??"0",10)}const Aoe=Moe,Doe=e=>{const t=H(s=>s.gallery.galleryView),{data:n}=kx(e),{data:r}=jx(e),o=l.useMemo(()=>t==="images"?n==null?void 0:n.total:r==null?void 0:r.total,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},Toe=({imageDTO:e})=>a.jsx(N,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ha,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),Noe=l.memo(Toe),k2=({postUploadAction:e,isDisabled:t})=>{const n=H(d=>d.gallery.autoAddBoardId),[r]=II(),o=l.useCallback(d=>{const p=d[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:c}=Oy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:c}},$oe=de(Ce,({generation:e})=>e.model,_e),f0=()=>{const e=oe(),t=Zl(),{t:n}=J(),r=H($oe),o=l.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=l.useCallback(G=>{t({title:n("toast.parameterNotSet"),description:G,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=l.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),c=l.useCallback(G=>{t({title:n("toast.parametersNotSet"),status:"warning",description:G,duration:2500,isClosable:!0})},[n,t]),d=l.useCallback((G,te,V,F)=>{if(Ap(G)||Dp(te)||pd(V)||Pv(F)){Ap(G)&&e(Rd(G)),Dp(te)&&e(Ad(te)),pd(V)&&e(Dd(V)),pd(F)&&e(Td(F)),o();return}s()},[e,o,s]),p=l.useCallback(G=>{if(!Ap(G)){s();return}e(Rd(G)),o()},[e,o,s]),h=l.useCallback(G=>{if(!Dp(G)){s();return}e(Ad(G)),o()},[e,o,s]),m=l.useCallback(G=>{if(!pd(G)){s();return}e(Dd(G)),o()},[e,o,s]),g=l.useCallback(G=>{if(!Pv(G)){s();return}e(Td(G)),o()},[e,o,s]),b=l.useCallback(G=>{if(!$w(G)){s();return}e(Lh(G)),o()},[e,o,s]),y=l.useCallback(G=>{if(!Ev(G)){s();return}e(zh(G)),o()},[e,o,s]),x=l.useCallback(G=>{if(!Lw(G)){s();return}e(z1(G)),o()},[e,o,s]),C=l.useCallback(G=>{if(!Mv(G)){s();return}e(F1(G)),o()},[e,o,s]),S=l.useCallback(G=>{if(!zw(G)&&!oi(G)){s();return}oi(G)?e(Wc(null)):e(Wc(G)),o()},[e,o,s]),j=l.useCallback(G=>{if(!Ov(G)){s();return}e(Fh(G)),o()},[e,o,s]),_=l.useCallback(G=>{if(!Fw(G)){s();return}e(Hl(G)),o()},[e,o,s]),I=l.useCallback(G=>{if(!Bw(G)){s();return}e(Wl(G)),o()},[e,o,s]),P=l.useCallback(G=>{if(!Tp(G)){s();return}e(Bh(G)),o()},[e,o,s]),M=l.useCallback(G=>{if(!Hw(G)){s();return}e(B1(G)),o()},[e,o,s]),R=l.useCallback(G=>{if(!Tp(G)){s();return}e(Hh(G)),o()},[e,o,s]),A=l.useCallback(G=>{if(!Ww(G)){s();return}e(H1(G)),o()},[e,o,s]),{data:D}=vf(void 0),O=l.useCallback(G=>{if(!$I(G.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:te,model_name:V}=G.lora,F=D?YD.getSelectors().selectById(D,`${te}/lora/${V}`):void 0;return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[D,r==null?void 0:r.base_model]),T=l.useCallback(G=>{const te=O(G);if(!te.lora){s(te.error);return}e(Vw({...te.lora,weight:G.weight})),o()},[O,e,o,s]),{data:Y}=_x(void 0),z=l.useCallback(G=>{if(!Wh(G.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:te,control_model:V,control_weight:F,begin_step_percent:X,end_step_percent:ue,control_mode:q,resize_mode:ne}=G,pe=Y?LI.getSelectors().selectById(Y,`${V.base_model}/controlnet/${V.model_name}`):void 0;if(!pe)return{controlnet:null,error:"ControlNet model is not installed"};if(!((pe==null?void 0:pe.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const we="none",ve=Oo.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:pe,weight:typeof F=="number"?F:hd.weight,beginStepPct:X||hd.beginStepPct,endStepPct:ue||hd.endStepPct,controlMode:q||hd.controlMode,resizeMode:ne||hd.resizeMode,controlImage:(te==null?void 0:te.image_name)||null,processedControlImage:(te==null?void 0:te.image_name)||null,processorType:we,processorNode:ve,shouldAutoConfig:!0,id:Jc()},error:null}},[Y,r==null?void 0:r.base_model]),W=l.useCallback(G=>{const te=z(G);if(!te.controlnet){s(te.error);return}e(wc(te.controlnet)),o()},[z,e,o,s]),{data:Q}=Ix(void 0),U=l.useCallback(G=>{if(!Wh(G.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:te,t2i_adapter_model:V,weight:F,begin_step_percent:X,end_step_percent:ue,resize_mode:q}=G,ne=Q?zI.getSelectors().selectById(Q,`${V.base_model}/t2i_adapter/${V.model_name}`):void 0;if(!ne)return{controlnet:null,error:"ControlNet model is not installed"};if(!((ne==null?void 0:ne.base_model)===(r==null?void 0:r.base_model)))return{t2iAdapter:null,error:"ControlNet incompatible with currently-selected model"};const le="none",we=Oo.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:ne,weight:typeof F=="number"?F:Np.weight,beginStepPct:X||Np.beginStepPct,endStepPct:ue||Np.endStepPct,resizeMode:q||Np.resizeMode,controlImage:(te==null?void 0:te.image_name)||null,processedControlImage:(te==null?void 0:te.image_name)||null,processorType:le,processorNode:we,shouldAutoConfig:!0,id:Jc()},error:null}},[r==null?void 0:r.base_model,Q]),L=l.useCallback(G=>{const te=U(G);if(!te.t2iAdapter){s(te.error);return}e(wc(te.t2iAdapter)),o()},[U,e,o,s]),{data:ee}=Px(void 0),K=l.useCallback(G=>{if(!JD(G==null?void 0:G.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:te,ip_adapter_model:V,weight:F,begin_step_percent:X,end_step_percent:ue}=G,q=ee?FI.getSelectors().selectById(ee,`${V.base_model}/ip_adapter/${V.model_name}`):void 0;return q?(q==null?void 0:q.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:Jc(),type:"ip_adapter",isEnabled:!0,controlImage:(te==null?void 0:te.image_name)??null,model:q,weight:F??Rv.weight,beginStepPct:X??Rv.beginStepPct,endStepPct:ue??Rv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[ee,r==null?void 0:r.base_model]),Z=l.useCallback(G=>{const te=K(G);if(!te.ipAdapter){s(te.error);return}e(wc(te.ipAdapter)),o()},[K,e,o,s]),se=l.useCallback(G=>{e(ig(G))},[e]),fe=l.useCallback(G=>{if(!G){c();return}const{cfg_scale:te,height:V,model:F,positive_prompt:X,negative_prompt:ue,scheduler:q,vae:ne,seed:pe,steps:le,width:we,strength:ve,hrf_enabled:he,hrf_strength:Ne,hrf_method:De,positive_style_prompt:qe,negative_style_prompt:Mt,refiner_model:ot,refiner_cfg_scale:an,refiner_steps:pt,refiner_scheduler:vt,refiner_positive_aesthetic_score:ke,refiner_negative_aesthetic_score:Be,refiner_start:Ot,loras:Ht,controlnets:je,ipAdapters:ht,t2iAdapters:At}=G;Ev(te)&&e(zh(te)),Lw(F)&&e(z1(F)),Ap(X)&&e(Rd(X)),Dp(ue)&&e(Ad(ue)),Mv(q)&&e(F1(q)),(zw(ne)||oi(ne))&&(oi(ne)?e(Wc(null)):e(Wc(ne))),$w(pe)&&e(Lh(pe)),Ov(le)&&e(Fh(le)),Fw(we)&&e(Hl(we)),Bw(V)&&e(Wl(V)),Tp(ve)&&e(Bh(ve)),Hw(he)&&e(B1(he)),Tp(Ne)&&e(Hh(Ne)),Ww(De)&&e(H1(De)),pd(qe)&&e(Dd(qe)),Pv(Mt)&&e(Td(Mt)),ZD(ot)&&e(BI(ot)),Ov(pt)&&e(W1(pt)),Ev(an)&&e(V1(an)),Mv(vt)&&e(HI(vt)),e7(ke)&&e(U1(ke)),t7(Be)&&e(G1(Be)),n7(Ot)&&e(q1(Ot)),e(r7()),Ht==null||Ht.forEach(_t=>{const Re=O(_t);Re.lora&&e(Vw({...Re.lora,weight:_t.weight}))}),e(MI()),je==null||je.forEach(_t=>{const Re=z(_t);Re.controlnet&&e(wc(Re.controlnet))}),ht==null||ht.forEach(_t=>{const Re=K(_t);Re.ipAdapter&&e(wc(Re.ipAdapter))}),At==null||At.forEach(_t=>{const Re=U(_t);Re.t2iAdapter&&e(wc(Re.t2iAdapter))}),i()},[e,i,c,O,z,K,U]);return{recallBothPrompts:d,recallPositivePrompt:p,recallNegativePrompt:h,recallSDXLPositiveStylePrompt:m,recallSDXLNegativeStylePrompt:g,recallSeed:b,recallCfgScale:y,recallModel:x,recallScheduler:C,recallVaeModel:S,recallSteps:j,recallWidth:_,recallHeight:I,recallStrength:P,recallHrfEnabled:M,recallHrfStrength:R,recallHrfMethod:A,recallLoRA:T,recallControlNet:W,recallIPAdapter:Z,recallT2IAdapter:L,recallAllParameters:fe,sendToImageToImage:se}},Loe=()=>l.useCallback(async t=>new Promise(n=>{const r=new Image;r.onload=()=>{const o=document.createElement("canvas");o.width=r.width,o.height=r.height;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),n(new Promise(i=>{o.toBlob(function(c){i(c)},"image/png")})))},r.crossOrigin=WI.get()?"use-credentials":"anonymous",r.src=t}),[]),x8=()=>{const e=Zl(),{t}=J(),n=Loe(),r=l.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=l.useCallback(async s=>{r||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const i=await n(s);if(!i)throw new Error("Unable to create Blob");o7(i),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(i){e({title:t("toast.problemCopyingImage"),description:String(i),status:"error",duration:2500,isClosable:!0})}},[n,r,t,e]);return{isClipboardAPIAvailable:r,copyImageToClipboard:o}};function zoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function Foe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function Boe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function j2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function Hoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function Woe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function Voe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function Uoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function Goe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function qoe(e){return Qe({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 _2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function I2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function y8(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}function Koe(e,t,n){var r=this,o=l.useRef(null),s=l.useRef(0),i=l.useRef(null),c=l.useRef([]),d=l.useRef(),p=l.useRef(),h=l.useRef(e),m=l.useRef(!0);l.useEffect(function(){h.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,x="maxWait"in n,C=x?Math.max(+n.maxWait||0,t):null;l.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var S=l.useMemo(function(){var j=function(A){var D=c.current,O=d.current;return c.current=d.current=null,s.current=A,p.current=h.current.apply(O,D)},_=function(A,D){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(A):setTimeout(A,D)},I=function(A){if(!m.current)return!1;var D=A-o.current;return!o.current||D>=t||D<0||x&&A-s.current>=C},P=function(A){return i.current=null,y&&c.current?j(A):(c.current=d.current=null,p.current)},M=function A(){var D=Date.now();if(I(D))return P(D);if(m.current){var O=t-(D-o.current),T=x?Math.min(O,C-(D-s.current)):O;_(A,T)}},R=function(){var A=Date.now(),D=I(A);if(c.current=[].slice.call(arguments),d.current=r,o.current=A,D){if(!i.current&&m.current)return s.current=o.current,_(M,t),b?j(o.current):p.current;if(x)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return R.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,c.current=o.current=d.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?P(Date.now()):p.current},R},[b,x,t,C,y,g]);return S}function Qoe(e,t){return e===t}function v_(e){return typeof e=="function"?function(){return e}:e}function P2(e,t,n){var r,o,s=n&&n.equalityFn||Qoe,i=(r=l.useState(v_(e)),o=r[1],[r[0],l.useCallback(function(m){return o(v_(m))},[])]),c=i[0],d=i[1],p=Koe(l.useCallback(function(m){return d(m)},[d]),t,n),h=l.useRef(e);return s(h.current,e)||(p(e),h.current=e),[c,p]}const E2=e=>{const t=H(s=>s.config.metadataFetchDebounce),[n]=P2(e,t??0),{data:r,isLoading:o}=VI(n??UI);return{metadata:r,isLoading:o}},Xoe=s7.injectEndpoints({endpoints:e=>({getWorkflow:e.query({query:t=>`workflows/i/${t}`,providesTags:(t,n,r)=>[{type:"Workflow",id:r}],transformResponse:t=>{if(t){const n=GI.safeParse(t);if(n.success)return n.data;Ci("images").warn("Problem parsing workflow")}}})})}),{useGetWorkflowQuery:Yoe}=Xoe,M2=e=>{const t=H(s=>s.config.workflowFetchDebounce),[n]=P2(e,t??0),{data:r,isLoading:o}=Yoe(n??UI);return{workflow:r,isLoading:o}};Ex("gallery/requestedBoardImagesDeletion");const Joe=Ex("gallery/sentImageToCanvas"),C8=Ex("gallery/sentImageToImg2Img"),Zoe=e=>{const{imageDTO:t}=e,n=oe(),{t:r}=J(),o=Zl(),s=jn("unifiedCanvas").isFeatureEnabled,i=Bg(Mx),{metadata:c,isLoading:d}=E2(t==null?void 0:t.image_name),{workflow:p,isLoading:h}=M2(t==null?void 0:t.workflow_id),[m]=Ox(),[g]=Rx(),{isClipboardAPIAvailable:b,copyImageToClipboard:y}=x8(),x=l.useCallback(()=>{t&&n(lg([t]))},[n,t]),{recallBothPrompts:C,recallSeed:S,recallAllParameters:j}=f0(),_=l.useCallback(()=>{C(c==null?void 0:c.positive_prompt,c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt)},[c==null?void 0:c.negative_prompt,c==null?void 0:c.positive_prompt,c==null?void 0:c.positive_style_prompt,c==null?void 0:c.negative_style_prompt,C]),I=l.useCallback(()=>{S(c==null?void 0:c.seed)},[c==null?void 0:c.seed,S]),P=l.useCallback(()=>{p&&n(Ax(p))},[n,p]),M=l.useCallback(()=>{n(C8()),n(ig(t))},[n,t]),R=l.useCallback(()=>{n(Joe()),rs.flushSync(()=>{n(ti("unifiedCanvas"))}),n(qI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),A=l.useCallback(()=>{j(c)},[c,j]),D=l.useCallback(()=>{n(KI([t])),n(Cx(!0))},[n,t]),O=l.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=l.useCallback(()=>{t&&m({imageDTOs:[t]})},[m,t]),Y=l.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(Vn,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(Ky,{}),children:r("common.openInNewTab")}),b&&a.jsx(Vn,{icon:a.jsx(Hu,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(Vn,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(Wu,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(Vn,{icon:h?a.jsx(vh,{}):a.jsx(j2,{}),onClickCapture:P,isDisabled:h||!p,children:r("nodes.loadWorkflow")}),a.jsx(Vn,{icon:d?a.jsx(vh,{}):a.jsx(XM,{}),onClickCapture:_,isDisabled:d||(c==null?void 0:c.positive_prompt)===void 0&&(c==null?void 0:c.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(Vn,{icon:d?a.jsx(vh,{}):a.jsx(YM,{}),onClickCapture:I,isDisabled:d||(c==null?void 0:c.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(Vn,{icon:d?a.jsx(vh,{}):a.jsx(FM,{}),onClickCapture:A,isDisabled:d||!c,children:r("parameters.useAll")}),a.jsx(Vn,{icon:a.jsx(yj,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(Vn,{icon:a.jsx(yj,{}),onClickCapture:R,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(Vn,{icon:a.jsx(UM,{}),onClickCapture:D,children:"Change Board"}),t.starred?a.jsx(Vn,{icon:i?i.off.icon:a.jsx(I2,{}),onClickCapture:Y,children:i?i.off.text:"Unstar Image"}):a.jsx(Vn,{icon:i?i.on.icon:a.jsx(_2,{}),onClickCapture:T,children:i?i.on.text:"Star Image"}),a.jsx(Vn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:x,children:r("gallery.deleteImage")})]})},w8=l.memo(Zoe),vh=()=>a.jsx(N,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(bi,{size:"xs"})}),ese=()=>{const{t:e}=J(),t=oe(),n=H(x=>x.gallery.selection),r=Bg(Mx),o=jn("bulkDownload").isFeatureEnabled,[s]=Ox(),[i]=Rx(),[c]=TI(),d=l.useCallback(()=>{t(KI(n)),t(Cx(!0))},[t,n]),p=l.useCallback(()=>{t(lg(n))},[t,n]),h=l.useCallback(()=>{s({imageDTOs:n})},[s,n]),m=l.useCallback(()=>{i({imageDTOs:n})},[i,n]),g=l.useCallback(async()=>{try{const x=await c({image_names:n.map(C=>C.image_name)}).unwrap();t(Bt({title:e("gallery.preparingDownload"),status:"success",...x.response?{description:x.response}:{}}))}catch{t(Bt({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,c,t]),b=l.useMemo(()=>n.every(x=>x.starred),[n]),y=l.useMemo(()=>n.every(x=>!x.starred),[n]);return a.jsxs(a.Fragment,{children:[b&&a.jsx(Vn,{icon:r?r.on.icon:a.jsx(_2,{}),onClickCapture:m,children:r?r.off.text:"Unstar All"}),(y||!b&&!y)&&a.jsx(Vn,{icon:r?r.on.icon:a.jsx(I2,{}),onClickCapture:h,children:r?r.on.text:"Star All"}),o&&a.jsx(Vn,{icon:a.jsx(Wu,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(Vn,{icon:a.jsx(UM,{}),onClickCapture:d,children:"Change Board"}),a.jsx(Vn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:p,children:"Delete Selection"})]})},tse=l.memo(ese),nse=de([Ce],({gallery:e})=>({selectionCount:e.selection.length}),_e),rse=({imageDTO:e,children:t})=>{const{selectionCount:n}=H(nse),r=l.useCallback(s=>{s.preventDefault()},[]),o=l.useCallback(()=>e?n>1?a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:r,children:a.jsx(tse,{})}):a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:r,children:a.jsx(w8,{imageDTO:e})}):null,[e,n,r]);return a.jsx(p2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:o,children:t})},ose=l.memo(rse),sse=e=>{const{data:t,disabled:n,...r}=e,o=l.useRef(Jc()),{attributes:s,listeners:i,setNodeRef:c}=Mne({id:o.current,disabled:n,data:t});return a.jsx(Te,{ref:c,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},ase=l.memo(sse),ise=a.jsx(zr,{as:Jg,sx:{boxSize:16}}),lse=a.jsx(qr,{icon:Ql}),cse=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:c=!1,minSize:d=24,postUploadAction:p,imageSx:h,fitContainer:m=!1,droppableData:g,draggableData:b,dropLabel:y,isSelected:x=!1,thumbnail:C=!1,noContentFallback:S=lse,uploadElement:j=ise,useThumbailFallback:_,withHoverOverlay:I=!1,children:P,onMouseOver:M,onMouseOut:R,dataTestId:A}=e,{colorMode:D}=wi(),[O,T]=l.useState(!1),Y=l.useCallback(L=>{M&&M(L),T(!0)},[M]),z=l.useCallback(L=>{R&&R(L),T(!1)},[R]),{getUploadButtonProps:W,getUploadInputProps:Q}=k2({postUploadAction:p,isDisabled:c}),U=c?{}:{cursor:"pointer",bg:Ke("base.200","base.700")(D),_hover:{bg:Ke("base.300","base.650")(D),color:Ke("base.500","base.300")(D)}};return a.jsx(ose,{imageDTO:t,children:L=>a.jsxs(N,{ref:L,onMouseOver:Y,onMouseOut:z,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:d||void 0,minH:d||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(N,{sx:{w:"full",h:"full",position:m?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(Si,{src:C?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(sre,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...h},"data-testid":A}),o&&a.jsx(Noe,{imageDTO:t}),a.jsx(f2,{isSelected:x,isHovered:I?O:!1})]}),!t&&!c&&a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{minH:d,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ke("base.500","base.500")(D),...U},...W(),children:[a.jsx("input",{...Q()}),j]})}),!t&&c&&S,t&&!i&&a.jsx(ase,{data:b,disabled:i||!t,onClick:r}),P,!s&&a.jsx(d2,{data:g,disabled:s,dropLabel:y})]})})},il=l.memo(cse),use=()=>a.jsx(Dg,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),dse=l.memo(use),fse=de([Ce,Dx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},_e),pse=e=>{const t=oe(),{queryArgs:n,selection:r}=H(fse),{imageDTOs:o}=QI(n,{selectFromResult:p=>({imageDTOs:p.data?a7.selectAll(p.data):[]})}),s=jn("multiselect").isFeatureEnabled,i=l.useCallback(p=>{var h;if(e){if(!s){t(md([e]));return}if(p.shiftKey){const m=e.image_name,g=(h=r[r.length-1])==null?void 0:h.image_name,b=o.findIndex(x=>x.image_name===g),y=o.findIndex(x=>x.image_name===m);if(b>-1&&y>-1){const x=Math.min(b,y),C=Math.max(b,y),S=o.slice(x,C+1);t(md(r.concat(S)))}}else p.ctrlKey||p.metaKey?r.some(m=>m.image_name===e.image_name)&&r.length>1?t(md(r.filter(m=>m.image_name!==e.image_name))):t(md(r.concat(e))):t(md([e]))}},[t,e,o,r,s]),c=l.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),d=l.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:d,isSelected:c,handleClick:i}},hse=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=di("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(tt,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},fu=l.memo(hse),mse=e=>{const t=oe(),{imageName:n}=e,{currentData:r}=Ps(n),o=H(M=>M.hotkeys.shift),{t:s}=J(),{handleClick:i,isSelected:c,selection:d,selectionCount:p}=pse(r),h=Bg(Mx),m=l.useCallback(M=>{M.stopPropagation(),r&&t(lg([r]))},[t,r]),g=l.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:d}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,d,p]),[b]=Ox(),[y]=Rx(),x=l.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||b({imageDTOs:[r]}))},[b,y,r]),[C,S]=l.useState(!1),j=l.useCallback(()=>{S(!0)},[]),_=l.useCallback(()=>{S(!1)},[]),I=l.useMemo(()=>{if(r!=null&&r.starred)return h?h.on.icon:a.jsx(I2,{size:"20"});if(!(r!=null&&r.starred)&&C)return h?h.off.icon:a.jsx(_2,{size:"20"})},[r==null?void 0:r.starred,C,h]),P=l.useMemo(()=>r!=null&&r.starred?h?h.off.text:"Unstar":r!=null&&r.starred?"":h?h.on.text:"Star",[r==null?void 0:r.starred,h]);return r?a.jsx(Te,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(N,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(il,{onClick:i,imageDTO:r,draggableData:g,isSelected:c,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(fu,{onClick:x,icon:I,tooltip:P}),C&&o&&a.jsx(fu,{onClick:m,icon:a.jsx(qo,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(dse,{})},gse=l.memo(mse),vse=Oe((e,t)=>a.jsx(Te,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),bse=l.memo(vse),xse=Oe((e,t)=>{const n=H(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(nl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),yse=l.memo(xse),Cse={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},wse=()=>{const{t:e}=J(),t=l.useRef(null),[n,r]=l.useState(null),[o,s]=u2(Cse),i=H(S=>S.gallery.selectedBoardId),{currentViewTotal:c}=Doe(i),d=H(Dx),{currentData:p,isFetching:h,isSuccess:m,isError:g}=QI(d),[b]=XI(),y=l.useMemo(()=>!p||!c?!1:p.ids.length{y&&b({...d,offset:(p==null?void 0:p.ids.length)??0,limit:YI})},[y,b,d,p==null?void 0:p.ids.length]),C=l.useCallback((S,j)=>a.jsx(gse,{imageName:j},j),[]);return l.useEffect(()=>{const{current:S}=t;return n&&S&&o({target:S,elements:{viewport:n}}),()=>{var j;return(j=s())==null?void 0:j.destroy()}},[n,o,s]),p?m&&(p==null?void 0:p.ids.length)===0?a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(qr,{label:e("gallery.noImagesInGallery"),icon:Ql})}):m&&p?a.jsxs(a.Fragment,{children:[a.jsx(Te,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(Aoe,{style:{height:"100%"},data:p.ids,endReached:x,components:{Item:bse,List:yse},scrollerRef:r,itemContent:C})}),a.jsx(Rt,{onClick:x,isDisabled:!y,isLoading:h,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${c})`})]}):g?a.jsx(Te,{sx:{w:"full",h:"full"},children:a.jsx(qr,{label:e("gallery.unableToLoad"),icon:oee})}):null:a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(qr,{label:e("gallery.loading"),icon:Ql})})},Sse=l.memo(wse),kse=de([Ce],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},_e),jse=()=>{const{t:e}=J(),t=l.useRef(null),n=l.useRef(null),{galleryView:r}=H(kse),o=oe(),{isOpen:s,onToggle:i}=ls({defaultIsOpen:!0}),c=l.useCallback(()=>{o(Uw("images"))},[o]),d=l.useCallback(()=>{o(Uw("assets"))},[o]);return a.jsxs(U5,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Te,{sx:{w:"full"},children:[a.jsxs(N,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(Qne,{isOpen:s,onToggle:i}),a.jsx(ore,{})]}),a.jsx(Te,{children:a.jsx(Gne,{isOpen:s})})]}),a.jsxs(N,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(N,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(tc,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(nc,{children:a.jsxs(zn,{isAttached:!0,sx:{w:"full"},children:[a.jsx(xo,{as:Rt,size:"sm",isChecked:r==="images",onClick:c,sx:{w:"full"},leftIcon:a.jsx(fee,{}),"data-testid":"images-tab",children:e("gallery.images")}),a.jsx(xo,{as:Rt,size:"sm",isChecked:r==="assets",onClick:d,sx:{w:"full"},leftIcon:a.jsx(kee,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx(Sse,{})]})]})},_se=l.memo(jse),Ise=()=>{const e=H(p=>p.system.isConnected),{data:t}=Fa(),[n,{isLoading:r}]=Tx(),o=oe(),{t:s}=J(),i=l.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),c=l.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(Bt({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Bt({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),d=l.useMemo(()=>!e||oi(i),[e,i]);return{cancelQueueItem:c,isLoading:r,currentQueueItemId:i,isDisabled:d}},Pse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:c,loadingText:d,sx:p})=>i?a.jsx(tt,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,sx:p,"data-testid":e}):a.jsx(Rt,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,loadingText:d??e,flexGrow:1,sx:p,"data-testid":e,children:e}),ic=l.memo(Pse),Ese=({asIconButton:e,sx:t})=>{const{t:n}=J(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Ise();return a.jsx(ic,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(ju,{}),onClick:r,colorScheme:"error",sx:t})},S8=l.memo(Ese),Mse=()=>{const{t:e}=J(),t=oe(),{data:n}=Fa(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=JI({fixedCacheKey:"clearQueue"}),i=l.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(Bt({title:e("queue.clearSucceeded"),status:"success"})),t(Nx(void 0)),t($x(void 0))}catch{t(Bt({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),c=l.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:c}},Ose=Oe((e,t)=>{const{t:n}=J(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:c,title:d,triggerComponent:p}=e,{isOpen:h,onOpen:m,onClose:g}=ls(),b=l.useRef(null),y=l.useCallback(()=>{o(),g()},[o,g]),x=l.useCallback(()=>{i&&i(),g()},[i,g]);return a.jsxs(a.Fragment,{children:[l.cloneElement(p,{onClick:m,ref:t}),a.jsx(Df,{isOpen:h,leastDestructiveRef:b,onClose:g,isCentered:!0,children:a.jsx(Ma,{children:a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:d}),a.jsx(Oa,{children:c}),a.jsxs(pi,{children:[a.jsx(Rt,{ref:b,onClick:x,children:s}),a.jsx(Rt,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),p0=l.memo(Ose),Rse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{clearQueue:r,isLoading:o,isDisabled:s}=Mse();return a.jsxs(p0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(ic,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(qo,{}),colorScheme:"error",sx:t}),children:[a.jsx(Se,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(Se,{children:n("queue.clearQueueAlertDialog2")})]})},O2=l.memo(Rse),Ase=()=>{const e=oe(),{t}=J(),n=H(p=>p.system.isConnected),{data:r}=Fa(),[o,{isLoading:s}]=ZI({fixedCacheKey:"pauseProcessor"}),i=l.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),c=l.useCallback(async()=>{if(i)try{await o().unwrap(),e(Bt({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(Bt({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),d=l.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},Dse=({asIconButton:e})=>{const{t}=J(),{pauseProcessor:n,isLoading:r,isDisabled:o}=Ase();return a.jsx(ic,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(bee,{}),onClick:n,colorScheme:"gold"})},k8=l.memo(Dse),Tse=de([Ce,ro],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:c}=t,{isConnected:d}=n,p=[];return d||p.push(on.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(on.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(on.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(h=>{if(!Rr(h))return;const m=r.nodeTemplates[h.data.type];if(!m){p.push(on.t("parameters.invoke.missingNodeTemplate"));return}const g=i7([h],r.edges);Kr(h.data.inputs,b=>{const y=m.inputs[b.name],x=g.some(C=>C.target===h.id&&C.targetHandle===b.name);if(!y){p.push(on.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&b.value===void 0&&!x){p.push(on.t("parameters.invoke.missingInputForField",{nodeLabel:h.data.label||m.title,fieldLabel:b.label||y.title}));return}})})):(o.prompts.length===0&&p.push(on.t("parameters.invoke.noPrompts")),c||p.push(on.t("parameters.invoke.noModelSelected")),l7(e).forEach((h,m)=>{h.isEnabled&&(h.model?h.model.base_model!==(c==null?void 0:c.base_model)&&p.push(on.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:m+1})):p.push(on.t("parameters.invoke.noModelForControlAdapter",{number:m+1})),(!h.controlImage||Au(h)&&!h.processedControlImage&&h.processorType!=="none")&&p.push(on.t("parameters.invoke.noControlImageForControlAdapter",{number:m+1})))})),{isReady:!p.length,reasons:p}},_e),R2=()=>{const{isReady:e,reasons:t}=H(Tse);return{isReady:e,reasons:t}},j8=()=>{const e=oe(),t=H(ro),{isReady:n}=R2(),[r,{isLoading:o}]=cg({fixedCacheKey:"enqueueBatch"}),s=l.useMemo(()=>!n,[n]);return{queueBack:l.useCallback(()=>{s||(e(Lx()),e(eP({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},Nse=de([Ce],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},_e),$se=({prepend:e=!1})=>{const{t}=J(),{isReady:n,reasons:r}=R2(),{autoAddBoardId:o}=H(Nse),s=a0(o),[i,{isLoading:c}]=cg({fixedCacheKey:"enqueueBatch"}),d=l.useMemo(()=>t(c?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[c,n,e,t]);return a.jsxs(N,{flexDir:"column",gap:1,children:[a.jsx(Se,{fontWeight:600,children:d}),r.length>0&&a.jsx(Mf,{children:r.map((p,h)=>a.jsx(ws,{children:a.jsx(Se,{fontWeight:400,children:p})},`${p}.${h}`))}),a.jsx(I8,{}),a.jsxs(Se,{fontWeight:400,fontStyle:"oblique 10deg",children:[t("parameters.invoke.addingImagesTo")," ",a.jsx(Se,{as:"span",fontWeight:600,children:s||t("boards.uncategorized")})]})]})},_8=l.memo($se),I8=l.memo(()=>a.jsx(no,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));I8.displayName="StyledDivider";const Lse=()=>a.jsx(Te,{pos:"relative",w:4,h:4,children:a.jsx(Si,{src:wx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),zse=l.memo(Lse),Fse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueBack:r,isLoading:o,isDisabled:s}=j8();return a.jsx(ic,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{}),sx:t,icon:e?a.jsx(zse,{}):void 0})},P8=l.memo(Fse),E8=()=>{const e=oe(),t=H(ro),{isReady:n}=R2(),[r,{isLoading:o}]=cg({fixedCacheKey:"enqueueBatch"}),s=jn("prependQueue").isFeatureEnabled,i=l.useMemo(()=>!n||!s,[n,s]);return{queueFront:l.useCallback(()=>{i||(e(Lx()),e(eP({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},Bse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueFront:r,isLoading:o,isDisabled:s}=E8();return a.jsx(ic,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{prepend:!0}),icon:a.jsx(Foe,{}),sx:t})},Hse=l.memo(Bse),Wse=()=>{const e=oe(),t=H(p=>p.system.isConnected),{data:n}=Fa(),{t:r}=J(),[o,{isLoading:s}]=tP({fixedCacheKey:"resumeProcessor"}),i=l.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),c=l.useCallback(async()=>{if(!i)try{await o().unwrap(),e(Bt({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(Bt({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),d=l.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:c,isLoading:s,isStarted:i,isDisabled:d}},Vse=({asIconButton:e})=>{const{t}=J(),{resumeProcessor:n,isLoading:r,isDisabled:o}=Wse();return a.jsx(ic,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(xee,{}),onClick:n,colorScheme:"green"})},M8=l.memo(Vse),Use=de(Ce,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},_e),Gse=()=>{const{t:e}=J(),{data:t}=Fa(),{hasSteps:n,value:r,isConnected:o}=H(Use);return a.jsx(k3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},qse=l.memo(Gse),Kse=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled,n=jn("prependQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsxs(zn,{isAttached:!0,flexGrow:2,children:[a.jsx(P8,{}),n?a.jsx(Hse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(S8,{asIconButton:!0})]}),a.jsxs(zn,{isAttached:!0,children:[t?a.jsx(M8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(k8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(O2,{asIconButton:!0})]}),a.jsx(N,{h:3,w:"full",children:a.jsx(qse,{})}),a.jsx(R8,{})]})},O8=l.memo(Kse),R8=l.memo(()=>{const{t:e}=J(),t=oe(),{hasItems:n,pending:r}=Fa(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:c}=s.queue;return{hasItems:i+c>0,pending:i}}}),o=l.useCallback(()=>{t(ti("queue"))},[t]);return a.jsxs(N,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ji,{}),a.jsx(tl,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});R8.displayName="QueueCounts";const{createElement:Iu,createContext:Qse,forwardRef:A8,useCallback:Ja,useContext:D8,useEffect:ui,useImperativeHandle:T8,useLayoutEffect:Xse,useMemo:Yse,useRef:ns,useState:Fd}=yx,b_=yx["useId".toString()],Bd=Xse,Jse=typeof b_=="function"?b_:()=>null;let Zse=0;function A2(e=null){const t=Jse(),n=ns(e||t||null);return n.current===null&&(n.current=""+Zse++),n.current}const h0=Qse(null);h0.displayName="PanelGroupContext";function N8({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:c=null,minSize:d,onCollapse:p=null,onResize:h=null,order:m=null,style:g={},tagName:b="div"}){const y=D8(h0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const x=A2(i),{collapsePanel:C,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:I,resizePanel:P,units:M,unregisterPanel:R}=y;d==null&&(M==="percentages"?d=10:d=0);const A=ns({onCollapse:p,onResize:h});ui(()=>{A.current.onCollapse=p,A.current.onResize=h});const D=_(x,o),O=ns({size:x_(D)}),T=ns({callbacksRef:A,collapsedSize:n,collapsible:r,defaultSize:o,id:x,idWasAutoGenerated:i==null,maxSize:c,minSize:d,order:m});return Bd(()=>{O.current.size=x_(D),T.current.callbacksRef=A,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=x,T.current.idWasAutoGenerated=i==null,T.current.maxSize=c,T.current.minSize=d,T.current.order=m}),Bd(()=>(I(x,T),()=>{R(x)}),[m,x,I,R]),T8(s,()=>({collapse:()=>C(x),expand:()=>S(x),getCollapsed(){return O.current.size===0},getId(){return x},getSize(Y){return j(x,Y)},resize:(Y,z)=>P(x,Y,z)}),[C,S,j,x,P]),Iu(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":x,"data-panel-size":parseFloat(""+D.flexGrow).toFixed(1),id:`data-panel-id-${x}`,style:{...D,...g}})}const Zi=A8((e,t)=>Iu(N8,{...e,forwardedRef:t}));N8.displayName="Panel";Zi.displayName="forwardRef(Panel)";function x_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Jl=10;function Ed(e,t,n,r,o,s,i,c){const{id:d,panels:p,units:h}=t,m=h==="pixels"?Vi(d):NaN,{sizes:g}=c||{},b=g||s,y=Fo(p),x=b.concat();let C=0;{const _=o<0?r:n,I=y.findIndex(A=>A.current.id===_),P=y[I],M=b[I],R=ex(h,m,P,M,M+Math.abs(o),e);if(M===R)return b;R===0&&M>0&&i.set(_,M),o=o<0?M-R:R-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],I=b[j],P=Math.abs(o)-Math.abs(C),M=ex(h,m,_,I,I-P,e);if(I!==M&&(M===0&&I>0&&i.set(_.current.id,I),C+=I-M,x[j]=M,C.toPrecision(Jl).localeCompare(Math.abs(o).toPrecision(Jl),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return C===0?b:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),x[j]=b[j]+C,x)}function Ac(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:c,collapsible:d,id:p}=s.current,h=n[p];if(h!==r){n[p]=r;const{onCollapse:m,onResize:g}=i.current;g&&g(r,h),d&&m&&((h==null||h===c)&&r!==c?m(!1):h!==c&&r===c&&m(!0))}})}function eae({groupId:e,panels:t,units:n}){const r=n==="pixels"?Vi(e):NaN,o=Fo(t),s=Array(o.length);let i=0,c=100;for(let d=0;di.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Vi(e){const t=uf(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=D2(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function $8(e,t,n){if(e.size===1)return"100";const o=Fo(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Jl)}function tae(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function uf(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function m0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function nae(e){return L8().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function L8(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function D2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function T2(e,t,n){var d,p,h,m;const r=m0(t),o=D2(e),s=r?o.indexOf(r):-1,i=((p=(d=n[s])==null?void 0:d.current)==null?void 0:p.id)??null,c=((m=(h=n[s+1])==null?void 0:h.current)==null?void 0:m.id)??null;return[i,c]}function Fo(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function ex(e,t,n,r,o,s=null){var h;let{collapsedSize:i,collapsible:c,maxSize:d,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,d!=null&&(d=d/t*100),p=p/t*100),c){if(r>i){if(o<=p/2+i)return i}else if(!((h=s==null?void 0:s.type)==null?void 0:h.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function k1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Fo(t),i=o==="pixels"?Vi(e):NaN;let c=0;for(let d=0;d{const{direction:i,panels:c}=e.current,d=uf(t);z8(d!=null,`No group found for id "${t}"`);const{height:p,width:h}=d.getBoundingClientRect(),g=D2(t).map(b=>{const y=b.getAttribute("data-panel-resize-handle-id"),x=Fo(c),[C,S]=T2(t,y,x);if(C==null||S==null)return()=>{};let j=0,_=100,I=0,P=0;x.forEach(T=>{const{id:Y,maxSize:z,minSize:W}=T.current;Y===C?(j=W,_=z??100):(I+=W,P+=z??100)});const M=Math.min(_,100-I),R=Math.max(j,(x.length-1)*100-P),A=$8(c,C,o);b.setAttribute("aria-valuemax",""+Math.round(M)),b.setAttribute("aria-valuemin",""+Math.round(R)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(A)));const D=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const Y=x.findIndex(z=>z.current.id===C);if(Y>=0){const z=x[Y],W=o[Y];if(W!=null){let Q=0;W.toPrecision(Jl)<=z.current.minSize.toPrecision(Jl)?Q=i==="horizontal"?h:p:Q=-(i==="horizontal"?h:p);const U=Ed(T,e.current,C,S,Q,o,s.current,null);o!==U&&r(U)}}break}}};b.addEventListener("keydown",D);const O=tae(C);return O!=null&&b.setAttribute("aria-controls",O.id),()=>{b.removeAttribute("aria-valuemax"),b.removeAttribute("aria-valuemin"),b.removeAttribute("aria-valuenow"),b.removeEventListener("keydown",D),O!=null&&b.removeAttribute("aria-controls")}});return()=>{g.forEach(b=>b())}},[e,t,n,s,r,o])}function sae({disabled:e,handleId:t,resizeHandler:n}){ui(()=>{if(e||n==null)return;const r=m0(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=L8(),c=nae(t);z8(c!==null);const d=s.shiftKey?c>0?c-1:i.length-1:c+1{r.removeEventListener("keydown",o)}},[e,t,n])}function j1(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===I),M=r[P];if(M.current.collapsible){const R=h[P];(R===0||R.toPrecision(Jl)===M.current.minSize.toPrecision(Jl))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return F8(e,n,o,c,d)}function iae(e){return e.type==="keydown"}function tx(e){return e.type.startsWith("mouse")}function nx(e){return e.type.startsWith("touch")}let rx=null,Al=null;function B8(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function lae(){Al!==null&&(document.head.removeChild(Al),rx=null,Al=null)}function _1(e){if(rx===e)return;rx=e;const t=B8(e);Al===null&&(Al=document.createElement("style"),document.head.appendChild(Al)),Al.innerHTML=`*{cursor: ${t}!important;}`}function cae(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function H8(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function W8(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function uae(e,t,n){const r=W8(e,n);if(r){const o=H8(t);return r[o]??null}return null}function dae(e,t,n,r){const o=H8(t),s=W8(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const I1={};function y_(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Md={getItem:e=>(y_(Md),Md.getItem(e)),setItem:(e,t)=>{y_(Md),Md.setItem(e,t)}};function V8({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:c,storage:d=Md,style:p={},tagName:h="div",units:m="percentages"}){const g=A2(i),[b,y]=Fd(null),[x,C]=Fd(new Map),S=ns(null);ns({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=ns({onLayout:c});ui(()=>{j.current.onLayout=c});const _=ns({}),[I,P]=Fd([]),M=ns(new Map),R=ns(0),A=ns({direction:r,id:g,panels:x,sizes:I,units:m});T8(s,()=>({getId:()=>g,getLayout:K=>{const{sizes:Z,units:se}=A.current;if((K??se)==="pixels"){const G=Vi(g);return Z.map(te=>te/100*G)}else return Z},setLayout:(K,Z)=>{const{id:se,panels:fe,sizes:G,units:te}=A.current;if((Z||te)==="pixels"){const ue=Vi(se);K=K.map(q=>q/ue*100)}const V=_.current,F=Fo(fe),X=k1({groupId:se,panels:fe,nextSizes:K,prevSizes:G,units:te});j1(G,X)||(P(X),Ac(F,X,V))}}),[g]),Bd(()=>{A.current.direction=r,A.current.id=g,A.current.panels=x,A.current.sizes=I,A.current.units=m}),oae({committedValuesRef:A,groupId:g,panels:x,setSizes:P,sizes:I,panelSizeBeforeCollapse:M}),ui(()=>{const{onLayout:K}=j.current,{panels:Z,sizes:se}=A.current;if(se.length>0){K&&K(se);const fe=_.current,G=Fo(Z);Ac(G,se,fe)}},[I]),Bd(()=>{const{id:K,sizes:Z,units:se}=A.current;if(Z.length===x.size)return;let fe=null;if(e){const G=Fo(x);fe=uae(e,G,d)}if(fe!=null){const G=k1({groupId:K,panels:x,nextSizes:fe,prevSizes:fe,units:se});P(G)}else{const G=eae({groupId:K,panels:x,units:se});P(G)}},[e,x,d]),ui(()=>{if(e){if(I.length===0||I.length!==x.size)return;const K=Fo(x);I1[e]||(I1[e]=cae(dae,100)),I1[e](e,K,I,d)}},[e,x,I,d]),Bd(()=>{if(m==="pixels"){const K=new ResizeObserver(()=>{const{panels:Z,sizes:se}=A.current,fe=k1({groupId:g,panels:Z,nextSizes:se,prevSizes:se,units:m});j1(se,fe)||P(fe)});return K.observe(uf(g)),()=>{K.disconnect()}}},[g,m]);const D=Ja((K,Z)=>{const{panels:se,units:fe}=A.current,te=Fo(se).findIndex(X=>X.current.id===K),V=I[te];if((Z??fe)==="pixels"){const X=Vi(g);return V/100*X}else return V},[g,I]),O=Ja((K,Z)=>{const{panels:se}=A.current;return se.size===0?{flexBasis:0,flexGrow:Z??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:$8(se,K,I),flexShrink:1,overflow:"hidden",pointerEvents:o&&b!==null?"none":void 0}},[b,o,I]),T=Ja((K,Z)=>{const{units:se}=A.current;rae(se,Z),C(fe=>{if(fe.has(K))return fe;const G=new Map(fe);return G.set(K,Z),G})},[]),Y=Ja(K=>se=>{se.preventDefault();const{direction:fe,panels:G,sizes:te}=A.current,V=Fo(G),[F,X]=T2(g,K,V);if(F==null||X==null)return;let ue=aae(se,g,K,V,fe,te,S.current);if(ue===0)return;const ne=uf(g).getBoundingClientRect(),pe=fe==="horizontal";document.dir==="rtl"&&pe&&(ue=-ue);const le=pe?ne.width:ne.height,we=ue/le*100,ve=Ed(se,A.current,F,X,we,te,M.current,S.current),he=!j1(te,ve);if((tx(se)||nx(se))&&R.current!=we&&_1(he?pe?"horizontal":"vertical":pe?ue<0?"horizontal-min":"horizontal-max":ue<0?"vertical-min":"vertical-max"),he){const Ne=_.current;P(ve),Ac(V,ve,Ne)}R.current=we},[g]),z=Ja(K=>{C(Z=>{if(!Z.has(K))return Z;const se=new Map(Z);return se.delete(K),se})},[]),W=Ja(K=>{const{panels:Z,sizes:se}=A.current,fe=Z.get(K);if(fe==null)return;const{collapsedSize:G,collapsible:te}=fe.current;if(!te)return;const V=Fo(Z),F=V.indexOf(fe);if(F<0)return;const X=se[F];if(X===G)return;M.current.set(K,X);const[ue,q]=S1(K,V);if(ue==null||q==null)return;const pe=F===V.length-1?X:G-X,le=Ed(null,A.current,ue,q,pe,se,M.current,null);if(se!==le){const we=_.current;P(le),Ac(V,le,we)}},[]),Q=Ja(K=>{const{panels:Z,sizes:se}=A.current,fe=Z.get(K);if(fe==null)return;const{collapsedSize:G,minSize:te}=fe.current,V=M.current.get(K)||te;if(!V)return;const F=Fo(Z),X=F.indexOf(fe);if(X<0||se[X]!==G)return;const[q,ne]=S1(K,F);if(q==null||ne==null)return;const le=X===F.length-1?G-V:V,we=Ed(null,A.current,q,ne,le,se,M.current,null);if(se!==we){const ve=_.current;P(we),Ac(F,we,ve)}},[]),U=Ja((K,Z,se)=>{const{id:fe,panels:G,sizes:te,units:V}=A.current;if((se||V)==="pixels"){const Mt=Vi(fe);Z=Z/Mt*100}const F=G.get(K);if(F==null)return;let{collapsedSize:X,collapsible:ue,maxSize:q,minSize:ne}=F.current;if(V==="pixels"){const Mt=Vi(fe);ne=ne/Mt*100,q!=null&&(q=q/Mt*100)}const pe=Fo(G),le=pe.indexOf(F);if(le<0)return;const we=te[le];if(we===Z)return;ue&&Z===X||(Z=Math.min(q??100,Math.max(ne,Z)));const[ve,he]=S1(K,pe);if(ve==null||he==null)return;const De=le===pe.length-1?we-Z:Z-we,qe=Ed(null,A.current,ve,he,De,te,M.current,null);if(te!==qe){const Mt=_.current;P(qe),Ac(pe,qe,Mt)}},[]),L=Yse(()=>({activeHandleId:b,collapsePanel:W,direction:r,expandPanel:Q,getPanelSize:D,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:Y,resizePanel:U,startDragging:(K,Z)=>{if(y(K),tx(Z)||nx(Z)){const se=m0(K);S.current={dragHandleRect:se.getBoundingClientRect(),dragOffset:F8(Z,K,r),sizes:A.current.sizes}}},stopDragging:()=>{lae(),y(null),S.current=null},units:m,unregisterPanel:z}),[b,W,r,Q,D,O,g,T,Y,U,m,z]),ee={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Iu(h0.Provider,{children:Iu(h,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":m,style:{...ee,...p}}),value:L})}const g0=A8((e,t)=>Iu(V8,{...e,forwardedRef:t}));V8.displayName="PanelGroup";g0.displayName="forwardRef(PanelGroup)";function ox({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const c=ns(null),d=ns({onDragging:o});ui(()=>{d.current.onDragging=o});const p=D8(h0);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:h,direction:m,groupId:g,registerResizeHandle:b,startDragging:y,stopDragging:x}=p,C=A2(r),S=h===C,[j,_]=Fd(!1),[I,P]=Fd(null),M=Ja(()=>{c.current.blur(),x();const{onDragging:D}=d.current;D&&D(!1)},[x]);ui(()=>{if(n)P(null);else{const A=b(C);P(()=>A)}},[n,C,b]),ui(()=>{if(n||I==null||!S)return;const A=Y=>{I(Y)},D=Y=>{I(Y)},T=c.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",A),T.body.addEventListener("touchmove",A),T.body.addEventListener("mouseleave",D),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",A),T.body.removeEventListener("touchmove",A),T.body.removeEventListener("mouseleave",D),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[m,n,S,I,M]),sae({disabled:n,handleId:C,resizeHandler:I});const R={cursor:B8(m),touchAction:"none",userSelect:"none"};return Iu(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":m,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":C,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:A=>{y(C,A.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:A=>{y(C,A.nativeEvent);const{onDragging:D}=d.current;D&&D(!0)},ref:c,role:"separator",style:{...R,...s},tabIndex:0})}ox.displayName="PanelResizeHandle";const fae=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=di("base.100","base.850"),i=di("base.300","base.700");return t==="horizontal"?a.jsx(ox,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Te,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(ox,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(N,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Te,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},Zm=l.memo(fae),N2=()=>{const e=oe(),t=H(o=>o.ui.panels),n=l.useCallback(o=>t[o]??"",[t]),r=l.useCallback((o,s)=>{e(c7({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const pae=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=l.useMemo(()=>u7(n)?n:JSON.stringify(n,null,2),[n]),c=l.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),d=l.useCallback(()=>{const h=new Blob([i]),m=document.createElement("a");m.href=URL.createObjectURL(h),m.download=`${r||t}.json`,document.body.appendChild(m),m.click(),m.remove()},[i,t,r]),{t:p}=J();return a.jsxs(N,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Te,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(N,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Fn,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(_a,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(Wu,{}),variant:"ghost",opacity:.7,onClick:d})}),s&&a.jsx(Fn,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(_a,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hu,{}),variant:"ghost",opacity:.7,onClick:c})})]})]})},el=l.memo(pae),hae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},_e),mae=()=>{const{data:e}=H(hae);return e?a.jsx(el,{data:e,label:"Node Data"}):a.jsx(qr,{label:"No node selected",icon:null})},gae=l.memo(mae),vae=({children:e,maxHeight:t})=>a.jsx(N,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Te,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),lc=l.memo(vae),bae=({output:e})=>{const{image:t}=e,{data:n}=Ps(t.image_name);return a.jsx(il,{imageDTO:n})},xae=l.memo(bae),yae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},_e),Cae=()=>{const{node:e,template:t,nes:n}=H(yae),{t:r}=J();return!e||!n||!Rr(e)?a.jsx(qr,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(qr,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Te,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(lc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(xae,{output:o},Sae(o,s))):a.jsx(el,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},wae=l.memo(Cae),Sae=(e,t)=>`${e.type}-${t}`,kae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},_e),jae=()=>{const{template:e}=H(kae),{t}=J();return e?a.jsx(el,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(qr,{label:t("nodes.noNodeSelected"),icon:null})},_ae=l.memo(jae),$2=e=>{e.stopPropagation()},Iae=Oe((e,t)=>{const n=oe(),r=l.useCallback(s=>{s.shiftKey&&n(Uo(!0))},[n]),o=l.useCallback(s=>{s.shiftKey||n(Uo(!1))},[n]);return a.jsx(G3,{ref:t,onPaste:$2,onKeyDown:r,onKeyUp:o,...e})}),vi=l.memo(Iae),L2=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},_e),[e]);return H(t)},Pae=({nodeId:e})=>{const t=oe(),n=L2(e),{t:r}=J(),o=l.useCallback(s=>{t(d7({nodeId:e,notes:s.target.value}))},[t,e]);return Vh(n)?a.jsxs(Bn,{children:[a.jsx(vr,{children:r("nodes.notes")}),a.jsx(vi,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},Eae=l.memo(Pae),U8=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.label:!1},_e),[e]);return H(t)},G8=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},_e),[e]);return H(t)},Mae=({nodeId:e,title:t})=>{const n=oe(),r=U8(e),o=G8(e),{t:s}=J(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(nP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsxs(Ef,{as:N,value:i,onChange:p,onSubmit:d,w:"full",fontWeight:600,children:[a.jsx(Pf,{noOfLines:1}),a.jsx(If,{className:"nodrag",_focusVisible:{boxShadow:"none"}})]})})},Oae=l.memo(Mae),Rae=de(Ce,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t),r=n?e.nodeTemplates[n.data.type]:void 0;return{node:n,template:r}},_e),Aae=()=>{const{node:e,template:t}=H(Rae),{t:n}=J();return!t||!Rr(e)?a.jsx(qr,{label:n("nodes.noNodeSelected"),icon:null}):a.jsx(Tae,{node:e,template:t})},Dae=l.memo(Aae),Tae=e=>{const{t}=J(),{needsUpdate:n,updateNode:r}=rP(e.node.id);return a.jsx(Te,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(lc,{children:a.jsxs(N,{sx:{flexDir:"column",position:"relative",p:1,gap:2,w:"full"},children:[a.jsx(Oae,{nodeId:e.node.data.id}),a.jsxs(xg,{children:[a.jsxs(Bn,{children:[a.jsx(vr,{children:"Node Type"}),a.jsx(Se,{fontSize:"sm",fontWeight:600,children:e.template.title})]}),a.jsxs(N,{flexDir:"row",alignItems:"center",justifyContent:"space-between",w:"full",children:[a.jsxs(Bn,{isInvalid:n,children:[a.jsx(vr,{children:"Node Version"}),a.jsx(Se,{fontSize:"sm",fontWeight:600,children:e.node.data.version})]}),n&&a.jsx(tt,{"aria-label":t("nodes.updateNode"),tooltip:t("nodes.updateNode"),icon:a.jsx(Xg,{}),onClick:r})]})]}),a.jsx(Eae,{nodeId:e.node.data.id})]})})})},Nae=()=>a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(xo,{children:"Details"}),a.jsx(xo,{children:"Outputs"}),a.jsx(xo,{children:"Data"}),a.jsx(xo,{children:"Template"})]}),a.jsxs(zu,{children:[a.jsx(Ho,{children:a.jsx(Dae,{})}),a.jsx(Ho,{children:a.jsx(wae,{})}),a.jsx(Ho,{children:a.jsx(gae,{})}),a.jsx(Ho,{children:a.jsx(_ae,{})})]})]})}),$ae=l.memo(Nae),Lae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},zae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,c=oe(),d=l.useCallback(h=>{h.shiftKey&&c(Uo(!0))},[c]),p=l.useCallback(h=>{h.shiftKey||c(Uo(!1))},[c]);return a.jsxs(Bn,{isInvalid:o,isDisabled:r,...s,style:n==="side"?Lae:void 0,children:[t!==""&&a.jsx(vr,{children:t}),a.jsx(vg,{...i,onPaste:$2,onKeyDown:d,onKeyUp:p})]})},Cs=l.memo(zae),Fae=de(Ce,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:c}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:c}},_e),Bae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=H(Fae),c=oe(),d=l.useCallback(C=>{c(f7(C.target.value))},[c]),p=l.useCallback(C=>{c(p7(C.target.value))},[c]),h=l.useCallback(C=>{c(h7(C.target.value))},[c]),m=l.useCallback(C=>{c(m7(C.target.value))},[c]),g=l.useCallback(C=>{c(g7(C.target.value))},[c]),b=l.useCallback(C=>{c(v7(C.target.value))},[c]),y=l.useCallback(C=>{c(b7(C.target.value))},[c]),{t:x}=J();return a.jsx(lc,{children:a.jsxs(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:x("nodes.workflowName"),value:t,onChange:d}),a.jsx(Cs,{label:x("nodes.workflowVersion"),value:o,onChange:m})]}),a.jsxs(N,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:x("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(Cs,{label:x("nodes.workflowContact"),value:s,onChange:h})]}),a.jsx(Cs,{label:x("nodes.workflowTags"),value:r,onChange:b}),a.jsxs(Bn,{as:N,sx:{flexDir:"column"},children:[a.jsx(vr,{children:x("nodes.workflowDescription")}),a.jsx(vi,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Bn,{as:N,sx:{flexDir:"column",h:"full"},children:[a.jsx(vr,{children:x("nodes.workflowNotes")}),a.jsx(vi,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},Hae=l.memo(Bae),q8=()=>{const e=H(r=>r.nodes),[t]=P2(e,300);return l.useMemo(()=>x7(t),[t])},Wae=()=>{const e=q8(),{t}=J();return a.jsx(N,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(el,{data:e,label:t("nodes.workflow")})})},Vae=l.memo(Wae),Uae=({isSelected:e,isHovered:t})=>{const n=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=l.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Te,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},K8=l.memo(Uae),Q8=e=>{const t=oe(),n=l.useMemo(()=>de(Ce,({nodes:i})=>i.mouseOverNode===e,_e),[e]),r=H(n),o=l.useCallback(()=>{!r&&t(Gw(e))},[t,e,r]),s=l.useCallback(()=>{r&&t(Gw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},X8=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},_e),[t,e]);return H(n)},Y8=(e,t,n)=>{const r=l.useMemo(()=>de(Ce,({nodes:s})=>{var d;const i=s.nodes.find(p=>p.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(d=c==null?void 0:c[zx[n]][t])==null?void 0:d.title},_e),[t,n,e]);return H(r)},J8=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Rr(s))return s==null?void 0:s.data.inputs[t]},_e),[t,e]);return H(n)},v0=(e,t,n)=>{const r=l.useMemo(()=>de(Ce,({nodes:s})=>{const i=s.nodes.find(d=>d.id===e);if(!Rr(i))return;const c=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return c==null?void 0:c[zx[n]][t]},_e),[t,n,e]);return H(r)},Gae=({nodeId:e,fieldName:t,kind:n})=>{const r=J8(e,t),o=v0(e,t,n),s=y7(o),{t:i}=J(),c=l.useMemo(()=>C7(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(Se,{sx:{fontWeight:600},children:c}),o&&a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(Se,{children:["Type: ",bf[o.type].title]}),s&&a.jsxs(Se,{children:["Input: ",w7(o.input)]})]})},z2=l.memo(Gae),qae=Oe((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,c=X8(n,r),d=Y8(n,r,o),{t:p}=J(),h=oe(),[m,g]=l.useState(c||d||p("nodes.unknownField")),b=l.useCallback(async x=>{x&&(x===c||x===d)||(g(x||d||p("nodes.unknownField")),h(S7({nodeId:n,fieldName:r,label:x})))},[c,d,h,n,r,p]),y=l.useCallback(x=>{g(x)},[]);return l.useEffect(()=>{g(c||d||p("nodes.unknownField"))},[c,d,p]),a.jsx(Fn,{label:i?a.jsx(z2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:ug,placement:"top",hasArrow:!0,children:a.jsx(N,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Ef,{value:m,onChange:y,onSubmit:b,as:N,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(Pf,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(If,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(eR,{})]})})})}),Z8=l.memo(qae),eR=l.memo(()=>{const{isEditing:e,getEditButtonProps:t}=JP(),n=l.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(N,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});eR.displayName="EditableControls";const Kae=e=>{const{nodeId:t,field:n}=e,r=oe(),o=l.useCallback(s=>{r(k7({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(Ey,{className:"nodrag",onChange:o,isChecked:n.value})},Qae=l.memo(Kae);function b0(){return(b0=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function sx(e){var t=l.useRef(e),n=l.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Pu=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:C.buttons>0)&&o.current?s(C_(o.current,C,c.current)):x(!1)},y=function(){return x(!1)};function x(C){var S=d.current,j=ax(o.current),_=C?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",b),_(S?"touchend":"mouseup",y)}return[function(C){var S=C.nativeEvent,j=o.current;if(j&&(w_(S),!function(I,P){return P&&!Hd(I)}(S,d.current)&&j)){if(Hd(S)){d.current=!0;var _=S.changedTouches||[];_.length&&(c.current=_[0].identifier)}j.focus(),s(C_(j,S,c.current)),x(!0)}},function(C){var S=C.which||C.keyCode;S<37||S>40||(C.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},x]},[i,s]),h=p[0],m=p[1],g=p[2];return l.useEffect(function(){return g},[g]),B.createElement("div",b0({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:m,tabIndex:0,role:"slider"}))}),x0=function(e){return e.filter(Boolean).join(" ")},B2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=x0(["react-colorful__pointer",e.className]);return B.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},B.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Eo=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},nR=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Eo(e.h),s:Eo(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Eo(o/2),a:Eo(r,2)}},ix=function(e){var t=nR(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},P1=function(e){var t=nR(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Xae=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),c=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),p=s%6;return{r:Eo(255*[r,c,i,i,d,r][p]),g:Eo(255*[d,r,r,c,i,i][p]),b:Eo(255*[i,i,d,r,r,c][p]),a:Eo(o,2)}},Yae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),c=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Eo(60*(c<0?c+6:c)),s:Eo(s?i/s*100:0),v:Eo(s/255*100),a:o}},Jae=B.memo(function(e){var t=e.hue,n=e.onChange,r=x0(["react-colorful__hue",e.className]);return B.createElement("div",{className:r},B.createElement(F2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Pu(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Eo(t),"aria-valuemax":"360","aria-valuemin":"0"},B.createElement(B2,{className:"react-colorful__hue-pointer",left:t/360,color:ix({h:t,s:100,v:100,a:1})})))}),Zae=B.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:ix({h:t.h,s:100,v:100,a:1})};return B.createElement("div",{className:"react-colorful__saturation",style:r},B.createElement(F2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Pu(t.s+100*o.left,0,100),v:Pu(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Eo(t.s)+"%, Brightness "+Eo(t.v)+"%"},B.createElement(B2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:ix(t)})))}),rR=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function eie(e,t,n){var r=sx(n),o=l.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],c=l.useRef({color:t,hsva:s});l.useEffect(function(){if(!e.equal(t,c.current.color)){var p=e.toHsva(t);c.current={hsva:p,color:t},i(p)}},[t,e]),l.useEffect(function(){var p;rR(s,c.current.hsva)||e.equal(p=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:p},r(p))},[s,e,r]);var d=l.useCallback(function(p){i(function(h){return Object.assign({},h,p)})},[]);return[s,d]}var tie=typeof window<"u"?l.useLayoutEffect:l.useEffect,nie=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},S_=new Map,rie=function(e){tie(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!S_.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,S_.set(t,n);var r=nie();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},oie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+P1(Object.assign({},n,{a:0}))+", "+P1(Object.assign({},n,{a:1}))+")"},s=x0(["react-colorful__alpha",t]),i=Eo(100*n.a);return B.createElement("div",{className:s},B.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),B.createElement(F2,{onMove:function(c){r({a:c.left})},onKey:function(c){r({a:Pu(n.a+c.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},B.createElement(B2,{className:"react-colorful__alpha-pointer",left:n.a,color:P1(n)})))},sie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=tR(e,["className","colorModel","color","onChange"]),c=l.useRef(null);rie(c);var d=eie(n,o,s),p=d[0],h=d[1],m=x0(["react-colorful",t]);return B.createElement("div",b0({},i,{ref:c,className:m}),B.createElement(Zae,{hsva:p,onChange:h}),B.createElement(Jae,{hue:p.h,onChange:h}),B.createElement(oie,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},aie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:Yae,fromHsva:Xae,equal:rR},oR=function(e){return B.createElement(sie,b0({},e,{colorModel:aie}))};const iie=e=>{const{nodeId:t,field:n}=e,r=oe(),o=l.useCallback(s=>{r(j7({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(oR,{className:"nodrag",color:n.value,onChange:o})},lie=l.memo(iie),sR=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=_7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},cie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=_x(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=sR(p);h&&o(I7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Ar,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},uie=l.memo(cie),die=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=oe(),s=l.useCallback(i=>{o(P7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(I3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},fie=l.memo(die),pie=e=>{var p;const{nodeId:t,field:n}=e,r=oe(),{currentData:o}=Ps(((p=n.value)==null?void 0:p.image_name)??Os.skipToken),s=l.useCallback(()=>{r(E7({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=l.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),c=l.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),d=l.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(N,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(il,{imageDTO:o,droppableData:c,draggableData:i,postUploadAction:d,useThumbailFallback:!0,uploadElement:a.jsx(aR,{}),dropLabel:a.jsx(iR,{}),minSize:8,children:a.jsx(fu,{onClick:s,icon:o?a.jsx(Yg,{}):void 0,tooltip:"Reset Image"})})})},hie=l.memo(pie),aR=l.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));aR.displayName="UploadElement";const iR=l.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop"}));iR.displayName="DropLabel";const mie=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=M7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},gie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=vf(),{t:i}=J(),c=l.useMemo(()=>{if(!s)return[];const m=[];return Kr(s.entities,(g,b)=>{g&&m.push({value:b,label:g.model_name,group:gr[g.base_model]})}),m.sort((g,b)=>g.disabled&&!b.disabled?1:-1)},[s]),d=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=l.useCallback(m=>{if(!m)return;const g=mie(m);g&&o(O7({nodeId:t,fieldName:n.name,value:g}))},[o,n.name,t]),h=l.useCallback((m,g)=>{var b;return((b=g.label)==null?void 0:b.toLowerCase().includes(m.toLowerCase().trim()))||g.value.toLowerCase().includes(m.toLowerCase().trim())},[]);return(s==null?void 0:s.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(tr,{className:"nowheel nodrag",value:(d==null?void 0:d.id)??null,placeholder:c.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:c,nothingFound:i("models.noMatchingLoRAs"),itemComponent:pl,disabled:c.length===0,filter:h,error:!d,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},vie=l.memo(gie),y0=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=R7.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Gu(e){const{iconMode:t=!1,...n}=e,r=oe(),{t:o}=J(),[s,{isLoading:i}]=A7(),c=l.useCallback(()=>{s().unwrap().then(d=>{r(Bt(Zn({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(d=>{d&&r(Bt(Zn({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})},[r,s,o]);return t?a.jsx(tt,{icon:a.jsx(Xg,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:c,size:"sm",...n}):a.jsx(Rt,{isLoading:i,onClick:c,minW:"max-content",...n,children:"Sync Models"})}const bie=e=>{var y,x;const{nodeId:t,field:n}=e,r=oe(),o=jn("syncModels").isFeatureEnabled,{t:s}=J(),{data:i,isLoading:c}=Wd(qw),{data:d,isLoading:p}=na(qw),h=l.useMemo(()=>c||p,[c,p]),m=l.useMemo(()=>{if(!d)return[];const C=[];return Kr(d.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),i&&Kr(i.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),C},[d,i]),g=l.useMemo(()=>{var C,S,j,_;return((d==null?void 0:d.entities[`${(C=n.value)==null?void 0:C.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(x=n.value)==null?void 0:x.model_name,d==null?void 0:d.entities,i==null?void 0:i.entities]),b=l.useCallback(C=>{if(!C)return;const S=y0(C);S&&r(oP({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(N,{sx:{w:"full",alignItems:"center",gap:2},children:[h?a.jsx(Se,{variant:"subtext",children:"Loading..."}):a.jsx(tr,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:m.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:m,error:!g,disabled:m.length===0,onChange:b,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Gu,{className:"nodrag",iconMode:!0})]})},xie=l.memo(bie),eg=/^-?(0\.)?\.?$/,lR=Oe((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:c,min:d,max:p,isInteger:h=!0,formControlProps:m,formLabelProps:g,numberInputFieldProps:b,numberInputStepperProps:y,tooltipProps:x,...C}=e,S=oe(),[j,_]=l.useState(String(i));l.useEffect(()=>{!j.match(eg)&&i!==Number(j)&&_(String(i))},[i,j]);const I=l.useCallback(A=>{_(A),A.match(eg)||c(h?Math.floor(Number(A)):Number(A))},[h,c]),P=l.useCallback(A=>{const D=Bl(h?Math.floor(Number(A.target.value)):Number(A.target.value),d,p);_(String(D)),c(D)},[h,p,d,c]),M=l.useCallback(A=>{A.shiftKey&&S(Uo(!0))},[S]),R=l.useCallback(A=>{A.shiftKey||S(Uo(!1))},[S]);return a.jsx(Fn,{...x,children:a.jsxs(Bn,{ref:t,isDisabled:r,isInvalid:s,...m,children:[n&&a.jsx(vr,{...g,children:n}),a.jsxs(_g,{value:j,min:d,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:I,onBlur:P,...C,onPaste:$2,children:[a.jsx(Pg,{...b,onKeyDown:M,onKeyUp:R}),o&&a.jsxs(Ig,{children:[a.jsx(Mg,{...y}),a.jsx(Eg,{...y})]})]})]})})});lR.displayName="IAINumberInput";const ja=l.memo(lR),yie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=oe(),[s,i]=l.useState(String(n.value)),c=l.useMemo(()=>r.type==="integer",[r.type]),d=l.useCallback(p=>{i(p),p.match(eg)||o(D7({nodeId:t,fieldName:n.name,value:c?Math.floor(Number(p)):Number(p)}))},[o,n.name,c,t]);return l.useEffect(()=>{!s.match(eg)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(_g,{onChange:d,value:s,step:c?1:.1,precision:c?0:3,children:[a.jsx(Pg,{className:"nodrag"}),a.jsxs(Ig,{children:[a.jsx(Mg,{}),a.jsx(Eg,{})]})]})},Cie=l.memo(yie),wie=e=>{var m,g;const{nodeId:t,field:n}=e,r=oe(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i,isLoading:c}=na(Fx),d=l.useMemo(()=>{if(!i)return[];const b=[];return Kr(i.entities,(y,x)=>{y&&b.push({value:x,label:y.model_name,group:gr[y.base_model]})}),b},[i]),p=l.useMemo(()=>{var b,y;return(i==null?void 0:i.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(m=n.value)==null?void 0:m.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),h=l.useCallback(b=>{if(!b)return;const y=y0(b);y&&r(T7({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return c?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:d.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:d,error:!p,disabled:d.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gu,{className:"nodrag",iconMode:!0})]})},Sie=l.memo(wie),kie=e=>{var g,b;const{nodeId:t,field:n}=e,r=oe(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i}=Wd(Kw),{data:c,isLoading:d}=na(Kw),p=l.useMemo(()=>{if(!c)return[];const y=[];return Kr(c.entities,(x,C)=>{!x||x.base_model!=="sdxl"||y.push({value:C,label:x.model_name,group:gr[x.base_model]})}),i&&Kr(i.entities,(x,C)=>{!x||x.base_model!=="sdxl"||y.push({value:C,label:x.model_name,group:gr[x.base_model]})}),y},[c,i]),h=l.useMemo(()=>{var y,x,C,S;return((c==null?void 0:c.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(x=n.value)==null?void 0:x.model_name}`])||(i==null?void 0:i.entities[`${(C=n.value)==null?void 0:C.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(b=n.value)==null?void 0:b.model_name,c==null?void 0:c.entities,i==null?void 0:i.entities]),m=l.useCallback(y=>{if(!y)return;const x=y0(y);x&&r(oP({nodeId:t,fieldName:n.name,value:x}))},[r,n.name,t]);return d?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:h==null?void 0:h.description,value:h==null?void 0:h.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!h,disabled:p.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gu,{className:"nodrag",iconMode:!0})]})},jie=l.memo(kie),_ie=de([Ce],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:Ro(sg,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},_e),Iie=e=>{const{nodeId:t,field:n}=e,r=oe(),{data:o}=H(_ie),s=l.useCallback(i=>{i&&r(N7({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Pie=l.memo(Iie),Eie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=oe(),s=l.useCallback(i=>{o($7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(vi,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(Cs,{onChange:s,value:n.value})},Mie=l.memo(Eie),cR=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=L7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Oie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=sP(),i=l.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p.sort((h,m)=>h.disabled&&!m.disabled?1:-1)},[s]),c=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),d=l.useCallback(p=>{if(!p)return;const h=cR(p);h&&o(z7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",itemComponent:pl,tooltip:c==null?void 0:c.description,value:(c==null?void 0:c.id)??"default",placeholder:"Default",data:i,onChange:d,disabled:i.length===0,error:!c,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Rie=l.memo(Oie),Aie=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=F7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},Die=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=Px(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=Aie(p);h&&o(B7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Ar,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},Tie=l.memo(Die),Nie=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=H7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({t2iAdapterModelId:e,errors:s.error.format()},"Failed to parse T2I-Adapter model id");return}return s.data},$ie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=oe(),{data:s}=Ix(),i=l.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/t2i_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),c=l.useMemo(()=>{if(!s)return[];const p=[];return Kr(s.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[s]),d=l.useCallback(p=>{if(!p)return;const h=Nie(p);h&&o(W7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return a.jsx(Ar,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:c,onChange:d,sx:{width:"100%"}})},Lie=l.memo($ie),zie=e=>{var c;const{nodeId:t,field:n}=e,r=oe(),{data:o,hasBoards:s}=gf(void 0,{selectFromResult:({data:d})=>{const p=[{label:"None",value:"none"}];return d==null||d.forEach(({board_id:h,board_name:m})=>{p.push({label:m,value:h})}),{data:p,hasBoards:p.length>1}}}),i=l.useCallback(d=>{r(V7({nodeId:t,fieldName:n.name,value:d&&d!=="none"?{board_id:d}:void 0}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:((c=n.value)==null?void 0:c.board_id)??"none",data:o,onChange:i,disabled:!s})},Fie=l.memo(zie),Bie=({nodeId:e,fieldName:t})=>{const n=J8(e,t),r=v0(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Te,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(Mie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(Qae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Cie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(fie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(hie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(Fie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(xie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Sie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Rie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(vie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(uie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(Tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(Lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(jie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Pie,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Te,{p:1,children:a.jsxs(Se,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},uR=l.memo(Bie),Hie=({nodeId:e,fieldName:t})=>{const n=oe(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=Q8(e),{t:i}=J(),c=l.useCallback(()=>{n(aP({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(N,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Bn,{as:N,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(vr,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(Z8,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ji,{}),a.jsx(Fn,{label:a.jsx(z2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:ug,placement:"top",hasArrow:!0,children:a.jsx(N,{h:"full",alignItems:"center",children:a.jsx(zr,{as:GM})})}),a.jsx(tt,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:c,icon:a.jsx(qo,{})})]}),a.jsx(uR,{nodeId:e,fieldName:t})]}),a.jsx(K8,{isSelected:!1,isHovered:r})]})},Wie=l.memo(Hie),Vie=de(Ce,({nodes:e})=>({fields:e.workflow.exposedFields}),_e),Uie=()=>{const{fields:e}=H(Vie),{t}=J();return a.jsx(Te,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(lc,{children:a.jsx(N,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(Wie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(qr,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},Gie=l.memo(Uie),qie=()=>a.jsx(N,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(xo,{children:"Linear"}),a.jsx(xo,{children:"Details"}),a.jsx(xo,{children:"JSON"})]}),a.jsxs(zu,{children:[a.jsx(Ho,{children:a.jsx(Gie,{})}),a.jsx(Ho,{children:a.jsx(Hae,{})}),a.jsx(Ho,{children:a.jsx(Vae,{})})]})]})}),Kie=l.memo(qie),Qie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},Xie=1e3,Yie=[{name:"preventOverflow",options:{padding:10}}],dR=Oe(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=J(),i=H(g=>g.system.shouldEnableInformationalPopovers),c=l.useMemo(()=>Qie[e],[e]),d=l.useMemo(()=>U7(G7(c,["image","href","buttonLabel"]),r),[c,r]),p=l.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),h=l.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),m=l.useCallback(()=>{c!=null&&c.href&&window.open(c.href)},[c==null?void 0:c.href]);return i?a.jsxs(Nf,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:Xie,modifiers:Yie,placement:"top",...d,children:[a.jsx(Rg,{children:a.jsx(Te,{ref:o,w:"full",...n,children:t})}),a.jsx(Ru,{children:a.jsxs($f,{w:96,children:[a.jsx(y3,{}),a.jsx(Ag,{children:a.jsxs(N,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(vo,{size:"sm",children:p}),a.jsx(no,{})]}),(c==null?void 0:c.image)&&a.jsxs(a.Fragment,{children:[a.jsx(Si,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:c.image,alt:"Optional Image"}),a.jsx(no,{})]}),h.map(g=>a.jsx(Se,{children:g},g)),(c==null?void 0:c.href)&&a.jsxs(a.Fragment,{children:[a.jsx(no,{}),a.jsx(tl,{pt:1,onClick:m,leftIcon:a.jsx(Ky,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Te,{ref:o,w:"full",...n,children:t})});dR.displayName="IAIInformationalPopover";const wn=l.memo(dR),Jie=de([Ce],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:c}=e.generation,{shouldUseSliders:d}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:c,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:d}},_e),Zie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:c}=H(Jie),d=oe(),{t:p}=J(),h=l.useCallback(g=>{d(Qw(g))},[d]),m=l.useCallback(()=>{d(Qw(n))},[d,n]);return e||c?a.jsx(wn,{feature:"paramIterations",children:a.jsx(Pt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:h,handleReset:m,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(wn,{feature:"paramIterations",children:a.jsx(ja,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:h,value:t,numberInputFieldProps:{textAlign:"center"}})})},ia=l.memo(Zie),ele=()=>{const[e,t]=l.useState(!1),[n,r]=l.useState(!1),o=l.useRef(null),s=N2(),i=l.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(N,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(O8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(ia,{asSlider:!0})}),a.jsxs(g0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Zi,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(Kie,{})}),a.jsx(Zm,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Zi,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx($ae,{})})]})]})},tle=l.memo(ele),k_=(e,t)=>{const n=l.useRef(null),[r,o]=l.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=l.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?rs.flushSync(()=>{var h;(h=n.current)==null||h.expand()}):rs.flushSync(()=>{var h;(h=n.current)==null||h.collapse()})},[]),i=l.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),c=l.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),d=l.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:d,toggle:s,expand:i,collapse:c}},nle=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=J(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Ru,{children:a.jsx(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(tt,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(qoe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},rle=l.memo(nle),bh={borderStartRadius:0,flexGrow:1},ole=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=J(),r=l.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Ru,{children:a.jsxs(N,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(zn,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(tt,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:bh,icon:a.jsx(JM,{})}),a.jsx(P8,{asIconButton:!0,sx:bh}),a.jsx(S8,{asIconButton:!0,sx:bh})]}),a.jsx(O2,{asIconButton:!0,sx:bh})]})}):null},sle=l.memo(ole),ale=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=ls({defaultIsOpen:o}),{colorMode:c}=wi();return a.jsxs(Te,{children:[a.jsxs(N,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ke("base.250","base.750")(c),color:Ke("base.900","base.100")(c),_hover:{bg:Ke("base.300","base.700")(c)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(yo,{children:n&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(Se,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ji,{}),a.jsx(s0,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Sf,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Te,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},Ao=l.memo(ale),ile=de(Ce,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},_e),lle=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=H(ile),s=oe(),{t:i}=J(),c=l.useCallback(p=>{s(q7(p))},[s]),d=l.useCallback(()=>{s(K7())},[s]);return a.jsx(wn,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(Pt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:c,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})})},cle=l.memo(lle),ule=de(Ce,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},_e),dle={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},fle=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=H(ule);return r?a.jsx(wn,{feature:"dynamicPrompts",children:a.jsx(N,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(qr,{icon:Boe,label:"Problem generating prompts"})})}):a.jsx(wn,{feature:"dynamicPrompts",children:a.jsxs(Bn,{isInvalid:!!t,children:[a.jsxs(vr,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs(N,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(lc,{children:a.jsx(H5,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(ws,{fontSize:"sm",sx:dle,children:a.jsx(Se,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx(N,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(bi,{})})]})]})})},ple=l.memo(fle),fR=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Te,{ref:r,...n,children:a.jsxs(Te,{children:[a.jsx(Se,{fontWeight:600,children:e}),t&&a.jsx(Se,{size:"xs",variant:"subtext",children:t})]})}));fR.displayName="IAIMantineSelectItemWithDescription";const hle=l.memo(fR),mle=()=>{const e=oe(),{t}=J(),n=H(s=>s.dynamicPrompts.seedBehaviour),r=l.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=l.useCallback(s=>{s&&e(Q7(s))},[e]);return a.jsx(wn,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Ar,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:hle,onChange:o})})},gle=l.memo(mle),vle=()=>{const{t:e}=J(),t=l.useMemo(()=>de(Ce,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=H(t);return jn("dynamicPrompting").isFeatureEnabled?a.jsx(Ao,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(ple,{}),a.jsx(gle,{}),a.jsx(cle,{})]})}):null},qu=l.memo(vle),ble=e=>{const t=oe(),{lora:n}=e,r=l.useCallback(i=>{t(X7({id:n.id,weight:i}))},[t,n.id]),o=l.useCallback(()=>{t(Y7(n.id))},[t,n.id]),s=l.useCallback(()=>{t(J7(n.id))},[t,n.id]);return a.jsx(wn,{feature:"lora",children:a.jsxs(N,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(Pt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(tt,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(qo,{}),colorScheme:"error"})]})})},xle=l.memo(ble),yle=de(Ce,({lora:e})=>({lorasArray:Ro(e.loras)}),_e),Cle=()=>{const{lorasArray:e}=H(yle);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(no,{pt:1}),a.jsx(xle,{lora:t})]},t.model_name))})},wle=l.memo(Cle),Sle=de(Ce,({lora:e})=>({loras:e.loras}),_e),kle=()=>{const e=oe(),{loras:t}=H(Sle),{data:n}=vf(),{t:r}=J(),o=H(d=>d.generation.model),s=l.useMemo(()=>{if(!n)return[];const d=[];return Kr(n.entities,(p,h)=>{if(!p||h in t)return;const m=(o==null?void 0:o.base_model)!==p.base_model;d.push({value:h,label:p.model_name,disabled:m,group:gr[p.base_model],tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.label&&!h.label?1:-1),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),i=l.useCallback(d=>{if(!d)return;const p=n==null?void 0:n.entities[d];p&&e(Z7(p))},[e,n==null?void 0:n.entities]),c=l.useCallback((d,p)=>{var h;return((h=p.label)==null?void 0:h.toLowerCase().includes(d.toLowerCase().trim()))||p.value.toLowerCase().includes(d.toLowerCase().trim())},[]);return(n==null?void 0:n.ids.length)===0?a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:r("models.noLoRAsInstalled")})}):a.jsx(tr,{placeholder:s.length===0?"All LoRAs added":"Add LoRA",value:null,data:s,nothingFound:"No matching LoRAs",itemComponent:pl,disabled:s.length===0,filter:c,onChange:i,"data-testid":"add-lora"})},jle=l.memo(kle),_le=de(Ce,e=>{const t=iP(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},_e),Ile=()=>{const{t:e}=J(),{activeLabel:t}=H(_le);return jn("lora").isFeatureEnabled?a.jsx(Ao,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(jle,{}),a.jsx(wle,{})]})}):null},Ku=l.memo(Ile),Ple=()=>{const e=oe(),t=H(o=>o.generation.shouldUseCpuNoise),{t:n}=J(),r=l.useCallback(o=>{e(eT(o.target.checked))},[e]);return a.jsx(wn,{feature:"noiseUseCPU",children:a.jsx(jr,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},la=e=>e.generation,Ele=de(la,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},_e),Mle=()=>{const{t:e}=J(),{seamlessXAxis:t}=H(Ele),n=oe(),r=l.useCallback(o=>{n(tT(o.target.checked))},[n]);return a.jsx(jr,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Ole=l.memo(Mle),Rle=de(la,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},_e),Ale=()=>{const{t:e}=J(),{seamlessYAxis:t}=H(Rle),n=oe(),r=l.useCallback(o=>{n(nT(o.target.checked))},[n]);return a.jsx(jr,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Dle=l.memo(Ale),Tle=()=>{const{t:e}=J();return jn("seamless").isFeatureEnabled?a.jsxs(Bn,{children:[a.jsx(vr,{children:e("parameters.seamlessTiling")})," ",a.jsxs(N,{sx:{gap:5},children:[a.jsx(Te,{flexGrow:1,children:a.jsx(Ole,{})}),a.jsx(Te,{flexGrow:1,children:a.jsx(Dle,{})})]})]}):null},Nle=l.memo(Tle);function $le(){const e=H(d=>d.generation.clipSkip),{model:t}=H(d=>d.generation),n=oe(),{t:r}=J(),o=l.useCallback(d=>{n(Xw(d))},[n]),s=l.useCallback(()=>{n(Xw(0))},[n]),i=l.useMemo(()=>t?$p[t.base_model].maxClip:$p["sd-1"].maxClip,[t]),c=l.useMemo(()=>t?$p[t.base_model].markers:$p["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(wn,{feature:"clipSkip",placement:"top",children:a.jsx(Pt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:c,withInput:!0,withReset:!0,handleReset:s})})}const Lle=de(Ce,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},_e);function Qu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=H(Lle),{t:s}=J(),i=l.useMemo(()=>{const c=[];return o||c.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&c.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?c.push(s("parameters.seamlessX&Y")):n?c.push(s("parameters.seamlessX")):r&&c.push(s("parameters.seamlessY")),c.join(", ")},[e,t,n,r,o,s]);return a.jsx(Ao,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(Nle,{}),a.jsx(no,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx($le,{}),a.jsx(no,{pt:2})]}),a.jsx(Ple,{})]})})}const Pi=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return((o=Rs(r,e))==null?void 0:o.isEnabled)??!1},_e),[e]);return H(t)},zle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.model},_e),[e]);return H(t)},pR=e=>{const{data:t}=_x(),n=l.useMemo(()=>t?LI.getSelectors().selectAll(t):[],[t]),{data:r}=Ix(),o=l.useMemo(()=>r?zI.getSelectors().selectAll(r):[],[r]),{data:s}=Px(),i=l.useMemo(()=>s?FI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?i:[]},hR=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.type},_e),[e]);return H(t)},Fle=de(Ce,({generation:e})=>{const{model:t}=e;return{mainModel:t}},_e),Ble=({id:e})=>{const t=Pi(e),n=hR(e),r=zle(e),o=oe(),{mainModel:s}=H(Fle),{t:i}=J(),c=pR(n),d=l.useMemo(()=>{if(!c)return[];const m=[];return c.forEach(g=>{if(!g)return;const b=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);m.push({value:g.id,label:g.model_name,group:gr[g.base_model],disabled:b,tooltip:b?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),m.sort((g,b)=>g.disabled?1:b.disabled?-1:g.label.localeCompare(b.label)),m},[s==null?void 0:s.base_model,c,i]),p=l.useMemo(()=>c.find(m=>(m==null?void 0:m.id)===`${r==null?void 0:r.base_model}/${n}/${r==null?void 0:r.model_name}`),[n,r==null?void 0:r.base_model,r==null?void 0:r.model_name,c]),h=l.useCallback(m=>{if(!m)return;const g=sR(m);g&&o(rT({id:e,model:g}))},[o,e]);return a.jsx(tr,{itemComponent:pl,data:d,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:h,disabled:!t,tooltip:p==null?void 0:p.description})},Hle=l.memo(Ble),Wle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.weight},_e),[e]);return H(t)},Vle=({id:e})=>{const t=Pi(e),n=Wle(e),r=oe(),{t:o}=J(),s=l.useCallback(i=>{r(oT({id:e,weight:i}))},[r,e]);return oi(n)?null:a.jsx(wn,{feature:"controlNetWeight",children:a.jsx(Pt,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},Ule=l.memo(Vle),Gle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.controlImage},_e),[e]);return H(t)},qle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Au(o)?o.processedControlImage:void 0},_e),[e]);return H(t)},Kle=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Au(o)?o.processorType:void 0},_e),[e]);return H(t)},Qle=de(Ce,({controlAdapters:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},_e),Xle=({isSmall:e,id:t})=>{const n=Gle(t),r=qle(t),o=Kle(t),s=oe(),{t:i}=J(),{pendingControlImages:c,autoAddBoardId:d}=H(Qle),p=H(ro),[h,m]=l.useState(!1),{currentData:g}=Ps(n??Os.skipToken),{currentData:b}=Ps(r??Os.skipToken),[y]=sT(),[x]=aT(),[C]=iT(),S=l.useCallback(()=>{s(lT({id:t,controlImage:null}))},[t,s]),j=l.useCallback(async()=>{b&&(await y({imageDTO:b,is_intermediate:!1}).unwrap(),d!=="none"?x({imageDTO:b,board_id:d}):C({imageDTO:b}))},[b,y,d,x,C]),_=l.useCallback(()=>{g&&(p==="unifiedCanvas"?s(Xs({width:g.width,height:g.height})):(s(Hl(g.width)),s(Wl(g.height))))},[g,p,s]),I=l.useCallback(()=>{m(!0)},[]),P=l.useCallback(()=>{m(!1)},[]),M=l.useMemo(()=>{if(g)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:g}}},[g,t]),R=l.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),A=l.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),D=g&&b&&!h&&!c.includes(t)&&o!=="none";return a.jsxs(N,{onMouseEnter:I,onMouseLeave:P,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(il,{draggableData:M,droppableData:R,imageDTO:g,isDropDisabled:D,postUploadAction:A}),a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:D?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(il,{draggableData:M,droppableData:R,imageDTO:b,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(fu,{onClick:S,icon:g?a.jsx(Yg,{}):void 0,tooltip:i("controlnet.resetControlImage")}),a.jsx(fu,{onClick:j,icon:g?a.jsx(Qg,{size:16}):void 0,tooltip:i("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(fu,{onClick:_,icon:g?a.jsx(wee,{size:16}):void 0,tooltip:i("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),c.includes(t)&&a.jsx(N,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(bi,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},j_=l.memo(Xle),Ds=()=>{const e=oe();return l.useCallback((n,r)=>{e(cT({id:n,params:r}))},[e])};function Ts(e){return a.jsx(N,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const __=Oo.canny_image_processor.default,Yle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=l.useCallback(()=>{i(t,{low_threshold:__.low_threshold})},[t,i]),h=l.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),m=l.useCallback(()=>{i(t,{high_threshold:__.high_threshold})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{isDisabled:!r,label:c("controlnet.lowThreshold"),value:o,onChange:d,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(Pt,{isDisabled:!r,label:c("controlnet.highThreshold"),value:s,onChange:h,handleReset:m,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},Jle=l.memo(Yle),Zle=Oo.color_map_image_processor.default,ece=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Ds(),{t:i}=J(),c=l.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),d=l.useCallback(()=>{s(t,{color_map_tile_size:Zle.color_map_tile_size})},[t,s]);return a.jsx(Ts,{children:a.jsx(Pt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:c,handleReset:d,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},tce=l.memo(ece),wd=Oo.content_shuffle_image_processor.default,nce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:c,f:d}=n,p=Ds(),{t:h}=J(),m=l.useCallback(P=>{p(t,{detect_resolution:P})},[t,p]),g=l.useCallback(()=>{p(t,{detect_resolution:wd.detect_resolution})},[t,p]),b=l.useCallback(P=>{p(t,{image_resolution:P})},[t,p]),y=l.useCallback(()=>{p(t,{image_resolution:wd.image_resolution})},[t,p]),x=l.useCallback(P=>{p(t,{w:P})},[t,p]),C=l.useCallback(()=>{p(t,{w:wd.w})},[t,p]),S=l.useCallback(P=>{p(t,{h:P})},[t,p]),j=l.useCallback(()=>{p(t,{h:wd.h})},[t,p]),_=l.useCallback(P=>{p(t,{f:P})},[t,p]),I=l.useCallback(()=>{p(t,{f:wd.f})},[t,p]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:h("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.imageResolution"),value:o,onChange:b,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.w"),value:i,onChange:x,handleReset:C,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.h"),value:c,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:h("controlnet.f"),value:d,onChange:_,handleReset:I,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},rce=l.memo(nce),I_=Oo.hed_image_processor.default,oce=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Ds(),{t:c}=J(),d=l.useCallback(b=>{i(t,{detect_resolution:b})},[t,i]),p=l.useCallback(b=>{i(t,{image_resolution:b})},[t,i]),h=l.useCallback(b=>{i(t,{scribble:b.target.checked})},[t,i]),m=l.useCallback(()=>{i(t,{detect_resolution:I_.detect_resolution})},[t,i]),g=l.useCallback(()=>{i(t,{image_resolution:I_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.detectResolution"),value:n,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(Pt,{label:c("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(jr,{label:c("controlnet.scribble"),isChecked:o,onChange:h,isDisabled:!s})]})},sce=l.memo(oce),P_=Oo.lineart_anime_image_processor.default,ace=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:P_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:P_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ice=l.memo(ace),E_=Oo.lineart_image_processor.default,lce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,c=Ds(),{t:d}=J(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:E_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:E_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{coarse:y.target.checked})},[t,c]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jr,{label:d("controlnet.coarse"),isChecked:i,onChange:b,isDisabled:!r})]})},cce=l.memo(lce),M_=Oo.mediapipe_face_processor.default,uce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=l.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),h=l.useCallback(()=>{i(t,{max_faces:M_.max_faces})},[t,i]),m=l.useCallback(()=>{i(t,{min_confidence:M_.min_confidence})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.maxFaces"),value:o,onChange:d,handleReset:h,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.minConfidence"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},dce=l.memo(uce),O_=Oo.midas_depth_image_processor.default,fce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=l.useCallback(g=>{i(t,{bg_th:g})},[t,i]),h=l.useCallback(()=>{i(t,{a_mult:O_.a_mult})},[t,i]),m=l.useCallback(()=>{i(t,{bg_th:O_.bg_th})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.amult"),value:o,onChange:d,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.bgth"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},pce=l.memo(fce),xh=Oo.mlsd_image_processor.default,hce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:c}=n,d=Ds(),{t:p}=J(),h=l.useCallback(j=>{d(t,{detect_resolution:j})},[t,d]),m=l.useCallback(j=>{d(t,{image_resolution:j})},[t,d]),g=l.useCallback(j=>{d(t,{thr_d:j})},[t,d]),b=l.useCallback(j=>{d(t,{thr_v:j})},[t,d]),y=l.useCallback(()=>{d(t,{detect_resolution:xh.detect_resolution})},[t,d]),x=l.useCallback(()=>{d(t,{image_resolution:xh.image_resolution})},[t,d]),C=l.useCallback(()=>{d(t,{thr_d:xh.thr_d})},[t,d]),S=l.useCallback(()=>{d(t,{thr_v:xh.thr_v})},[t,d]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:C,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.h"),value:c,onChange:b,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},mce=l.memo(hce),R_=Oo.normalbae_image_processor.default,gce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:c}=J(),d=l.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=l.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),h=l.useCallback(()=>{i(t,{detect_resolution:R_.detect_resolution})},[t,i]),m=l.useCallback(()=>{i(t,{image_resolution:R_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:c("controlnet.imageResolution"),value:o,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},vce=l.memo(gce),A_=Oo.openpose_image_processor.default,bce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,c=Ds(),{t:d}=J(),p=l.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),h=l.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),m=l.useCallback(()=>{c(t,{detect_resolution:A_.detect_resolution})},[t,c]),g=l.useCallback(()=>{c(t,{image_resolution:A_.image_resolution})},[t,c]),b=l.useCallback(y=>{c(t,{hand_and_face:y.target.checked})},[t,c]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:d("controlnet.detectResolution"),value:s,onChange:p,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:d("controlnet.imageResolution"),value:o,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jr,{label:d("controlnet.handAndFace"),isChecked:i,onChange:b,isDisabled:!r})]})},xce=l.memo(bce),D_=Oo.pidi_image_processor.default,yce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:c}=n,d=Ds(),{t:p}=J(),h=l.useCallback(C=>{d(t,{detect_resolution:C})},[t,d]),m=l.useCallback(C=>{d(t,{image_resolution:C})},[t,d]),g=l.useCallback(()=>{d(t,{detect_resolution:D_.detect_resolution})},[t,d]),b=l.useCallback(()=>{d(t,{image_resolution:D_.image_resolution})},[t,d]),y=l.useCallback(C=>{d(t,{scribble:C.target.checked})},[t,d]),x=l.useCallback(C=>{d(t,{safe:C.target.checked})},[t,d]);return a.jsxs(Ts,{children:[a.jsx(Pt,{label:p("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(Pt,{label:p("controlnet.imageResolution"),value:o,onChange:m,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jr,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(jr,{label:p("controlnet.safe"),isChecked:c,onChange:x,isDisabled:!r})]})},Cce=l.memo(yce),wce=e=>null,Sce=l.memo(wce),mR=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Au(o)?o.processorNode:void 0},_e),[e]);return H(t)},kce=({id:e})=>{const t=Pi(e),n=mR(e);return n?n.type==="canny_image_processor"?a.jsx(Jle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(tce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(sce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(cce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(rce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(ice,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(dce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(pce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(mce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(vce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(xce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx(Cce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(Sce,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},jce=l.memo(kce),_ce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Au(o))return o.shouldAutoConfig},_e),[e]);return H(t)},Ice=({id:e})=>{const t=Pi(e),n=_ce(e),r=oe(),{t:o}=J(),s=l.useCallback(()=>{r(uT({id:e}))},[e,r]);return oi(n)?null:a.jsx(jr,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},Pce=l.memo(Ice),Ece=e=>{const{id:t}=e,n=oe(),{t:r}=J(),o=l.useCallback(()=>{n(dT({id:t}))},[t,n]),s=l.useCallback(()=>{n(fT({id:t}))},[t,n]);return a.jsxs(N,{sx:{gap:2},children:[a.jsx(tt,{size:"sm",icon:a.jsx(Ql,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(tt,{size:"sm",icon:a.jsx(QM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Mce=l.memo(Ece),Oce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0},_e),[e]);return H(t)},T_=e=>`${Math.round(e*100)}%`,Rce=({id:e})=>{const t=Pi(e),n=Oce(e),r=oe(),{t:o}=J(),s=l.useCallback(i=>{r(pT({id:e,beginStepPct:i[0]})),r(hT({id:e,endStepPct:i[1]}))},[r,e]);return n?a.jsx(wn,{feature:"controlNetBeginEnd",children:a.jsxs(Bn,{isDisabled:!t,children:[a.jsx(vr,{children:o("controlnet.beginEndStepPercent")}),a.jsx(xg,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(N3,{"aria-label":["Begin Step %","End Step %!"],value:[n.beginStepPct,n.endStepPct],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!t,children:[a.jsx($3,{children:a.jsx(L3,{})}),a.jsx(Fn,{label:T_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(wb,{index:0})}),a.jsx(Fn,{label:T_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(wb,{index:1})}),a.jsx(Eh,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Eh,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Eh,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},Ace=l.memo(Rce),Dce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&mT(o))return o.controlMode},_e),[e]);return H(t)};function Tce({id:e}){const t=Pi(e),n=Dce(e),r=oe(),{t:o}=J(),s=[{label:o("controlnet.balanced"),value:"balanced"},{label:o("controlnet.prompt"),value:"more_prompt"},{label:o("controlnet.control"),value:"more_control"},{label:o("controlnet.megaControl"),value:"unbalanced"}],i=l.useCallback(c=>{r(gT({id:e,controlMode:c}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetControlMode",children:a.jsx(Ar,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:i})}):null}const Nce=e=>e.config,$ce=de(Nce,e=>Ro(Oo,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),_e),Lce=({id:e})=>{const t=Pi(e),n=mR(e),r=oe(),o=H($ce),{t:s}=J(),i=l.useCallback(c=>{r(vT({id:e,processorType:c}))},[e,r]);return n?a.jsx(tr,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:i,disabled:!t}):null},zce=l.memo(Lce),Fce=e=>{const t=l.useMemo(()=>de(Ce,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Au(o))return o.resizeMode},_e),[e]);return H(t)};function Bce({id:e}){const t=Pi(e),n=Fce(e),r=oe(),{t:o}=J(),s=[{label:o("controlnet.resize"),value:"just_resize"},{label:o("controlnet.crop"),value:"crop_resize"},{label:o("controlnet.fill"),value:"fill_resize"}],i=l.useCallback(c=>{r(bT({id:e,resizeMode:c}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetResizeMode",children:a.jsx(Ar,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:i})}):null}const Hce=e=>{const{id:t,number:n}=e,r=hR(t),o=oe(),{t:s}=J(),i=H(ro),c=Pi(t),[d,p]=Ree(!1),h=l.useCallback(()=>{o(xT({id:t}))},[t,o]),m=l.useCallback(()=>{o(yT(t))},[t,o]),g=l.useCallback(b=>{o(CT({id:t,isEnabled:b.target.checked}))},[t,o]);return r?a.jsxs(N,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(N,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(jr,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:c,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs(N,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Te,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(Hle,{id:t})}),i==="unifiedCanvas"&&a.jsx(Mce,{id:t}),a.jsx(tt,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:m,icon:a.jsx(Hu,{})}),a.jsx(tt,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(qo,{})}),a.jsx(tt,{size:"sm",tooltip:s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:p,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(s0,{sx:{boxSize:4,color:"base.700",transform:d?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs(N,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(N,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(N,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:d?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(Ule,{id:t}),a.jsx(Ace,{id:t})]}),!d&&a.jsx(N,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(j_,{id:t,isSmall:!0})})]}),a.jsxs(N,{sx:{gap:2},children:[a.jsx(Tce,{id:t}),a.jsx(Bce,{id:t})]}),a.jsx(zce,{id:t})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(j_,{id:t}),a.jsx(Pce,{id:t}),a.jsx(jce,{id:t})]})]}):null},Wce=l.memo(Hce),E1=e=>{const t=H(c=>{var d;return(d=c.generation.model)==null?void 0:d.base_model}),n=oe(),r=pR(e),o=l.useMemo(()=>{const c=r.filter(d=>t?d.base_model===t:!0)[0];return c||r[0]},[t,r]),s=l.useMemo(()=>!o,[o]);return[l.useCallback(()=>{s||n(wT({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},Vce=de([Ce],({controlAdapters:e})=>{const t=[];let n=!1;const r=ST(e).filter(h=>h.isEnabled).length,o=kT(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=jT(e).filter(h=>h.isEnabled).length,i=_T(e).length;s>0&&t.push(`${s} ControlNet`),s>i&&(n=!0);const c=IT(e).filter(h=>h.isEnabled).length,d=PT(e).length;return c>0&&t.push(`${c} T2I`),c>d&&(n=!0),{controlAdapterIds:ET(e).map(String),activeLabel:t.join(", "),isError:n}},_e),Uce=()=>{const{t:e}=J(),{controlAdapterIds:t,activeLabel:n}=H(Vce),r=jn("controlNet").isFeatureDisabled,[o,s]=E1("controlnet"),[i,c]=E1("ip_adapter"),[d,p]=E1("t2i_adapter");return r?null:a.jsx(Ao,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsxs(zn,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Rt,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(Yi,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Rt,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(Yi,{}),onClick:i,"data-testid":"add ip adapter",flexGrow:1,isDisabled:c,children:e("common.ipAdapter")}),a.jsx(Rt,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(Yi,{}),onClick:d,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:p,children:e("common.t2iAdapter")})]}),t.map((h,m)=>a.jsxs(l.Fragment,{children:[a.jsx(no,{}),a.jsx(Wce,{id:h,number:m+1})]},h))]})})},Xu=l.memo(Uce),Gce=e=>{const{onClick:t}=e,{t:n}=J();return a.jsx(tt,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(HM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},C0=l.memo(Gce),qce="28rem",Kce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=MT(),i=l.useRef(null),{t:c}=J(),d=H(g=>g.generation.model),p=l.useMemo(()=>{if(!s)return[];const g=[];return Kr(s.entities,(b,y)=>{if(!b)return;const x=(d==null?void 0:d.base_model)!==b.base_model;g.push({value:b.model_name,label:b.model_name,group:gr[b.base_model],disabled:x,tooltip:x?`${c("embedding.incompatibleModel")} ${b.base_model}`:void 0})}),g.sort((b,y)=>{var x;return b.label&&y.label?(x=b.label)!=null&&x.localeCompare(y.label)?-1:1:-1}),g.sort((b,y)=>b.disabled&&!y.disabled?1:-1)},[s,d==null?void 0:d.base_model,c]),h=l.useCallback(g=>{g&&t(g)},[t]),m=l.useCallback((g,b)=>{var y;return((y=b.label)==null?void 0:y.toLowerCase().includes(g.toLowerCase().trim()))||b.value.toLowerCase().includes(g.toLowerCase().trim())},[]);return a.jsxs(Nf,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Rg,{children:o}),a.jsx($f,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Ag,{sx:{p:0,w:`calc(${qce} - 2rem )`},children:p.length===0?a.jsx(N,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(Se,{children:"No Embeddings Loaded"})}):a.jsx(tr,{inputRef:i,autoFocus:!0,placeholder:c("embedding.addEmbedding"),value:null,data:p,nothingFound:c("embedding.noMatchingEmbedding"),itemComponent:pl,disabled:p.length===0,onDropdownClose:r,filter:m,onChange:h})})})]})},w0=l.memo(Kce),Qce=()=>{const e=H(m=>m.generation.negativePrompt),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ls(),s=oe(),{t:i}=J(),c=l.useCallback(m=>{s(Ad(m.target.value))},[s]),d=l.useCallback(m=>{m.key==="<"&&o()},[o]),p=l.useCallback(m=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let b=e.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=e.slice(g),rs.flushSync(()=>{s(Ad(b))}),t.current.selectionEnd=y,r()},[s,r,e]),h=jn("embedding").isFeatureEnabled;return a.jsxs(Bn,{children:[a.jsx(w0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(wn,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(vi,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:c,resize:"vertical",fontSize:"sm",minH:16,...h&&{onKeyDown:d}})})}),!n&&h&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:o})})]})},gR=l.memo(Qce),Xce=de([Ce],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Tn}}),Yce=()=>{const e=oe(),{prompt:t}=H(Xce),n=l.useRef(null),{isOpen:r,onClose:o,onOpen:s}=ls(),{t:i}=J(),c=l.useCallback(m=>{e(Rd(m.target.value))},[e]);It("alt+a",()=>{var m;(m=n.current)==null||m.focus()},[]);const d=l.useCallback(m=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let b=t.slice(0,g);b[b.length-1]!=="<"&&(b+="<"),b+=`${m}>`;const y=b.length;b+=t.slice(g),rs.flushSync(()=>{e(Rd(b))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=jn("embedding").isFeatureEnabled,h=l.useCallback(m=>{p&&m.key==="<"&&s()},[s,p]);return a.jsxs(Te,{position:"relative",children:[a.jsx(Bn,{children:a.jsx(w0,{isOpen:r,onClose:o,onSelect:d,children:a.jsx(wn,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(vi,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:c,onKeyDown:h,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:s})})]})},vR=l.memo(Yce);function Jce(){const e=H(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=oe(),{t:n}=J(),r=l.useCallback(()=>{t(OT(!e))},[t,e]);return a.jsx(tt,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(qM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const N_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function bR(){return a.jsxs(N,{children:[a.jsx(Te,{as:Or.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...N_,_dark:{borderColor:"accent.500"}}}),a.jsx(Te,{as:Or.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(qM,{size:12})}),a.jsx(Te,{as:Or.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...N_,_dark:{borderColor:"accent.500"}}})]})}const Zce=de([Ce],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),eue=()=>{const e=oe(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ls(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(Zce),d=l.useCallback(g=>{e(Td(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),rs.flushSync(()=>{e(Td(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=jn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Te,{position:"relative",children:[a.jsx(yo,{children:c&&a.jsx(Te,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(bR,{})})}),a.jsx(Bn,{children:a.jsx(w0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(vi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&h&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:o})})]})},tue=l.memo(eue),nue=de([Ce],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),rue=()=>{const e=oe(),t=l.useRef(null),{isOpen:n,onClose:r,onOpen:o}=ls(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:c}=H(nue),d=l.useCallback(g=>{e(Dd(g.target.value))},[e]),p=l.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=i.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=i.slice(b),rs.flushSync(()=>{e(Dd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,i]),h=jn("embedding").isFeatureEnabled,m=l.useCallback(g=>{h&&g.key==="<"&&o()},[o,h]);return a.jsxs(Te,{position:"relative",children:[a.jsx(yo,{children:c&&a.jsx(Te,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(bR,{})})}),a.jsx(Bn,{children:a.jsx(w0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(vi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:d,onKeyDown:m,resize:"vertical",minH:16})})}),!n&&h&&a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(C0,{onClick:o})})]})},oue=l.memo(rue);function H2(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(vR,{}),a.jsx(Jce,{}),a.jsx(oue,{}),a.jsx(gR,{}),a.jsx(tue,{})]})}const vl=()=>{const{isRefinerAvailable:e}=na(Fx,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},sue=de([Ce],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},_e),aue=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=H(sue),r=vl(),o=oe(),{t:s}=J(),i=l.useCallback(d=>o(V1(d)),[o]),c=l.useCallback(()=>o(V1(7)),[o]);return t?a.jsx(Pt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:c,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(ja,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},iue=l.memo(aue),lue=e=>{const t=Ci("models"),[n,r,o]=e.split("/"),s=RT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},cue=de(Ce,e=>({model:e.sdxl.refinerModel}),_e),uue=()=>{const e=oe(),t=jn("syncModels").isFeatureEnabled,{model:n}=H(cue),{t:r}=J(),{data:o,isLoading:s}=na(Fx),i=l.useMemo(()=>{if(!o)return[];const p=[];return Kr(o.entities,(h,m)=>{h&&p.push({value:m,label:h.model_name,group:gr[h.base_model]})}),p},[o]),c=l.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),d=l.useCallback(p=>{if(!p)return;const h=lue(p);h&&e(BI(h))},[e]);return s?a.jsx(tr,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{tooltip:c==null?void 0:c.description,label:r("sdxl.refinermodel"),value:c==null?void 0:c.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:d,w:"100%"}),t&&a.jsx(Te,{mt:7,children:a.jsx(Gu,{iconMode:!0})})]})},due=l.memo(uue),fue=de([Ce],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},_e),pue=()=>{const{refinerNegativeAestheticScore:e,shift:t}=H(fue),n=vl(),r=oe(),{t:o}=J(),s=l.useCallback(c=>r(G1(c)),[r]),i=l.useCallback(()=>r(G1(2.5)),[r]);return a.jsx(Pt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},hue=l.memo(pue),mue=de([Ce],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},_e),gue=()=>{const{refinerPositiveAestheticScore:e,shift:t}=H(mue),n=vl(),r=oe(),{t:o}=J(),s=l.useCallback(c=>r(U1(c)),[r]),i=l.useCallback(()=>r(U1(6)),[r]);return a.jsx(Pt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},vue=l.memo(gue),bue=de(Ce,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(sg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},_e),xue=()=>{const e=oe(),{t}=J(),{refinerScheduler:n,data:r}=H(bue),o=vl(),s=l.useCallback(i=>{i&&e(HI(i))},[e]);return a.jsx(tr,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},yue=l.memo(xue),Cue=de([Ce],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},_e),wue=()=>{const{refinerStart:e}=H(Cue),t=oe(),n=vl(),r=l.useCallback(i=>t(q1(i)),[t]),{t:o}=J(),s=l.useCallback(()=>t(q1(.8)),[t]);return a.jsx(Pt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Sue=l.memo(wue),kue=de([Ce],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},_e),jue=()=>{const{refinerSteps:e,shouldUseSliders:t}=H(kue),n=vl(),r=oe(),{t:o}=J(),s=l.useCallback(c=>{r(W1(c))},[r]),i=l.useCallback(()=>{r(W1(20))},[r]);return t?a.jsx(Pt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(ja,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},_ue=l.memo(jue);function Iue(){const e=H(s=>s.sdxl.shouldUseSDXLRefiner),t=vl(),n=oe(),{t:r}=J(),o=l.useCallback(s=>{n(AT(s.target.checked))},[n]);return a.jsx(jr,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Pue=de(Ce,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},_e),Eue=()=>{const{activeLabel:e,shouldUseSliders:t}=H(Pue),{t:n}=J();return vl()?a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Iue,{}),a.jsx(due,{}),a.jsxs(N,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(_ue,{}),a.jsx(iue,{})]}),a.jsx(yue,{}),a.jsx(vue,{}),a.jsx(hue,{}),a.jsx(Sue,{})]})}):a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx(N,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},W2=l.memo(Eue),Mue=de([Ce],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:p}=n,{shift:h}=r;return{cfgScale:d,initial:o,min:s,sliderMax:i,inputMax:c,shouldUseSliders:p,shift:h}},_e),Oue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=H(Mue),c=oe(),{t:d}=J(),p=l.useCallback(m=>c(zh(m)),[c]),h=l.useCallback(()=>c(zh(t)),[c,t]);return s?a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(Pt,{label:d("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:h,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(ja,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Da=l.memo(Oue),Rue=de(Ce,e=>({model:e.generation.model}),_e),Aue=()=>{const e=oe(),{t}=J(),{model:n}=H(Rue),r=jn("syncModels").isFeatureEnabled,{data:o,isLoading:s}=na(Yw),{data:i,isLoading:c}=Wd(Yw),d=H(ro),p=l.useMemo(()=>{if(!o)return[];const g=[];return Kr(o.entities,(b,y)=>{b&&g.push({value:y,label:b.model_name,group:gr[b.base_model]})}),Kr(i==null?void 0:i.entities,(b,y)=>{!b||d==="unifiedCanvas"||d==="img2img"||g.push({value:y,label:b.model_name,group:gr[b.base_model]})}),g},[o,i,d]),h=l.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),m=l.useCallback(g=>{if(!g)return;const b=y0(g);b&&e(z1(b))},[e]);return s||c?a.jsx(tr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(N,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(wn,{feature:"paramModel",children:a.jsx(tr,{tooltip:h==null?void 0:h.description,label:t("modelManager.model"),value:h==null?void 0:h.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:m,w:"100%"})}),r&&a.jsx(Te,{mt:6,children:a.jsx(Gu,{iconMode:!0})})]})},Due=l.memo(Aue),Tue=de(Ce,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},_e),Nue=()=>{const e=oe(),{t}=J(),{model:n,vae:r}=H(Tue),{data:o}=sP(),s=l.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return Kr(o.entities,(p,h)=>{if(!p)return;const m=(n==null?void 0:n.base_model)!==p.base_model;d.push({value:h,label:p.model_name,group:gr[p.base_model],disabled:m,tooltip:m?`Incompatible base model: ${p.base_model}`:void 0})}),d.sort((p,h)=>p.disabled&&!h.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=l.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),c=l.useCallback(d=>{if(!d||d==="default"){e(Wc(null));return}const p=cR(d);p&&e(Wc(p))},[e]);return a.jsx(wn,{feature:"paramVAE",children:a.jsx(tr,{itemComponent:pl,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:c,disabled:s.length===0,clearable:!0})})},$ue=l.memo(Nue),Lue=de([lP,la],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(sg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},_e),zue=()=>{const e=oe(),{t}=J(),{scheduler:n,data:r}=H(Lue),o=l.useCallback(s=>{s&&e(F1(s))},[e]);return a.jsx(wn,{feature:"paramScheduler",children:a.jsx(tr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},Fue=l.memo(zue),Bue=de(Ce,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},_e),Hue=["fp16","fp32"],Wue=()=>{const{t:e}=J(),t=oe(),{vaePrecision:n}=H(Bue),r=l.useCallback(o=>{o&&t(DT(o))},[t]);return a.jsx(wn,{feature:"paramVAEPrecision",children:a.jsx(Ar,{label:e("modelManager.vaePrecision"),value:n,data:Hue,onChange:r})})},Vue=l.memo(Wue),Uue=()=>{const e=jn("vae").isFeatureEnabled;return a.jsxs(N,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Te,{w:"full",children:a.jsx(Due,{})}),a.jsx(Te,{w:"full",children:a.jsx(Fue,{})}),e&&a.jsxs(N,{w:"full",gap:3,children:[a.jsx($ue,{}),a.jsx(Vue,{})]})]})},Ta=l.memo(Uue),xR=[{name:on.t("parameters.aspectRatioFree"),value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],yR=xR.map(e=>e.value);function CR(){const e=H(s=>s.generation.aspectRatio),t=oe(),n=H(s=>s.generation.shouldFitToWidthHeight),r=H(ro),o=l.useCallback(s=>{t(Us(s.value)),t(Vd(!1))},[t]);return a.jsx(zn,{isAttached:!0,children:xR.map(s=>a.jsx(Rt,{size:"sm",isChecked:e===s.value,isDisabled:r==="img2img"?!n:!1,onClick:o.bind(null,s),children:s.name},s.name))})}const Gue=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.height,{model:d,height:p}=e,{aspectRatio:h}=e,m=t.shift?i:c;return{model:d,height:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},_e),que=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(Gue),d=oe(),{t:p}=J(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Wl(b)),c){const y=Mo(b*c,8);d(Hl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Wl(h)),c){const b=Mo(h*c,8);d(Hl(b))}},[d,h,c]);return a.jsx(Pt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Kue=l.memo(que),Que=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:c}=n.sd.width,{model:d,width:p,aspectRatio:h}=e,m=t.shift?i:c;return{model:d,width:p,min:r,sliderMax:o,inputMax:s,step:m,aspectRatio:h}},_e),Xue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:c}=H(Que),d=oe(),{t:p}=J(),h=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,m=l.useCallback(b=>{if(d(Hl(b)),c){const y=Mo(b/c,8);d(Wl(y))}},[d,c]),g=l.useCallback(()=>{if(d(Hl(h)),c){const b=Mo(h/c,8);d(Wl(b))}},[d,h,c]);return a.jsx(Pt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:m,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Yue=l.memo(Xue),Jue=de([la,ro],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},_e);function Eu(){const{t:e}=J(),t=oe(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=H(Jue),c=l.useCallback(()=>{o?(t(Vd(!1)),yR.includes(s/i)?t(Us(s/i)):t(Us(null))):(t(Vd(!0)),t(Us(s/i)))},[o,s,i,t]),d=l.useCallback(()=>{t(TT()),t(Us(null)),o&&t(Us(i/s))},[t,o,s,i]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(wn,{feature:"paramRatio",children:a.jsxs(Bn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(vr,{children:e("parameters.aspectRatio")}),a.jsx(ji,{}),a.jsx(CR,{}),a.jsx(tt,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:d}),a.jsx(tt,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(KM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:c})]})}),a.jsx(N,{gap:2,alignItems:"center",children:a.jsxs(N,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(Yue,{isDisabled:n==="img2img"?!r:!1}),a.jsx(Kue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Zue=de([Ce],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:c,fineStep:d,coarseStep:p}=t.sd.steps,{steps:h}=e,{shouldUseSliders:m}=n,g=r.shift?d:p;return{steps:h,initial:o,min:s,sliderMax:i,inputMax:c,step:g,shouldUseSliders:m}},_e),ede=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=H(Zue),c=oe(),{t:d}=J(),p=l.useCallback(g=>{c(Fh(g))},[c]),h=l.useCallback(()=>{c(Fh(t))},[c,t]),m=l.useCallback(()=>{c(Lx())},[c]);return i?a.jsx(wn,{feature:"paramSteps",children:a.jsx(Pt,{label:d("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:h,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(wn,{feature:"paramSteps",children:a.jsx(ja,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:m})})},Na=l.memo(ede);function wR(){const e=oe(),t=H(o=>o.generation.shouldFitToWidthHeight),n=l.useCallback(o=>{e(NT(o.target.checked))},[e]),{t:r}=J();return a.jsx(jr,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function tde(){const e=H(i=>i.generation.seed),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.shouldGenerateVariations),{t:r}=J(),o=oe(),s=l.useCallback(i=>o(Lh(i)),[o]);return a.jsx(ja,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:cP,max:uP,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const nde=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function rde(){const e=oe(),t=H(o=>o.generation.shouldRandomizeSeed),{t:n}=J(),r=l.useCallback(()=>e(Lh(nde(cP,uP))),[e]);return a.jsx(tt,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(yee,{})})}const ode=()=>{const e=oe(),{t}=J(),n=H(o=>o.generation.shouldRandomizeSeed),r=l.useCallback(o=>e($T(o.target.checked)),[e]);return a.jsx(jr,{label:t("common.random"),isChecked:n,onChange:r})},sde=l.memo(ode),ade=()=>a.jsx(wn,{feature:"paramSeed",children:a.jsxs(N,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(tde,{}),a.jsx(rde,{}),a.jsx(sde,{})]})}),$a=l.memo(ade),SR=Oe((e,t)=>a.jsxs(N,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(Se,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));SR.displayName="SubSettingsWrapper";const Mu=l.memo(SR),ide=de([Ce],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},_e),lde=()=>{const{sdxlImg2ImgDenoisingStrength:e}=H(ide),t=oe(),{t:n}=J(),r=l.useCallback(s=>t(Jw(s)),[t]),o=l.useCallback(()=>{t(Jw(.7))},[t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(Pt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},kR=l.memo(lde),cde=de([lP,la],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},_e),ude=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=H(cde);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}),a.jsx(kR,{}),a.jsx(wR,{})]})})},dde=l.memo(ude),fde=()=>a.jsxs(a.Fragment,{children:[a.jsx(H2,{}),a.jsx(dde,{}),a.jsx(W2,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(Qu,{})]}),pde=l.memo(fde),V2=()=>{const{t:e}=J(),t=H(i=>i.generation.shouldRandomizeSeed),n=H(i=>i.generation.iterations),r=l.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=l.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:l.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},hde=()=>{const{t:e}=J(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=V2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx(N,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]})})})},jR=l.memo(hde),mde=()=>a.jsxs(a.Fragment,{children:[a.jsx(H2,{}),a.jsx(jR,{}),a.jsx(W2,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(Qu,{})]}),gde=l.memo(mde),vde=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],bde=()=>{const e=oe(),t=H(o=>o.generation.canvasCoherenceMode),{t:n}=J(),r=l.useCallback(o=>{o&&e(LT(o))},[e]);return a.jsx(wn,{feature:"compositingCoherenceMode",children:a.jsx(Ar,{label:n("parameters.coherenceMode"),data:vde,value:t,onChange:r})})},xde=l.memo(bde),yde=()=>{const e=oe(),t=H(s=>s.generation.canvasCoherenceSteps),{t:n}=J(),r=l.useCallback(s=>{e(Zw(s))},[e]),o=l.useCallback(()=>{e(Zw(20))},[e]);return a.jsx(wn,{feature:"compositingCoherenceSteps",children:a.jsx(Pt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Cde=l.memo(yde),wde=()=>{const e=oe(),t=H(s=>s.generation.canvasCoherenceStrength),{t:n}=J(),r=l.useCallback(s=>{e(eS(s))},[e]),o=l.useCallback(()=>{e(eS(.3))},[e]);return a.jsx(wn,{feature:"compositingStrength",children:a.jsx(Pt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})},Sde=l.memo(wde);function kde(){const e=oe(),t=H(s=>s.generation.maskBlur),{t:n}=J(),r=l.useCallback(s=>{e(tS(s))},[e]),o=l.useCallback(()=>{e(tS(16))},[e]);return a.jsx(wn,{feature:"compositingBlur",children:a.jsx(Pt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})}const jde=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function _de(){const e=H(o=>o.generation.maskBlurMethod),t=oe(),{t:n}=J(),r=l.useCallback(o=>{o&&t(zT(o))},[t]);return a.jsx(wn,{feature:"compositingBlurMethod",children:a.jsx(Ar,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:jde})})}const Ide=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Mu,{label:e("parameters.coherencePassHeader"),children:[a.jsx(xde,{}),a.jsx(Cde,{}),a.jsx(Sde,{})]}),a.jsx(no,{}),a.jsxs(Mu,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(kde,{}),a.jsx(_de,{})]})]})})},_R=l.memo(Ide),Pde=de([Ce],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},_e),Ede=()=>{const e=oe(),{infillMethod:t}=H(Pde),{data:n,isLoading:r}=RI(),o=n==null?void 0:n.infill_methods,{t:s}=J(),i=l.useCallback(c=>{e(FT(c))},[e]);return a.jsx(wn,{feature:"infillMethod",children:a.jsx(Ar,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},Mde=l.memo(Ede),Ode=de([la],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},_e),Rde=()=>{const e=oe(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=H(Ode),{t:r}=J(),o=l.useCallback(i=>{e(nS(i))},[e]),s=l.useCallback(()=>{e(nS(2))},[e]);return a.jsx(Pt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Ade=l.memo(Rde),Dde=de([la],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},_e),Tde=()=>{const e=oe(),{infillTileSize:t,infillMethod:n}=H(Dde),{t:r}=J(),o=l.useCallback(i=>{e(rS(i))},[e]),s=l.useCallback(()=>{e(rS(32))},[e]);return a.jsx(Pt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Nde=l.memo(Tde),$de=de([la],e=>{const{infillMethod:t}=e;return{infillMethod:t}},_e);function Lde(){const{infillMethod:e}=H($de);return a.jsxs(N,{children:[e==="tile"&&a.jsx(Nde,{}),e==="patchmatch"&&a.jsx(Ade,{})]})}const _r=e=>e.canvas,Ns=de([Ce],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),zde=de([_r],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},_e),Fde=()=>{const e=oe(),{boundingBoxScale:t}=H(zde),{t:n}=J(),r=l.useCallback(o=>{e(BT(o))},[e]);return a.jsx(wn,{feature:"scaleBeforeProcessing",children:a.jsx(tr,{label:n("parameters.scaleBeforeProcessing"),data:HT,value:t,onChange:r})})},Bde=l.memo(Fde),Hde=de([la,_r],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},_e),Wde=()=>{const e=oe(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(Hde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),c=l.useCallback(p=>{let h=r.width;const m=Math.floor(p);o&&(h=Mo(m*o,64)),e(Uh({width:h,height:m}))},[o,e,r.width]),d=l.useCallback(()=>{let p=r.width;const h=Math.floor(s);o&&(p=Mo(h*o,64)),e(Uh({width:p,height:h}))},[o,e,s,r.width]);return a.jsx(Pt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},Vde=l.memo(Wde),Ude=de([_r,la],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},_e),Gde=()=>{const e=oe(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(Ude),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),c=l.useCallback(p=>{const h=Math.floor(p);let m=r.height;o&&(m=Mo(h/o,64)),e(Uh({width:h,height:m}))},[o,e,r.height]),d=l.useCallback(()=>{const p=Math.floor(s);let h=r.height;o&&(h=Mo(p/o,64)),e(Uh({width:p,height:h}))},[o,e,s,r.height]);return a.jsx(Pt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},qde=l.memo(Gde),Kde=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.infillScalingHeader"),children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Mu,{children:[a.jsx(Mde,{}),a.jsx(Lde,{})]}),a.jsx(no,{}),a.jsxs(Mu,{children:[a.jsx(Bde,{}),a.jsx(qde,{}),a.jsx(Vde,{})]})]})})},IR=l.memo(Kde),Qde=de([Ce,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},_e),Xde=()=>{const e=oe(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(Qde),{t:s}=J(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,c=l.useCallback(p=>{if(e(Xs({...n,height:Math.floor(p)})),o){const h=Mo(p*o,64);e(Xs({width:h,height:Math.floor(p)}))}},[o,n,e]),d=l.useCallback(()=>{if(e(Xs({...n,height:Math.floor(i)})),o){const p=Mo(i*o,64);e(Xs({width:p,height:Math.floor(i)}))}},[o,n,e,i]);return a.jsx(Pt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},Yde=l.memo(Xde),Jde=de([Ce,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},_e),Zde=()=>{const e=oe(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(Jde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),c=l.useCallback(p=>{if(e(Xs({...n,width:Math.floor(p)})),o){const h=Mo(p/o,64);e(Xs({width:Math.floor(p),height:h}))}},[o,n,e]),d=l.useCallback(()=>{if(e(Xs({...n,width:Math.floor(s)})),o){const p=Mo(s/o,64);e(Xs({width:Math.floor(s),height:p}))}},[o,n,e,s]);return a.jsx(Pt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:c,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},efe=l.memo(Zde),tfe=de([la,_r],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function tg(){const e=oe(),{t}=J(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=H(tfe),o=l.useCallback(()=>{n?(e(Vd(!1)),yR.includes(r.width/r.height)?e(Us(r.width/r.height)):e(Us(null))):(e(Vd(!0)),e(Us(r.width/r.height)))},[n,r,e]),s=l.useCallback(()=>{e(WT()),e(Us(null)),n&&e(Us(r.height/r.width))},[e,n,r]);return a.jsxs(N,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(wn,{feature:"paramRatio",children:a.jsxs(Bn,{as:N,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(vr,{children:t("parameters.aspectRatio")}),a.jsx(ji,{}),a.jsx(CR,{}),a.jsx(tt,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,onClick:s}),a.jsx(tt,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(KM,{}),isChecked:n,onClick:o})]})}),a.jsx(efe,{}),a.jsx(Yde,{})]})}const nfe=de(Ce,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},_e),rfe=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=H(nfe);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}),a.jsx(kR,{})]})})},ofe=l.memo(rfe);function sfe(){return a.jsxs(a.Fragment,{children:[a.jsx(H2,{}),a.jsx(ofe,{}),a.jsx(W2,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(IR,{}),a.jsx(_R,{}),a.jsx(Qu,{})]})}function U2(){return a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(vR,{}),a.jsx(gR,{})]})}function afe(){const e=H(i=>i.generation.horizontalSymmetrySteps),t=H(i=>i.generation.steps),n=oe(),{t:r}=J(),o=l.useCallback(i=>{n(oS(i))},[n]),s=l.useCallback(()=>{n(oS(0))},[n]);return a.jsx(Pt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function ife(){const e=H(i=>i.generation.verticalSymmetrySteps),t=H(i=>i.generation.steps),n=oe(),{t:r}=J(),o=l.useCallback(i=>{n(sS(i))},[n]),s=l.useCallback(()=>{n(sS(0))},[n]);return a.jsx(Pt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function lfe(){const e=H(r=>r.generation.shouldUseSymmetry),t=oe(),n=l.useCallback(r=>{t(VT(r.target.checked))},[t]);return a.jsx(jr,{label:"Enable Symmetry",isChecked:e,onChange:n})}const cfe=de(Ce,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),_e),ufe=()=>{const{t:e}=J(),{activeLabel:t}=H(cfe);return jn("symmetry").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(N,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(lfe,{}),a.jsx(afe,{}),a.jsx(ife,{})]})}):null},G2=l.memo(ufe),dfe=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.img2imgStrength,{img2imgStrength:p}=e,h=t.shift?c:d;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h}},_e),ffe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=H(dfe),i=oe(),{t:c}=J(),d=l.useCallback(h=>i(Bh(h)),[i]),p=l.useCallback(()=>{i(Bh(t))},[i,t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Mu,{children:a.jsx(Pt,{label:`${c("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:d,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},PR=l.memo(ffe),pfe=()=>{const{t:e}=J(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=V2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(Eu,{})]}),a.jsx(PR,{}),a.jsx(wR,{})]})})},hfe=l.memo(pfe),mfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(U2,{}),a.jsx(hfe,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(G2,{}),a.jsx(Qu,{})]}),gfe=l.memo(mfe),vfe=de([Ce],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:c,coarseStep:d}=n.sd.hrfStrength,{hrfStrength:p,hrfEnabled:h}=e,m=t.shift?c:d;return{hrfStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m,hrfEnabled:h}},_e),bfe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=H(vfe),i=oe(),{t:c}=J(),d=l.useCallback(()=>{i(Hh(t))},[i,t]),p=l.useCallback(h=>{i(Hh(h))},[i]);return a.jsx(Fn,{label:c("hrf.strengthTooltip"),placement:"right",hasArrow:!0,children:a.jsx(Pt,{label:c("parameters.denoisingStrength"),min:n,max:r,step:o,value:e,onChange:p,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d,isDisabled:!s})})},xfe=l.memo(bfe);function yfe(){const e=oe(),{t}=J(),n=H(o=>o.generation.hrfEnabled),r=l.useCallback(o=>e(B1(o.target.checked)),[e]);return a.jsx(jr,{label:t("hrf.enableHrf"),isChecked:n,onChange:r,tooltip:t("hrf.enableHrfTooltip")})}const Cfe=de(Ce,({generation:e})=>{const{hrfMethod:t,hrfEnabled:n}=e;return{hrfMethod:t,hrfEnabled:n}},_e),wfe=["ESRGAN","bilinear"],Sfe=()=>{const e=oe(),{t}=J(),{hrfMethod:n,hrfEnabled:r}=H(Cfe),o=l.useCallback(s=>{s&&e(H1(s))},[e]);return a.jsx(Ar,{label:t("hrf.upscaleMethod"),value:n,data:wfe,onChange:o,disabled:!r})},kfe=l.memo(Sfe),jfe=de(Ce,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}},_e);function _fe(){const{t:e}=J(),t=jn("hrf").isFeatureEnabled,{hrfEnabled:n}=H(jfe),r=l.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(Ao,{label:e("hrf.hrf"),activeLabel:r,children:a.jsxs(N,{sx:{flexDir:"column",gap:2},children:[a.jsx(yfe,{}),a.jsx(xfe,{}),a.jsx(kfe,{})]})}):null}const Ife=()=>a.jsxs(a.Fragment,{children:[a.jsx(U2,{}),a.jsx(jR,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(G2,{}),a.jsx(_fe,{}),a.jsx(Qu,{})]}),Pfe=l.memo(Ife),Efe=()=>{const{t:e}=J(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=V2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs(N,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(N,{gap:3,children:[a.jsx(ia,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(Te,{pt:2,children:a.jsx($a,{})}),a.jsx(tg,{})]}),a.jsx(PR,{})]})})},Mfe=l.memo(Efe),Ofe=()=>a.jsxs(a.Fragment,{children:[a.jsx(U2,{}),a.jsx(Mfe,{}),a.jsx(Xu,{}),a.jsx(Ku,{}),a.jsx(qu,{}),a.jsx(G2,{}),a.jsx(IR,{}),a.jsx(_R,{}),a.jsx(Qu,{})]}),Rfe=l.memo(Ofe),Afe=()=>{const e=H(ro),t=H(n=>n.generation.model);return e==="txt2img"?a.jsx(Nh,{children:t&&t.base_model==="sdxl"?a.jsx(gde,{}):a.jsx(Pfe,{})}):e==="img2img"?a.jsx(Nh,{children:t&&t.base_model==="sdxl"?a.jsx(pde,{}):a.jsx(gfe,{})}):e==="unifiedCanvas"?a.jsx(Nh,{children:t&&t.base_model==="sdxl"?a.jsx(sfe,{}):a.jsx(Rfe,{})}):null},Dfe=l.memo(Afe),Nh=l.memo(e=>a.jsxs(N,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(O8,{}),a.jsx(N,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(N,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Te,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(o0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(N,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Nh.displayName="ParametersPanelWrapper";const Tfe=de([Ce],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},_e),Nfe=()=>{const{initialImage:e}=H(Tfe),{currentData:t}=Ps((e==null?void 0:e.imageName)??Os.skipToken),n=l.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=l.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(il,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(qr,{label:"No initial image selected"}),dataTestId:"initial-image"})},$fe=l.memo(Nfe),Lfe=de([Ce],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},_e),zfe={type:"SET_INITIAL_IMAGE"},Ffe=()=>{const{isResetButtonDisabled:e}=H(Lfe),t=oe(),{getUploadButtonProps:n,getUploadInputProps:r}=k2({postUploadAction:zfe}),o=l.useCallback(()=>{t(UT())},[t]);return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(N,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(Se,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ji,{}),a.jsx(tt,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(Jg,{}),...n()}),a.jsx(tt,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Yg,{}),onClick:o,isDisabled:e})]}),a.jsx($fe,{}),a.jsx("input",{...r()})]})},Bfe=l.memo(Ffe),Hfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=J(),o=H(s=>s.system.isConnected);return a.jsx(tt,{onClick:t,icon:a.jsx(qo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},ER=()=>{const[e,{isLoading:t}]=cg({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=tP({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=ZI({fixedCacheKey:"pauseProcessor"}),[i,{isLoading:c}]=Tx({fixedCacheKey:"cancelQueueItem"}),[d,{isLoading:p}]=JI({fixedCacheKey:"clearQueue"}),[h,{isLoading:m}]=dP({fixedCacheKey:"pruneQueue"});return t||r||s||c||p||m},Wfe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function Vfe(){const e=H(r=>r.postprocessing.esrganModelName),t=oe(),n=l.useCallback(r=>t(GT(r)),[t]);return a.jsx(Ar,{label:"ESRGAN Model",value:e,itemComponent:pl,onChange:n,data:Wfe})}const Ufe=e=>{const{imageDTO:t}=e,n=oe(),r=ER(),{t:o}=J(),{isOpen:s,onOpen:i,onClose:c}=ls(),{isAllowedToUpscale:d,detail:p}=qT(t),h=l.useCallback(()=>{c(),!(!t||!d)&&n(fP({imageDTO:t}))},[n,t,d,c]);return a.jsx(Uf,{isOpen:s,onClose:c,triggerComponent:a.jsx(tt,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(VM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(N,{sx:{flexDirection:"column",gap:4},children:[a.jsx(Vfe,{}),a.jsx(Rt,{tooltip:p,size:"sm",isDisabled:!t||r||!d,onClick:h,children:o("parameters.upscaleImage")})]})})},Gfe=l.memo(Ufe),qfe=de([Ce,ro],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:c}=t,{shouldShowImageDetails:d,shouldHidePreview:p,shouldShowProgressInViewer:h}=n,{shouldFetchMetadataFromApi:m}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(c!=null&&c.progress_image)||!g,shouldShowImageDetails:d,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:h,lastSelectedImage:g,shouldFetchMetadataFromApi:m}},{memoizeOptions:{resultEqualityCheck:Tn}}),Kfe=()=>{const e=oe(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=H(qfe),i=jn("upscaling").isFeatureEnabled,c=ER(),d=Zl(),{t:p}=J(),{recallBothPrompts:h,recallSeed:m,recallAllParameters:g}=f0(),{currentData:b}=Ps((o==null?void 0:o.image_name)??Os.skipToken),{metadata:y,isLoading:x}=E2(o==null?void 0:o.image_name),{workflow:C,isLoading:S}=M2(o==null?void 0:o.workflow_id),j=l.useCallback(()=>{C&&e(Ax(C))},[e,C]),_=l.useCallback(()=>{g(y)},[y,g]);It("a",_,[y]);const I=l.useCallback(()=>{m(y==null?void 0:y.seed)},[y==null?void 0:y.seed,m]);It("s",I,[b]);const P=l.useCallback(()=>{h(y==null?void 0:y.positive_prompt,y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt)},[y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt,h]);It("p",P,[b]),It("w",j,[C]);const M=l.useCallback(()=>{e(C8()),e(ig(b))},[e,b]);It("shift+i",M,[b]);const R=l.useCallback(()=>{b&&e(fP({imageDTO:b}))},[e,b]),A=l.useCallback(()=>{b&&e(lg([b]))},[e,b]);It("Shift+U",()=>{R()},{enabled:()=>!!(i&&!n&&t)},[i,b,n,t]);const D=l.useCallback(()=>e(KT(!r)),[e,r]);It("i",()=>{b?D():d({title:p("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,r,d]),It("delete",()=>{A()},[e,b]);const O=l.useCallback(()=>{e(AI(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs(N,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(zn,{isAttached:!0,isDisabled:n,children:a.jsxs(Cg,{isLazy:!0,children:[a.jsx(wg,{as:tt,"aria-label":p("parameters.imageActions"),tooltip:p("parameters.imageActions"),isDisabled:!b,icon:a.jsx(Hoe,{})}),a.jsx(Gl,{motionProps:pu,children:b&&a.jsx(w8,{imageDTO:b})})]})}),a.jsxs(zn,{isAttached:!0,isDisabled:n,children:[a.jsx(tt,{isLoading:S,icon:a.jsx(j2,{}),tooltip:`${p("nodes.loadWorkflow")} (W)`,"aria-label":`${p("nodes.loadWorkflow")} (W)`,isDisabled:!C,onClick:j}),a.jsx(tt,{isLoading:x,icon:a.jsx(XM,{}),tooltip:`${p("parameters.usePrompt")} (P)`,"aria-label":`${p("parameters.usePrompt")} (P)`,isDisabled:!(y!=null&&y.positive_prompt),onClick:P}),a.jsx(tt,{isLoading:x,icon:a.jsx(YM,{}),tooltip:`${p("parameters.useSeed")} (S)`,"aria-label":`${p("parameters.useSeed")} (S)`,isDisabled:(y==null?void 0:y.seed)===null||(y==null?void 0:y.seed)===void 0,onClick:I}),a.jsx(tt,{isLoading:x,icon:a.jsx(FM,{}),tooltip:`${p("parameters.useAll")} (A)`,"aria-label":`${p("parameters.useAll")} (A)`,isDisabled:!y,onClick:_})]}),i&&a.jsx(zn,{isAttached:!0,isDisabled:c,children:i&&a.jsx(Gfe,{imageDTO:b})}),a.jsx(zn,{isAttached:!0,children:a.jsx(tt,{icon:a.jsx(HM,{}),tooltip:`${p("parameters.info")} (I)`,"aria-label":`${p("parameters.info")} (I)`,isChecked:r,onClick:D})}),a.jsx(zn,{isAttached:!0,children:a.jsx(tt,{"aria-label":p("settings.displayInProgress"),tooltip:p("settings.displayInProgress"),icon:a.jsx(dee,{}),isChecked:s,onClick:O})}),a.jsx(zn,{isAttached:!0,children:a.jsx(Hfe,{onClick:A})})]})})},Qfe=l.memo(Kfe),Xfe=de([Ce,Dx],(e,t)=>{var j,_;const{data:n,status:r}=QT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?aS.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):aS.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||(o==null?void 0:o.total)===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const c={...t,offset:n.ids.length,limit:YI},d=XT.getSelectors(),p=d.selectAll(n),h=p.findIndex(I=>I.image_name===s.image_name),m=Bl(h+1,0,p.length-1),g=Bl(h-1,0,p.length-1),b=(j=p[m])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,x=b?d.selectById(n,b):void 0,C=y?d.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:h,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:x,prevImage:C,queryArgs:c}},{memoizeOptions:{resultEqualityCheck:Tn}}),MR=()=>{const e=oe(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:c}=H(Xfe),d=l.useCallback(()=>{n&&e(iS(n))},[e,n]),p=l.useCallback(()=>{t&&e(iS(t))},[e,t]),[h]=XI(),m=l.useCallback(()=>{h(s)},[h,s]);return{handlePrevImage:d,handleNextImage:p,isOnFirstImage:c===0,isOnLastImage:c!==void 0&&c===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:m,isFetching:o}};function Yfe(e){return Qe({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 Jfe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=J(),c=l.useCallback(()=>navigator.clipboard.writeText(t.toString()),[t]);return t?a.jsxs(N,{gap:2,children:[n&&a.jsx(Fn,{label:`Recall ${e}`,children:a.jsx(_a,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(Yfe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Fn,{label:`Copy ${e}`,children:a.jsx(_a,{"aria-label":`Copy ${e}`,icon:a.jsx(Hu,{}),size:"xs",variant:"ghost",fontSize:14,onClick:c})}),a.jsxs(N,{direction:o?"column":"row",children:[a.jsxs(Se,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(bg,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(DO,{mx:"2px"})]}):a.jsx(Se,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},Lr=l.memo(Jfe),Zfe=e=>{var F;const{metadata:t}=e,{t:n}=J(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:c,recallScheduler:d,recallVaeModel:p,recallSteps:h,recallWidth:m,recallHeight:g,recallStrength:b,recallHrfEnabled:y,recallHrfStrength:x,recallHrfMethod:C,recallLoRA:S,recallControlNet:j,recallIPAdapter:_,recallT2IAdapter:I}=f0(),P=l.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),M=l.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),R=l.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),A=l.useCallback(()=>{c(t==null?void 0:t.model)},[t==null?void 0:t.model,c]),D=l.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),O=l.useCallback(()=>{g(t==null?void 0:t.height)},[t==null?void 0:t.height,g]),T=l.useCallback(()=>{d(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,d]),Y=l.useCallback(()=>{p(t==null?void 0:t.vae)},[t==null?void 0:t.vae,p]),z=l.useCallback(()=>{h(t==null?void 0:t.steps)},[t==null?void 0:t.steps,h]),W=l.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),Q=l.useCallback(()=>{b(t==null?void 0:t.strength)},[t==null?void 0:t.strength,b]),U=l.useCallback(()=>{y(t==null?void 0:t.hrf_enabled)},[t==null?void 0:t.hrf_enabled,y]),L=l.useCallback(()=>{x(t==null?void 0:t.hrf_strength)},[t==null?void 0:t.hrf_strength,x]),ee=l.useCallback(()=>{C(t==null?void 0:t.hrf_method)},[t==null?void 0:t.hrf_method,C]),K=l.useCallback(X=>{S(X)},[S]),Z=l.useCallback(X=>{j(X)},[j]),se=l.useCallback(X=>{_(X)},[_]),fe=l.useCallback(X=>{I(X)},[I]),G=l.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(X=>Wh(X.control_model)):[],[t==null?void 0:t.controlnets]),te=l.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(X=>Wh(X.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),V=l.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(X=>YT(X.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:(console.log(t),a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(Lr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(Lr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(Lr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:P}),t.negative_prompt&&a.jsx(Lr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:M}),t.seed!==void 0&&t.seed!==null&&a.jsx(Lr,{label:n("metadata.seed"),value:t.seed,onClick:R}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(Lr,{label:n("metadata.model"),value:t.model.model_name,onClick:A}),t.width&&a.jsx(Lr,{label:n("metadata.width"),value:t.width,onClick:D}),t.height&&a.jsx(Lr,{label:n("metadata.height"),value:t.height,onClick:O}),t.scheduler&&a.jsx(Lr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:T}),a.jsx(Lr,{label:n("metadata.vae"),value:((F=t.vae)==null?void 0:F.model_name)??"Default",onClick:Y}),t.steps&&a.jsx(Lr,{label:n("metadata.steps"),value:t.steps,onClick:z}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(Lr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:W}),t.strength&&a.jsx(Lr,{label:n("metadata.strength"),value:t.strength,onClick:Q}),t.hrf_enabled&&a.jsx(Lr,{label:n("hrf.metadata.enabled"),value:t.hrf_enabled,onClick:U}),t.hrf_enabled&&t.hrf_strength&&a.jsx(Lr,{label:n("hrf.metadata.strength"),value:t.hrf_strength,onClick:L}),t.hrf_enabled&&t.hrf_method&&a.jsx(Lr,{label:n("hrf.metadata.method"),value:t.hrf_method,onClick:ee}),t.loras&&t.loras.map((X,ue)=>{if($I(X.lora))return a.jsx(Lr,{label:"LoRA",value:`${X.lora.model_name} - ${X.weight}`,onClick:K.bind(null,X)},ue)}),G.map((X,ue)=>{var q;return a.jsx(Lr,{label:"ControlNet",value:`${(q=X.control_model)==null?void 0:q.model_name} - ${X.control_weight}`,onClick:Z.bind(null,X)},ue)}),te.map((X,ue)=>{var q;return a.jsx(Lr,{label:"IP Adapter",value:`${(q=X.ip_adapter_model)==null?void 0:q.model_name} - ${X.weight}`,onClick:se.bind(null,X)},ue)}),V.map((X,ue)=>{var q;return a.jsx(Lr,{label:"T2I Adapter",value:`${(q=X.t2i_adapter_model)==null?void 0:q.model_name} - ${X.weight}`,onClick:fe.bind(null,X)},ue)})]}))},epe=l.memo(Zfe),tpe=({image:e})=>{const{t}=J(),{metadata:n}=E2(e.image_name),{workflow:r}=M2(e.workflow_id);return a.jsxs(N,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(N,{gap:2,children:[a.jsx(Se,{fontWeight:"semibold",children:"File:"}),a.jsxs(bg,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(DO,{mx:"2px"})]})]}),a.jsxs(tc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(nc,{children:[a.jsx(xo,{children:t("metadata.recallParameters")}),a.jsx(xo,{children:t("metadata.metadata")}),a.jsx(xo,{children:t("metadata.imageDetails")}),a.jsx(xo,{children:t("metadata.workflow")})]}),a.jsxs(zu,{children:[a.jsx(Ho,{children:n?a.jsx(lc,{children:a.jsx(epe,{metadata:n})}):a.jsx(qr,{label:t("metadata.noRecallParameters")})}),a.jsx(Ho,{children:n?a.jsx(el,{data:n,label:t("metadata.metadata")}):a.jsx(qr,{label:t("metadata.noMetaData")})}),a.jsx(Ho,{children:e?a.jsx(el,{data:e,label:t("metadata.imageDetails")}):a.jsx(qr,{label:t("metadata.noImageDetails")})}),a.jsx(Ho,{children:r?a.jsx(el,{data:r,label:t("metadata.workflow")}):a.jsx(qr,{label:t("nodes.noWorkflow")})})]})]})]})},npe=l.memo(tpe),M1={color:"base.100",pointerEvents:"auto"},rpe=()=>{const{t:e}=J(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:c}=MR();return a.jsxs(Te,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Te,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(_a,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(GZ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:M1})}),a.jsxs(Te,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(_a,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(qZ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:M1}),o&&i&&!c&&a.jsx(_a,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(UZ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:M1}),o&&i&&c&&a.jsx(N,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(bi,{opacity:.5,size:"xl"})})]})]})},OR=l.memo(rpe),ope=de([Ce,JT],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:c}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:c}},{memoizeOptions:{resultEqualityCheck:Tn}}),spe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=H(ope),{handlePrevImage:s,handleNextImage:i,isOnLastImage:c,handleLoadMoreImages:d,areMoreImagesAvailable:p,isFetching:h}=MR();It("left",()=>{s()},[s]),It("right",()=>{if(c&&p&&!h){d();return}c||i()},[c,p,d,h,i]);const{currentData:m}=Ps(t??Os.skipToken),g=l.useMemo(()=>{if(m)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:m}}},[m]),b=l.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,x]=l.useState(!1),C=l.useRef(0),{t:S}=J(),j=l.useCallback(()=>{x(!0),window.clearTimeout(C.current)},[]),_=l.useCallback(()=>{C.current=window.setTimeout(()=>{x(!1)},500)},[]);return a.jsxs(N,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(Si,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(il,{imageDTO:m,droppableData:b,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(qr,{icon:Ql,label:"No image selected"}),dataTestId:"image-preview"}),e&&m&&a.jsx(Te,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(npe,{image:m})}),a.jsx(yo,{children:!e&&m&&y&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(OR,{})},"nextPrevButtons")})]})},ape=l.memo(spe),ipe=()=>a.jsxs(N,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(Qfe,{}),a.jsx(ape,{})]}),lpe=l.memo(ipe),cpe=()=>a.jsx(Te,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(N,{sx:{width:"100%",height:"100%"},children:a.jsx(lpe,{})})}),RR=l.memo(cpe),upe=()=>{const e=l.useRef(null),t=l.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=N2();return a.jsx(Te,{sx:{w:"full",h:"full"},children:a.jsxs(g0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Zi,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(Bfe,{})}),a.jsx(Zm,{onDoubleClick:t}),a.jsx(Zi,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(RR,{})})]})})},dpe=l.memo(upe);var fpe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const $_=hf(fpe);function lx(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var ppe=Object.defineProperty,L_=Object.getOwnPropertySymbols,hpe=Object.prototype.hasOwnProperty,mpe=Object.prototype.propertyIsEnumerable,z_=(e,t,n)=>t in e?ppe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gpe=(e,t)=>{for(var n in t||(t={}))hpe.call(t,n)&&z_(e,n,t[n]);if(L_)for(var n of L_(t))mpe.call(t,n)&&z_(e,n,t[n]);return e};function AR(e,t){if(t===null||typeof t!="object")return{};const n=gpe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const vpe="__MANTINE_FORM_INDEX__";function F_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${vpe}`)):!1:!1}function B_(e,t,n){typeof n.value=="object"&&(n.value=Qc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function Qc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(Qc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,c){o.set(Qc(c),Qc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(Qc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function cx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],c=`${n===""?"":`${n}.`}${s}`,d=ni(c,t);let p=!1;return typeof i=="function"&&(o[c]=i(d,t,c)),typeof i=="object"&&Array.isArray(d)&&(p=!0,d.forEach((h,m)=>cx(i,t,`${c}.${m}`,o))),typeof i=="object"&&typeof d=="object"&&d!==null&&(p||cx(i,t,c,o)),o},r)}function ux(e,t){return H_(typeof e=="function"?e(t):cx(e,t))}function yh(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=ux(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,c)=>i===s.split(".")[c]));return{hasError:!!o,error:o?r.errors[o]:null}}function bpe(e,{from:t,to:n},r){const o=ni(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),S0(e,s,r)}var xpe=Object.defineProperty,W_=Object.getOwnPropertySymbols,ype=Object.prototype.hasOwnProperty,Cpe=Object.prototype.propertyIsEnumerable,V_=(e,t,n)=>t in e?xpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wpe=(e,t)=>{for(var n in t||(t={}))ype.call(t,n)&&V_(e,n,t[n]);if(W_)for(var n of W_(t))Cpe.call(t,n)&&V_(e,n,t[n]);return e};function Spe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=wpe({},r);return Object.keys(r).every(c=>{let d,p;if(c.startsWith(o)&&(d=c,p=c.replace(o,s)),c.startsWith(s)&&(d=c.replace(s,o),p=c),d&&p){const h=i[d],m=i[p];return m===void 0?delete i[d]:i[d]=m,h===void 0?delete i[p]:i[p]=h,!1}return!0}),i}function kpe(e,t,n){const r=ni(e,n);return Array.isArray(r)?S0(e,r.filter((o,s)=>s!==t),n):n}var jpe=Object.defineProperty,U_=Object.getOwnPropertySymbols,_pe=Object.prototype.hasOwnProperty,Ipe=Object.prototype.propertyIsEnumerable,G_=(e,t,n)=>t in e?jpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ppe=(e,t)=>{for(var n in t||(t={}))_pe.call(t,n)&&G_(e,n,t[n]);if(U_)for(var n of U_(t))Ipe.call(t,n)&&G_(e,n,t[n]);return e};function q_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function K_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=AR(`${o}.${t}`,s));const i=Ppe({},s),c=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const p=q_(d,o);return Number.isNaN(p)?!1:p>=t}).forEach(([d,p])=>{const h=q_(d,o),m=d.replace(`${o}.${h}`,`${o}.${h+r}`);i[m]=p,c.add(m),c.has(d)||delete i[d]}),i}function Epe(e,t,n,r){const o=ni(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),S0(e,s,r)}function Q_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Mpe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Ope=Object.defineProperty,Rpe=Object.defineProperties,Ape=Object.getOwnPropertyDescriptors,X_=Object.getOwnPropertySymbols,Dpe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,Y_=(e,t,n)=>t in e?Ope(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fi=(e,t)=>{for(var n in t||(t={}))Dpe.call(t,n)&&Y_(e,n,t[n]);if(X_)for(var n of X_(t))Tpe.call(t,n)&&Y_(e,n,t[n]);return e},O1=(e,t)=>Rpe(e,Ape(t));function cc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:c=p=>p,validate:d}={}){const[p,h]=l.useState(r),[m,g]=l.useState(n),[b,y]=l.useState(e),[x,C]=l.useState(lx(t)),S=l.useRef(e),j=V=>{S.current=V},_=l.useCallback(()=>h({}),[]),I=V=>{const F=V?Fi(Fi({},b),V):b;j(F),g({})},P=l.useCallback(V=>C(F=>lx(typeof V=="function"?V(F):V)),[]),M=l.useCallback(()=>C({}),[]),R=l.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),A=l.useCallback((V,F)=>P(X=>O1(Fi({},X),{[V]:F})),[]),D=l.useCallback(V=>P(F=>{if(typeof V!="string")return F;const X=Fi({},F);return delete X[V],X}),[]),O=l.useCallback(V=>g(F=>{if(typeof V!="string")return F;const X=AR(V,F);return delete X[V],X}),[]),T=l.useCallback((V,F)=>{const X=F_(V,s);O(V),h(ue=>O1(Fi({},ue),{[V]:!0})),y(ue=>{const q=S0(V,F,ue);if(X){const ne=yh(V,d,q);ne.hasError?A(V,ne.error):D(V)}return q}),!X&&o&&A(V,null)},[]),Y=l.useCallback(V=>{y(F=>{const X=typeof V=="function"?V(F):V;return Fi(Fi({},F),X)}),o&&M()},[]),z=l.useCallback((V,F)=>{O(V),y(X=>bpe(V,F,X)),C(X=>Spe(V,F,X))},[]),W=l.useCallback((V,F)=>{O(V),y(X=>kpe(V,F,X)),C(X=>K_(V,F,X,-1))},[]),Q=l.useCallback((V,F,X)=>{O(V),y(ue=>Epe(V,F,X,ue)),C(ue=>K_(V,X,ue,1))},[]),U=l.useCallback(()=>{const V=ux(d,b);return C(V.errors),V},[b,d]),L=l.useCallback(V=>{const F=yh(V,d,b);return F.hasError?A(V,F.error):D(V),F},[b,d]),ee=(V,{type:F="input",withError:X=!0,withFocus:ue=!0}={})=>{const ne={onChange:Mpe(pe=>T(V,pe))};return X&&(ne.error=x[V]),F==="checkbox"?ne.checked=ni(V,b):ne.value=ni(V,b),ue&&(ne.onFocus=()=>h(pe=>O1(Fi({},pe),{[V]:!0})),ne.onBlur=()=>{if(F_(V,i)){const pe=yh(V,d,b);pe.hasError?A(V,pe.error):D(V)}}),ne},K=(V,F)=>X=>{X==null||X.preventDefault();const ue=U();ue.hasErrors?F==null||F(ue.errors,b,X):V==null||V(c(b),X)},Z=V=>c(V||b),se=l.useCallback(V=>{V.preventDefault(),R()},[]),fe=V=>{if(V){const X=ni(V,m);if(typeof X=="boolean")return X;const ue=ni(V,b),q=ni(V,S.current);return!$_(ue,q)}return Object.keys(m).length>0?Q_(m):!$_(b,S.current)},G=l.useCallback(V=>Q_(p,V),[p]),te=l.useCallback(V=>V?!yh(V,d,b).hasError:!ux(d,b).hasErrors,[b,d]);return{values:b,errors:x,setValues:Y,setErrors:P,setFieldValue:T,setFieldError:A,clearFieldError:D,clearErrors:M,reset:R,validate:U,validateField:L,reorderListItem:z,removeListItem:W,insertListItem:Q,getInputProps:ee,onSubmit:K,onReset:se,isDirty:fe,isTouched:G,setTouched:h,setDirty:g,resetTouched:_,resetDirty:I,isValid:te,getTransformedValues:Z}}function Mr(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:c,base900:d,accent500:p,accent300:h}=Hf(),{colorMode:m}=wi(),g=l.useCallback(()=>({input:{color:Ke(d,r)(m),backgroundColor:Ke(n,d)(m),borderColor:Ke(o,i)(m),borderWidth:2,outline:"none",":focus":{borderColor:Ke(h,p)(m)}},label:{color:Ke(c,s)(m),fontWeight:"normal",marginBottom:4}}),[h,p,r,o,s,n,c,i,d,m]);return a.jsx(MM,{styles:g,...t})}const Npe=[{value:"sd-1",label:gr["sd-1"]},{value:"sd-2",label:gr["sd-2"]},{value:"sdxl",label:gr.sdxl},{value:"sdxl-refiner",label:gr["sdxl-refiner"]}];function Qf(e){const{...t}=e,{t:n}=J();return a.jsx(Ar,{label:n("modelManager.baseModel"),data:Npe,...t})}function TR(e){const{data:t}=pP(),{...n}=e;return a.jsx(Ar,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const $pe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function k0(e){const{...t}=e,{t:n}=J();return a.jsx(Ar,{label:n("modelManager.variant"),data:$pe,...t})}function ng(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function NR(e){const{t}=J(),n=oe(),{model_path:r}=e,o=cc({initialValues:{model_name:r?ng(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=hP(),[i,c]=l.useState(!1),d=m=>{s({body:m}).unwrap().then(g=>{n(Bt(Zn({title:t("modelManager.modelAdded",{modelName:m.model_name}),status:"success"}))),o.reset(),r&&n(xf(null))}).catch(g=>{g&&n(Bt(Zn({title:t("toast.modelAddFailed"),status:"error"})))})},p=l.useCallback(m=>{if(o.values.model_name===""){const g=ng(m.currentTarget.value);g&&o.setFieldValue("model_name",g)}},[o]),h=l.useCallback(()=>c(m=>!m),[]);return a.jsx("form",{onSubmit:o.onSubmit(m=>d(m)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Mr,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Qf,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(Mr,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p}),a.jsx(Mr,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(Mr,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(k0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(N,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Mr,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(TR,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Io,{isChecked:i,onChange:h,label:t("modelManager.useCustomConfig")}),a.jsx(Rt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function $R(e){const{t}=J(),n=oe(),{model_path:r}=e,[o]=hP(),s=cc({initialValues:{model_name:r?ng(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=d=>{o({body:d}).unwrap().then(p=>{n(Bt(Zn({title:t("modelManager.modelAdded",{modelName:d.model_name}),status:"success"}))),s.reset(),r&&n(xf(null))}).catch(p=>{p&&n(Bt(Zn({title:t("toast.modelAddFailed"),status:"error"})))})},c=l.useCallback(d=>{if(s.values.model_name===""){const p=ng(d.currentTarget.value,!1);p&&s.setFieldValue("model_name",p)}},[s]);return a.jsx("form",{onSubmit:s.onSubmit(d=>i(d)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",gap:2,children:[a.jsx(Mr,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Qf,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(Mr,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:c}),a.jsx(Mr,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(Mr,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(k0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Rt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const LR=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Lpe(){const[e,t]=l.useState("diffusers"),{t:n}=J(),r=l.useCallback(o=>{o&&t(o)},[]);return a.jsxs(N,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Ar,{label:n("modelManager.modelType"),value:e,data:LR,onChange:r}),a.jsxs(N,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx($R,{}),e==="checkpoint"&&a.jsx(NR,{})]})]})}const zpe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function Fpe(){const e=oe(),{t}=J(),[n,{isLoading:r}]=mP(),o=cc({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const c={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:c}).unwrap().then(d=>{e(Bt(Zn({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(d=>{d&&e(Bt(Zn({title:`${d.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(N,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Mr,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Ar,{label:t("modelManager.predictionType"),data:zpe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Rt,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function Bpe(){const[e,t]=l.useState("simple"),n=l.useCallback(()=>t("simple"),[]),r=l.useCallback(()=>t("advanced"),[]);return a.jsxs(N,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Rt,{size:"sm",isChecked:e=="simple",onClick:n,children:"Simple"}),a.jsx(Rt,{size:"sm",isChecked:e=="advanced",onClick:r,children:"Advanced"})]}),a.jsxs(N,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(Fpe,{}),e==="advanced"&&a.jsx(Lpe,{})]})]})}function Hpe(e){const{...t}=e;return a.jsx(SE,{w:"100%",...t,children:e.children})}function Wpe(){const e=H(C=>C.modelmanager.searchFolder),[t,n]=l.useState(""),{data:r}=na(Ol),{foundModels:o,alreadyInstalled:s,filteredModels:i}=gP({search_path:e||""},{selectFromResult:({data:C})=>{const S=x$(r==null?void 0:r.entities),j=Ro(S,"path"),_=h$(C,j),I=k$(C,j);return{foundModels:C,alreadyInstalled:J_(I,t),filteredModels:J_(_,t)}}}),[c,{isLoading:d}]=mP(),p=oe(),{t:h}=J(),m=l.useCallback(C=>{const S=C.currentTarget.id.split("\\").splice(-1)[0];c({body:{location:C.currentTarget.id}}).unwrap().then(j=>{p(Bt(Zn({title:`Added Model: ${S}`,status:"success"})))}).catch(j=>{j&&p(Bt(Zn({title:h("toast.modelAddFailed"),status:"error"})))})},[p,c,h]),g=l.useCallback(C=>{n(C.target.value)},[]),b=l.useCallback(C=>p(xf(C)),[p]),y=({models:C,showActions:S=!0})=>C.map(j=>a.jsxs(N,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(Se,{sx:{fontWeight:600},children:j.split("\\").slice(-1)[0]}),a.jsx(Se,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:j})]}),S?a.jsxs(N,{gap:2,children:[a.jsx(Rt,{id:j,onClick:m,isLoading:d,children:h("modelManager.quickAdd")}),a.jsx(Rt,{onClick:b.bind(null,j),isLoading:d,children:h("modelManager.advanced")})]}):a.jsx(Se,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},j));return(()=>e?!o||o.length===0?a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(Se,{variant:"subtext",children:h("modelManager.noModels")})}):a.jsxs(N,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Cs,{onChange:g,label:h("modelManager.search"),labelPos:"side"}),a.jsxs(N,{p:2,gap:2,children:[a.jsxs(Se,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(Se,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(Hpe,{offsetScrollbars:!0,children:a.jsxs(N,{gap:2,flexDirection:"column",children:[y({models:i}),y({models:s,showActions:!1})]})})]}):null)()}const J_=(e,t)=>{const n=[];return Kr(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function Vpe(){const e=H(p=>p.modelmanager.advancedAddScanModel),{t}=J(),[n,r]=l.useState("diffusers"),[o,s]=l.useState(!0);l.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(p=>e.endsWith(p))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=oe(),c=l.useCallback(()=>i(xf(null)),[i]),d=l.useCallback(p=>{p&&(r(p),s(p==="checkpoint"))},[]);return e?a.jsxs(Te,{as:Or.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(Se,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(tt,{icon:a.jsx(ju,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:c,size:"sm"})]}),a.jsx(Ar,{label:t("modelManager.modelType"),value:n,data:LR,onChange:d}),o?a.jsx(NR,{model_path:e},e):a.jsx($R,{model_path:e},e)]}):null}function Upe(){const e=oe(),{t}=J(),n=H(d=>d.modelmanager.searchFolder),{refetch:r}=gP({search_path:n||""}),o=cc({initialValues:{folder:""}}),s=l.useCallback(d=>{e(lS(d.folder))},[e]),i=l.useCallback(()=>{r()},[r]),c=l.useCallback(()=>{e(lS(null)),e(xf(null))},[e]);return a.jsx("form",{onSubmit:o.onSubmit(d=>s(d)),style:{width:"100%"},children:a.jsxs(N,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(N,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(Se,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(N,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(Cs,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(N,{gap:2,children:[n?a.jsx(tt,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(Xg,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(tt,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(See,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(tt,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(qo,{}),size:"sm",onClick:c,isDisabled:!n,colorScheme:"red"})]})]})})}const Gpe=l.memo(Upe);function qpe(){return a.jsxs(N,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(Gpe,{}),a.jsxs(N,{gap:4,children:[a.jsx(N,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(Wpe,{})}),a.jsx(Vpe,{})]})]})}function Kpe(){const[e,t]=l.useState("add"),{t:n}=J(),r=l.useCallback(()=>t("add"),[]),o=l.useCallback(()=>t("scan"),[]);return a.jsxs(N,{flexDirection:"column",gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Rt,{onClick:r,isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Rt,{onClick:o,isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(Bpe,{}),e=="scan"&&a.jsx(qpe,{})]})}const Qpe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function Xpe(){var X,ue;const{t:e}=J(),t=oe(),{data:n}=na(Ol),[r,{isLoading:o}]=ZT(),[s,i]=l.useState("sd-1"),c=CS(n==null?void 0:n.entities,(q,ne)=>(q==null?void 0:q.model_format)==="diffusers"&&(q==null?void 0:q.base_model)==="sd-1"),d=CS(n==null?void 0:n.entities,(q,ne)=>(q==null?void 0:q.model_format)==="diffusers"&&(q==null?void 0:q.base_model)==="sd-2"),p=l.useMemo(()=>({"sd-1":c,"sd-2":d}),[c,d]),[h,m]=l.useState(((X=Object.keys(p[s]))==null?void 0:X[0])??null),[g,b]=l.useState(((ue=Object.keys(p[s]))==null?void 0:ue[1])??null),[y,x]=l.useState(null),[C,S]=l.useState(""),[j,_]=l.useState(.5),[I,P]=l.useState("weighted_sum"),[M,R]=l.useState("root"),[A,D]=l.useState(""),[O,T]=l.useState(!1),Y=Object.keys(p[s]).filter(q=>q!==g&&q!==y),z=Object.keys(p[s]).filter(q=>q!==h&&q!==y),W=Object.keys(p[s]).filter(q=>q!==h&&q!==g),Q=l.useCallback(q=>{i(q),m(null),b(null)},[]),U=l.useCallback(q=>{m(q)},[]),L=l.useCallback(q=>{b(q)},[]),ee=l.useCallback(q=>{q?(x(q),P("weighted_sum")):(x(null),P("add_difference"))},[]),K=l.useCallback(q=>S(q.target.value),[]),Z=l.useCallback(q=>_(q),[]),se=l.useCallback(()=>_(.5),[]),fe=l.useCallback(q=>P(q),[]),G=l.useCallback(q=>R(q),[]),te=l.useCallback(q=>D(q.target.value),[]),V=l.useCallback(q=>T(q.target.checked),[]),F=l.useCallback(()=>{const q=[];let ne=[h,g,y];ne=ne.filter(le=>le!==null),ne.forEach(le=>{var ve;const we=(ve=le==null?void 0:le.split("/"))==null?void 0:ve[2];we&&q.push(we)});const pe={model_names:q,merged_model_name:C!==""?C:q.join("-"),alpha:j,interp:I,force:O,merge_dest_directory:M==="root"?void 0:A};r({base_model:s,body:{body:pe}}).unwrap().then(le=>{t(Bt(Zn({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(le=>{le&&t(Bt(Zn({title:e("modelManager.modelsMergeFailed"),status:"error"})))})},[s,t,r,C,j,A,O,I,M,h,y,g,e]);return a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsxs(N,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(Se,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(Se,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(N,{columnGap:4,children:[a.jsx(Ar,{label:"Model Type",w:"100%",data:Qpe,value:s,onChange:Q}),a.jsx(tr,{label:e("modelManager.modelOne"),w:"100%",value:h,placeholder:e("modelManager.selectModel"),data:Y,onChange:U}),a.jsx(tr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:z,onChange:L}),a.jsx(tr,{label:e("modelManager.modelThree"),data:W,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:ee})]}),a.jsx(Cs,{label:e("modelManager.mergedModelName"),value:C,onChange:K}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(Pt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:Z,withInput:!0,withReset:!0,handleReset:se,withSliderMarks:!0}),a.jsx(Se,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(N,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(Se,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(em,{value:I,onChange:fe,children:a.jsx(N,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Za,{value:"weighted_sum",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Za,{value:"sigmoid",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Za,{value:"inv_sigmoid",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Za,{value:"add_difference",children:a.jsx(Fn,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(N,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(N,{columnGap:4,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(em,{value:M,onChange:G,children:a.jsxs(N,{columnGap:4,children:[a.jsx(Za,{value:"root",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Za,{value:"custom",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(Cs,{label:e("modelManager.mergedModelCustomSaveLocation"),value:A,onChange:te})]}),a.jsx(Io,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:V,fontWeight:"500"}),a.jsx(Rt,{onClick:F,isLoading:o,isDisabled:h===null||g===null,children:e("modelManager.merge")})]})}function Ype(e){const{model:t}=e,n=oe(),{t:r}=J(),[o,{isLoading:s}]=eN(),[i,c]=l.useState("InvokeAIRoot"),[d,p]=l.useState("");l.useEffect(()=>{c("InvokeAIRoot")},[t]);const h=l.useCallback(()=>{c("InvokeAIRoot")},[]),m=l.useCallback(y=>{c(y)},[]),g=l.useCallback(y=>{p(y.target.value)},[]),b=l.useCallback(()=>{const y={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?d:void 0};if(i==="Custom"&&d===""){n(Bt(Zn({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(Bt(Zn({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(y).unwrap().then(()=>{n(Bt(Zn({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(Bt(Zn({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})},[o,d,n,t.base_model,t.model_name,i,r]);return a.jsxs(p0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:b,cancelCallback:h,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Rt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(N,{flexDirection:"column",rowGap:4,children:[a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(Mf,{children:[a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsxs(N,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(Se,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(em,{value:i,onChange:m,children:a.jsxs(N,{gap:4,children:[a.jsx(Za,{value:"InvokeAIRoot",children:a.jsx(Fn,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Za,{value:"Custom",children:a.jsx(Fn,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(N,{flexDirection:"column",rowGap:2,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Cs,{value:d,onChange:g,width:"full"})]})]})]})}function Jpe(e){const{model:t}=e,[n,{isLoading:r}]=vP(),{data:o}=pP(),[s,i]=l.useState(!1);l.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const c=oe(),{t:d}=J(),p=cc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:g=>g.trim().length===0?"Must provide a path":null}}),h=l.useCallback(()=>i(g=>!g),[]),m=l.useCallback(g=>{const b={base_model:t.base_model,model_name:t.model_name,body:g};n(b).unwrap().then(y=>{p.setValues(y),c(Bt(Zn({title:d("modelManager.modelUpdated"),status:"success"})))}).catch(y=>{p.reset(),c(Bt(Zn({title:d("modelManager.modelUpdateFailed"),status:"error"})))})},[p,c,t.base_model,t.model_name,d,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ha,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(Ype,{model:t})]}),a.jsx(no,{}),a.jsx(N,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(g=>m(g)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Mr,{label:d("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(Mr,{label:d("modelManager.description"),...p.getInputProps("description")}),a.jsx(Qf,{required:!0,...p.getInputProps("base_model")}),a.jsx(k0,{required:!0,...p.getInputProps("variant")}),a.jsx(Mr,{required:!0,label:d("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(Mr,{label:d("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(N,{flexDirection:"column",gap:2,children:[s?a.jsx(Mr,{required:!0,label:d("modelManager.config"),...p.getInputProps("config")}):a.jsx(TR,{required:!0,...p.getInputProps("config")}),a.jsx(Io,{isChecked:s,onChange:h,label:"Use Custom Config"})]}),a.jsx(Rt,{type:"submit",isLoading:r,children:d("modelManager.updateModel")})]})})})]})}function Zpe(e){const{model:t}=e,[n,{isLoading:r}]=vP(),o=oe(),{t:s}=J(),i=cc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Bt(Zn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Bt(Zn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Mr,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Mr,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Qf,{required:!0,...i.getInputProps("base_model")}),a.jsx(k0,{required:!0,...i.getInputProps("variant")}),a.jsx(Mr,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Mr,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(Rt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function ehe(e){const{model:t}=e,[n,{isLoading:r}]=tN(),o=oe(),{t:s}=J(),i=cc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:d=>d.trim().length===0?"Must provide a path":null}}),c=l.useCallback(d=>{const p={base_model:t.base_model,model_name:t.model_name,body:d};n(p).unwrap().then(h=>{i.setValues(h),o(Bt(Zn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(h=>{i.reset(),o(Bt(Zn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(N,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(N,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model ⋅"," ",nN[t.model_format]," format"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(d=>c(d)),children:a.jsxs(N,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Mr,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Mr,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Qf,{...i.getInputProps("base_model")}),a.jsx(Mr,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Rt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function the(e){const{t}=J(),n=oe(),[r]=rN(),[o]=oN(),{model:s,isSelected:i,setSelectedModelId:c}=e,d=l.useCallback(()=>{c(s.id)},[s.id,c]),p=l.useCallback(()=>{const h={main:r,lora:o,onnx:r}[s.model_type];h(s).unwrap().then(m=>{n(Bt(Zn({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(m=>{m&&n(Bt(Zn({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),c(void 0)},[r,o,s,c,n,t]);return a.jsxs(N,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(N,{as:Rt,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:d,children:a.jsxs(N,{gap:4,alignItems:"center",children:[a.jsx(Ha,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:sN[s.base_model]}),a.jsx(Fn,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(Se,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(p0,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(tt,{icon:a.jsx(_ne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(N,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const nhe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=J(),[o,s]=l.useState(""),[i,c]=l.useState("all"),{filteredDiffusersModels:d,isLoadingDiffusersModels:p}=na(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredDiffusersModels:Sd(_,"main","diffusers",o),isLoadingDiffusersModels:I})}),{filteredCheckpointModels:h,isLoadingCheckpointModels:m}=na(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredCheckpointModels:Sd(_,"main","checkpoint",o),isLoadingCheckpointModels:I})}),{filteredLoraModels:g,isLoadingLoraModels:b}=vf(void 0,{selectFromResult:({data:_,isLoading:I})=>({filteredLoraModels:Sd(_,"lora",void 0,o),isLoadingLoraModels:I})}),{filteredOnnxModels:y,isLoadingOnnxModels:x}=Wd(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredOnnxModels:Sd(_,"onnx","onnx",o),isLoadingOnnxModels:I})}),{filteredOliveModels:C,isLoadingOliveModels:S}=Wd(Ol,{selectFromResult:({data:_,isLoading:I})=>({filteredOliveModels:Sd(_,"onnx","olive",o),isLoadingOliveModels:I})}),j=l.useCallback(_=>{s(_.target.value)},[]);return a.jsx(N,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(N,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Rt,{onClick:c.bind(null,"all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(Rt,{size:"sm",onClick:c.bind(null,"lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(Cs,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(N,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Hc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&d.length>0&&a.jsx(Bc,{title:"Diffusers",modelList:d,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),m&&a.jsx(Hc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!m&&h.length>0&&a.jsx(Bc,{title:"Checkpoints",modelList:h,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),b&&a.jsx(Hc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!b&&g.length>0&&a.jsx(Bc,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Hc,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&C.length>0&&a.jsx(Bc,{title:"Olives",modelList:C,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),x&&a.jsx(Hc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!x&&y.length>0&&a.jsx(Bc,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},rhe=l.memo(nhe),Sd=(e,t,n,r)=>{const o=[];return Kr(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),c=n===void 0||s.model_format===n,d=s.model_type===t;i&&c&&d&&o.push(s)}),o},q2=l.memo(e=>a.jsx(N,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));q2.displayName="StyledModelContainer";const Bc=l.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(q2,{children:a.jsxs(N,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Se,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(the,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});Bc.displayName="ModelListWrapper";const Hc=l.memo(({loadingMessage:e})=>a.jsx(q2,{children:a.jsxs(N,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(bi,{}),a.jsx(Se,{variant:"subtext",children:e||"Fetching..."})]})}));Hc.displayName="FetchingModelsLoader";function ohe(){const[e,t]=l.useState(),{mainModel:n}=na(Ol,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=vf(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(N,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(rhe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(she,{model:o})]})}const she=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(Jpe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(Zpe,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(ehe,{model:t},t.id):a.jsx(N,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(Se,{variant:"subtext",children:"No Model Selected"})})};function ahe(){const{t:e}=J();return a.jsxs(N,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(N,{sx:{flexDirection:"column",gap:2},children:[a.jsx(Se,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(Se,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Gu,{})]})}function ihe(){return a.jsx(N,{children:a.jsx(ahe,{})})}const Z_=[{id:"modelManager",label:on.t("modelManager.modelManager"),content:a.jsx(ohe,{})},{id:"importModels",label:on.t("modelManager.importModels"),content:a.jsx(Kpe,{})},{id:"mergeModels",label:on.t("modelManager.mergeModels"),content:a.jsx(Xpe,{})},{id:"settings",label:on.t("modelManager.settings"),content:a.jsx(ihe,{})}],lhe=()=>a.jsxs(tc,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(nc,{children:Z_.map(e=>a.jsx(xo,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(zu,{sx:{w:"full",h:"full"},children:Z_.map(e=>a.jsx(Ho,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),che=l.memo(lhe),uhe=de([e=>e.nodes],e=>e.nodeTemplates),dhe=()=>{const e=H(uhe),t=Bx();return l.useCallback(n=>{var d;let r=window.innerWidth/2,o=window.innerHeight/2;const s=(d=document.querySelector("#workflow-editor"))==null?void 0:d.getBoundingClientRect();s&&(r=s.width/2-K1/2,o=s.height/2-K1/2);const i=t.project({x:r,y:o}),c=e[n];return aN(n,i,c)},[e,t])},zR=l.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(Se,{fontWeight:600,children:e}),a.jsx(Se,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));zR.displayName="AddNodePopoverSelectItem";const fhe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},phe=()=>{const e=oe(),t=dhe(),n=Zl(),{t:r}=J(),o=H(C=>C.nodes.currentConnectionFieldType),s=H(C=>{var S;return(S=C.nodes.connectionStartParams)==null?void 0:S.handleType}),i=de([Ce],({nodes:C})=>{const S=o?g$(C.nodeTemplates,_=>{const I=s=="source"?_.inputs:_.outputs;return Qs(I,P=>{const M=s=="source"?o:P.type,R=s=="target"?o:P.type;return Hx(M,R)})}):Ro(C.nodeTemplates),j=Ro(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,I)=>_.label.localeCompare(I.label)),{data:j,t:r}},_e),{data:c}=H(i),d=H(C=>C.nodes.isAddNodePopoverOpen),p=l.useRef(null),h=l.useCallback(C=>{const S=t(C);if(!S){const j=r("nodes.unknownNode",{nodeType:C});n({status:"error",title:j});return}e(iN(S))},[e,t,n,r]),m=l.useCallback(C=>{C&&h(C)},[h]),g=l.useCallback(()=>{e(lN())},[e]),b=l.useCallback(()=>{e(bP())},[e]),y=l.useCallback(C=>{C.preventDefault(),b(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[b]),x=l.useCallback(()=>{g()},[g]);return It(["shift+a","space"],y),It(["escape"],x),a.jsxs(Nf,{initialFocusRef:p,isOpen:d,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(b3,{children:a.jsx(N,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx($f,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Ag,{sx:{p:0},children:a.jsx(tr,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:c,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:zR,filter:fhe,onChange:m,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},hhe=l.memo(phe),mhe=()=>{const e=Bx(),t=H(r=>r.nodes.shouldValidateGraph);return l.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var b,y;const c=e.getEdges(),d=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),h=e.getNode(s);if(!(p&&h&&p.data&&h.data))return!1;const m=(b=p.data.outputs[o])==null?void 0:b.type,g=(y=h.data.inputs[i])==null?void 0:y.type;return!m||!g||r===s?!1:t?c.find(x=>{x.target===s&&x.targetHandle===i&&x.source===r&&x.sourceHandle})||c.find(x=>x.target===s&&x.targetHandle===i)&&g!=="CollectionItem"||!Hx(m,g)?!1:xP(r,s,d,c):!0},[e,t])},df=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,ghe=de(Ce,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=df(n&&r?bf[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),vhe=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:c}=H(ghe),d={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=Wx(d);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:c,d:p,style:{opacity:.8}})})},bhe=l.memo(vhe),FR=(e,t,n,r,o)=>de(Ce,({nodes:s})=>{var g,b;const i=s.nodes.find(y=>y.id===e),c=s.nodes.find(y=>y.id===n),d=Rr(i)&&Rr(c),p=(i==null?void 0:i.selected)||(c==null?void 0:c.selected)||o,h=d?(b=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:b.type:void 0,m=h&&s.shouldColorEdges?df(bf[h].color):df("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:m}},_e),xhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:c,selected:d,source:p,target:h,sourceHandleId:m,targetHandleId:g})=>{const b=l.useMemo(()=>FR(p,m,h,g,d),[d,p,m,h,g]),{isSelected:y,shouldAnimate:x}=H(b),[C,S,j]=Wx({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=Hf();return a.jsxs(a.Fragment,{children:[a.jsx(yP,{path:C,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:x?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:x?5:"none"}}),(c==null?void 0:c.count)&&c.count>1&&a.jsx(cN,{children:a.jsx(N,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ha,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:c.count})})})]})},yhe=l.memo(xhe),Che=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:c,source:d,target:p,sourceHandleId:h,targetHandleId:m})=>{const g=l.useMemo(()=>FR(d,h,p,m,c),[d,h,p,m,c]),{isSelected:b,shouldAnimate:y,stroke:x}=H(g),[C]=Wx({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(yP,{path:C,markerEnd:i,style:{strokeWidth:b?3:2,stroke:x,opacity:b?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},whe=l.memo(Che),She=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:c}=Q8(t),d=l.useMemo(()=>de(Ce,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===ri.IN_PROGRESS}),[t]),p=H(d),[h,m,g,b]=Ks("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=oe(),x=di(h,m),C=H(j=>j.nodes.nodeOpacity),S=l.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(uN(t)),y(CP())},[y,t]);return a.jsxs(Te,{onClick:S,onMouseEnter:c,onMouseLeave:i,className:Du,sx:{h:"full",position:"relative",borderRadius:"base",w:n??K1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:C},children:[a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${b}, ${b}`,zIndex:-1}}),a.jsx(Te,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?x:void 0,zIndex:-1}}),r,a.jsx(K8,{isSelected:o,isHovered:s})]})},j0=l.memo(She),khe=de(Ce,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),jhe=e=>{const{progressImage:t,imageDTO:n}=dN(khe);return t?a.jsx(R1,{nodeProps:e,children:a.jsx(Si,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(R1,{nodeProps:e,children:a.jsx(il,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(R1,{nodeProps:e,children:a.jsx(qr,{})})},_he=l.memo(jhe),R1=e=>{const[t,n]=l.useState(!1),r=l.useCallback(()=>{n(!0)},[]),o=l.useCallback(()=>{n(!1)},[]);return a.jsx(j0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(N,{onMouseEnter:r,onMouseLeave:o,className:Du,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(Se,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(N,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(OR,{})},"nextPrevButtons")]})]})})},K2=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!oi(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>oi(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},Ihe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(c=>(["any","direct"].includes(c.input)||Vx.includes(c.type))&&wP.includes(c.type));return K2(i)},_e),[e]);return H(t)},Phe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(c=>c.input==="connection"&&!Vx.includes(c.type)||!wP.includes(c.type));return K2(i)},_e),[e]);return H(t)},Ehe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return[];const s=r.nodeTemplates[o.data.type];return s?K2(Ro(s.outputs)):[]},_e),[e]);return H(t)},Q2=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?Qs(o.data.outputs,s=>fN.includes(s.type)&&o.data.type!=="image"):!1},_e),[e]);return H(t)},Mhe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.embedWorkflow:!1},_e),[e]);return H(t)},Ohe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Rr(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s?s.withWorkflow:!1},_e),[e]);return H(t)},Rhe=({nodeId:e})=>{const t=oe(),n=Ohe(e),r=Mhe(e),o=l.useCallback(s=>{t(pN({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Bn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(vr,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(_f,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Ahe=l.memo(Rhe),Dhe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.isIntermediate:!1},_e),[e]);return H(t)},The=({nodeId:e})=>{const t=oe(),n=Q2(e),r=Dhe(e),o=l.useCallback(s=>{t(hN({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Bn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(vr,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(_f,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Nhe=l.memo(The),$he=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Rr(o)?o.data.useCache:!1},_e),[e]);return H(t)},Lhe=({nodeId:e})=>{const t=oe(),n=$he(e),r=l.useCallback(o=>{t(mN({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Bn,{as:N,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(vr,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(_f,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},zhe=l.memo(Lhe),Fhe=({nodeId:e})=>{const t=Q2(e),n=jn("invocationCache").isFeatureEnabled;return a.jsxs(N,{className:Du,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(zhe,{nodeId:e}),t&&a.jsx(Ahe,{nodeId:e}),t&&a.jsx(Nhe,{nodeId:e})]})},Bhe=l.memo(Fhe),Hhe=({nodeId:e,isOpen:t})=>{const n=oe(),r=gN(),o=l.useCallback(()=>{n(vN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(tt,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(s0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},X2=l.memo(Hhe),Whe=({nodeId:e,title:t})=>{const n=oe(),r=U8(e),o=G8(e),{t:s}=J(),[i,c]=l.useState(""),d=l.useCallback(async h=>{n(nP({nodeId:e,label:h})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=l.useCallback(h=>{c(h)},[]);return l.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(N,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Ef,{as:N,value:i,onChange:p,onSubmit:d,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(Pf,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(If,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(Vhe,{})]})})},BR=l.memo(Whe);function Vhe(){const{isEditing:e,getEditButtonProps:t}=JP(),n=l.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Te,{className:Du,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const Uhe=({nodeId:e})=>{const t=L2(e),{base400:n,base600:r}=Hf(),o=di(n,r),s=l.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Vh(t)?a.jsxs(a.Fragment,{children:[a.jsx(Id,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Vc.Left,style:{...s,left:"-0.5rem"}}),Ro(t.inputs,i=>a.jsx(Id,{type:"target",id:i.name,isConnectable:!1,position:Vc.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Id,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Vc.Right,style:{...s,right:"-0.5rem"}}),Ro(t.outputs,i=>a.jsx(Id,{type:"source",id:i.name,isConnectable:!1,position:Vc.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},Ghe=l.memo(Uhe),qhe=e=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},_e),[e]);return H(t)},Khe=({nodeId:e})=>{const{needsUpdate:t}=rP(e);return a.jsx(Fn,{label:a.jsx(HR,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(zr,{as:GM,sx:{boxSize:4,w:8,color:t?"error.400":"base.400"}})})},Qhe=l.memo(Khe),HR=l.memo(({nodeId:e})=>{const t=L2(e),n=qhe(e),{t:r}=J(),o=l.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=l.useMemo(()=>!Vh(t)||!n?null:t.version?n.version?cS(t.version,n.version,"<")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):cS(t.version,n.version,">")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(Se,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(Se,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return Vh(t)?a.jsxs(N,{sx:{flexDir:"column"},children:[a.jsx(Se,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(Se,{children:t.notes})]}):a.jsx(Se,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});HR.displayName="TooltipContent";const A1=3,eI={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},Xhe=({nodeId:e})=>{const t=l.useMemo(()=>de(Ce,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=H(t);return n?a.jsx(Fn,{label:a.jsx(WR,{nodeExecutionState:n}),placement:"top",children:a.jsx(N,{className:Du,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(VR,{nodeExecutionState:n})})}):null},Yhe=l.memo(Xhe),WR=l.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=J();return t===ri.PENDING?a.jsx(Se,{children:"Pending"}):t===ri.IN_PROGRESS?r?a.jsxs(N,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(Si,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ha,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(Se,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(Se,{children:o("nodes.executionStateInProgress")}):t===ri.COMPLETED?a.jsx(Se,{children:o("nodes.executionStateCompleted")}):t===ri.FAILED?a.jsx(Se,{children:o("nodes.executionStateError")}):null});WR.displayName="TooltipLabel";const VR=l.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===ri.PENDING?a.jsx(zr,{as:nee,sx:{boxSize:A1,color:"base.600",_dark:{color:"base.300"}}}):n===ri.IN_PROGRESS?t===null?a.jsx(xb,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:eI}):a.jsx(xb,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:eI}):n===ri.COMPLETED?a.jsx(zr,{as:BM,sx:{boxSize:A1,color:"ok.600",_dark:{color:"ok.300"}}}):n===ri.FAILED?a.jsx(zr,{as:see,sx:{boxSize:A1,color:"error.600",_dark:{color:"error.300"}}}):null});VR.displayName="StatusIcon";const Jhe=({nodeId:e,isOpen:t})=>a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(X2,{nodeId:e,isOpen:t}),a.jsx(BR,{nodeId:e}),a.jsxs(N,{alignItems:"center",children:[a.jsx(Yhe,{nodeId:e}),a.jsx(Qhe,{nodeId:e})]}),!t&&a.jsx(Ghe,{nodeId:e})]}),Zhe=l.memo(Jhe),eme=(e,t,n,r)=>de(Ce,o=>{if(!r)return on.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:c,edges:d}=o.nodes;if(!i||!s)return on.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:h,handleId:m}=i;if(!p||!h||!m)return on.t("nodes.noConnectionData");const g=n==="target"?r:s,b=n==="source"?r:s;if(e===h)return on.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?on.t("nodes.cannotConnectOutputToOutput"):on.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:h,x=n==="target"?t:m,C=n==="source"?e:h,S=n==="source"?t:m;return d.find(_=>{_.target===y&&_.targetHandle===x&&_.source===C&&_.sourceHandle})?on.t("nodes.cannotDuplicateConnection"):d.find(_=>_.target===y&&_.targetHandle===x)&&g!=="CollectionItem"?on.t("nodes.inputMayOnlyHaveOneConnection"):Hx(b,g)?xP(p==="source"?h:e,p==="source"?e:h,c,d)?null:on.t("nodes.connectionWouldCreateCycle"):on.t("nodes.fieldTypesMustMatch")}),tme=(e,t,n)=>{const r=l.useMemo(()=>de(Ce,({nodes:s})=>{var c;const i=s.nodes.find(d=>d.id===e);if(Rr(i))return(c=i==null?void 0:i.data[zx[n]][t])==null?void 0:c.type},_e),[t,n,e]);return H(r)},nme=de(Ce,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),UR=({nodeId:e,fieldName:t,kind:n})=>{const r=tme(e,t,n),o=l.useMemo(()=>de(Ce,({nodes:g})=>!!g.edges.filter(b=>(n==="input"?b.target:b.source)===e&&(n==="input"?b.targetHandle:b.sourceHandle)===t).length),[t,n,e]),s=l.useMemo(()=>eme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=l.useMemo(()=>de(Ce,({nodes:g})=>{var b,y,x;return((b=g.connectionStartParams)==null?void 0:b.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((x=g.connectionStartParams)==null?void 0:x.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),c=H(o),d=H(nme),p=H(i),h=H(s),m=l.useMemo(()=>!!(d&&h&&!p),[h,d,p]);return{isConnected:c,isConnectionInProgress:d,isConnectionStartField:p,connectionError:h,shouldDim:m}},rme=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{var i;const s=o.nodes.find(c=>c.id===e);if(Rr(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},_e),[t,e]);return H(n)},ome=(e,t)=>{const n=l.useMemo(()=>de(Ce,({nodes:o})=>{const s=o.nodes.find(d=>d.id===e);if(!Rr(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],c=i==null?void 0:i.inputs[t];return c==null?void 0:c.input},_e),[t,e]);return H(n)},sme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=oe(),s=X8(e,t),i=Y8(e,t,n),c=ome(e,t),{t:d}=J(),p=l.useCallback(S=>{S.preventDefault()},[]),h=l.useMemo(()=>de(Ce,({nodes:S})=>({isExposed:!!S.workflow.exposedFields.find(_=>_.nodeId===e&&_.fieldName===t)}),_e),[t,e]),m=l.useMemo(()=>["any","direct"].includes(c??"__UNKNOWN_INPUT__"),[c]),{isExposed:g}=H(h),b=l.useCallback(()=>{o(bN({nodeId:e,fieldName:t}))},[o,t,e]),y=l.useCallback(()=>{o(aP({nodeId:e,fieldName:t}))},[o,t,e]),x=l.useMemo(()=>{const S=[];return m&&!g&&S.push(a.jsx(Vn,{icon:a.jsx(Yi,{}),onClick:b,children:"Add to Linear View"},`${e}.${t}.expose-field`)),m&&g&&S.push(a.jsx(Vn,{icon:a.jsx(gee,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),S},[t,b,y,g,m,e]),C=l.useCallback(()=>x.length?a.jsx(Gl,{sx:{visibility:"visible !important"},motionProps:pu,onContextMenu:p,children:a.jsx(Yd,{title:s||i||d("nodes.unknownField"),children:x})}):null,[i,s,x,p,d]);return a.jsx(p2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:C,children:r})},ame=l.memo(sme),ime=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:c}=t,{color:d,title:p}=bf[c],h=l.useMemo(()=>{const g=xN.includes(c),b=Vx.includes(c),y=yN.includes(c),x=df(d),C={backgroundColor:g||b?"var(--invokeai-colors-base-900)":x,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||b?4:0,borderStyle:"solid",borderColor:x,borderRadius:y?4:"100%",zIndex:1};return n==="target"?C.insetInlineStart="-1rem":C.insetInlineEnd="-1rem",r&&!o&&s&&(C.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?C.cursor="grab":C.cursor="not-allowed":C.cursor="crosshair",C},[s,n,r,o,c,d]),m=l.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Fn,{label:m,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:ug,children:a.jsx(Id,{type:n,id:i,position:n==="target"?Vc.Left:Vc.Right,style:h})})},GR=l.memo(ime),lme=({nodeId:e,fieldName:t})=>{const n=v0(e,t,"input"),r=rme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:c,shouldDim:d}=UR({nodeId:e,fieldName:t,kind:"input"}),p=l.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(dx,{shouldDim:d,children:a.jsxs(Bn,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(dx,{shouldDim:d,children:[a.jsxs(Bn,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(ame,{nodeId:e,fieldName:t,kind:"input",children:h=>a.jsx(vr,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(Z8,{ref:h,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Te,{children:a.jsx(uR,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(GR,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:c})]})},tI=l.memo(lme),dx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));dx.displayName="InputFieldWrapper";const cme=({nodeId:e,fieldName:t})=>{const n=v0(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:c}=UR({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(fx,{shouldDim:c,children:a.jsxs(Bn,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(fx,{shouldDim:c,children:[a.jsx(Fn,{label:a.jsx(z2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:ug,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Bn,{isDisabled:r,pe:2,children:a.jsx(vr,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(GR,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},ume=l.memo(cme),fx=l.memo(({shouldDim:e,children:t})=>a.jsx(N,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));fx.displayName="OutputFieldWrapper";const dme=e=>{const t=Q2(e),n=jn("invocationCache").isFeatureEnabled;return l.useMemo(()=>t||n,[t,n])},fme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Phe(e),i=Ihe(e),c=dme(e),d=Ehe(e);return a.jsxs(j0,{nodeId:e,selected:o,children:[a.jsx(Zhe,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(N,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:c?0:"base"},children:a.jsxs(N,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(nl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,h)=>a.jsx(Kd,{gridColumnStart:1,gridRowStart:h+1,children:a.jsx(tI,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),d.map((p,h)=>a.jsx(Kd,{gridColumnStart:2,gridRowStart:h+1,children:a.jsx(ume,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(tI,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),c&&a.jsx(Bhe,{nodeId:e})]})]})},pme=l.memo(fme),hme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(j0,{nodeId:e,selected:o,children:[a.jsxs(N,{className:Du,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(X2,{nodeId:e,isOpen:t}),a.jsx(Se,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(N,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Te,{children:[a.jsx(Se,{as:"span",children:"Unknown node type: "}),a.jsx(Se,{as:"span",fontWeight:600,children:r})]})})]}),mme=l.memo(hme),gme=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,c=l.useMemo(()=>de(Ce,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return H(c)?a.jsx(pme,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(mme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},vme=l.memo(gme),bme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=oe(),c=l.useCallback(d=>{i(CN({nodeId:t,value:d.target.value}))},[i,t]);return a.jsxs(j0,{nodeId:t,selected:r,children:[a.jsxs(N,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(X2,{nodeId:t,isOpen:s}),a.jsx(BR,{nodeId:t,title:"Notes"}),a.jsx(Te,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(N,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(N,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(vi,{value:o,onChange:c,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},xme=l.memo(bme),yme=["Delete","Backspace"],Cme={collapsed:yhe,default:whe},wme={invocation:vme,current_image:_he,notes:xme},Sme={hideAttribution:!0},kme=de(Ce,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},_e),jme=()=>{const e=oe(),t=H(O=>O.nodes.nodes),n=H(O=>O.nodes.edges),r=H(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=H(kme),i=l.useRef(null),c=l.useRef(),d=mhe(),[p]=Ks("radii",["base"]),h=l.useCallback(O=>{e(wN(O))},[e]),m=l.useCallback(O=>{e(SN(O))},[e]),g=l.useCallback((O,T)=>{e(kN(T))},[e]),b=l.useCallback(O=>{e(uS(O))},[e]),y=l.useCallback(()=>{e(jN({cursorPosition:c.current}))},[e]),x=l.useCallback(O=>{e(_N(O))},[e]),C=l.useCallback(O=>{e(IN(O))},[e]),S=l.useCallback(({nodes:O,edges:T})=>{e(PN(O?O.map(Y=>Y.id):[])),e(EN(T?T.map(Y=>Y.id):[]))},[e]),j=l.useCallback((O,T)=>{e(MN(T))},[e]),_=l.useCallback(()=>{e(CP())},[e]),I=l.useCallback(O=>{dS.set(O),O.fitView()},[]),P=l.useCallback(O=>{var Y,z;const T=(Y=i.current)==null?void 0:Y.getBoundingClientRect();if(T){const W=(z=dS.get())==null?void 0:z.project({x:O.clientX-T.left,y:O.clientY-T.top});c.current=W}},[]),M=l.useRef(),R=l.useCallback((O,T,Y)=>{M.current=O,e(ON(T.id)),e(RN())},[e]),A=l.useCallback((O,T)=>{e(uS(T))},[e]),D=l.useCallback((O,T,Y)=>{var z,W;!("touches"in O)&&((z=M.current)==null?void 0:z.clientX)===O.clientX&&((W=M.current)==null?void 0:W.clientY)===O.clientY&&e(AN(T)),M.current=void 0},[e]);return It(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(DN())}),It(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(TN())}),It(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(NN({cursorPosition:c.current}))}),a.jsx($N,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:wme,edgeTypes:Cme,nodes:t,edges:n,onInit:I,onMouseMove:P,onNodesChange:h,onEdgesChange:m,onEdgesDelete:x,onEdgeUpdate:A,onEdgeUpdateStart:R,onEdgeUpdateEnd:D,onNodesDelete:C,onConnectStart:g,onConnect:b,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:bhe,onSelectionChange:S,isValidConnection:d,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Sme,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:yme,selectionMode:s,children:a.jsx(V$,{})})},_me=de(Ce,e=>{const t=e.nodes.nodes,n=e.nodes.nodeTemplates;return t.some(o=>{const s=n[o.data.type];return LN(o,s)})},_e),Ime=()=>H(_me),Pme=()=>{const e=oe(),{t}=J(),n=Ime(),r=l.useCallback(()=>{e(bP())},[e]),o=l.useCallback(()=>{e(zN())},[e]);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:[a.jsx(tt,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Yi,{}),onClick:r}),n&&a.jsx(Rt,{leftIcon:a.jsx(Xg,{}),onClick:o,children:t("nodes.updateAllNodes")})]})},Eme=l.memo(Pme),Mme=()=>{const e=oe(),t=q3("nodes"),{t:n}=J();return l.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const c=JSON.parse(String(i)),d=GI.safeParse(c);if(!d.success){const{message:p}=FN(d.error,{prefix:n("nodes.workflowValidation")});t.error({error:BN(d.error)},p),e(Bt(Zn({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Ax(d.data)),s.abort()}catch{e(Bt(Zn({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Ome=l.memo(e=>e.error.issues[0]?a.jsx(Se,{children:fS(e.error.issues[0],{prefix:null}).toString()}):a.jsx(Mf,{children:e.error.issues.map((t,n)=>a.jsx(ws,{children:a.jsx(Se,{children:fS(t,{prefix:null}).toString()})},n))}));Ome.displayName="WorkflowValidationErrorContent";const Rme=()=>{const{t:e}=J(),t=l.useRef(null),n=Mme();return a.jsx(hM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(tt,{icon:a.jsx(Jg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Ame=l.memo(Rme),Dme=()=>{const{t:e}=J(),t=oe(),{isOpen:n,onOpen:r,onClose:o}=ls(),s=l.useRef(null),i=H(d=>d.nodes.nodes.length),c=l.useCallback(()=>{t(HN()),t(Bt(Zn({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(tt,{icon:a.jsx(qo,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Df,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Ma,{}),a.jsxs(Tf,{children:[a.jsx(Ea,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Oa,{py:4,children:a.jsxs(N,{flexDir:"column",gap:2,children:[a.jsx(Se,{children:e("nodes.resetWorkflowDesc")}),a.jsx(Se,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(pi,{children:[a.jsx(tl,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(tl,{colorScheme:"error",ml:3,onClick:c,children:e("common.accept")})]})]})]})]})},Tme=l.memo(Dme),Nme=()=>{const{t:e}=J(),t=q8(),n=l.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(tt,{icon:a.jsx(Wu,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},$me=l.memo(Nme),Lme=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx($me,{}),a.jsx(Ame,{}),a.jsx(Tme,{})]}),zme=l.memo(Lme),Fme=()=>a.jsx(N,{sx:{gap:2,flexDir:"column"},children:Ro(bf,({title:e,description:t,color:n},r)=>a.jsx(Fn,{label:t,children:a.jsx(Ha,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),Bme=l.memo(Fme),Hme=()=>{const{t:e}=J(),t=oe(),n=l.useCallback(()=>{t(WN())},[t]);return a.jsx(Rt,{leftIcon:a.jsx(_ee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},Wme=l.memo(Hme),kd={fontWeight:600},Vme=de(Ce,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===VN.Full}},_e),Ume=Oe((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=ls(),s=oe(),{shouldAnimateEdges:i,shouldValidateGraph:c,shouldSnapToGrid:d,shouldColorEdges:p,selectionModeIsChecked:h}=H(Vme),m=l.useCallback(S=>{s(UN(S.target.checked))},[s]),g=l.useCallback(S=>{s(GN(S.target.checked))},[s]),b=l.useCallback(S=>{s(qN(S.target.checked))},[s]),y=l.useCallback(S=>{s(KN(S.target.checked))},[s]),x=l.useCallback(S=>{s(QN(S.target.checked))},[s]),{t:C}=J();return a.jsxs(a.Fragment,{children:[a.jsx(tt,{ref:t,"aria-label":C("nodes.workflowSettings"),tooltip:C("nodes.workflowSettings"),icon:a.jsx(WM,{}),onClick:r}),a.jsxs(bu,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Ma,{}),a.jsxs(xu,{children:[a.jsx(Ea,{children:C("nodes.workflowSettings")}),a.jsx(kg,{}),a.jsx(Oa,{children:a.jsxs(N,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(vo,{size:"sm",children:"General"}),a.jsx(jr,{formLabelProps:kd,onChange:g,isChecked:i,label:C("nodes.animatedEdges"),helperText:C("nodes.animatedEdgesHelp")}),a.jsx(no,{}),a.jsx(jr,{formLabelProps:kd,isChecked:d,onChange:b,label:C("nodes.snapToGrid"),helperText:C("nodes.snapToGridHelp")}),a.jsx(no,{}),a.jsx(jr,{formLabelProps:kd,isChecked:p,onChange:y,label:C("nodes.colorCodeEdges"),helperText:C("nodes.colorCodeEdgesHelp")}),a.jsx(jr,{formLabelProps:kd,isChecked:h,onChange:x,label:C("nodes.fullyContainNodes"),helperText:C("nodes.fullyContainNodesHelp")}),a.jsx(vo,{size:"sm",pt:4,children:"Advanced"}),a.jsx(jr,{formLabelProps:kd,isChecked:c,onChange:m,label:C("nodes.validateConnections"),helperText:C("nodes.validateConnectionsHelp")}),a.jsx(Wme,{})]})})]})]})]})}),Gme=l.memo(Ume),qme=()=>{const e=H(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(N,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(Gme,{}),e&&a.jsx(Bme,{})]})},Kme=l.memo(qme);function Qme(){const e=oe(),t=H(o=>o.nodes.nodeOpacity),{t:n}=J(),r=l.useCallback(o=>{e(XN(o))},[e]);return a.jsx(N,{alignItems:"center",children:a.jsxs(jy,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Iy,{children:a.jsx(Py,{})}),a.jsx(_y,{})]})})}const Xme=()=>{const{t:e}=J(),{zoomIn:t,zoomOut:n,fitView:r}=Bx(),o=oe(),s=H(h=>h.nodes.shouldShowMinimapPanel),i=l.useCallback(()=>{t()},[t]),c=l.useCallback(()=>{n()},[n]),d=l.useCallback(()=>{r()},[r]),p=l.useCallback(()=>{o(YN(!s))},[s,o]);return a.jsxs(zn,{isAttached:!0,orientation:"vertical",children:[a.jsx(tt,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(Voe,{})}),a.jsx(tt,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:c,icon:a.jsx(Woe,{})}),a.jsx(tt,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:d,icon:a.jsx(VM,{})}),a.jsx(tt,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(mee,{})})]})},Yme=l.memo(Xme),Jme=()=>a.jsxs(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(Yme,{}),a.jsx(Qme,{})]}),Zme=l.memo(Jme),ege=Ee(L$),tge=()=>{const e=H(r=>r.nodes.shouldShowMinimapPanel),t=di("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=di("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(N,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(ege,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},nge=l.memo(tge),rge=()=>{const e=H(n=>n.nodes.isReady),{t}=J();return a.jsxs(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(yo,{children:e&&a.jsxs(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(jme,{}),a.jsx(hhe,{}),a.jsx(Eme,{}),a.jsx(zme,{}),a.jsx(Kme,{}),a.jsx(Zme,{}),a.jsx(nge,{})]})}),a.jsx(yo,{children:!e&&a.jsx(Or.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(N,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(qr,{label:t("nodes.loadingNodes"),icon:Uoe})})})})]})},oge=l.memo(rge),sge=()=>a.jsx(JN,{children:a.jsx(oge,{})}),age=l.memo(sge),ige=()=>{const{t:e}=J(),t=oe(),{data:n}=yf(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=ZN({fixedCacheKey:"clearInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Bt({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(Bt({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},lge=()=>{const{t:e}=J(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=ige();return a.jsx(Rt,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},cge=l.memo(lge),uge=()=>{const{t:e}=J(),t=oe(),{data:n}=yf(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=e9({fixedCacheKey:"disableInvocationCache"}),i=l.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Bt({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(Bt({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},dge=()=>{const{t:e}=J(),t=oe(),{data:n}=yf(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=t9({fixedCacheKey:"enableInvocationCache"}),i=l.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:l.useCallback(async()=>{if(!i)try{await o().unwrap(),t(Bt({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(Bt({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},fge=()=>{const{t:e}=J(),{data:t}=yf(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=dge(),{disableInvocationCache:s,isDisabled:i,isLoading:c}=uge();return t!=null&&t.enabled?a.jsx(Rt,{isDisabled:i,isLoading:c,onClick:s,children:e("invocationCache.disable")}):a.jsx(Rt,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},pge=l.memo(fge),hge=({children:e,...t})=>a.jsx(B3,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),qR=l.memo(hge),mge={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},gge=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(F3,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:mge,...r,children:[a.jsx(H3,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(W3,{children:t})]}),ya=l.memo(gge),vge=()=>{const{t:e}=J(),{data:t}=yf(void 0);return a.jsxs(qR,{children:[a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(ya,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(zn,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(cge,{}),a.jsx(pge,{})]})]})},bge=l.memo(vge),KR=e=>{const t=H(c=>c.system.isConnected),[n,{isLoading:r}]=Tx(),o=oe(),{t:s}=J();return{cancelQueueItem:l.useCallback(async()=>{try{await n(e).unwrap(),o(Bt({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(Bt({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},QR=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),nI={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},xge=({status:e})=>{const{t}=J();return a.jsx(Ha,{colorScheme:nI[e].colorScheme,children:t(nI[e].translationKey)})},yge=l.memo(xge),Cge=e=>{const t=H(d=>d.system.isConnected),{isCanceled:n}=n9({batch_id:e},{selectFromResult:({data:d})=>d?{isCanceled:(d==null?void 0:d.in_progress)===0&&(d==null?void 0:d.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=r9({fixedCacheKey:"cancelByBatchIds"}),s=oe(),{t:i}=J();return{cancelBatch:l.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(Bt({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(Bt({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},wge=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=J(),{cancelBatch:s,isLoading:i,isCanceled:c}=Cge(n),{cancelQueueItem:d,isLoading:p}=KR(r),{data:h}=o9(r),m=l.useMemo(()=>{if(!h)return o("common.loading");if(!h.completed_at||!h.started_at)return o(`queue.${h.status}`);const g=QR(h.started_at,h.completed_at);return h.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[h,o]);return a.jsxs(N,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(N,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(Ch,{label:o("queue.status"),data:m}),a.jsx(Ch,{label:o("queue.item"),data:r}),a.jsx(Ch,{label:o("queue.batch"),data:n}),a.jsx(Ch,{label:o("queue.session"),data:t}),a.jsxs(zn,{size:"xs",orientation:"vertical",children:[a.jsx(Rt,{onClick:d,isLoading:p,isDisabled:h?["canceled","completed","failed"].includes(h.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(ju,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Rt,{onClick:s,isLoading:i,isDisabled:c,"aria-label":o("queue.cancelBatch"),icon:a.jsx(ju,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(h==null?void 0:h.error)&&a.jsxs(N,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(vo,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:h.error})]}),a.jsx(N,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:h?a.jsx(lc,{children:a.jsx(el,{label:"Queue Item",data:h})}):a.jsx(bi,{opacity:.5})})]})},Sge=l.memo(wge),Ch=({label:e,data:t})=>a.jsxs(N,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(vo,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),wa={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},rI={bg:"base.300",_dark:{bg:"base.750"}},kge={_hover:rI,"&[aria-selected='true']":rI},jge=({index:e,item:t,context:n})=>{const{t:r}=J(),o=l.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=KR(t.item_id),c=l.useCallback(m=>{m.stopPropagation(),s()},[s]),d=l.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=l.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${QR(t.started_at,t.completed_at)}s`,[t]),h=l.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(N,{flexDir:"column","aria-selected":d,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:kge,"data-testid":"queue-item",children:[a.jsxs(N,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(N,{w:wa.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(Se,{variant:"subtext",children:e+1})}),a.jsx(N,{w:wa.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(yge,{status:t.status})}),a.jsx(N,{w:wa.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(N,{w:wa.batchId,flexShrink:0,children:a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(N,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(N,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(m=>m.node_path!=="metadata_accumulator").map(({node_path:m,field_name:g,value:b})=>a.jsxs(Se,{as:"span",children:[a.jsxs(Se,{as:"span",fontWeight:600,children:[m,".",g]}),": ",b]},`${t.item_id}.${m}.${g}.${b}`))})}),a.jsx(N,{alignItems:"center",w:wa.actions,pe:3,children:a.jsx(zn,{size:"xs",variant:"ghost",children:a.jsx(tt,{onClick:c,isDisabled:h,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(ju,{})})})})]}),a.jsx(Sf,{in:d,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Sge,{queueItemDTO:t})})]})},_ge=l.memo(jge),Ige=l.memo(Oe((e,t)=>a.jsx(N,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Pge=l.memo(Ige),Ege=()=>a.jsxs(N,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(N,{w:wa.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"#"})}),a.jsx(N,{ps:.5,w:wa.statusBadge,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"status"})}),a.jsx(N,{ps:.5,w:wa.time,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"time"})}),a.jsx(N,{ps:.5,w:wa.batchId,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch"})}),a.jsx(N,{ps:.5,w:wa.fieldValues,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch field values"})})]}),Mge=l.memo(Ege),Oge={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Rge=de(Ce,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},_e),Age=(e,t)=>t.item_id,Dge={List:Pge},Tge=(e,t,n)=>a.jsx(_ge,{index:e,item:t,context:n}),Nge=()=>{const{listCursor:e,listPriority:t}=H(Rge),n=oe(),r=l.useRef(null),[o,s]=l.useState(null),[i,c]=u2(Oge),{t:d}=J();l.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=c())==null?void 0:j.destroy()}},[o,i,c]);const{data:p,isLoading:h}=s9({cursor:e,priority:t}),m=l.useMemo(()=>p?a9.getSelectors().selectAll(p):[],[p]),g=l.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=m[m.length-1];S&&(n(Nx(S.item_id)),n($x(S.priority)))},[n,p==null?void 0:p.has_more,m]),[b,y]=l.useState([]),x=l.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),C=l.useMemo(()=>({openQueueItems:b,toggleQueueItem:x}),[b,x]);return h?a.jsx(are,{}):m.length?a.jsxs(N,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Mge,{}),a.jsx(N,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(voe,{data:m,endReached:g,scrollerRef:s,itemContent:Tge,computeItemKey:Age,components:Dge,context:C})})]}):a.jsx(N,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(vo,{color:"base.400",_dark:{color:"base.500"},children:d("queue.queueEmpty")})})},$ge=l.memo(Nge),Lge=()=>{const{data:e}=Fa(),{t}=J();return a.jsxs(qR,{"data-testid":"queue-status",children:[a.jsx(ya,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(ya,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(ya,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(ya,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(ya,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(ya,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},zge=l.memo(Lge);function Fge(e){return Qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const Bge=()=>{const e=oe(),{t}=J(),n=H(d=>d.system.isConnected),[r,{isLoading:o}]=dP({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Fa(void 0,{selectFromResult:({data:d})=>d?{finishedCount:d.queue.completed+d.queue.canceled+d.queue.failed}:{finishedCount:0}}),i=l.useCallback(async()=>{if(s)try{const d=await r().unwrap();e(Bt({title:t("queue.pruneSucceeded",{item_count:d.deleted}),status:"success"})),e(Nx(void 0)),e($x(void 0))}catch{e(Bt({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),c=l.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:c}},Hge=({asIconButton:e})=>{const{t}=J(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=Bge();return a.jsx(ic,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(Fge,{}),onClick:n,colorScheme:"blue"})},Wge=l.memo(Hge),Vge=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled;return a.jsxs(N,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(zn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(M8,{}):a.jsx(a.Fragment,{}),e?a.jsx(k8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(zn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(Wge,{}),a.jsx(O2,{})]})]})},Uge=l.memo(Vge),Gge=()=>{const e=jn("invocationCache").isFeatureEnabled;return a.jsxs(N,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(N,{gap:2,w:"full",children:[a.jsx(Uge,{}),a.jsx(zge,{}),e&&a.jsx(bge,{})]}),a.jsx(Te,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx($ge,{})})]})},qge=l.memo(Gge),Kge=()=>a.jsx(qge,{}),Qge=l.memo(Kge),Xge=()=>a.jsx(RR,{}),Yge=l.memo(Xge);var px={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=pS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=pS;e.exports=r.Konva})(px,px.exports);var Jge=px.exports;const ff=hf(Jge);var XR={exports:{}};/** - * @license React - * react-reconciler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Zge=function(t){var n={},r=l,o=Sh,s=Object.assign;function i(u){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;vae||k[$]!==E[ae]){var ge=` -`+k[$].replace(" at new "," at ");return u.displayName&&ge.includes("")&&(ge=ge.replace("",u.displayName)),ge}while(1<=$&&0<=ae);break}}}finally{Zt=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?Vt(u):""}var sn=Object.prototype.hasOwnProperty,Yt=[],He=-1;function Ct(u){return{current:u}}function zt(u){0>He||(u.current=Yt[He],Yt[He]=null,He--)}function Qt(u,f){He++,Yt[He]=u.current,u.current=f}var Nn={},Jt=Ct(Nn),vn=Ct(!1),fn=Nn;function Br(u,f){var v=u.type.contextTypes;if(!v)return Nn;var w=u.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===f)return w.__reactInternalMemoizedMaskedChildContext;var k={},E;for(E in v)k[E]=f[E];return w&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=f,u.__reactInternalMemoizedMaskedChildContext=k),k}function cr(u){return u=u.childContextTypes,u!=null}function Dt(){zt(vn),zt(Jt)}function $n(u,f,v){if(Jt.current!==Nn)throw Error(i(168));Qt(Jt,f),Qt(vn,v)}function Wn(u,f,v){var w=u.stateNode;if(f=f.childContextTypes,typeof w.getChildContext!="function")return v;w=w.getChildContext();for(var k in w)if(!(k in f))throw Error(i(108,A(u)||"Unknown",k));return s({},v,w)}function ur(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Nn,fn=Jt.current,Qt(Jt,u),Qt(vn,vn.current),!0}function Ir(u,f,v){var w=u.stateNode;if(!w)throw Error(i(169));v?(u=Wn(u,f,fn),w.__reactInternalMemoizedMergedChildContext=u,zt(vn),zt(Jt),Qt(Jt,u)):zt(vn),Qt(vn,v)}var Kn=Math.clz32?Math.clz32:On,Qn=Math.log,bn=Math.LN2;function On(u){return u>>>=0,u===0?32:31-(Qn(u)/bn|0)|0}var Ln=64,In=4194304;function Pn(u){switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Je(u,f){var v=u.pendingLanes;if(v===0)return 0;var w=0,k=u.suspendedLanes,E=u.pingedLanes,$=v&268435455;if($!==0){var ae=$&~k;ae!==0?w=Pn(ae):(E&=$,E!==0&&(w=Pn(E)))}else $=v&~k,$!==0?w=Pn($):E!==0&&(w=Pn(E));if(w===0)return 0;if(f!==0&&f!==w&&!(f&k)&&(k=w&-w,E=f&-f,k>=E||k===16&&(E&4194240)!==0))return f;if(w&4&&(w|=v&16),f=u.entangledLanes,f!==0)for(u=u.entanglements,f&=w;0v;v++)f.push(u);return f}function bt(u,f,v){u.pendingLanes|=f,f!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,f=31-Kn(f),u[f]=v}function st(u,f){var v=u.pendingLanes&~f;u.pendingLanes=f,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=f,u.mutableReadLanes&=f,u.entangledLanes&=f,f=u.entanglements;var w=u.eventTimes;for(u=u.expirationTimes;0>=$,k-=$,Jo=1<<32-Kn(f)+k|v<Rn?(eo=rn,rn=null):eo=rn.sibling;var An=ct(me,rn,ye[Rn],dt);if(An===null){rn===null&&(rn=eo);break}u&&rn&&An.alternate===null&&f(me,rn),ce=E(An,ce,Rn),un===null?Wt=An:un.sibling=An,un=An,rn=eo}if(Rn===ye.length)return v(me,rn),dr&&xl(me,Rn),Wt;if(rn===null){for(;RnRn?(eo=rn,rn=null):eo=rn.sibling;var $i=ct(me,rn,An.value,dt);if($i===null){rn===null&&(rn=eo);break}u&&rn&&$i.alternate===null&&f(me,rn),ce=E($i,ce,Rn),un===null?Wt=$i:un.sibling=$i,un=$i,rn=eo}if(An.done)return v(me,rn),dr&&xl(me,Rn),Wt;if(rn===null){for(;!An.done;Rn++,An=ye.next())An=nn(me,An.value,dt),An!==null&&(ce=E(An,ce,Rn),un===null?Wt=An:un.sibling=An,un=An);return dr&&xl(me,Rn),Wt}for(rn=w(me,rn);!An.done;Rn++,An=ye.next())An=lr(rn,me,Rn,An.value,dt),An!==null&&(u&&An.alternate!==null&&rn.delete(An.key===null?Rn:An.key),ce=E(An,ce,Rn),un===null?Wt=An:un.sibling=An,un=An);return u&&rn.forEach(function(FA){return f(me,FA)}),dr&&xl(me,Rn),Wt}function Ya(me,ce,ye,dt){if(typeof ye=="object"&&ye!==null&&ye.type===h&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case d:e:{for(var Wt=ye.key,un=ce;un!==null;){if(un.key===Wt){if(Wt=ye.type,Wt===h){if(un.tag===7){v(me,un.sibling),ce=k(un,ye.props.children),ce.return=me,me=ce;break e}}else if(un.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===_&&hC(Wt)===un.type){v(me,un.sibling),ce=k(un,ye.props),ce.ref=Ju(me,un,ye),ce.return=me,me=ce;break e}v(me,un);break}else f(me,un);un=un.sibling}ye.type===h?(ce=_l(ye.props.children,me.mode,dt,ye.key),ce.return=me,me=ce):(dt=Mp(ye.type,ye.key,ye.props,null,me.mode,dt),dt.ref=Ju(me,ce,ye),dt.return=me,me=dt)}return $(me);case p:e:{for(un=ye.key;ce!==null;){if(ce.key===un)if(ce.tag===4&&ce.stateNode.containerInfo===ye.containerInfo&&ce.stateNode.implementation===ye.implementation){v(me,ce.sibling),ce=k(ce,ye.children||[]),ce.return=me,me=ce;break e}else{v(me,ce);break}else f(me,ce);ce=ce.sibling}ce=Iv(ye,me.mode,dt),ce.return=me,me=ce}return $(me);case _:return un=ye._init,Ya(me,ce,un(ye._payload),dt)}if(Q(ye))return Yn(me,ce,ye,dt);if(M(ye))return Lo(me,ce,ye,dt);op(me,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"?(ye=""+ye,ce!==null&&ce.tag===6?(v(me,ce.sibling),ce=k(ce,ye),ce.return=me,me=ce):(v(me,ce),ce=_v(ye,me.mode,dt),ce.return=me,me=ce),$(me)):v(me,ce)}return Ya}var hc=mC(!0),gC=mC(!1),Zu={},hs=Ct(Zu),ed=Ct(Zu),mc=Ct(Zu);function pa(u){if(u===Zu)throw Error(i(174));return u}function F0(u,f){Qt(mc,f),Qt(ed,u),Qt(hs,Zu),u=L(f),zt(hs),Qt(hs,u)}function gc(){zt(hs),zt(ed),zt(mc)}function vC(u){var f=pa(mc.current),v=pa(hs.current);f=ee(v,u.type,f),v!==f&&(Qt(ed,u),Qt(hs,f))}function B0(u){ed.current===u&&(zt(hs),zt(ed))}var yr=Ct(0);function sp(u){for(var f=u;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Yr(v)||ca(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var H0=[];function W0(){for(var u=0;uv?v:4,u(!0);var w=V0.transition;V0.transition={};try{u(!1),f()}finally{Ae=v,V0.transition=w}}function TC(){return ms().memoizedState}function pA(u,f,v){var w=Di(u);if(v={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null},NC(u))$C(f,v);else if(v=aC(u,f,v,w),v!==null){var k=mo();gs(v,u,w,k),LC(v,f,w)}}function hA(u,f,v){var w=Di(u),k={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null};if(NC(u))$C(f,k);else{var E=u.alternate;if(u.lanes===0&&(E===null||E.lanes===0)&&(E=f.lastRenderedReducer,E!==null))try{var $=f.lastRenderedState,ae=E($,v);if(k.hasEagerState=!0,k.eagerState=ae,xn(ae,$)){var ge=f.interleaved;ge===null?(k.next=k,N0(f)):(k.next=ge.next,ge.next=k),f.interleaved=k;return}}catch{}finally{}v=aC(u,f,k,w),v!==null&&(k=mo(),gs(v,u,w,k),LC(v,f,w))}}function NC(u){var f=u.alternate;return u===Cr||f!==null&&f===Cr}function $C(u,f){td=ip=!0;var v=u.pending;v===null?f.next=f:(f.next=v.next,v.next=f),u.pending=f}function LC(u,f,v){if(v&4194240){var w=f.lanes;w&=u.pendingLanes,v|=w,f.lanes=v,Le(u,v)}}var up={readContext:ps,useCallback:fo,useContext:fo,useEffect:fo,useImperativeHandle:fo,useInsertionEffect:fo,useLayoutEffect:fo,useMemo:fo,useReducer:fo,useRef:fo,useState:fo,useDebugValue:fo,useDeferredValue:fo,useTransition:fo,useMutableSource:fo,useSyncExternalStore:fo,useId:fo,unstable_isNewReconciler:!1},mA={readContext:ps,useCallback:function(u,f){return ha().memoizedState=[u,f===void 0?null:f],u},useContext:ps,useEffect:IC,useImperativeHandle:function(u,f,v){return v=v!=null?v.concat([u]):null,lp(4194308,4,MC.bind(null,f,u),v)},useLayoutEffect:function(u,f){return lp(4194308,4,u,f)},useInsertionEffect:function(u,f){return lp(4,2,u,f)},useMemo:function(u,f){var v=ha();return f=f===void 0?null:f,u=u(),v.memoizedState=[u,f],u},useReducer:function(u,f,v){var w=ha();return f=v!==void 0?v(f):f,w.memoizedState=w.baseState=f,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:f},w.queue=u,u=u.dispatch=pA.bind(null,Cr,u),[w.memoizedState,u]},useRef:function(u){var f=ha();return u={current:u},f.memoizedState=u},useState:jC,useDebugValue:Y0,useDeferredValue:function(u){return ha().memoizedState=u},useTransition:function(){var u=jC(!1),f=u[0];return u=fA.bind(null,u[1]),ha().memoizedState=u,[f,u]},useMutableSource:function(){},useSyncExternalStore:function(u,f,v){var w=Cr,k=ha();if(dr){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),Zr===null)throw Error(i(349));Cl&30||yC(w,f,v)}k.memoizedState=v;var E={value:v,getSnapshot:f};return k.queue=E,IC(wC.bind(null,w,E,u),[u]),w.flags|=2048,od(9,CC.bind(null,w,E,v,f),void 0,null),v},useId:function(){var u=ha(),f=Zr.identifierPrefix;if(dr){var v=uo,w=Jo;v=(w&~(1<<32-Kn(w)-1)).toString(32)+v,f=":"+f+"R"+v,v=nd++,0bv&&(f.flags|=128,w=!0,id(k,!1),f.lanes=4194304)}else{if(!w)if(u=sp(E),u!==null){if(f.flags|=128,w=!0,u=u.updateQueue,u!==null&&(f.updateQueue=u,f.flags|=4),id(k,!0),k.tail===null&&k.tailMode==="hidden"&&!E.alternate&&!dr)return po(f),null}else 2*Ue()-k.renderingStartTime>bv&&v!==1073741824&&(f.flags|=128,w=!0,id(k,!1),f.lanes=4194304);k.isBackwards?(E.sibling=f.child,f.child=E):(u=k.last,u!==null?u.sibling=E:f.child=E,k.last=E)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Ue(),f.sibling=null,u=yr.current,Qt(yr,w?u&1|2:u&1),f):(po(f),null);case 22:case 23:return Sv(),v=f.memoizedState!==null,u!==null&&u.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?es&1073741824&&(po(f),pe&&f.subtreeFlags&6&&(f.flags|=8192)):po(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function SA(u,f){switch(P0(f),f.tag){case 1:return cr(f.type)&&Dt(),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return gc(),zt(vn),zt(Jt),W0(),u=f.flags,u&65536&&!(u&128)?(f.flags=u&-65537|128,f):null;case 5:return B0(f),null;case 13:if(zt(yr),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(i(340));dc()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return zt(yr),null;case 4:return gc(),null;case 10:return D0(f.type._context),null;case 22:case 23:return Sv(),null;case 24:return null;default:return null}}var mp=!1,ho=!1,kA=typeof WeakSet=="function"?WeakSet:Set,gt=null;function bc(u,f){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(w){fr(u,f,w)}else v.current=null}function av(u,f,v){try{v()}catch(w){fr(u,f,w)}}var rw=!1;function jA(u,f){for(K(u.containerInfo),gt=f;gt!==null;)if(u=gt,f=u.child,(u.subtreeFlags&1028)!==0&&f!==null)f.return=u,gt=f;else for(;gt!==null;){u=gt;try{var v=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,k=v.memoizedState,E=u.stateNode,$=E.getSnapshotBeforeUpdate(u.elementType===u.type?w:Fs(u.type,w),k);E.__reactInternalSnapshotBeforeUpdate=$}break;case 3:pe&&hn(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ae){fr(u,u.return,ae)}if(f=u.sibling,f!==null){f.return=u.return,gt=f;break}gt=u.return}return v=rw,rw=!1,v}function ld(u,f,v){var w=f.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var k=w=w.next;do{if((k.tag&u)===u){var E=k.destroy;k.destroy=void 0,E!==void 0&&av(f,v,E)}k=k.next}while(k!==w)}}function gp(u,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&u)===u){var w=v.create;v.destroy=w()}v=v.next}while(v!==f)}}function iv(u){var f=u.ref;if(f!==null){var v=u.stateNode;switch(u.tag){case 5:u=U(v);break;default:u=v}typeof f=="function"?f(u):f.current=u}}function ow(u){var f=u.alternate;f!==null&&(u.alternate=null,ow(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&De(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function sw(u){return u.tag===5||u.tag===3||u.tag===4}function aw(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||sw(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function lv(u,f,v){var w=u.tag;if(w===5||w===6)u=u.stateNode,f?_n(v,u,f):ht(v,u);else if(w!==4&&(u=u.child,u!==null))for(lv(u,f,v),u=u.sibling;u!==null;)lv(u,f,v),u=u.sibling}function cv(u,f,v){var w=u.tag;if(w===5||w===6)u=u.stateNode,f?Xe(v,u,f):je(v,u);else if(w!==4&&(u=u.child,u!==null))for(cv(u,f,v),u=u.sibling;u!==null;)cv(u,f,v),u=u.sibling}var lo=null,Bs=!1;function ga(u,f,v){for(v=v.child;v!==null;)uv(u,f,v),v=v.sibling}function uv(u,f,v){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(ir,v)}catch{}switch(v.tag){case 5:ho||bc(v,f);case 6:if(pe){var w=lo,k=Bs;lo=null,ga(u,f,v),lo=w,Bs=k,lo!==null&&(Bs?Ze(lo,v.stateNode):Me(lo,v.stateNode))}else ga(u,f,v);break;case 18:pe&&lo!==null&&(Bs?We(lo,v.stateNode):wt(lo,v.stateNode));break;case 4:pe?(w=lo,k=Bs,lo=v.stateNode.containerInfo,Bs=!0,ga(u,f,v),lo=w,Bs=k):(le&&(w=v.stateNode.containerInfo,k=Dr(w),or(w,k)),ga(u,f,v));break;case 0:case 11:case 14:case 15:if(!ho&&(w=v.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){k=w=w.next;do{var E=k,$=E.destroy;E=E.tag,$!==void 0&&(E&2||E&4)&&av(v,f,$),k=k.next}while(k!==w)}ga(u,f,v);break;case 1:if(!ho&&(bc(v,f),w=v.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=v.memoizedProps,w.state=v.memoizedState,w.componentWillUnmount()}catch(ae){fr(v,f,ae)}ga(u,f,v);break;case 21:ga(u,f,v);break;case 22:v.mode&1?(ho=(w=ho)||v.memoizedState!==null,ga(u,f,v),ho=w):ga(u,f,v);break;default:ga(u,f,v)}}function iw(u){var f=u.updateQueue;if(f!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new kA),f.forEach(function(w){var k=DA.bind(null,u,w);v.has(w)||(v.add(w),w.then(k,k))})}}function Hs(u,f){var v=f.deletions;if(v!==null)for(var w=0;w";case bp:return":has("+(pv(u)||"")+")";case xp:return'[role="'+u.value+'"]';case Cp:return'"'+u.value+'"';case yp:return'[data-testname="'+u.value+'"]';default:throw Error(i(365))}}function pw(u,f){var v=[];u=[u,0];for(var w=0;wk&&(k=$),w&=~E}if(w=k,w=Ue()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*IA(w/1960))-w,10u?16:u,Ai===null)var w=!1;else{if(u=Ai,Ai=null,_p=0,pn&6)throw Error(i(331));var k=pn;for(pn|=4,gt=u.current;gt!==null;){var E=gt,$=E.child;if(gt.flags&16){var ae=E.deletions;if(ae!==null){for(var ge=0;geUe()-vv?Sl(u,0):gv|=v),$o(u,f)}function ww(u,f){f===0&&(u.mode&1?(f=In,In<<=1,!(In&130023424)&&(In=4194304)):f=1);var v=mo();u=fa(u,f),u!==null&&(bt(u,f,v),$o(u,v))}function AA(u){var f=u.memoizedState,v=0;f!==null&&(v=f.retryLane),ww(u,v)}function DA(u,f){var v=0;switch(u.tag){case 13:var w=u.stateNode,k=u.memoizedState;k!==null&&(v=k.retryLane);break;case 19:w=u.stateNode;break;default:throw Error(i(314))}w!==null&&w.delete(f),ww(u,v)}var Sw;Sw=function(u,f,v){if(u!==null)if(u.memoizedProps!==f.pendingProps||vn.current)To=!0;else{if(!(u.lanes&v)&&!(f.flags&128))return To=!1,CA(u,f,v);To=!!(u.flags&131072)}else To=!1,dr&&f.flags&1048576&&eC(f,So,f.index);switch(f.lanes=0,f.tag){case 2:var w=f.type;fp(u,f),u=f.pendingProps;var k=Br(f,Jt.current);pc(f,v),k=G0(null,f,w,u,k,v);var E=q0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,cr(w)?(E=!0,ur(f)):E=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,$0(f),k.updater=rp,f.stateNode=k,k._reactInternals=f,z0(f,w,u,v),f=tv(null,f,w,!0,E,v)):(f.tag=0,dr&&E&&I0(f),_o(null,f,k,v),f=f.child),f;case 16:w=f.elementType;e:{switch(fp(u,f),u=f.pendingProps,k=w._init,w=k(w._payload),f.type=w,k=f.tag=NA(w),u=Fs(w,u),k){case 0:f=ev(null,f,w,u,v);break e;case 1:f=QC(null,f,w,u,v);break e;case 11:f=VC(null,f,w,u,v);break e;case 14:f=UC(null,f,w,Fs(w.type,u),v);break e}throw Error(i(306,w,""))}return f;case 0:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),ev(u,f,w,k,v);case 1:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),QC(u,f,w,k,v);case 3:e:{if(XC(f),u===null)throw Error(i(387));w=f.pendingProps,E=f.memoizedState,k=E.element,iC(u,f),np(f,w,null,v);var $=f.memoizedState;if(w=$.element,we&&E.isDehydrated)if(E={element:w,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},f.updateQueue.baseState=E,f.memoizedState=E,f.flags&256){k=vc(Error(i(423)),f),f=YC(u,f,w,v,k);break e}else if(w!==k){k=vc(Error(i(424)),f),f=YC(u,f,w,v,k);break e}else for(we&&(fs=ie(f.stateNode.containerInfo),Zo=f,dr=!0,zs=null,Yu=!1),v=gC(f,null,w,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(dc(),w===k){f=Qa(u,f,v);break e}_o(u,f,w,v)}f=f.child}return f;case 5:return vC(f),u===null&&M0(f),w=f.type,k=f.pendingProps,E=u!==null?u.memoizedProps:null,$=k.children,V(w,k)?$=null:E!==null&&V(w,E)&&(f.flags|=32),KC(u,f),_o(u,f,$,v),f.child;case 6:return u===null&&M0(f),null;case 13:return JC(u,f,v);case 4:return F0(f,f.stateNode.containerInfo),w=f.pendingProps,u===null?f.child=hc(f,null,w,v):_o(u,f,w,v),f.child;case 11:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),VC(u,f,w,k,v);case 7:return _o(u,f,f.pendingProps,v),f.child;case 8:return _o(u,f,f.pendingProps.children,v),f.child;case 12:return _o(u,f,f.pendingProps.children,v),f.child;case 10:e:{if(w=f.type._context,k=f.pendingProps,E=f.memoizedProps,$=k.value,sC(f,w,$),E!==null)if(xn(E.value,$)){if(E.children===k.children&&!vn.current){f=Qa(u,f,v);break e}}else for(E=f.child,E!==null&&(E.return=f);E!==null;){var ae=E.dependencies;if(ae!==null){$=E.child;for(var ge=ae.firstContext;ge!==null;){if(ge.context===w){if(E.tag===1){ge=Ka(-1,v&-v),ge.tag=2;var Fe=E.updateQueue;if(Fe!==null){Fe=Fe.shared;var xt=Fe.pending;xt===null?ge.next=ge:(ge.next=xt.next,xt.next=ge),Fe.pending=ge}}E.lanes|=v,ge=E.alternate,ge!==null&&(ge.lanes|=v),T0(E.return,v,f),ae.lanes|=v;break}ge=ge.next}}else if(E.tag===10)$=E.type===f.type?null:E.child;else if(E.tag===18){if($=E.return,$===null)throw Error(i(341));$.lanes|=v,ae=$.alternate,ae!==null&&(ae.lanes|=v),T0($,v,f),$=E.sibling}else $=E.child;if($!==null)$.return=E;else for($=E;$!==null;){if($===f){$=null;break}if(E=$.sibling,E!==null){E.return=$.return,$=E;break}$=$.return}E=$}_o(u,f,k.children,v),f=f.child}return f;case 9:return k=f.type,w=f.pendingProps.children,pc(f,v),k=ps(k),w=w(k),f.flags|=1,_o(u,f,w,v),f.child;case 14:return w=f.type,k=Fs(w,f.pendingProps),k=Fs(w.type,k),UC(u,f,w,k,v);case 15:return GC(u,f,f.type,f.pendingProps,v);case 17:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),fp(u,f),f.tag=1,cr(w)?(u=!0,ur(f)):u=!1,pc(f,v),fC(f,w,k),z0(f,w,k,v),tv(null,f,w,!0,u,v);case 19:return ew(u,f,v);case 22:return qC(u,f,v)}throw Error(i(156,f.tag))};function kw(u,f){return Ve(u,f)}function TA(u,f,v,w){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(u,f,v,w){return new TA(u,f,v,w)}function jv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function NA(u){if(typeof u=="function")return jv(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===j)return 14}return 2}function Ni(u,f){var v=u.alternate;return v===null?(v=vs(u.tag,f,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=f,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&14680064,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,f=u.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function Mp(u,f,v,w,k,E){var $=2;if(w=u,typeof u=="function")jv(u)&&($=1);else if(typeof u=="string")$=5;else e:switch(u){case h:return _l(v.children,k,E,f);case m:$=8,k|=8;break;case g:return u=vs(12,v,f,k|2),u.elementType=g,u.lanes=E,u;case C:return u=vs(13,v,f,k),u.elementType=C,u.lanes=E,u;case S:return u=vs(19,v,f,k),u.elementType=S,u.lanes=E,u;case I:return Op(v,k,E,f);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case b:$=10;break e;case y:$=9;break e;case x:$=11;break e;case j:$=14;break e;case _:$=16,w=null;break e}throw Error(i(130,u==null?u:typeof u,""))}return f=vs($,v,f,k),f.elementType=u,f.type=w,f.lanes=E,f}function _l(u,f,v,w){return u=vs(7,u,w,f),u.lanes=v,u}function Op(u,f,v,w){return u=vs(22,u,w,f),u.elementType=I,u.lanes=v,u.stateNode={isHidden:!1},u}function _v(u,f,v){return u=vs(6,u,null,f),u.lanes=v,u}function Iv(u,f,v){return f=vs(4,u.children!==null?u.children:[],u.key,f),f.lanes=v,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}function $A(u,f,v,w,k){this.tag=f,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gt(0),this.expirationTimes=Gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.identifierPrefix=w,this.onRecoverableError=k,we&&(this.mutableSourceEagerHydrationData=null)}function jw(u,f,v,w,k,E,$,ae,ge){return u=new $A(u,f,v,ae,ge),f===1?(f=1,E===!0&&(f|=8)):f=0,E=vs(3,null,null,f),u.current=E,E.stateNode=u,E.memoizedState={element:w,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},$0(E),u}function _w(u){if(!u)return Nn;u=u._reactInternals;e:{if(D(u)!==u||u.tag!==1)throw Error(i(170));var f=u;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(cr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(u.tag===1){var v=u.type;if(cr(v))return Wn(u,v,f)}return f}function Iw(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(i(188)):(u=Object.keys(u).join(","),Error(i(268,u)));return u=Y(f),u===null?null:u.stateNode}function Pw(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v=Fe&&E>=nn&&k<=xt&&$<=ct){u.splice(f,1);break}else if(w!==Fe||v.width!==ge.width||ct$){if(!(E!==nn||v.height!==ge.height||xtk)){Fe>w&&(ge.width+=Fe-w,ge.x=w),xtE&&(ge.height+=nn-E,ge.y=E),ct<$&&(ge.height=$-nn),u.splice(f,1);break}}}return u},n.findHostInstance=Iw,n.findHostInstanceWithNoPortals=function(u){return u=T(u),u=u!==null?W(u):null,u===null?null:u.stateNode},n.findHostInstanceWithWarning=function(u){return Iw(u)},n.flushControlled=function(u){var f=pn;pn|=1;var v=Tr.transition,w=Ae;try{Tr.transition=null,Ae=1,u()}finally{Ae=w,Tr.transition=v,pn=f,pn===0&&(yc(),Yo())}},n.flushPassiveEffects=jl,n.flushSync=gw,n.focusWithin=function(u,f){if(!ot)throw Error(i(363));for(u=dv(u),f=pw(u,f),f=Array.from(f),u=0;uv&&(v=$)),$ ")+` - -No matching component was found for: - `)+u.join(" > ")}return null},n.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return U(u.child.stateNode);default:return u.child.stateNode}},n.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:LA,findFiberByHostInstance:u.findFiberByHostInstance||zA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{ir=f.inject(u),Sn=f}catch{}u=!!f.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,f,v,w){if(!ot)throw Error(i(363));u=hv(u,f);var k=Ht(u,v,w).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(u,f){var v=f._getVersion;v=v(f._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[f,v]:u.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(u,f){var v=Ae;try{return Ae=u,f()}finally{Ae=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,f,v,w){var k=f.current,E=mo(),$=Di(k);return v=_w(v),f.context===null?f.context=v:f.pendingContext=v,f=Ka(E,$),f.payload={element:u},w=w===void 0?null:w,w!==null&&(f.callback=w),u=Oi(k,f,$),u!==null&&(gs(u,k,$,E),tp(u,k,$)),$},n};XR.exports=Zge;var e0e=XR.exports;const t0e=hf(e0e);var YR={exports:{}},uc={};/** - * @license React - * react-reconciler-constants.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */uc.ConcurrentRoot=1;uc.ContinuousEventPriority=4;uc.DefaultEventPriority=16;uc.DiscreteEventPriority=1;uc.IdleEventPriority=536870912;uc.LegacyRoot=0;YR.exports=uc;var JR=YR.exports;const oI={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let sI=!1,aI=!1;const Y2=".react-konva-event",n0e=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. -Position of a node will be changed during drag&drop, so you should update state of the react app as well. -Consider to add onDragMove or onDragEnd events. -For more info see: https://github.com/konvajs/react-konva/issues/256 -`,r0e=`ReactKonva: You are using "zIndex" attribute for a Konva node. -react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. -For more info see: https://github.com/konvajs/react-konva/issues/194 -`,o0e={};function _0(e,t,n=o0e){if(!sI&&"zIndex"in t&&(console.warn(r0e),sI=!0),!aI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(n0e),aI=!0)}for(var s in n)if(!oI[s]){var i=s.slice(0,2)==="on",c=n[s]!==t[s];if(i&&c){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e.off(d,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var h=t._useStrictMode,m={},g=!1;const b={};for(var s in t)if(!oI[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var d=s.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t[s]&&(b[d]=t[s])}!i&&(t[s]!==n[s]||h&&t[s]!==e.getAttr(s))&&(g=!0,m[s]=t[s])}g&&(e.setAttrs(m),bl(e));for(var d in b)e.on(d+Y2,b[d])}function bl(e){if(!i9.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const ZR={},s0e={};ff.Node.prototype._applyProps=_0;function a0e(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),bl(e)}function i0e(e,t,n){let r=ff[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=ff.Group);const o={},s={};for(var i in t){var c=i.slice(0,2)==="on";c?s[i]=t[i]:o[i]=t[i]}const d=new r(o);return _0(d,s),d}function l0e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function c0e(e,t,n){return!1}function u0e(e){return e}function d0e(){return null}function f0e(){return null}function p0e(e,t,n,r){return s0e}function h0e(){}function m0e(e){}function g0e(e,t){return!1}function v0e(){return ZR}function b0e(){return ZR}const x0e=setTimeout,y0e=clearTimeout,C0e=-1;function w0e(e,t){return!1}const S0e=!1,k0e=!0,j0e=!0;function _0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function I0e(e,t){t.parent===e?t.moveToTop():e.add(t),bl(e)}function eA(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),bl(e)}function P0e(e,t,n){eA(e,t,n)}function E0e(e,t){t.destroy(),t.off(Y2),bl(e)}function M0e(e,t){t.destroy(),t.off(Y2),bl(e)}function O0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function R0e(e,t,n){}function A0e(e,t,n,r,o){_0(e,o,r)}function D0e(e){e.hide(),bl(e)}function T0e(e){}function N0e(e,t){(t.visible==null||t.visible)&&e.show()}function $0e(e,t){}function L0e(e){}function z0e(){}const F0e=()=>JR.DefaultEventPriority,B0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:_0e,appendChildToContainer:I0e,appendInitialChild:a0e,cancelTimeout:y0e,clearContainer:L0e,commitMount:R0e,commitTextUpdate:O0e,commitUpdate:A0e,createInstance:i0e,createTextInstance:l0e,detachDeletedInstance:z0e,finalizeInitialChildren:c0e,getChildHostContext:b0e,getCurrentEventPriority:F0e,getPublicInstance:u0e,getRootHostContext:v0e,hideInstance:D0e,hideTextInstance:T0e,idlePriority:Sh.unstable_IdlePriority,insertBefore:eA,insertInContainerBefore:P0e,isPrimaryRenderer:S0e,noTimeout:C0e,now:Sh.unstable_now,prepareForCommit:d0e,preparePortalMount:f0e,prepareUpdate:p0e,removeChild:E0e,removeChildFromContainer:M0e,resetAfterCommit:h0e,resetTextContent:m0e,run:Sh.unstable_runWithPriority,scheduleTimeout:x0e,shouldDeprioritizeSubtree:g0e,shouldSetTextContent:w0e,supportsMutation:j0e,unhideInstance:N0e,unhideTextInstance:$0e,warnsIfNotActing:k0e},Symbol.toStringTag,{value:"Module"}));var H0e=Object.defineProperty,W0e=Object.defineProperties,V0e=Object.getOwnPropertyDescriptors,iI=Object.getOwnPropertySymbols,U0e=Object.prototype.hasOwnProperty,G0e=Object.prototype.propertyIsEnumerable,lI=(e,t,n)=>t in e?H0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cI=(e,t)=>{for(var n in t||(t={}))U0e.call(t,n)&&lI(e,n,t[n]);if(iI)for(var n of iI(t))G0e.call(t,n)&&lI(e,n,t[n]);return e},q0e=(e,t)=>W0e(e,V0e(t));function tA(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=tA(r,t,n);if(o)return o;r=t?null:r.sibling}}function nA(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const J2=nA(l.createContext(null));class rA extends l.Component{render(){return l.createElement(J2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:uI,ReactCurrentDispatcher:dI}=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function K0e(){const e=l.useContext(J2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=l.useId();return l.useMemo(()=>{for(const r of[uI==null?void 0:uI.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=tA(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function Q0e(){var e,t;const n=K0e(),[r]=l.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==J2&&!r.has(s)&&r.set(s,(t=dI==null?void 0:dI.current)==null?void 0:t.readContext(nA(s))),o=o.return}return r}function X0e(){const e=Q0e();return l.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>l.createElement(t,null,l.createElement(n.Provider,q0e(cI({},r),{value:e.get(n)}))),t=>l.createElement(rA,cI({},t))),[e])}function Y0e(e){const t=B.useRef({});return B.useLayoutEffect(()=>{t.current=e}),B.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const J0e=e=>{const t=B.useRef(),n=B.useRef(),r=B.useRef(),o=Y0e(e),s=X0e(),i=c=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(c):d.current=c)};return B.useLayoutEffect(()=>(n.current=new ff.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Od.createContainer(n.current,JR.LegacyRoot,!1,null),Od.updateContainer(B.createElement(s,{},e.children),r.current),()=>{ff.isBrowser&&(i(null),Od.updateContainer(null,r.current,null),n.current.destroy())}),[]),B.useLayoutEffect(()=>{i(n.current),_0(n.current,e,o),Od.updateContainer(B.createElement(s,{},e.children),r.current,null)}),B.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},jd="Layer",La="Group",za="Rect",Il="Circle",rg="Line",oA="Image",Z0e="Text",eve="Transformer",Od=t0e(B0e);Od.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:B.version,rendererPackageName:"react-konva"});const tve=B.forwardRef((e,t)=>B.createElement(rA,{},B.createElement(J0e,{...e,forwardedRef:t}))),nve=de([_r,Ns],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),rve=()=>{const e=oe(),{tool:t,isStaging:n,isMovingBoundingBox:r}=H(nve);return{handleDragStart:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Gh(!0))},[e,r,n,t]),handleDragMove:l.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(SP(s))},[e,r,n,t]),handleDragEnd:l.useCallback(()=>{(t==="move"||n)&&!r&&e(Gh(!1))},[e,r,n,t])}},ove=de([_r,ro,Ns],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:c,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:c,shouldSnapToGrid:d}},{memoizeOptions:{resultEqualityCheck:Tn}}),sve=()=>{const e=oe(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=H(ove),c=l.useRef(null),d=kP(),p=()=>e(jP());It(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(Ux(!s));It(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),It(["n"],()=>{e(qh(!i))},{enabled:!0,preventDefault:!0},[i]),It("esc",()=>{e(l9())},{enabled:()=>!0,preventDefault:!0}),It("shift+h",()=>{e(c9(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),It(["space"],m=>{m.repeat||(d==null||d.container().focus(),r!=="move"&&(c.current=r,e(Zc("move"))),r==="move"&&c.current&&c.current!=="move"&&(e(Zc(c.current)),c.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,c])},Z2=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},sA=()=>{const e=oe(),t=Q1(),n=kP();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=u9.pixelRatio,[s,i,c,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||i===void 0||c===void 0||d===void 0||e(d9({r:s,g:i,b:c,a:d}))},commitColorUnderCursor:()=>{e(f9())}}},ave=de([ro,_r,Ns],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),ive=e=>{const t=oe(),{tool:n,isStaging:r}=H(ave),{commitColorUnderCursor:o}=sA();return l.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Gh(!0));return}if(n==="colorPicker"){o();return}const i=Z2(e.current);i&&(s.evt.preventDefault(),t(_P(!0)),t(p9([i.x,i.y])))},[e,n,r,t,o])},lve=de([ro,_r,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),cve=(e,t,n)=>{const r=oe(),{isDrawing:o,tool:s,isStaging:i}=H(lve),{updateColorUnderCursor:c}=sA();return l.useCallback(()=>{if(!e.current)return;const d=Z2(e.current);if(d){if(r(h9(d)),n.current=d,s==="colorPicker"){c();return}!o||s==="move"||i||(t.current=!0,r(IP([d.x,d.y])))}},[t,r,o,i,n,e,s,c])},uve=()=>{const e=oe();return l.useCallback(()=>{e(m9())},[e])},dve=de([ro,_r,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),fve=(e,t)=>{const n=oe(),{tool:r,isDrawing:o,isStaging:s}=H(dve);return l.useCallback(()=>{if(r==="move"||s){n(Gh(!1));return}if(!t.current&&o&&e.current){const i=Z2(e.current);if(!i)return;n(IP([i.x,i.y]))}else t.current=!1;n(_P(!1))},[t,n,o,s,e,r])},pve=de([_r],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),hve=e=>{const t=oe(),{isMoveStageKeyHeld:n,stageScale:r}=H(pve);return l.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let c=o.evt.deltaY;o.evt.ctrlKey&&(c=-c);const d=Bl(r*b9**c,v9,g9),p={x:s.x-i.x*d,y:s.y-i.y*d};t(x9(d)),t(SP(p))},[e,n,r,t])},mve=de(_r,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),gve=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(mve);return a.jsxs(La,{children:[a.jsx(za,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(za,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},vve=l.memo(gve),bve=de([_r],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),xve=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=H(bve),{colorMode:r}=wi(),[o,s]=l.useState([]),[i,c]=Ks("colors",["base.800","base.200"]),d=l.useCallback(p=>p/e,[e]);return l.useLayoutEffect(()=>{const{width:p,height:h}=n,{x:m,y:g}=t,b={x1:0,y1:0,x2:p,y2:h,offset:{x:d(m),y:d(g)}},y={x:Math.ceil(d(m)/64)*64,y:Math.ceil(d(g)/64)*64},x={x1:-y.x,y1:-y.y,x2:d(p)-y.x+64,y2:d(h)-y.y+64},S={x1:Math.min(b.x1,x.x1),y1:Math.min(b.y1,x.y1),x2:Math.max(b.x2,x.x2),y2:Math.max(b.y2,x.y2)},j=S.x2-S.x1,_=S.y2-S.y1,I=Math.round(j/64)+1,P=Math.round(_/64)+1,M=hS(0,I).map(A=>a.jsx(rg,{x:S.x1+A*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:c,strokeWidth:1},`x_${A}`)),R=hS(0,P).map(A=>a.jsx(rg,{x:S.x1,y:S.y1+A*64,points:[0,0,j,0],stroke:r==="dark"?i:c,strokeWidth:1},`y_${A}`));s(M.concat(R))},[e,t,n,d,r,i,c]),a.jsx(La,{children:o})},yve=l.memo(xve),Cve=de([Ce],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Tn}}),wve=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=H(Cve),[o,s]=l.useState(null);return l.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(oA,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},Sve=l.memo(wve),Fl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},kve=de(_r,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Fl(t)}}),fI=e=>`data:image/svg+xml;utf8, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`.replaceAll("black",e),jve=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(kve),[i,c]=l.useState(null),[d,p]=l.useState(0),h=l.useRef(null),m=l.useCallback(()=>{p(d+1),setTimeout(m,500)},[d]);return l.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{c(g)},g.src=fI(n)},[i,n]),l.useEffect(()=>{i&&(i.src=fI(n))},[i,n]),l.useEffect(()=>{const g=setInterval(()=>p(b=>(b+1)%5),50);return()=>clearInterval(g)},[]),!i||!Sc(r.x)||!Sc(r.y)||!Sc(s)||!Sc(o.width)||!Sc(o.height)?null:a.jsx(za,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:Sc(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},_ve=l.memo(jve),Ive=de([_r],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Tn}}),Pve=e=>{const{...t}=e,{objects:n}=H(Ive);return a.jsx(La,{listening:!1,...t,children:n.filter(y9).map((r,o)=>a.jsx(rg,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},Eve=l.memo(Pve);var Pl=l,Mve=function(t,n,r){const o=Pl.useRef("loading"),s=Pl.useRef(),[i,c]=Pl.useState(0),d=Pl.useRef(),p=Pl.useRef(),h=Pl.useRef();return(d.current!==t||p.current!==n||h.current!==r)&&(o.current="loading",s.current=void 0,d.current=t,p.current=n,h.current=r),Pl.useLayoutEffect(function(){if(!t)return;var m=document.createElement("img");function g(){o.current="loaded",s.current=m,c(Math.random())}function b(){o.current="failed",s.current=void 0,c(Math.random())}return m.addEventListener("load",g),m.addEventListener("error",b),n&&(m.crossOrigin=n),r&&(m.referrerPolicy=r),m.src=t,function(){m.removeEventListener("load",g),m.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const Ove=hf(Mve),Rve=({canvasImage:e})=>{const[t,n,r,o]=Ks("colors",["base.400","base.500","base.700","base.900"]),s=di(t,n),i=di(r,o),{t:c}=J();return a.jsxs(La,{children:[a.jsx(za,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(Z0e,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:c("common.imageFailedToLoad"),fill:i})]})},Ave=l.memo(Rve),Dve=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=Ps(r??Os.skipToken),[i,c]=Ove((o==null?void 0:o.image_url)??"",WI.get()?"use-credentials":"anonymous");return s||c==="failed"?a.jsx(Ave,{canvasImage:e.canvasImage}):a.jsx(oA,{x:t,y:n,image:i,listening:!1})},aA=l.memo(Dve),Tve=de([_r],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),Nve=()=>{const{objects:e}=H(Tve);return e?a.jsx(La,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(C9(t))return a.jsx(aA,{canvasImage:t},n);if(w9(t)){const r=a.jsx(rg,{points:t.points,stroke:t.color?Fl(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(La,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(S9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Fl(t.color)},n);if(k9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},$ve=l.memo(Nve),Lve=de([_r],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:c,boundingBox:d}=t.stagingArea;return{currentStagingAreaImage:c.length>0&&i!==void 0?c[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===c.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(d==null?void 0:d.x)??o.x,y:(d==null?void 0:d.y)??o.y,width:(d==null?void 0:d.width)??s.width,height:(d==null?void 0:d.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Tn}}),zve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:c,height:d}=H(Lve);return a.jsxs(La,{...t,children:[r&&n&&a.jsx(aA,{canvasImage:n}),o&&a.jsxs(La,{children:[a.jsx(za,{x:s,y:i,width:c,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(za,{x:s,y:i,width:c,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Fve=l.memo(zve),Bve=de([_r],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},_e),Hve=()=>{const e=oe(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=H(Bve),{t:s}=J(),i=l.useCallback(()=>{e(mS(!0))},[e]),c=l.useCallback(()=>{e(mS(!1))},[e]),d=l.useCallback(()=>e(j9()),[e]),p=l.useCallback(()=>e(_9()),[e]),h=l.useCallback(()=>e(I9()),[e]);It(["left"],d,{enabled:()=>!0,preventDefault:!0}),It(["right"],p,{enabled:()=>!0,preventDefault:!0}),It(["enter"],()=>h,{enabled:()=>!0,preventDefault:!0});const{data:m}=Ps((t==null?void 0:t.imageName)??Os.skipToken),g=l.useCallback(()=>{e(P9(!n))},[e,n]),b=l.useCallback(()=>{m&&e(E9({imageDTO:m}))},[e,m]),y=l.useCallback(()=>{e(M9())},[e]);return t?a.jsxs(N,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:c,children:[a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(tt,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(KZ,{}),onClick:d,colorScheme:"accent",isDisabled:!n}),a.jsx(Rt,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(tt,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(QZ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(tt,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(BM,{}),onClick:h,colorScheme:"accent"}),a.jsx(tt,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(lee,{}):a.jsx(iee,{}),onClick:g,colorScheme:"accent"}),a.jsx(tt,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!m||!m.is_intermediate,icon:a.jsx(Qg,{}),onClick:b,colorScheme:"accent"}),a.jsx(tt,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(ju,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},Wve=l.memo(Hve),Vve=()=>{const e=H(c=>c.canvas.layerState),t=H(c=>c.canvas.boundingBoxCoordinates),n=H(c=>c.canvas.boundingBoxDimensions),r=H(c=>c.canvas.isMaskEnabled),o=H(c=>c.canvas.shouldPreserveMaskedArea),[s,i]=l.useState();return l.useEffect(()=>{i(void 0)},[e,t,n,r,o]),Dee(async()=>{const c=await O9(e,t,n,r,o);if(!c)return;const{baseImageData:d,maskImageData:p}=c,h=R9(d,p);i(h)},1e3,[e,t,n,r,o]),s},Uve={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},Gve=()=>{const e=Vve();return a.jsxs(Te,{children:["Mode: ",e?Uve[e]:"..."]})},qve=l.memo(Gve),Xc=e=>Math.round(e*100)/100,Kve=de([_r],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Xc(n)}, ${Xc(r)})`}},{memoizeOptions:{resultEqualityCheck:Tn}});function Qve(){const{cursorCoordinatesString:e}=H(Kve),{t}=J();return a.jsx(Te,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const hx="var(--invokeai-colors-warning-500)",Xve=de([_r],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:c,height:d},boundingBoxCoordinates:{x:p,y:h},stageScale:m,shouldShowCanvasDebugInfo:g,layer:b,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:x}=e;let C="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&c*d<512*512)&&(C=hx),{activeLayerColor:b==="mask"?hx:"inherit",layer:b,boundingBoxColor:C,boundingBoxCoordinatesString:`(${Xc(p)}, ${Xc(h)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${c}×${d}`,canvasCoordinatesString:`${Xc(r)}×${Xc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(m*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:x}},{memoizeOptions:{resultEqualityCheck:Tn}}),Yve=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:c,canvasDimensionsString:d,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:m,shouldPreserveMaskedArea:g}=H(Xve),{t:b}=J();return a.jsxs(N,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(qve,{}),a.jsx(Te,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${b(`unifiedCanvas.${t}`)}`}),a.jsx(Te,{children:`${b("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsxs(Te,{style:{color:hx},children:[b("unifiedCanvas.preserveMaskedArea"),": ",b("common.on")]}),m&&a.jsx(Te,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Te,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&a.jsxs(a.Fragment,{children:[a.jsx(Te,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Te,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),a.jsx(Te,{children:`${b("unifiedCanvas.canvasPosition")}: ${c}`}),a.jsx(Qve,{})]})]})},Jve=l.memo(Yve),Zve=de([Ce],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:c,tool:d,shouldSnapToGrid:p}=e,{aspectRatio:h}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:d,hitStrokeWidth:20/o,aspectRatio:h}},{memoizeOptions:{resultEqualityCheck:Tn}}),e1e=e=>{const{...t}=e,n=oe(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:c,stageScale:d,shouldSnapToGrid:p,tool:h,hitStrokeWidth:m,aspectRatio:g}=H(Zve),b=l.useRef(null),y=l.useRef(null),[x,C]=l.useState(!1);l.useEffect(()=>{var z;!b.current||!y.current||(b.current.nodes([y.current]),(z=b.current.getLayer())==null||z.batchDraw())},[]);const S=64*d;It("N",()=>{n(qh(!p))});const j=l.useCallback(z=>{if(!p){n(Av({x:Math.floor(z.target.x()),y:Math.floor(z.target.y())}));return}const W=z.target.x(),Q=z.target.y(),U=Mo(W,64),L=Mo(Q,64);z.target.x(U),z.target.y(L),n(Av({x:U,y:L}))},[n,p]),_=l.useCallback(()=>{if(!y.current)return;const z=y.current,W=z.scaleX(),Q=z.scaleY(),U=Math.round(z.width()*W),L=Math.round(z.height()*Q),ee=Math.round(z.x()),K=Math.round(z.y());if(g){const Z=Mo(U/g,64);n(Xs({width:U,height:Z}))}else n(Xs({width:U,height:L}));n(Av({x:p?_d(ee,64):ee,y:p?_d(K,64):K})),z.scaleX(1),z.scaleY(1)},[n,p,g]),I=l.useCallback((z,W,Q)=>{const U=z.x%S,L=z.y%S;return{x:_d(W.x,S)+U,y:_d(W.y,S)+L}},[S]),P=l.useCallback(()=>{n(Dv(!0))},[n]),M=l.useCallback(()=>{n(Dv(!1)),n(Tv(!1)),n(Lp(!1)),C(!1)},[n]),R=l.useCallback(()=>{n(Tv(!0))},[n]),A=l.useCallback(()=>{n(Dv(!1)),n(Tv(!1)),n(Lp(!1)),C(!1)},[n]),D=l.useCallback(()=>{C(!0)},[]),O=l.useCallback(()=>{!c&&!i&&C(!1)},[i,c]),T=l.useCallback(()=>{n(Lp(!0))},[n]),Y=l.useCallback(()=>{n(Lp(!1))},[n]);return a.jsxs(La,{...t,children:[a.jsx(za,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:Y,onMouseOut:Y}),a.jsx(za,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:m,listening:!s&&h==="move",onDragStart:R,onDragEnd:A,onDragMove:j,onMouseDown:R,onMouseOut:O,onMouseOver:D,onMouseEnter:D,onMouseUp:A,onTransform:_,onTransformEnd:M,ref:y,stroke:x?"rgba(255,255,255,0.7)":"white",strokeWidth:(x?8:1)/d,width:o.width,x:r.x,y:r.y}),a.jsx(eve,{anchorCornerRadius:3,anchorDragBoundFunc:I,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:R,onDragEnd:A,onMouseDown:P,onMouseUp:M,onTransformEnd:M,ref:b,rotateEnabled:!1})]})},t1e=l.memo(e1e),n1e=de(_r,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:c,shouldShowBrush:d,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:m,stageDimensions:g,boundingBoxCoordinates:b,boundingBoxDimensions:y,shouldRestrictStrokesToBox:x}=e,C=x?{clipX:b.x,clipY:b.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:gS/m,colorPickerInnerRadius:(gS-X1+1)/m,maskColorString:Fl({...o,a:.5}),brushColorString:Fl(s),colorPickerColorString:Fl(r),tool:i,layer:c,shouldShowBrush:d,shouldDrawBrushPreview:!(p||h||!t)&&d,strokeWidth:1.5/m,dotRadius:1.5/m,clip:C}},{memoizeOptions:{resultEqualityCheck:Tn}}),r1e=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:c,shouldDrawBrushPreview:d,dotRadius:p,strokeWidth:h,brushColorString:m,colorPickerColorString:g,colorPickerInnerRadius:b,colorPickerOuterRadius:y,clip:x}=H(n1e);return d?a.jsxs(La,{listening:!1,...x,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:y,stroke:m,strokeWidth:X1,strokeScaleEnabled:!1}),a.jsx(Il,{x:n,y:r,radius:b,stroke:g,strokeWidth:X1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(Il,{x:n,y:r,radius:o,fill:c==="mask"?s:m,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),a.jsx(Il,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),a.jsx(Il,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(Il,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},o1e=l.memo(r1e),s1e=de([_r,Ns],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:c,stageDimensions:d,stageCoordinates:p,tool:h,isMovingStage:m,shouldShowIntermediates:g,shouldShowGrid:b,shouldRestrictStrokesToBox:y,shouldAntialias:x}=e;let C="none";return h==="move"||t?m?C="grabbing":C="grab":s?C=void 0:y&&!i&&(C="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||c,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:p,stageCursor:C,stageDimensions:d,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:g,shouldAntialias:x}},_e),a1e=Ee(tve,{shouldForwardProp:e=>!["sx"].includes(e)}),i1e=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:c,tool:d,isStaging:p,shouldShowIntermediates:h,shouldAntialias:m}=H(s1e);sve();const g=oe(),b=l.useRef(null),y=l.useRef(null),x=l.useRef(null),C=l.useCallback(z=>{A9(z),y.current=z},[]),S=l.useCallback(z=>{D9(z),x.current=z},[]),j=l.useRef({x:0,y:0}),_=l.useRef(!1),I=hve(y),P=ive(y),M=fve(y,_),R=cve(y,_,j),A=uve(),{handleDragStart:D,handleDragMove:O,handleDragEnd:T}=rve(),Y=l.useCallback(z=>z.evt.preventDefault(),[]);return l.useEffect(()=>{if(!b.current)return;const z=new ResizeObserver(U=>{for(const L of U)if(L.contentBoxSize){const{width:ee,height:K}=L.contentRect;g(vS({width:ee,height:K}))}});z.observe(b.current);const{width:W,height:Q}=b.current.getBoundingClientRect();return g(vS({width:W,height:Q})),()=>{z.disconnect()}},[g]),a.jsxs(N,{id:"canvas-container",ref:b,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Te,{sx:{position:"absolute"},children:a.jsxs(a1e,{tabIndex:-1,ref:C,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:c,y:c},onTouchStart:P,onTouchMove:R,onTouchEnd:M,onMouseDown:P,onMouseLeave:A,onMouseMove:R,onMouseUp:M,onDragStart:D,onDragMove:O,onDragEnd:T,onContextMenu:Y,onWheel:I,draggable:(d==="move"||p)&&!t,children:[a.jsx(jd,{id:"grid",visible:r,children:a.jsx(yve,{})}),a.jsx(jd,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:m,children:a.jsx($ve,{})}),a.jsxs(jd,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Eve,{visible:!0,listening:!1}),a.jsx(_ve,{listening:!1})]}),a.jsx(jd,{children:a.jsx(vve,{})}),a.jsxs(jd,{id:"preview",imageSmoothingEnabled:m,children:[!p&&a.jsx(o1e,{visible:d!=="move",listening:!1}),a.jsx(Fve,{visible:p}),h&&a.jsx(Sve,{}),a.jsx(t1e,{visible:n&&!p})]})]})}),a.jsx(Jve,{}),a.jsx(Wve,{})]})},l1e=l.memo(i1e);function c1e(e,t,n=250){const[r,o]=l.useState(0);return l.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const D1={width:6,height:6,borderColor:"base.100"},u1e={".react-colorful__hue-pointer":D1,".react-colorful__saturation-pointer":D1,".react-colorful__alpha-pointer":D1,gap:2,flexDir:"column"},wh="4.2rem",d1e=e=>{const{color:t,onChange:n,withNumberInput:r,...o}=e,s=l.useCallback(p=>n({...t,r:p}),[t,n]),i=l.useCallback(p=>n({...t,g:p}),[t,n]),c=l.useCallback(p=>n({...t,b:p}),[t,n]),d=l.useCallback(p=>n({...t,a:p}),[t,n]);return a.jsxs(N,{sx:u1e,children:[a.jsx(oR,{color:t,onChange:n,style:{width:"100%"},...o}),r&&a.jsxs(N,{children:[a.jsx(ja,{value:t.r,onChange:s,min:0,max:255,step:1,label:"Red",w:wh}),a.jsx(ja,{value:t.g,onChange:i,min:0,max:255,step:1,label:"Green",w:wh}),a.jsx(ja,{value:t.b,onChange:c,min:0,max:255,step:1,label:"Blue",w:wh}),a.jsx(ja,{value:t.a,onChange:d,step:.1,min:0,max:1,label:"Alpha",w:wh,isInteger:!1})]})]})},iA=l.memo(d1e),f1e=de([_r,Ns],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Fl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),p1e=()=>{const e=oe(),{t}=J(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=H(f1e);It(["q"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[n]),It(["shift+c"],()=>{d()},{enabled:()=>!i,preventDefault:!0},[]),It(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const c=l.useCallback(()=>{e(PP(n==="mask"?"base":"mask"))},[e,n]),d=l.useCallback(()=>{e(jP())},[e]),p=l.useCallback(()=>{e(Ux(!o))},[e,o]),h=l.useCallback(async()=>{e(T9())},[e]),m=l.useCallback(b=>{e(N9(b.target.checked))},[e]),g=l.useCallback(b=>{e($9(b))},[e]);return a.jsx(Uf,{triggerComponent:a.jsx(zn,{children:a.jsx(tt,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(QM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Io,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(Io,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:m}),a.jsx(Te,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(iA,{color:r,onChange:g})}),a.jsx(Rt,{size:"sm",leftIcon:a.jsx(Qg,{}),onClick:h,children:"Save Mask"}),a.jsxs(Rt,{size:"sm",leftIcon:a.jsx(qo,{}),onClick:d,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},h1e=l.memo(p1e),m1e=de([Ce,ro],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function g1e(){const e=oe(),{canRedo:t,activeTabName:n}=H(m1e),{t:r}=J(),o=l.useCallback(()=>{e(L9())},[e]);return It(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(tt,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(Cee,{}),onClick:o,isDisabled:!t})}const v1e=()=>{const e=H(Ns),t=oe(),{t:n}=J(),r=l.useCallback(()=>t(z9()),[t]);return a.jsxs(p0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Rt,{size:"sm",leftIcon:a.jsx(qo,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},b1e=l.memo(v1e),x1e=de([_r],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),y1e=()=>{const e=oe(),{t}=J(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:c,shouldSnapToGrid:d,shouldRestrictStrokesToBox:p,shouldAntialias:h}=H(x1e);It(["n"],()=>{e(qh(!d))},{enabled:!0,preventDefault:!0},[d]);const m=l.useCallback(I=>e(qh(I.target.checked)),[e]),g=l.useCallback(I=>e(F9(I.target.checked)),[e]),b=l.useCallback(I=>e(B9(I.target.checked)),[e]),y=l.useCallback(I=>e(H9(I.target.checked)),[e]),x=l.useCallback(I=>e(W9(I.target.checked)),[e]),C=l.useCallback(I=>e(V9(I.target.checked)),[e]),S=l.useCallback(I=>e(U9(I.target.checked)),[e]),j=l.useCallback(I=>e(G9(I.target.checked)),[e]),_=l.useCallback(I=>e(q9(I.target.checked)),[e]);return a.jsx(Uf,{isLazy:!1,triggerComponent:a.jsx(tt,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(ZM,{})}),children:a.jsxs(N,{direction:"column",gap:2,children:[a.jsx(Io,{label:t("unifiedCanvas.showIntermediates"),isChecked:c,onChange:g}),a.jsx(Io,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:b}),a.jsx(Io,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:m}),a.jsx(Io,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y}),a.jsx(Io,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:x}),a.jsx(Io,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:C}),a.jsx(Io,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:S}),a.jsx(Io,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:j}),a.jsx(Io,{label:t("unifiedCanvas.antialiasing"),isChecked:h,onChange:_}),a.jsx(b1e,{})]})})},C1e=l.memo(y1e),w1e=de([Ce,Ns],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),S1e=()=>{const e=oe(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=H(w1e),{t:s}=J();It(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),It(["e"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[t]),It(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),It(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),It(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),It(["BracketLeft"],()=>{r-5<=5?e(zp(Math.max(r-1,1))):e(zp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["BracketRight"],()=>{e(zp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["Shift+BracketLeft"],()=>{e(Nv({...n,a:Bl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),It(["Shift+BracketRight"],()=>{e(Nv({...n,a:Bl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=l.useCallback(()=>{e(Zc("brush"))},[e]),c=l.useCallback(()=>{e(Zc("eraser"))},[e]),d=l.useCallback(()=>{e(Zc("colorPicker"))},[e]),p=l.useCallback(()=>{e(K9())},[e]),h=l.useCallback(()=>{e(Q9())},[e]),m=l.useCallback(b=>{e(zp(b))},[e]),g=l.useCallback(b=>{e(Nv(b))},[e]);return a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(vee,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(ree,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:c}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(cee,{}),isDisabled:o,onClick:p}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Yi,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),a.jsx(tt,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(aee,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),a.jsx(Uf,{triggerComponent:a.jsx(tt,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(JM,{})}),children:a.jsxs(N,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(N,{gap:4,justifyContent:"space-between",children:a.jsx(Pt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:m,sliderNumberInputProps:{max:500}})}),a.jsx(Te,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(iA,{withNumberInput:!0,color:n,onChange:g})})]})})]})},k1e=l.memo(S1e),j1e=de([Ce,ro],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function _1e(){const e=oe(),{t}=J(),{canUndo:n,activeTabName:r}=H(j1e),o=l.useCallback(()=>{e(X9())},[e]);return It(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(tt,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Yg,{}),onClick:o,isDisabled:!n})}const I1e=de([Ce,Ns],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),P1e=()=>{const e=oe(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=H(I1e),s=Q1(),{t:i}=J(),{isClipboardAPIAvailable:c}=x8(),{getUploadButtonProps:d,getUploadInputProps:p}=k2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});It(["v"],()=>{h()},{enabled:()=>!t,preventDefault:!0},[]),It(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),It(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),It(["shift+s"],()=>{x()},{enabled:()=>!t,preventDefault:!0},[s]),It(["meta+c","ctrl+c"],()=>{C()},{enabled:()=>!t&&c,preventDefault:!0},[s,c]),It(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const h=l.useCallback(()=>{e(Zc("move"))},[e]),m=c1e(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const I=Q1();if(!I)return;const P=I.getClientRect({skipTransform:!0});e(n$({contentRect:P,shouldScaleTo1:_}))},b=l.useCallback(()=>{e(OI())},[e]),y=l.useCallback(()=>{e(Y9())},[e]),x=l.useCallback(()=>{e(J9())},[e]),C=l.useCallback(()=>{c&&e(Z9())},[e,c]),S=l.useCallback(()=>{e(e$())},[e]),j=l.useCallback(_=>{const I=_;e(PP(I)),I==="mask"&&!n&&e(Ux(!0))},[e,n]);return a.jsxs(N,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Te,{w:24,children:a.jsx(Ar,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:t$,onChange:j,disabled:t})}),a.jsx(h1e,{}),a.jsx(k1e,{}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(XZ,{}),isChecked:o==="move"||t,onClick:h}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(eee,{}),onClick:m})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(hee,{}),onClick:y,isDisabled:t}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(Qg,{}),onClick:x,isDisabled:t}),c&&a.jsx(tt,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hu,{}),onClick:C,isDisabled:t}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(Wu,{}),onClick:S,isDisabled:t})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(_1e,{}),a.jsx(g1e,{})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(tt,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(Jg,{}),isDisabled:t,...d()}),a.jsx("input",{...p()}),a.jsx(tt,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(qo,{}),onClick:b,colorScheme:"error",isDisabled:t})]}),a.jsx(zn,{isAttached:!0,children:a.jsx(C1e,{})})]})},E1e=l.memo(P1e),pI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},M1e=()=>{const{isOver:e,setNodeRef:t,active:n}=TO({id:"unifiedCanvas",data:pI});return a.jsxs(N,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(E1e,{}),a.jsx(l1e,{}),NO(pI,n)&&a.jsx($O,{isOver:e,label:"Set Canvas Initial Image"})]})},O1e=l.memo(M1e),R1e=()=>a.jsx(O1e,{}),A1e=l.memo(R1e),D1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(zr,{as:uee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Yge,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(zr,{as:Ql,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(dpe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(zr,{as:Goe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(A1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(zr,{as:j2,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(age,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(zr,{as:tee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(che,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(zr,{as:jee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Qge,{})}],T1e=de([Ce],({config:e})=>{const{disabledTabs:t}=e;return D1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Tn}}),N1e=448,$1e=448,L1e=360,z1e=["modelManager","queue"],F1e=["modelManager","queue"],B1e=()=>{const e=H(r$),t=H(ro),n=H(T1e),{t:r}=J(),o=oe(),s=l.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=l.useMemo(()=>n.map(O=>a.jsx(Fn,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(xo,{onClick:s,children:[a.jsx(WP,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),c=l.useMemo(()=>n.map(O=>a.jsx(Ho,{children:O.content},O.id)),[n]),d=l.useCallback(O=>{const T=n[O];T&&o(ti(T.id))},[o,n]),{minSize:p,isCollapsed:h,setIsCollapsed:m,ref:g,reset:b,expand:y,collapse:x,toggle:C}=k_(N1e,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:I,reset:P,expand:M,collapse:R,toggle:A}=k_(L1e,"pixels");It("f",()=>{_||h?(M(),y()):(x(),R())},[o,_,h]),It(["t","o"],()=>{C()},[o]),It("g",()=>{A()},[o]);const D=N2();return a.jsxs(tc,{variant:"appTabs",defaultIndex:e,index:e,onChange:d,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(nc,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ji,{})]}),a.jsxs(g0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:D,units:"pixels",children:[!F1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Zi,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:m,collapsible:!0,children:t==="nodes"?a.jsx(tle,{}):a.jsx(Dfe,{})}),a.jsx(Zm,{onDoubleClick:b,collapsedDirection:h?"left":void 0}),a.jsx(sle,{isSidePanelCollapsed:h,sidePanelRef:g})]}),a.jsx(Zi,{id:"main",order:1,minSize:$1e,children:a.jsx(zu,{style:{height:"100%",width:"100%"},children:c})}),!z1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Zm,{onDoubleClick:P,collapsedDirection:_?"right":void 0}),a.jsx(Zi,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:I,collapsible:!0,children:a.jsx(_se,{})}),a.jsx(rle,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},H1e=l.memo(B1e),W1e=l.createContext(null),T1={didCatch:!1,error:null};class V1e extends l.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=T1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function G1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const q1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),K1e=new Map(q1e),Q1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],mx=new WeakSet,X1e=e=>{mx.add(e);const t=e.toJSON();return mx.delete(e),t},Y1e=e=>K1e.get(e)??Error,lA=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c})=>{if(!n)if(Array.isArray(e))n=[];else if(!c&&hI(e)){const p=Y1e(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!mx.has(e))return X1e(e);const d=p=>lA({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:c});for(const[p,h]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(h)){n[p]="[object Buffer]";continue}if(h!==null&&typeof h=="object"&&typeof h.pipe=="function"){n[p]="[object Stream]";continue}if(typeof h!="function"){if(!h||typeof h!="object"){n[p]=h;continue}if(!t.includes(e[p])){s++,n[p]=d(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:h}of Q1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:hI(e[p])?d(e[p]):e[p],enumerable:r?!0:h,configurable:!0,writable:!0});return n};function J1e(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?lA({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function hI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const Z1e=({error:e,resetErrorBoundary:t})=>{const n=o$(),r=l.useCallback(()=>{const s=JSON.stringify(J1e(e),null,2);navigator.clipboard.writeText(`\`\`\` -${s} -\`\`\``),n({title:"Error Copied"})},[e,n]),o=l.useMemo(()=>G1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(N,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(N,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(vo,{children:"Something went wrong"}),a.jsx(N,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(Se,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(N,{sx:{gap:4},children:[a.jsx(Rt,{leftIcon:a.jsx(zoe,{}),onClick:t,children:"Reset UI"}),a.jsx(Rt,{leftIcon:a.jsx(Hu,{}),onClick:r,children:"Copy Error"}),a.jsx(bg,{href:o,isExternal:!0,children:a.jsx(Rt,{leftIcon:a.jsx(Ky,{}),children:"Create Issue"})})]})]})})},ebe=l.memo(Z1e),tbe=de([Ce],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),nbe=()=>{const e=oe(),{shift:t,ctrl:n,meta:r}=H(tbe),{queueBack:o,isDisabled:s,isLoading:i}=j8();It(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:c,isDisabled:d,isLoading:p}=E8();return It(["ctrl+shift+enter","meta+shift+enter"],c,{enabled:()=>!d&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[c,d,p]),It("*",()=>{Oh("shift")?!t&&e(Uo(!0)):t&&e(Uo(!1)),Oh("ctrl")?!n&&e(bS(!0)):n&&e(bS(!1)),Oh("meta")?!r&&e(xS(!0)):r&&e(xS(!1))},{keyup:!0,keydown:!0},[t,n,r]),It("1",()=>{e(ti("txt2img"))}),It("2",()=>{e(ti("img2img"))}),It("3",()=>{e(ti("unifiedCanvas"))}),It("4",()=>{e(ti("nodes"))}),It("5",()=>{e(ti("modelManager"))}),null},rbe=l.memo(nbe),obe=e=>{const t=oe(),{recallAllParameters:n}=f0(),r=Zl(),{currentData:o}=Ps((e==null?void 0:e.imageName)??Os.skipToken),{currentData:s}=VI((e==null?void 0:e.imageName)??Os.skipToken),i=l.useCallback(()=>{o&&(t(qI(o)),t(ti("unifiedCanvas")),r({title:DI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),c=l.useCallback(()=>{o&&t(ig(o))},[t,o]),d=l.useCallback(()=>{s&&n(s.metadata)},[s]);return l.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),l.useEffect(()=>{e&&e.action==="sendToImg2Img"&&c()},[e,c]),l.useEffect(()=>{e&&e.action==="useAllParameters"&&d()},[e,d]),{handleSendToCanvas:i,handleSendToImg2Img:c,handleUseAllMetadata:d}},sbe=e=>(obe(e.selectedImage),null),abe=l.memo(sbe),ibe={},lbe=({config:e=ibe,selectedImage:t})=>{const n=H(nO),r=q3("system"),o=oe(),s=l.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);l.useEffect(()=>{on.changeLanguage(n)},[n]),l.useEffect(()=>{iP(e)&&(r.info({config:e},"Received config"),o(s$(e)))},[o,e,r]),l.useEffect(()=>{o(a$())},[o]);const i=Bg(l$);return a.jsxs(V1e,{onReset:s,FallbackComponent:ebe,children:[a.jsx(nl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(kG,{children:a.jsxs(nl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(Zee,{}),a.jsx(N,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(H1e,{})})]})})}),a.jsx(FZ,{}),a.jsx(NZ,{}),a.jsx(i$,{}),a.jsx(rbe,{}),a.jsx(abe,{selectedImage:t})]})},hbe=l.memo(lbe);export{hbe as default}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-094ba0de.js b/invokeai/frontend/web/dist/assets/MantineProvider-094ba0de.js deleted file mode 100644 index 6a64f214ec..0000000000 --- a/invokeai/frontend/web/dist/assets/MantineProvider-094ba0de.js +++ /dev/null @@ -1 +0,0 @@ -import{a6 as d,ie as _,v as h,ir as X}from"./index-c553e366.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-a6a1d85c.js b/invokeai/frontend/web/dist/assets/MantineProvider-a6a1d85c.js new file mode 100644 index 0000000000..82e3e2ecc2 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/MantineProvider-a6a1d85c.js @@ -0,0 +1 @@ +import{R as d,ie as _,v as h,ir as X}from"./index-f820e2e3.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-90f0fcd3.css b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-90f0fcd3.css deleted file mode 100644 index d25bb84a51..0000000000 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-90f0fcd3.css +++ /dev/null @@ -1,9 +0,0 @@ -@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-cyrillic-ext-wght-normal-848492d3.woff2) format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-cyrillic-wght-normal-262a1054.woff2) format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-greek-ext-wght-normal-fe977ddb.woff2) format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-greek-wght-normal-89b4a3fe.woff2) format("woff2-variations");unicode-range:U+0370-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-vietnamese-wght-normal-ac4e131c.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-latin-ext-wght-normal-45606f83.woff2) format("woff2-variations");unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-latin-wght-normal-450f3ba4.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}/*! -* OverlayScrollbars -* Version: 2.2.1 -* -* Copyright (c) Rene Haas | KingSora. -* https://github.com/KingSora -* -* Released under the MIT license. -*/.os-size-observer,.os-size-observer-listener{direction:inherit;pointer-events:none;overflow:hidden;visibility:hidden;box-sizing:border-box}.os-size-observer,.os-size-observer-listener,.os-size-observer-listener-item,.os-size-observer-listener-item-final{writing-mode:horizontal-tb;position:absolute;left:0;top:0}.os-size-observer{z-index:-1;contain:strict;display:flex;flex-direction:row;flex-wrap:nowrap;padding:inherit;border:inherit;box-sizing:inherit;margin:-133px;top:0;right:0;bottom:0;left:0;transform:scale(.1)}.os-size-observer:before{content:"";flex:none;box-sizing:inherit;padding:10px;width:10px;height:10px}.os-size-observer-appear{animation:os-size-observer-appear-animation 1ms forwards}.os-size-observer-listener{box-sizing:border-box;position:relative;flex:auto;padding:inherit;border:inherit;margin:-133px;transform:scale(10)}.os-size-observer-listener.ltr{margin-right:-266px;margin-left:0}.os-size-observer-listener.rtl{margin-left:-266px;margin-right:0}.os-size-observer-listener:empty:before{content:"";width:100%;height:100%}.os-size-observer-listener:empty:before,.os-size-observer-listener>.os-size-observer-listener-item{display:block;position:relative;padding:inherit;border:inherit;box-sizing:content-box;flex:auto}.os-size-observer-listener-scroll{box-sizing:border-box;display:flex}.os-size-observer-listener-item{right:0;bottom:0;overflow:hidden;direction:ltr;flex:none}.os-size-observer-listener-item-final{transition:none}@keyframes os-size-observer-appear-animation{0%{cursor:auto}to{cursor:none}}.os-trinsic-observer{flex:none;box-sizing:border-box;position:relative;max-width:0px;max-height:1px;padding:0;margin:0;border:none;overflow:hidden;z-index:-1;height:0;top:calc(100% + 1px);contain:strict}.os-trinsic-observer:not(:empty){height:calc(100% + 1px);top:-1px}.os-trinsic-observer:not(:empty)>.os-size-observer{width:1000%;height:1000%;min-height:1px;min-width:1px}.os-environment{--os-custom-prop: -1;position:fixed;opacity:0;visibility:hidden;overflow:scroll;height:200px;width:200px;z-index:var(--os-custom-prop)}.os-environment div{width:200%;height:200%;margin:10px 0}.os-environment.os-environment-flexbox-glue{display:flex;flex-direction:row;flex-wrap:nowrap;height:auto;width:auto;min-height:200px;min-width:200px}.os-environment.os-environment-flexbox-glue div{flex:auto;width:auto;height:auto;max-height:100%;max-width:100%;margin:0}.os-environment.os-environment-flexbox-glue-max{max-height:200px}.os-environment.os-environment-flexbox-glue-max div{overflow:visible}.os-environment.os-environment-flexbox-glue-max div:before{content:"";display:block;height:999px;width:999px}.os-environment,[data-overlayscrollbars-viewport]{-ms-overflow-style:scrollbar!important}[data-overlayscrollbars-initialize],[data-overlayscrollbars~=scrollbarHidden],[data-overlayscrollbars-viewport~=scrollbarHidden],.os-scrollbar-hidden.os-environment{scrollbar-width:none!important}[data-overlayscrollbars-initialize]::-webkit-scrollbar,[data-overlayscrollbars-initialize]::-webkit-scrollbar-corner,[data-overlayscrollbars~=scrollbarHidden]::-webkit-scrollbar,[data-overlayscrollbars~=scrollbarHidden]::-webkit-scrollbar-corner,[data-overlayscrollbars-viewport~=scrollbarHidden]::-webkit-scrollbar,[data-overlayscrollbars-viewport~=scrollbarHidden]::-webkit-scrollbar-corner,.os-scrollbar-hidden.os-environment::-webkit-scrollbar,.os-scrollbar-hidden.os-environment::-webkit-scrollbar-corner{-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;display:none!important;width:0!important;height:0!important}[data-overlayscrollbars-initialize]{overflow:auto}html[data-overlayscrollbars],html.os-scrollbar-hidden,html.os-scrollbar-hidden>body{box-sizing:border-box;margin:0;width:100%;height:100%}html[data-overlayscrollbars]>body{overflow:visible}[data-overlayscrollbars~=host]{position:relative}[data-overlayscrollbars~=host],[data-overlayscrollbars-padding]{display:flex;flex-direction:row!important;flex-wrap:nowrap!important}[data-overlayscrollbars-padding],[data-overlayscrollbars-viewport]{box-sizing:inherit;position:relative;flex:auto!important;height:auto;width:100%;min-width:0;padding:0;margin:0;border:none;z-index:0}[data-overlayscrollbars-viewport]{--os-vaw: 0;--os-vah: 0}[data-overlayscrollbars-viewport][data-overlayscrollbars-viewport~=arrange]:before{content:"";position:absolute;pointer-events:none;z-index:-1;min-width:1px;min-height:1px;width:var(--os-vaw);height:var(--os-vah)}[data-overlayscrollbars-padding],[data-overlayscrollbars-viewport],[data-overlayscrollbars~=host],[data-overlayscrollbars~=viewport]{overflow:hidden}[data-overlayscrollbars~=overflowVisible],[data-overlayscrollbars-padding~=overflowVisible],[data-overlayscrollbars-viewport~=overflowVisible]{overflow:visible}[data-overlayscrollbars-overflow-x=hidden]{overflow-x:hidden}[data-overlayscrollbars-overflow-x=scroll]{overflow-x:scroll}[data-overlayscrollbars-overflow-x=hidden]{overflow-y:hidden}[data-overlayscrollbars-overflow-y=scroll]{overflow-y:scroll}[data-overlayscrollbars~=scrollbarPressed],[data-overlayscrollbars~=scrollbarPressed] [data-overlayscrollbars-viewport]{scroll-behavior:auto!important}[data-overlayscrollbars-content]{box-sizing:inherit}[data-overlayscrollbars-grid],[data-overlayscrollbars-grid] [data-overlayscrollbars-padding]{display:grid;grid-template:1fr/1fr}[data-overlayscrollbars-grid]>[data-overlayscrollbars-padding],[data-overlayscrollbars-grid]>[data-overlayscrollbars-viewport],[data-overlayscrollbars-grid]>[data-overlayscrollbars-padding]>[data-overlayscrollbars-viewport]{height:auto!important;width:auto!important}.os-scrollbar{contain:size layout;contain:size layout style;transition:opacity .15s,visibility .15s,top .15s,right .15s,bottom .15s,left .15s;pointer-events:none;position:absolute;opacity:0;visibility:hidden}body>.os-scrollbar{position:fixed;z-index:99999}.os-scrollbar-transitionless{transition:none}.os-scrollbar-track{position:relative;direction:ltr!important;padding:0!important;border:none!important}.os-scrollbar-handle{position:absolute}.os-scrollbar-track,.os-scrollbar-handle{pointer-events:none;width:100%;height:100%}.os-scrollbar.os-scrollbar-track-interactive .os-scrollbar-track,.os-scrollbar.os-scrollbar-handle-interactive .os-scrollbar-handle{pointer-events:auto;touch-action:none}.os-scrollbar-horizontal{bottom:0;left:0}.os-scrollbar-vertical{top:0;right:0}.os-scrollbar-rtl.os-scrollbar-horizontal{right:0}.os-scrollbar-rtl.os-scrollbar-vertical{right:auto;left:0}.os-scrollbar-visible,.os-scrollbar-interaction.os-scrollbar-visible{opacity:1;visibility:visible}.os-scrollbar-auto-hidden{opacity:0;visibility:hidden}.os-scrollbar-unusable,.os-scrollbar-unusable *,.os-scrollbar-wheel,.os-scrollbar-wheel *{pointer-events:none!important}.os-scrollbar-unusable .os-scrollbar-handle{opacity:0!important}.os-scrollbar-horizontal .os-scrollbar-handle{bottom:0}.os-scrollbar-vertical .os-scrollbar-handle{right:0}.os-scrollbar-rtl.os-scrollbar-vertical .os-scrollbar-handle{right:auto;left:0}.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless,.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless.os-scrollbar-rtl{left:0;right:0}.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless,.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless.os-scrollbar-rtl{top:0;bottom:0}.os-scrollbar{--os-size: 0;--os-padding-perpendicular: 0;--os-padding-axis: 0;--os-track-border-radius: 0;--os-track-bg: none;--os-track-bg-hover: none;--os-track-bg-active: none;--os-track-border: none;--os-track-border-hover: none;--os-track-border-active: none;--os-handle-border-radius: 0;--os-handle-bg: none;--os-handle-bg-hover: none;--os-handle-bg-active: none;--os-handle-border: none;--os-handle-border-hover: none;--os-handle-border-active: none;--os-handle-min-size: 33px;--os-handle-max-size: none;--os-handle-perpendicular-size: 100%;--os-handle-perpendicular-size-hover: 100%;--os-handle-perpendicular-size-active: 100%;--os-handle-interactive-area-offset: 0}.os-scrollbar .os-scrollbar-track{border:var(--os-track-border);border-radius:var(--os-track-border-radius);background:var(--os-track-bg);transition:opacity .15s,background-color .15s,border-color .15s}.os-scrollbar .os-scrollbar-track:hover{border:var(--os-track-border-hover);background:var(--os-track-bg-hover)}.os-scrollbar .os-scrollbar-track:active{border:var(--os-track-border-active);background:var(--os-track-bg-active)}.os-scrollbar .os-scrollbar-handle{border:var(--os-handle-border);border-radius:var(--os-handle-border-radius);background:var(--os-handle-bg)}.os-scrollbar .os-scrollbar-handle:before{content:"";position:absolute;left:0;right:0;top:0;bottom:0;display:block}.os-scrollbar .os-scrollbar-handle:hover{border:var(--os-handle-border-hover);background:var(--os-handle-bg-hover)}.os-scrollbar .os-scrollbar-handle:active{border:var(--os-handle-border-active);background:var(--os-handle-bg-active)}.os-scrollbar-horizontal{padding:var(--os-padding-perpendicular) var(--os-padding-axis);right:var(--os-size);height:var(--os-size)}.os-scrollbar-horizontal.os-scrollbar-rtl{left:var(--os-size);right:0}.os-scrollbar-horizontal .os-scrollbar-handle{min-width:var(--os-handle-min-size);max-width:var(--os-handle-max-size);height:var(--os-handle-perpendicular-size);transition:opacity .15s,background-color .15s,border-color .15s,height .15s}.os-scrollbar-horizontal .os-scrollbar-handle:before{top:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);bottom:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-horizontal:hover .os-scrollbar-handle{height:var(--os-handle-perpendicular-size-hover)}.os-scrollbar-horizontal:active .os-scrollbar-handle{height:var(--os-handle-perpendicular-size-active)}.os-scrollbar-vertical{padding:var(--os-padding-axis) var(--os-padding-perpendicular);bottom:var(--os-size);width:var(--os-size)}.os-scrollbar-vertical .os-scrollbar-handle{min-height:var(--os-handle-min-size);max-height:var(--os-handle-max-size);width:var(--os-handle-perpendicular-size);transition:opacity .15s,background-color .15s,border-color .15s,width .15s}.os-scrollbar-vertical .os-scrollbar-handle:before{left:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);right:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before{right:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);left:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-vertical:hover .os-scrollbar-handle{width:var(--os-handle-perpendicular-size-hover)}.os-scrollbar-vertical:active .os-scrollbar-handle{width:var(--os-handle-perpendicular-size-active)}[data-overlayscrollbars~=updating]>.os-scrollbar,.os-theme-none.os-scrollbar{display:none!important}.os-theme-dark,.os-theme-light{box-sizing:border-box;--os-size: 10px;--os-padding-perpendicular: 2px;--os-padding-axis: 2px;--os-track-border-radius: 10px;--os-handle-interactive-area-offset: 4px;--os-handle-border-radius: 10px}.os-theme-dark{--os-handle-bg: rgba(0, 0, 0, .44);--os-handle-bg-hover: rgba(0, 0, 0, .55);--os-handle-bg-active: rgba(0, 0, 0, .66)}.os-theme-light{--os-handle-bg: rgba(255, 255, 255, .44);--os-handle-bg-hover: rgba(255, 255, 255, .55);--os-handle-bg-active: rgba(255, 255, 255, .66)}.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-handle,.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-track,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-track{border-radius:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal{padding:2px;right:10px;height:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal.os-scrollbar-rtl,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal.os-scrollbar-rtl{left:10px;right:0}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle{min-width:33px;max-width:none}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle:before{top:-6px;bottom:-2px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical,.os-no-css-vars.os-theme-light.os-scrollbar-vertical{padding:2px;bottom:10px;width:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle{min-height:33px;max-height:none}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle:before{left:-6px;right:-2px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before{right:-6px;left:-2px}.os-no-css-vars.os-theme-dark .os-scrollbar-handle{background:rgba(0,0,0,.44)}.os-no-css-vars.os-theme-dark:hover .os-scrollbar-handle{background:rgba(0,0,0,.55)}.os-no-css-vars.os-theme-dark:active .os-scrollbar-handle{background:rgba(0,0,0,.66)}.os-no-css-vars.os-theme-light .os-scrollbar-handle{background:rgba(255,255,255,.44)}.os-no-css-vars.os-theme-light:hover .os-scrollbar-handle{background:rgba(255,255,255,.55)}.os-no-css-vars.os-theme-light:active .os-scrollbar-handle{background:rgba(255,255,255,.66)}.os-scrollbar{--os-handle-bg: var(--invokeai-colors-accentAlpha-500);--os-handle-bg-hover: var(--invokeai-colors-accentAlpha-700);--os-handle-bg-active: var(--invokeai-colors-accentAlpha-800);--os-handle-min-size: 50px} diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-37ef62a0.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-9d17ef9a.js similarity index 94% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-37ef62a0.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-9d17ef9a.js index dbe6637892..eaa62f15d4 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-37ef62a0.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-9d17ef9a.js @@ -1,4 +1,4 @@ -import{w as s,ie as T,v as l,_ as I,ig as R,aa as V,ih as z,ii as j,ij as D,ik as F,il as G,im as W,io as K,az as H,ip as U,iq as Y}from"./index-c553e366.js";import{M as Z}from"./MantineProvider-094ba0de.js";var P=String.raw,E=P` +import{I as s,ie as T,v as l,$ as A,ig as R,aa as V,ih as z,ii as j,ij as D,ik as F,il as G,im as W,io as K,az as H,ip as U,iq as Y}from"./index-f820e2e3.js";import{M as Z}from"./MantineProvider-a6a1d85c.js";var P=String.raw,E=P` :root, :host { --chakra-vh: 100vh; @@ -277,4 +277,4 @@ import{w as s,ie as T,v as l,_ as I,ig as R,aa as V,ih as z,ii as j,ij as D,ik a } ${E} - `}),g={light:"chakra-ui-light",dark:"chakra-ui-dark"};function Q(e={}){const{preventTransition:o=!0}=e,n={setDataset:r=>{const t=o?n.preventTransition():void 0;document.documentElement.dataset.theme=r,document.documentElement.style.colorScheme=r,t==null||t()},setClassName(r){document.body.classList.add(r?g.dark:g.light),document.body.classList.remove(r?g.light:g.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(r){var t;return((t=n.query().matches)!=null?t:r==="dark")?"dark":"light"},addListener(r){const t=n.query(),i=a=>{r(a.matches?"dark":"light")};return typeof t.addListener=="function"?t.addListener(i):t.addEventListener("change",i),()=>{typeof t.removeListener=="function"?t.removeListener(i):t.removeEventListener("change",i)}},preventTransition(){const r=document.createElement("style");return r.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(r)})})}}};return n}var X="chakra-ui-color-mode";function L(e){return{ssr:!1,type:"localStorage",get(o){if(!(globalThis!=null&&globalThis.document))return o;let n;try{n=localStorage.getItem(e)||o}catch{}return n||o},set(o){try{localStorage.setItem(e,o)}catch{}}}}var ee=L(X),M=()=>{};function S(e,o){return e.type==="cookie"&&e.ssr?e.get(o):o}function O(e){const{value:o,children:n,options:{useSystemColorMode:r,initialColorMode:t,disableTransitionOnChange:i}={},colorModeManager:a=ee}=e,d=t==="dark"?"dark":"light",[u,p]=l.useState(()=>S(a,d)),[y,b]=l.useState(()=>S(a)),{getSystemTheme:w,setClassName:k,setDataset:x,addListener:$}=l.useMemo(()=>Q({preventTransition:i}),[i]),v=t==="system"&&!u?y:u,c=l.useCallback(m=>{const f=m==="system"?w():m;p(f),k(f==="dark"),x(f),a.set(f)},[a,w,k,x]);I(()=>{t==="system"&&b(w())},[]),l.useEffect(()=>{const m=a.get();if(m){c(m);return}if(t==="system"){c("system");return}c(d)},[a,d,t,c]);const C=l.useCallback(()=>{c(v==="dark"?"light":"dark")},[v,c]);l.useEffect(()=>{if(r)return $(c)},[r,$,c]);const A=l.useMemo(()=>({colorMode:o??v,toggleColorMode:o?M:C,setColorMode:o?M:c,forced:o!==void 0}),[v,C,c,o]);return s.jsx(R.Provider,{value:A,children:n})}O.displayName="ColorModeProvider";var te=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function re(e){return V(e)?te.every(o=>Object.prototype.hasOwnProperty.call(e,o)):!1}function h(e){return typeof e=="function"}function oe(...e){return o=>e.reduce((n,r)=>r(n),o)}var ne=e=>function(...n){let r=[...n],t=n[n.length-1];return re(t)&&r.length>1?r=r.slice(0,r.length-1):t=e,oe(...r.map(i=>a=>h(i)?i(a):ae(a,i)))(t)},ie=ne(j);function ae(...e){return z({},...e,_)}function _(e,o,n,r){if((h(e)||h(o))&&Object.prototype.hasOwnProperty.call(r,n))return(...t)=>{const i=h(e)?e(...t):e,a=h(o)?o(...t):o;return z({},i,a,_)}}var q=l.createContext({getDocument(){return document},getWindow(){return window}});q.displayName="EnvironmentContext";function N(e){const{children:o,environment:n,disabled:r}=e,t=l.useRef(null),i=l.useMemo(()=>n||{getDocument:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument)!=null?u:document},getWindow:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument.defaultView)!=null?u:window}},[n]),a=!r||!n;return s.jsxs(q.Provider,{value:i,children:[o,a&&s.jsx("span",{id:"__chakra_env",hidden:!0,ref:t})]})}N.displayName="EnvironmentProvider";var se=e=>{const{children:o,colorModeManager:n,portalZIndex:r,resetScope:t,resetCSS:i=!0,theme:a={},environment:d,cssVarsRoot:u,disableEnvironment:p,disableGlobalStyle:y}=e,b=s.jsx(N,{environment:d,disabled:p,children:o});return s.jsx(D,{theme:a,cssVarsRoot:u,children:s.jsxs(O,{colorModeManager:n,options:a.config,children:[i?s.jsx(J,{scope:t}):s.jsx(B,{}),!y&&s.jsx(F,{}),r?s.jsx(G,{zIndex:r,children:b}):b]})})},le=e=>function({children:n,theme:r=e,toastOptions:t,...i}){return s.jsxs(se,{theme:r,...i,children:[s.jsx(W,{value:t==null?void 0:t.defaultOptions,children:n}),s.jsx(K,{...t})]})},de=le(j);const ue=()=>l.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),ce=L("@@invokeai-color-mode");function me({children:e}){const{i18n:o}=H(),n=o.dir(),r=l.useMemo(()=>ie({...U,direction:n}),[n]);l.useEffect(()=>{document.body.dir=n},[n]);const t=ue();return s.jsx(Z,{theme:t,children:s.jsx(de,{theme:r,colorModeManager:ce,toastOptions:Y,children:e})})}const ve=l.memo(me);export{ve as default}; + `}),g={light:"chakra-ui-light",dark:"chakra-ui-dark"};function Q(e={}){const{preventTransition:o=!0}=e,n={setDataset:r=>{const t=o?n.preventTransition():void 0;document.documentElement.dataset.theme=r,document.documentElement.style.colorScheme=r,t==null||t()},setClassName(r){document.body.classList.add(r?g.dark:g.light),document.body.classList.remove(r?g.light:g.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(r){var t;return((t=n.query().matches)!=null?t:r==="dark")?"dark":"light"},addListener(r){const t=n.query(),i=a=>{r(a.matches?"dark":"light")};return typeof t.addListener=="function"?t.addListener(i):t.addEventListener("change",i),()=>{typeof t.removeListener=="function"?t.removeListener(i):t.removeEventListener("change",i)}},preventTransition(){const r=document.createElement("style");return r.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(r)})})}}};return n}var X="chakra-ui-color-mode";function L(e){return{ssr:!1,type:"localStorage",get(o){if(!(globalThis!=null&&globalThis.document))return o;let n;try{n=localStorage.getItem(e)||o}catch{}return n||o},set(o){try{localStorage.setItem(e,o)}catch{}}}}var ee=L(X),M=()=>{};function S(e,o){return e.type==="cookie"&&e.ssr?e.get(o):o}function O(e){const{value:o,children:n,options:{useSystemColorMode:r,initialColorMode:t,disableTransitionOnChange:i}={},colorModeManager:a=ee}=e,d=t==="dark"?"dark":"light",[u,p]=l.useState(()=>S(a,d)),[y,b]=l.useState(()=>S(a)),{getSystemTheme:w,setClassName:k,setDataset:x,addListener:$}=l.useMemo(()=>Q({preventTransition:i}),[i]),v=t==="system"&&!u?y:u,c=l.useCallback(m=>{const f=m==="system"?w():m;p(f),k(f==="dark"),x(f),a.set(f)},[a,w,k,x]);A(()=>{t==="system"&&b(w())},[]),l.useEffect(()=>{const m=a.get();if(m){c(m);return}if(t==="system"){c("system");return}c(d)},[a,d,t,c]);const C=l.useCallback(()=>{c(v==="dark"?"light":"dark")},[v,c]);l.useEffect(()=>{if(r)return $(c)},[r,$,c]);const N=l.useMemo(()=>({colorMode:o??v,toggleColorMode:o?M:C,setColorMode:o?M:c,forced:o!==void 0}),[v,C,c,o]);return s.jsx(R.Provider,{value:N,children:n})}O.displayName="ColorModeProvider";var te=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function re(e){return V(e)?te.every(o=>Object.prototype.hasOwnProperty.call(e,o)):!1}function h(e){return typeof e=="function"}function oe(...e){return o=>e.reduce((n,r)=>r(n),o)}var ne=e=>function(...n){let r=[...n],t=n[n.length-1];return re(t)&&r.length>1?r=r.slice(0,r.length-1):t=e,oe(...r.map(i=>a=>h(i)?i(a):ae(a,i)))(t)},ie=ne(j);function ae(...e){return z({},...e,_)}function _(e,o,n,r){if((h(e)||h(o))&&Object.prototype.hasOwnProperty.call(r,n))return(...t)=>{const i=h(e)?e(...t):e,a=h(o)?o(...t):o;return z({},i,a,_)}}var q=l.createContext({getDocument(){return document},getWindow(){return window}});q.displayName="EnvironmentContext";function I(e){const{children:o,environment:n,disabled:r}=e,t=l.useRef(null),i=l.useMemo(()=>n||{getDocument:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument)!=null?u:document},getWindow:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument.defaultView)!=null?u:window}},[n]),a=!r||!n;return s.jsxs(q.Provider,{value:i,children:[o,a&&s.jsx("span",{id:"__chakra_env",hidden:!0,ref:t})]})}I.displayName="EnvironmentProvider";var se=e=>{const{children:o,colorModeManager:n,portalZIndex:r,resetScope:t,resetCSS:i=!0,theme:a={},environment:d,cssVarsRoot:u,disableEnvironment:p,disableGlobalStyle:y}=e,b=s.jsx(I,{environment:d,disabled:p,children:o});return s.jsx(D,{theme:a,cssVarsRoot:u,children:s.jsxs(O,{colorModeManager:n,options:a.config,children:[i?s.jsx(J,{scope:t}):s.jsx(B,{}),!y&&s.jsx(F,{}),r?s.jsx(G,{zIndex:r,children:b}):b]})})},le=e=>function({children:n,theme:r=e,toastOptions:t,...i}){return s.jsxs(se,{theme:r,...i,children:[s.jsx(W,{value:t==null?void 0:t.defaultOptions,children:n}),s.jsx(K,{...t})]})},de=le(j);const ue=()=>l.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),ce=L("@@invokeai-color-mode");function me({children:e}){const{i18n:o}=H(),n=o.dir(),r=l.useMemo(()=>ie({...U,direction:n}),[n]);l.useEffect(()=>{document.body.dir=n},[n]);const t=ue();return s.jsx(Z,{theme:t,children:s.jsx(de,{theme:r,colorModeManager:ce,toastOptions:Y,children:e})})}const ve=l.memo(me);export{ve as default}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-f5f9aabf.css b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-f5f9aabf.css new file mode 100644 index 0000000000..2d9bf55425 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-f5f9aabf.css @@ -0,0 +1,9 @@ +@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-cyrillic-ext-wght-normal-1c3007b8.woff2) format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-cyrillic-wght-normal-eba94878.woff2) format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-greek-ext-wght-normal-81f77e51.woff2) format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-greek-wght-normal-d92c6cbc.woff2) format("woff2-variations");unicode-range:U+0370-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-vietnamese-wght-normal-15df7612.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-latin-ext-wght-normal-a2bfd9fe.woff2) format("woff2-variations");unicode-range:U+0100-02AF,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-latin-wght-normal-88df0b5a.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}/*! +* OverlayScrollbars +* Version: 2.4.4 +* +* Copyright (c) Rene Haas | KingSora. +* https://github.com/KingSora +* +* Released under the MIT license. +*/.os-size-observer,.os-size-observer-listener{scroll-behavior:auto!important;direction:inherit;pointer-events:none;overflow:hidden;visibility:hidden;box-sizing:border-box}.os-size-observer,.os-size-observer-listener,.os-size-observer-listener-item,.os-size-observer-listener-item-final{writing-mode:horizontal-tb;position:absolute;left:0;top:0}.os-size-observer{z-index:-1;contain:strict;display:flex;flex-direction:row;flex-wrap:nowrap;padding:inherit;border:inherit;box-sizing:inherit;margin:-133px;top:0;right:0;bottom:0;left:0;transform:scale(.1)}.os-size-observer:before{content:"";flex:none;box-sizing:inherit;padding:10px;width:10px;height:10px}.os-size-observer-appear{animation:os-size-observer-appear-animation 1ms forwards}.os-size-observer-listener{box-sizing:border-box;position:relative;flex:auto;padding:inherit;border:inherit;margin:-133px;transform:scale(10)}.os-size-observer-listener.ltr{margin-right:-266px;margin-left:0}.os-size-observer-listener.rtl{margin-left:-266px;margin-right:0}.os-size-observer-listener:empty:before{content:"";width:100%;height:100%}.os-size-observer-listener:empty:before,.os-size-observer-listener>.os-size-observer-listener-item{display:block;position:relative;padding:inherit;border:inherit;box-sizing:content-box;flex:auto}.os-size-observer-listener-scroll{box-sizing:border-box;display:flex}.os-size-observer-listener-item{right:0;bottom:0;overflow:hidden;direction:ltr;flex:none}.os-size-observer-listener-item-final{transition:none}@keyframes os-size-observer-appear-animation{0%{cursor:auto}to{cursor:none}}.os-trinsic-observer{flex:none;box-sizing:border-box;position:relative;max-width:0px;max-height:1px;padding:0;margin:0;border:none;overflow:hidden;z-index:-1;height:0;top:calc(100% + 1px);contain:strict}.os-trinsic-observer:not(:empty){height:calc(100% + 1px);top:-1px}.os-trinsic-observer:not(:empty)>.os-size-observer{width:1000%;height:1000%;min-height:1px;min-width:1px}.os-environment{scroll-behavior:auto!important;--os-custom-prop: -1;position:fixed;opacity:0;visibility:hidden;overflow:scroll;height:200px;width:200px;z-index:var(--os-custom-prop)}.os-environment div{width:200%;height:200%;margin:10px 0}.os-environment.os-environment-flexbox-glue{display:flex;flex-direction:row;flex-wrap:nowrap;height:auto;width:auto;min-height:200px;min-width:200px}.os-environment.os-environment-flexbox-glue div{flex:auto;width:auto;height:auto;max-height:100%;max-width:100%;margin:0}.os-environment.os-environment-flexbox-glue-max{max-height:200px}.os-environment.os-environment-flexbox-glue-max div{overflow:visible}.os-environment.os-environment-flexbox-glue-max div:before{content:"";display:block;height:999px;width:999px}.os-environment,[data-overlayscrollbars-viewport]{-ms-overflow-style:scrollbar!important}[data-overlayscrollbars-initialize],[data-overlayscrollbars~=scrollbarHidden],[data-overlayscrollbars-viewport~=scrollbarHidden],.os-scrollbar-hidden.os-environment{scrollbar-width:none!important}[data-overlayscrollbars-initialize]::-webkit-scrollbar,[data-overlayscrollbars-initialize]::-webkit-scrollbar-corner,[data-overlayscrollbars~=scrollbarHidden]::-webkit-scrollbar,[data-overlayscrollbars~=scrollbarHidden]::-webkit-scrollbar-corner,[data-overlayscrollbars-viewport~=scrollbarHidden]::-webkit-scrollbar,[data-overlayscrollbars-viewport~=scrollbarHidden]::-webkit-scrollbar-corner,.os-scrollbar-hidden.os-environment::-webkit-scrollbar,.os-scrollbar-hidden.os-environment::-webkit-scrollbar-corner{-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;display:none!important;width:0!important;height:0!important}[data-overlayscrollbars-initialize]:not([data-overlayscrollbars]):not(html):not(body){overflow:auto}html[data-overlayscrollbars],html.os-scrollbar-hidden,html.os-scrollbar-hidden>body{box-sizing:border-box;margin:0;width:100%;height:100%}html[data-overlayscrollbars]>body{overflow:visible}[data-overlayscrollbars~=host],[data-overlayscrollbars-padding]{display:flex;align-items:stretch!important;flex-direction:row!important;flex-wrap:nowrap!important}[data-overlayscrollbars-padding],[data-overlayscrollbars-viewport]{box-sizing:inherit;position:relative;flex:auto!important;height:auto;width:100%;min-width:0;padding:0;margin:0;border:none;z-index:0}[data-overlayscrollbars-viewport]{--os-vaw: 0;--os-vah: 0}[data-overlayscrollbars-viewport][data-overlayscrollbars-viewport~=arrange]:before{content:"";position:absolute;pointer-events:none;z-index:-1;min-width:1px;min-height:1px;width:var(--os-vaw);height:var(--os-vah)}[data-overlayscrollbars-padding],[data-overlayscrollbars-viewport]{overflow:hidden}[data-overlayscrollbars~=host],[data-overlayscrollbars~=viewport]{position:relative;overflow:hidden}[data-overlayscrollbars~=overflowVisible],[data-overlayscrollbars-padding~=overflowVisible],[data-overlayscrollbars-viewport~=overflowVisible]{overflow:visible}[data-overlayscrollbars-overflow-x=hidden]{overflow-x:hidden}[data-overlayscrollbars-overflow-x=scroll]{overflow-x:scroll}[data-overlayscrollbars-overflow-x=hidden]{overflow-y:hidden}[data-overlayscrollbars-overflow-y=scroll]{overflow-y:scroll}[data-overlayscrollbars~=scrollbarPressed],[data-overlayscrollbars~=scrollbarPressed] [data-overlayscrollbars-viewport]{scroll-behavior:auto!important}[data-overlayscrollbars-content]{box-sizing:inherit}[data-overlayscrollbars-contents]:not([data-overlayscrollbars-padding]):not([data-overlayscrollbars-viewport]):not([data-overlayscrollbars-content]){display:contents}[data-overlayscrollbars-grid],[data-overlayscrollbars-grid] [data-overlayscrollbars-padding]{display:grid;grid-template:1fr/1fr}[data-overlayscrollbars-grid]>[data-overlayscrollbars-padding],[data-overlayscrollbars-grid]>[data-overlayscrollbars-viewport],[data-overlayscrollbars-grid]>[data-overlayscrollbars-padding]>[data-overlayscrollbars-viewport]{height:auto!important;width:auto!important}.os-scrollbar{contain:size layout;contain:size layout style;transition:opacity .15s,visibility .15s,top .15s,right .15s,bottom .15s,left .15s;pointer-events:none;position:absolute;opacity:0;visibility:hidden}body>.os-scrollbar{position:fixed;z-index:99999}.os-scrollbar-transitionless{transition:none}.os-scrollbar-track{position:relative;direction:ltr!important;padding:0!important;border:none!important}.os-scrollbar-handle{position:absolute}.os-scrollbar-track,.os-scrollbar-handle{pointer-events:none;width:100%;height:100%}.os-scrollbar.os-scrollbar-track-interactive .os-scrollbar-track,.os-scrollbar.os-scrollbar-handle-interactive .os-scrollbar-handle{pointer-events:auto;touch-action:none}.os-scrollbar-horizontal{bottom:0;left:0}.os-scrollbar-vertical{top:0;right:0}.os-scrollbar-rtl.os-scrollbar-horizontal{right:0}.os-scrollbar-rtl.os-scrollbar-vertical{right:auto;left:0}.os-scrollbar-visible,.os-scrollbar-interaction.os-scrollbar-visible{opacity:1;visibility:visible}.os-scrollbar-auto-hide.os-scrollbar-auto-hide-hidden{opacity:0;visibility:hidden}.os-scrollbar-unusable,.os-scrollbar-unusable *,.os-scrollbar-wheel,.os-scrollbar-wheel *{pointer-events:none!important}.os-scrollbar-unusable .os-scrollbar-handle{opacity:0!important}.os-scrollbar-horizontal .os-scrollbar-handle{bottom:0}.os-scrollbar-vertical .os-scrollbar-handle{right:0}.os-scrollbar-rtl.os-scrollbar-vertical .os-scrollbar-handle{right:auto;left:0}.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless,.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless.os-scrollbar-rtl{left:0;right:0}.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless,.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless.os-scrollbar-rtl{top:0;bottom:0}.os-scrollbar{--os-size: 0;--os-padding-perpendicular: 0;--os-padding-axis: 0;--os-track-border-radius: 0;--os-track-bg: none;--os-track-bg-hover: none;--os-track-bg-active: none;--os-track-border: none;--os-track-border-hover: none;--os-track-border-active: none;--os-handle-border-radius: 0;--os-handle-bg: none;--os-handle-bg-hover: none;--os-handle-bg-active: none;--os-handle-border: none;--os-handle-border-hover: none;--os-handle-border-active: none;--os-handle-min-size: 33px;--os-handle-max-size: none;--os-handle-perpendicular-size: 100%;--os-handle-perpendicular-size-hover: 100%;--os-handle-perpendicular-size-active: 100%;--os-handle-interactive-area-offset: 0}.os-scrollbar .os-scrollbar-track{border:var(--os-track-border);border-radius:var(--os-track-border-radius);background:var(--os-track-bg);transition:opacity .15s,background-color .15s,border-color .15s}.os-scrollbar .os-scrollbar-track:hover{border:var(--os-track-border-hover);background:var(--os-track-bg-hover)}.os-scrollbar .os-scrollbar-track:active{border:var(--os-track-border-active);background:var(--os-track-bg-active)}.os-scrollbar .os-scrollbar-handle{border:var(--os-handle-border);border-radius:var(--os-handle-border-radius);background:var(--os-handle-bg)}.os-scrollbar .os-scrollbar-handle:before{content:"";position:absolute;left:0;right:0;top:0;bottom:0;display:block}.os-scrollbar .os-scrollbar-handle:hover{border:var(--os-handle-border-hover);background:var(--os-handle-bg-hover)}.os-scrollbar .os-scrollbar-handle:active{border:var(--os-handle-border-active);background:var(--os-handle-bg-active)}.os-scrollbar-horizontal{padding:var(--os-padding-perpendicular) var(--os-padding-axis);right:var(--os-size);height:var(--os-size)}.os-scrollbar-horizontal.os-scrollbar-rtl{left:var(--os-size);right:0}.os-scrollbar-horizontal .os-scrollbar-handle{min-width:var(--os-handle-min-size);max-width:var(--os-handle-max-size);height:var(--os-handle-perpendicular-size);transition:opacity .15s,background-color .15s,border-color .15s,height .15s}.os-scrollbar-horizontal .os-scrollbar-handle:before{top:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);bottom:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-horizontal:hover .os-scrollbar-handle{height:var(--os-handle-perpendicular-size-hover)}.os-scrollbar-horizontal:active .os-scrollbar-handle{height:var(--os-handle-perpendicular-size-active)}.os-scrollbar-vertical{padding:var(--os-padding-axis) var(--os-padding-perpendicular);bottom:var(--os-size);width:var(--os-size)}.os-scrollbar-vertical .os-scrollbar-handle{min-height:var(--os-handle-min-size);max-height:var(--os-handle-max-size);width:var(--os-handle-perpendicular-size);transition:opacity .15s,background-color .15s,border-color .15s,width .15s}.os-scrollbar-vertical .os-scrollbar-handle:before{left:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);right:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before{right:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);left:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-vertical:hover .os-scrollbar-handle{width:var(--os-handle-perpendicular-size-hover)}.os-scrollbar-vertical:active .os-scrollbar-handle{width:var(--os-handle-perpendicular-size-active)}[data-overlayscrollbars~=updating]>.os-scrollbar,.os-theme-none.os-scrollbar{display:none!important}.os-theme-dark,.os-theme-light{box-sizing:border-box;--os-size: 10px;--os-padding-perpendicular: 2px;--os-padding-axis: 2px;--os-track-border-radius: 10px;--os-handle-interactive-area-offset: 4px;--os-handle-border-radius: 10px}.os-theme-dark{--os-handle-bg: rgba(0, 0, 0, .44);--os-handle-bg-hover: rgba(0, 0, 0, .55);--os-handle-bg-active: rgba(0, 0, 0, .66)}.os-theme-light{--os-handle-bg: rgba(255, 255, 255, .44);--os-handle-bg-hover: rgba(255, 255, 255, .55);--os-handle-bg-active: rgba(255, 255, 255, .66)}.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-handle,.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-track,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-track{border-radius:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal{padding:2px;right:10px;height:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal.os-scrollbar-cornerless,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal.os-scrollbar-cornerless{right:0}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal.os-scrollbar-rtl,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal.os-scrollbar-rtl{left:10px;right:0}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal.os-scrollbar-rtl.os-scrollbar-cornerless,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal.os-scrollbar-rtl.os-scrollbar-cornerless{left:0}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle{min-width:33px;max-width:none}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle:before{top:-6px;bottom:-2px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical,.os-no-css-vars.os-theme-light.os-scrollbar-vertical{padding:2px;bottom:10px;width:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical.os-scrollbar-cornerless,.os-no-css-vars.os-theme-light.os-scrollbar-vertical.os-scrollbar-cornerless{bottom:0}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle{min-height:33px;max-height:none}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle:before{left:-6px;right:-2px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before{right:-6px;left:-2px}.os-no-css-vars.os-theme-dark .os-scrollbar-handle{background:rgba(0,0,0,.44)}.os-no-css-vars.os-theme-dark:hover .os-scrollbar-handle{background:rgba(0,0,0,.55)}.os-no-css-vars.os-theme-dark:active .os-scrollbar-handle{background:rgba(0,0,0,.66)}.os-no-css-vars.os-theme-light .os-scrollbar-handle{background:rgba(255,255,255,.44)}.os-no-css-vars.os-theme-light:hover .os-scrollbar-handle{background:rgba(255,255,255,.55)}.os-no-css-vars.os-theme-light:active .os-scrollbar-handle{background:rgba(255,255,255,.66)}.os-scrollbar{--os-handle-bg: var(--invokeai-colors-accentAlpha-500);--os-handle-bg-hover: var(--invokeai-colors-accentAlpha-700);--os-handle-bg-active: var(--invokeai-colors-accentAlpha-800);--os-handle-min-size: 50px} diff --git a/invokeai/frontend/web/dist/assets/index-c553e366.js b/invokeai/frontend/web/dist/assets/index-c553e366.js deleted file mode 100644 index 6a524be799..0000000000 --- a/invokeai/frontend/web/dist/assets/index-c553e366.js +++ /dev/null @@ -1,156 +0,0 @@ -var eq=Object.defineProperty;var tq=(e,t,n)=>t in e?eq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var W2=(e,t,n)=>(tq(e,typeof t!="symbol"?t+"":t,n),n),K2=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var te=(e,t,n)=>(K2(e,t,"read from private field"),n?n.call(e):t.get(e)),Ut=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ri=(e,t,n,r)=>(K2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Zf=(e,t,n,r)=>({set _(i){Ri(e,t,i,n)},get _(){return te(e,t,r)}}),Uo=(e,t,n)=>(K2(e,t,"access private method"),n);function iO(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nq(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var oO={exports:{}},_b={},aO={exports:{}},We={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var tm=Symbol.for("react.element"),rq=Symbol.for("react.portal"),iq=Symbol.for("react.fragment"),oq=Symbol.for("react.strict_mode"),aq=Symbol.for("react.profiler"),sq=Symbol.for("react.provider"),lq=Symbol.for("react.context"),uq=Symbol.for("react.forward_ref"),cq=Symbol.for("react.suspense"),dq=Symbol.for("react.memo"),fq=Symbol.for("react.lazy"),qT=Symbol.iterator;function hq(e){return e===null||typeof e!="object"?null:(e=qT&&e[qT]||e["@@iterator"],typeof e=="function"?e:null)}var sO={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},lO=Object.assign,uO={};function Pf(e,t,n){this.props=e,this.context=t,this.refs=uO,this.updater=n||sO}Pf.prototype.isReactComponent={};Pf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Pf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cO(){}cO.prototype=Pf.prototype;function K3(e,t,n){this.props=e,this.context=t,this.refs=uO,this.updater=n||sO}var X3=K3.prototype=new cO;X3.constructor=K3;lO(X3,Pf.prototype);X3.isPureReactComponent=!0;var WT=Array.isArray,dO=Object.prototype.hasOwnProperty,Q3={current:null},fO={key:!0,ref:!0,__self:!0,__source:!0};function hO(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)dO.call(t,r)&&!fO.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,V=O[z];if(0>>1;zi(Z,$))Ji(j,Z)?(O[z]=j,O[J]=$,z=J):(O[z]=Z,O[Q]=$,z=Q);else if(Ji(j,$))O[z]=j,O[J]=$,z=J;else break e}}return R}function i(O,R){var $=O.sortIndex-R.sortIndex;return $!==0?$:O.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(O){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=O)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function b(O){if(m=!1,g(O),!p)if(n(l)!==null)p=!0,N(S);else{var R=n(u);R!==null&&L(b,R.startTime-O)}}function S(O,R){p=!1,m&&(m=!1,v(C),C=-1),h=!0;var $=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||O&&!I());){var z=d.callback;if(typeof z=="function"){d.callback=null,f=d.priorityLevel;var V=z(d.expirationTime<=R);R=e.unstable_now(),typeof V=="function"?d.callback=V:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var H=!0;else{var Q=n(u);Q!==null&&L(b,Q.startTime-R),H=!1}return H}finally{d=null,f=$,h=!1}}var x=!1,w=null,C=-1,T=5,A=-1;function I(){return!(e.unstable_now()-AO||125z?(O.sortIndex=$,t(u,O),n(l)===null&&O===n(u)&&(m?(v(C),C=-1):m=!0,L(b,$-z))):(O.sortIndex=V,t(l,O),p||h||(p=!0,N(S))),O},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(O){var R=f;return function(){var $=f;f=R;try{return O.apply(this,arguments)}finally{f=$}}}})(yO);mO.exports=yO;var Cq=mO.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var vO=k,Si=Cq;function re(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nC=Object.prototype.hasOwnProperty,Eq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,QT={},YT={};function Aq(e){return nC.call(YT,e)?!0:nC.call(QT,e)?!1:Eq.test(e)?YT[e]=!0:(QT[e]=!0,!1)}function Tq(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Pq(e,t,n,r){if(t===null||typeof t>"u"||Tq(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fr(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var ar={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ar[e]=new Fr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ar[t]=new Fr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ar[e]=new Fr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ar[e]=new Fr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ar[e]=new Fr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ar[e]=new Fr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ar[e]=new Fr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ar[e]=new Fr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ar[e]=new Fr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Z3=/[\-:]([a-z])/g;function J3(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Z3,J3);ar[t]=new Fr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Z3,J3);ar[t]=new Fr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Z3,J3);ar[t]=new Fr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ar[e]=new Fr(e,1,!1,e.toLowerCase(),null,!1,!1)});ar.xlinkHref=new Fr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ar[e]=new Fr(e,1,!1,e.toLowerCase(),null,!0,!0)});function e4(e,t,n,r){var i=ar.hasOwnProperty(t)?ar[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` -`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{Y2=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Oh(e):""}function kq(e){switch(e.tag){case 5:return Oh(e.type);case 16:return Oh("Lazy");case 13:return Oh("Suspense");case 19:return Oh("SuspenseList");case 0:case 2:case 15:return e=Z2(e.type,!1),e;case 11:return e=Z2(e.type.render,!1),e;case 1:return e=Z2(e.type,!0),e;default:return""}}function aC(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Yc:return"Fragment";case Qc:return"Portal";case rC:return"Profiler";case t4:return"StrictMode";case iC:return"Suspense";case oC:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case SO:return(e.displayName||"Context")+".Consumer";case _O:return(e._context.displayName||"Context")+".Provider";case n4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case r4:return t=e.displayName||null,t!==null?t:aC(e.type)||"Memo";case Gs:t=e._payload,e=e._init;try{return aC(e(t))}catch{}}return null}function Iq(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return aC(t);case 8:return t===t4?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function wl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function wO(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Mq(e){var t=wO(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function t0(e){e._valueTracker||(e._valueTracker=Mq(e))}function CO(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=wO(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bv(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function sC(e,t){var n=t.checked;return Jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function JT(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=wl(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function EO(e,t){t=t.checked,t!=null&&e4(e,"checked",t,!1)}function lC(e,t){EO(e,t);var n=wl(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?uC(e,t.type,n):t.hasOwnProperty("defaultValue")&&uC(e,t.type,wl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function eP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function uC(e,t,n){(t!=="number"||bv(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $h=Array.isArray;function _d(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=n0.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Tp(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Rq=["Webkit","ms","Moz","O"];Object.keys(Jh).forEach(function(e){Rq.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Jh[t]=Jh[e]})});function kO(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Jh.hasOwnProperty(e)&&Jh[e]?(""+t).trim():t+"px"}function IO(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=kO(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Oq=Jt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fC(e,t){if(t){if(Oq[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(re(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(re(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(re(61))}if(t.style!=null&&typeof t.style!="object")throw Error(re(62))}}function hC(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pC=null;function i4(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gC=null,Sd=null,xd=null;function rP(e){if(e=im(e)){if(typeof gC!="function")throw Error(re(280));var t=e.stateNode;t&&(t=Eb(t),gC(e.stateNode,e.type,t))}}function MO(e){Sd?xd?xd.push(e):xd=[e]:Sd=e}function RO(){if(Sd){var e=Sd,t=xd;if(xd=Sd=null,rP(e),t)for(e=0;e>>=0,e===0?32:31-(Gq(e)/Hq|0)|0}var r0=64,i0=4194304;function Nh(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wv(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=Nh(s):(o&=a,o!==0&&(r=Nh(o)))}else a=n&~i,a!==0?r=Nh(a):o!==0&&(r=Nh(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function nm(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Eo(t),e[t]=n}function Xq(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=tp),fP=String.fromCharCode(32),hP=!1;function ZO(e,t){switch(e){case"keyup":return wW.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function JO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zc=!1;function EW(e,t){switch(e){case"compositionend":return JO(t);case"keypress":return t.which!==32?null:(hP=!0,fP);case"textInput":return e=t.data,e===fP&&hP?null:e;default:return null}}function AW(e,t){if(Zc)return e==="compositionend"||!f4&&ZO(e,t)?(e=QO(),Py=u4=il=null,Zc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yP(n)}}function r7(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?r7(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function i7(){for(var e=window,t=bv();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bv(e.document)}return t}function h4(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function NW(e){var t=i7(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&r7(n.ownerDocument.documentElement,n)){if(r!==null&&h4(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=vP(n,o);var a=vP(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jc=null,SC=null,rp=null,xC=!1;function bP(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xC||Jc==null||Jc!==bv(r)||(r=Jc,"selectionStart"in r&&h4(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rp&&Op(rp,r)||(rp=r,r=Av(SC,"onSelect"),0nd||(e.current=PC[nd],PC[nd]=null,nd--)}function It(e,t){nd++,PC[nd]=e.current,e.current=t}var Cl={},br=jl(Cl),Yr=jl(!1),Xu=Cl;function ef(e,t){var n=e.type.contextTypes;if(!n)return Cl;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Zr(e){return e=e.childContextTypes,e!=null}function Pv(){Bt(Yr),Bt(br)}function AP(e,t,n){if(br.current!==Cl)throw Error(re(168));It(br,t),It(Yr,n)}function h7(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(re(108,Iq(e)||"Unknown",i));return Jt({},n,r)}function kv(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cl,Xu=br.current,It(br,e),It(Yr,Yr.current),!0}function TP(e,t,n){var r=e.stateNode;if(!r)throw Error(re(169));n?(e=h7(e,t,Xu),r.__reactInternalMemoizedMergedChildContext=e,Bt(Yr),Bt(br),It(br,e)):Bt(Yr),It(Yr,n)}var Va=null,Ab=!1,fx=!1;function p7(e){Va===null?Va=[e]:Va.push(e)}function WW(e){Ab=!0,p7(e)}function Vl(){if(!fx&&Va!==null){fx=!0;var e=0,t=gt;try{var n=Va;for(gt=1;e>=a,i-=a,Qa=1<<32-Eo(t)+i|n<C?(T=w,w=null):T=w.sibling;var A=f(v,w,g[C],b);if(A===null){w===null&&(w=T);break}e&&w&&A.alternate===null&&t(v,w),y=o(A,y,C),x===null?S=A:x.sibling=A,x=A,w=T}if(C===g.length)return n(v,w),Ht&&hu(v,C),S;if(w===null){for(;CC?(T=w,w=null):T=w.sibling;var I=f(v,w,A.value,b);if(I===null){w===null&&(w=T);break}e&&w&&I.alternate===null&&t(v,w),y=o(I,y,C),x===null?S=I:x.sibling=I,x=I,w=T}if(A.done)return n(v,w),Ht&&hu(v,C),S;if(w===null){for(;!A.done;C++,A=g.next())A=d(v,A.value,b),A!==null&&(y=o(A,y,C),x===null?S=A:x.sibling=A,x=A);return Ht&&hu(v,C),S}for(w=r(v,w);!A.done;C++,A=g.next())A=h(w,v,C,A.value,b),A!==null&&(e&&A.alternate!==null&&w.delete(A.key===null?C:A.key),y=o(A,y,C),x===null?S=A:x.sibling=A,x=A);return e&&w.forEach(function(D){return t(v,D)}),Ht&&hu(v,C),S}function _(v,y,g,b){if(typeof g=="object"&&g!==null&&g.type===Yc&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case e0:e:{for(var S=g.key,x=y;x!==null;){if(x.key===S){if(S=g.type,S===Yc){if(x.tag===7){n(v,x.sibling),y=i(x,g.props.children),y.return=v,v=y;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Gs&&$P(S)===x.type){n(v,x.sibling),y=i(x,g.props),y.ref=ih(v,x,g),y.return=v,v=y;break e}n(v,x);break}else t(v,x);x=x.sibling}g.type===Yc?(y=Fu(g.props.children,v.mode,b,g.key),y.return=v,v=y):(b=Dy(g.type,g.key,g.props,null,v.mode,b),b.ref=ih(v,y,g),b.return=v,v=b)}return a(v);case Qc:e:{for(x=g.key;y!==null;){if(y.key===x)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(v,y.sibling),y=i(y,g.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=_x(g,v.mode,b),y.return=v,v=y}return a(v);case Gs:return x=g._init,_(v,y,x(g._payload),b)}if($h(g))return p(v,y,g,b);if(Jf(g))return m(v,y,g,b);d0(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(n(v,y.sibling),y=i(y,g),y.return=v,v=y):(n(v,y),y=bx(g,v.mode,b),y.return=v,v=y),a(v)):n(v,y)}return _}var nf=x7(!0),w7=x7(!1),om={},da=jl(om),Lp=jl(om),Fp=jl(om);function Pu(e){if(e===om)throw Error(re(174));return e}function x4(e,t){switch(It(Fp,t),It(Lp,e),It(da,om),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:dC(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=dC(t,e)}Bt(da),It(da,t)}function rf(){Bt(da),Bt(Lp),Bt(Fp)}function C7(e){Pu(Fp.current);var t=Pu(da.current),n=dC(t,e.type);t!==n&&(It(Lp,e),It(da,n))}function w4(e){Lp.current===e&&(Bt(da),Bt(Lp))}var Qt=jl(0);function Nv(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var hx=[];function C4(){for(var e=0;en?n:4,e(!0);var r=px.transition;px.transition={};try{e(!1),t()}finally{gt=n,px.transition=r}}function z7(){return Xi().memoizedState}function YW(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},j7(e))V7(t,n);else if(n=v7(e,t,n,r),n!==null){var i=Or();Ao(n,e,r,i),U7(n,t,r)}}function ZW(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(j7(e))V7(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,Ro(s,a)){var l=t.interleaved;l===null?(i.next=i,_4(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=v7(e,t,i,r),n!==null&&(i=Or(),Ao(n,e,r,i),U7(n,t,r))}}function j7(e){var t=e.alternate;return e===Zt||t!==null&&t===Zt}function V7(e,t){ip=Dv=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function U7(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,a4(e,n)}}var Lv={readContext:Ki,useCallback:cr,useContext:cr,useEffect:cr,useImperativeHandle:cr,useInsertionEffect:cr,useLayoutEffect:cr,useMemo:cr,useReducer:cr,useRef:cr,useState:cr,useDebugValue:cr,useDeferredValue:cr,useTransition:cr,useMutableSource:cr,useSyncExternalStore:cr,useId:cr,unstable_isNewReconciler:!1},JW={readContext:Ki,useCallback:function(e,t){return Wo().memoizedState=[e,t===void 0?null:t],e},useContext:Ki,useEffect:DP,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ry(4194308,4,N7.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ry(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ry(4,2,e,t)},useMemo:function(e,t){var n=Wo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wo();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=YW.bind(null,Zt,e),[r.memoizedState,e]},useRef:function(e){var t=Wo();return e={current:e},t.memoizedState=e},useState:NP,useDebugValue:k4,useDeferredValue:function(e){return Wo().memoizedState=e},useTransition:function(){var e=NP(!1),t=e[0];return e=QW.bind(null,e[1]),Wo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Zt,i=Wo();if(Ht){if(n===void 0)throw Error(re(407));n=n()}else{if(n=t(),Un===null)throw Error(re(349));Yu&30||T7(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,DP(k7.bind(null,r,o,e),[e]),r.flags|=2048,jp(9,P7.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Wo(),t=Un.identifierPrefix;if(Ht){var n=Ya,r=Qa;n=(r&~(1<<32-Eo(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Bp++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[na]=t,e[Dp]=r,Z7(e,t,!1,!1),t.stateNode=e;e:{switch(a=hC(n,r),n){case"dialog":$t("cancel",e),$t("close",e),i=r;break;case"iframe":case"object":case"embed":$t("load",e),i=r;break;case"video":case"audio":for(i=0;iaf&&(t.flags|=128,r=!0,oh(o,!1),t.lanes=4194304)}else{if(!r)if(e=Nv(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Ht)return dr(t),null}else 2*gn()-o.renderingStartTime>af&&n!==1073741824&&(t.flags|=128,r=!0,oh(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=gn(),t.sibling=null,n=Qt.current,It(Qt,r?n&1|2:n&1),t):(dr(t),null);case 22:case 23:return N4(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?fi&1073741824&&(dr(t),t.subtreeFlags&6&&(t.flags|=8192)):dr(t),null;case 24:return null;case 25:return null}throw Error(re(156,t.tag))}function sK(e,t){switch(g4(t),t.tag){case 1:return Zr(t.type)&&Pv(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rf(),Bt(Yr),Bt(br),C4(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return w4(t),null;case 13:if(Bt(Qt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(re(340));tf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bt(Qt),null;case 4:return rf(),null;case 10:return b4(t.type._context),null;case 22:case 23:return N4(),null;case 24:return null;default:return null}}var h0=!1,yr=!1,lK=typeof WeakSet=="function"?WeakSet:Set,_e=null;function ad(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){an(e,t,r)}else n.current=null}function zC(e,t,n){try{n()}catch(r){an(e,t,r)}}var HP=!1;function uK(e,t){if(wC=Cv,e=i7(),h4(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(CC={focusedElem:e,selectionRange:n},Cv=!1,_e=t;_e!==null;)if(t=_e,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_e=e;else for(;_e!==null;){t=_e;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?m:go(t.type,m),_);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(b){an(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,_e=e;break}_e=t.return}return p=HP,HP=!1,p}function op(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&zC(t,n,o)}i=i.next}while(i!==r)}}function kb(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function jC(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function t$(e){var t=e.alternate;t!==null&&(e.alternate=null,t$(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[na],delete t[Dp],delete t[TC],delete t[HW],delete t[qW])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function n$(e){return e.tag===5||e.tag===3||e.tag===4}function qP(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||n$(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function VC(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Tv));else if(r!==4&&(e=e.child,e!==null))for(VC(e,t,n),e=e.sibling;e!==null;)VC(e,t,n),e=e.sibling}function UC(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(UC(e,t,n),e=e.sibling;e!==null;)UC(e,t,n),e=e.sibling}var er=null,yo=!1;function Os(e,t,n){for(n=n.child;n!==null;)r$(e,t,n),n=n.sibling}function r$(e,t,n){if(ca&&typeof ca.onCommitFiberUnmount=="function")try{ca.onCommitFiberUnmount(Sb,n)}catch{}switch(n.tag){case 5:yr||ad(n,t);case 6:var r=er,i=yo;er=null,Os(e,t,n),er=r,yo=i,er!==null&&(yo?(e=er,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):er.removeChild(n.stateNode));break;case 18:er!==null&&(yo?(e=er,n=n.stateNode,e.nodeType===8?dx(e.parentNode,n):e.nodeType===1&&dx(e,n),Mp(e)):dx(er,n.stateNode));break;case 4:r=er,i=yo,er=n.stateNode.containerInfo,yo=!0,Os(e,t,n),er=r,yo=i;break;case 0:case 11:case 14:case 15:if(!yr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&zC(n,t,a),i=i.next}while(i!==r)}Os(e,t,n);break;case 1:if(!yr&&(ad(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){an(n,t,s)}Os(e,t,n);break;case 21:Os(e,t,n);break;case 22:n.mode&1?(yr=(r=yr)||n.memoizedState!==null,Os(e,t,n),yr=r):Os(e,t,n);break;default:Os(e,t,n)}}function WP(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lK),t.forEach(function(r){var i=vK.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function fo(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=gn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*dK(r/1960))-r,10e?16:e,ol===null)var r=!1;else{if(e=ol,ol=null,zv=0,it&6)throw Error(re(331));var i=it;for(it|=4,_e=e.current;_e!==null;){var o=_e,a=o.child;if(_e.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lgn()-O4?Lu(e,0):R4|=n),Jr(e,t)}function d$(e,t){t===0&&(e.mode&1?(t=i0,i0<<=1,!(i0&130023424)&&(i0=4194304)):t=1);var n=Or();e=ds(e,t),e!==null&&(nm(e,t,n),Jr(e,n))}function yK(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),d$(e,n)}function vK(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(re(314))}r!==null&&r.delete(t),d$(e,n)}var f$;f$=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yr.current)Kr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Kr=!1,oK(e,t,n);Kr=!!(e.flags&131072)}else Kr=!1,Ht&&t.flags&1048576&&g7(t,Mv,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Oy(e,t),e=t.pendingProps;var i=ef(t,br.current);Cd(t,n),i=A4(null,t,r,e,i,n);var o=T4();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Zr(r)?(o=!0,kv(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,S4(t),i.updater=Tb,t.stateNode=i,i._reactInternals=t,OC(t,r,e,n),t=DC(null,t,r,!0,o,n)):(t.tag=0,Ht&&o&&p4(t),Ir(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Oy(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=_K(r),e=go(r,e),i){case 0:t=NC(null,t,r,e,n);break e;case 1:t=VP(null,t,r,e,n);break e;case 11:t=zP(null,t,r,e,n);break e;case 14:t=jP(null,t,r,go(r.type,e),n);break e}throw Error(re(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),NC(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),VP(e,t,r,i,n);case 3:e:{if(X7(t),e===null)throw Error(re(387));r=t.pendingProps,o=t.memoizedState,i=o.element,b7(e,t),$v(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=of(Error(re(423)),t),t=UP(e,t,r,n,i);break e}else if(r!==i){i=of(Error(re(424)),t),t=UP(e,t,r,n,i);break e}else for(yi=dl(t.stateNode.containerInfo.firstChild),vi=t,Ht=!0,bo=null,n=w7(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tf(),r===i){t=fs(e,t,n);break e}Ir(e,t,r,n)}t=t.child}return t;case 5:return C7(t),e===null&&IC(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,EC(r,i)?a=null:o!==null&&EC(r,o)&&(t.flags|=32),K7(e,t),Ir(e,t,a,n),t.child;case 6:return e===null&&IC(t),null;case 13:return Q7(e,t,n);case 4:return x4(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=nf(t,null,r,n):Ir(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),zP(e,t,r,i,n);case 7:return Ir(e,t,t.pendingProps,n),t.child;case 8:return Ir(e,t,t.pendingProps.children,n),t.child;case 12:return Ir(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,It(Rv,r._currentValue),r._currentValue=a,o!==null)if(Ro(o.value,a)){if(o.children===i.children&&!Yr.current){t=fs(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=ns(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),MC(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(re(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),MC(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Ir(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Cd(t,n),i=Ki(i),r=r(i),t.flags|=1,Ir(e,t,r,n),t.child;case 14:return r=t.type,i=go(r,t.pendingProps),i=go(r.type,i),jP(e,t,r,i,n);case 15:return q7(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),Oy(e,t),t.tag=1,Zr(r)?(e=!0,kv(t)):e=!1,Cd(t,n),S7(t,r,i),OC(t,r,i,n),DC(null,t,r,!0,e,n);case 19:return Y7(e,t,n);case 22:return W7(e,t,n)}throw Error(re(156,t.tag))};function h$(e,t){return BO(e,t)}function bK(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hi(e,t,n,r){return new bK(e,t,n,r)}function L4(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _K(e){if(typeof e=="function")return L4(e)?1:0;if(e!=null){if(e=e.$$typeof,e===n4)return 11;if(e===r4)return 14}return 2}function gl(e,t){var n=e.alternate;return n===null?(n=Hi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Dy(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")L4(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Yc:return Fu(n.children,i,o,t);case t4:a=8,i|=8;break;case rC:return e=Hi(12,n,t,i|2),e.elementType=rC,e.lanes=o,e;case iC:return e=Hi(13,n,t,i),e.elementType=iC,e.lanes=o,e;case oC:return e=Hi(19,n,t,i),e.elementType=oC,e.lanes=o,e;case xO:return Mb(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _O:a=10;break e;case SO:a=9;break e;case n4:a=11;break e;case r4:a=14;break e;case Gs:a=16,r=null;break e}throw Error(re(130,e==null?e:typeof e,""))}return t=Hi(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Fu(e,t,n,r){return e=Hi(7,e,r,t),e.lanes=n,e}function Mb(e,t,n,r){return e=Hi(22,e,r,t),e.elementType=xO,e.lanes=n,e.stateNode={isHidden:!1},e}function bx(e,t,n){return e=Hi(6,e,null,t),e.lanes=n,e}function _x(e,t,n){return t=Hi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function SK(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ex(0),this.expirationTimes=ex(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ex(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function F4(e,t,n,r,i,o,a,s,l){return e=new SK(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Hi(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},S4(o),e}function xK(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y$)}catch(e){console.error(e)}}y$(),gO.exports=Ei;var pi=gO.exports;const lLe=Bl(pi);var tk=pi;tC.createRoot=tk.createRoot,tC.hydrateRoot=tk.hydrateRoot;const TK="modulepreload",PK=function(e,t){return new URL(e,t).href},nk={},v$=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=PK(o,r),o in nk)return;nk[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":TK,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function jn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Db(e)?2:Lb(e)?3:0}function ml(e,t){return El(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ly(e,t){return El(e)===2?e.get(t):e[t]}function b$(e,t,n){var r=El(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function _$(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Db(e){return $K&&e instanceof Map}function Lb(e){return NK&&e instanceof Set}function Dn(e){return e.o||e.t}function U4(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=x$(e);delete t[De];for(var n=Td(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=kK),Object.freeze(e),t&&hs(e,function(n,r){return am(r,!0)},!0)),e}function kK(){jn(2)}function G4(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function fa(e){var t=XC[e];return t||jn(18,e),t}function H4(e,t){XC[e]||(XC[e]=t)}function Up(){return Hp}function Sx(e,t){t&&(fa("Patches"),e.u=[],e.s=[],e.v=t)}function Uv(e){KC(e),e.p.forEach(IK),e.p=null}function KC(e){e===Hp&&(Hp=e.l)}function rk(e){return Hp={p:[],l:Hp,h:e,m:!0,_:0}}function IK(e){var t=e[De];t.i===0||t.i===1?t.j():t.g=!0}function xx(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||fa("ES5").S(t,e,r),r?(n[De].P&&(Uv(t),jn(4)),ei(e)&&(e=Gv(t,e),t.l||Hv(t,e)),t.u&&fa("Patches").M(n[De].t,e,t.u,t.s)):e=Gv(t,n,[]),Uv(t),t.u&&t.v(t.u,t.s),e!==Bb?e:void 0}function Gv(e,t,n){if(G4(t))return t;var r=t[De];if(!r)return hs(t,function(s,l){return ik(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Hv(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=U4(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),hs(o,function(s,l){return ik(e,r,i,s,l,n,a)}),Hv(e,i,!1),n&&e.u&&fa("Patches").N(r,n,e.u,e.s)}return r.o}function ik(e,t,n,r,i,o,a){if(Nr(i)){var s=Gv(e,i,o&&t&&t.i!==3&&!ml(t.R,r)?o.concat(r):void 0);if(b$(n,r,s),!Nr(s))return;e.m=!1}else a&&n.add(i);if(ei(i)&&!G4(i)){if(!e.h.D&&e._<1)return;Gv(e,i),t&&t.A.l||Hv(e,i)}}function Hv(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&am(t,n)}function wx(e,t){var n=e[De];return(n?Dn(n):e)[t]}function ok(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function qr(e){e.P||(e.P=!0,e.l&&qr(e.l))}function Cx(e){e.o||(e.o=U4(e.t))}function Gp(e,t,n){var r=Db(t)?fa("MapSet").F(t,n):Lb(t)?fa("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Up(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=qp;a&&(l=[s],u=Lh);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):fa("ES5").J(t,n);return(n?n.A:Up()).p.push(r),r}function Fb(e){return Nr(e)||jn(22,e),function t(n){if(!ei(n))return n;var r,i=n[De],o=El(n);if(i){if(!i.P&&(i.i<4||!fa("ES5").K(i)))return i.t;i.I=!0,r=ak(n,o),i.I=!1}else r=ak(n,o);return hs(r,function(a,s){i&&Ly(i.t,a)===s||b$(r,a,t(s))}),o===3?new Set(r):r}(e)}function ak(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return U4(e)}function q4(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[De];return qp.get(l,o)},set:function(l){var u=this[De];qp.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][De];if(!s.P)switch(s.i){case 5:r(s)&&qr(s);break;case 4:n(s)&&qr(s)}}}function n(o){for(var a=o.t,s=o.k,l=Td(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==De){var d=a[c];if(d===void 0&&!ml(a,c))return!0;var f=s[c],h=f&&f[De];if(h?h.t!==d:!_$(f,d))return!0}}var p=!!a[De];return l.length!==Td(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?v-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=fa("Patches").$;return Nr(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),xi=new w$,C$=xi.produce,X4=xi.produceWithPatches.bind(xi),LK=xi.setAutoFreeze.bind(xi),FK=xi.setUseProxies.bind(xi),QC=xi.applyPatches.bind(xi),BK=xi.createDraft.bind(xi),zK=xi.finishDraft.bind(xi);const Ul=C$,uLe=Object.freeze(Object.defineProperty({__proto__:null,Immer:w$,applyPatches:QC,castDraft:RK,castImmutable:OK,createDraft:BK,current:Fb,default:Ul,enableAllPlugins:MK,enableES5:q4,enableMapSet:S$,enablePatches:W4,finishDraft:zK,freeze:am,immerable:Ad,isDraft:Nr,isDraftable:ei,nothing:Bb,original:V4,produce:C$,produceWithPatches:X4,setAutoFreeze:LK,setUseProxies:FK},Symbol.toStringTag,{value:"Module"}));function Wp(e){"@babel/helpers - typeof";return Wp=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},Wp(e)}function jK(e,t){if(Wp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Wp(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function VK(e){var t=jK(e,"string");return Wp(t)==="symbol"?t:String(t)}function UK(e,t,n){return t=VK(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uk(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 ck(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(tr(1));return n(sm)(e,t)}if(typeof e!="function")throw new Error(tr(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(tr(3));return o}function d(m){if(typeof m!="function")throw new Error(tr(4));if(l)throw new Error(tr(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(tr(6));_=!1,u();var y=s.indexOf(m);s.splice(y,1),a=null}}}function f(m){if(!GK(m))throw new Error(tr(7));if(typeof m.type>"u")throw new Error(tr(8));if(l)throw new Error(tr(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,v=0;v<_.length;v++){var y=_[v];y()}return m}function h(m){if(typeof m!="function")throw new Error(tr(10));i=m,f({type:sf.REPLACE})}function p(){var m,_=d;return m={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(tr(11));function g(){y.next&&y.next(c())}g();var b=_(g);return{unsubscribe:b}}},m[dk]=function(){return this},m}return f({type:sf.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[dk]=p,r}var E$=sm;function HK(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:sf.INIT});if(typeof r>"u")throw new Error(tr(12));if(typeof n(void 0,{type:sf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(tr(13))})}function Mf(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(tr(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function fk(e,t){return function(){return t(e.apply(this,arguments))}}function A$(e,t){if(typeof e=="function")return fk(e,t);if(typeof e!="object"||e===null)throw new Error(tr(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=fk(i,t))}return n}function lf(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return qv}function i(s,l){r(s)===qv&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var T$=function(t,n){return t===n};function XK(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,v){var y=t?t+"."+_:_;if(l){var g=i.some(function(b){return b instanceof RegExp?b.test(y):y===b});if(g)return"continue"}if(!n(v))return{value:{keyPath:y,value:v}};if(typeof v=="object"&&(a=N$(v,y,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function dX(e){return""+e}function z$(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function fX(e){return typeof e=="function"}function j$(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?z$(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(fX(e))l=function(){return YC(e())};else{var u=YC(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=Al([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(Nr(p)){var _=p,v=m(_,f);return v===void 0?p:v}else{if(ei(p))return Ul(p,function(y){return m(y,f)});var v=m(p,f);if(v===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return v}return p},d)}return c.getInitialState=l,c}function hX(e,t){return e+"/"+t}function qt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:YC(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=hX(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?ge(f,p):ge(f)});function l(){var c=typeof e.extraReducers=="function"?z$(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,v=Xr(Xr({},f),a);return j$(n,function(y){for(var g in v)y.addCase(g,v[g]);for(var b=0,S=p;b0;if(y){var g=p.filter(function(b){return u(_,b,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=V$(p,e,m),v=_[0],y=_[1];d(y,m),n(v,m)}return{removeAll:yX(l),addOne:hn(t),addMany:hn(n),setOne:hn(r),setMany:hn(i),setAll:hn(o),updateOne:hn(c),updateMany:hn(d),upsertOne:hn(f),upsertMany:hn(h),removeOne:hn(a),removeMany:hn(s)}}function vX(e,t){var n=U$(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(y,g){return s([y],g)}function s(y,g){y=Bu(y);var b=y.filter(function(S){return!(lp(S,e)in g.entities)});b.length!==0&&_(b,g)}function l(y,g){return u([y],g)}function u(y,g){y=Bu(y),y.length!==0&&_(y,g)}function c(y,g){y=Bu(y),g.entities={},g.ids=[],s(y,g)}function d(y,g){return f([y],g)}function f(y,g){for(var b=!1,S=0,x=y;S-1;return n&&r}function cm(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Vb(){for(var e=[],t=0;t0)for(var g=h.getState(),b=Array.from(n.values()),S=0,x=b;SMath.floor(e/t)*t,Mr=(e,t)=>Math.round(e/t)*t;var DX=typeof global=="object"&&global&&global.Object===Object&&global;const sN=DX;var LX=typeof self=="object"&&self&&self.Object===Object&&self,FX=sN||LX||Function("return this")();const Ea=FX;var BX=Ea.Symbol;const Qi=BX;var lN=Object.prototype,zX=lN.hasOwnProperty,jX=lN.toString,sh=Qi?Qi.toStringTag:void 0;function VX(e){var t=zX.call(e,sh),n=e[sh];try{e[sh]=void 0;var r=!0}catch{}var i=jX.call(e);return r&&(t?e[sh]=n:delete e[sh]),i}var UX=Object.prototype,GX=UX.toString;function HX(e){return GX.call(e)}var qX="[object Null]",WX="[object Undefined]",_k=Qi?Qi.toStringTag:void 0;function Fo(e){return e==null?e===void 0?WX:qX:_k&&_k in Object(e)?VX(e):HX(e)}function ti(e){return e!=null&&typeof e=="object"}var KX="[object Symbol]";function Ub(e){return typeof e=="symbol"||ti(e)&&Fo(e)==KX}function uN(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=TQ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function MQ(e){return function(){return e}}var RQ=function(){try{var e=fc(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Zv=RQ;var OQ=Zv?function(e,t){return Zv(e,"toString",{configurable:!0,enumerable:!1,value:MQ(t),writable:!0})}:Gb;const $Q=OQ;var NQ=IQ($Q);const hN=NQ;function pN(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var jQ=9007199254740991,VQ=/^(?:0|[1-9]\d*)$/;function tE(e,t){var n=typeof e;return t=t??jQ,!!t&&(n=="number"||n!="symbol"&&VQ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=HQ}function Of(e){return e!=null&&nE(e.length)&&!eE(e)}function qb(e,t,n){if(!ni(n))return!1;var r=typeof t;return(r=="number"?Of(n)&&tE(t,n.length):r=="string"&&t in n)?pm(n[t],e):!1}function vN(e){return yN(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&qb(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function aZ(e,t){var n=this.__data__,r=Kb(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function xs(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?EN(s,t-1,n,r,i):lE(i,s):r||(i[i.length]=s)}return i}function wZ(e){var t=e==null?0:e.length;return t?EN(e,1):[]}function CZ(e){return hN(mN(e,void 0,wZ),e+"")}var EZ=wN(Object.getPrototypeOf,Object);const uE=EZ;var AZ="[object Object]",TZ=Function.prototype,PZ=Object.prototype,AN=TZ.toString,kZ=PZ.hasOwnProperty,IZ=AN.call(Object);function TN(e){if(!ti(e)||Fo(e)!=AZ)return!1;var t=uE(e);if(t===null)return!0;var n=kZ.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&AN.call(n)==IZ}function PN(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:PN(e,t,n)}var MZ="\\ud800-\\udfff",RZ="\\u0300-\\u036f",OZ="\\ufe20-\\ufe2f",$Z="\\u20d0-\\u20ff",NZ=RZ+OZ+$Z,DZ="\\ufe0e\\ufe0f",LZ="\\u200d",FZ=RegExp("["+LZ+MZ+NZ+DZ+"]");function Yb(e){return FZ.test(e)}function BZ(e){return e.split("")}var IN="\\ud800-\\udfff",zZ="\\u0300-\\u036f",jZ="\\ufe20-\\ufe2f",VZ="\\u20d0-\\u20ff",UZ=zZ+jZ+VZ,GZ="\\ufe0e\\ufe0f",HZ="["+IN+"]",t5="["+UZ+"]",n5="\\ud83c[\\udffb-\\udfff]",qZ="(?:"+t5+"|"+n5+")",MN="[^"+IN+"]",RN="(?:\\ud83c[\\udde6-\\uddff]){2}",ON="[\\ud800-\\udbff][\\udc00-\\udfff]",WZ="\\u200d",$N=qZ+"?",NN="["+GZ+"]?",KZ="(?:"+WZ+"(?:"+[MN,RN,ON].join("|")+")"+NN+$N+")*",XZ=NN+$N+KZ,QZ="(?:"+[MN+t5+"?",t5,RN,ON,HZ].join("|")+")",YZ=RegExp(n5+"(?="+n5+")|"+QZ+XZ,"g");function ZZ(e){return e.match(YZ)||[]}function DN(e){return Yb(e)?ZZ(e):BZ(e)}function JZ(e){return function(t){t=cf(t);var n=Yb(t)?DN(t):void 0,r=n?n[0]:t.charAt(0),i=n?kN(n,1).join(""):t.slice(1);return r[e]()+i}}var eJ=JZ("toUpperCase");const LN=eJ;function FN(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function al(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=By(n),n=n===n?n:0),t!==void 0&&(t=By(t),t=t===t?t:0),GJ(By(e),t,n)}function HJ(){this.__data__=new xs,this.size=0}function qJ(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function WJ(e){return this.__data__.get(e)}function KJ(e){return this.__data__.has(e)}var XJ=200;function QJ(e,t){var n=this.__data__;if(n instanceof xs){var r=n.__data__;if(!Yp||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&Mte?new Zp:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),Rf(e,rD(e),n),r&&(n=cp(n,Wne|Kne|Xne,qne));for(var i=t.length;i--;)Hne(n,t[i]);return n});const $f=Qne;var Yne=gD("length");const Zne=Yne;var bD="\\ud800-\\udfff",Jne="\\u0300-\\u036f",ere="\\ufe20-\\ufe2f",tre="\\u20d0-\\u20ff",nre=Jne+ere+tre,rre="\\ufe0e\\ufe0f",ire="["+bD+"]",l5="["+nre+"]",u5="\\ud83c[\\udffb-\\udfff]",ore="(?:"+l5+"|"+u5+")",_D="[^"+bD+"]",SD="(?:\\ud83c[\\udde6-\\uddff]){2}",xD="[\\ud800-\\udbff][\\udc00-\\udfff]",are="\\u200d",wD=ore+"?",CD="["+rre+"]?",sre="(?:"+are+"(?:"+[_D,SD,xD].join("|")+")"+CD+wD+")*",lre=CD+wD+sre,ure="(?:"+[_D+l5+"?",l5,SD,xD,ire].join("|")+")",t6=RegExp(u5+"(?="+u5+")|"+ure+lre,"g");function cre(e){for(var t=t6.lastIndex=0;t6.test(e);)++t;return t}function ED(e){return Yb(e)?cre(e):Zne(e)}var dre=Math.floor,fre=Math.random;function hre(e,t){return e+dre(fre()*(t-e+1))}var pre=parseFloat,gre=Math.min,mre=Math.random;function yre(e,t,n){if(n&&typeof n!="boolean"&&qb(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=Md(e),t===void 0?(t=e,e=0):t=Md(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=mre();return gre(e+i*(t-e+pre("1e-"+((i+"").length-1))),t)}return hre(e,t)}var vre=Math.ceil,bre=Math.max;function _re(e,t,n,r){for(var i=-1,o=bre(vre((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function Sre(e){return function(t,n,r){return r&&typeof r!="number"&&qb(t,n,r)&&(n=r=void 0),t=Md(t),n===void 0?(n=t,t=0):n=Md(n),r=r===void 0?t=o)return e;var s=n-ED(r);if(s<1)return r;var l=a?kN(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Vne(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,cf(Mre.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Yv(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Rre=1/0,Ore=Rd&&1/fE(new Rd([,-0]))[1]==Rre?function(e){return new Rd(e)}:AQ;const $re=Ore;var Nre=200;function AD(e,t,n){var r=-1,i=zQ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=Ane;else if(o>=Nre){var u=t?null:$re(e);if(u)return fE(u);a=!1,i=cD,l=new Zp}else l=t?[]:s;e:for(;++r{Od(e,t.payload)}}}),{configChanged:Lre}=PD.actions,Fre=PD.reducer,kD=ge("socket/socketConnected"),yE=ge("socket/appSocketConnected"),ID=ge("socket/socketDisconnected"),MD=ge("socket/appSocketDisconnected"),Bre=ge("socket/socketSubscribedSession"),zre=ge("socket/appSocketSubscribedSession"),jre=ge("socket/socketUnsubscribedSession"),Vre=ge("socket/appSocketUnsubscribedSession"),RD=ge("socket/socketInvocationStarted"),vE=ge("socket/appSocketInvocationStarted"),bE=ge("socket/socketInvocationComplete"),_E=ge("socket/appSocketInvocationComplete"),OD=ge("socket/socketInvocationError"),r_=ge("socket/appSocketInvocationError"),$D=ge("socket/socketGraphExecutionStateComplete"),ND=ge("socket/appSocketGraphExecutionStateComplete"),DD=ge("socket/socketGeneratorProgress"),SE=ge("socket/appSocketGeneratorProgress"),LD=ge("socket/socketModelLoadStarted"),FD=ge("socket/appSocketModelLoadStarted"),BD=ge("socket/socketModelLoadCompleted"),zD=ge("socket/appSocketModelLoadCompleted"),jD=ge("socket/socketSessionRetrievalError"),VD=ge("socket/appSocketSessionRetrievalError"),UD=ge("socket/socketInvocationRetrievalError"),GD=ge("socket/appSocketInvocationRetrievalError"),HD=ge("socket/socketQueueItemStatusChanged"),i_=ge("socket/appSocketQueueItemStatusChanged");let b0;const Ure=new Uint8Array(16);function Gre(){if(!b0&&(b0=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!b0))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return b0(Ure)}const Jn=[];for(let e=0;e<256;++e)Jn.push((e+256).toString(16).slice(1));function Hre(e,t=0){return(Jn[e[t+0]]+Jn[e[t+1]]+Jn[e[t+2]]+Jn[e[t+3]]+"-"+Jn[e[t+4]]+Jn[e[t+5]]+"-"+Jn[e[t+6]]+Jn[e[t+7]]+"-"+Jn[e[t+8]]+Jn[e[t+9]]+"-"+Jn[e[t+10]]+Jn[e[t+11]]+Jn[e[t+12]]+Jn[e[t+13]]+Jn[e[t+14]]+Jn[e[t+15]]).toLowerCase()}const qre=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),r6={randomUUID:qre};function yl(e,t,n){if(r6.randomUUID&&!t&&!e)return r6.randomUUID();e=e||{};const r=e.random||(e.rng||Gre)();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 Hre(r)}const Wre={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class e1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||Wre,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function lh(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function i6(e){return e==null?"":""+e}function Kre(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function xE(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const 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 o6(e,t,n){const{obj:r,k:i}=xE(e,t,Object);r[i]=n}function Xre(e,t,n,r){const{obj:i,k:o}=xE(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function t1(e,t){const{obj:n,k:r}=xE(e,t);if(n)return n[r]}function Qre(e,t,n){const r=t1(e,n);return r!==void 0?r:t1(t,n)}function qD(e,t,n){for(const 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]):qD(e[r],t[r],n):e[r]=t[r]);return e}function Ic(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Yre={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Zre(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>Yre[t]):e}const Jre=[" ",",","?","!",";"];function eie(e,t,n){t=t||"",n=n||"";const r=Jre.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function n1(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let 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]}const u=r.slice(o+a).join(n);return u?n1(l,u,n):void 0}i=i[r[o]]}return i}function r1(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class a6 extends o_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=t1(this.data,s);return l||!a||typeof r!="string"?l:n1(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),o6(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=t1(this.data,s)||{};i?qD(l,r,o):l={...l,...r},o6(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var WD={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const s6={};class i1 extends o_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Kre(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=aa.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!eie(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${b}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],v=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof v=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d):b}if(o){const b=m==="[object Array]",S=b?[]:{},x=b?p:h;for(const w in f)if(Object.prototype.hasOwnProperty.call(f,w)){const C=`${x}${o}${w}`;S[w]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[w]===C&&(S[w]=f[w])}f=S}}else if(y&&typeof v=="string"&&m==="[object Array]")f=f.join(v),f&&(f=this.extendTranslation(f,t,n,r));else{let b=!1,S=!1;const x=n.count!==void 0&&typeof n.count!="string",w=i1.hasDefaultValue(n),C=x?this.pluralResolver.getSuffix(u,n.count,n):"",T=n.ordinal&&x?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",A=n[`defaultValue${C}`]||n[`defaultValue${T}`]||n.defaultValue;!this.isValidLookup(f)&&w&&(b=!0,f=A),this.isValidLookup(f)||(S=!0,f=a);const D=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,M=w&&A!==f&&this.options.updateMissing;if(S||b||M){if(this.logger.log(M?"updateKey":"missingKey",u,l,a,M?A:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.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.")}let E=[];const P=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&P&&P[0])for(let L=0;L{const $=w&&R!==f?R:D;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,O,$,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,O,$,M,n),this.emit("missingKey",L,l,O,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?E.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(O=>{N([L],a+O,n[`defaultValue${O}`]||A)})}):N(E,a,A))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!s6[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(s6[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" 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!!!")),m.forEach(v=>{if(this.isValidLookup(r))return;a=v;const y=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,c,v,_,n);else{let b;f&&(b=this.pluralResolver.getSuffix(v,n.count,n));const S=`${this.options.pluralSeparator}zero`,x=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(c+b),n.ordinal&&b.indexOf(x)===0&&y.push(c+b.replace(x,this.options.pluralSeparator)),h&&y.push(c+S)),p){const w=`${c}${this.options.contextSeparator}${n.context}`;y.push(w),f&&(y.push(w+b),n.ordinal&&b.indexOf(x)===0&&y.push(w+b.replace(x,this.options.pluralSeparator)),h&&y.push(w+S))}}let g;for(;g=y.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(v,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function Mx(e){return e.charAt(0).toUpperCase()+e.slice(1)}class l6{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=aa.create("languageUtils")}getScriptPartFromCode(t){if(t=r1(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=r1(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Mx(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Mx(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Mx(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let tie=[{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}],nie={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const rie=["v1","v2","v3"],iie=["v4"],u6={zero:0,one:1,two:2,few:3,many:4,other:5};function oie(){const e={};return tie.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:nie[t.fc]}})}),e}class aie{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=aa.create("pluralResolver"),(!this.options.compatibilityJSON||iie.includes(this.options.compatibilityJSON))&&(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=oie()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(r1(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>u6[i]-u6[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!rie.includes(this.options.compatibilityJSON)}}function c6(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=Qre(e,t,n);return!o&&i&&typeof n=="string"&&(o=n1(e,n,r),o===void 0&&(o=n1(t,n,r))),o}class sie{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=aa.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:Zre,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Ic(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Ic(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Ic(n.nestingPrefix):n.nestingPrefixEscaped||Ic("$t("),this.nestingSuffix=n.nestingSuffix?Ic(n.nestingSuffix):n.nestingSuffixEscaped||Ic(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const y=c6(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:p}):y}const m=p.split(this.formatSeparator),_=m.shift().trim(),v=m.join(this.formatSeparator).trim();return this.format(c6(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const v=d(t,o,i);a=typeof v=="string"?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=i6(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=i6(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function lie(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function Mc(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(r1(i),o),t[a]=s),s(r)}}class uie{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=aa.create("formatter"),this.options=t,this.formats={number:Mc((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:Mc((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:Mc((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:Mc((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:Mc((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Mc(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=lie(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function cie(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class die extends o_{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=aa.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{Xre(l.loaded,[o],a),cie(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=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."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function d6(){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:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function f6(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 _0(){}function fie(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class eg extends o_{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=f6(t),this.services={},this.logger=aa,this.modules={external:[]},fie(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=d6();this.options={...i,...this.options,...f6(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?aa.init(o(this.modules.logger),this.options):aa.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=uie);const d=new l6(this.options);this.store=new a6(this.options.resources,this.options);const f=this.services;f.logger=aa,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new aie(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new sie(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new die(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=_0),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=lh(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_0;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=lh();return t||(t=this.languages),n||(n=this.options.ns),r||(r=_0),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&WD.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=lh();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&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;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=lh();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=lh();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["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"],r=this.services&&this.services.languageUtils||new l6(d6());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new eg(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_0;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new eg(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new a6(this.store.data,i),o.services.resourceStore=o.store),o.translator=new i1(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c{switch(t){case"controlnet":return Od(Ye(hie),{id:e,...n});case"t2i_adapter":return Od(Ye(pie),{id:e,...n});case"ip_adapter":return Od(Ye(gie),{id:e,...n});default:throw new Error(`Unknown control adapter type: ${t}`)}},wE=ge("controlAdapters/imageProcessed"),a_=e=>e.type==="controlnet",KD=e=>e.type==="ip_adapter",CE=e=>e.type==="t2i_adapter",hi=e=>a_(e)||CE(e),fn=Yi(),{selectById:ui,selectAll:Aa,selectEntities:fLe,selectIds:hLe,selectTotal:pLe}=fn.getSelectors(),d5=fn.getInitialState({pendingControlImages:[]}),mie=e=>Aa(e).filter(a_),yie=e=>Aa(e).filter(a_).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),vie=e=>Aa(e).filter(KD),bie=e=>Aa(e).filter(KD).filter(t=>t.isEnabled&&t.model&&!!t.controlImage),_ie=e=>Aa(e).filter(CE),Sie=e=>Aa(e).filter(CE).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),XD=qt({name:"controlAdapters",initialState:d5,reducers:{controlAdapterAdded:{reducer:(e,t)=>{const{id:n,type:r,overrides:i}=t.payload;fn.addOne(e,h6(n,r,i))},prepare:({type:e,overrides:t})=>({payload:{id:yl(),type:e,overrides:t}})},controlAdapterRecalled:(e,t)=>{fn.addOne(e,t.payload)},controlAdapterDuplicated:{reducer:(e,t)=>{const{id:n,newId:r}=t.payload,i=ui(e,n);if(!i)return;const o=Od(Ye(i),{id:r,isEnabled:!0});fn.addOne(e,o)},prepare:e=>({payload:{id:e,newId:yl()}})},controlAdapterAddedFromImage:{reducer:(e,t)=>{const{id:n,type:r,controlImage:i}=t.payload;fn.addOne(e,h6(n,r,{controlImage:i}))},prepare:e=>({payload:{...e,id:yl()}})},controlAdapterRemoved:(e,t)=>{fn.removeOne(e,t.payload.id)},controlAdapterIsEnabledChanged:(e,t)=>{const{id:n,isEnabled:r}=t.payload;fn.updateOne(e,{id:n,changes:{isEnabled:r}})},controlAdapterImageChanged:(e,t)=>{const{id:n,controlImage:r}=t.payload,i=ui(e,n);i&&(fn.updateOne(e,{id:n,changes:{controlImage:r,processedControlImage:null}}),r!==null&&hi(i)&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlAdapterProcessedImageChanged:(e,t)=>{const{id:n,processedControlImage:r}=t.payload,i=ui(e,n);i&&hi(i)&&(fn.updateOne(e,{id:n,changes:{processedControlImage:r}}),e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlAdapterModelCleared:(e,t)=>{fn.updateOne(e,{id:t.payload.id,changes:{model:null}})},controlAdapterModelChanged:(e,t)=>{const{id:n,model:r}=t.payload,i=ui(e,n);if(!i)return;if(!hi(i)){fn.updateOne(e,{id:n,changes:{model:r}});return}const o={id:n,changes:{model:r}};if(o.changes.processedControlImage=null,i.shouldAutoConfig){let a;for(const s in S0)if(r.model_name.includes(s)){a=S0[s];break}a?(o.changes.processorType=a,o.changes.processorNode=Su[a].default):(o.changes.processorType="none",o.changes.processorNode=Su.none.default)}fn.updateOne(e,o)},controlAdapterWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload;fn.updateOne(e,{id:n,changes:{weight:r}})},controlAdapterBeginStepPctChanged:(e,t)=>{const{id:n,beginStepPct:r}=t.payload;fn.updateOne(e,{id:n,changes:{beginStepPct:r}})},controlAdapterEndStepPctChanged:(e,t)=>{const{id:n,endStepPct:r}=t.payload;fn.updateOne(e,{id:n,changes:{endStepPct:r}})},controlAdapterControlModeChanged:(e,t)=>{const{id:n,controlMode:r}=t.payload,i=ui(e,n);!i||!a_(i)||fn.updateOne(e,{id:n,changes:{controlMode:r}})},controlAdapterResizeModeChanged:(e,t)=>{const{id:n,resizeMode:r}=t.payload,i=ui(e,n);!i||!hi(i)||fn.updateOne(e,{id:n,changes:{resizeMode:r}})},controlAdapterProcessorParamsChanged:(e,t)=>{const{id:n,params:r}=t.payload,i=ui(e,n);if(!i||!hi(i)||!i.processorNode)return;const o=Od(Ye(i.processorNode),r);fn.updateOne(e,{id:n,changes:{shouldAutoConfig:!1,processorNode:o}})},controlAdapterProcessortTypeChanged:(e,t)=>{const{id:n,processorType:r}=t.payload,i=ui(e,n);if(!i||!hi(i))return;const o=Ye(Su[r].default);fn.updateOne(e,{id:n,changes:{processorType:r,processedControlImage:null,processorNode:o,shouldAutoConfig:!1}})},controlAdapterAutoConfigToggled:(e,t)=>{var o;const{id:n}=t.payload,r=ui(e,n);if(!r||!hi(r))return;const i={id:n,changes:{shouldAutoConfig:!r.shouldAutoConfig}};if(i.changes.shouldAutoConfig){let a;for(const s in S0)if((o=r.model)!=null&&o.model_name.includes(s)){a=S0[s];break}a?(i.changes.processorType=a,i.changes.processorNode=Su[a].default):(i.changes.processorType="none",i.changes.processorNode=Su.none.default)}fn.updateOne(e,i)},controlAdaptersReset:()=>Ye(d5),pendingControlImagesCleared:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(wE,(t,n)=>{const r=ui(t,n.payload.id);r&&r.controlImage!==null&&(t.pendingControlImages=Dre(t.pendingControlImages.concat(n.payload.id)))}),e.addCase(r_,t=>{t.pendingControlImages=[]})}}),{controlAdapterAdded:xie,controlAdapterRecalled:wie,controlAdapterDuplicated:gLe,controlAdapterAddedFromImage:Cie,controlAdapterRemoved:mLe,controlAdapterImageChanged:Hl,controlAdapterProcessedImageChanged:EE,controlAdapterIsEnabledChanged:AE,controlAdapterModelChanged:p6,controlAdapterWeightChanged:yLe,controlAdapterBeginStepPctChanged:vLe,controlAdapterEndStepPctChanged:bLe,controlAdapterControlModeChanged:_Le,controlAdapterResizeModeChanged:SLe,controlAdapterProcessorParamsChanged:Eie,controlAdapterProcessortTypeChanged:Aie,controlAdaptersReset:Tie,controlAdapterAutoConfigToggled:g6,pendingControlImagesCleared:Pie,controlAdapterModelCleared:Rx}=XD.actions,kie=XD.reducer,Iie=ai(xie,Cie,wie),xLe={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},wLe={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Mie={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},CLe={lycoris:"LyCORIS",diffusers:"Diffusers"},Rie=0,dp=4294967295;var at;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(at||(at={}));var f5;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(f5||(f5={}));const he=at.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return he.undefined;case"string":return he.string;case"number":return isNaN(e)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(e)?he.array:e===null?he.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?he.promise:typeof Map<"u"&&e instanceof Map?he.map:typeof Set<"u"&&e instanceof Set?he.set:typeof Date<"u"&&e instanceof Date?he.date:he.object;default:return he.unknown}},ie=at.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Oie=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Po extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Po.create=e=>new Po(e);const tg=(e,t)=>{let n;switch(e.code){case ie.invalid_type:e.received===he.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,at.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${at.joinValues(e.keys,", ")}`;break;case ie.invalid_union:n="Invalid input";break;case ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${at.joinValues(e.options)}`;break;case ie.invalid_enum_value:n=`Invalid enum value. Expected ${at.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:n="Invalid function arguments";break;case ie.invalid_return_type:n="Invalid function return type";break;case ie.invalid_date:n="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:at.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ie.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ie.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ie.custom:n="Invalid input";break;case ie.invalid_intersection_types:n="Intersection results could not be merged";break;case ie.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:n="Number must be finite";break;default:n=t.defaultError,at.assertNever(e)}return{message:n}};let QD=tg;function $ie(e){QD=e}function o1(){return QD}const a1=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},Nie=[];function ye(e,t){const n=a1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,o1(),tg].filter(r=>!!r)});e.common.issues.push(n)}class _r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ne;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return _r.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return Ne;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const Ne=Object.freeze({status:"aborted"}),YD=e=>({status:"dirty",value:e}),Dr=e=>({status:"valid",value:e}),h5=e=>e.status==="aborted",p5=e=>e.status==="dirty",ng=e=>e.status==="valid",s1=e=>typeof Promise<"u"&&e instanceof Promise;var ke;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ke||(ke={}));class _a{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const m6=(e,t)=>{if(ng(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Po(e.common.issues);return this._error=n,this._error}}};function Le(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Fe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new _r,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(s1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:i.path,parent:i});return m6(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(s1(i)?i:Promise.resolve(i));return m6(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:ie.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new $o({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return rs.create(this,this._def)}nullable(){return rc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ko.create(this,this._def)}promise(){return hf.create(this,this._def)}or(t){return ag.create([this,t],this._def)}and(t){return sg.create(this,t,this._def)}transform(t){return new $o({...Le(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new fg({...Le(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new JD({typeName:Me.ZodBranded,type:this,...Le(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new d1({...Le(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return vm.create(this,t)}readonly(){return h1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Die=/^c[^\s-]{8,}$/i,Lie=/^[a-z][a-z0-9]*$/,Fie=/[0-9A-HJKMNP-TV-Z]{26}/,Bie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zie=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jie=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Vie=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Uie=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Gie=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Hie(e,t){return!!((t==="v4"||!t)&&Vie.test(e)||(t==="v6"||!t)&&Uie.test(e))}class Co extends Fe{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:ie.invalid_string,...ke.errToObj(r)}),this.nonempty=t=>this.min(1,ke.errToObj(t)),this.trim=()=>new Co({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Co({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Co({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==he.string){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.string,received:o.parsedType}),Ne}const r=new _r;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),ye(i,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...ke.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ke.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ke.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ke.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ke.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ke.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ke.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ke.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Co({checks:[],typeName:Me.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Le(e)})};function qie(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class Pl extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==he.number){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.number,received:o.parsedType}),Ne}let r;const i=new _r;for(const o of this._def.checks)o.kind==="int"?at.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?qie(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.not_finite,message:o.message}),i.dirty()):at.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ke.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ke.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ke.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ke.toString(n))}setLimit(t,n,r,i){return new Pl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(t){return new Pl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ke.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ke.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ke.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&at.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Pl({checks:[],typeName:Me.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class kl extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==he.bigint){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.bigint,received:o.parsedType}),Ne}let r;const i=new _r;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):at.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ke.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ke.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ke.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ke.toString(n))}setLimit(t,n,r,i){return new kl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(t){return new kl({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ke.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new kl({checks:[],typeName:Me.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Le(e)})};class rg extends Fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==he.boolean){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.boolean,received:r.parsedType}),Ne}return Dr(t.data)}}rg.create=e=>new rg({typeName:Me.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class tc extends Fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==he.date){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.date,received:o.parsedType}),Ne}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_date}),Ne}const r=new _r;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),ye(i,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):at.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new tc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ke.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ke.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew tc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Me.ZodDate,...Le(e)});class l1 extends Fe{_parse(t){if(this._getType(t)!==he.symbol){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.symbol,received:r.parsedType}),Ne}return Dr(t.data)}}l1.create=e=>new l1({typeName:Me.ZodSymbol,...Le(e)});class ig extends Fe{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.undefined,received:r.parsedType}),Ne}return Dr(t.data)}}ig.create=e=>new ig({typeName:Me.ZodUndefined,...Le(e)});class og extends Fe{_parse(t){if(this._getType(t)!==he.null){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.null,received:r.parsedType}),Ne}return Dr(t.data)}}og.create=e=>new og({typeName:Me.ZodNull,...Le(e)});class ff extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return Dr(t.data)}}ff.create=e=>new ff({typeName:Me.ZodAny,...Le(e)});class zu extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Dr(t.data)}}zu.create=e=>new zu({typeName:Me.ZodUnknown,...Le(e)});class gs extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return ye(n,{code:ie.invalid_type,expected:he.never,received:n.parsedType}),Ne}}gs.create=e=>new gs({typeName:Me.ZodNever,...Le(e)});class u1 extends Fe{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.void,received:r.parsedType}),Ne}return Dr(t.data)}}u1.create=e=>new u1({typeName:Me.ZodVoid,...Le(e)});class ko extends Fe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==he.array)return ye(n,{code:ie.invalid_type,expected:he.array,received:n.parsedType}),Ne;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(ye(n,{code:ie.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new _a(n,a,n.path,s)))).then(a=>_r.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new _a(n,a,n.path,s)));return _r.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new ko({...this._def,minLength:{value:t,message:ke.toString(n)}})}max(t,n){return new ko({...this._def,maxLength:{value:t,message:ke.toString(n)}})}length(t,n){return new ko({...this._def,exactLength:{value:t,message:ke.toString(n)}})}nonempty(t){return this.min(1,t)}}ko.create=(e,t)=>new ko({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...Le(t)});function Hc(e){if(e instanceof Xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=rs.create(Hc(r))}return new Xt({...e._def,shape:()=>t})}else return e instanceof ko?new ko({...e._def,type:Hc(e.element)}):e instanceof rs?rs.create(Hc(e.unwrap())):e instanceof rc?rc.create(Hc(e.unwrap())):e instanceof Sa?Sa.create(e.items.map(t=>Hc(t))):e}class Xt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=at.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==he.object){const u=this._getOrReturnCtx(t);return ye(u,{code:ie.invalid_type,expected:he.object,received:u.parsedType}),Ne}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof gs&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new _a(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof gs){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(ye(i,{code:ie.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new _a(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>_r.mergeObjectSync(r,u)):_r.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ke.errToObj,new Xt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ke.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Xt({...this._def,unknownKeys:"strip"})}passthrough(){return new Xt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Xt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Xt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Me.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Xt({...this._def,catchall:t})}pick(t){const n={};return at.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Xt({...this._def,shape:()=>n})}omit(t){const n={};return at.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Xt({...this._def,shape:()=>n})}deepPartial(){return Hc(this)}partial(t){const n={};return at.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new Xt({...this._def,shape:()=>n})}required(t){const n={};return at.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof rs;)o=o._def.innerType;n[r]=o}}),new Xt({...this._def,shape:()=>n})}keyof(){return ZD(at.objectKeys(this.shape))}}Xt.create=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strip",catchall:gs.create(),typeName:Me.ZodObject,...Le(t)});Xt.strictCreate=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strict",catchall:gs.create(),typeName:Me.ZodObject,...Le(t)});Xt.lazycreate=(e,t)=>new Xt({shape:e,unknownKeys:"strip",catchall:gs.create(),typeName:Me.ZodObject,...Le(t)});class ag extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new Po(s.ctx.common.issues));return ye(n,{code:ie.invalid_union,unionErrors:a}),Ne}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new Po(l));return ye(n,{code:ie.invalid_union,unionErrors:s}),Ne}}get options(){return this._def.options}}ag.create=(e,t)=>new ag({options:e,typeName:Me.ZodUnion,...Le(t)});const jy=e=>e instanceof ug?jy(e.schema):e instanceof $o?jy(e.innerType()):e instanceof cg?[e.value]:e instanceof Il?e.options:e instanceof dg?Object.keys(e.enum):e instanceof fg?jy(e._def.innerType):e instanceof ig?[void 0]:e instanceof og?[null]:null;class s_ extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.object)return ye(n,{code:ie.invalid_type,expected:he.object,received:n.parsedType}),Ne;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ye(n,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=jy(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new s_({typeName:Me.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Le(r)})}}function g5(e,t){const n=Zs(e),r=Zs(t);if(e===t)return{valid:!0,data:e};if(n===he.object&&r===he.object){const i=at.objectKeys(t),o=at.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=g5(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===he.array&&r===he.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(h5(o)||h5(a))return Ne;const s=g5(o.value,a.value);return s.valid?((p5(o)||p5(a))&&n.dirty(),{status:n.value,value:s.data}):(ye(r,{code:ie.invalid_intersection_types}),Ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}sg.create=(e,t,n)=>new sg({left:e,right:t,typeName:Me.ZodIntersection,...Le(n)});class Sa extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.array)return ye(r,{code:ie.invalid_type,expected:he.array,received:r.parsedType}),Ne;if(r.data.lengththis._def.items.length&&(ye(r,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new _a(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>_r.mergeArray(n,a)):_r.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Sa({...this._def,rest:t})}}Sa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Sa({items:e,typeName:Me.ZodTuple,rest:null,...Le(t)})};class lg extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.object)return ye(r,{code:ie.invalid_type,expected:he.object,received:r.parsedType}),Ne;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new _a(r,s,r.path,s)),value:a._parse(new _a(r,r.data[s],r.path,s))});return r.common.async?_r.mergeObjectAsync(n,i):_r.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Fe?new lg({keyType:t,valueType:n,typeName:Me.ZodRecord,...Le(r)}):new lg({keyType:Co.create(),valueType:t,typeName:Me.ZodRecord,...Le(n)})}}class c1 extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.map)return ye(r,{code:ie.invalid_type,expected:he.map,received:r.parsedType}),Ne;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new _a(r,s,r.path,[u,"key"])),value:o._parse(new _a(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return Ne;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return Ne;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}c1.create=(e,t,n)=>new c1({valueType:t,keyType:e,typeName:Me.ZodMap,...Le(n)});class nc extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.set)return ye(r,{code:ie.invalid_type,expected:he.set,received:r.parsedType}),Ne;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ye(r,{code:ie.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return Ne;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new _a(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new nc({...this._def,minSize:{value:t,message:ke.toString(n)}})}max(t,n){return new nc({...this._def,maxSize:{value:t,message:ke.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}nc.create=(e,t)=>new nc({valueType:e,minSize:null,maxSize:null,typeName:Me.ZodSet,...Le(t)});class $d extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.function)return ye(n,{code:ie.invalid_type,expected:he.function,received:n.parsedType}),Ne;function r(s,l){return a1({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,o1(),tg].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:l}})}function i(s,l){return a1({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,o1(),tg].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof hf){const s=this;return Dr(async function(...l){const u=new Po([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return Dr(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new Po([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new Po([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new $d({...this._def,args:Sa.create(t).rest(zu.create())})}returns(t){return new $d({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new $d({args:t||Sa.create([]).rest(zu.create()),returns:n||zu.create(),typeName:Me.ZodFunction,...Le(r)})}}class ug extends Fe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ug.create=(e,t)=>new ug({getter:e,typeName:Me.ZodLazy,...Le(t)});class cg extends Fe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ye(n,{received:n.data,code:ie.invalid_literal,expected:this._def.value}),Ne}return{status:"valid",value:t.data}}get value(){return this._def.value}}cg.create=(e,t)=>new cg({value:e,typeName:Me.ZodLiteral,...Le(t)});function ZD(e,t){return new Il({values:e,typeName:Me.ZodEnum,...Le(t)})}class Il extends Fe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ye(n,{expected:at.joinValues(r),received:n.parsedType,code:ie.invalid_type}),Ne}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return ye(n,{received:n.data,code:ie.invalid_enum_value,options:r}),Ne}return Dr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Il.create(t)}exclude(t){return Il.create(this.options.filter(n=>!t.includes(n)))}}Il.create=ZD;class dg extends Fe{_parse(t){const n=at.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==he.string&&r.parsedType!==he.number){const i=at.objectValues(n);return ye(r,{expected:at.joinValues(i),received:r.parsedType,code:ie.invalid_type}),Ne}if(n.indexOf(t.data)===-1){const i=at.objectValues(n);return ye(r,{received:r.data,code:ie.invalid_enum_value,options:i}),Ne}return Dr(t.data)}get enum(){return this._def.values}}dg.create=(e,t)=>new dg({values:e,typeName:Me.ZodNativeEnum,...Le(t)});class hf extends Fe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.promise&&n.common.async===!1)return ye(n,{code:ie.invalid_type,expected:he.promise,received:n.parsedType}),Ne;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return Dr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}hf.create=(e,t)=>new hf({type:e,typeName:Me.ZodPromise,...Le(t)});class $o extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{ye(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ne:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Ne:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ng(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ng(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);at.assertNever(i)}}$o.create=(e,t,n)=>new $o({schema:e,typeName:Me.ZodEffects,effect:t,...Le(n)});$o.createWithPreprocess=(e,t,n)=>new $o({schema:t,effect:{type:"preprocess",transform:e},typeName:Me.ZodEffects,...Le(n)});class rs extends Fe{_parse(t){return this._getType(t)===he.undefined?Dr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:Me.ZodOptional,...Le(t)});class rc extends Fe{_parse(t){return this._getType(t)===he.null?Dr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}rc.create=(e,t)=>new rc({innerType:e,typeName:Me.ZodNullable,...Le(t)});class fg extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}fg.create=(e,t)=>new fg({innerType:e,typeName:Me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Le(t)});class d1 extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return s1(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Po(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Po(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}d1.create=(e,t)=>new d1({innerType:e,typeName:Me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Le(t)});class f1 extends Fe{_parse(t){if(this._getType(t)!==he.nan){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.nan,received:r.parsedType}),Ne}return{status:"valid",value:t.data}}}f1.create=e=>new f1({typeName:Me.ZodNaN,...Le(e)});const Wie=Symbol("zod_brand");class JD extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class vm extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ne:o.status==="dirty"?(n.dirty(),YD(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ne:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new vm({in:t,out:n,typeName:Me.ZodPipeline})}}class h1 extends Fe{_parse(t){const n=this._def.innerType._parse(t);return ng(n)&&(n.value=Object.freeze(n.value)),n}}h1.create=(e,t)=>new h1({innerType:e,typeName:Me.ZodReadonly,...Le(t)});const eL=(e,t={},n)=>e?ff.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):ff.create(),Kie={object:Xt.lazycreate};var Me;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Me||(Me={}));const Xie=(e,t={message:`Input not instance of ${e.name}`})=>eL(n=>n instanceof e,t),tL=Co.create,nL=Pl.create,Qie=f1.create,Yie=kl.create,rL=rg.create,Zie=tc.create,Jie=l1.create,eoe=ig.create,toe=og.create,noe=ff.create,roe=zu.create,ioe=gs.create,ooe=u1.create,aoe=ko.create,soe=Xt.create,loe=Xt.strictCreate,uoe=ag.create,coe=s_.create,doe=sg.create,foe=Sa.create,hoe=lg.create,poe=c1.create,goe=nc.create,moe=$d.create,yoe=ug.create,voe=cg.create,boe=Il.create,_oe=dg.create,Soe=hf.create,y6=$o.create,xoe=rs.create,woe=rc.create,Coe=$o.createWithPreprocess,Eoe=vm.create,Aoe=()=>tL().optional(),Toe=()=>nL().optional(),Poe=()=>rL().optional(),koe={string:e=>Co.create({...e,coerce:!0}),number:e=>Pl.create({...e,coerce:!0}),boolean:e=>rg.create({...e,coerce:!0}),bigint:e=>kl.create({...e,coerce:!0}),date:e=>tc.create({...e,coerce:!0})},Ioe=Ne;var F=Object.freeze({__proto__:null,defaultErrorMap:tg,setErrorMap:$ie,getErrorMap:o1,makeIssue:a1,EMPTY_PATH:Nie,addIssueToContext:ye,ParseStatus:_r,INVALID:Ne,DIRTY:YD,OK:Dr,isAborted:h5,isDirty:p5,isValid:ng,isAsync:s1,get util(){return at},get objectUtil(){return f5},ZodParsedType:he,getParsedType:Zs,ZodType:Fe,ZodString:Co,ZodNumber:Pl,ZodBigInt:kl,ZodBoolean:rg,ZodDate:tc,ZodSymbol:l1,ZodUndefined:ig,ZodNull:og,ZodAny:ff,ZodUnknown:zu,ZodNever:gs,ZodVoid:u1,ZodArray:ko,ZodObject:Xt,ZodUnion:ag,ZodDiscriminatedUnion:s_,ZodIntersection:sg,ZodTuple:Sa,ZodRecord:lg,ZodMap:c1,ZodSet:nc,ZodFunction:$d,ZodLazy:ug,ZodLiteral:cg,ZodEnum:Il,ZodNativeEnum:dg,ZodPromise:hf,ZodEffects:$o,ZodTransformer:$o,ZodOptional:rs,ZodNullable:rc,ZodDefault:fg,ZodCatch:d1,ZodNaN:f1,BRAND:Wie,ZodBranded:JD,ZodPipeline:vm,ZodReadonly:h1,custom:eL,Schema:Fe,ZodSchema:Fe,late:Kie,get ZodFirstPartyTypeKind(){return Me},coerce:koe,any:noe,array:aoe,bigint:Yie,boolean:rL,date:Zie,discriminatedUnion:coe,effect:y6,enum:boe,function:moe,instanceof:Xie,intersection:doe,lazy:yoe,literal:voe,map:poe,nan:Qie,nativeEnum:_oe,never:ioe,null:toe,nullable:woe,number:nL,object:soe,oboolean:Poe,onumber:Toe,optional:xoe,ostring:Aoe,pipeline:Eoe,preprocess:Coe,promise:Soe,record:hoe,set:goe,strictObject:loe,string:tL,symbol:Jie,transformer:y6,tuple:foe,undefined:eoe,union:uoe,unknown:roe,void:ooe,NEVER:Ioe,ZodIssueCode:ie,quotelessJson:Oie,ZodError:Po});const Moe=F.string(),ELe=e=>Moe.safeParse(e).success,Roe=F.string(),ALe=e=>Roe.safeParse(e).success,Ooe=F.string(),TLe=e=>Ooe.safeParse(e).success,$oe=F.string(),PLe=e=>$oe.safeParse(e).success,Noe=F.number().int().min(1),kLe=e=>Noe.safeParse(e).success,Doe=F.number().min(1),ILe=e=>Doe.safeParse(e).success,iL=F.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a","lcm"]),MLe=e=>iL.safeParse(e).success,RLe={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral",lcm:"LCM"},Loe=F.number().int().min(0).max(dp),OLe=e=>Loe.safeParse(e).success,oL=F.number().multipleOf(8).min(64),$Le=e=>oL.safeParse(e).success,aL=F.number().multipleOf(8).min(64),NLe=e=>aL.safeParse(e).success;F.tuple([oL,aL]);const ql=F.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),l_=F.object({model_name:F.string().min(1),base_model:ql,model_type:F.literal("main")}),DLe=e=>l_.safeParse(e).success,TE=F.object({model_name:F.string().min(1),base_model:F.literal("sdxl-refiner"),model_type:F.literal("main")}),LLe=e=>TE.safeParse(e).success,sL=F.object({model_name:F.string().min(1),base_model:ql,model_type:F.literal("onnx")}),bm=F.union([l_,sL]),lL=F.object({model_name:F.string().min(1),base_model:ql}),FLe=e=>lL.safeParse(e).success,Foe=F.object({model_name:F.string().min(1),base_model:ql}),BLe=e=>Foe.safeParse(e).success,Boe=F.object({model_name:F.string().min(1),base_model:ql}),zLe=e=>Boe.safeParse(e).success,zoe=F.object({model_name:F.string().min(1),base_model:ql}),joe=F.object({model_name:F.string().min(1),base_model:ql}),jLe=e=>joe.safeParse(e).success,VLe=e=>zoe.safeParse(e).success,Voe=F.number().min(0).max(1),ULe=e=>Voe.safeParse(e).success;F.enum(["fp16","fp32"]);const Uoe=F.enum(["ESRGAN","bilinear"]),GLe=e=>Uoe.safeParse(e).success,Goe=F.number().min(1).max(10),HLe=e=>Goe.safeParse(e).success,Hoe=F.number().min(1).max(10),qLe=e=>Hoe.safeParse(e).success,qoe=F.number().min(0).max(1),WLe=e=>qoe.safeParse(e).success;F.enum(["box","gaussian"]);F.enum(["unmasked","mask","edge"]);const Woe=F.boolean(),KLe=e=>Woe.safeParse(e).success&&e!==null&&e!==void 0,PE={hrfStrength:.45,hrfEnabled:!1,hrfMethod:"ESRGAN",cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},Koe=PE,uL=qt({name:"generation",initialState:Koe,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=al(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=al(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},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},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},resetParametersState:e=>({...e,...PE}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Mie[e.model.base_model];e.clipSkip=al(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},setHrfStrength:(e,t)=>{e.hrfStrength=t.payload},setHrfEnabled:(e,t)=>{e.hrfEnabled=t.payload},setHrfMethod:(e,t)=>{e.hrfMethod=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=Mr(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Lre,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=l_.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}}),e.addMatcher(Iie,(t,n)=>{n.payload.type==="t2i_adapter"&&(t.width=Mr(t.width,64),t.height=Mr(t.height,64))})}}),{clampSymmetrySteps:XLe,clearInitialImage:kE,resetParametersState:QLe,resetSeed:YLe,setCfgScale:ZLe,setWidth:v6,setHeight:b6,toggleSize:JLe,setImg2imgStrength:eFe,setInfillMethod:Xoe,setIterations:tFe,setPerlin:nFe,setPositivePrompt:Qoe,setNegativePrompt:rFe,setScheduler:iFe,setMaskBlur:oFe,setMaskBlurMethod:aFe,setCanvasCoherenceMode:sFe,setCanvasCoherenceSteps:lFe,setCanvasCoherenceStrength:uFe,setSeed:cFe,setSeedWeights:dFe,setShouldFitToWidthHeight:fFe,setShouldGenerateVariations:hFe,setShouldRandomizeSeed:pFe,setSteps:gFe,setThreshold:mFe,setInfillTileSize:yFe,setInfillPatchmatchDownscaleSize:vFe,setVariationAmount:bFe,setShouldUseSymmetry:_Fe,setHorizontalSymmetrySteps:SFe,setVerticalSymmetrySteps:xFe,initialImageChanged:u_,modelChanged:sl,vaeSelected:cL,setSeamlessXAxis:wFe,setSeamlessYAxis:CFe,setClipSkip:EFe,setHrfEnabled:AFe,setHrfStrength:TFe,setHrfMethod:PFe,shouldUseCpuNoiseChanged:kFe,setAspectRatio:Yoe,setShouldLockAspectRatio:IFe,vaePrecisionChanged:MFe}=uL.actions,Zoe=uL.reducer,x0=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},w0=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},RFe=.999,OFe=.1,$Fe=20,C0=.95,NFe=30,DFe=10,Joe=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),Rc=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=Mr(s/o,64)):o<1&&(r.height=s,r.width=Mr(s*o,64)),a=r.width*r.height;return r},eae=e=>({width:Mr(e.width,64),height:Mr(e.height,64)}),LFe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],FFe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],dL=e=>e.kind==="line"&&e.layer==="mask",BFe=e=>e.kind==="line"&&e.layer==="base",tae=e=>e.kind==="image"&&e.layer==="base",zFe=e=>e.kind==="fillRect"&&e.layer==="base",jFe=e=>e.kind==="eraseRect"&&e.layer==="base",nae=e=>e.kind==="line";let Er=[],Ta=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Er.length;for(let a=0;a(e.events=e.events||{},e.events[n+A0]||(e.events[n+A0]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+A0](),delete e.events[n+A0])}),oae=1e3,aae=(e,t)=>iae(e,r=>{let i=t(r);i&&e.events[E0].push(i)},rae,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[E0]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[E0])a();e.events[E0]=[]}},oae)},()=>{e.listen=i,e.off=o}}),sae=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=Ta(void 0,Math.max(...e.map(o=>o.l))+1);return aae(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const fL="default",Nn=Ta(fL),lae={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},uae=lae,hL=qt({name:"queue",initialState:uae,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:VFe,listPriorityChanged:UFe,listParamsReset:cae,queueItemSelectionToggled:GFe,resumeProcessorOnEnqueueChanged:HFe}=hL.actions,dae=hL.reducer,pL="%[a-f0-9]{2}",_6=new RegExp("("+pL+")|([^%]+?)","gi"),S6=new RegExp("("+pL+")+","gi");function m5(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],m5(n),m5(r))}function fae(e){try{return decodeURIComponent(e)}catch{let t=e.match(_6)||[];for(let n=1;ne==null,yae=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),y5=Symbol("encodeFragmentIdentifier");function vae(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[_n(t,e),"[",i,"]"].join("")]:[...n,[_n(t,e),"[",_n(i,e),"]=",_n(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[_n(t,e),"[]"].join("")]:[...n,[_n(t,e),"[]=",_n(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[_n(t,e),":list="].join("")]:[...n,[_n(t,e),":list=",_n(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[_n(n,e),t,_n(i,e)].join("")]:[[r,_n(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,_n(t,e)]:[...n,[_n(t,e),"=",_n(r,e)].join("")]}}function bae(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&Ua(r,e).includes(e.arrayFormatSeparator);r=a?Ua(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>Ua(l,e)):r===null?r:Ua(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Ua(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>Ua(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function mL(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function _n(e,t){return t.encode?t.strict?yae(e):encodeURIComponent(e):e}function Ua(e,t){return t.decode?pae(e):e}function yL(e){return Array.isArray(e)?e.sort():typeof e=="object"?yL(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function vL(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function _ae(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function x6(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function IE(e){e=vL(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function ME(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},mL(t.arrayFormatSeparator);const n=bae(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=gL(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:Ua(s,t),n(Ua(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=x6(s,t);else r[i]=x6(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=yL(a):i[o]=a,i},Object.create(null))}function bL(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},mL(t.arrayFormatSeparator);const n=a=>t.skipNull&&mae(e[a])||t.skipEmptyString&&e[a]==="",r=vae(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?_n(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?_n(a,t)+"[]":s.reduce(r(a),[]).join("&"):_n(a,t)+"="+_n(s,t)}).filter(a=>a.length>0).join("&")}function _L(e,t){var i;t={decode:!0,...t};let[n,r]=gL(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:ME(IE(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Ua(r,t)}:{}}}function SL(e,t){t={encode:!0,strict:!0,[y5]:!0,...t};const n=vL(e.url).split("?")[0]||"",r=IE(e.url),i={...ME(r,{sort:!1}),...e.query};let o=bL(i,t);o&&(o=`?${o}`);let a=_ae(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[y5]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function xL(e,t,n){n={parseFragmentIdentifier:!0,[y5]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=_L(e,n);return SL({url:r,query:gae(i,t),fragmentIdentifier:o},n)}function Sae(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return xL(e,r,n)}const fp=Object.freeze(Object.defineProperty({__proto__:null,exclude:Sae,extract:IE,parse:ME,parseUrl:_L,pick:xL,stringify:bL,stringifyUrl:SL},Symbol.toStringTag,{value:"Module"}));var p1=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function Mae(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var A6=Oo;function EL(e,t){if(e===t||!(A6(e)&&A6(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},Oae=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function P6(e){if(!Oo(e))return e;for(var t=pn({},e),n=0,r=Object.entries(t);n"u"&&s===T6&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,b){return y1(t,null,function(){var S,x,w,C,T,A,I,D,M,E,P,N,L,O,R,$,z,V,H,Q,Z,J,j,X,ee,ne,fe,de,Be,$e,Ce,Ke,be,zt,Wn,nn;return p1(this,function(Rt){switch(Rt.label){case 0:return S=b.signal,x=b.getState,w=b.extra,C=b.endpoint,T=b.forced,A=b.type,D=typeof g=="string"?{url:g}:g,M=D.url,E=D.headers,P=E===void 0?new Headers(v.headers):E,N=D.params,L=N===void 0?void 0:N,O=D.responseHandler,R=O===void 0?m??"json":O,$=D.validateStatus,z=$===void 0?_??Rae:$,V=D.timeout,H=V===void 0?p:V,Q=C6(D,["url","headers","params","responseHandler","validateStatus","timeout"]),Z=pn(sa(pn({},v),{signal:S}),Q),P=new Headers(P6(P)),J=Z,[4,o(P,{getState:x,extra:w,endpoint:C,forced:T,type:A})];case 1:J.headers=Rt.sent()||P,j=function(St){return typeof St=="object"&&(Oo(St)||Array.isArray(St)||typeof St.toJSON=="function")},!Z.headers.has("content-type")&&j(Z.body)&&Z.headers.set("content-type",f),j(Z.body)&&c(Z.headers)&&(Z.body=JSON.stringify(Z.body,h)),L&&(X=~M.indexOf("?")?"&":"?",ee=l?l(L):new URLSearchParams(P6(L)),M+=X+ee),M=kae(r,M),ne=new Request(M,Z),fe=ne.clone(),I={request:fe},Be=!1,$e=H&&setTimeout(function(){Be=!0,b.abort()},H),Rt.label=2;case 2:return Rt.trys.push([2,4,5,6]),[4,s(ne)];case 3:return de=Rt.sent(),[3,6];case 4:return Ce=Rt.sent(),[2,{error:{status:Be?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Ce)},meta:I}];case 5:return $e&&clearTimeout($e),[7];case 6:Ke=de.clone(),I.response=Ke,zt="",Rt.label=7;case 7:return Rt.trys.push([7,9,,10]),[4,Promise.all([y(de,R).then(function(St){return be=St},function(St){return Wn=St}),Ke.text().then(function(St){return zt=St},function(){})])];case 8:if(Rt.sent(),Wn)throw Wn;return[3,10];case 9:return nn=Rt.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:de.status,data:zt,error:String(nn)},meta:I}];case 10:return[2,z(de,be)?{data:be,meta:I}:{error:{status:de.status,data:be},meta:I}]}})})};function y(g,b){return y1(this,null,function(){var S;return p1(this,function(x){switch(x.label){case 0:return typeof b=="function"?[2,b(g)]:(b==="content-type"&&(b=c(g.headers)?"json":"text"),b!=="json"?[3,2]:[4,g.text()]);case 1:return S=x.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var k6=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),RE=ge("__rtkq/focused"),AL=ge("__rtkq/unfocused"),OE=ge("__rtkq/online"),TL=ge("__rtkq/offline"),xa;(function(e){e.query="query",e.mutation="mutation"})(xa||(xa={}));function PL(e){return e.type===xa.query}function Nae(e){return e.type===xa.mutation}function kL(e,t,n,r,i,o){return Dae(e)?e(t,n,r,i).map(v5).map(o):Array.isArray(e)?e.map(v5).map(o):[]}function Dae(e){return typeof e=="function"}function v5(e){return typeof e=="string"?{type:e}:e}function Ox(e){return e!=null}var hg=Symbol("forceQueryFn"),b5=function(e){return typeof e[hg]=="function"};function Lae(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:y,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:v,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. - Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. - See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var b=function(S){return Array.from(S.values()).flatMap(function(x){return x?Object.values(x):[]})};return g1(g1([],b(a)),b(s)).filter(Ox)}function p(b,S){return function(x){var w,C=o.endpointDefinitions[b],T=t({queryArgs:S,endpointDefinition:C,endpointName:b});return(w=a.get(x))==null?void 0:w[T]}}function m(b,S){return function(x){var w;return(w=s.get(x))==null?void 0:w[S]}}function _(){return function(b){return Object.values(a.get(b)||{}).filter(Ox)}}function v(){return function(b){return Object.values(s.get(b)||{}).filter(Ox)}}function y(b,S){var x=function(w,C){var T=C===void 0?{}:C,A=T.subscribe,I=A===void 0?!0:A,D=T.forceRefetch,M=T.subscriptionOptions,E=hg,P=T[E];return function(N,L){var O,R,$=t({queryArgs:w,endpointDefinition:S,endpointName:b}),z=n((O={type:"query",subscribe:I,forceRefetch:D,subscriptionOptions:M,endpointName:b,originalArgs:w,queryCacheKey:$},O[hg]=P,O)),V=i.endpoints[b].select(w),H=N(z),Q=V(L()),Z=H.requestId,J=H.abort,j=Q.requestId!==Z,X=(R=a.get(N))==null?void 0:R[$],ee=function(){return V(L())},ne=Object.assign(P?H.then(ee):j&&!X?Promise.resolve(Q):Promise.all([X,H]).then(ee),{arg:w,requestId:Z,subscriptionOptions:M,queryCacheKey:$,abort:J,unwrap:function(){return y1(this,null,function(){var de;return p1(this,function(Be){switch(Be.label){case 0:return[4,ne];case 1:if(de=Be.sent(),de.isError)throw de.error;return[2,de.data]}})})},refetch:function(){return N(x(w,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){I&&N(u({queryCacheKey:$,requestId:Z}))},updateSubscriptionOptions:function(de){ne.subscriptionOptions=de,N(d({endpointName:b,requestId:Z,queryCacheKey:$,options:de}))}});if(!X&&!j&&!P){var fe=a.get(N)||{};fe[$]=ne,a.set(N,fe),ne.then(function(){delete fe[$],Object.keys(fe).length||a.delete(N)})}return ne}};return x}function g(b){return function(S,x){var w=x===void 0?{}:x,C=w.track,T=C===void 0?!0:C,A=w.fixedCacheKey;return function(I,D){var M=r({type:"mutation",endpointName:b,originalArgs:S,track:T,fixedCacheKey:A}),E=I(M),P=E.requestId,N=E.abort,L=E.unwrap,O=E.unwrap().then(function(V){return{data:V}}).catch(function(V){return{error:V}}),R=function(){I(c({requestId:P,fixedCacheKey:A}))},$=Object.assign(O,{arg:E.arg,requestId:P,abort:N,unwrap:L,unsubscribe:R,reset:R}),z=s.get(I)||{};return s.set(I,z),z[P]=$,$.then(function(){delete z[P],Object.keys(z).length||s.delete(I)}),A&&(z[A]=$,$.then(function(){z[A]===$&&(delete z[A],Object.keys(z).length||s.delete(I))})),$}}}}function I6(e){return e}function Fae(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=function(g,b,S){return function(x){var w=i[g];x(a.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:b,endpointDefinition:w,endpointName:g}),patches:S}))}},l=function(g,b,S){return function(x,w){var C,T,A=a.endpoints[g].select(b)(w()),I={patches:[],inversePatches:[],undo:function(){return x(a.util.patchQueryData(g,b,I.inversePatches))}};if(A.status===Gt.uninitialized)return I;if("data"in A)if(ei(A.data)){var D=X4(A.data,S),M=D[1],E=D[2];(C=I.patches).push.apply(C,M),(T=I.inversePatches).push.apply(T,E)}else{var P=S(A.data);I.patches.push({op:"replace",path:[],value:P}),I.inversePatches.push({op:"replace",path:[],value:A.data})}return x(a.util.patchQueryData(g,b,I.patches)),I}},u=function(g,b,S){return function(x){var w;return x(a.endpoints[g].initiate(b,(w={subscribe:!1,forceRefetch:!0},w[hg]=function(){return{data:S}},w)))}},c=function(g,b){return y1(t,[g,b],function(S,x){var w,C,T,A,I,D,M,E,P,N,L,O,R,$,z,V,H,Q,Z=x.signal,J=x.abort,j=x.rejectWithValue,X=x.fulfillWithValue,ee=x.dispatch,ne=x.getState,fe=x.extra;return p1(this,function(de){switch(de.label){case 0:w=i[S.endpointName],de.label=1;case 1:return de.trys.push([1,8,,13]),C=I6,T=void 0,A={signal:Z,abort:J,dispatch:ee,getState:ne,extra:fe,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,ne()):void 0},I=S.type==="query"?S[hg]:void 0,I?(T=I(),[3,6]):[3,2];case 2:return w.query?[4,r(w.query(S.originalArgs),A,w.extraOptions)]:[3,4];case 3:return T=de.sent(),w.transformResponse&&(C=w.transformResponse),[3,6];case 4:return[4,w.queryFn(S.originalArgs,A,w.extraOptions,function(Be){return r(Be,A,w.extraOptions)})];case 5:T=de.sent(),de.label=6;case 6:if(typeof process<"u",T.error)throw new k6(T.error,T.meta);return L=X,[4,C(T.data,T.meta,S.originalArgs)];case 7:return[2,L.apply(void 0,[de.sent(),(H={fulfilledTimeStamp:Date.now(),baseQueryMeta:T.meta},H[ku]=!0,H)])];case 8:if(O=de.sent(),R=O,!(R instanceof k6))return[3,12];$=I6,w.query&&w.transformErrorResponse&&($=w.transformErrorResponse),de.label=9;case 9:return de.trys.push([9,11,,12]),z=j,[4,$(R.value,R.meta,S.originalArgs)];case 10:return[2,z.apply(void 0,[de.sent(),(Q={baseQueryMeta:R.meta},Q[ku]=!0,Q)])];case 11:return V=de.sent(),R=V,[3,12];case 12:throw typeof process<"u",console.error(R),R;case 13:return[2]}})})};function d(g,b){var S,x,w,C,T=(x=(S=b[n])==null?void 0:S.queries)==null?void 0:x[g.queryCacheKey],A=(w=b[n])==null?void 0:w.config.refetchOnMountOrArgChange,I=T==null?void 0:T.fulfilledTimeStamp,D=(C=g.forceRefetch)!=null?C:g.subscribe&&A;return D?D===!0||(Number(new Date)-Number(I))/1e3>=D:!1}var f=Kv(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[ku]=!0,g},condition:function(g,b){var S=b.getState,x,w,C,T=S(),A=(w=(x=T[n])==null?void 0:x.queries)==null?void 0:w[g.queryCacheKey],I=A==null?void 0:A.fulfilledTimeStamp,D=g.originalArgs,M=A==null?void 0:A.originalArgs,E=i[g.endpointName];return b5(g)?!0:(A==null?void 0:A.status)==="pending"?!1:d(g,T)||PL(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:D,previousArg:M,endpointState:A,state:T}))?!0:!I},dispatchConditionRejection:!0}),h=Kv(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[ku]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,b,S){return function(x,w){var C=p(S)&&S.force,T=m(S)&&S.ifOlderThan,A=function(E){return E===void 0&&(E=!0),a.endpoints[g].initiate(b,{forceRefetch:E})},I=a.endpoints[g].select(b)(w());if(C)x(A());else if(T){var D=I==null?void 0:I.fulfilledTimeStamp;if(!D){x(A());return}var M=(Number(new Date)-Number(new Date(D)))/1e3>=T;M&&x(A())}else x(A(!1))}};function v(g){return function(b){var S,x;return((x=(S=b==null?void 0:b.meta)==null?void 0:S.arg)==null?void 0:x.endpointName)===g}}function y(g,b){return{matchPending:Pd(Vb(g),v(b)),matchFulfilled:Pd(Gl(g),v(b)),matchRejected:Pd(uf(g),v(b))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:y}}function IL(e,t,n,r){return kL(n[e.meta.arg.endpointName][t],Gl(e)?e.payload:void 0,dm(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function T0(e,t,n){var r=e[t];r&&n(r)}function pg(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function M6(e,t,n){var r=e[pg(t)];r&&n(r)}var uh={};function Bae(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=ge(t+"/resetApiState"),f=qt({name:t+"/queries",initialState:uh,reducers:{removeQueryResult:{reducer:function(S,x){var w=x.payload.queryCacheKey;delete S[w]},prepare:Fy()},queryResultPatched:function(S,x){var w=x.payload,C=w.queryCacheKey,T=w.patches;T0(S,C,function(A){A.data=QC(A.data,T.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(x,w){var C=w.meta,T=w.meta.arg,A,I,D=b5(T);(T.subscribe||D)&&((I=x[A=T.queryCacheKey])!=null||(x[A]={status:Gt.uninitialized,endpointName:T.endpointName})),T0(x,T.queryCacheKey,function(M){M.status=Gt.pending,M.requestId=D&&M.requestId?M.requestId:C.requestId,T.originalArgs!==void 0&&(M.originalArgs=T.originalArgs),M.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(x,w){var C=w.meta,T=w.payload;T0(x,C.arg.queryCacheKey,function(A){var I;if(!(A.requestId!==C.requestId&&!b5(C.arg))){var D=o[C.arg.endpointName].merge;if(A.status=Gt.fulfilled,D)if(A.data!==void 0){var M=C.fulfilledTimeStamp,E=C.arg,P=C.baseQueryMeta,N=C.requestId,L=Ul(A.data,function(O){return D(O,T,{arg:E.originalArgs,baseQueryMeta:P,fulfilledTimeStamp:M,requestId:N})});A.data=L}else A.data=T;else A.data=(I=o[C.arg.endpointName].structuralSharing)==null||I?EL(Nr(A.data)?V4(A.data):A.data,T):T;delete A.error,A.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(x,w){var C=w.meta,T=C.condition,A=C.arg,I=C.requestId,D=w.error,M=w.payload;T0(x,A.queryCacheKey,function(E){if(!T){if(E.requestId!==I)return;E.status=Gt.rejected,E.error=M??D}})}).addMatcher(l,function(x,w){for(var C=s(w).queries,T=0,A=Object.entries(C);T"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?lse:sse;OL.useSyncExternalStore=pf.useSyncExternalStore!==void 0?pf.useSyncExternalStore:use;RL.exports=OL;var cse=RL.exports,$L={exports:{}},NL={};/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var c_=k,dse=cse;function fse(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hse=typeof Object.is=="function"?Object.is:fse,pse=dse.useSyncExternalStore,gse=c_.useRef,mse=c_.useEffect,yse=c_.useMemo,vse=c_.useDebugValue;NL.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=gse(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=yse(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,hse(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=pse(e,o[0],o[1]);return mse(function(){a.hasValue=!0,a.value=s},[s]),vse(s),s};$L.exports=NL;var DL=$L.exports;const bse=Bl(DL);function _se(e){e()}let LL=_se;const Sse=e=>LL=e,xse=()=>LL,F6=Symbol.for("react-redux-context"),B6=typeof globalThis<"u"?globalThis:{};function wse(){var e;if(!k.createContext)return{};const t=(e=B6[F6])!=null?e:B6[F6]=new Map;let n=t.get(k.createContext);return n||(n=k.createContext(null),t.set(k.createContext,n)),n}const Ml=wse();function $E(e=Ml){return function(){return k.useContext(e)}}const FL=$E(),Cse=()=>{throw new Error("uSES not initialized!")};let BL=Cse;const Ese=e=>{BL=e},Ase=(e,t)=>e===t;function Tse(e=Ml){const t=e===Ml?FL:$E(e);return function(r,i={}){const{equalityFn:o=Ase,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();k.useRef(!0);const h=k.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=BL(u.addNestedSub,l.getState,c||l.getState,h,o);return k.useDebugValue(p),p}}const zL=Tse();function v1(){return v1=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const z6={notify(){},get:()=>[]};function Bse(e,t){let n,r=z6;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=Fse())}function u(){n&&(n(),n=void 0,r.clear(),r=z6)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const zse=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",jse=zse?k.useLayoutEffect:k.useEffect;function j6(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function b1(e,t){if(j6(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=Bse(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=k.useMemo(()=>e.getState(),[e]);jse(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||Ml;return k.createElement(l.Provider,{value:a},n)}function qL(e=Ml){const t=e===Ml?FL:$E(e);return function(){const{store:r}=t();return r}}const WL=qL();function Use(e=Ml){const t=e===Ml?WL:qL(e);return function(){return t().dispatch}}const KL=Use();Ese(DL.useSyncExternalStoreWithSelector);Sse(pi.unstable_batchedUpdates);var Gse=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;nlle({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const hle=["AppVersion","AppConfig","Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","IntermediatesCount","SessionQueueItem","SessionQueueStatus","SessionProcessorStatus","CurrentSessionQueueItem","NextSessionQueueItem","BatchStatus","InvocationCacheStatus","Model","T2IAdapterModel","MainModel","OnnxModel","VaeModel","IPAdapterModel","TextualInversionModel","ControlNetModel","LoRAModel","SDXLRefinerModel","Workflow"],Pr="LIST",ple=async(e,t,n)=>{const r=mg.get(),i=gg.get(),o=S1.get();return $ae({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},No=ole({baseQuery:ple,reducerPath:"api",tagTypes:hle,endpoints:()=>({})}),gle=e=>{const t=e?fp.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Nn.get()}/list?${t}`:`queue/${Nn.get()}/list`},xu=Yi({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),ln=No.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Nn.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,M0(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Nn.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Nn.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Nn.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,M0(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Nn.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,M0(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Nn.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Nn.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Nn.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Nn.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Nn.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Nn.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(ln.util.updateQueryData("listQueueItems",void 0,o=>{xu.updateOne(o,{id:t,changes:{status:i.status,completed_at:i.completed_at,updated_at:i.updated_at}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Nn.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,M0(r)}catch{}},invalidatesTags:["SessionQueueStatus","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:gle(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Nn.get()}/list`,transformResponse:t=>xu.addMany(xu.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{xu.addMany(t,xu.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:qFe,useEnqueueBatchMutation:WFe,usePauseProcessorMutation:KFe,useResumeProcessorMutation:XFe,useClearQueueMutation:QFe,usePruneQueueMutation:YFe,useGetCurrentQueueItemQuery:ZFe,useGetQueueStatusQuery:JFe,useGetQueueItemQuery:eBe,useGetNextQueueItemQuery:tBe,useListQueueItemsQuery:nBe,useCancelQueueItemMutation:rBe,useGetBatchStatusQuery:iBe}=ln,M0=e=>{e(ln.util.updateQueryData("listQueueItems",void 0,t=>{xu.removeAll(t),t.has_more=!1})),e(cae()),e(ln.endpoints.listQueueItems.initiate(void 0))},Fh={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},XL={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Fh,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,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",batchIds:[]},QL=qt({name:"canvas",initialState:XL,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(Ye(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!dL(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,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:y0(al(r,64,512),64),height:y0(al(i,64,512),64)},s={x:Mr(r/2-a.width/2,64),y:Mr(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=Rc(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(Ye(e.layerState)),e.layerState={...Ye(Fh),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=w0(o.width,o.height,r,i,C0),u=x0(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=eae(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=Rc(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=Joe(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=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},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Ye(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Ye(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=Ye(Ye(Fh)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Ye(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(Ye(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(Ye(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(nae);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Ye(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Ye(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(Ye(e.layerState)),e.layerState=Ye(Fh),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(tae)){const o=w0(i.width,i.height,512,512,C0),a=x0(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=Rc(s);e.scaledBoundingBoxDimensions=l}}},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 c=r?1:w0(i,o,l,u,C0),d=x0(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=w0(i,o,512,512,C0),d=x0(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=Rc(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(Ye(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=Ye(Fh).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},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:y0(al(o,64,512),64),height:y0(al(a,64,512),64)},l={x:Mr(o/2-s.width/2,64),y:Mr(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=Rc(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=Rc(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},setShouldAntialias:(e,t)=>{e.shouldAntialias=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(Ye(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}},extraReducers:e=>{e.addCase(i_,(t,n)=>{const r=n.payload.data.batch_status;t.batchIds.includes(r.batch_id)&&r.in_progress===0&&r.pending===0&&(t.batchIds=t.batchIds.filter(i=>i!==r.batch_id))}),e.addCase(Yoe,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=Mr(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=Mr(t.scaledBoundingBoxDimensions.width/r,64))}),e.addMatcher(ln.endpoints.clearQueue.matchFulfilled,t=>{t.batchIds=[]}),e.addMatcher(ln.endpoints.cancelByBatchIds.matchFulfilled,(t,n)=>{t.batchIds=t.batchIds.filter(r=>!n.meta.arg.originalArgs.batch_ids.includes(r))})}}),{addEraseRect:oBe,addFillRect:aBe,addImageToStagingArea:mle,addLine:sBe,addPointToCurrentLine:lBe,clearCanvasHistory:uBe,clearMask:cBe,commitColorPickerColor:dBe,commitStagingAreaImage:yle,discardStagedImages:vle,fitBoundingBoxToStage:fBe,mouseLeftCanvas:hBe,nextStagingAreaImage:pBe,prevStagingAreaImage:gBe,redo:mBe,resetCanvas:zE,resetCanvasInteractionState:yBe,resetCanvasView:vBe,setBoundingBoxCoordinates:bBe,setBoundingBoxDimensions:H6,setBoundingBoxPreviewFill:_Be,setBoundingBoxScaleMethod:SBe,flipBoundingBoxAxes:xBe,setBrushColor:wBe,setBrushSize:CBe,setColorPickerColor:EBe,setCursorPosition:ABe,setInitialCanvasImage:YL,setIsDrawing:TBe,setIsMaskEnabled:PBe,setIsMouseOverBoundingBox:kBe,setIsMoveBoundingBoxKeyHeld:IBe,setIsMoveStageKeyHeld:MBe,setIsMovingBoundingBox:RBe,setIsMovingStage:OBe,setIsTransformingBoundingBox:$Be,setLayer:NBe,setMaskColor:DBe,setMergedCanvas:ble,setShouldAutoSave:LBe,setShouldCropToBoundingBoxOnSave:FBe,setShouldDarkenOutsideBoundingBox:BBe,setShouldLockBoundingBox:zBe,setShouldPreserveMaskedArea:jBe,setShouldShowBoundingBox:VBe,setShouldShowBrush:UBe,setShouldShowBrushPreview:GBe,setShouldShowCanvasDebugInfo:HBe,setShouldShowCheckboardTransparency:qBe,setShouldShowGrid:WBe,setShouldShowIntermediates:KBe,setShouldShowStagingImage:XBe,setShouldShowStagingOutline:QBe,setShouldSnapToGrid:YBe,setStageCoordinates:ZBe,setStageScale:JBe,setTool:eze,toggleShouldLockBoundingBox:tze,toggleTool:nze,undo:rze,setScaledBoundingBoxDimensions:ize,setShouldRestrictStrokesToBox:oze,stagingAreaInitialized:_le,setShouldAntialias:aze,canvasResized:sze,canvasBatchIdAdded:Sle,canvasBatchIdsReset:xle}=QL.actions,wle=QL.reducer,Cle={isModalOpen:!1,imagesToChange:[]},ZL=qt({name:"changeBoardModal",initialState:Cle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:lze,imagesToChangeSelected:uze,changeBoardReset:cze}=ZL.actions,Ele=ZL.reducer,Ale={imagesToDelete:[],isModalOpen:!1},JL=qt({name:"deleteImageModal",initialState:Ale,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:jE,imagesToDeleteSelected:Tle,imageDeletionCanceled:dze}=JL.actions,Ple=JL.reducer,VE={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},kle=VE,eF=qt({name:"dynamicPrompts",initialState:kle,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=VE.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:Ile,maxPromptsReset:Mle,combinatorialToggled:Rle,promptsChanged:Ole,parsingErrorChanged:$le,isErrorChanged:q6,isLoadingChanged:Fx,seedBehaviourChanged:fze}=eF.actions,Nle=eF.reducer,Ln=["general"],Tr=["control","mask","user","other"],Dle=100,R0=20,Lle=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:n{if(!e)return!1;const n=yg.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},Oi=e=>Ln.includes(e.image_category)?Ln:Tr,Dt=Yi({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Lle(t.created_at,e.created_at)}),yg=Dt.getSelectors(),Bi=e=>`images/?${fp.stringify(e,{arrayFormat:"none"})}`,Qe=No.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:Pr}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:Pr}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Bi({board_id:t??"none",categories:Ln,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),getBoardAssetsTotal:e.query({query:t=>({url:Bi({board_id:t??"none",categories:Tr,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Pr}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:hze,useListAllBoardsQuery:pze,useGetBoardImagesTotalQuery:gze,useGetBoardAssetsTotalQuery:mze,useCreateBoardMutation:yze,useUpdateBoardMutation:vze,useListAllImageNamesForBoardQuery:bze}=Qe;var tF={},M_={},R_={};Object.defineProperty(R_,"__esModule",{value:!0});R_.createLogMethods=void 0;var Fle=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};R_.createLogMethods=Fle;var UE={},O_={};Object.defineProperty(O_,"__esModule",{value:!0});O_.boolean=void 0;const Ble=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};O_.boolean=Ble;var $_={};Object.defineProperty($_,"__esModule",{value:!0});$_.isBooleanable=void 0;const zle=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};$_.isBooleanable=zle;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=O_;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=$_;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(UE);var W6=Object.prototype.toString,nF=function(t){var n=W6.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&W6.call(t.callee)==="[object Function]"),r},Bx,K6;function jle(){if(K6)return Bx;K6=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=nF,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),v=p&&n.call(h)==="[object String]",y=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(v&&h.length>0&&!t.call(h,0))for(var b=0;b0)for(var S=0;S"u"||!Fn?qe:Fn(Uint8Array),Vu={"%AggregateError%":typeof AggregateError>"u"?qe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?qe:ArrayBuffer,"%ArrayIteratorPrototype%":Oc&&Fn?Fn([][Symbol.iterator]()):qe,"%AsyncFromSyncIteratorPrototype%":qe,"%AsyncFunction%":qc,"%AsyncGenerator%":qc,"%AsyncGeneratorFunction%":qc,"%AsyncIteratorPrototype%":qc,"%Atomics%":typeof Atomics>"u"?qe:Atomics,"%BigInt%":typeof BigInt>"u"?qe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?qe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?qe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?qe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?qe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?qe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?qe:FinalizationRegistry,"%Function%":iF,"%GeneratorFunction%":qc,"%Int8Array%":typeof Int8Array>"u"?qe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?qe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?qe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Oc&&Fn?Fn(Fn([][Symbol.iterator]())):qe,"%JSON%":typeof JSON=="object"?JSON:qe,"%Map%":typeof Map>"u"?qe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Oc||!Fn?qe:Fn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?qe:Promise,"%Proxy%":typeof Proxy>"u"?qe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?qe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?qe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Oc||!Fn?qe:Fn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?qe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Oc&&Fn?Fn(""[Symbol.iterator]()):qe,"%Symbol%":Oc?Symbol:qe,"%SyntaxError%":gf,"%ThrowTypeError%":rue,"%TypedArray%":oue,"%TypeError%":Nd,"%Uint8Array%":typeof Uint8Array>"u"?qe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?qe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?qe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?qe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?qe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?qe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?qe:WeakSet};if(Fn)try{null.error}catch(e){var aue=Fn(Fn(e));Vu["%Error.prototype%"]=aue}var sue=function e(t){var n;if(t==="%AsyncFunction%")n=jx("async function () {}");else if(t==="%GeneratorFunction%")n=jx("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=jx("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Fn&&(n=Fn(i.prototype))}return Vu[t]=n,n},J6={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},_m=rF,x1=nue,lue=_m.call(Function.call,Array.prototype.concat),uue=_m.call(Function.apply,Array.prototype.splice),eI=_m.call(Function.call,String.prototype.replace),w1=_m.call(Function.call,String.prototype.slice),cue=_m.call(Function.call,RegExp.prototype.exec),due=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,fue=/\\(\\)?/g,hue=function(t){var n=w1(t,0,1),r=w1(t,-1);if(n==="%"&&r!=="%")throw new gf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new gf("invalid intrinsic syntax, expected opening `%`");var i=[];return eI(t,due,function(o,a,s,l){i[i.length]=s?eI(l,fue,"$1"):a||o}),i},pue=function(t,n){var r=t,i;if(x1(J6,r)&&(i=J6[r],r="%"+i[0]+"%"),x1(Vu,r)){var o=Vu[r];if(o===qc&&(o=sue(r)),typeof o>"u"&&!n)throw new Nd("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new gf("intrinsic "+t+" does not exist!")},gue=function(t,n){if(typeof t!="string"||t.length===0)throw new Nd("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Nd('"allowMissing" argument must be a boolean');if(cue(/^%?[^%]*%?$/,t)===null)throw new gf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=hue(t),i=r.length>0?r[0]:"",o=pue("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],uue(r,lue([0,1],u)));for(var c=1,d=!0;c=r.length){var m=ju(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=x1(s,f),s=s[f];d&&!l&&(Vu[a]=s)}}return s},mue=gue,_5=mue("%Object.defineProperty%",!0),S5=function(){if(_5)try{return _5({},"a",{value:1}),!0}catch{return!1}return!1};S5.hasArrayLengthDefineBug=function(){if(!S5())return null;try{return _5([],"length",{value:1}).length!==1}catch{return!0}};var yue=S5,vue=Gle,bue=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",_ue=Object.prototype.toString,Sue=Array.prototype.concat,oF=Object.defineProperty,xue=function(e){return typeof e=="function"&&_ue.call(e)==="[object Function]"},wue=yue(),aF=oF&&wue,Cue=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!xue(r)||!r())return}aF?oF(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},sF=function(e,t){var n=arguments.length>2?arguments[2]:{},r=vue(t);bue&&(r=Sue.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};F_.testComparisonRange=Hue;var B_={};Object.defineProperty(B_,"__esModule",{value:!0});B_.testRange=void 0;var que=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};B_.testRange=que;(function(e){var t=Ve&&Ve.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,Xue.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};z_.highlight=Yue;var j_={},pF={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(Ve,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(pF);var Zue=pF.exports,ic={},gF={},Wl={};Wl.__esModule=void 0;Wl.__esModule=!0;var Jue=typeof Object.setPrototypeOf=="function",ece=typeof Object.getPrototypeOf=="function",tce=typeof Object.defineProperty=="function",nce=typeof Object.create=="function",rce=typeof Object.prototype.hasOwnProperty=="function",ice=function(t,n){Jue?Object.setPrototypeOf(t,n):t.__proto__=n};Wl.setPrototypeOf=ice;var oce=function(t){return ece?Object.getPrototypeOf(t):t.__proto__||t.prototype};Wl.getPrototypeOf=oce;var tI=!1,ace=function e(t,n,r){if(tce&&!tI)try{Object.defineProperty(t,n,r)}catch{tI=!0,e(t,n,r)}else t[n]=r.value};Wl.defineProperty=ace;var mF=function(t,n){return rce?t.hasOwnProperty(t,n):t[n]===void 0};Wl.hasOwnProperty=mF;var sce=function(t,n){if(nce)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)mF(n,o)&&(i[o]=n[o].value);return i};Wl.objectCreate=sce;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=Wl,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(gF);var yF=Ve&&Ve.__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){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(ic,"__esModule",{value:!0});ic.SyntaxError=ic.LiqeError=void 0;var lce=gF,vF=function(e){yF(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(lce.ExtendableError);ic.LiqeError=vF;var uce=function(e){yF(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(vF);ic.SyntaxError=uce;var qE={},C1=Ve&&Ve.__assign||function(){return C1=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:$a},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};qE.default=cce;var bF={},V_={},wm={};Object.defineProperty(wm,"__esModule",{value:!0});wm.isSafePath=void 0;var dce=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,fce=function(e){return dce.test(e)};wm.isSafePath=fce;Object.defineProperty(V_,"__esModule",{value:!0});V_.createGetValueFunctionBody=void 0;var hce=wm,pce=function(e){if(!(0,hce.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};V_.createGetValueFunctionBody=pce;(function(e){var t=Ve&&Ve.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,_ce=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new SF.default.Parser(vce),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(bce);throw r?new gce.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,yce.hydrateAst)(n[0]);return i};j_.parse=_ce;var U_={};Object.defineProperty(U_,"__esModule",{value:!0});U_.test=void 0;var Sce=Sm,xce=function(e,t){return(0,Sce.filter)(e,[t]).length===1};U_.test=xce;var xF={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(xF);var G_={};Object.defineProperty(G_,"__esModule",{value:!0});G_.isSafeUnquotedExpression=void 0;var wce=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};G_.isSafeUnquotedExpression=wce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=Sm;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=z_;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=j_;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=U_;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=ic;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=xF;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=G_;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(hF);var Cm={},wF={},oc={};Object.defineProperty(oc,"__esModule",{value:!0});oc.ROARR_LOG_FORMAT_VERSION=oc.ROARR_VERSION=void 0;oc.ROARR_VERSION="5.0.0";oc.ROARR_LOG_FORMAT_VERSION="2.0.0";var Em={};Object.defineProperty(Em,"__esModule",{value:!0});Em.logLevels=void 0;Em.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var CF={},H_={};Object.defineProperty(H_,"__esModule",{value:!0});H_.hasOwnProperty=void 0;const Cce=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);H_.hasOwnProperty=Cce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=H_;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(CF);var EF={},q_={},W_={};Object.defineProperty(W_,"__esModule",{value:!0});W_.tokenize=void 0;const Ece=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,Ace=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Ece.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};W_.tokenize=Ace;Object.defineProperty(q_,"__esModule",{value:!0});q_.createPrintf=void 0;const nI=UE,Tce=W_,Pce=(e,t)=>t.placeholder,kce=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Pce,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=Tce.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=nI.boolean(c)?"true":"false";else if(u.conversion==="B")l+=nI.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};q_.createPrintf=kce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=q_;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(EF);var x5={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(v){return v.length<5e3&&!i.test(v)?`"${v}"`:JSON.stringify(v)}function a(v){if(v.length>200)return v.sort();for(let y=1;yg;)v[b]=v[b-1],b--;v[b]=g}return v}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(v){return s.call(v)!==void 0&&v.length!==0}function u(v,y,g){v.length= 1`)}return g===void 0?1/0:g}function h(v){return v===1?"1 item":`${v} items`}function p(v){const y=new Set;for(const g of v)(typeof g=="string"||typeof g=="number")&&y.add(String(g));return y}function m(v){if(n.call(v,"strict")){const y=v.strict;if(typeof y!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(y)return g=>{let b=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(b+=` (${g.toString()})`),new Error(b)}}}function _(v){v={...v};const y=m(v);y&&(v.bigint===void 0&&(v.bigint=!1),"circularValue"in v||(v.circularValue=Error));const g=c(v),b=d(v,"bigint"),S=d(v,"deterministic"),x=f(v,"maximumDepth"),w=f(v,"maximumBreadth");function C(M,E,P,N,L,O){let R=E[M];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(M)),R=N.call(E,M,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(P.indexOf(R)!==-1)return g;let $="",z=",";const V=O;if(Array.isArray(R)){if(R.length===0)return"[]";if(xw){const fe=R.length-w-1;$+=`${z}"... ${h(fe)} not stringified"`}return L!==""&&($+=` -${V}`),P.pop(),`[${$}]`}let H=Object.keys(R);const Q=H.length;if(Q===0)return"{}";if(xw){const X=Q-w;$+=`${J}"...":${Z}"${h(X)} not stringified"`,J=z}return L!==""&&J.length>1&&($=` -${O}${$} -${V}`),P.pop(),`{${$}}`}case"number":return isFinite(R)?String(R):y?y(R):"null";case"boolean":return R===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(R);default:return y?y(R):void 0}}function T(M,E,P,N,L,O){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(M)),typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(P.indexOf(E)!==-1)return g;const R=O;let $="",z=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(xw){const j=E.length-w-1;$+=`${z}"... ${h(j)} not stringified"`}return L!==""&&($+=` -${R}`),P.pop(),`[${$}]`}P.push(E);let V="";L!==""&&(O+=L,z=`, -${O}`,V=" ");let H="";for(const Q of N){const Z=T(Q,E[Q],P,N,L,O);Z!==void 0&&($+=`${H}${o(Q)}:${V}${Z}`,H=z)}return L!==""&&H.length>1&&($=` -${O}${$} -${R}`),P.pop(),`{${$}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(E);default:return y?y(E):void 0}}function A(M,E,P,N,L){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(M),typeof E!="object")return A(M,E,P,N,L);if(E===null)return"null"}if(P.indexOf(E)!==-1)return g;const O=L;if(Array.isArray(E)){if(E.length===0)return"[]";if(xw){const ne=E.length-w-1;Z+=`${J}"... ${h(ne)} not stringified"`}return Z+=` -${O}`,P.pop(),`[${Z}]`}let R=Object.keys(E);const $=R.length;if($===0)return"{}";if(xw){const Z=$-w;V+=`${H}"...": "${h(Z)} not stringified"`,H=z}return H!==""&&(V=` -${L}${V} -${O}`),P.pop(),`{${V}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(E);default:return y?y(E):void 0}}function I(M,E,P){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(M),typeof E!="object")return I(M,E,P);if(E===null)return"null"}if(P.indexOf(E)!==-1)return g;let N="";if(Array.isArray(E)){if(E.length===0)return"[]";if(xw){const Q=E.length-w-1;N+=`,"... ${h(Q)} not stringified"`}return P.pop(),`[${N}]`}let L=Object.keys(E);const O=L.length;if(O===0)return"{}";if(xw){const z=O-w;N+=`${R}"...":"${h(z)} not stringified"`}return P.pop(),`{${N}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(E);default:return y?y(E):void 0}}function D(M,E,P){if(arguments.length>1){let N="";if(typeof P=="number"?N=" ".repeat(Math.min(P,10)):typeof P=="string"&&(N=P.slice(0,10)),E!=null){if(typeof E=="function")return C("",{"":M},[],E,N,"");if(Array.isArray(E))return T("",M,[],p(E),N,"")}if(N.length!==0)return A("",M,[],N,"")}return I("",M,[])}return D}})(x5,x5.exports);var Ice=x5.exports;(function(e){var t=Ve&&Ve.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=oc,r=Em,i=CF,o=EF,a=t(GE),s=t(Ice);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const b=g.getStore();return b||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,b)=>(S,x,w,C,T,A,I,D,M,E)=>{g.child({logLevel:b})(S,x,w,C,T,A,I,D,M,E)},_=1e3,v=(g,b)=>(S,x,w,C,T,A,I,D,M,E)=>{const P=(0,s.default)({a:S,b:x,c:w,d:C,e:T,f:A,g:I,h:D,i:M,j:E,logLevel:b});if(!P)throw new Error("Expected key to be a string");const N=c().onceLog;N.has(P)||(N.add(P),N.size>_&&N.clear(),g.child({logLevel:b})(S,x,w,C,T,A,I,D,M,E))},y=(g,b={},S=[])=>{const x=(w,C,T,A,I,D,M,E,P,N)=>{const L=Date.now(),O=p();let R;h()?R=f():R=d();let $,z;if(typeof w=="string"?$={...R.messageContext,...b}:$={...R.messageContext,...b,...w},typeof w=="string"&&C===void 0)z=w;else if(typeof w=="string"){if(!w.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");z=(0,o.printf)(w,C,T,A,I,D,M,E,P,N)}else{let H=C;if(typeof C!="string")if(C===void 0)H="";else throw new TypeError("Message must be a string. Received "+typeof C+".");z=(0,o.printf)(H,T,A,I,D,M,E,P,N)}let V={context:$,message:z,sequence:O,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const H of[...R.transforms,...S])if(V=H(V),typeof V!="object"||V===null)throw new Error("Message transform function must return a message object.");g(V)};return x.child=w=>{let C;return h()?C=f():C=d(),typeof w=="function"?(0,e.createLogger)(g,{...C.messageContext,...b,...w},[w,...S]):(0,e.createLogger)(g,{...C.messageContext,...b,...w},S)},x.getContext=()=>{let w;return h()?w=f():w=d(),{...w.messageContext,...b}},x.adopt=async(w,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),w();const T=f();let A;(0,i.hasOwnProperty)(T,"sequenceRoot")&&(0,i.hasOwnProperty)(T,"sequence")&&typeof T.sequence=="number"?A=T.sequenceRoot+"."+String(T.sequence++):A=String(c().sequence++);let I={...T.messageContext};const D=[...T.transforms];typeof C=="function"?D.push(C):I={...I,...C};const M=c().asyncLocalStorage;if(!M)throw new Error("Async local context unavailable.");return M.run({messageContext:I,sequence:0,sequenceRoot:A,transforms:D},()=>w())},x.debug=m(x,r.logLevels.debug),x.debugOnce=v(x,r.logLevels.debug),x.error=m(x,r.logLevels.error),x.errorOnce=v(x,r.logLevels.error),x.fatal=m(x,r.logLevels.fatal),x.fatalOnce=v(x,r.logLevels.fatal),x.info=m(x,r.logLevels.info),x.infoOnce=v(x,r.logLevels.info),x.trace=m(x,r.logLevels.trace),x.traceOnce=v(x,r.logLevels.trace),x.warn=m(x,r.logLevels.warn),x.warnOnce=v(x,r.logLevels.warn),x};e.createLogger=y})(wF);var K_={},Mce=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},Rce=Ve&&Ve.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(K_,"__esModule",{value:!0});K_.createRoarrInitialGlobalStateBrowser=void 0;const rI=oc,iI=Rce(Mce),Oce=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(iI.default),t.includes(rI.ROARR_VERSION)||t.push(rI.ROARR_VERSION),t.sort(iI.default),{sequence:0,...e,versions:t}};K_.createRoarrInitialGlobalStateBrowser=Oce;var X_={};Object.defineProperty(X_,"__esModule",{value:!0});X_.getLogLevelName=void 0;const $ce=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";X_.getLogLevelName=$ce;(function(e){var t=Ve&&Ve.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=wF,r=K_,o=(0,t(GE).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=Em;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=X_;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(Cm);var Nce=Ve&&Ve.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,v,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,v)}}};M_.createLogWriter=Gce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=M_;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(tF);Cm.ROARR.write=tF.createLogWriter();const TF={};Cm.Roarr.child(TF);const Q_=Ta(Cm.Roarr.child(TF)),ae=e=>Q_.get().child({namespace:e}),_ze=["trace","debug","info","warn","error","fatal"],Sze={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},PF=Ta(),kF=F.enum(["Any","BoardField","boolean","BooleanCollection","BooleanPolymorphic","ClipField","Collection","CollectionItem","ColorCollection","ColorField","ColorPolymorphic","ConditioningCollection","ConditioningField","ConditioningPolymorphic","ControlCollection","ControlField","ControlNetModelField","ControlPolymorphic","DenoiseMaskField","enum","float","FloatCollection","FloatPolymorphic","ImageCollection","ImageField","ImagePolymorphic","integer","IntegerCollection","IntegerPolymorphic","IPAdapterCollection","IPAdapterField","IPAdapterModelField","IPAdapterPolymorphic","LatentsCollection","LatentsField","LatentsPolymorphic","LoRAModelField","MainModelField","MetadataField","MetadataCollection","MetadataItemField","MetadataItemCollection","MetadataItemPolymorphic","ONNXModelField","Scheduler","SDXLMainModelField","SDXLRefinerModelField","string","StringCollection","StringPolymorphic","T2IAdapterCollection","T2IAdapterField","T2IAdapterModelField","T2IAdapterPolymorphic","UNetField","VaeField","VaeModelField"]),Hce=F.enum(["WorkflowField","IsIntermediate","MetadataField"]),aI=e=>kF.safeParse(e).success||Hce.safeParse(e).success;F.enum(["connection","direct","any"]);const IF=F.object({id:F.string().trim().min(1),name:F.string().trim().min(1),type:kF}),qce=IF.extend({fieldKind:F.literal("output")}),Ae=IF.extend({fieldKind:F.literal("input"),label:F.string()}),Cs=F.object({model_name:F.string().trim().min(1),base_model:ql}),Nf=F.object({image_name:F.string().trim().min(1)}),Wce=F.object({board_id:F.string().trim().min(1)}),E1=F.object({latents_name:F.string().trim().min(1),seed:F.number().int().optional()}),A1=F.object({conditioning_name:F.string().trim().min(1)}),Kce=F.object({mask_name:F.string().trim().min(1),masked_latents_name:F.string().trim().min(1).optional()}),Xce=Ae.extend({type:F.literal("integer"),value:F.number().int().optional()}),Qce=Ae.extend({type:F.literal("IntegerCollection"),value:F.array(F.number().int()).optional()}),Yce=Ae.extend({type:F.literal("IntegerPolymorphic"),value:F.number().int().optional()}),Zce=Ae.extend({type:F.literal("float"),value:F.number().optional()}),Jce=Ae.extend({type:F.literal("FloatCollection"),value:F.array(F.number()).optional()}),ede=Ae.extend({type:F.literal("FloatPolymorphic"),value:F.number().optional()}),tde=Ae.extend({type:F.literal("string"),value:F.string().optional()}),nde=Ae.extend({type:F.literal("StringCollection"),value:F.array(F.string()).optional()}),rde=Ae.extend({type:F.literal("StringPolymorphic"),value:F.string().optional()}),ide=Ae.extend({type:F.literal("boolean"),value:F.boolean().optional()}),ode=Ae.extend({type:F.literal("BooleanCollection"),value:F.array(F.boolean()).optional()}),ade=Ae.extend({type:F.literal("BooleanPolymorphic"),value:F.boolean().optional()}),sde=Ae.extend({type:F.literal("enum"),value:F.string().optional()}),lde=Ae.extend({type:F.literal("LatentsField"),value:E1.optional()}),ude=Ae.extend({type:F.literal("LatentsCollection"),value:F.array(E1).optional()}),cde=Ae.extend({type:F.literal("LatentsPolymorphic"),value:F.union([E1,F.array(E1)]).optional()}),dde=Ae.extend({type:F.literal("DenoiseMaskField"),value:Kce.optional()}),fde=Ae.extend({type:F.literal("ConditioningField"),value:A1.optional()}),hde=Ae.extend({type:F.literal("ConditioningCollection"),value:F.array(A1).optional()}),pde=Ae.extend({type:F.literal("ConditioningPolymorphic"),value:F.union([A1,F.array(A1)]).optional()}),gde=Cs,vg=F.object({image:Nf,control_model:gde,control_weight:F.union([F.number(),F.array(F.number())]).optional(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional(),control_mode:F.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:F.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),mde=Ae.extend({type:F.literal("ControlField"),value:vg.optional()}),yde=Ae.extend({type:F.literal("ControlPolymorphic"),value:F.union([vg,F.array(vg)]).optional()}),vde=Ae.extend({type:F.literal("ControlCollection"),value:F.array(vg).optional()}),bde=Cs,bg=F.object({image:Nf,ip_adapter_model:bde,weight:F.number(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional()}),_de=Ae.extend({type:F.literal("IPAdapterField"),value:bg.optional()}),Sde=Ae.extend({type:F.literal("IPAdapterPolymorphic"),value:F.union([bg,F.array(bg)]).optional()}),xde=Ae.extend({type:F.literal("IPAdapterCollection"),value:F.array(bg).optional()}),wde=Cs,_g=F.object({image:Nf,t2i_adapter_model:wde,weight:F.union([F.number(),F.array(F.number())]).optional(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional(),resize_mode:F.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),Cde=Ae.extend({type:F.literal("T2IAdapterField"),value:_g.optional()}),Ede=Ae.extend({type:F.literal("T2IAdapterPolymorphic"),value:F.union([_g,F.array(_g)]).optional()}),Ade=Ae.extend({type:F.literal("T2IAdapterCollection"),value:F.array(_g).optional()}),Tde=F.enum(["onnx","main","vae","lora","controlnet","embedding"]),Pde=F.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),mf=Cs.extend({model_type:Tde,submodel:Pde.optional()}),MF=mf.extend({weight:F.number().optional()}),kde=F.object({unet:mf,scheduler:mf,loras:F.array(MF)}),Ide=Ae.extend({type:F.literal("UNetField"),value:kde.optional()}),Mde=F.object({tokenizer:mf,text_encoder:mf,skipped_layers:F.number(),loras:F.array(MF)}),Rde=Ae.extend({type:F.literal("ClipField"),value:Mde.optional()}),Ode=F.object({vae:mf}),$de=Ae.extend({type:F.literal("VaeField"),value:Ode.optional()}),Nde=Ae.extend({type:F.literal("ImageField"),value:Nf.optional()}),Dde=Ae.extend({type:F.literal("BoardField"),value:Wce.optional()}),Lde=Ae.extend({type:F.literal("ImagePolymorphic"),value:Nf.optional()}),Fde=Ae.extend({type:F.literal("ImageCollection"),value:F.array(Nf).optional()}),Bde=Ae.extend({type:F.literal("MainModelField"),value:bm.optional()}),zde=Ae.extend({type:F.literal("SDXLMainModelField"),value:bm.optional()}),jde=Ae.extend({type:F.literal("SDXLRefinerModelField"),value:bm.optional()}),RF=Cs,Vde=Ae.extend({type:F.literal("VaeModelField"),value:RF.optional()}),OF=Cs,Ude=Ae.extend({type:F.literal("LoRAModelField"),value:OF.optional()}),Gde=Cs,Hde=Ae.extend({type:F.literal("ControlNetModelField"),value:Gde.optional()}),qde=Cs,Wde=Ae.extend({type:F.literal("IPAdapterModelField"),value:qde.optional()}),Kde=Cs,Xde=Ae.extend({type:F.literal("T2IAdapterModelField"),value:Kde.optional()}),Qde=Ae.extend({type:F.literal("Collection"),value:F.array(F.any()).optional()}),Yde=Ae.extend({type:F.literal("CollectionItem"),value:F.any().optional()}),T1=F.object({label:F.string(),value:F.any()}),Zde=Ae.extend({type:F.literal("MetadataItemField"),value:T1.optional()}),Jde=Ae.extend({type:F.literal("MetadataItemCollection"),value:F.array(T1).optional()}),efe=Ae.extend({type:F.literal("MetadataItemPolymorphic"),value:F.union([T1,F.array(T1)]).optional()}),$F=F.record(F.any()),tfe=Ae.extend({type:F.literal("MetadataField"),value:$F.optional()}),nfe=Ae.extend({type:F.literal("MetadataCollection"),value:F.array($F).optional()}),P1=F.object({r:F.number().int().min(0).max(255),g:F.number().int().min(0).max(255),b:F.number().int().min(0).max(255),a:F.number().int().min(0).max(255)}),rfe=Ae.extend({type:F.literal("ColorField"),value:P1.optional()}),ife=Ae.extend({type:F.literal("ColorCollection"),value:F.array(P1).optional()}),ofe=Ae.extend({type:F.literal("ColorPolymorphic"),value:F.union([P1,F.array(P1)]).optional()}),afe=Ae.extend({type:F.literal("Scheduler"),value:iL.optional()}),sfe=Ae.extend({type:F.literal("Any"),value:F.any().optional()}),lfe=F.discriminatedUnion("type",[sfe,Dde,ode,ide,ade,Rde,Qde,Yde,rfe,ife,ofe,fde,hde,pde,mde,Hde,vde,yde,dde,sde,Jce,Zce,ede,Fde,Lde,Nde,Qce,Yce,Xce,_de,Wde,xde,Sde,lde,ude,cde,Ude,Bde,afe,zde,jde,nde,rde,tde,Cde,Xde,Ade,Ede,Ide,$de,Vde,Zde,Jde,efe,tfe,nfe]),xze=e=>!!(e&&e.fieldKind==="input"),wze=e=>!!(e&&e.fieldKind==="input"),O0=e=>!!(e&&!("$ref"in e)),sI=e=>!!(e&&!("$ref"in e)&&e.type==="array"),$0=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),au=e=>!!(e&&"$ref"in e),ufe=e=>"class"in e&&e.class==="invocation",cfe=e=>"class"in e&&e.class==="output",lI=e=>!("$ref"in e),NF=F.object({lora:OF.deepPartial(),weight:F.number()}),dfe=vg.deepPartial(),ffe=bg.deepPartial(),hfe=_g.deepPartial(),pfe=F.object({app_version:F.string().nullish().catch(null),generation_mode:F.string().nullish().catch(null),created_by:F.string().nullish().catch(null),positive_prompt:F.string().nullish().catch(null),negative_prompt:F.string().nullish().catch(null),width:F.number().int().nullish().catch(null),height:F.number().int().nullish().catch(null),seed:F.number().int().nullish().catch(null),rand_device:F.string().nullish().catch(null),cfg_scale:F.number().nullish().catch(null),steps:F.number().int().nullish().catch(null),scheduler:F.string().nullish().catch(null),clip_skip:F.number().int().nullish().catch(null),model:F.union([l_.deepPartial(),sL.deepPartial()]).nullish().catch(null),controlnets:F.array(dfe).nullish().catch(null),ipAdapters:F.array(ffe).nullish().catch(null),t2iAdapters:F.array(hfe).nullish().catch(null),loras:F.array(NF).nullish().catch(null),vae:RF.nullish().catch(null),strength:F.number().nullish().catch(null),hrf_enabled:F.boolean().nullish().catch(null),hrf_strength:F.number().nullish().catch(null),hrf_method:F.string().nullish().catch(null),init_image:F.string().nullish().catch(null),positive_style_prompt:F.string().nullish().catch(null),negative_style_prompt:F.string().nullish().catch(null),refiner_model:TE.deepPartial().nullish().catch(null),refiner_cfg_scale:F.number().nullish().catch(null),refiner_steps:F.number().int().nullish().catch(null),refiner_scheduler:F.string().nullish().catch(null),refiner_positive_aesthetic_score:F.number().nullish().catch(null),refiner_negative_aesthetic_score:F.number().nullish().catch(null),refiner_start:F.number().nullish().catch(null)}).passthrough(),WE=F.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))}),gfe=WE.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}}),uI=F.object({id:F.string().trim().min(1),type:F.string().trim().min(1),inputs:F.record(lfe),outputs:F.record(qce),label:F.string(),isOpen:F.boolean(),notes:F.string(),embedWorkflow:F.boolean(),isIntermediate:F.boolean(),useCache:F.boolean().optional(),version:WE.optional()}),mfe=F.preprocess(e=>{var t;try{const n=uI.parse(e);if(!Rne(n,"useCache")){const r=(t=PF.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},uI.extend({useCache:F.boolean()})),yfe=F.object({id:F.string().trim().min(1),type:F.literal("notes"),label:F.string(),isOpen:F.boolean(),notes:F.string()}),DF=F.object({x:F.number(),y:F.number()}).default({x:0,y:0}),k1=F.number().gt(0).nullish(),LF=F.object({id:F.string().trim().min(1),type:F.literal("invocation"),data:mfe,width:k1,height:k1,position:DF}),w5=e=>LF.safeParse(e).success,vfe=F.object({id:F.string().trim().min(1),type:F.literal("notes"),data:yfe,width:k1,height:k1,position:DF}),FF=F.discriminatedUnion("type",[LF,vfe]),bfe=F.object({source:F.string().trim().min(1),sourceHandle:F.string().trim().min(1),target:F.string().trim().min(1),targetHandle:F.string().trim().min(1),id:F.string().trim().min(1),type:F.literal("default")}),_fe=F.object({source:F.string().trim().min(1),target:F.string().trim().min(1),id:F.string().trim().min(1),type:F.literal("collapsed")}),BF=F.union([bfe,_fe]),Sfe=F.object({nodeId:F.string().trim().min(1),fieldName:F.string().trim().min(1)}),xfe="1.0.0",wfe=F.object({name:F.string().default(""),author:F.string().default(""),description:F.string().default(""),version:F.string().default(""),contact:F.string().default(""),tags:F.string().default(""),notes:F.string().default(""),nodes:F.array(FF).default([]),edges:F.array(BF).default([]),exposedFields:F.array(Sfe).default([]),meta:F.object({version:WE}).default({version:xfe})});wfe.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(w5),o=gE(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${ce.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${ce.t("nodes.doesNotExist")}`):c.push(`${ce.t("nodes.outputNode")} ${a.source} ${ce.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${ce.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${ce.t("nodes.doesNotExist")}`):c.push(`${ce.t("nodes.inputNode")} ${a.target} ${ce.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${ce.t("nodes.edge")} "${d} -> ${f}" ${ce.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const on=e=>!!(e&&e.type==="invocation"),Cze=e=>!!(e&&!["notes","current_image"].includes(e.type)),cI=e=>!!(e&&e.type==="notes");var wu=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(wu||{});const ue=No.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Bi(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Bi({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Bi({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Dt.addMany(Dt.getInitialState(),n)},merge:(t,n)=>{Dt.addMany(t,yg.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;yg.selectAll(i).forEach(o=>{n(ue.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:"images/intermediates"}),providesTags:["IntermediatesCount"]}),clearIntermediates:e.mutation({query:()=>({url:"images/intermediates",method:"DELETE"}),invalidatesTags:["IntermediatesCount"]}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],transformResponse:t=>{if(t){const n=pfe.safeParse(t);if(n.success)return n.data;ae("images").warn("Problem parsing metadata")}},keepUnusedDataFor:86400}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a=Tr.includes(t.image_category),s={board_id:o??"none",categories:Oi(t)},l=[];l.push(n(ue.util.updateQueryData("listImages",s,u=>{Dt.removeOne(u,i)}))),l.push(n(Qe.util.updateQueryData(a?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));try{await r}catch{l.forEach(u=>{u.undo()})}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=gE(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:Oi(s)};n(ue.util.updateQueryData("listImages",l,c=>{Dt.removeOne(c,a)}));const u=Tr.includes(s.image_category);n(Qe.util.updateQueryData(u?"getBoardAssetsTotal":"getBoardImagesTotal",s.board_id??"none",c=>{c.total=Math.max(c.total-1,0)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(ue.util.updateQueryData("getImageDTO",t.image_name,u=>{Object.assign(u,{is_intermediate:n})})));const s=Oi(t),l=Tr.includes(t.image_category);if(n)a.push(r(ue.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},u=>{Dt.removeOne(u,t.image_name)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));else{a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",p=>{p.total+=1})));const u={board_id:t.board_id??"none",categories:s},c=ue.endpoints.listImages.select(u)(o()),{data:d}=Ln.includes(t.image_category)?Qe.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=ou(c.data,t);(f||h)&&a.push(r(ue.util.updateQueryData("listImages",u,p=>{Dt.upsertOne(p,t)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(ue.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=Oi(r[0]),o=r[0].board_id??void 0;return[{type:"ImageList",id:Bi({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=Oi(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(ue.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=ue.endpoints.listImages.select(d)(i()),{data:h}=Ln.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(l??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=R0?ou(f.data,u):!0;(p||m)&&n(ue.util.updateQueryData("listImages",d,_=>{Dt.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=Oi(r[0]),o=r[0].board_id??void 0;return[{type:"ImageList",id:Bi({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=Oi(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(ue.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=ue.endpoints.listImages.select(d)(i()),{data:h}=Ln.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(l??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=R0?ou(f.data,u):!0;(p||m)&&n(ue.util.updateQueryData("listImages",d,_=>{Dt.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(ue.util.upsertQueryData("getImageDTO",i.image_name,i));const o=Oi(i);n(ue.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Dt.addOne(a,i)})),n(Qe.util.updateQueryData("getBoardAssetsTotal",i.board_id??"none",a=>{a.total+=1}))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:Pr},{type:"ImageList",id:Bi({board_id:"none",categories:Ln})},{type:"ImageList",id:Bi({board_id:"none",categories:Tr})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(ue.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))}),n(Qe.util.updateQueryData("getBoardAssetsTotal",t,l=>{l.total=0})),n(Qe.util.updateQueryData("getBoardImagesTotal",t,l=>{l.total=0}));const a=[{categories:Ln},{categories:Tr}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(ue.util.updateQueryData("listImages",l,u=>{Dt.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:Pr},{type:"ImageList",id:Bi({board_id:"none",categories:Ln})},{type:"ImageList",id:Bi({board_id:"none",categories:Tr})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:Ln},{categories:Tr}].forEach(s=>{n(ue.util.updateQueryData("listImages",s,l=>{Dt.removeMany(l,o)}))}),n(Qe.util.updateQueryData("getBoardAssetsTotal",t,s=>{s.total=0})),n(Qe.util.updateQueryData("getBoardImagesTotal",t,s=>{s.total=0}))}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r})=>[{type:"Board",id:r}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=Oi(n),l=Tr.includes(n.image_category);if(a.push(r(ue.util.updateQueryData("getImageDTO",n.image_name,u=>{u.board_id=t}))),!n.is_intermediate){a.push(r(ue.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},p=>{Dt.removeOne(p,n.image_name)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",n.board_id??"none",p=>{p.total=Math.max(p.total-1,0)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",p=>{p.total+=1})));const u={board_id:t??"none",categories:s},c=ue.endpoints.listImages.select(u)(o()),{data:d}=Ln.includes(n.image_category)?Qe.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=ou(c.data,n);(f||h)&&a.push(r(ue.util.updateQueryData("listImages",u,p=>{Dt.addOne(p,n)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=Oi(t),a=[],s=Tr.includes(t.image_category);a.push(n(ue.util.updateQueryData("getImageDTO",t.image_name,h=>{h.board_id=void 0}))),a.push(n(ue.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},h=>{Dt.removeOne(h,t.image_name)}))),a.push(n(Qe.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",h=>{h.total=Math.max(h.total-1,0)}))),a.push(n(Qe.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal","none",h=>{h.total+=1})));const l={board_id:"none",categories:o},u=ue.endpoints.listImages.select(l)(i()),{data:c}=Ln.includes(t.image_category)?Qe.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),d=u.data&&u.data.ids.length>=((c==null?void 0:c.total)??0),f=ou(u.data,t);(d||f)&&a.push(n(ue.util.updateQueryData("listImages",l,h=>{Dt.upsertOne(h,t)})));try{await r}catch{a.forEach(h=>h.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{board_id:r})=>[{type:"Board",id:r??"none"}],async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(ue.util.updateQueryData("getImageDTO",l,y=>{y.board_id=t==="none"?void 0:t}));const u=n.find(y=>y.image_name===l);if(!u)return;const c=Oi(u),d=u.board_id,f=Tr.includes(u.image_category);r(ue.util.updateQueryData("listImages",{board_id:d??"none",categories:c},y=>{Dt.removeOne(y,u.image_name)})),r(Qe.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",d??"none",y=>{y.total=Math.max(y.total-1,0)})),r(Qe.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",y=>{y.total+=1}));const h={board_id:t,categories:c},p=ue.endpoints.listImages.select(h)(o()),{data:m}=Ln.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(t??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(t??"none")(o()),_=p.data&&p.data.ids.length>=((m==null?void 0:m.total)??0),v=((m==null?void 0:m.total)??0)>=R0?ou(p.data,u):!0;(_||v)&&r(ue.util.updateQueryData("listImages",h,y=>{Dt.upsertOne(y,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||o.push({type:"Board",id:s})}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(ue.util.updateQueryData("getImageDTO",s,_=>{_.board_id=void 0}));const l=t.find(_=>_.image_name===s);if(!l)return;const u=Oi(l),c=Tr.includes(l.image_category);n(ue.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},_=>{Dt.removeOne(_,l.image_name)})),n(Qe.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal",l.board_id??"none",_=>{_.total=Math.max(_.total-1,0)})),n(Qe.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal","none",_=>{_.total+=1}));const d={board_id:"none",categories:u},f=ue.endpoints.listImages.select(d)(i()),{data:h}=Ln.includes(l.image_category)?Qe.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=R0?ou(f.data,l):!0;(p||m)&&n(ue.util.updateQueryData("listImages",d,_=>{Dt.upsertOne(_,{...l,board_id:"none"})}))})}catch{}}}),bulkDownloadImages:e.mutation({query:({image_names:t,board_id:n})=>({url:"images/download",method:"POST",body:{image_names:t,board_id:n}})})})}),{useGetIntermediatesCountQuery:Eze,useListImagesQuery:Aze,useLazyListImagesQuery:Tze,useGetImageDTOQuery:Pze,useGetImageMetadataQuery:kze,useDeleteImageMutation:Ize,useDeleteImagesMutation:Mze,useUploadImageMutation:Rze,useClearIntermediatesMutation:Oze,useAddImagesToBoardMutation:$ze,useRemoveImagesFromBoardMutation:Nze,useAddImageToBoardMutation:Dze,useRemoveImageFromBoardMutation:Lze,useChangeImageIsIntermediateMutation:Fze,useChangeImageSessionIdMutation:Bze,useDeleteBoardAndImagesMutation:zze,useDeleteBoardMutation:jze,useStarImagesMutation:Vze,useUnstarImagesMutation:Uze,useBulkDownloadImagesMutation:Gze}=ue,zF={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},jF=qt({name:"gallery",initialState:zF,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=c5(t.payload,n=>n.image_name)},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(Efe,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(Qe.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:ha,shouldAutoSwitchChanged:Hze,autoAssignBoardOnClickChanged:qze,setGalleryImageMinimumWidth:Wze,boardIdSelected:I1,autoAddBoardIdChanged:Kze,galleryViewChanged:C5,selectionChanged:VF,boardSearchTextChanged:Xze}=jF.actions,Cfe=jF.reducer,Efe=ai(ue.endpoints.deleteBoard.matchFulfilled,ue.endpoints.deleteBoardAndImages.matchFulfilled),dI={weight:.75},Afe={loras:{}},UF=qt({name:"lora",initialState:Afe,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...dI}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=dI.weight)}}}),{loraAdded:Qze,loraRemoved:GF,loraWeightChanged:Yze,loraWeightReset:Zze,lorasCleared:Jze,loraRecalled:eje}=UF.actions,Tfe=UF.reducer;function Ji(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},Pfe=e=>e?fI(e):fI,{useSyncExternalStoreWithSelector:kfe}=bse;function HF(e,t=e.getState,n){const r=kfe(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return k.useDebugValue(r),r}const hI=(e,t)=>{const n=Pfe(e),r=(i,o=t)=>HF(n,i,o);return Object.assign(r,n),r},Ife=(e,t)=>e?hI(e,t):hI;function ri(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function Y_(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Hy.prototype=Y_.prototype={constructor:Hy,on:function(e,t){var n=this._,r=Rfe(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),gI.hasOwnProperty(t)?{space:gI[t],local:e}:e}function $fe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===E5&&t.documentElement.namespaceURI===E5?t.createElement(e):t.createElementNS(n,e)}}function Nfe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qF(e){var t=Z_(e);return(t.local?Nfe:$fe)(t)}function Dfe(){}function KE(e){return e==null?Dfe:function(){return this.querySelector(e)}}function Lfe(e){typeof e!="function"&&(e=KE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=y+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function lhe(e){e||(e=uhe);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function che(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dhe(){return Array.from(this)}function fhe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?whe:typeof t=="function"?Ehe:Che)(e,t,n??"")):yf(this.node(),e)}function yf(e,t){return e.style.getPropertyValue(t)||YF(e).getComputedStyle(e,null).getPropertyValue(t)}function The(e){return function(){delete this[e]}}function Phe(e,t){return function(){this[e]=t}}function khe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ihe(e,t){return arguments.length>1?this.each((t==null?The:typeof t=="function"?khe:Phe)(e,t)):this.node()[e]}function ZF(e){return e.trim().split(/^|\s+/)}function XE(e){return e.classList||new JF(e)}function JF(e){this._node=e,this._names=ZF(e.getAttribute("class")||"")}JF.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function eB(e,t){for(var n=XE(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ipe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function A5(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}A5.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ppe(e){return!e.ctrlKey&&!e.button}function gpe(){return this.parentNode}function mpe(e,t){return t??{x:e.x,y:e.y}}function ype(){return navigator.maxTouchPoints||"ontouchstart"in this}function vpe(){var e=ppe,t=gpe,n=mpe,r=ype,i={},o=Y_("start","drag","end"),a=0,s,l,u,c,d=0;function f(b){b.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",v,hpe).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(b,S){if(!(c||!e.call(this,b,S))){var x=g(this,t.call(this,b,S),b,S,"mouse");x&&(_o(b.view).on("mousemove.drag",p,Sg).on("mouseup.drag",m,Sg),iB(b.view),Gx(b),u=!1,s=b.clientX,l=b.clientY,x("start",b))}}function p(b){if(Dd(b),!u){var S=b.clientX-s,x=b.clientY-l;u=S*S+x*x>d}i.mouse("drag",b)}function m(b){_o(b.view).on("mousemove.drag mouseup.drag",null),oB(b.view,u),Dd(b),i.mouse("end",b)}function _(b,S){if(e.call(this,b,S)){var x=b.changedTouches,w=t.call(this,b,S),C=x.length,T,A;for(T=0;T>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?D0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?D0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_pe.exec(e))?new Qr(t[1],t[2],t[3],1):(t=Spe.exec(e))?new Qr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xpe.exec(e))?D0(t[1],t[2],t[3],t[4]):(t=wpe.exec(e))?D0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Cpe.exec(e))?xI(t[1],t[2]/100,t[3]/100,1):(t=Epe.exec(e))?xI(t[1],t[2]/100,t[3]/100,t[4]):mI.hasOwnProperty(e)?bI(mI[e]):e==="transparent"?new Qr(NaN,NaN,NaN,0):null}function bI(e){return new Qr(e>>16&255,e>>8&255,e&255,1)}function D0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Qr(e,t,n,r)}function Ppe(e){return e instanceof Tm||(e=Cg(e)),e?(e=e.rgb(),new Qr(e.r,e.g,e.b,e.opacity)):new Qr}function T5(e,t,n,r){return arguments.length===1?Ppe(e):new Qr(e,t,n,r??1)}function Qr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}QE(Qr,T5,aB(Tm,{brighter(e){return e=e==null?R1:Math.pow(R1,e),new Qr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xg:Math.pow(xg,e),new Qr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qr(Uu(this.r),Uu(this.g),Uu(this.b),O1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_I,formatHex:_I,formatHex8:kpe,formatRgb:SI,toString:SI}));function _I(){return`#${Mu(this.r)}${Mu(this.g)}${Mu(this.b)}`}function kpe(){return`#${Mu(this.r)}${Mu(this.g)}${Mu(this.b)}${Mu((isNaN(this.opacity)?1:this.opacity)*255)}`}function SI(){const e=O1(this.opacity);return`${e===1?"rgb(":"rgba("}${Uu(this.r)}, ${Uu(this.g)}, ${Uu(this.b)}${e===1?")":`, ${e})`}`}function O1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Uu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mu(e){return e=Uu(e),(e<16?"0":"")+e.toString(16)}function xI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new So(e,t,n,r)}function sB(e){if(e instanceof So)return new So(e.h,e.s,e.l,e.opacity);if(e instanceof Tm||(e=Cg(e)),!e)return new So;if(e instanceof So)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new So(a,s,l,e.opacity)}function Ipe(e,t,n,r){return arguments.length===1?sB(e):new So(e,t,n,r??1)}function So(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}QE(So,Ipe,aB(Tm,{brighter(e){return e=e==null?R1:Math.pow(R1,e),new So(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xg:Math.pow(xg,e),new So(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Qr(Hx(e>=240?e-240:e+120,i,r),Hx(e,i,r),Hx(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new So(wI(this.h),L0(this.s),L0(this.l),O1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=O1(this.opacity);return`${e===1?"hsl(":"hsla("}${wI(this.h)}, ${L0(this.s)*100}%, ${L0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function wI(e){return e=(e||0)%360,e<0?e+360:e}function L0(e){return Math.max(0,Math.min(1,e||0))}function Hx(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const lB=e=>()=>e;function Mpe(e,t){return function(n){return e+n*t}}function Rpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Ope(e){return(e=+e)==1?uB:function(t,n){return n-t?Rpe(t,n,e):lB(isNaN(t)?n:t)}}function uB(e,t){var n=t-e;return n?Mpe(e,n):lB(isNaN(e)?t:e)}const CI=function e(t){var n=Ope(t);function r(i,o){var a=n((i=T5(i)).r,(o=T5(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=uB(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function qs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var P5=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qx=new RegExp(P5.source,"g");function $pe(e){return function(){return e}}function Npe(e){return function(t){return e(t)+""}}function Dpe(e,t){var n=P5.lastIndex=qx.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=P5.exec(e))&&(i=qx.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:qs(r,i)})),n=qx.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:qs(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:qs(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:qs(u,d)},{i:m-2,x:qs(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--vf}function TI(){ac=(N1=Eg.now())+J_,vf=Bh=0;try{qpe()}finally{vf=0,Kpe(),ac=0}}function Wpe(){var e=Eg.now(),t=e-N1;t>fB&&(J_-=t,N1=e)}function Kpe(){for(var e,t=$1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$1=n);zh=e,I5(r)}function I5(e){if(!vf){Bh&&(Bh=clearTimeout(Bh));var t=e-ac;t>24?(e<1/0&&(Bh=setTimeout(TI,e-Eg.now()-J_)),ch&&(ch=clearInterval(ch))):(ch||(N1=Eg.now(),ch=setInterval(Wpe,fB)),vf=1,hB(TI))}}function PI(e,t,n){var r=new D1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Xpe=Y_("start","end","cancel","interrupt"),Qpe=[],gB=0,kI=1,M5=2,qy=3,II=4,R5=5,Wy=6;function eS(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Ype(e,n,{name:t,index:r,group:i,on:Xpe,tween:Qpe,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:gB})}function ZE(e,t){var n=Bo(e,t);if(n.state>gB)throw new Error("too late; already scheduled");return n}function Pa(e,t){var n=Bo(e,t);if(n.state>qy)throw new Error("too late; already running");return n}function Bo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ype(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=pB(o,0,n.time);function o(u){n.state=kI,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==kI)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===qy)return PI(a);h.state===II?(h.state=Wy,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cM5&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Tge(e,t,n){var r,i,o=Age(t)?ZE:Pa;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function Pge(e,t){var n=this._id;return arguments.length<2?Bo(this.node(),n).on.on(e):this.each(Tge(n,e,t))}function kge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ige(){return this.on("end.remove",kge(this._id))}function Mge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=KE(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function nme(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Za(e,t,n){this.k=e,this.x=t,this.y=n}Za.prototype={constructor:Za,scale:function(e){return e===1?this:new Za(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Za(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vl=new Za(1,0,0);Za.prototype;function Wx(e){e.stopImmediatePropagation()}function dh(e){e.preventDefault(),e.stopImmediatePropagation()}function rme(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ime(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function MI(){return this.__zoom||vl}function ome(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ame(){return navigator.maxTouchPoints||"ontouchstart"in this}function sme(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function lme(){var e=rme,t=ime,n=sme,r=ome,i=ame,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=Gpe,u=Y_("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function v(E){E.property("__zoom",MI).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(E,P,N,L){var O=E.selection?E.selection():E;O.property("__zoom",MI),E!==O?S(E,P,N,L):O.interrupt().each(function(){x(this,arguments).event(L).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},v.scaleBy=function(E,P,N,L){v.scaleTo(E,function(){var O=this.__zoom.k,R=typeof P=="function"?P.apply(this,arguments):P;return O*R},N,L)},v.scaleTo=function(E,P,N,L){v.transform(E,function(){var O=t.apply(this,arguments),R=this.__zoom,$=N==null?b(O):typeof N=="function"?N.apply(this,arguments):N,z=R.invert($),V=typeof P=="function"?P.apply(this,arguments):P;return n(g(y(R,V),$,z),O,a)},N,L)},v.translateBy=function(E,P,N,L){v.transform(E,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,L)},v.translateTo=function(E,P,N,L,O){v.transform(E,function(){var R=t.apply(this,arguments),$=this.__zoom,z=L==null?b(R):typeof L=="function"?L.apply(this,arguments):L;return n(vl.translate(z[0],z[1]).scale($.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof N=="function"?-N.apply(this,arguments):-N),R,a)},L,O)};function y(E,P){return P=Math.max(o[0],Math.min(o[1],P)),P===E.k?E:new Za(P,E.x,E.y)}function g(E,P,N){var L=P[0]-N[0]*E.k,O=P[1]-N[1]*E.k;return L===E.x&&O===E.y?E:new Za(E.k,L,O)}function b(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,P,N,L){E.on("start.zoom",function(){x(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(L).end()}).tween("zoom",function(){var O=this,R=arguments,$=x(O,R).event(L),z=t.apply(O,R),V=N==null?b(z):typeof N=="function"?N.apply(O,R):N,H=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),Q=O.__zoom,Z=typeof P=="function"?P.apply(O,R):P,J=l(Q.invert(V).concat(H/Q.k),Z.invert(V).concat(H/Z.k));return function(j){if(j===1)j=Z;else{var X=J(j),ee=H/X[2];j=new Za(ee,V[0]-X[0]*ee,V[1]-X[1]*ee)}$.zoom(null,j)}})}function x(E,P,N){return!N&&E.__zooming||new w(E,P)}function w(E,P){this.that=E,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,P),this.taps=0}w.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,P){return this.mouse&&E!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var P=_o(this.that).datum();u.call(E,this.that,new nme(E,{sourceEvent:this.sourceEvent,target:v,type:E,transform:this.that.__zoom,dispatch:u}),P)}};function C(E,...P){if(!e.apply(this,arguments))return;var N=x(this,P).event(E),L=this.__zoom,O=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=Qo(E);if(N.wheel)(N.mouse[0][0]!==R[0]||N.mouse[0][1]!==R[1])&&(N.mouse[1]=L.invert(N.mouse[0]=R)),clearTimeout(N.wheel);else{if(L.k===O)return;N.mouse=[R,L.invert(R)],Ky(this),N.start()}dh(E),N.wheel=setTimeout($,p),N.zoom("mouse",n(g(y(L,O),N.mouse[0],N.mouse[1]),N.extent,a));function $(){N.wheel=null,N.end()}}function T(E,...P){if(f||!e.apply(this,arguments))return;var N=E.currentTarget,L=x(this,P,!0).event(E),O=_o(E.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",H,!0),R=Qo(E,N),$=E.clientX,z=E.clientY;iB(E.view),Wx(E),L.mouse=[R,this.__zoom.invert(R)],Ky(this),L.start();function V(Q){if(dh(Q),!L.moved){var Z=Q.clientX-$,J=Q.clientY-z;L.moved=Z*Z+J*J>m}L.event(Q).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=Qo(Q,N),L.mouse[1]),L.extent,a))}function H(Q){O.on("mousemove.zoom mouseup.zoom",null),oB(Q.view,L.moved),dh(Q),L.event(Q).end()}}function A(E,...P){if(e.apply(this,arguments)){var N=this.__zoom,L=Qo(E.changedTouches?E.changedTouches[0]:E,this),O=N.invert(L),R=N.k*(E.shiftKey?.5:2),$=n(g(y(N,R),L,O),t.apply(this,P),a);dh(E),s>0?_o(this).transition().duration(s).call(S,$,L,E):_o(this).call(v.transform,$,L,E)}}function I(E,...P){if(e.apply(this,arguments)){var N=E.touches,L=N.length,O=x(this,P,E.changedTouches.length===L).event(E),R,$,z,V;for(Wx(E),$=0;$"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},bB=ys.error001();function dn(e,t){const n=k.useContext(tS);if(n===null)throw new Error(bB);return HF(n,e,t)}const qn=()=>{const e=k.useContext(tS);if(e===null)throw new Error(bB);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},cme=e=>e.userSelectionActive?"none":"all";function dme({position:e,children:t,className:n,style:r,...i}){const o=dn(cme),a=`${e}`.split("-");return q.jsx("div",{className:Ji(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function fme({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:q.jsx(dme,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:q.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const hme=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=k.useRef(null),[f,h]=k.useState({x:0,y:0,width:0,height:0}),p=Ji(["react-flow__edge-textwrapper",u]);return k.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:q.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&q.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),q.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var pme=k.memo(hme);const eA=e=>({width:e.offsetWidth,height:e.offsetHeight}),bf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),tA=(e={x:0,y:0},t)=>({x:bf(e.x,t[0][0],t[1][0]),y:bf(e.y,t[0][1],t[1][1])}),RI=(e,t,n)=>en?-bf(Math.abs(e-n),1,50)/50:0,_B=(e,t)=>{const n=RI(e.x,35,t.width-35)*20,r=RI(e.y,35,t.height-35)*20;return[n,r]},SB=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},xB=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ag=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),wB=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),OI=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),tje=(e,t)=>wB(xB(Ag(e),Ag(t))),O5=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},gme=e=>qi(e.width)&&qi(e.height)&&qi(e.x)&&qi(e.y),qi=e=>!isNaN(e)&&isFinite(e),Mn=Symbol.for("internals"),CB=["Enter"," ","Escape"],mme=(e,t)=>{},yme=e=>"nativeEvent"in e;function $5(e){var i,o;const t=yme(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const EB=e=>"clientX"in e,bl=(e,t)=>{var o,a;const n=EB(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},L1=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Pm=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>q.jsxs(q.Fragment,{children:[q.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&q.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&qi(n)&&qi(r)?q.jsx(pme,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});Pm.displayName="BaseEdge";function fh(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function AB({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,v,y]=PB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return q.jsx(Pm,{path:_,labelX:v,labelY:y,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});nA.displayName="SimpleBezierEdge";const NI={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}},vme=({source:e,sourcePosition:t=Te.Bottom,target:n})=>t===Te.Left||t===Te.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bme({source:e,sourcePosition:t=Te.Bottom,target:n,targetPosition:r=Te.Top,center:i,offset:o}){const a=NI[t],s=NI[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=vme({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},v={x:0,y:0},[y,g,b,S]=AB({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||y,m=i.y||g;const w=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?w:C:h=d==="x"?C:w}else{const w=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:w:h=a.y===f?w:C,t===r){const M=Math.abs(e[d]-n[d]);if(M<=o){const E=Math.min(o-1,o-M);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*E:v[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const M=d==="x"?"y":"x",E=a[d]===s[M],P=l[M]>u[M],N=l[M]=D?(p=(T.x+A.x)/2,m=h[0].y):(p=h[0].x,m=(T.y+A.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+v.x,y:u.y+v.y},n],p,m,b,S]}function _me(e,t,n,r){const i=Math.min(DI(e,t)/2,DI(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return y>0&&y{const[v,y,g]=N5({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return q.jsx(Pm,{path:v,labelX:y,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});nS.displayName="SmoothStepEdge";const rA=k.memo(e=>{var t;return q.jsx(nS,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});rA.displayName="StepEdge";function Sme({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=AB({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const iA=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=Sme({sourceX:e,sourceY:t,targetX:n,targetY:r});return q.jsx(Pm,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});iA.displayName="StraightEdge";function z0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function LI({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Te.Left:return[t-z0(t-r,o),n];case Te.Right:return[t+z0(r-t,o),n];case Te.Top:return[t,n-z0(n-i,o)];case Te.Bottom:return[t,n+z0(i-n,o)]}}function kB({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:i,targetPosition:o=Te.Top,curvature:a=.25}){const[s,l]=LI({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=LI({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=TB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const B1=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Te.Bottom,targetPosition:o=Te.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[v,y,g]=kB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return q.jsx(Pm,{path:v,labelX:y,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});B1.displayName="BezierEdge";const oA=k.createContext(null),xme=oA.Provider;oA.Consumer;const wme=()=>k.useContext(oA),Cme=e=>"id"in e&&"source"in e&&"target"in e,IB=e=>"id"in e&&!("source"in e)&&!("target"in e),Eme=(e,t,n)=>{if(!IB(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},Ame=(e,t,n)=>{if(!IB(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},MB=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,D5=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Tme=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),jh=(e,t)=>{if(!e.source||!e.target)return t;let n;return Cme(e)?n={...e}:n={...e,id:MB(e)},Tme(n,t)?t:t.concat(n)},Pme=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?MB(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},RB=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},kme=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),Fd=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},aA=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=Fd(i,t).positionAbsolute;return xB(r,Ag({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return wB(n)},OB=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=Fd(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},v=O5(l,_),y=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&v>0,b=(d||0)*(f||0);(y||g||v>=b||c.dragging)&&u.push(c)}),u},sA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},$B=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=bf(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},mu=(e,t=0)=>e.transition().duration(t);function FI(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function Ime(e,t,n,r,i,o){const{x:a,y:s}=bl(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=lA(void 0,u),_=u.getAttribute("data-handleid"),v=o({nodeId:p,id:_,type:m});if(v)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:v}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const Mme={source:null,target:null,sourceHandle:null,targetHandle:null},NB=()=>({handleDomNode:null,isValid:!1,connection:Mme,endHandle:null});function DB(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...NB(),handleDomNode:l};if(l){const c=lA(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===sc.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function Rme({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Mn]){const{handleBounds:a}=o[Mn];let s=[],l=[];a&&(s=FI(o,a,"source",`${t}-${n}-${r}`),l=FI(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function lA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Kx(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Ome(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function LB({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=SB(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:v,cancelConnection:y}=o();let g=0,b;const{x:S,y:x}=bl(e),w=c==null?void 0:c.elementFromPoint(S,x),C=lA(l,w),T=f==null?void 0:f.getBoundingClientRect();if(!T||!C)return;let A,I=bl(e,T),D=!1,M=null,E=!1,P=null;const N=Rme({nodes:v(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[$,z]=_B(I,T);_({x:$,y:z}),g=requestAnimationFrame(L)};a({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function O($){const{transform:z}=o();I=bl($,T);const{handle:V,validHandleResult:H}=Ime($,c,RB(I,z,!1,[1,1]),p,N,Q=>DB(Q,d,n,t,i?"target":"source",s,c));if(b=V,D||(L(),D=!0),P=H.handleDomNode,M=H.connection,E=H.isValid,a({connectionPosition:b&&E?kme({x:b.x,y:b.y},z):I,connectionStatus:Ome(!!b,E),connectionEndHandle:H.endHandle}),!b&&!E&&!P)return Kx(A);M.source!==M.target&&P&&(Kx(A),A=P,P.classList.add("connecting","react-flow__handle-connecting"),P.classList.toggle("valid",E),P.classList.toggle("react-flow__handle-valid",E))}function R($){var z,V;(b||P)&&M&&E&&(r==null||r(M)),(V=(z=o()).onConnectEnd)==null||V.call(z,$),l&&(u==null||u($)),Kx(A),y(),cancelAnimationFrame(g),D=!1,E=!1,M=null,P=null,c.removeEventListener("mousemove",O),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",O),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",O),c.addEventListener("mouseup",R),c.addEventListener("touchmove",O),c.addEventListener("touchend",R)}const BI=()=>!0,$me=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Nme=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},FB=k.forwardRef(({type:e="source",position:t=Te.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var T,A;const p=a||null,m=e==="target",_=qn(),v=wme(),{connectOnClick:y,noPanClassName:g}=dn($me,ri),{connecting:b,clickConnecting:S}=dn(Nme(v,p,e),ri);v||(A=(T=_.getState()).onError)==null||A.call(T,"010",ys.error010());const x=I=>{const{defaultEdgeOptions:D,onConnect:M,hasDefaultEdges:E}=_.getState(),P={...D,...I};if(E){const{edges:N,setEdges:L}=_.getState();L(jh(P,N))}M==null||M(P),s==null||s(P)},w=I=>{if(!v)return;const D=EB(I);i&&(D&&I.button===0||!D)&&LB({event:I,handleId:p,nodeId:v,onConnect:x,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||BI}),D?c==null||c(I):d==null||d(I)},C=I=>{const{onClickConnectStart:D,onClickConnectEnd:M,connectionClickStartHandle:E,connectionMode:P,isValidConnection:N}=_.getState();if(!v||!E&&!i)return;if(!E){D==null||D(I,{nodeId:v,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:v,type:e,handleId:p}});return}const L=SB(I.target),O=n||N||BI,{connection:R,isValid:$}=DB({nodeId:v,id:p,type:e},P,E.nodeId,E.handleId||null,E.type,O,L);$&&x(R),M==null||M(I),_.setState({connectionClickStartHandle:null})};return q.jsx("div",{"data-handleid":p,"data-nodeid":v,"data-handlepos":t,"data-id":`${v}-${p}-${e}`,className:Ji(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!b||o&&b)}]),onMouseDown:w,onTouchStart:w,onClick:y?C:void 0,ref:h,...f,children:l})});FB.displayName="Handle";var z1=k.memo(FB);const BB=({data:e,isConnectable:t,targetPosition:n=Te.Top,sourcePosition:r=Te.Bottom})=>q.jsxs(q.Fragment,{children:[q.jsx(z1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,q.jsx(z1,{type:"source",position:r,isConnectable:t})]});BB.displayName="DefaultNode";var L5=k.memo(BB);const zB=({data:e,isConnectable:t,sourcePosition:n=Te.Bottom})=>q.jsxs(q.Fragment,{children:[e==null?void 0:e.label,q.jsx(z1,{type:"source",position:n,isConnectable:t})]});zB.displayName="InputNode";var jB=k.memo(zB);const VB=({data:e,isConnectable:t,targetPosition:n=Te.Top})=>q.jsxs(q.Fragment,{children:[q.jsx(z1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});VB.displayName="OutputNode";var UB=k.memo(VB);const uA=()=>null;uA.displayName="GroupNode";const Dme=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),j0=e=>e.id;function Lme(e,t){return ri(e.selectedNodes.map(j0),t.selectedNodes.map(j0))&&ri(e.selectedEdges.map(j0),t.selectedEdges.map(j0))}const GB=k.memo(({onSelectionChange:e})=>{const t=qn(),{selectedNodes:n,selectedEdges:r}=dn(Dme,Lme);return k.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});GB.displayName="SelectionListener";const Fme=e=>!!e.onSelectionChange;function Bme({onSelectionChange:e}){const t=dn(Fme);return e||t?q.jsx(GB,{onSelectionChange:e}):null}const zme=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function $c(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ge(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const jme=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:v,onNodesChange:y,onEdgesChange:g,elementsSelectable:b,connectionMode:S,snapGrid:x,snapToGrid:w,translateExtent:C,connectOnClick:T,defaultEdgeOptions:A,fitView:I,fitViewOptions:D,onNodesDelete:M,onEdgesDelete:E,onNodeDrag:P,onNodeDragStart:N,onNodeDragStop:L,onSelectionDrag:O,onSelectionDragStart:R,onSelectionDragStop:$,noPanClassName:z,nodeOrigin:V,rfId:H,autoPanOnConnect:Q,autoPanOnNodeDrag:Z,onError:J,connectionRadius:j,isValidConnection:X})=>{const{setNodes:ee,setEdges:ne,setDefaultNodesAndEdges:fe,setMinZoom:de,setMaxZoom:Be,setTranslateExtent:$e,setNodeExtent:Ce,reset:Ke}=dn(zme,ri),be=qn();return k.useEffect(()=>{const zt=r==null?void 0:r.map(Wn=>({...Wn,...A}));return fe(n,zt),()=>{Ke()}},[]),Ge("defaultEdgeOptions",A,be.setState),Ge("connectionMode",S,be.setState),Ge("onConnect",i,be.setState),Ge("onConnectStart",o,be.setState),Ge("onConnectEnd",a,be.setState),Ge("onClickConnectStart",s,be.setState),Ge("onClickConnectEnd",l,be.setState),Ge("nodesDraggable",u,be.setState),Ge("nodesConnectable",c,be.setState),Ge("nodesFocusable",d,be.setState),Ge("edgesFocusable",f,be.setState),Ge("edgesUpdatable",h,be.setState),Ge("elementsSelectable",b,be.setState),Ge("elevateNodesOnSelect",p,be.setState),Ge("snapToGrid",w,be.setState),Ge("snapGrid",x,be.setState),Ge("onNodesChange",y,be.setState),Ge("onEdgesChange",g,be.setState),Ge("connectOnClick",T,be.setState),Ge("fitViewOnInit",I,be.setState),Ge("fitViewOnInitOptions",D,be.setState),Ge("onNodesDelete",M,be.setState),Ge("onEdgesDelete",E,be.setState),Ge("onNodeDrag",P,be.setState),Ge("onNodeDragStart",N,be.setState),Ge("onNodeDragStop",L,be.setState),Ge("onSelectionDrag",O,be.setState),Ge("onSelectionDragStart",R,be.setState),Ge("onSelectionDragStop",$,be.setState),Ge("noPanClassName",z,be.setState),Ge("nodeOrigin",V,be.setState),Ge("rfId",H,be.setState),Ge("autoPanOnConnect",Q,be.setState),Ge("autoPanOnNodeDrag",Z,be.setState),Ge("onError",J,be.setState),Ge("connectionRadius",j,be.setState),Ge("isValidConnection",X,be.setState),$c(e,ee),$c(t,ne),$c(m,de),$c(_,Be),$c(C,$e),$c(v,Ce),null},zI={display:"none"},Vme={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},HB="react-flow__node-desc",qB="react-flow__edge-desc",Ume="react-flow__aria-live",Gme=e=>e.ariaLiveMessage;function Hme({rfId:e}){const t=dn(Gme);return q.jsx("div",{id:`${Ume}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Vme,children:t})}function qme({rfId:e,disableKeyboardA11y:t}){return q.jsxs(q.Fragment,{children:[q.jsxs("div",{id:`${HB}-${e}`,style:zI,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),q.jsx("div",{id:`${qB}-${e}`,style:zI,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&q.jsx(Hme,{rfId:e})]})}const Wme=typeof document<"u"?document:null;var Tg=(e=null,t={target:Wme})=>{const[n,r]=k.useState(!1),i=k.useRef(!1),o=k.useRef(new Set([])),[a,s]=k.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return k.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&$5(h))return!1;const p=VI(h.code,s);o.current.add(h[p]),jI(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&$5(h))return!1;const p=VI(h.code,s);jI(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function jI(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function VI(e,t){return t.includes(e)?"code":"key"}function WB(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=Fd(i,r);return WB(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Mn])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Mn])==null?void 0:s.z)??0:n.z??0},r)}function KB(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=WB(r,e,{...r.position,z:((i=r[Mn])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Mn].z=s,n!=null&&n[r.id]&&(r[Mn].isParent=!0)}})}function Xx(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(qi(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Mn,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Mn])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),KB(i,n,o),i}function XB(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var y;const v=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(y=t.nodes)!=null&&y.length?v&&t.nodes.some(g=>g.id===_.id):v}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=aA(p,d),[v,y,g]=$B(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),b=vl.translate(v,y).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(mu(l,t.duration),b):s.transform(l,b),!0}}return!1}function Kme(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Mn]:r[Mn],selected:n.selected})}),new Map(t)}function Xme(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function V0({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Kme(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:Xme(t,o)}),s==null||s(t))}const Nc=()=>{},Qme={zoomIn:Nc,zoomOut:Nc,zoomTo:Nc,getZoom:()=>1,setViewport:Nc,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Nc,fitBounds:Nc,project:e=>e,viewportInitialized:!1},Yme=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Zme=()=>{const e=qn(),{d3Zoom:t,d3Selection:n}=dn(Yme,ri);return k.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(mu(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(mu(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(mu(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=vl.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(mu(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>XB(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=vl.translate(d,f).scale(c);t.transform(mu(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=$B(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=vl.translate(c,d).scale(f);t.transform(mu(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return RB(i,o,a,s)},viewportInitialized:!0}:Qme,[t,n])};function QB(){const e=Zme(),t=qn(),n=k.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=k.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=k.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=k.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(v=>v.id===m)},[]),a=k.useCallback(m=>{const{getNodes:_,setNodes:v,hasDefaultNodes:y,onNodesChange:g}=t.getState(),b=_(),S=typeof m=="function"?m(b):m;if(y)v(S);else if(g){const x=S.length===0?b.map(w=>({type:"remove",id:w.id})):S.map(w=>({item:w,type:"reset"}));g(x)}},[]),s=k.useCallback(m=>{const{edges:_=[],setEdges:v,hasDefaultEdges:y,onEdgesChange:g}=t.getState(),b=typeof m=="function"?m(_):m;if(y)v(b);else if(g){const S=b.length===0?_.map(x=>({type:"remove",id:x.id})):b.map(x=>({item:x,type:"reset"}));g(S)}},[]),l=k.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:v,setNodes:y,hasDefaultNodes:g,onNodesChange:b}=t.getState();if(g){const x=[...v(),..._];y(x)}else if(b){const S=_.map(x=>({item:x,type:"add"}));b(S)}},[]),u=k.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:v=[],setEdges:y,hasDefaultEdges:g,onEdgesChange:b}=t.getState();if(g)y([...v,..._]);else if(b){const S=_.map(x=>({item:x,type:"add"}));b(S)}},[]),c=k.useCallback(()=>{const{getNodes:m,edges:_=[],transform:v}=t.getState(),[y,g,b]=v;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:y,y:g,zoom:b}}},[]),d=k.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:v,getNodes:y,edges:g,hasDefaultNodes:b,hasDefaultEdges:S,onNodesDelete:x,onEdgesDelete:w,onNodesChange:C,onEdgesChange:T}=t.getState(),A=(m||[]).map(P=>P.id),I=(_||[]).map(P=>P.id),D=y().reduce((P,N)=>{const L=!A.includes(N.id)&&N.parentNode&&P.find(R=>R.id===N.parentNode);return(typeof N.deletable=="boolean"?N.deletable:!0)&&(A.includes(N.id)||L)&&P.push(N),P},[]),M=g.filter(P=>typeof P.deletable=="boolean"?P.deletable:!0),E=M.filter(P=>I.includes(P.id));if(D||E){const P=sA(D,M),N=[...E,...P],L=N.reduce((O,R)=>(O.includes(R.id)||O.push(R.id),O),[]);if((S||b)&&(S&&t.setState({edges:g.filter(O=>!L.includes(O.id))}),b&&(D.forEach(O=>{v.delete(O.id)}),t.setState({nodeInternals:new Map(v)}))),L.length>0&&(w==null||w(N),T&&T(L.map(O=>({id:O,type:"remove"})))),D.length>0&&(x==null||x(D),C)){const O=D.map(R=>({id:R.id,type:"remove"}));C(O)}}},[]),f=k.useCallback(m=>{const _=gme(m),v=_?null:t.getState().nodeInternals.get(m.id);return[_?m:OI(v),v,_]},[]),h=k.useCallback((m,_=!0,v)=>{const[y,g,b]=f(m);return y?(v||t.getState().getNodes()).filter(S=>{if(!b&&(S.id===g.id||!S.positionAbsolute))return!1;const x=OI(S),w=O5(x,y);return _&&w>0||w>=m.width*m.height}):[]},[]),p=k.useCallback((m,_,v=!0)=>{const[y]=f(m);if(!y)return!1;const g=O5(y,_);return v&&g>0||g>=m.width*m.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var Jme=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=qn(),{deleteElements:r}=QB(),i=Tg(e),o=Tg(t);k.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function e0e(e){const t=qn();k.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=eA(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",ys.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const cA={position:"absolute",width:"100%",height:"100%",top:0,left:0},t0e=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,U0=e=>({x:e.x,y:e.y,zoom:e.k}),Dc=(e,t)=>e.target.closest(`.${t}`),UI=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),GI=e=>{const t=e.ctrlKey&&L1()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},n0e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),r0e=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=Ru.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:v=!0,children:y,noWheelClassName:g,noPanClassName:b})=>{const S=k.useRef(),x=qn(),w=k.useRef(!1),C=k.useRef(!1),T=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:M,userSelectionActive:E}=dn(n0e,ri),P=Tg(_),N=k.useRef(0),L=k.useRef(!1),O=k.useRef();return e0e(T),k.useEffect(()=>{if(T.current){const R=T.current.getBoundingClientRect(),$=lme().scaleExtent([p,m]).translateExtent(h),z=_o(T.current).call($),V=vl.translate(f.x,f.y).scale(bf(f.zoom,p,m)),H=[[0,0],[R.width,R.height]],Q=$.constrain()(V,H,h);$.transform(z,Q),$.wheelDelta(GI),x.setState({d3Zoom:$,d3Selection:z,d3ZoomHandler:z.on("wheel.zoom"),transform:[Q.x,Q.y,Q.k],domNode:T.current.closest(".react-flow")})}},[]),k.useEffect(()=>{D&&I&&(a&&!P&&!E?D.on("wheel.zoom",R=>{if(Dc(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const $=D.property("__zoom").k||1,z=L1();if(R.ctrlKey&&o&&z){const ee=Qo(R),ne=GI(R),fe=$*Math.pow(2,ne);I.scaleTo(D,fe,ee,R);return}const V=R.deltaMode===1?20:1;let H=l===Ru.Vertical?0:R.deltaX*V,Q=l===Ru.Horizontal?0:R.deltaY*V;!z&&R.shiftKey&&l!==Ru.Vertical&&(H=R.deltaY*V,Q=0),I.translateBy(D,-(H/$)*s,-(Q/$)*s,{internal:!0});const Z=U0(D.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:X}=x.getState();clearTimeout(O.current),L.current||(L.current=!0,t==null||t(R,Z),J==null||J(Z)),L.current&&(e==null||e(R,Z),j==null||j(Z),O.current=setTimeout(()=>{n==null||n(R,Z),X==null||X(Z),L.current=!1},150))},{passive:!1}):typeof M<"u"&&D.on("wheel.zoom",function(R,$){if(!v||Dc(R,g))return null;R.preventDefault(),M.call(this,R,$)},{passive:!1}))},[E,a,l,D,I,M,P,o,v,g,t,e,n]),k.useEffect(()=>{I&&I.on("start",R=>{var V,H;if(!R.sourceEvent||R.sourceEvent.internal)return null;N.current=(V=R.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:$}=x.getState(),z=U0(R.transform);w.current=!0,A.current=z,((H=R.sourceEvent)==null?void 0:H.type)==="mousedown"&&x.setState({paneDragging:!0}),$==null||$(z),t==null||t(R.sourceEvent,z)})},[I,t]),k.useEffect(()=>{I&&(E&&!w.current?I.on("zoom",null):E||I.on("zoom",R=>{var z;const{onViewportChange:$}=x.getState();if(x.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&UI(d,N.current??0)),(e||$)&&!((z=R.sourceEvent)!=null&&z.internal)){const V=U0(R.transform);$==null||$(V),e==null||e(R.sourceEvent,V)}}))},[E,I,e,d,r]),k.useEffect(()=>{I&&I.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=x.getState();if(w.current=!1,x.setState({paneDragging:!1}),r&&UI(d,N.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||$)&&t0e(A.current,R.transform)){const z=U0(R.transform);A.current=z,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(z),n==null||n(R.sourceEvent,z)},a?150:0)}})},[I,a,d,n,r]),k.useEffect(()=>{I&&I.filter(R=>{const $=P||i,z=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(Dc(R,"react-flow__node")||Dc(R,"react-flow__edge")))return!0;if(!d&&!$&&!a&&!u&&!o||E||!u&&R.type==="dblclick"||Dc(R,g)&&R.type==="wheel"||Dc(R,b)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!$&&!a&&!z&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const V=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&V})},[E,I,i,o,a,u,d,c,P]),q.jsx("div",{className:"react-flow__renderer",ref:T,style:cA,children:y})},i0e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function o0e(){const{userSelectionActive:e,userSelectionRect:t}=dn(i0e,ri);return e&&t?q.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function HI(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function YB(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&HI(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&HI(r,a);break}case"remove":return r}return r.push(a),r},n)}function yu(e,t){return YB(e,t)}function su(e,t){return YB(e,t)}const Ws=(e,t)=>({id:e,type:"select",selected:t});function ld(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(Ws(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(Ws(r.id,!1))),n},[])}const Qx=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},a0e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),ZB=k.memo(({isSelecting:e,selectionMode:t=Rl.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=k.useRef(null),h=qn(),p=k.useRef(0),m=k.useRef(0),_=k.useRef(),{userSelectionActive:v,elementsSelectable:y,dragging:g}=dn(a0e,ri),b=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=M=>{o==null||o(M),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=M=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){M.preventDefault();return}a==null||a(M)},w=s?M=>s(M):void 0,C=M=>{const{resetSelectedElements:E,domNode:P}=h.getState();if(_.current=P==null?void 0:P.getBoundingClientRect(),!y||!e||M.button!==0||M.target!==f.current||!_.current)return;const{x:N,y:L}=bl(M,_.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:N,startY:L,x:N,y:L}}),r==null||r(M)},T=M=>{const{userSelectionRect:E,nodeInternals:P,edges:N,transform:L,onNodesChange:O,onEdgesChange:R,nodeOrigin:$,getNodes:z}=h.getState();if(!e||!_.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=bl(M,_.current),H=E.startX??0,Q=E.startY??0,Z={...E,x:V.xne.id),ee=j.map(ne=>ne.id);if(p.current!==ee.length){p.current=ee.length;const ne=ld(J,ee);ne.length&&(O==null||O(ne))}if(m.current!==X.length){m.current=X.length;const ne=ld(N,X);ne.length&&(R==null||R(ne))}h.setState({userSelectionRect:Z})},A=M=>{if(M.button!==0)return;const{userSelectionRect:E}=h.getState();!v&&E&&M.target===f.current&&(S==null||S(M)),h.setState({nodesSelectionActive:p.current>0}),b(),i==null||i(M)},I=M=>{v&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(M)),b()},D=y&&(e||v);return q.jsxs("div",{className:Ji(["react-flow__pane",{dragging:g,selection:e}]),onClick:D?void 0:Qx(S,f),onContextMenu:Qx(x,f),onWheel:Qx(w,f),onMouseEnter:D?void 0:l,onMouseDown:D?C:void 0,onMouseMove:D?T:u,onMouseUp:D?A:void 0,onMouseLeave:D?I:c,ref:f,style:cA,children:[d,q.jsx(o0e,{})]})});ZB.displayName="Pane";function JB(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:JB(n,t):!1}function qI(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function s0e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!JB(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function l0e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function ez(e,t,n,r,i=[0,0],o){const a=l0e(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=Fd(c,i).positionAbsolute;s=c&&qi(d)&&qi(f)&&qi(c.width)&&qi(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",ys.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=Fd(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=Fd(c,i).positionAbsolute}const u=s&&s!=="parent"?tA(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function Yx({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const WI=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...eA(l)}})};function hh(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function F5({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",ys.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function u0e(){const e=qn();return k.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function Zx(e){return(t,n,r)=>e==null?void 0:e(t,r)}function tz({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=qn(),[l,u]=k.useState(!1),c=k.useRef([]),d=k.useRef({x:null,y:null}),f=k.useRef(0),h=k.useRef(null),p=k.useRef({x:0,y:0}),m=k.useRef(null),_=k.useRef(!1),v=u0e();return k.useEffect(()=>{if(e!=null&&e.current){const y=_o(e.current),g=({x:S,y:x})=>{const{nodeInternals:w,onNodeDrag:C,onSelectionDrag:T,updateNodePositions:A,nodeExtent:I,snapGrid:D,snapToGrid:M,nodeOrigin:E,onError:P}=s.getState();d.current={x:S,y:x};let N=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&I){const R=aA(c.current,E);L=Ag(R)}if(c.current=c.current.map(R=>{const $={x:S-R.distance.x,y:x-R.distance.y};M&&($.x=D[0]*Math.round($.x/D[0]),$.y=D[1]*Math.round($.y/D[1]));const z=[[I[0][0],I[0][1]],[I[1][0],I[1][1]]];c.current.length>1&&I&&!R.extent&&(z[0][0]=R.positionAbsolute.x-L.x+I[0][0],z[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+I[1][0],z[0][1]=R.positionAbsolute.y-L.y+I[0][1],z[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+I[1][1]);const V=ez(R,$,w,z,E,P);return N=N||R.position.x!==V.position.x||R.position.y!==V.position.y,R.position=V.position,R.positionAbsolute=V.positionAbsolute,R}),!N)return;A(c.current,!0,!0),u(!0);const O=i?C:Zx(T);if(O&&m.current){const[R,$]=Yx({nodeId:i,dragItems:c.current,nodeInternals:w});O(m.current,R,$)}},b=()=>{if(!h.current)return;const[S,x]=_B(p.current,h.current);if(S!==0||x!==0){const{transform:w,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/w[2],d.current.y=(d.current.y??0)-x/w[2],C({x:S,y:x})&&g(d.current)}f.current=requestAnimationFrame(b)};if(t)y.on(".drag",null);else{const S=vpe().on("start",x=>{var N;const{nodeInternals:w,multiSelectionActive:C,domNode:T,nodesDraggable:A,unselectNodesAndEdges:I,onNodeDragStart:D,onSelectionDragStart:M}=s.getState(),E=i?D:Zx(M);!a&&!C&&i&&((N=w.get(i))!=null&&N.selected||I()),i&&o&&a&&F5({id:i,store:s,nodeRef:e});const P=v(x);if(d.current=P,c.current=s0e(w,A,P,i),E&&c.current){const[L,O]=Yx({nodeId:i,dragItems:c.current,nodeInternals:w});E(x.sourceEvent,L,O)}h.current=(T==null?void 0:T.getBoundingClientRect())||null,p.current=bl(x.sourceEvent,h.current)}).on("drag",x=>{const w=v(x),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,b()),(d.current.x!==w.xSnapped||d.current.y!==w.ySnapped)&&c.current&&(m.current=x.sourceEvent,p.current=bl(x.sourceEvent,h.current),g(w))}).on("end",x=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:w,nodeInternals:C,onNodeDragStop:T,onSelectionDragStop:A}=s.getState(),I=i?T:Zx(A);if(w(c.current,!1,!1),I){const[D,M]=Yx({nodeId:i,dragItems:c.current,nodeInternals:C});I(x.sourceEvent,D,M)}}}).filter(x=>{const w=x.target;return!x.button&&(!n||!qI(w,`.${n}`,e))&&(!r||qI(w,r,e))});return y.call(S),()=>{y.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,v]),l}function nz(){const e=qn();return k.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,v=d.map(y=>{if(y.positionAbsolute){const g={x:y.positionAbsolute.x+m,y:y.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:b,position:S}=ez(y,g,r,i,void 0,u);y.position=S,y.positionAbsolute=b}return y});o(v,!0,!1)},[])}const Bd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ph=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:v,isDraggable:y,isSelectable:g,isConnectable:b,isFocusable:S,selectNodesOnDrag:x,sourcePosition:w,targetPosition:C,hidden:T,resizeObserver:A,dragHandle:I,zIndex:D,isParent:M,noDragClassName:E,noPanClassName:P,initialized:N,disableKeyboardA11y:L,ariaLabel:O,rfId:R})=>{const $=qn(),z=k.useRef(null),V=k.useRef(w),H=k.useRef(C),Q=k.useRef(r),Z=g||y||c||d||f||h,J=nz(),j=hh(n,$.getState,d),X=hh(n,$.getState,f),ee=hh(n,$.getState,h),ne=hh(n,$.getState,p),fe=hh(n,$.getState,m),de=Ce=>{if(g&&(!x||!y)&&F5({id:n,store:$,nodeRef:z}),c){const Ke=$.getState().nodeInternals.get(n);Ke&&c(Ce,{...Ke})}},Be=Ce=>{if(!$5(Ce))if(CB.includes(Ce.key)&&g){const Ke=Ce.key==="Escape";F5({id:n,store:$,unselect:Ke,nodeRef:z})}else!L&&y&&u&&Object.prototype.hasOwnProperty.call(Bd,Ce.key)&&($.setState({ariaLiveMessage:`Moved selected node ${Ce.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:Bd[Ce.key].x,y:Bd[Ce.key].y,isShiftPressed:Ce.shiftKey}))};k.useEffect(()=>{if(z.current&&!T){const Ce=z.current;return A==null||A.observe(Ce),()=>A==null?void 0:A.unobserve(Ce)}},[T]),k.useEffect(()=>{const Ce=Q.current!==r,Ke=V.current!==w,be=H.current!==C;z.current&&(Ce||Ke||be)&&(Ce&&(Q.current=r),Ke&&(V.current=w),be&&(H.current=C),$.getState().updateNodeDimensions([{id:n,nodeElement:z.current,forceUpdate:!0}]))},[n,r,w,C]);const $e=tz({nodeRef:z,disabled:T||!y,noDragClassName:E,handleSelector:I,nodeId:n,isSelectable:g,selectNodesOnDrag:x});return T?null:q.jsx("div",{className:Ji(["react-flow__node",`react-flow__node-${r}`,{[P]:y},v,{selected:u,selectable:g,parent:M,dragging:$e}]),ref:z,style:{zIndex:D,transform:`translate(${s}px,${l}px)`,pointerEvents:Z?"all":"none",visibility:N?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:X,onMouseLeave:ee,onContextMenu:ne,onClick:de,onDoubleClick:fe,onKeyDown:S?Be:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${HB}-${R}`,"aria-label":O,children:q.jsx(xme,{value:n,children:q.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:b,sourcePosition:w,targetPosition:C,dragging:$e,dragHandle:I,zIndex:D})})})};return t.displayName="NodeWrapper",k.memo(t)};const c0e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...aA(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function d0e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=qn(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=dn(c0e,ri),c=nz(),d=k.useRef(null);if(k.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),tz({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Bd,p.key)&&c({x:Bd[p.key].x,y:Bd[p.key].y,isShiftPressed:p.shiftKey})};return q.jsx("div",{className:Ji(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:q.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var f0e=k.memo(d0e);const h0e=e=>e.nodesSelectionActive,rz=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:v,zoomActivationKeyCode:y,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:S,panOnScroll:x,panOnScrollSpeed:w,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:A,defaultViewport:I,translateExtent:D,minZoom:M,maxZoom:E,preventScrolling:P,onSelectionContextMenu:N,noWheelClassName:L,noPanClassName:O,disableKeyboardA11y:R})=>{const $=dn(h0e),z=Tg(d),H=Tg(v)||A,Q=z||f&&H!==!0;return Jme({deleteKeyCode:s,multiSelectionKeyCode:_}),q.jsx(r0e,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:S,panOnScroll:x,panOnScrollSpeed:w,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!z&&H,defaultViewport:I,translateExtent:D,minZoom:M,maxZoom:E,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:L,noPanClassName:O,children:q.jsxs(ZB,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:H,isSelecting:!!Q,selectionMode:h,children:[e,$&&q.jsx(f0e,{onSelectionContextMenu:N,noPanClassName:O,disableKeyboardA11y:R})]})})};rz.displayName="FlowRenderer";var p0e=k.memo(rz);function g0e(e){return dn(k.useCallback(n=>e?OB(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function m0e(e){const t={input:ph(e.input||jB),default:ph(e.default||L5),output:ph(e.output||UB),group:ph(e.group||uA)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=ph(e[o]||L5),i),n);return{...t,...r}}const y0e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},v0e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),iz=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=dn(v0e,ri),s=g0e(e.onlyRenderVisibleElements),l=k.useRef(),u=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return k.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),q.jsx("div",{className:"react-flow__nodes",style:cA,children:s.map(c=>{var S,x;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",ys.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),v=e.nodeExtent?tA(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=(v==null?void 0:v.x)??0,g=(v==null?void 0:v.y)??0,b=y0e({x:y,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return q.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||Te.Bottom,targetPosition:c.targetPosition||Te.Top,hidden:c.hidden,xPos:y,yPos:g,xPosOrigin:b.x,yPosOrigin:b.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Mn])==null?void 0:S.z)??0,isParent:!!((x=c[Mn])!=null&&x.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};iz.displayName="NodeRenderer";var b0e=k.memo(iz);const _0e=(e,t,n)=>n===Te.Left?e-t:n===Te.Right?e+t:e,S0e=(e,t,n)=>n===Te.Top?e-t:n===Te.Bottom?e+t:e,KI="react-flow__edgeupdater",XI=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>q.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:Ji([KI,`${KI}-${s}`]),cx:_0e(t,r,e),cy:S0e(n,r,e),r,stroke:"transparent",fill:"transparent"}),x0e=()=>!0;var Lc=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:v,target:y,sourceX:g,sourceY:b,targetX:S,targetY:x,sourcePosition:w,targetPosition:C,elementsSelectable:T,hidden:A,sourceHandleId:I,targetHandleId:D,onContextMenu:M,onMouseEnter:E,onMouseMove:P,onMouseLeave:N,edgeUpdaterRadius:L,onEdgeUpdate:O,onEdgeUpdateStart:R,onEdgeUpdateEnd:$,markerEnd:z,markerStart:V,rfId:H,ariaLabel:Q,isFocusable:Z,isUpdatable:J,pathOptions:j,interactionWidth:X})=>{const ee=k.useRef(null),[ne,fe]=k.useState(!1),[de,Be]=k.useState(!1),$e=qn(),Ce=k.useMemo(()=>`url(#${D5(V,H)})`,[V,H]),Ke=k.useMemo(()=>`url(#${D5(z,H)})`,[z,H]);if(A)return null;const be=rn=>{const{edges:Ot,addSelectedEdges:si}=$e.getState();if(T&&($e.setState({nodesSelectionActive:!1}),si([n])),a){const Ii=Ot.find(uo=>uo.id===n);a(rn,Ii)}},zt=fh(n,$e.getState,s),Wn=fh(n,$e.getState,M),nn=fh(n,$e.getState,E),Rt=fh(n,$e.getState,P),St=fh(n,$e.getState,N),bn=(rn,Ot)=>{if(rn.button!==0)return;const{edges:si,isValidConnection:Ii}=$e.getState(),uo=Ot?y:v,Ma=(Ot?D:I)||null,Xn=Ot?"target":"source",co=Ii||x0e,tu=Ot,jo=si.find(xt=>xt.id===n);Be(!0),R==null||R(rn,jo,Xn);const nu=xt=>{Be(!1),$==null||$(xt,jo,Xn)};LB({event:rn,handleId:Ma,nodeId:uo,onConnect:xt=>O==null?void 0:O(jo,xt),isTarget:tu,getState:$e.getState,setState:$e.setState,isValidConnection:co,edgeUpdaterType:Xn,onEdgeUpdateEnd:nu})},jr=rn=>bn(rn,!0),lo=rn=>bn(rn,!1),ki=()=>fe(!0),lr=()=>fe(!1),Kn=!T&&!a,Sr=rn=>{var Ot;if(CB.includes(rn.key)&&T){const{unselectNodesAndEdges:si,addSelectedEdges:Ii,edges:uo}=$e.getState();rn.key==="Escape"?((Ot=ee.current)==null||Ot.blur(),si({edges:[uo.find(Xn=>Xn.id===n)]})):Ii([n])}};return q.jsxs("g",{className:Ji(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Kn,updating:ne}]),onClick:be,onDoubleClick:zt,onContextMenu:Wn,onMouseEnter:nn,onMouseMove:Rt,onMouseLeave:St,onKeyDown:Z?Sr:void 0,tabIndex:Z?0:void 0,role:Z?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Q===null?void 0:Q||`Edge from ${v} to ${y}`,"aria-describedby":Z?`${qB}-${H}`:void 0,ref:ee,children:[!de&&q.jsx(e,{id:n,source:v,target:y,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:b,targetX:S,targetY:x,sourcePosition:w,targetPosition:C,sourceHandleId:I,targetHandleId:D,markerStart:Ce,markerEnd:Ke,pathOptions:j,interactionWidth:X}),J&&q.jsxs(q.Fragment,{children:[(J==="source"||J===!0)&&q.jsx(XI,{position:w,centerX:g,centerY:b,radius:L,onMouseDown:jr,onMouseEnter:ki,onMouseOut:lr,type:"source"}),(J==="target"||J===!0)&&q.jsx(XI,{position:C,centerX:S,centerY:x,radius:L,onMouseDown:lo,onMouseEnter:ki,onMouseOut:lr,type:"target"})]})]})};return t.displayName="EdgeWrapper",k.memo(t)};function w0e(e){const t={default:Lc(e.default||B1),straight:Lc(e.bezier||iA),step:Lc(e.step||rA),smoothstep:Lc(e.step||nS),simplebezier:Lc(e.simplebezier||nA)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=Lc(e[o]||B1),i),n);return{...t,...r}}function QI(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case Te.Top:return{x:r+o/2,y:i};case Te.Right:return{x:r+o,y:i+a/2};case Te.Bottom:return{x:r+o/2,y:i+a};case Te.Left:return{x:r,y:i+a/2}}}function YI(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const C0e=(e,t,n,r,i,o)=>{const a=QI(n,e,t),s=QI(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function E0e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Ag({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function ZI(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Mn])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const A0e=[{level:0,isMaxLevel:!0,edges:[]}];function T0e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=qi(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Mn])==null?void 0:c.z)||0,((d=f==null?void 0:f[Mn])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?A0e:o}function P0e(e,t,n){const r=dn(k.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&E0e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return T0e(r,t,n)}const k0e=({color:e="none",strokeWidth:t=1})=>q.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),I0e=({color:e="none",strokeWidth:t=1})=>q.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),JI={[F1.Arrow]:k0e,[F1.ArrowClosed]:I0e};function M0e(e){const t=qn();return k.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(JI,e)?JI[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ys.error009(e)),null)},[e])}const R0e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=M0e(t);return l?q.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:q.jsx(l,{color:n,strokeWidth:a})}):null},O0e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=D5(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},oz=({defaultColor:e,rfId:t})=>{const n=dn(k.useCallback(O0e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return q.jsx("defs",{children:n.map(r=>q.jsx(R0e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};oz.displayName="MarkerDefinitions";var $0e=k.memo(oz);const N0e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),az=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:v,edgesUpdatable:y,elementsSelectable:g,width:b,height:S,connectionMode:x,nodeInternals:w,onError:C}=dn(N0e,ri),T=P0e(t,w,n);return b?q.jsxs(q.Fragment,{children:[T.map(({level:A,edges:I,isMaxLevel:D})=>q.jsxs("svg",{style:{zIndex:A},width:b,height:S,className:"react-flow__edges react-flow__container",children:[D&&q.jsx($0e,{defaultColor:e,rfId:r}),q.jsx("g",{children:I.map(M=>{const[E,P,N]=ZI(w.get(M.source)),[L,O,R]=ZI(w.get(M.target));if(!N||!R)return null;let $=M.type||"default";i[$]||(C==null||C("011",ys.error011($)),$="default");const z=i[$]||i.default,V=x===sc.Strict?O.target:(O.target??[]).concat(O.source??[]),H=YI(P.source,M.sourceHandle),Q=YI(V,M.targetHandle),Z=(H==null?void 0:H.position)||Te.Bottom,J=(Q==null?void 0:Q.position)||Te.Top,j=!!(M.focusable||v&&typeof M.focusable>"u"),X=typeof a<"u"&&(M.updatable||y&&typeof M.updatable>"u");if(!H||!Q)return C==null||C("008",ys.error008(H,M)),null;const{sourceX:ee,sourceY:ne,targetX:fe,targetY:de}=C0e(E,H,Z,L,Q,J);return q.jsx(z,{id:M.id,className:Ji([M.className,o]),type:$,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:ee,sourceY:ne,targetX:fe,targetY:de,sourcePosition:Z,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:M.ariaLabel,isFocusable:j,isUpdatable:X,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth},M.id)})})]},A)),_]}):null};az.displayName="EdgeRenderer";var D0e=k.memo(az);const L0e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function F0e({children:e}){const t=dn(L0e);return q.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function B0e(e){const t=QB(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const z0e={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top},sz=({nodeId:e,handleType:t,style:n,type:r=Js.Bezier,CustomComponent:i,connectionStatus:o})=>{var x,w,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=dn(k.useCallback(T=>({fromNode:T.nodeInternals.get(e),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[e]),ri),d=(x=a==null?void 0:a[Mn])==null?void 0:x.handleBounds;let f=d==null?void 0:d[t];if(c===sc.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(T=>T.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((w=a.positionAbsolute)==null?void 0:w.x)??0)+p,v=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,y=h==null?void 0:h.position,g=y?z0e[y]:null;if(!y||!g)return null;if(i)return q.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:v,toX:l,toY:u,fromPosition:y,toPosition:g,connectionStatus:o});let b="";const S={sourceX:_,sourceY:v,sourcePosition:y,targetX:l,targetY:u,targetPosition:g};return r===Js.Bezier?[b]=kB(S):r===Js.Step?[b]=N5({...S,borderRadius:0}):r===Js.SmoothStep?[b]=N5(S):r===Js.SimpleBezier?[b]=PB(S):b=`M${_},${v} ${l},${u}`,q.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:n})};sz.displayName="ConnectionLine";const j0e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function V0e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=dn(j0e,ri);return!(i&&o&&s&&a)?null:q.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:q.jsx("g",{className:Ji(["react-flow__connection",u]),children:q.jsx(sz,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function e8(e,t){return k.useRef(null),qn(),k.useMemo(()=>t(e),[e])}const lz=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:v,connectionLineStyle:y,connectionLineComponent:g,connectionLineContainerStyle:b,selectionKeyCode:S,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:M,selectNodesOnDrag:E,defaultViewport:P,translateExtent:N,minZoom:L,maxZoom:O,preventScrolling:R,defaultMarkerColor:$,zoomOnScroll:z,zoomOnPinch:V,panOnScroll:H,panOnScrollSpeed:Q,panOnScrollMode:Z,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:X,onPaneMouseEnter:ee,onPaneMouseMove:ne,onPaneMouseLeave:fe,onPaneScroll:de,onPaneContextMenu:Be,onEdgeUpdate:$e,onEdgeContextMenu:Ce,onEdgeMouseEnter:Ke,onEdgeMouseMove:be,onEdgeMouseLeave:zt,edgeUpdaterRadius:Wn,onEdgeUpdateStart:nn,onEdgeUpdateEnd:Rt,noDragClassName:St,noWheelClassName:bn,noPanClassName:jr,elevateEdgesOnSelect:lo,disableKeyboardA11y:ki,nodeOrigin:lr,nodeExtent:Kn,rfId:Sr})=>{const rn=e8(e,m0e),Ot=e8(t,w0e);return B0e(o),q.jsx(p0e,{onPaneClick:X,onPaneMouseEnter:ee,onPaneMouseMove:ne,onPaneMouseLeave:fe,onPaneContextMenu:Be,onPaneScroll:de,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:x,selectionMode:w,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:A,elementsSelectable:M,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:z,zoomOnPinch:V,zoomOnDoubleClick:J,panOnScroll:H,panOnScrollSpeed:Q,panOnScrollMode:Z,panOnDrag:j,defaultViewport:P,translateExtent:N,minZoom:L,maxZoom:O,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:St,noWheelClassName:bn,noPanClassName:jr,disableKeyboardA11y:ki,children:q.jsxs(F0e,{children:[q.jsx(D0e,{edgeTypes:Ot,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:$e,onlyRenderVisibleElements:D,onEdgeContextMenu:Ce,onEdgeMouseEnter:Ke,onEdgeMouseMove:be,onEdgeMouseLeave:zt,onEdgeUpdateStart:nn,onEdgeUpdateEnd:Rt,edgeUpdaterRadius:Wn,defaultMarkerColor:$,noPanClassName:jr,elevateEdgesOnSelect:!!lo,disableKeyboardA11y:ki,rfId:Sr,children:q.jsx(V0e,{style:y,type:v,component:g,containerStyle:b})}),q.jsx("div",{className:"react-flow__edgelabel-renderer"}),q.jsx(b0e,{nodeTypes:rn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:D,noPanClassName:jr,noDragClassName:St,disableKeyboardA11y:ki,nodeOrigin:lr,nodeExtent:Kn,rfId:Sr})]})})};lz.displayName="GraphView";var U0e=k.memo(lz);const B5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ns={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:B5,nodeExtent:B5,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:sc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:mme,isValidConnection:void 0},G0e=()=>Ife((e,t)=>({...Ns,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:Xx(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?Xx(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const v=i.get(_.id);if(v){const y=eA(_.nodeElement);!!(y.width&&y.height&&(v.width!==y.width||v.height!==y.height||_.forceUpdate))&&(i.set(v.id,{...v,[Mn]:{...v[Mn],handleBounds:{source:WI(".source",_.nodeElement,f,u),target:WI(".target",_.nodeElement,f,u)}},...y}),m.push({id:v.id,type:"dimensions",dimensions:y}))}return m},[]);KB(i,u);const p=a||o&&!a&&XB(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=yu(n,s()),c=Xx(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Ws(l,!0)):(a=ld(o(),n),s=ld(i,[])),V0({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Ws(l,!0)):(a=ld(i,n),s=ld(o(),[])),V0({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,Ws(c.id,!1))),u=s.map(c=>Ws(c.id,!1));V0({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>Ws(s.id,!1)),a=n.filter(s=>s.selected).map(s=>Ws(s.id,!1));V0({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=tA(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=vl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Ns.connectionNodeId,connectionHandleId:Ns.connectionHandleId,connectionHandleType:Ns.connectionHandleType,connectionStatus:Ns.connectionStatus,connectionStartHandle:Ns.connectionStartHandle,connectionEndHandle:Ns.connectionEndHandle}),reset:()=>e({...Ns})}),Object.is),uz=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=G0e()),q.jsx(ume,{value:t.current,children:e})};uz.displayName="ReactFlowProvider";const cz=({children:e})=>k.useContext(tS)?q.jsx(q.Fragment,{children:e}):q.jsx(uz,{children:e});cz.displayName="ReactFlowWrapper";const H0e={input:jB,default:L5,output:UB,group:uA},q0e={default:B1,straight:iA,step:rA,smoothstep:nS,simplebezier:nA},W0e=[0,0],K0e=[15,15],X0e={x:0,y:0,zoom:1},Q0e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Y0e=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=H0e,edgeTypes:a=q0e,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:x,onNodeDragStart:w,onNodeDrag:C,onNodeDragStop:T,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:M,onSelectionDrag:E,onSelectionDragStop:P,onSelectionContextMenu:N,onSelectionStart:L,onSelectionEnd:O,connectionMode:R=sc.Strict,connectionLineType:$=Js.Bezier,connectionLineStyle:z,connectionLineComponent:V,connectionLineContainerStyle:H,deleteKeyCode:Q="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:J=!1,selectionMode:j=Rl.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:ee=L1()?"Meta":"Control",zoomActivationKeyCode:ne=L1()?"Meta":"Control",snapToGrid:fe=!1,snapGrid:de=K0e,onlyRenderVisibleElements:Be=!1,selectNodesOnDrag:$e=!0,nodesDraggable:Ce,nodesConnectable:Ke,nodesFocusable:be,nodeOrigin:zt=W0e,edgesFocusable:Wn,edgesUpdatable:nn,elementsSelectable:Rt,defaultViewport:St=X0e,minZoom:bn=.5,maxZoom:jr=2,translateExtent:lo=B5,preventScrolling:ki=!0,nodeExtent:lr,defaultMarkerColor:Kn="#b1b1b7",zoomOnScroll:Sr=!0,zoomOnPinch:rn=!0,panOnScroll:Ot=!1,panOnScrollSpeed:si=.5,panOnScrollMode:Ii=Ru.Free,zoomOnDoubleClick:uo=!0,panOnDrag:Ma=!0,onPaneClick:Xn,onPaneMouseEnter:co,onPaneMouseMove:tu,onPaneMouseLeave:jo,onPaneScroll:nu,onPaneContextMenu:Kt,children:xt,onEdgeUpdate:Qn,onEdgeContextMenu:$n,onEdgeDoubleClick:ur,onEdgeMouseEnter:xr,onEdgeMouseMove:Vr,onEdgeMouseLeave:Vo,onEdgeUpdateStart:wr,onEdgeUpdateEnd:Yn,edgeUpdaterRadius:Ra=10,onNodesChange:Is,onEdgesChange:Ms,noDragClassName:Cc="nodrag",noWheelClassName:Oa="nowheel",noPanClassName:Cr="nopan",fitView:ru=!1,fitViewOptions:P2,connectOnClick:k2=!0,attributionPosition:I2,proOptions:M2,defaultEdgeOptions:Rs,elevateNodesOnSelect:R2=!0,elevateEdgesOnSelect:O2=!1,disableKeyboardA11y:Qm=!1,autoPanOnConnect:$2=!0,autoPanOnNodeDrag:N2=!0,connectionRadius:D2=20,isValidConnection:Xf,onError:L2,style:Ec,id:Ac,...F2},Tc)=>{const Pc=Ac||"1";return q.jsx("div",{...F2,style:{...Ec,...Q0e},ref:Tc,className:Ji(["react-flow",i]),"data-testid":"rf__wrapper",id:Ac,children:q.jsxs(cz,{children:[q.jsx(U0e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:x,nodeTypes:o,edgeTypes:a,connectionLineType:$,connectionLineStyle:z,connectionLineComponent:V,connectionLineContainerStyle:H,selectionKeyCode:Z,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Q,multiSelectionKeyCode:ee,panActivationKeyCode:X,zoomActivationKeyCode:ne,onlyRenderVisibleElements:Be,selectNodesOnDrag:$e,defaultViewport:St,translateExtent:lo,minZoom:bn,maxZoom:jr,preventScrolling:ki,zoomOnScroll:Sr,zoomOnPinch:rn,zoomOnDoubleClick:uo,panOnScroll:Ot,panOnScrollSpeed:si,panOnScrollMode:Ii,panOnDrag:Ma,onPaneClick:Xn,onPaneMouseEnter:co,onPaneMouseMove:tu,onPaneMouseLeave:jo,onPaneScroll:nu,onPaneContextMenu:Kt,onSelectionContextMenu:N,onSelectionStart:L,onSelectionEnd:O,onEdgeUpdate:Qn,onEdgeContextMenu:$n,onEdgeDoubleClick:ur,onEdgeMouseEnter:xr,onEdgeMouseMove:Vr,onEdgeMouseLeave:Vo,onEdgeUpdateStart:wr,onEdgeUpdateEnd:Yn,edgeUpdaterRadius:Ra,defaultMarkerColor:Kn,noDragClassName:Cc,noWheelClassName:Oa,noPanClassName:Cr,elevateEdgesOnSelect:O2,rfId:Pc,disableKeyboardA11y:Qm,nodeOrigin:zt,nodeExtent:lr}),q.jsx(jme,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:v,nodesDraggable:Ce,nodesConnectable:Ke,nodesFocusable:be,edgesFocusable:Wn,edgesUpdatable:nn,elementsSelectable:Rt,elevateNodesOnSelect:R2,minZoom:bn,maxZoom:jr,nodeExtent:lr,onNodesChange:Is,onEdgesChange:Ms,snapToGrid:fe,snapGrid:de,connectionMode:R,translateExtent:lo,connectOnClick:k2,defaultEdgeOptions:Rs,fitView:ru,fitViewOptions:P2,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:w,onNodeDrag:C,onNodeDragStop:T,onSelectionDrag:E,onSelectionDragStart:M,onSelectionDragStop:P,noPanClassName:Cr,nodeOrigin:zt,rfId:Pc,autoPanOnConnect:$2,autoPanOnNodeDrag:N2,onError:L2,connectionRadius:D2,isValidConnection:Xf}),q.jsx(Bme,{onSelectionChange:D}),xt,q.jsx(fme,{proOptions:M2,position:I2}),q.jsx(qme,{rfId:Pc,disableKeyboardA11y:Qm})]})})});Y0e.displayName="ReactFlow";const Z0e=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function nje({children:e}){const t=dn(Z0e);return t?pi.createPortal(e,t):null}function rje(){const e=qn();return k.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function J0e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const Pg=Kv("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,J0e()))}catch(n){return t({error:n})}}),ije=500,oje=320,dz="node-drag-handle",aje=["ImageField","ImageCollection"],sje={input:"inputs",output:"outputs"},G0=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection","T2IAdapterCollection","IPAdapterCollection","MetadataItemCollection","MetadataCollection"],Vh=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic","T2IAdapterPolymorphic","IPAdapterPolymorphic","MetadataItemPolymorphic"],lje=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField","T2IAdapterModelField","IPAdapterModelField"],dA={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection",T2IAdapterField:"T2IAdapterCollection",IPAdapterField:"IPAdapterCollection",MetadataItemField:"MetadataItemCollection",MetadataField:"MetadataCollection"},eye=e=>!!(e&&e in dA),fz={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic",T2IAdapterField:"T2IAdapterPolymorphic",IPAdapterField:"IPAdapterPolymorphic",MetadataItemField:"MetadataItemPolymorphic"},tye={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField",T2IAdapterPolymorphic:"T2IAdapterField",IPAdapterPolymorphic:"IPAdapterField",MetadataItemPolymorphic:"MetadataItemField"},uje=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField","T2IAdapterModelField"],nye=e=>!!(e&&e in fz),cje={Any:{color:"gray.500",description:"Any field type is accepted.",title:"Any"},MetadataField:{color:"gray.500",description:"A metadata dict.",title:"Metadata Dict"},MetadataCollection:{color:"gray.500",description:"A collection of metadata dicts.",title:"Metadata Dict Collection"},MetadataItemField:{color:"gray.500",description:"A metadata item.",title:"Metadata Item"},MetadataItemCollection:{color:"gray.500",description:"Any field type is accepted.",title:"Metadata Item Collection"},MetadataItemPolymorphic:{color:"gray.500",description:"MetadataItem or MetadataItemCollection field types are accepted.",title:"Metadata Item Polymorphic"},boolean:{color:"green.500",description:K("nodes.booleanDescription"),title:K("nodes.boolean")},BooleanCollection:{color:"green.500",description:K("nodes.booleanCollectionDescription"),title:K("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:K("nodes.booleanPolymorphicDescription"),title:K("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:K("nodes.clipFieldDescription"),title:K("nodes.clipField")},Collection:{color:"base.500",description:K("nodes.collectionDescription"),title:K("nodes.collection")},CollectionItem:{color:"base.500",description:K("nodes.collectionItemDescription"),title:K("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:K("nodes.colorCollectionDescription"),title:K("nodes.colorCollection")},ColorField:{color:"pink.300",description:K("nodes.colorFieldDescription"),title:K("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:K("nodes.colorPolymorphicDescription"),title:K("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:K("nodes.conditioningCollectionDescription"),title:K("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:K("nodes.conditioningFieldDescription"),title:K("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:K("nodes.conditioningPolymorphicDescription"),title:K("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:K("nodes.controlCollectionDescription"),title:K("nodes.controlCollection")},ControlField:{color:"teal.500",description:K("nodes.controlFieldDescription"),title:K("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:K("nodes.denoiseMaskFieldDescription"),title:K("nodes.denoiseMaskField")},enum:{color:"blue.500",description:K("nodes.enumDescription"),title:K("nodes.enum")},float:{color:"orange.500",description:K("nodes.floatDescription"),title:K("nodes.float")},FloatCollection:{color:"orange.500",description:K("nodes.floatCollectionDescription"),title:K("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:K("nodes.floatPolymorphicDescription"),title:K("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:K("nodes.imageCollectionDescription"),title:K("nodes.imageCollection")},ImageField:{color:"purple.500",description:K("nodes.imageFieldDescription"),title:K("nodes.imageField")},BoardField:{color:"purple.500",description:K("nodes.imageFieldDescription"),title:K("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:K("nodes.imagePolymorphicDescription"),title:K("nodes.imagePolymorphic")},integer:{color:"red.500",description:K("nodes.integerDescription"),title:K("nodes.integer")},IntegerCollection:{color:"red.500",description:K("nodes.integerCollectionDescription"),title:K("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:K("nodes.integerPolymorphicDescription"),title:K("nodes.integerPolymorphic")},IPAdapterCollection:{color:"teal.500",description:K("nodes.ipAdapterCollectionDescription"),title:K("nodes.ipAdapterCollection")},IPAdapterField:{color:"teal.500",description:K("nodes.ipAdapterDescription"),title:K("nodes.ipAdapter")},IPAdapterModelField:{color:"teal.500",description:K("nodes.ipAdapterModelDescription"),title:K("nodes.ipAdapterModel")},IPAdapterPolymorphic:{color:"teal.500",description:K("nodes.ipAdapterPolymorphicDescription"),title:K("nodes.ipAdapterPolymorphic")},LatentsCollection:{color:"pink.500",description:K("nodes.latentsCollectionDescription"),title:K("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:K("nodes.latentsFieldDescription"),title:K("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:K("nodes.latentsPolymorphicDescription"),title:K("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:K("nodes.loRAModelFieldDescription"),title:K("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:K("nodes.mainModelFieldDescription"),title:K("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:K("nodes.oNNXModelFieldDescription"),title:K("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:K("nodes.schedulerDescription"),title:K("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:K("nodes.sDXLMainModelFieldDescription"),title:K("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:K("nodes.sDXLRefinerModelFieldDescription"),title:K("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:K("nodes.stringDescription"),title:K("nodes.string")},StringCollection:{color:"yellow.500",description:K("nodes.stringCollectionDescription"),title:K("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:K("nodes.stringPolymorphicDescription"),title:K("nodes.stringPolymorphic")},T2IAdapterCollection:{color:"teal.500",description:K("nodes.t2iAdapterCollectionDescription"),title:K("nodes.t2iAdapterCollection")},T2IAdapterField:{color:"teal.500",description:K("nodes.t2iAdapterFieldDescription"),title:K("nodes.t2iAdapterField")},T2IAdapterModelField:{color:"teal.500",description:"TODO",title:"T2I-Adapter"},T2IAdapterPolymorphic:{color:"teal.500",description:"T2I-Adapter info passed between nodes.",title:"T2I-Adapter Polymorphic"},UNetField:{color:"red.500",description:K("nodes.uNetFieldDescription"),title:K("nodes.uNetField")},VaeField:{color:"blue.500",description:K("nodes.vaeFieldDescription"),title:K("nodes.vaeField")},VaeModelField:{color:"teal.500",description:K("nodes.vaeModelFieldDescription"),title:K("nodes.vaeModelField")}},t8=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},rye=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!G0.includes(t),r=t==="CollectionItem"&&!G0.includes(e)&&!Vh.includes(e),i=Vh.includes(t)&&(()=>{if(!Vh.includes(t))return!1;const c=tye[t],d=dA[c];return e===c||e===d})(),o=e==="Collection"&&(G0.includes(t)||Vh.includes(t)),a=t==="Collection"&&G0.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"||t==="Any"};var iye="\0",lu="\0",n8="",Gr,Du,di,Yg,Kd,Xd,zi,Zo,nl,Jo,rl,Ga,Ha,Qd,Yd,qa,mo,Zg,z5,nO;let oye=(nO=class{constructor(t){Ut(this,Zg);Ut(this,Gr,!0);Ut(this,Du,!1);Ut(this,di,!1);Ut(this,Yg,void 0);Ut(this,Kd,()=>{});Ut(this,Xd,()=>{});Ut(this,zi,{});Ut(this,Zo,{});Ut(this,nl,{});Ut(this,Jo,{});Ut(this,rl,{});Ut(this,Ga,{});Ut(this,Ha,{});Ut(this,Qd,0);Ut(this,Yd,0);Ut(this,qa,void 0);Ut(this,mo,void 0);t&&(Ri(this,Gr,t.hasOwnProperty("directed")?t.directed:!0),Ri(this,Du,t.hasOwnProperty("multigraph")?t.multigraph:!1),Ri(this,di,t.hasOwnProperty("compound")?t.compound:!1)),te(this,di)&&(Ri(this,qa,{}),Ri(this,mo,{}),te(this,mo)[lu]={})}isDirected(){return te(this,Gr)}isMultigraph(){return te(this,Du)}isCompound(){return te(this,di)}setGraph(t){return Ri(this,Yg,t),this}graph(){return te(this,Yg)}setDefaultNodeLabel(t){return Ri(this,Kd,t),typeof t!="function"&&Ri(this,Kd,()=>t),this}nodeCount(){return te(this,Qd)}nodes(){return Object.keys(te(this,zi))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(te(t,Zo)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(te(t,Jo)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return te(this,zi).hasOwnProperty(t)?(arguments.length>1&&(te(this,zi)[t]=n),this):(te(this,zi)[t]=arguments.length>1?n:te(this,Kd).call(this,t),te(this,di)&&(te(this,qa)[t]=lu,te(this,mo)[t]={},te(this,mo)[lu][t]=!0),te(this,Zo)[t]={},te(this,nl)[t]={},te(this,Jo)[t]={},te(this,rl)[t]={},++Zf(this,Qd)._,this)}node(t){return te(this,zi)[t]}hasNode(t){return te(this,zi).hasOwnProperty(t)}removeNode(t){var n=this;if(te(this,zi).hasOwnProperty(t)){var r=i=>n.removeEdge(te(n,Ga)[i]);delete te(this,zi)[t],te(this,di)&&(Uo(this,Zg,z5).call(this,t),delete te(this,qa)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete te(this,mo)[t]),Object.keys(te(this,Zo)[t]).forEach(r),delete te(this,Zo)[t],delete te(this,nl)[t],Object.keys(te(this,Jo)[t]).forEach(r),delete te(this,Jo)[t],delete te(this,rl)[t],--Zf(this,Qd)._}return this}setParent(t,n){if(!te(this,di))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=lu;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),Uo(this,Zg,z5).call(this,t),te(this,qa)[t]=n,te(this,mo)[n][t]=!0,this}parent(t){if(te(this,di)){var n=te(this,qa)[t];if(n!==lu)return n}}children(t=lu){if(te(this,di)){var n=te(this,mo)[t];if(n)return Object.keys(n)}else{if(t===lu)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=te(this,nl)[t];if(n)return Object.keys(n)}successors(t){var n=te(this,rl)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:te(this,Gr),multigraph:te(this,Du),compound:te(this,di)});n.setGraph(this.graph());var r=this;Object.entries(te(this,zi)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(te(this,Ga)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return te(this,di)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return Ri(this,Xd,t),typeof t!="function"&&Ri(this,Xd,()=>t),this}edgeCount(){return te(this,Yd)}edges(){return Object.values(te(this,Ga))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=Uh(te(this,Gr),t,n,r);if(te(this,Ha).hasOwnProperty(s))return o&&(te(this,Ha)[s]=i),this;if(r!==void 0&&!te(this,Du))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),te(this,Ha)[s]=o?i:te(this,Xd).call(this,t,n,r);var l=aye(te(this,Gr),t,n,r);return t=l.v,n=l.w,Object.freeze(l),te(this,Ga)[s]=l,r8(te(this,nl)[n],t),r8(te(this,rl)[t],n),te(this,Zo)[n][s]=l,te(this,Jo)[t][s]=l,Zf(this,Yd)._++,this}edge(t,n,r){var i=arguments.length===1?Jx(te(this,Gr),arguments[0]):Uh(te(this,Gr),t,n,r);return te(this,Ha)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?Jx(te(this,Gr),arguments[0]):Uh(te(this,Gr),t,n,r);return te(this,Ha).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?Jx(te(this,Gr),arguments[0]):Uh(te(this,Gr),t,n,r),o=te(this,Ga)[i];return o&&(t=o.v,n=o.w,delete te(this,Ha)[i],delete te(this,Ga)[i],i8(te(this,nl)[n],t),i8(te(this,rl)[t],n),delete te(this,Zo)[n][i],delete te(this,Jo)[t][i],Zf(this,Yd)._--),this}inEdges(t,n){var r=te(this,Zo)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=te(this,Jo)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},Gr=new WeakMap,Du=new WeakMap,di=new WeakMap,Yg=new WeakMap,Kd=new WeakMap,Xd=new WeakMap,zi=new WeakMap,Zo=new WeakMap,nl=new WeakMap,Jo=new WeakMap,rl=new WeakMap,Ga=new WeakMap,Ha=new WeakMap,Qd=new WeakMap,Yd=new WeakMap,qa=new WeakMap,mo=new WeakMap,Zg=new WeakSet,z5=function(t){delete te(this,mo)[te(this,qa)[t]][t]},nO);function r8(e,t){e[t]?e[t]++:e[t]=1}function i8(e,t){--e[t]||delete e[t]}function Uh(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+n8+o+n8+(r===void 0?iye:r)}function aye(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function Jx(e,t){return Uh(e,t.v,t.w,t.name)}var fA=oye,sye="2.1.13",lye={Graph:fA,version:sye},uye=fA,cye={write:dye,read:pye};function dye(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:fye(e),edges:hye(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function fye(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function hye(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function pye(e){var t=new uye(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var gye=mye;function mye(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var hr,Wa,Jg,j5,em,V5,Zd,Xy,rO;let yye=(rO=class{constructor(){Ut(this,Jg);Ut(this,em);Ut(this,Zd);Ut(this,hr,[]);Ut(this,Wa,{})}size(){return te(this,hr).length}keys(){return te(this,hr).map(function(t){return t.key})}has(t){return te(this,Wa).hasOwnProperty(t)}priority(t){var n=te(this,Wa)[t];if(n!==void 0)return te(this,hr)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return te(this,hr)[0].key}add(t,n){var r=te(this,Wa);if(t=String(t),!r.hasOwnProperty(t)){var i=te(this,hr),o=i.length;return r[t]=o,i.push({key:t,priority:n}),Uo(this,em,V5).call(this,o),!0}return!1}removeMin(){Uo(this,Zd,Xy).call(this,0,te(this,hr).length-1);var t=te(this,hr).pop();return delete te(this,Wa)[t.key],Uo(this,Jg,j5).call(this,0),t.key}decrease(t,n){var r=te(this,Wa)[t];if(n>te(this,hr)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+te(this,hr)[r].priority+" New: "+n);te(this,hr)[r].priority=n,Uo(this,em,V5).call(this,r)}},hr=new WeakMap,Wa=new WeakMap,Jg=new WeakSet,j5=function(t){var n=te(this,hr),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function _ye(e,t,n,r){return Sye(e,String(t),n||bye,r||function(i){return e.outEdges(i)})}function Sye(e,t,n,r){var i={},o=new vye,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var xye=pz,wye=Cye;function Cye(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=xye(e,i,t,n),r},{})}var gz=Eye;function Eye(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var Aye=gz,Tye=Pye;function Pye(e){return Aye(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var kye=Mye,Iye=()=>1;function Mye(e,t,n){return Rye(e,t||Iye,n||function(r){return e.outEdges(r)})}function Rye(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?Dye:Lye,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function Dye(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),bz(t(o[0]),a=>i.push([a,!1])))}}function Lye(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),bz(t(o),a=>i.push(a)))}}function bz(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var Fye=vz,Bye=zye;function zye(e,t){return Fye(e,t,"post")}var jye=vz,Vye=Uye;function Uye(e,t){return jye(e,t,"pre")}var Gye=fA,Hye=hz,qye=Wye;function Wye(e,t){var n=new Gye,r={},i=new Hye,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var Kye={components:gye,dijkstra:pz,dijkstraAll:wye,findCycles:Tye,floydWarshall:kye,isAcyclic:Oye,postorder:Bye,preorder:Vye,prim:qye,tarjan:gz,topsort:yz},a8=lye,Xye={Graph:a8.Graph,json:cye,alg:Kye,version:a8.version};const s8=Bl(Xye),l8=(e,t,n,r)=>{const i=new s8.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),s8.alg.isAcyclic(i)},u8=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),rye(n,i.type)||(o=!1),o},c8=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=l8(u,c,t,n),p=u8(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=l8(c,d,t,n),m=u8(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},Qye="1.0.0",ew={status:wu.PENDING,error:null,progress:null,progressImage:null,outputs:[]},G5={meta:{version:Qye},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},_z={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:G5,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:Rl.Partial},Ar=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!on(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},Sz=qt({name:"nodes",initialState:_z,reducers:{nodesChanged:(e,t)=>{e.nodes=yu(t.payload,e.nodes)},nodeReplaced:(e,t)=>{const n=e.nodes.findIndex(r=>r.id===t.payload.nodeId);n<0||(e.nodes[n]=t.payload.node)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=t8(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=yu(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=su(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!on(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...ew},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=c8(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=jh({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=su(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=jh(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=Pme(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!on(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=jh({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=c8(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=jh({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=c5(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!pE(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!on(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!on(o)&&!cI(o)||(o.data.isOpen=r,!on(o)))return;const a=sA([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=Ame(o,e.nodes,e.edges).filter(d=>on(d)&&d.data.isOpen===!1),u=Eme(o,e.nodes,e.edges).filter(d=>on(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=su(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=su(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),on(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=yu(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{Ar(e,t)},fieldNumberValueChanged:(e,t)=>{Ar(e,t)},fieldBooleanValueChanged:(e,t)=>{Ar(e,t)},fieldBoardValueChanged:(e,t)=>{Ar(e,t)},fieldImageValueChanged:(e,t)=>{Ar(e,t)},fieldColorValueChanged:(e,t)=>{Ar(e,t)},fieldMainModelValueChanged:(e,t)=>{Ar(e,t)},fieldRefinerModelValueChanged:(e,t)=>{Ar(e,t)},fieldVaeModelValueChanged:(e,t)=>{Ar(e,t)},fieldLoRAModelValueChanged:(e,t)=>{Ar(e,t)},fieldControlNetModelValueChanged:(e,t)=>{Ar(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{Ar(e,t)},fieldT2IAdapterModelValueChanged:(e,t)=>{Ar(e,t)},fieldEnumModelValueChanged:(e,t)=>{Ar(e,t)},fieldSchedulerValueChanged:(e,t)=>{Ar(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!on(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=Ye(s.value);if(!l){s.value=i;return}s.value=c5(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];cI(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=Ye(G5)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=yu(n.map(o=>({item:{...o,dragHandle:`.${dz}`},type:"add"})),[]),e.edges=su(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...ew},o),{})},workflowReset:e=>{e.workflow=Ye(G5)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=yu(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=su(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(Ye),e.edgesToCopy=e.edges.filter(t=>t.selected).map(Ye),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(Ye),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(Ye);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=yl();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=t8(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=yu(a.concat(s),e.nodes),e.edges=su(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...ew}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?Rl.Full:Rl.Partial}},extraReducers:e=>{e.addCase(Pg.pending,t=>{t.isReady=!1}),e.addCase(vE,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=wu.IN_PROGRESS)}),e.addCase(_E,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=wu.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(r_,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=wu.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(SE,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=wu.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(i_,(t,n)=>{["in_progress"].includes(n.payload.data.queue_item.status)&&ps(t.nodeExecutionStates,r=>{r.status=wu.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:hje,addNodePopoverOpened:pje,addNodePopoverToggled:gje,connectionEnded:mje,connectionMade:yje,connectionStarted:vje,edgeDeleted:bje,edgeChangeStarted:_je,edgesChanged:Sje,edgesDeleted:xje,edgeUpdated:wje,fieldBoardValueChanged:Cje,fieldBooleanValueChanged:Eje,fieldColorValueChanged:Aje,fieldControlNetModelValueChanged:Tje,fieldEnumModelValueChanged:Pje,fieldImageValueChanged:rS,fieldIPAdapterModelValueChanged:kje,fieldT2IAdapterModelValueChanged:Ije,fieldLabelChanged:Mje,fieldLoRAModelValueChanged:Rje,fieldMainModelValueChanged:Oje,fieldNumberValueChanged:$je,fieldRefinerModelValueChanged:Nje,fieldSchedulerValueChanged:Dje,fieldStringValueChanged:Lje,fieldVaeModelValueChanged:Fje,imageCollectionFieldValueChanged:Bje,mouseOverFieldChanged:zje,mouseOverNodeChanged:jje,nodeAdded:Vje,nodeReplaced:xz,nodeEditorReset:Yye,nodeEmbedWorkflowChanged:Uje,nodeExclusivelySelected:Gje,nodeIsIntermediateChanged:Hje,nodeIsOpenChanged:qje,nodeLabelChanged:Wje,nodeNotesChanged:Kje,nodeOpacityChanged:Xje,nodesChanged:Qje,nodesDeleted:Yje,nodeTemplatesBuilt:wz,nodeUseCacheChanged:Zje,notesNodeValueChanged:Jje,selectedAll:eVe,selectedEdgesChanged:tVe,selectedNodesChanged:nVe,selectionCopied:rVe,selectionModeChanged:iVe,selectionPasted:oVe,shouldAnimateEdgesChanged:aVe,shouldColorEdgesChanged:sVe,shouldShowFieldTypeLegendChanged:lVe,shouldShowMinimapPanelChanged:uVe,shouldSnapToGridChanged:cVe,shouldValidateGraphChanged:dVe,viewportChanged:fVe,workflowAuthorChanged:hVe,workflowContactChanged:pVe,workflowDescriptionChanged:gVe,workflowExposedFieldAdded:Zye,workflowExposedFieldRemoved:mVe,workflowLoaded:Jye,workflowNameChanged:yVe,workflowNotesChanged:vVe,workflowTagsChanged:bVe,workflowVersionChanged:_Ve,edgeAdded:SVe}=Sz.actions,eve=Sz.reducer,Cz={esrganModelName:"RealESRGAN_x4plus.pth"},Ez=qt({name:"postprocessing",initialState:Cz,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:xVe}=Ez.actions,tve=Ez.reducer,Az={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},Tz=qt({name:"sdxl",initialState:Az,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:wVe,setNegativeStylePromptSDXL:CVe,setShouldConcatSDXLStylePrompt:EVe,setShouldUseSDXLRefiner:nve,setSDXLImg2ImgDenoisingStrength:AVe,refinerModelChanged:d8,setRefinerSteps:TVe,setRefinerCFGScale:PVe,setRefinerScheduler:kVe,setRefinerPositiveAestheticScore:IVe,setRefinerNegativeAestheticScore:MVe,setRefinerStart:RVe}=Tz.actions,rve=Tz.reducer,ive=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),vs=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},Pz={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},kz=qt({name:"system",initialState:Pz,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(yE,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(MD,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(vE,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(SE,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:ive(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(_E,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(ND,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(FD,t=>{t.status="LOADING_MODEL"}),e.addCase(zD,t=>{t.status="CONNECTED"}),e.addCase(i_,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.queue_item.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(cve,(t,n)=>{t.toastQueue.push(vs({title:K("toast.serverError"),status:"error",description:mE(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:OVe,setEnableImageDebugging:$Ve,addToast:nt,clearToastQueue:ove,consoleLogLevelChanged:NVe,shouldLogToConsoleChanged:DVe,shouldAntialiasProgressImageChanged:LVe,languageChanged:FVe,shouldUseNSFWCheckerChanged:ave,shouldUseWatermarkerChanged:sve,setShouldEnableInformationalPopovers:BVe,isInitializedChanged:lve}=kz.actions,uve=kz.reducer,cve=ai(r_,VD,GD),dve={searchFolder:null,advancedAddScanModel:null},Iz=qt({name:"modelmanager",initialState:dve,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:zVe,setAdvancedAddScanModel:jVe}=Iz.actions,fve=Iz.reducer,Mz={shift:!1,ctrl:!1,meta:!1},Rz=qt({name:"hotkeys",initialState:Mz,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:VVe,ctrlKeyPressed:UVe,metaKeyPressed:GVe}=Rz.actions,hve=Rz.reducer,Oz={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},$z=qt({name:"ui",initialState:Oz,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(u_,t=>{t.activeTab="img2img"})}}),{setActiveTab:Nz,setShouldShowImageDetails:HVe,setShouldUseCanvasBetaLayout:qVe,setShouldShowExistingModelsInSearch:WVe,setShouldUseSliders:KVe,setShouldHidePreview:XVe,setShouldShowProgressInViewer:QVe,favoriteSchedulersChanged:YVe,toggleEmbeddingPicker:ZVe,setShouldAutoChangeDimensions:JVe,contextMenusClosed:eUe,panelsChanged:tUe}=$z.actions,pve=$z.reducer,gve=nq(qK);Dz=H5=void 0;var mve=gve,yve=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return mve.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function Fz(e,t){if(e){if(typeof e=="string")return h8(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h8(e,t)}}function h8(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?Mve:Rve;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function y8(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function v8(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){y8(o,r,i,a,s,"next",l)}function s(l){y8(o,r,i,a,s,"throw",l)}a(void 0)})}}var $ve=function(){var e=v8(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield Ave(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=v8(function*(){var p=Lz(t.getState(),n);yield Ove(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),pA(p,d)||t.dispatch({type:Sve,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(wve(f,u)):t.subscribe(xve(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const Nve=$ve;function kg(e){"@babel/helpers - typeof";return kg=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},kg(e)}function b8(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 rw(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=rw({},r));var o=typeof t=="function"?t:Mf(t);switch(i.type){case q5:{var a=rw(rw({},n.state),i.payload||{});return n.state=o(a,{type:q5,payload:a}),n.state}default:return o(r,i)}}},zve=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,v){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,v){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(v){return function(y,g,b){var S=v(y,g,b);return Nve(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const nUe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],jve="@@invokeai-",Vve=["cursorPosition"],Uve=["pendingControlImages"],Gve=["prompts"],Hve=["selection","selectedBoardId","galleryView"],qve=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],Wve=[],Kve=[],Xve=["isInitialized","isConnected","denoiseProgress","status"],Qve=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],Yve={canvas:Vve,gallery:Hve,generation:Wve,nodes:qve,postprocessing:Kve,system:Xve,ui:Qve,controlNet:Uve,dynamicPrompts:Gve},Zve=(e,t)=>{const n=$f(e,Yve[t]??[]);return JSON.stringify(n)},Jve={canvas:XL,gallery:zF,generation:PE,nodes:_z,postprocessing:Cz,system:Pz,config:TD,ui:Oz,hotkeys:Mz,controlAdapters:d5,dynamicPrompts:VE,sdxl:Az},e1e=(e,t)=>vD(JSON.parse(e),Jve[t]),t1e=ge("nodes/textToImageGraphBuilt"),n1e=ge("nodes/imageToImageGraphBuilt"),zz=ge("nodes/canvasGraphBuilt"),r1e=ge("nodes/nodesGraphBuilt"),i1e=ai(t1e,n1e,zz,r1e),o1e=ge("nodes/workflowLoadRequested"),a1e=ge("nodes/updateAllNodesRequested"),s1e=e=>{if(i1e(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return Pg.fulfilled.match(e)?{...e,payload:""}:wz.match(e)?{...e,payload:""}:e},l1e=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],u1e=e=>e,c1e=ai(yle,vle),d1e=()=>{pe({matcher:c1e,effect:async(e,{dispatch:t,getState:n})=>{const r=ae("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(ln.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(nt({title:K("queue.cancelBatchSucceeded"),status:"success"}))),t(xle())}catch{r.error("Failed to cancel canvas batches"),t(nt({title:K("queue.cancelBatchFailed"),status:"error"}))}}})};ge("app/appStarted");const f1e=()=>{pe({matcher:ue.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Bi({board_id:"none",categories:Ln}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Dt.getSelectors().selectAll(i)[0];t(ha(o??null))}}})},h1e=()=>{pe({matcher:ln.endpoints.enqueueBatch.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=ln.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(ln.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},jz=No.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:rUe,useGetAppConfigQuery:iUe,useClearInvocationCacheMutation:oUe,useDisableInvocationCacheMutation:aUe,useEnableInvocationCacheMutation:sUe,useGetInvocationCacheStatusQuery:lUe}=jz,p1e=()=>{pe({matcher:jz.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(Xoe(r[0])),i.includes("nsfw_checker")||n(ave(!1)),o.includes("invisible_watermark")||n(sve(!1))}})},g1e=ge("app/appStarted"),m1e=()=>{pe({actionCreator:g1e,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})};function y1e(e){if(e.sheet)return e.sheet;for(var t=0;t0?rr(Df,--ii):0,_f--,xn===10&&(_f=1,aS--),xn}function bi(){return xn=ii2||Mg(xn)>3?"":" "}function I1e(e,t){for(;--t&&bi()&&!(xn<48||xn>102||xn>57&&xn<65||xn>70&&xn<97););return km(e,Qy()+(t<6&&ga()==32&&bi()==32))}function X5(e){for(;bi();)switch(xn){case e:return ii;case 34:case 39:e!==34&&e!==39&&X5(xn);break;case 40:e===41&&X5(e);break;case 92:bi();break}return ii}function M1e(e,t){for(;bi()&&e+xn!==47+10;)if(e+xn===42+42&&ga()===47)break;return"/*"+km(t,ii-1)+"*"+oS(e===47?e:bi())}function R1e(e){for(;!Mg(ga());)bi();return km(e,ii)}function O1e(e){return Wz(Zy("",null,null,null,[""],e=qz(e),0,[0],e))}function Zy(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,v=1,y=0,g="",b=i,S=o,x=r,w=g;_;)switch(p=y,y=bi()){case 40:if(p!=108&&rr(w,d-1)==58){K5(w+=dt(Yy(y),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:w+=Yy(y);break;case 9:case 10:case 13:case 32:w+=k1e(p);break;case 92:w+=I1e(Qy()-1,7);continue;case 47:switch(ga()){case 42:case 47:H0($1e(M1e(bi(),Qy()),t,n),l);break;default:w+="/"}break;case 123*m:s[u++]=ea(w)*v;case 125*m:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+c:v==-1&&(w=dt(w,/\f/g,"")),h>0&&ea(w)-d&&H0(h>32?S8(w+";",r,n,d-1):S8(dt(w," ","")+";",r,n,d-2),l);break;case 59:w+=";";default:if(H0(x=_8(w,t,n,u,c,i,s,g,b=[],S=[],d),o),y===123)if(c===0)Zy(w,t,x,x,b,o,d,s,S);else switch(f===99&&rr(w,3)===110?100:f){case 100:case 108:case 109:case 115:Zy(e,x,x,r&&H0(_8(e,x,x,0,0,i,s,g,i,b=[],d),S),i,S,d,s,r?b:S);break;default:Zy(w,x,x,x,[""],S,0,s,S)}}u=c=h=0,m=v=1,g=w="",d=a;break;case 58:d=1+ea(w),h=p;default:if(m<1){if(y==123)--m;else if(y==125&&m++==0&&P1e()==125)continue}switch(w+=oS(y),y*m){case 38:v=c>0?1:(w+="\f",-1);break;case 44:s[u++]=(ea(w)-1)*v,v=1;break;case 64:ga()===45&&(w+=Yy(bi())),f=ga(),c=d=ea(g=w+=R1e(Qy())),y++;break;case 45:p===45&&ea(w)==2&&(m=0)}}return o}function _8(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=yA(f),p=0,m=0,_=0;p0?f[v]+" "+y:dt(y,/&\f/g,f[v])))&&(l[_++]=g);return sS(e,t,n,i===0?gA:s,l,u,c)}function $1e(e,t,n){return sS(e,t,n,Vz,oS(T1e()),Ig(e,2,-2),0)}function S8(e,t,n,r){return sS(e,t,n,mA,Ig(e,0,r),Ig(e,r+1,-1),r)}function zd(e,t){for(var n="",r=yA(e),i=0;i6)switch(rr(e,t+1)){case 109:if(rr(e,t+4)!==45)break;case 102:return dt(e,/(.+:)(.+)-([^]+)/,"$1"+ct+"$2-$3$1"+V1+(rr(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~K5(e,"stretch")?Xz(dt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(rr(e,t+1)!==115)break;case 6444:switch(rr(e,ea(e)-3-(~K5(e,"!important")&&10))){case 107:return dt(e,":",":"+ct)+e;case 101:return dt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ct+(rr(e,14)===45?"inline-":"")+"box$3$1"+ct+"$2$3$1"+fr+"$2box$3")+e}break;case 5936:switch(rr(e,t+11)){case 114:return ct+e+fr+dt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ct+e+fr+dt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ct+e+fr+dt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ct+e+fr+e+e}return e}var U1e=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case mA:t.return=Xz(t.value,t.length);break;case Uz:return zd([gh(t,{value:dt(t.value,"@","@"+ct)})],i);case gA:if(t.length)return A1e(t.props,function(o){switch(E1e(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return zd([gh(t,{props:[dt(o,/:(read-\w+)/,":"+V1+"$1")]})],i);case"::placeholder":return zd([gh(t,{props:[dt(o,/:(plac\w+)/,":"+ct+"input-$1")]}),gh(t,{props:[dt(o,/:(plac\w+)/,":"+V1+"$1")]}),gh(t,{props:[dt(o,/:(plac\w+)/,fr+"input-$1")]})],i)}return""})}},G1e=[U1e],H1e=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||G1e,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),v=1;v<_.length;v++)o[_[v]]=!0;s.push(m)});var l,u=[j1e,V1e];{var c,d=[N1e,L1e(function(m){c.insert(m)})],f=D1e(u.concat(i,d)),h=function(_){return zd(O1e(_),f)};l=function(_,v,y,g){c=y,h(_?_+"{"+v.styles+"}":v.styles),g&&(p.inserted[v.name]=!0)}}var p={key:n,sheet:new b1e({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},q1e=!0;function W1e(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var Qz=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||q1e===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},Yz=function(t,n,r){Qz(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function K1e(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var X1e={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Q1e=/[A-Z]|^ms/g,Y1e=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Zz=function(t){return t.charCodeAt(1)===45},C8=function(t){return t!=null&&typeof t!="boolean"},iw=Kz(function(e){return Zz(e)?e:e.replace(Q1e,"-$&").toLowerCase()}),E8=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Y1e,function(r,i,o){return ta={name:i,styles:o,next:ta},i})}return X1e[t]!==1&&!Zz(t)&&typeof n=="number"&&n!==0?n+"px":n};function Rg(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return ta={name:n.name,styles:n.styles,next:ta},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ta={name:r.name,styles:r.styles,next:ta},r=r.next;var i=n.styles+";";return i}return Z1e(e,t,n)}case"function":{if(e!==void 0){var o=ta,a=n(e);return ta=o,Rg(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function Z1e(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iq.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),hbe=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=k.useState(null),o=k.useRef(null),[,a]=k.useState({});k.useEffect(()=>a({}),[]);const s=cbe(),l=lbe();U1(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=bA,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?q.jsx(fbe,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?pi.createPortal(q.jsx(rj,{value:o.current,children:u}),o.current):q.jsx("span",{ref:c=>{c&&i(c)}})},pbe=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=k.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=bA),l},[i]),[,s]=k.useState({});return U1(()=>s({}),[]),U1(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?pi.createPortal(q.jsx(rj,{value:r?a:null,children:t}),a):null};function lS(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?q.jsx(pbe,{containerRef:n,...r}):q.jsx(hbe,{...r})}lS.className=bA;lS.selector=dbe;lS.displayName="Portal";function ij(){const e=k.useContext(Og);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var _A=k.createContext({});_A.displayName="ColorModeContext";function uS(){const e=k.useContext(_A);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function uUe(e,t){const{colorMode:n}=uS();return n==="dark"?t:e}function oj(){const e=uS(),t=ij();return{...e,theme:t}}function gbe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function mbe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function cUe(e,t,n){const r=ij();return ybe(e,t,n)(r)}function ybe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return gbe(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return mbe(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Kl=(...e)=>e.filter(Boolean).join(" ");function vbe(){return!1}function ma(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var dUe=e=>{const{condition:t,message:n}=e;t&&vbe()&&console.warn(n)};function la(e,...t){return bbe(e)?e(...t):e}var bbe=e=>typeof e=="function",fUe=e=>e?"":void 0,hUe=e=>e?!0:void 0;function pUe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function gUe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var G1={exports:{}};G1.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",v="[object Null]",y="[object Object]",g="[object Proxy]",b="[object RegExp]",S="[object Set]",x="[object String]",w="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",A="[object DataView]",I="[object Float32Array]",D="[object Float64Array]",M="[object Int8Array]",E="[object Int16Array]",P="[object Int32Array]",N="[object Uint8Array]",L="[object Uint8ClampedArray]",O="[object Uint16Array]",R="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,z=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,H={};H[I]=H[D]=H[M]=H[E]=H[P]=H[N]=H[L]=H[O]=H[R]=!0,H[s]=H[l]=H[T]=H[c]=H[A]=H[d]=H[f]=H[h]=H[m]=H[_]=H[y]=H[b]=H[S]=H[x]=H[C]=!1;var Q=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,Z=typeof self=="object"&&self&&self.Object===Object&&self,J=Q||Z||Function("return this")(),j=t&&!t.nodeType&&t,X=j&&!0&&e&&!e.nodeType&&e,ee=X&&X.exports===j,ne=ee&&Q.process,fe=function(){try{var B=X&&X.require&&X.require("util").types;return B||ne&&ne.binding&&ne.binding("util")}catch{}}(),de=fe&&fe.isTypedArray;function Be(B,U,Y){switch(Y.length){case 0:return B.call(U);case 1:return B.call(U,Y[0]);case 2:return B.call(U,Y[0],Y[1]);case 3:return B.call(U,Y[0],Y[1],Y[2])}return B.apply(U,Y)}function $e(B,U){for(var Y=-1,me=Array(B);++Y-1}function Oa(B,U){var Y=this.__data__,me=Ec(Y,B);return me<0?(++this.size,Y.push([B,U])):Y[me][1]=U,this}Yn.prototype.clear=Ra,Yn.prototype.delete=Is,Yn.prototype.get=Ms,Yn.prototype.has=Cc,Yn.prototype.set=Oa;function Cr(B){var U=-1,Y=B==null?0:B.length;for(this.clear();++U1?Y[et-1]:void 0,jt=et>2?Y[2]:void 0;for(wt=B.length>3&&typeof wt=="function"?(et--,wt):void 0,jt&&BH(Y[0],Y[1],jt)&&(wt=et<3?void 0:wt,et=1),U=Object(U);++me-1&&B%1==0&&B0){if(++U>=i)return arguments[0]}else U=0;return B.apply(void 0,arguments)}}function WH(B){if(B!=null){try{return St.call(B)}catch{}try{return B+""}catch{}}return""}function Zm(B,U){return B===U||B!==B&&U!==U}var j2=Pc(function(){return arguments}())?Pc:function(B){return Qf(B)&&bn.call(B,"callee")&&!uo.call(B,"callee")},V2=Array.isArray;function U2(B){return B!=null&&jT(B.length)&&!G2(B)}function KH(B){return Qf(B)&&U2(B)}var zT=tu||JH;function G2(B){if(!iu(B))return!1;var U=Tc(B);return U==h||U==p||U==u||U==g}function jT(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=a}function iu(B){var U=typeof B;return B!=null&&(U=="object"||U=="function")}function Qf(B){return B!=null&&typeof B=="object"}function XH(B){if(!Qf(B)||Tc(B)!=y)return!1;var U=si(B);if(U===null)return!0;var Y=bn.call(U,"constructor")&&U.constructor;return typeof Y=="function"&&Y instanceof Y&&St.call(Y)==ki}var VT=de?Ce(de):EH;function QH(B){return $H(B,UT(B))}function UT(B){return U2(B)?D2(B,!0):AH(B)}var YH=NH(function(B,U,Y,me){LT(B,U,Y,me)});function ZH(B){return function(){return B}}function GT(B){return B}function JH(){return!1}e.exports=YH})(G1,G1.exports);var _be=G1.exports;const ua=Bl(_be);var Sbe=e=>/!(important)?$/.test(e),P8=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,xbe=(e,t)=>n=>{const r=String(t),i=Sbe(r),o=P8(r),a=e?`${e}.${o}`:o;let s=ma(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=P8(s),i?`${s} !important`:s};function SA(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=xbe(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var q0=(...e)=>t=>e.reduce((n,r)=>r(n),t);function $i(e,t){return n=>{const r={property:n,scale:e};return r.transform=SA({scale:e,transform:t}),r}}var wbe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function Cbe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:wbe(t),transform:n?SA({scale:n,compose:r}):r}}var aj=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function Ebe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...aj].join(" ")}function Abe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...aj].join(" ")}var Tbe={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},Pbe={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function kbe(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Ibe={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},Q5={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},Mbe=new Set(Object.values(Q5)),Y5=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Rbe=e=>e.trim();function Obe(e,t){if(e==null||Y5.has(e))return e;if(!(Z5(e)||Y5.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(Rbe).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in Q5?Q5[l]:l;u.unshift(c);const d=u.map(f=>{if(Mbe.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=Z5(m)?m:m&&m.split(" "),v=`colors.${p}`,y=v in t.__cssMap?t.__cssMap[v].varRef:p;return _?[y,...Array.isArray(_)?_:[_]].join(" "):y});return`${s}(${d.join(", ")})`}var Z5=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),$be=(e,t)=>Obe(e,t??{});function Nbe(e){return/^var\(--.+\)$/.test(e)}var Dbe=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},Ho=e=>t=>`${e}(${t})`,ot={filter(e){return e!=="auto"?e:Tbe},backdropFilter(e){return e!=="auto"?e:Pbe},ring(e){return kbe(ot.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?Ebe():e==="auto-gpu"?Abe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=Dbe(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(Nbe(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:$be,blur:Ho("blur"),opacity:Ho("opacity"),brightness:Ho("brightness"),contrast:Ho("contrast"),dropShadow:Ho("drop-shadow"),grayscale:Ho("grayscale"),hueRotate:Ho("hue-rotate"),invert:Ho("invert"),saturate:Ho("saturate"),sepia:Ho("sepia"),bgImage(e){return e==null||Z5(e)||Y5.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=Ibe[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},G={borderWidths:$i("borderWidths"),borderStyles:$i("borderStyles"),colors:$i("colors"),borders:$i("borders"),gradients:$i("gradients",ot.gradient),radii:$i("radii",ot.px),space:$i("space",q0(ot.vh,ot.px)),spaceT:$i("space",q0(ot.vh,ot.px)),degreeT(e){return{property:e,transform:ot.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:SA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:$i("sizes",q0(ot.vh,ot.px)),sizesT:$i("sizes",q0(ot.vh,ot.fraction)),shadows:$i("shadows"),logical:Cbe,blur:$i("blur",ot.blur)},Jy={background:G.colors("background"),backgroundColor:G.colors("backgroundColor"),backgroundImage:G.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:ot.bgClip},bgSize:G.prop("backgroundSize"),bgPosition:G.prop("backgroundPosition"),bg:G.colors("background"),bgColor:G.colors("backgroundColor"),bgPos:G.prop("backgroundPosition"),bgRepeat:G.prop("backgroundRepeat"),bgAttachment:G.prop("backgroundAttachment"),bgGradient:G.gradients("backgroundImage"),bgClip:{transform:ot.bgClip}};Object.assign(Jy,{bgImage:Jy.backgroundImage,bgImg:Jy.backgroundImage});var ut={border:G.borders("border"),borderWidth:G.borderWidths("borderWidth"),borderStyle:G.borderStyles("borderStyle"),borderColor:G.colors("borderColor"),borderRadius:G.radii("borderRadius"),borderTop:G.borders("borderTop"),borderBlockStart:G.borders("borderBlockStart"),borderTopLeftRadius:G.radii("borderTopLeftRadius"),borderStartStartRadius:G.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:G.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:G.radii("borderTopRightRadius"),borderStartEndRadius:G.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:G.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:G.borders("borderRight"),borderInlineEnd:G.borders("borderInlineEnd"),borderBottom:G.borders("borderBottom"),borderBlockEnd:G.borders("borderBlockEnd"),borderBottomLeftRadius:G.radii("borderBottomLeftRadius"),borderBottomRightRadius:G.radii("borderBottomRightRadius"),borderLeft:G.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:G.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:G.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:G.borders(["borderLeft","borderRight"]),borderInline:G.borders("borderInline"),borderY:G.borders(["borderTop","borderBottom"]),borderBlock:G.borders("borderBlock"),borderTopWidth:G.borderWidths("borderTopWidth"),borderBlockStartWidth:G.borderWidths("borderBlockStartWidth"),borderTopColor:G.colors("borderTopColor"),borderBlockStartColor:G.colors("borderBlockStartColor"),borderTopStyle:G.borderStyles("borderTopStyle"),borderBlockStartStyle:G.borderStyles("borderBlockStartStyle"),borderBottomWidth:G.borderWidths("borderBottomWidth"),borderBlockEndWidth:G.borderWidths("borderBlockEndWidth"),borderBottomColor:G.colors("borderBottomColor"),borderBlockEndColor:G.colors("borderBlockEndColor"),borderBottomStyle:G.borderStyles("borderBottomStyle"),borderBlockEndStyle:G.borderStyles("borderBlockEndStyle"),borderLeftWidth:G.borderWidths("borderLeftWidth"),borderInlineStartWidth:G.borderWidths("borderInlineStartWidth"),borderLeftColor:G.colors("borderLeftColor"),borderInlineStartColor:G.colors("borderInlineStartColor"),borderLeftStyle:G.borderStyles("borderLeftStyle"),borderInlineStartStyle:G.borderStyles("borderInlineStartStyle"),borderRightWidth:G.borderWidths("borderRightWidth"),borderInlineEndWidth:G.borderWidths("borderInlineEndWidth"),borderRightColor:G.colors("borderRightColor"),borderInlineEndColor:G.colors("borderInlineEndColor"),borderRightStyle:G.borderStyles("borderRightStyle"),borderInlineEndStyle:G.borderStyles("borderInlineEndStyle"),borderTopRadius:G.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:G.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:G.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:G.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(ut,{rounded:ut.borderRadius,roundedTop:ut.borderTopRadius,roundedTopLeft:ut.borderTopLeftRadius,roundedTopRight:ut.borderTopRightRadius,roundedTopStart:ut.borderStartStartRadius,roundedTopEnd:ut.borderStartEndRadius,roundedBottom:ut.borderBottomRadius,roundedBottomLeft:ut.borderBottomLeftRadius,roundedBottomRight:ut.borderBottomRightRadius,roundedBottomStart:ut.borderEndStartRadius,roundedBottomEnd:ut.borderEndEndRadius,roundedLeft:ut.borderLeftRadius,roundedRight:ut.borderRightRadius,roundedStart:ut.borderInlineStartRadius,roundedEnd:ut.borderInlineEndRadius,borderStart:ut.borderInlineStart,borderEnd:ut.borderInlineEnd,borderTopStartRadius:ut.borderStartStartRadius,borderTopEndRadius:ut.borderStartEndRadius,borderBottomStartRadius:ut.borderEndStartRadius,borderBottomEndRadius:ut.borderEndEndRadius,borderStartRadius:ut.borderInlineStartRadius,borderEndRadius:ut.borderInlineEndRadius,borderStartWidth:ut.borderInlineStartWidth,borderEndWidth:ut.borderInlineEndWidth,borderStartColor:ut.borderInlineStartColor,borderEndColor:ut.borderInlineEndColor,borderStartStyle:ut.borderInlineStartStyle,borderEndStyle:ut.borderInlineEndStyle});var Lbe={color:G.colors("color"),textColor:G.colors("color"),fill:G.colors("fill"),stroke:G.colors("stroke")},J5={boxShadow:G.shadows("boxShadow"),mixBlendMode:!0,blendMode:G.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:G.prop("backgroundBlendMode"),opacity:!0};Object.assign(J5,{shadow:J5.boxShadow});var Fbe={filter:{transform:ot.filter},blur:G.blur("--chakra-blur"),brightness:G.propT("--chakra-brightness",ot.brightness),contrast:G.propT("--chakra-contrast",ot.contrast),hueRotate:G.degreeT("--chakra-hue-rotate"),invert:G.propT("--chakra-invert",ot.invert),saturate:G.propT("--chakra-saturate",ot.saturate),dropShadow:G.propT("--chakra-drop-shadow",ot.dropShadow),backdropFilter:{transform:ot.backdropFilter},backdropBlur:G.blur("--chakra-backdrop-blur"),backdropBrightness:G.propT("--chakra-backdrop-brightness",ot.brightness),backdropContrast:G.propT("--chakra-backdrop-contrast",ot.contrast),backdropHueRotate:G.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:G.propT("--chakra-backdrop-invert",ot.invert),backdropSaturate:G.propT("--chakra-backdrop-saturate",ot.saturate)},H1={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:ot.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:G.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:G.space("gap"),rowGap:G.space("rowGap"),columnGap:G.space("columnGap")};Object.assign(H1,{flexDir:H1.flexDirection});var sj={gridGap:G.space("gridGap"),gridColumnGap:G.space("gridColumnGap"),gridRowGap:G.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},Bbe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:ot.outline},outlineOffset:!0,outlineColor:G.colors("outlineColor")},Li={width:G.sizesT("width"),inlineSize:G.sizesT("inlineSize"),height:G.sizes("height"),blockSize:G.sizes("blockSize"),boxSize:G.sizes(["width","height"]),minWidth:G.sizes("minWidth"),minInlineSize:G.sizes("minInlineSize"),minHeight:G.sizes("minHeight"),minBlockSize:G.sizes("minBlockSize"),maxWidth:G.sizes("maxWidth"),maxInlineSize:G.sizes("maxInlineSize"),maxHeight:G.sizes("maxHeight"),maxBlockSize:G.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:G.propT("float",ot.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(Li,{w:Li.width,h:Li.height,minW:Li.minWidth,maxW:Li.maxWidth,minH:Li.minHeight,maxH:Li.maxHeight,overscroll:Li.overscrollBehavior,overscrollX:Li.overscrollBehaviorX,overscrollY:Li.overscrollBehaviorY});var zbe={listStyleType:!0,listStylePosition:!0,listStylePos:G.prop("listStylePosition"),listStyleImage:!0,listStyleImg:G.prop("listStyleImage")};function jbe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},Ube=Vbe(jbe),Gbe={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},Hbe={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},ow=(e,t,n)=>{const r={},i=Ube(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},qbe={srOnly:{transform(e){return e===!0?Gbe:e==="focusable"?Hbe:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>ow(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>ow(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>ow(t,e,n)}},hp={position:!0,pos:G.prop("position"),zIndex:G.prop("zIndex","zIndices"),inset:G.spaceT("inset"),insetX:G.spaceT(["left","right"]),insetInline:G.spaceT("insetInline"),insetY:G.spaceT(["top","bottom"]),insetBlock:G.spaceT("insetBlock"),top:G.spaceT("top"),insetBlockStart:G.spaceT("insetBlockStart"),bottom:G.spaceT("bottom"),insetBlockEnd:G.spaceT("insetBlockEnd"),left:G.spaceT("left"),insetInlineStart:G.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:G.spaceT("right"),insetInlineEnd:G.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(hp,{insetStart:hp.insetInlineStart,insetEnd:hp.insetInlineEnd});var Wbe={ring:{transform:ot.ring},ringColor:G.colors("--chakra-ring-color"),ringOffset:G.prop("--chakra-ring-offset-width"),ringOffsetColor:G.colors("--chakra-ring-offset-color"),ringInset:G.prop("--chakra-ring-inset")},Nt={margin:G.spaceT("margin"),marginTop:G.spaceT("marginTop"),marginBlockStart:G.spaceT("marginBlockStart"),marginRight:G.spaceT("marginRight"),marginInlineEnd:G.spaceT("marginInlineEnd"),marginBottom:G.spaceT("marginBottom"),marginBlockEnd:G.spaceT("marginBlockEnd"),marginLeft:G.spaceT("marginLeft"),marginInlineStart:G.spaceT("marginInlineStart"),marginX:G.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:G.spaceT("marginInline"),marginY:G.spaceT(["marginTop","marginBottom"]),marginBlock:G.spaceT("marginBlock"),padding:G.space("padding"),paddingTop:G.space("paddingTop"),paddingBlockStart:G.space("paddingBlockStart"),paddingRight:G.space("paddingRight"),paddingBottom:G.space("paddingBottom"),paddingBlockEnd:G.space("paddingBlockEnd"),paddingLeft:G.space("paddingLeft"),paddingInlineStart:G.space("paddingInlineStart"),paddingInlineEnd:G.space("paddingInlineEnd"),paddingX:G.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:G.space("paddingInline"),paddingY:G.space(["paddingTop","paddingBottom"]),paddingBlock:G.space("paddingBlock")};Object.assign(Nt,{m:Nt.margin,mt:Nt.marginTop,mr:Nt.marginRight,me:Nt.marginInlineEnd,marginEnd:Nt.marginInlineEnd,mb:Nt.marginBottom,ml:Nt.marginLeft,ms:Nt.marginInlineStart,marginStart:Nt.marginInlineStart,mx:Nt.marginX,my:Nt.marginY,p:Nt.padding,pt:Nt.paddingTop,py:Nt.paddingY,px:Nt.paddingX,pb:Nt.paddingBottom,pl:Nt.paddingLeft,ps:Nt.paddingInlineStart,paddingStart:Nt.paddingInlineStart,pr:Nt.paddingRight,pe:Nt.paddingInlineEnd,paddingEnd:Nt.paddingInlineEnd});var Kbe={textDecorationColor:G.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:G.shadows("textShadow")},Xbe={clipPath:!0,transform:G.propT("transform",ot.transform),transformOrigin:!0,translateX:G.spaceT("--chakra-translate-x"),translateY:G.spaceT("--chakra-translate-y"),skewX:G.degreeT("--chakra-skew-x"),skewY:G.degreeT("--chakra-skew-y"),scaleX:G.prop("--chakra-scale-x"),scaleY:G.prop("--chakra-scale-y"),scale:G.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:G.degreeT("--chakra-rotate")},Qbe={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:G.prop("transitionDuration","transition.duration"),transitionProperty:G.prop("transitionProperty","transition.property"),transitionTimingFunction:G.prop("transitionTimingFunction","transition.easing")},Ybe={fontFamily:G.prop("fontFamily","fonts"),fontSize:G.prop("fontSize","fontSizes",ot.px),fontWeight:G.prop("fontWeight","fontWeights"),lineHeight:G.prop("lineHeight","lineHeights"),letterSpacing:G.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},Zbe={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:G.spaceT("scrollMargin"),scrollMarginTop:G.spaceT("scrollMarginTop"),scrollMarginBottom:G.spaceT("scrollMarginBottom"),scrollMarginLeft:G.spaceT("scrollMarginLeft"),scrollMarginRight:G.spaceT("scrollMarginRight"),scrollMarginX:G.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:G.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:G.spaceT("scrollPadding"),scrollPaddingTop:G.spaceT("scrollPaddingTop"),scrollPaddingBottom:G.spaceT("scrollPaddingBottom"),scrollPaddingLeft:G.spaceT("scrollPaddingLeft"),scrollPaddingRight:G.spaceT("scrollPaddingRight"),scrollPaddingX:G.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:G.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function lj(e){return ma(e)&&e.reference?e.reference:String(e)}var cS=(e,...t)=>t.map(lj).join(` ${e} `).replace(/calc/g,""),k8=(...e)=>`calc(${cS("+",...e)})`,I8=(...e)=>`calc(${cS("-",...e)})`,e3=(...e)=>`calc(${cS("*",...e)})`,M8=(...e)=>`calc(${cS("/",...e)})`,R8=e=>{const t=lj(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:e3(t,-1)},Cu=Object.assign(e=>({add:(...t)=>Cu(k8(e,...t)),subtract:(...t)=>Cu(I8(e,...t)),multiply:(...t)=>Cu(e3(e,...t)),divide:(...t)=>Cu(M8(e,...t)),negate:()=>Cu(R8(e)),toString:()=>e.toString()}),{add:k8,subtract:I8,multiply:e3,divide:M8,negate:R8});function Jbe(e,t="-"){return e.replace(/\s+/g,t)}function e_e(e){const t=Jbe(e.toString());return n_e(t_e(t))}function t_e(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function n_e(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function r_e(e,t=""){return[t,e].filter(Boolean).join("-")}function i_e(e,t){return`var(${e}${t?`, ${t}`:""})`}function o_e(e,t=""){return e_e(`--${r_e(e,t)}`)}function Pe(e,t,n){const r=o_e(e,n);return{variable:r,reference:i_e(r,t)}}function a_e(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=Pe(`${e}-${i}`,o);continue}n[r]=Pe(`${e}-${r}`)}return n}function s_e(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function l_e(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function t3(e){if(e==null)return e;const{unitless:t}=l_e(e);return t||typeof e=="number"?`${e}px`:e}var uj=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,xA=e=>Object.fromEntries(Object.entries(e).sort(uj));function O8(e){const t=xA(e);return Object.assign(Object.values(t),t)}function u_e(e){const t=Object.keys(xA(e));return new Set(t)}function $8(e){var t;if(!e)return e;e=(t=t3(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Gh(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${t3(e)})`),t&&n.push("and",`(max-width: ${t3(t)})`),n.join(" ")}function c_e(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=O8(e),r=Object.entries(e).sort(uj).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?$8(d):void 0,{_minW:$8(s),breakpoint:a,minW:s,maxW:d,maxWQuery:Gh(null,d),minWQuery:Gh(s),minMaxQuery:Gh(s,d)}}),i=u_e(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:xA(e),asArray:O8(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>Gh(a)).slice(1)],toArrayValue(a){if(!ma(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;s_e(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var Zn={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},Ds=e=>cj(t=>e(t,"&"),"[role=group]","[data-group]",".group"),Da=e=>cj(t=>e(t,"~ &"),"[data-peer]",".peer"),cj=(e,...t)=>t.map(e).join(", "),dS={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:Ds(Zn.hover),_peerHover:Da(Zn.hover),_groupFocus:Ds(Zn.focus),_peerFocus:Da(Zn.focus),_groupFocusVisible:Ds(Zn.focusVisible),_peerFocusVisible:Da(Zn.focusVisible),_groupActive:Ds(Zn.active),_peerActive:Da(Zn.active),_groupDisabled:Ds(Zn.disabled),_peerDisabled:Da(Zn.disabled),_groupInvalid:Ds(Zn.invalid),_peerInvalid:Da(Zn.invalid),_groupChecked:Ds(Zn.checked),_peerChecked:Da(Zn.checked),_groupFocusWithin:Ds(Zn.focusWithin),_peerFocusWithin:Da(Zn.focusWithin),_peerPlaceholderShown:Da(Zn.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},dj=Object.keys(dS);function N8(e,t){return Pe(String(e).replace(/\./g,"-"),void 0,t)}function d_e(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=N8(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Cu.negate(s),v=Cu.negate(u);r[m]={value:_,var:l,varRef:v}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=N8(p,t==null?void 0:t.cssVarPrefix);return _},d=ma(s)?s:{default:s};n=ua(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const v=c(`${p}`);if(h==="default")return f[l]=v,f;const y=(_=(m=dS)==null?void 0:m[h])!=null?_:h;return f[y]={[l]:v},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function f_e(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function h_e(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function p_e(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function D8(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(p_e(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var g_e=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function m_e(e){return h_e(e,g_e)}function y_e(e){return e.semanticTokens}function v_e(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var b_e=e=>dj.includes(e)||e==="default";function __e({tokens:e,semanticTokens:t}){const n={};return D8(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),D8(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(b_e)}),n}function S_e(e){var t;const n=v_e(e),r=m_e(n),i=y_e(n),o=__e({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=d_e(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:c_e(n.breakpoints)}),n}var wA=ua({},Jy,ut,Lbe,H1,Li,Fbe,Wbe,Bbe,sj,qbe,hp,J5,Nt,Zbe,Ybe,Kbe,Xbe,zbe,Qbe),x_e=Object.assign({},Nt,Li,H1,sj,hp),mUe=Object.keys(x_e),w_e=[...Object.keys(wA),...dj],C_e={...wA,...dS},E_e=e=>e in C_e,A_e=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=la(e[a],t);if(s==null)continue;if(s=ma(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!P_e(t),I_e=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=T_e(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function M_e(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=la(o,r),d=A_e(c)(r);let f={};for(let h in d){const p=d[h];let m=la(p,r);h in n&&(h=n[h]),k_e(h,m)&&(m=I_e(r,m));let _=t[h];if(_===!0&&(_={property:h}),ma(m)){f[h]=(s=f[h])!=null?s:{},f[h]=ua({},f[h],i(m,!0));continue}let v=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;v=_!=null&&_.processResult?i(v,!0):v;const y=la(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=la(_.static,r);f=ua({},f,g)}if(y&&Array.isArray(y)){for(const g of y)f[g]=v;continue}if(y){y==="&"&&ma(v)?f=ua({},f,v):f[y]=v;continue}if(ma(v)){f=ua({},f,v);continue}f[h]=v}return f};return i}var fj=e=>t=>M_e({theme:t,pseudos:dS,configs:wA})(e);function ze(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function R_e(e,t){if(Array.isArray(e))return e;if(ma(e))return t(e);if(e!=null)return[e]}function O_e(e,t){for(let n=t+1;n{ua(u,{[g]:f?y[g]:{[v]:y[g]}})});continue}if(!h){f?ua(u,y):u[v]=y;continue}u[v]=y}}return u}}function N_e(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=$_e(o);return ua({},la((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function yUe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Mm(e){return f_e(e,["styleConfig","size","variant","colorScheme"])}var D_e={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},L_e={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},F_e={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},B_e={property:D_e,easing:L_e,duration:F_e},z_e=B_e,j_e={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},V_e=j_e,U_e={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},G_e=U_e,H_e={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},q_e=H_e,W_e={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},K_e=W_e,X_e={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},Q_e=X_e,Y_e={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},Z_e=Y_e,J_e={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},eSe=J_e,tSe={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},hj=tSe,pj={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},nSe={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},rSe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},iSe={...pj,...nSe,container:rSe},gj=iSe,oSe={breakpoints:q_e,zIndices:V_e,radii:Q_e,blur:eSe,colors:K_e,...hj,sizes:gj,shadows:Z_e,space:pj,borders:G_e,transition:z_e},{defineMultiStyleConfig:aSe,definePartsStyle:Hh}=ze(["stepper","step","title","description","indicator","separator","icon","number"]),Ka=Pe("stepper-indicator-size"),ud=Pe("stepper-icon-size"),cd=Pe("stepper-title-font-size"),qh=Pe("stepper-description-font-size"),mh=Pe("stepper-accent-color"),sSe=Hh(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[mh.variable]:`colors.${e}.500`,_dark:{[mh.variable]:`colors.${e}.200`}},title:{fontSize:cd.reference,fontWeight:"medium"},description:{fontSize:qh.reference,color:"chakra-subtle-text"},number:{fontSize:cd.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:ud.reference,height:ud.reference},indicator:{flexShrink:0,borderRadius:"full",width:Ka.reference,height:Ka.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:mh.reference},"&[data-status=complete]":{bg:mh.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:mh.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Ka.reference} - 8px)`,top:`calc(${Ka.reference} + 4px)`,insetStart:`calc(${Ka.reference} / 2 - 1px)`}}})),lSe=aSe({baseStyle:sSe,sizes:{xs:Hh({stepper:{[Ka.variable]:"sizes.4",[ud.variable]:"sizes.3",[cd.variable]:"fontSizes.xs",[qh.variable]:"fontSizes.xs"}}),sm:Hh({stepper:{[Ka.variable]:"sizes.6",[ud.variable]:"sizes.4",[cd.variable]:"fontSizes.sm",[qh.variable]:"fontSizes.xs"}}),md:Hh({stepper:{[Ka.variable]:"sizes.8",[ud.variable]:"sizes.5",[cd.variable]:"fontSizes.md",[qh.variable]:"fontSizes.sm"}}),lg:Hh({stepper:{[Ka.variable]:"sizes.10",[ud.variable]:"sizes.6",[cd.variable]:"fontSizes.lg",[qh.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function pt(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return pt(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return pt(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var mj=pt("accordion").parts("root","container","button","panel").extend("icon"),uSe=pt("alert").parts("title","description","container").extend("icon","spinner"),cSe=pt("avatar").parts("label","badge","container").extend("excessLabel","group"),dSe=pt("breadcrumb").parts("link","item","container").extend("separator");pt("button").parts();var yj=pt("checkbox").parts("control","icon","container").extend("label");pt("progress").parts("track","filledTrack").extend("label");var fSe=pt("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),vj=pt("editable").parts("preview","input","textarea"),hSe=pt("form").parts("container","requiredIndicator","helperText"),pSe=pt("formError").parts("text","icon"),bj=pt("input").parts("addon","field","element","group"),gSe=pt("list").parts("container","item","icon"),_j=pt("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),Sj=pt("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),xj=pt("numberinput").parts("root","field","stepperGroup","stepper");pt("pininput").parts("field");var wj=pt("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),Cj=pt("progress").parts("label","filledTrack","track"),mSe=pt("radio").parts("container","control","label"),Ej=pt("select").parts("field","icon"),Aj=pt("slider").parts("container","track","thumb","filledTrack","mark"),ySe=pt("stat").parts("container","label","helpText","number","icon"),Tj=pt("switch").parts("container","track","thumb"),vSe=pt("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),Pj=pt("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),bSe=pt("tag").parts("container","label","closeButton"),_Se=pt("card").parts("container","header","body","footer");function Ou(e,t,n){return Math.min(Math.max(e,n),t)}class SSe extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Wh=SSe;function CA(e){if(typeof e!="string")throw new Wh(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=kSe.test(e)?CSe(e):e;const n=ESe.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt($g(s,2),16)),parseInt($g(a[3]||"f",2),16)/255]}const r=ASe.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=TSe.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=PSe.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(Ou(0,100,s)!==s)throw new Wh(e);if(Ou(0,100,l)!==l)throw new Wh(e);return[...ISe(a,s,l),Number.isNaN(u)?1:u]}throw new Wh(e)}function xSe(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const L8=e=>parseInt(e.replace(/_/g,""),36),wSe="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=L8(t.substring(0,3)),r=L8(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function CSe(e){const t=e.toLowerCase().trim(),n=wSe[xSe(t)];if(!n)throw new Wh(e);return`#${n}`}const $g=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),ESe=new RegExp(`^#${$g("([a-f0-9])",3)}([a-f0-9])?$`,"i"),ASe=new RegExp(`^#${$g("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),TSe=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${$g(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),PSe=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,kSe=/^[a-z]+$/i,F8=e=>Math.round(e*255),ISe=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(F8);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(F8)};function MSe(e,t,n,r){return`rgba(${Ou(0,255,e).toFixed()}, ${Ou(0,255,t).toFixed()}, ${Ou(0,255,n).toFixed()}, ${parseFloat(Ou(0,1,r).toFixed(3))})`}function RSe(e,t){const[n,r,i,o]=CA(e);return MSe(n,r,i,o-t)}function OSe(e){const[t,n,r,i]=CA(e);let o=a=>{const s=Ou(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function $Se(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,Rr=(e,t,n)=>{const r=$Se(e,`colors.${t}`,t);try{return OSe(r),r}catch{return n??"#000000"}},DSe=e=>{const[t,n,r]=CA(e);return(t*299+n*587+r*114)/1e3},LSe=e=>t=>{const n=Rr(t,e);return DSe(n)<128?"dark":"light"},FSe=e=>t=>LSe(e)(t)==="dark",Sf=(e,t)=>n=>{const r=Rr(n,e);return RSe(r,1-t)};function B8(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( - 45deg, - ${t} 25%, - transparent 25%, - transparent 50%, - ${t} 50%, - ${t} 75%, - transparent 75%, - transparent - )`,backgroundSize:`${e} ${e}`}}var BSe=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function zSe(e){const t=BSe();return!e||NSe(e)?t:e.string&&e.colors?VSe(e.string,e.colors):e.string&&!e.colors?jSe(e.string):e.colors&&!e.string?USe(e.colors):t}function jSe(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function VSe(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function EA(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function kj(e){return ma(e)&&e.reference?e.reference:String(e)}var fS=(e,...t)=>t.map(kj).join(` ${e} `).replace(/calc/g,""),z8=(...e)=>`calc(${fS("+",...e)})`,j8=(...e)=>`calc(${fS("-",...e)})`,n3=(...e)=>`calc(${fS("*",...e)})`,V8=(...e)=>`calc(${fS("/",...e)})`,U8=e=>{const t=kj(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:n3(t,-1)},Xa=Object.assign(e=>({add:(...t)=>Xa(z8(e,...t)),subtract:(...t)=>Xa(j8(e,...t)),multiply:(...t)=>Xa(n3(e,...t)),divide:(...t)=>Xa(V8(e,...t)),negate:()=>Xa(U8(e)),toString:()=>e.toString()}),{add:z8,subtract:j8,multiply:n3,divide:V8,negate:U8});function GSe(e){return!Number.isInteger(parseFloat(e.toString()))}function HSe(e,t="-"){return e.replace(/\s+/g,t)}function Ij(e){const t=HSe(e.toString());return t.includes("\\.")?e:GSe(e)?t.replace(".","\\."):e}function qSe(e,t=""){return[t,Ij(e)].filter(Boolean).join("-")}function WSe(e,t){return`var(${Ij(e)}${t?`, ${t}`:""})`}function KSe(e,t=""){return`--${qSe(e,t)}`}function en(e,t){const n=KSe(e,t==null?void 0:t.prefix);return{variable:n,reference:WSe(n,XSe(t==null?void 0:t.fallback))}}function XSe(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:QSe,definePartsStyle:ev}=ze(Tj.keys),pp=en("switch-track-width"),Gu=en("switch-track-height"),aw=en("switch-track-diff"),YSe=Xa.subtract(pp,Gu),r3=en("switch-thumb-x"),yh=en("switch-bg"),ZSe=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[pp.reference],height:[Gu.reference],transitionProperty:"common",transitionDuration:"fast",[yh.variable]:"colors.gray.300",_dark:{[yh.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[yh.variable]:`colors.${t}.500`,_dark:{[yh.variable]:`colors.${t}.200`}},bg:yh.reference}},JSe={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[Gu.reference],height:[Gu.reference],_checked:{transform:`translateX(${r3.reference})`}},e2e=ev(e=>({container:{[aw.variable]:YSe,[r3.variable]:aw.reference,_rtl:{[r3.variable]:Xa(aw).negate().toString()}},track:ZSe(e),thumb:JSe})),t2e={sm:ev({container:{[pp.variable]:"1.375rem",[Gu.variable]:"sizes.3"}}),md:ev({container:{[pp.variable]:"1.875rem",[Gu.variable]:"sizes.4"}}),lg:ev({container:{[pp.variable]:"2.875rem",[Gu.variable]:"sizes.6"}})},n2e=QSe({baseStyle:e2e,sizes:t2e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:r2e,definePartsStyle:jd}=ze(vSe.keys),i2e=jd({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),q1={"&[data-is-numeric=true]":{textAlign:"end"}},o2e=jd(e=>{const{colorScheme:t}=e;return{th:{color:W("gray.600","gray.400")(e),borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},td:{borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},caption:{color:W("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),a2e=jd(e=>{const{colorScheme:t}=e;return{th:{color:W("gray.600","gray.400")(e),borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},td:{borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},caption:{color:W("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e)},td:{background:W(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),s2e={simple:o2e,striped:a2e,unstyled:{}},l2e={sm:jd({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:jd({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:jd({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},u2e=r2e({baseStyle:i2e,variants:s2e,sizes:l2e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),Wr=Pe("tabs-color"),xo=Pe("tabs-bg"),W0=Pe("tabs-border-color"),{defineMultiStyleConfig:c2e,definePartsStyle:ya}=ze(Pj.keys),d2e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},f2e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},h2e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},p2e={p:4},g2e=ya(e=>({root:d2e(e),tab:f2e(e),tablist:h2e(e),tabpanel:p2e})),m2e={sm:ya({tab:{py:1,px:4,fontSize:"sm"}}),md:ya({tab:{fontSize:"md",py:2,px:4}}),lg:ya({tab:{fontSize:"lg",py:3,px:4}})},y2e=ya(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[Wr.variable]:`colors.${t}.600`,_dark:{[Wr.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[xo.variable]:"colors.gray.200",_dark:{[xo.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:Wr.reference,bg:xo.reference}}}),v2e=ya(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[W0.variable]:"transparent",_selected:{[Wr.variable]:`colors.${t}.600`,[W0.variable]:"colors.white",_dark:{[Wr.variable]:`colors.${t}.300`,[W0.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:W0.reference},color:Wr.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),b2e=ya(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[xo.variable]:"colors.gray.50",_dark:{[xo.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[xo.variable]:"colors.white",[Wr.variable]:`colors.${t}.600`,_dark:{[xo.variable]:"colors.gray.800",[Wr.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:Wr.reference,bg:xo.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),_2e=ya(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:Rr(n,`${t}.700`),bg:Rr(n,`${t}.100`)}}}}),S2e=ya(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[Wr.variable]:"colors.gray.600",_dark:{[Wr.variable]:"inherit"},_selected:{[Wr.variable]:"colors.white",[xo.variable]:`colors.${t}.600`,_dark:{[Wr.variable]:"colors.gray.800",[xo.variable]:`colors.${t}.300`}},color:Wr.reference,bg:xo.reference}}}),x2e=ya({}),w2e={line:y2e,enclosed:v2e,"enclosed-colored":b2e,"soft-rounded":_2e,"solid-rounded":S2e,unstyled:x2e},C2e=c2e({baseStyle:g2e,sizes:m2e,variants:w2e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),mn=a_e("badge",["bg","color","shadow"]),E2e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:mn.bg.reference,color:mn.color.reference,boxShadow:mn.shadow.reference},A2e=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.500`,.6)(n);return{[mn.bg.variable]:`colors.${t}.500`,[mn.color.variable]:"colors.white",_dark:{[mn.bg.variable]:r,[mn.color.variable]:"colors.whiteAlpha.800"}}},T2e=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.200`,.16)(n);return{[mn.bg.variable]:`colors.${t}.100`,[mn.color.variable]:`colors.${t}.800`,_dark:{[mn.bg.variable]:r,[mn.color.variable]:`colors.${t}.200`}}},P2e=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.200`,.8)(n);return{[mn.color.variable]:`colors.${t}.500`,_dark:{[mn.color.variable]:r},[mn.shadow.variable]:`inset 0 0 0px 1px ${mn.color.reference}`}},k2e={solid:A2e,subtle:T2e,outline:P2e},gp={baseStyle:E2e,variants:k2e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:I2e,definePartsStyle:Hu}=ze(bSe.keys),G8=Pe("tag-bg"),H8=Pe("tag-color"),sw=Pe("tag-shadow"),tv=Pe("tag-min-height"),nv=Pe("tag-min-width"),rv=Pe("tag-font-size"),iv=Pe("tag-padding-inline"),M2e={fontWeight:"medium",lineHeight:1.2,outline:0,[H8.variable]:mn.color.reference,[G8.variable]:mn.bg.reference,[sw.variable]:mn.shadow.reference,color:H8.reference,bg:G8.reference,boxShadow:sw.reference,borderRadius:"md",minH:tv.reference,minW:nv.reference,fontSize:rv.reference,px:iv.reference,_focusVisible:{[sw.variable]:"shadows.outline"}},R2e={lineHeight:1.2,overflow:"visible"},O2e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},$2e=Hu({container:M2e,label:R2e,closeButton:O2e}),N2e={sm:Hu({container:{[tv.variable]:"sizes.5",[nv.variable]:"sizes.5",[rv.variable]:"fontSizes.xs",[iv.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:Hu({container:{[tv.variable]:"sizes.6",[nv.variable]:"sizes.6",[rv.variable]:"fontSizes.sm",[iv.variable]:"space.2"}}),lg:Hu({container:{[tv.variable]:"sizes.8",[nv.variable]:"sizes.8",[rv.variable]:"fontSizes.md",[iv.variable]:"space.3"}})},D2e={subtle:Hu(e=>{var t;return{container:(t=gp.variants)==null?void 0:t.subtle(e)}}),solid:Hu(e=>{var t;return{container:(t=gp.variants)==null?void 0:t.solid(e)}}),outline:Hu(e=>{var t;return{container:(t=gp.variants)==null?void 0:t.outline(e)}})},L2e=I2e({variants:D2e,baseStyle:$2e,sizes:N2e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Ja,defineMultiStyleConfig:F2e}=ze(bj.keys),dd=Pe("input-height"),fd=Pe("input-font-size"),hd=Pe("input-padding"),pd=Pe("input-border-radius"),B2e=Ja({addon:{height:dd.reference,fontSize:fd.reference,px:hd.reference,borderRadius:pd.reference},field:{width:"100%",height:dd.reference,fontSize:fd.reference,px:hd.reference,borderRadius:pd.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),Ls={lg:{[fd.variable]:"fontSizes.lg",[hd.variable]:"space.4",[pd.variable]:"radii.md",[dd.variable]:"sizes.12"},md:{[fd.variable]:"fontSizes.md",[hd.variable]:"space.4",[pd.variable]:"radii.md",[dd.variable]:"sizes.10"},sm:{[fd.variable]:"fontSizes.sm",[hd.variable]:"space.3",[pd.variable]:"radii.sm",[dd.variable]:"sizes.8"},xs:{[fd.variable]:"fontSizes.xs",[hd.variable]:"space.2",[pd.variable]:"radii.sm",[dd.variable]:"sizes.6"}},z2e={lg:Ja({field:Ls.lg,group:Ls.lg}),md:Ja({field:Ls.md,group:Ls.md}),sm:Ja({field:Ls.sm,group:Ls.sm}),xs:Ja({field:Ls.xs,group:Ls.xs})};function AA(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||W("blue.500","blue.300")(e),errorBorderColor:n||W("red.500","red.300")(e)}}var j2e=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=AA(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:W("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Rr(t,r),boxShadow:`0 0 0 1px ${Rr(t,r)}`},_focusVisible:{zIndex:1,borderColor:Rr(t,n),boxShadow:`0 0 0 1px ${Rr(t,n)}`}},addon:{border:"1px solid",borderColor:W("inherit","whiteAlpha.50")(e),bg:W("gray.100","whiteAlpha.300")(e)}}}),V2e=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=AA(e);return{field:{border:"2px solid",borderColor:"transparent",bg:W("gray.100","whiteAlpha.50")(e),_hover:{bg:W("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Rr(t,r)},_focusVisible:{bg:"transparent",borderColor:Rr(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:W("gray.100","whiteAlpha.50")(e)}}}),U2e=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=AA(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Rr(t,r),boxShadow:`0px 1px 0px 0px ${Rr(t,r)}`},_focusVisible:{borderColor:Rr(t,n),boxShadow:`0px 1px 0px 0px ${Rr(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),G2e=Ja({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),H2e={outline:j2e,filled:V2e,flushed:U2e,unstyled:G2e},ht=F2e({baseStyle:B2e,sizes:z2e,variants:H2e,defaultProps:{size:"md",variant:"outline"}}),q8,q2e={...(q8=ht.baseStyle)==null?void 0:q8.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},W8,K8,W2e={outline:e=>{var t,n;return(n=(t=ht.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=ht.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=ht.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(K8=(W8=ht.variants)==null?void 0:W8.unstyled.field)!=null?K8:{}},X8,Q8,Y8,Z8,J8,e9,t9,n9,K2e={xs:(Q8=(X8=ht.sizes)==null?void 0:X8.xs.field)!=null?Q8:{},sm:(Z8=(Y8=ht.sizes)==null?void 0:Y8.sm.field)!=null?Z8:{},md:(e9=(J8=ht.sizes)==null?void 0:J8.md.field)!=null?e9:{},lg:(n9=(t9=ht.sizes)==null?void 0:t9.lg.field)!=null?n9:{}},X2e={baseStyle:q2e,sizes:K2e,variants:W2e,defaultProps:{size:"md",variant:"outline"}},K0=en("tooltip-bg"),lw=en("tooltip-fg"),Q2e=en("popper-arrow-bg"),Y2e={bg:K0.reference,color:lw.reference,[K0.variable]:"colors.gray.700",[lw.variable]:"colors.whiteAlpha.900",_dark:{[K0.variable]:"colors.gray.300",[lw.variable]:"colors.gray.900"},[Q2e.variable]:K0.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},Z2e={baseStyle:Y2e},{defineMultiStyleConfig:J2e,definePartsStyle:Kh}=ze(Cj.keys),exe=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=W(B8(),B8("1rem","rgba(0,0,0,0.1)"))(e),a=W(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( - to right, - transparent 0%, - ${Rr(n,a)} 50%, - transparent 100% - )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},txe={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},nxe=e=>({bg:W("gray.100","whiteAlpha.300")(e)}),rxe=e=>({transitionProperty:"common",transitionDuration:"slow",...exe(e)}),ixe=Kh(e=>({label:txe,filledTrack:rxe(e),track:nxe(e)})),oxe={xs:Kh({track:{h:"1"}}),sm:Kh({track:{h:"2"}}),md:Kh({track:{h:"3"}}),lg:Kh({track:{h:"4"}})},axe=J2e({sizes:oxe,baseStyle:ixe,defaultProps:{size:"md",colorScheme:"blue"}}),sxe=e=>typeof e=="function";function $r(e,...t){return sxe(e)?e(...t):e}var{definePartsStyle:ov,defineMultiStyleConfig:lxe}=ze(yj.keys),mp=Pe("checkbox-size"),uxe=e=>{const{colorScheme:t}=e;return{w:mp.reference,h:mp.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:W(`${t}.500`,`${t}.200`)(e),borderColor:W(`${t}.500`,`${t}.200`)(e),color:W("white","gray.900")(e),_hover:{bg:W(`${t}.600`,`${t}.300`)(e),borderColor:W(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:W("gray.200","transparent")(e),bg:W("gray.200","whiteAlpha.300")(e),color:W("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:W(`${t}.500`,`${t}.200`)(e),borderColor:W(`${t}.500`,`${t}.200`)(e),color:W("white","gray.900")(e)},_disabled:{bg:W("gray.100","whiteAlpha.100")(e),borderColor:W("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:W("red.500","red.300")(e)}}},cxe={_disabled:{cursor:"not-allowed"}},dxe={userSelect:"none",_disabled:{opacity:.4}},fxe={transitionProperty:"transform",transitionDuration:"normal"},hxe=ov(e=>({icon:fxe,container:cxe,control:$r(uxe,e),label:dxe})),pxe={sm:ov({control:{[mp.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:ov({control:{[mp.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:ov({control:{[mp.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},W1=lxe({baseStyle:hxe,sizes:pxe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:gxe,definePartsStyle:av}=ze(mSe.keys),mxe=e=>{var t;const n=(t=$r(W1.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},yxe=av(e=>{var t,n,r,i;return{label:(n=(t=W1).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=W1).baseStyle)==null?void 0:i.call(r,e).container,control:mxe(e)}}),vxe={md:av({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:av({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:av({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},bxe=gxe({baseStyle:yxe,sizes:vxe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:_xe,definePartsStyle:Sxe}=ze(Ej.keys),X0=Pe("select-bg"),r9,xxe={...(r9=ht.baseStyle)==null?void 0:r9.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:X0.reference,[X0.variable]:"colors.white",_dark:{[X0.variable]:"colors.gray.700"},"> option, > optgroup":{bg:X0.reference}},wxe={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},Cxe=Sxe({field:xxe,icon:wxe}),Q0={paddingInlineEnd:"8"},i9,o9,a9,s9,l9,u9,c9,d9,Exe={lg:{...(i9=ht.sizes)==null?void 0:i9.lg,field:{...(o9=ht.sizes)==null?void 0:o9.lg.field,...Q0}},md:{...(a9=ht.sizes)==null?void 0:a9.md,field:{...(s9=ht.sizes)==null?void 0:s9.md.field,...Q0}},sm:{...(l9=ht.sizes)==null?void 0:l9.sm,field:{...(u9=ht.sizes)==null?void 0:u9.sm.field,...Q0}},xs:{...(c9=ht.sizes)==null?void 0:c9.xs,field:{...(d9=ht.sizes)==null?void 0:d9.xs.field,...Q0},icon:{insetEnd:"1"}}},Axe=_xe({baseStyle:Cxe,sizes:Exe,variants:ht.variants,defaultProps:ht.defaultProps}),uw=Pe("skeleton-start-color"),cw=Pe("skeleton-end-color"),Txe={[uw.variable]:"colors.gray.100",[cw.variable]:"colors.gray.400",_dark:{[uw.variable]:"colors.gray.800",[cw.variable]:"colors.gray.600"},background:uw.reference,borderColor:cw.reference,opacity:.7,borderRadius:"sm"},Pxe={baseStyle:Txe},dw=Pe("skip-link-bg"),kxe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[dw.variable]:"colors.white",_dark:{[dw.variable]:"colors.gray.700"},bg:dw.reference}},Ixe={baseStyle:kxe},{defineMultiStyleConfig:Mxe,definePartsStyle:hS}=ze(Aj.keys),Ng=Pe("slider-thumb-size"),Dg=Pe("slider-track-size"),el=Pe("slider-bg"),Rxe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...EA({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},Oxe=e=>({...EA({orientation:e.orientation,horizontal:{h:Dg.reference},vertical:{w:Dg.reference}}),overflow:"hidden",borderRadius:"sm",[el.variable]:"colors.gray.200",_dark:{[el.variable]:"colors.whiteAlpha.200"},_disabled:{[el.variable]:"colors.gray.300",_dark:{[el.variable]:"colors.whiteAlpha.300"}},bg:el.reference}),$xe=e=>{const{orientation:t}=e;return{...EA({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:Ng.reference,h:Ng.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},Nxe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[el.variable]:`colors.${t}.500`,_dark:{[el.variable]:`colors.${t}.200`},bg:el.reference}},Dxe=hS(e=>({container:Rxe(e),track:Oxe(e),thumb:$xe(e),filledTrack:Nxe(e)})),Lxe=hS({container:{[Ng.variable]:"sizes.4",[Dg.variable]:"sizes.1"}}),Fxe=hS({container:{[Ng.variable]:"sizes.3.5",[Dg.variable]:"sizes.1"}}),Bxe=hS({container:{[Ng.variable]:"sizes.2.5",[Dg.variable]:"sizes.0.5"}}),zxe={lg:Lxe,md:Fxe,sm:Bxe},jxe=Mxe({baseStyle:Dxe,sizes:zxe,defaultProps:{size:"md",colorScheme:"blue"}}),Eu=en("spinner-size"),Vxe={width:[Eu.reference],height:[Eu.reference]},Uxe={xs:{[Eu.variable]:"sizes.3"},sm:{[Eu.variable]:"sizes.4"},md:{[Eu.variable]:"sizes.6"},lg:{[Eu.variable]:"sizes.8"},xl:{[Eu.variable]:"sizes.12"}},Gxe={baseStyle:Vxe,sizes:Uxe,defaultProps:{size:"md"}},{defineMultiStyleConfig:Hxe,definePartsStyle:Mj}=ze(ySe.keys),qxe={fontWeight:"medium"},Wxe={opacity:.8,marginBottom:"2"},Kxe={verticalAlign:"baseline",fontWeight:"semibold"},Xxe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},Qxe=Mj({container:{},label:qxe,helpText:Wxe,number:Kxe,icon:Xxe}),Yxe={md:Mj({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},Zxe=Hxe({baseStyle:Qxe,sizes:Yxe,defaultProps:{size:"md"}}),fw=Pe("kbd-bg"),Jxe={[fw.variable]:"colors.gray.100",_dark:{[fw.variable]:"colors.whiteAlpha.100"},bg:fw.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},ewe={baseStyle:Jxe},twe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},nwe={baseStyle:twe},{defineMultiStyleConfig:rwe,definePartsStyle:iwe}=ze(gSe.keys),owe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},awe=iwe({icon:owe}),swe=rwe({baseStyle:awe}),{defineMultiStyleConfig:lwe,definePartsStyle:uwe}=ze(_j.keys),Yo=Pe("menu-bg"),hw=Pe("menu-shadow"),cwe={[Yo.variable]:"#fff",[hw.variable]:"shadows.sm",_dark:{[Yo.variable]:"colors.gray.700",[hw.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:Yo.reference,boxShadow:hw.reference},dwe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[Yo.variable]:"colors.gray.100",_dark:{[Yo.variable]:"colors.whiteAlpha.100"}},_active:{[Yo.variable]:"colors.gray.200",_dark:{[Yo.variable]:"colors.whiteAlpha.200"}},_expanded:{[Yo.variable]:"colors.gray.100",_dark:{[Yo.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:Yo.reference},fwe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},hwe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},pwe={opacity:.6},gwe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},mwe={transitionProperty:"common",transitionDuration:"normal"},ywe=uwe({button:mwe,list:cwe,item:dwe,groupTitle:fwe,icon:hwe,command:pwe,divider:gwe}),vwe=lwe({baseStyle:ywe}),{defineMultiStyleConfig:bwe,definePartsStyle:i3}=ze(Sj.keys),pw=Pe("modal-bg"),gw=Pe("modal-shadow"),_we={bg:"blackAlpha.600",zIndex:"modal"},Swe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},xwe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[pw.variable]:"colors.white",[gw.variable]:"shadows.lg",_dark:{[pw.variable]:"colors.gray.700",[gw.variable]:"shadows.dark-lg"},bg:pw.reference,boxShadow:gw.reference}},wwe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},Cwe={position:"absolute",top:"2",insetEnd:"3"},Ewe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},Awe={px:"6",py:"4"},Twe=i3(e=>({overlay:_we,dialogContainer:$r(Swe,e),dialog:$r(xwe,e),header:wwe,closeButton:Cwe,body:$r(Ewe,e),footer:Awe}));function ho(e){return i3(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var Pwe={xs:ho("xs"),sm:ho("sm"),md:ho("md"),lg:ho("lg"),xl:ho("xl"),"2xl":ho("2xl"),"3xl":ho("3xl"),"4xl":ho("4xl"),"5xl":ho("5xl"),"6xl":ho("6xl"),full:ho("full")},kwe=bwe({baseStyle:Twe,sizes:Pwe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:Iwe,definePartsStyle:Rj}=ze(xj.keys),TA=en("number-input-stepper-width"),Oj=en("number-input-input-padding"),Mwe=Xa(TA).add("0.5rem").toString(),mw=en("number-input-bg"),yw=en("number-input-color"),vw=en("number-input-border-color"),Rwe={[TA.variable]:"sizes.6",[Oj.variable]:Mwe},Owe=e=>{var t,n;return(n=(t=$r(ht.baseStyle,e))==null?void 0:t.field)!=null?n:{}},$we={width:TA.reference},Nwe={borderStart:"1px solid",borderStartColor:vw.reference,color:yw.reference,bg:mw.reference,[yw.variable]:"colors.chakra-body-text",[vw.variable]:"colors.chakra-border-color",_dark:{[yw.variable]:"colors.whiteAlpha.800",[vw.variable]:"colors.whiteAlpha.300"},_active:{[mw.variable]:"colors.gray.200",_dark:{[mw.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},Dwe=Rj(e=>{var t;return{root:Rwe,field:(t=$r(Owe,e))!=null?t:{},stepperGroup:$we,stepper:Nwe}});function Y0(e){var t,n,r;const i=(t=ht.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=hj.fontSizes[a];return Rj({field:{...i.field,paddingInlineEnd:Oj.reference,verticalAlign:"top"},stepper:{fontSize:Xa(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var Lwe={xs:Y0("xs"),sm:Y0("sm"),md:Y0("md"),lg:Y0("lg")},Fwe=Iwe({baseStyle:Dwe,sizes:Lwe,variants:ht.variants,defaultProps:ht.defaultProps}),f9,Bwe={...(f9=ht.baseStyle)==null?void 0:f9.field,textAlign:"center"},zwe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},h9,p9,jwe={outline:e=>{var t,n,r;return(r=(n=$r((t=ht.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=$r((t=ht.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=$r((t=ht.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(p9=(h9=ht.variants)==null?void 0:h9.unstyled.field)!=null?p9:{}},Vwe={baseStyle:Bwe,sizes:zwe,variants:jwe,defaultProps:ht.defaultProps},{defineMultiStyleConfig:Uwe,definePartsStyle:Gwe}=ze(wj.keys),Z0=en("popper-bg"),Hwe=en("popper-arrow-bg"),g9=en("popper-arrow-shadow-color"),qwe={zIndex:10},Wwe={[Z0.variable]:"colors.white",bg:Z0.reference,[Hwe.variable]:Z0.reference,[g9.variable]:"colors.gray.200",_dark:{[Z0.variable]:"colors.gray.700",[g9.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},Kwe={px:3,py:2,borderBottomWidth:"1px"},Xwe={px:3,py:2},Qwe={px:3,py:2,borderTopWidth:"1px"},Ywe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},Zwe=Gwe({popper:qwe,content:Wwe,header:Kwe,body:Xwe,footer:Qwe,closeButton:Ywe}),Jwe=Uwe({baseStyle:Zwe}),{definePartsStyle:o3,defineMultiStyleConfig:eCe}=ze(fSe.keys),bw=Pe("drawer-bg"),_w=Pe("drawer-box-shadow");function Fc(e){return o3(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var tCe={bg:"blackAlpha.600",zIndex:"overlay"},nCe={display:"flex",zIndex:"modal",justifyContent:"center"},rCe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[bw.variable]:"colors.white",[_w.variable]:"shadows.lg",_dark:{[bw.variable]:"colors.gray.700",[_w.variable]:"shadows.dark-lg"},bg:bw.reference,boxShadow:_w.reference}},iCe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},oCe={position:"absolute",top:"2",insetEnd:"3"},aCe={px:"6",py:"2",flex:"1",overflow:"auto"},sCe={px:"6",py:"4"},lCe=o3(e=>({overlay:tCe,dialogContainer:nCe,dialog:$r(rCe,e),header:iCe,closeButton:oCe,body:aCe,footer:sCe})),uCe={xs:Fc("xs"),sm:Fc("md"),md:Fc("lg"),lg:Fc("2xl"),xl:Fc("4xl"),full:Fc("full")},cCe=eCe({baseStyle:lCe,sizes:uCe,defaultProps:{size:"xs"}}),{definePartsStyle:dCe,defineMultiStyleConfig:fCe}=ze(vj.keys),hCe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},pCe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},gCe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},mCe=dCe({preview:hCe,input:pCe,textarea:gCe}),yCe=fCe({baseStyle:mCe}),{definePartsStyle:vCe,defineMultiStyleConfig:bCe}=ze(hSe.keys),Vd=Pe("form-control-color"),_Ce={marginStart:"1",[Vd.variable]:"colors.red.500",_dark:{[Vd.variable]:"colors.red.300"},color:Vd.reference},SCe={mt:"2",[Vd.variable]:"colors.gray.600",_dark:{[Vd.variable]:"colors.whiteAlpha.600"},color:Vd.reference,lineHeight:"normal",fontSize:"sm"},xCe=vCe({container:{width:"100%",position:"relative"},requiredIndicator:_Ce,helperText:SCe}),wCe=bCe({baseStyle:xCe}),{definePartsStyle:CCe,defineMultiStyleConfig:ECe}=ze(pSe.keys),Ud=Pe("form-error-color"),ACe={[Ud.variable]:"colors.red.500",_dark:{[Ud.variable]:"colors.red.300"},color:Ud.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},TCe={marginEnd:"0.5em",[Ud.variable]:"colors.red.500",_dark:{[Ud.variable]:"colors.red.300"},color:Ud.reference},PCe=CCe({text:ACe,icon:TCe}),kCe=ECe({baseStyle:PCe}),ICe={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},MCe={baseStyle:ICe},RCe={fontFamily:"heading",fontWeight:"bold"},OCe={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},$Ce={baseStyle:RCe,sizes:OCe,defaultProps:{size:"xl"}},{defineMultiStyleConfig:NCe,definePartsStyle:DCe}=ze(dSe.keys),Sw=Pe("breadcrumb-link-decor"),LCe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:Sw.reference,[Sw.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[Sw.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},FCe=DCe({link:LCe}),BCe=NCe({baseStyle:FCe}),zCe={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},$j=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:W("gray.800","whiteAlpha.900")(e),_hover:{bg:W("gray.100","whiteAlpha.200")(e)},_active:{bg:W("gray.200","whiteAlpha.300")(e)}};const r=Sf(`${t}.200`,.12)(n),i=Sf(`${t}.200`,.24)(n);return{color:W(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:W(`${t}.50`,r)(e)},_active:{bg:W(`${t}.100`,i)(e)}}},jCe=e=>{const{colorScheme:t}=e,n=W("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...$r($j,e)}},VCe={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},UCe=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=W("gray.100","whiteAlpha.200")(e);return{bg:l,color:W("gray.800","whiteAlpha.900")(e),_hover:{bg:W("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:W("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=VCe[n])!=null?t:{},s=W(r,`${n}.200`)(e);return{bg:s,color:W(i,"gray.800")(e),_hover:{bg:W(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:W(a,`${n}.400`)(e)}}},GCe=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:W(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:W(`${t}.700`,`${t}.500`)(e)}}},HCe={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},qCe={ghost:$j,outline:jCe,solid:UCe,link:GCe,unstyled:HCe},WCe={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},KCe={baseStyle:zCe,variants:qCe,sizes:WCe,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:qu,defineMultiStyleConfig:XCe}=ze(_Se.keys),K1=Pe("card-bg"),is=Pe("card-padding"),Nj=Pe("card-shadow"),sv=Pe("card-radius"),Dj=Pe("card-border-width","0"),Lj=Pe("card-border-color"),QCe=qu({container:{[K1.variable]:"colors.chakra-body-bg",backgroundColor:K1.reference,boxShadow:Nj.reference,borderRadius:sv.reference,color:"chakra-body-text",borderWidth:Dj.reference,borderColor:Lj.reference},body:{padding:is.reference,flex:"1 1 0%"},header:{padding:is.reference},footer:{padding:is.reference}}),YCe={sm:qu({container:{[sv.variable]:"radii.base",[is.variable]:"space.3"}}),md:qu({container:{[sv.variable]:"radii.md",[is.variable]:"space.5"}}),lg:qu({container:{[sv.variable]:"radii.xl",[is.variable]:"space.7"}})},ZCe={elevated:qu({container:{[Nj.variable]:"shadows.base",_dark:{[K1.variable]:"colors.gray.700"}}}),outline:qu({container:{[Dj.variable]:"1px",[Lj.variable]:"colors.chakra-border-color"}}),filled:qu({container:{[K1.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[is.variable]:0},header:{[is.variable]:0},footer:{[is.variable]:0}}},JCe=XCe({baseStyle:QCe,variants:ZCe,sizes:YCe,defaultProps:{variant:"elevated",size:"md"}}),yp=en("close-button-size"),vh=en("close-button-bg"),e5e={w:[yp.reference],h:[yp.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[vh.variable]:"colors.blackAlpha.100",_dark:{[vh.variable]:"colors.whiteAlpha.100"}},_active:{[vh.variable]:"colors.blackAlpha.200",_dark:{[vh.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:vh.reference},t5e={lg:{[yp.variable]:"sizes.10",fontSize:"md"},md:{[yp.variable]:"sizes.8",fontSize:"xs"},sm:{[yp.variable]:"sizes.6",fontSize:"2xs"}},n5e={baseStyle:e5e,sizes:t5e,defaultProps:{size:"md"}},{variants:r5e,defaultProps:i5e}=gp,o5e={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:mn.bg.reference,color:mn.color.reference,boxShadow:mn.shadow.reference},a5e={baseStyle:o5e,variants:r5e,defaultProps:i5e},s5e={w:"100%",mx:"auto",maxW:"prose",px:"4"},l5e={baseStyle:s5e},u5e={opacity:.6,borderColor:"inherit"},c5e={borderStyle:"solid"},d5e={borderStyle:"dashed"},f5e={solid:c5e,dashed:d5e},h5e={baseStyle:u5e,variants:f5e,defaultProps:{variant:"solid"}},{definePartsStyle:p5e,defineMultiStyleConfig:g5e}=ze(mj.keys),m5e={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},y5e={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},v5e={pt:"2",px:"4",pb:"5"},b5e={fontSize:"1.25em"},_5e=p5e({container:m5e,button:y5e,panel:v5e,icon:b5e}),S5e=g5e({baseStyle:_5e}),{definePartsStyle:Rm,defineMultiStyleConfig:x5e}=ze(uSe.keys),_i=Pe("alert-fg"),bs=Pe("alert-bg"),w5e=Rm({container:{bg:bs.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:_i.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:_i.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function PA(e){const{theme:t,colorScheme:n}=e,r=Sf(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var C5e=Rm(e=>{const{colorScheme:t}=e,n=PA(e);return{container:{[_i.variable]:`colors.${t}.500`,[bs.variable]:n.light,_dark:{[_i.variable]:`colors.${t}.200`,[bs.variable]:n.dark}}}}),E5e=Rm(e=>{const{colorScheme:t}=e,n=PA(e);return{container:{[_i.variable]:`colors.${t}.500`,[bs.variable]:n.light,_dark:{[_i.variable]:`colors.${t}.200`,[bs.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:_i.reference}}}),A5e=Rm(e=>{const{colorScheme:t}=e,n=PA(e);return{container:{[_i.variable]:`colors.${t}.500`,[bs.variable]:n.light,_dark:{[_i.variable]:`colors.${t}.200`,[bs.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:_i.reference}}}),T5e=Rm(e=>{const{colorScheme:t}=e;return{container:{[_i.variable]:"colors.white",[bs.variable]:`colors.${t}.500`,_dark:{[_i.variable]:"colors.gray.900",[bs.variable]:`colors.${t}.200`},color:_i.reference}}}),P5e={subtle:C5e,"left-accent":E5e,"top-accent":A5e,solid:T5e},k5e=x5e({baseStyle:w5e,variants:P5e,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:Fj,defineMultiStyleConfig:I5e}=ze(cSe.keys),Gd=Pe("avatar-border-color"),vp=Pe("avatar-bg"),Lg=Pe("avatar-font-size"),xf=Pe("avatar-size"),M5e={borderRadius:"full",border:"0.2em solid",borderColor:Gd.reference,[Gd.variable]:"white",_dark:{[Gd.variable]:"colors.gray.800"}},R5e={bg:vp.reference,fontSize:Lg.reference,width:xf.reference,height:xf.reference,lineHeight:"1",[vp.variable]:"colors.gray.200",_dark:{[vp.variable]:"colors.whiteAlpha.400"}},O5e=e=>{const{name:t,theme:n}=e,r=t?zSe({string:t}):"colors.gray.400",i=FSe(r)(n);let o="white";return i||(o="gray.800"),{bg:vp.reference,fontSize:Lg.reference,color:o,borderColor:Gd.reference,verticalAlign:"top",width:xf.reference,height:xf.reference,"&:not([data-loaded])":{[vp.variable]:r},[Gd.variable]:"colors.white",_dark:{[Gd.variable]:"colors.gray.800"}}},$5e={fontSize:Lg.reference,lineHeight:"1"},N5e=Fj(e=>({badge:$r(M5e,e),excessLabel:$r(R5e,e),container:$r(O5e,e),label:$5e}));function Fs(e){const t=e!=="100%"?gj[e]:void 0;return Fj({container:{[xf.variable]:t??e,[Lg.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[xf.variable]:t??e,[Lg.variable]:`calc(${t??e} / 2.5)`}})}var D5e={"2xs":Fs(4),xs:Fs(6),sm:Fs(8),md:Fs(12),lg:Fs(16),xl:Fs(24),"2xl":Fs(32),full:Fs("100%")},L5e=I5e({baseStyle:N5e,sizes:D5e,defaultProps:{size:"md"}}),F5e={Accordion:S5e,Alert:k5e,Avatar:L5e,Badge:gp,Breadcrumb:BCe,Button:KCe,Checkbox:W1,CloseButton:n5e,Code:a5e,Container:l5e,Divider:h5e,Drawer:cCe,Editable:yCe,Form:wCe,FormError:kCe,FormLabel:MCe,Heading:$Ce,Input:ht,Kbd:ewe,Link:nwe,List:swe,Menu:vwe,Modal:kwe,NumberInput:Fwe,PinInput:Vwe,Popover:Jwe,Progress:axe,Radio:bxe,Select:Axe,Skeleton:Pxe,SkipLink:Ixe,Slider:jxe,Spinner:Gxe,Stat:Zxe,Switch:n2e,Table:u2e,Tabs:C2e,Tag:L2e,Textarea:X2e,Tooltip:Z2e,Card:JCe,Stepper:lSe},B5e={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},z5e={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},j5e="ltr",V5e={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},U5e={semanticTokens:B5e,direction:j5e,...oSe,components:F5e,styles:z5e,config:V5e},G5e=U5e;function H5e(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function q5e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},Bj=W5e(q5e);function zj(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var jj=e=>zj(e,t=>t!=null);function K5e(e){return typeof e=="function"}function Vj(e,...t){return K5e(e)?e(...t):e}function vUe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var X5e=typeof Element<"u",Q5e=typeof Map=="function",Y5e=typeof Set=="function",Z5e=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function lv(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!lv(e[r],t[r]))return!1;return!0}var o;if(Q5e&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!lv(r.value[1],t.get(r.value[0])))return!1;return!0}if(Y5e&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(Z5e&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();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;if(X5e&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!lv(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var J5e=function(t,n){try{return lv(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const e3e=Bl(J5e);function Uj(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=oj(),s=e?Bj(o,`components.${e}`):void 0,l=r||s,u=ua({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},jj(H5e(i,["children"]))),c=k.useRef({});if(l){const f=N_e(l)(u);e3e(c.current,f)||(c.current=f)}return c.current}function Om(e,t={}){return Uj(e,t)}function t3e(e,t={}){return Uj(e,t)}var n3e=new Set([...w_e,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),r3e=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function i3e(e){return r3e.has(e)||!n3e.has(e)}function o3e(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function a3e(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var s3e=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,l3e=Kz(function(e){return s3e.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),u3e=l3e,c3e=function(t){return t!=="theme"},m9=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?u3e:c3e},y9=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},d3e=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return Qz(n,r,i),ebe(function(){return Yz(n,r,i)}),null},f3e=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=y9(t,n,r),l=s||m9(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=zj(a,(d,f)=>E_e(f)),l=Vj(e,t),u=o3e({},i,l,jj(s),o),c=fj(u)(t.theme);return r?[c,r]:c};function xw(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=i3e);const i=g3e({baseStyle:n}),o=p3e(e,r)(i);return bt.forwardRef(function(l,u){const{colorMode:c,forced:d}=uS();return bt.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function m3e(){const e=new Map;return new Proxy(xw,{apply(t,n,r){return xw(...r)},get(t,n){return e.has(n)||e.set(n,xw(n)),e.get(n)}})}var sr=m3e();function Pi(e){return k.forwardRef(e)}function y3e(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=k.createContext(void 0);i.displayName=r;function o(){var a;const s=k.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function v3e(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=k.useMemo(()=>S_e(n),[n]);return q.jsxs(rbe,{theme:i,children:[q.jsx(b3e,{root:t}),r]})}function b3e({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return q.jsx(nj,{styles:n=>({[t]:n.__cssVars})})}y3e({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function bUe(){const{colorMode:e}=uS();return q.jsx(nj,{styles:t=>{const n=Bj(t,"styles.global"),r=Vj(n,{theme:t,colorMode:e});return r?fj(r)(t):void 0}})}var _3e=(e,t)=>e.find(n=>n.id===t);function b9(e,t){const n=Gj(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function Gj(e,t){for(const[n,r]of Object.entries(e))if(_3e(r,t))return n}function S3e(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function x3e(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function w3e(e,t=[]){const n=k.useRef(e);return k.useEffect(()=>{n.current=e}),k.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function C3e(e,t){const n=w3e(e);k.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function _9(e,t){const n=k.useRef(!1),r=k.useRef(!1);k.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),k.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Hj=k.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),pS=k.createContext({}),$m=k.createContext(null),gS=typeof document<"u",kA=gS?k.useLayoutEffect:k.useEffect,qj=k.createContext({strict:!1});function E3e(e,t,n,r){const{visualElement:i}=k.useContext(pS),o=k.useContext(qj),a=k.useContext($m),s=k.useContext(Hj).reducedMotion,l=k.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;k.useInsertionEffect(()=>{u&&u.update(n,a)});const c=k.useRef(!!window.HandoffAppearAnimations);return kA(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),k.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function gd(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function A3e(e,t,n){return k.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gd(n)&&(n.current=r))},[t])}function Fg(e){return typeof e=="string"||Array.isArray(e)}function mS(e){return typeof e=="object"&&typeof e.start=="function"}const IA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],MA=["initial",...IA];function yS(e){return mS(e.animate)||MA.some(t=>Fg(e[t]))}function Wj(e){return!!(yS(e)||e.variants)}function T3e(e,t){if(yS(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Fg(n)?n:void 0,animate:Fg(r)?r:void 0}}return e.inherit!==!1?t:{}}function P3e(e){const{initial:t,animate:n}=T3e(e,k.useContext(pS));return k.useMemo(()=>({initial:t,animate:n}),[S9(t),S9(n)])}function S9(e){return Array.isArray(e)?e.join(" "):e}const x9={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Bg={};for(const e in x9)Bg[e]={isEnabled:t=>x9[e].some(n=>!!t[n])};function k3e(e){for(const t in e)Bg[t]={...Bg[t],...e[t]}}const RA=k.createContext({}),Kj=k.createContext({}),I3e=Symbol.for("motionComponentSymbol");function M3e({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&k3e(e);function o(s,l){let u;const c={...k.useContext(Hj),...s,layoutId:R3e(s)},{isStatic:d}=c,f=P3e(s),h=r(s,d);if(!d&&gS){f.visualElement=E3e(i,h,c,t);const p=k.useContext(Kj),m=k.useContext(qj).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return k.createElement(pS.Provider,{value:f},u&&f.visualElement?k.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,A3e(h,f.visualElement,l),h,d,f.visualElement))}const a=k.forwardRef(o);return a[I3e]=i,a}function R3e({layoutId:e}){const t=k.useContext(RA).id;return t&&e!==void 0?t+"-"+e:e}function O3e(e){function t(r,i={}){return M3e(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const $3e=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function OA(e){return typeof e!="string"||e.includes("-")?!1:!!($3e.indexOf(e)>-1||/[A-Z]/.test(e))}const Q1={};function N3e(e){Object.assign(Q1,e)}const Nm=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hc=new Set(Nm);function Xj(e,{layout:t,layoutId:n}){return hc.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Q1[e]||e==="opacity")}const oi=e=>!!(e&&e.getVelocity),D3e={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},L3e=Nm.length;function F3e(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),Yj=Qj("--"),a3=Qj("var(--"),B3e=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,z3e=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ol=(e,t,n)=>Math.min(Math.max(n,e),t),pc={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},bp={...pc,transform:e=>Ol(0,1,e)},J0={...pc,default:1},_p=e=>Math.round(e*1e5)/1e5,vS=/(-)?([\d]*\.?[\d])+/g,Zj=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,j3e=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Dm(e){return typeof e=="string"}const Lm=e=>({test:t=>Dm(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),js=Lm("deg"),va=Lm("%"),Ie=Lm("px"),V3e=Lm("vh"),U3e=Lm("vw"),w9={...va,parse:e=>va.parse(e)/100,transform:e=>va.transform(e*100)},C9={...pc,transform:Math.round},Jj={borderWidth:Ie,borderTopWidth:Ie,borderRightWidth:Ie,borderBottomWidth:Ie,borderLeftWidth:Ie,borderRadius:Ie,radius:Ie,borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomRightRadius:Ie,borderBottomLeftRadius:Ie,width:Ie,maxWidth:Ie,height:Ie,maxHeight:Ie,size:Ie,top:Ie,right:Ie,bottom:Ie,left:Ie,padding:Ie,paddingTop:Ie,paddingRight:Ie,paddingBottom:Ie,paddingLeft:Ie,margin:Ie,marginTop:Ie,marginRight:Ie,marginBottom:Ie,marginLeft:Ie,rotate:js,rotateX:js,rotateY:js,rotateZ:js,scale:J0,scaleX:J0,scaleY:J0,scaleZ:J0,skew:js,skewX:js,skewY:js,distance:Ie,translateX:Ie,translateY:Ie,translateZ:Ie,x:Ie,y:Ie,z:Ie,perspective:Ie,transformPerspective:Ie,opacity:bp,originX:w9,originY:w9,originZ:Ie,zIndex:C9,fillOpacity:bp,strokeOpacity:bp,numOctaves:C9};function $A(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(Yj(d)){o[d]=f;continue}const h=Jj[d],p=z3e(f,h);if(hc.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=F3e(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const NA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function eV(e,t,n){for(const r in t)!oi(t[r])&&!Xj(r,n)&&(e[r]=t[r])}function G3e({transformTemplate:e},t,n){return k.useMemo(()=>{const r=NA();return $A(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function H3e(e,t,n){const r=e.style||{},i={};return eV(i,r,e),Object.assign(i,G3e(e,t,n)),e.transformValues?e.transformValues(i):i}function q3e(e,t,n){const r={},i=H3e(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const W3e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Y1(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||W3e.has(e)}let tV=e=>!Y1(e);function K3e(e){e&&(tV=t=>t.startsWith("on")?!Y1(t):e(t))}try{K3e(require("@emotion/is-prop-valid").default)}catch{}function X3e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(tV(i)||n===!0&&Y1(i)||!t&&!Y1(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function E9(e,t,n){return typeof e=="string"?e:Ie.transform(t+n*e)}function Q3e(e,t,n){const r=E9(t,e.x,e.width),i=E9(n,e.y,e.height);return`${r} ${i}`}const Y3e={offset:"stroke-dashoffset",array:"stroke-dasharray"},Z3e={offset:"strokeDashoffset",array:"strokeDasharray"};function J3e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?Y3e:Z3e;e[o.offset]=Ie.transform(-r);const a=Ie.transform(t),s=Ie.transform(n);e[o.array]=`${a} ${s}`}function DA(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if($A(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=Q3e(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&J3e(h,a,s,l,!1)}const nV=()=>({...NA(),attrs:{}}),LA=e=>typeof e=="string"&&e.toLowerCase()==="svg";function e4e(e,t,n,r){const i=k.useMemo(()=>{const o=nV();return DA(o,t,{enableHardwareAcceleration:!1},LA(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};eV(o,e.style,e),i.style={...o,...i.style}}return i}function t4e(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(OA(n)?e4e:q3e)(r,o,a,n),c={...X3e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=k.useMemo(()=>oi(d)?d.get():d,[d]);return k.createElement(n,{...c,children:f})}}const FA=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function rV(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const iV=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function oV(e,t,n,r){rV(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(iV.has(i)?i:FA(i),t.attrs[i])}function BA(e,t){const{style:n}=e,r={};for(const i in n)(oi(n[i])||t.style&&oi(t.style[i])||Xj(i,e))&&(r[i]=n[i]);return r}function aV(e,t){const n=BA(e,t);for(const r in e)if(oi(e[r])||oi(t[r])){const i=Nm.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function zA(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function sV(e){const t=k.useRef(null);return t.current===null&&(t.current=e()),t.current}const Z1=e=>Array.isArray(e),n4e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),r4e=e=>Z1(e)?e[e.length-1]||0:e;function uv(e){const t=oi(e)?e.get():e;return n4e(t)?t.toValue():t}function i4e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:o4e(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const lV=e=>(t,n)=>{const r=k.useContext(pS),i=k.useContext($m),o=()=>i4e(e,t,r,i);return n?o():sV(o)};function o4e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=uv(o[f]);let{initial:a,animate:s}=e;const l=yS(e),u=Wj(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!mS(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=zA(e,h);if(!p)return;const{transitionEnd:m,transition:_,...v}=p;for(const y in v){let g=v[y];if(Array.isArray(g)){const b=c?g.length-1:0;g=g[b]}g!==null&&(i[y]=g)}for(const y in m)i[y]=m[y]}),i}const un=e=>e;function a4e(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=a4e(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,s4e),1),i.timestamp=d,i.isProcessing=!0,ey.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:ey.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>ey.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:Mt,cancel:_s,state:pr,steps:ww}=l4e(typeof requestAnimationFrame<"u"?requestAnimationFrame:un,!0),u4e={useVisualState:lV({scrapeMotionValuesFromProps:aV,createRenderState:nV,onMount:(e,t,{renderState:n,latestValues:r})=>{Mt.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Mt.render(()=>{DA(n,r,{enableHardwareAcceleration:!1},LA(t.tagName),e.transformTemplate),oV(t,n)})}})},c4e={useVisualState:lV({scrapeMotionValuesFromProps:BA,createRenderState:NA})};function d4e(e,{forwardMotionProps:t=!1},n,r){return{...OA(e)?u4e:c4e,preloadedFeatures:n,useRender:t4e(t),createVisualElement:r,Component:e}}function es(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const uV=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function bS(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const f4e=e=>t=>uV(t)&&e(t,bS(t));function os(e,t,n,r){return es(e,t,f4e(n),r)}const h4e=(e,t)=>n=>t(e(n)),_l=(...e)=>e.reduce(h4e);function cV(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const A9=cV("dragHorizontal"),T9=cV("dragVertical");function dV(e){let t=!1;if(e==="y")t=T9();else if(e==="x")t=A9();else{const n=A9(),r=T9();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function fV(){const e=dV(!0);return e?(e(),!1):!0}class Xl{constructor(t){this.isMounted=!1,this.node=t}update(){}}function P9(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||fV())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&Mt.update(()=>s[r](o,a))};return os(e.current,n,i,{passive:!e.getProps()[r]})}class p4e extends Xl{mount(){this.unmount=_l(P9(this.node,!0),P9(this.node,!1))}unmount(){}}class g4e extends Xl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=_l(es(this.node.current,"focus",()=>this.onFocus()),es(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const hV=(e,t)=>t?e===t?!0:hV(e,t.parentElement):!1;function Cw(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,bS(n))}class m4e extends Xl{constructor(){super(...arguments),this.removeStartListeners=un,this.removeEndListeners=un,this.removeAccessibleListeners=un,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=os(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();Mt.update(()=>{hV(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=os(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=_l(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||Cw("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&Mt.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=es(this.node.current,"keyup",a),Cw("down",(s,l)=>{this.startPress(s,l)})},n=es(this.node.current,"keydown",t),r=()=>{this.isPressing&&Cw("cancel",(o,a)=>this.cancelPress(o,a))},i=es(this.node.current,"blur",r);this.removeAccessibleListeners=_l(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Mt.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!fV()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Mt.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=os(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=es(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=_l(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const s3=new WeakMap,Ew=new WeakMap,y4e=e=>{const t=s3.get(e.target);t&&t(e)},v4e=e=>{e.forEach(y4e)};function b4e({root:e,...t}){const n=e||document;Ew.has(n)||Ew.set(n,{});const r=Ew.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(v4e,{root:e,...t})),r[i]}function _4e(e,t,n){const r=b4e(t);return s3.set(e,n),r.observe(e),()=>{s3.delete(e),r.unobserve(e)}}const S4e={some:0,all:1};class x4e extends Xl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:S4e[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return _4e(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(w4e(t,n))&&this.startObserver()}unmount(){}}function w4e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const C4e={inView:{Feature:x4e},tap:{Feature:m4e},focus:{Feature:g4e},hover:{Feature:p4e}};function pV(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function A4e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function _S(e,t,n){const r=e.getProps();return zA(r,t,n!==void 0?n:r.custom,E4e(e),A4e(e))}const T4e="framerAppearId",P4e="data-"+FA(T4e);let k4e=un,jA=un;const Sl=e=>e*1e3,as=e=>e/1e3,I4e={current:!1},gV=e=>Array.isArray(e)&&typeof e[0]=="number";function mV(e){return!!(!e||typeof e=="string"&&yV[e]||gV(e)||Array.isArray(e)&&e.every(mV))}const Xh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,yV={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Xh([0,.65,.55,1]),circOut:Xh([.55,0,1,.45]),backIn:Xh([.31,.01,.66,-.59]),backOut:Xh([.33,1.53,.69,.99])};function vV(e){if(e)return gV(e)?Xh(e):Array.isArray(e)?e.map(vV):yV[e]}function M4e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=vV(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function R4e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const bV=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,O4e=1e-7,$4e=12;function N4e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=bV(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>O4e&&++s<$4e);return a}function Fm(e,t,n,r){if(e===t&&n===r)return un;const i=o=>N4e(o,0,1,e,n);return o=>o===0||o===1?o:bV(i(o),t,r)}const D4e=Fm(.42,0,1,1),L4e=Fm(0,0,.58,1),_V=Fm(.42,0,.58,1),F4e=e=>Array.isArray(e)&&typeof e[0]!="number",SV=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,xV=e=>t=>1-e(1-t),wV=e=>1-Math.sin(Math.acos(e)),VA=xV(wV),B4e=SV(VA),CV=Fm(.33,1.53,.69,.99),UA=xV(CV),z4e=SV(UA),j4e=e=>(e*=2)<1?.5*UA(e):.5*(2-Math.pow(2,-10*(e-1))),V4e={linear:un,easeIn:D4e,easeInOut:_V,easeOut:L4e,circIn:wV,circInOut:B4e,circOut:VA,backIn:UA,backInOut:z4e,backOut:CV,anticipate:j4e},k9=e=>{if(Array.isArray(e)){jA(e.length===4);const[t,n,r,i]=e;return Fm(t,n,r,i)}else if(typeof e=="string")return V4e[e];return e},GA=(e,t)=>n=>!!(Dm(n)&&j3e.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),EV=(e,t,n)=>r=>{if(!Dm(r))return r;const[i,o,a,s]=r.match(vS);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},U4e=e=>Ol(0,255,e),Aw={...pc,transform:e=>Math.round(U4e(e))},$u={test:GA("rgb","red"),parse:EV("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Aw.transform(e)+", "+Aw.transform(t)+", "+Aw.transform(n)+", "+_p(bp.transform(r))+")"};function G4e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const l3={test:GA("#"),parse:G4e,transform:$u.transform},md={test:GA("hsl","hue"),parse:EV("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+va.transform(_p(t))+", "+va.transform(_p(n))+", "+_p(bp.transform(r))+")"},kr={test:e=>$u.test(e)||l3.test(e)||md.test(e),parse:e=>$u.test(e)?$u.parse(e):md.test(e)?md.parse(e):l3.parse(e),transform:e=>Dm(e)?e:e.hasOwnProperty("red")?$u.transform(e):md.transform(e)},Yt=(e,t,n)=>-n*e+n*t+e;function Tw(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function H4e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=Tw(l,s,e+1/3),o=Tw(l,s,e),a=Tw(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const Pw=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},q4e=[l3,$u,md],W4e=e=>q4e.find(t=>t.test(e));function I9(e){const t=W4e(e);let n=t.parse(e);return t===md&&(n=H4e(n)),n}const AV=(e,t)=>{const n=I9(e),r=I9(t),i={...n};return o=>(i.red=Pw(n.red,r.red,o),i.green=Pw(n.green,r.green,o),i.blue=Pw(n.blue,r.blue,o),i.alpha=Yt(n.alpha,r.alpha,o),$u.transform(i))};function K4e(e){var t,n;return isNaN(e)&&Dm(e)&&(((t=e.match(vS))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Zj))===null||n===void 0?void 0:n.length)||0)>0}const TV={regex:B3e,countKey:"Vars",token:"${v}",parse:un},PV={regex:Zj,countKey:"Colors",token:"${c}",parse:kr.parse},kV={regex:vS,countKey:"Numbers",token:"${n}",parse:pc.parse};function kw(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function J1(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&kw(n,TV),kw(n,PV),kw(n,kV),n}function IV(e){return J1(e).values}function MV(e){const{values:t,numColors:n,numVars:r,tokenised:i}=J1(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function Q4e(e){const t=IV(e);return MV(e)(t.map(X4e))}const $l={test:K4e,parse:IV,createTransformer:MV,getAnimatableNone:Q4e},RV=(e,t)=>n=>`${n>0?t:e}`;function OV(e,t){return typeof e=="number"?n=>Yt(e,t,n):kr.test(e)?AV(e,t):e.startsWith("var(")?RV(e,t):NV(e,t)}const $V=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>OV(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=OV(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},NV=(e,t)=>{const n=$l.createTransformer(t),r=J1(e),i=J1(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?_l($V(r.values,i.values),n):RV(e,t)},zg=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},M9=(e,t)=>n=>Yt(e,t,n);function Z4e(e){return typeof e=="number"?M9:typeof e=="string"?kr.test(e)?AV:NV:Array.isArray(e)?$V:typeof e=="object"?Y4e:M9}function J4e(e,t,n){const r=[],i=n||Z4e(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=J4e(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(Ol(e[0],e[o-1],u)):l}function eEe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=zg(0,t,r);e.push(Yt(n,1,i))}}function tEe(e){const t=[0];return eEe(t,e.length-1),t}function nEe(e,t){return e.map(n=>n*t)}function rEe(e,t){return e.map(()=>t||_V).splice(0,e.length-1)}function eb({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=F4e(r)?r.map(k9):k9(r),o={done:!1,value:t[0]},a=nEe(n&&n.length===t.length?n:tEe(t),e),s=DV(a,t,{ease:Array.isArray(i)?i:rEe(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function LV(e,t){return t?e*(1e3/t):0}const iEe=5;function FV(e,t,n){const r=Math.max(t-iEe,0);return LV(n-e(r),t-r)}const Iw=.001,oEe=.01,R9=10,aEe=.05,sEe=1;function lEe({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;k4e(e<=Sl(R9));let a=1-t;a=Ol(aEe,sEe,a),e=Ol(oEe,R9,as(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=u3(u,a),p=Math.exp(-d);return Iw-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=u3(Math.pow(u,2),a);return(-i(u)+Iw>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-Iw+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=cEe(i,o,s);if(e=Sl(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const uEe=12;function cEe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function hEe(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!O9(e,fEe)&&O9(e,dEe)){const n=lEe(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function BV({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=hEe(r),h=c?-as(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=as(Math.sqrt(s/u)),v=Math.abs(m)<5;n||(n=v?.01:2),t||(t=v?.005:.5);let y;if(p<1){const g=u3(_,p);y=b=>{const S=Math.exp(-p*_*b);return o-S*((h+p*_*m)/g*Math.sin(g*b)+m*Math.cos(g*b))}}else if(p===1)y=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);y=b=>{const S=Math.exp(-p*_*b),x=Math.min(g*b,300);return o-S*((h+p*_*m)*Math.sinh(x)+g*m*Math.cosh(x))/g}}return{calculatedDuration:f&&d||null,next:g=>{const b=y(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=FV(y,g,b):S=0);const x=Math.abs(S)<=n,w=Math.abs(o-b)<=t;a.done=x&&w}return a.value=a.done?o:b,a}}}function $9({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>v+y(C),b=C=>{const T=y(C),A=g(C);f.done=Math.abs(T)<=u,f.value=f.done?v:A};let S,x;const w=C=>{h(f.value)&&(S=C,x=BV({keyframes:[f.value,p(f.value)],velocity:FV(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return w(0),{calculatedDuration:null,next:C=>{let T=!1;return!x&&S===void 0&&(T=!0,b(C),w(C)),S!==void 0&&C>S?x.next(C-S):(!T&&b(C),f)}}}const pEe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Mt.update(t,!0),stop:()=>_s(t),now:()=>pr.isProcessing?pr.timestamp:performance.now()}},N9=2e4;function D9(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=N9?1/0:t}const gEe={decay:$9,inertia:$9,tween:eb,keyframes:eb,spring:BV};function tb({autoplay:e=!0,delay:t=0,driver:n=pEe,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const v=()=>{_=new Promise(z=>{m=z})};v();let y;const g=gEe[i]||eb;let b;g!==eb&&typeof r[0]!="number"&&(b=DV([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let x;s==="mirror"&&(x=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let w="idle",C=null,T=null,A=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=D9(S));const{calculatedDuration:I}=S;let D=1/0,M=1/0;I!==null&&(D=I+a,M=D*(o+1)-a);let E=0;const P=z=>{if(T===null)return;h>0&&(T=Math.min(T,z)),h<0&&(T=Math.min(z-M/h,T)),C!==null?E=C:E=Math.round(z-T)*h;const V=E-t*(h>=0?1:-1),H=h>=0?V<0:V>M;E=Math.max(V,0),w==="finished"&&C===null&&(E=M);let Q=E,Z=S;if(o){const ee=E/D;let ne=Math.floor(ee),fe=ee%1;!fe&&ee>=1&&(fe=1),fe===1&&ne--,ne=Math.min(ne,o+1);const de=!!(ne%2);de&&(s==="reverse"?(fe=1-fe,a&&(fe-=a/D)):s==="mirror"&&(Z=x));let Be=Ol(0,1,fe);E>M&&(Be=s==="reverse"&&de?1:0),Q=Be*D}const J=H?{done:!1,value:r[0]}:Z.next(Q);b&&(J.value=b(J.value));let{done:j}=J;!H&&I!==null&&(j=h>=0?E>=M:E<=0);const X=C===null&&(w==="finished"||w==="running"&&j);return d&&d(J.value),X&&O(),J},N=()=>{y&&y.stop(),y=void 0},L=()=>{w="idle",N(),m(),v(),T=A=null},O=()=>{w="finished",c&&c(),N(),m()},R=()=>{if(p)return;y||(y=n(P));const z=y.now();l&&l(),C!==null?T=z-C:(!T||w==="finished")&&(T=z),w==="finished"&&v(),A=T,C=null,w="running",y.start()};e&&R();const $={then(z,V){return _.then(z,V)},get time(){return as(E)},set time(z){z=Sl(z),E=z,C!==null||!y||h===0?C=z:T=y.now()-z/h},get duration(){const z=S.calculatedDuration===null?D9(S):S.calculatedDuration;return as(z)},get speed(){return h},set speed(z){z===h||!y||(h=z,$.time=as(E))},get state(){return w},play:R,pause:()=>{w="paused",C=E},stop:()=>{p=!0,w!=="idle"&&(w="idle",u&&u(),L())},cancel:()=>{A!==null&&P(A),L()},complete:()=>{w="finished"},sample:z=>(T=0,P(z))};return $}function mEe(e){let t;return()=>(t===void 0&&(t=e()),t)}const yEe=mEe(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),vEe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),ty=10,bEe=2e4,_Ee=(e,t)=>t.type==="spring"||e==="backgroundColor"||!mV(t.ease);function SEe(e,t,{onUpdate:n,onComplete:r,...i}){if(!(yEe()&&vEe.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(y=>{s=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(_Ee(t,i)){const y=tb({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const b=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{Mt.update(m),s(),u()};return p.onfinish=()=>{e.set(R4e(c,i)),r&&r(),_()},{then(y,g){return l.then(y,g)},attachTimeline(y){return p.timeline=y,p.onfinish=null,un},get time(){return as(p.currentTime||0)},set time(y){p.currentTime=Sl(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return as(d)},play:()=>{a||(p.play(),_s(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const g=tb({...i,autoplay:!1});e.setWithVelocity(g.sample(y-ty).value,g.sample(y).value,ty)}_()},complete:()=>p.finish(),cancel:_}}function xEe({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:un,pause:un,stop:un,then:o=>(o(),Promise.resolve()),cancel:un,complete:un});return t?tb({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const wEe={type:"spring",stiffness:500,damping:25,restSpeed:10},CEe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),EEe={type:"keyframes",duration:.8},AEe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},TEe=(e,{keyframes:t})=>t.length>2?EEe:hc.has(e)?e.startsWith("scale")?CEe(t[1]):wEe:AEe,c3=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&($l.test(t)||t==="0")&&!t.startsWith("url(")),PEe=new Set(["brightness","contrast","saturate","opacity"]);function kEe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(vS)||[];if(!r)return e;const i=n.replace(r,"");let o=PEe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const IEe=/([a-z-]*)\(.*?\)/g,d3={...$l,getAnimatableNone:e=>{const t=e.match(IEe);return t?t.map(kEe).join(" "):e}},MEe={...Jj,color:kr,backgroundColor:kr,outlineColor:kr,fill:kr,stroke:kr,borderColor:kr,borderTopColor:kr,borderRightColor:kr,borderBottomColor:kr,borderLeftColor:kr,filter:d3,WebkitFilter:d3},HA=e=>MEe[e];function zV(e,t){let n=HA(e);return n!==d3&&(n=$l),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const jV=e=>/^0[^.\s]+$/.test(e);function REe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||jV(e)}function OEe(e,t,n,r){const i=c3(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=VV(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-Sl(a);const l=OEe(t,e,n,o),u=l[0],c=l[l.length-1],d=c3(e,u),f=c3(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if($Ee(o)||(h={...h,...TEe(e,h)}),h.duration&&(h.duration=Sl(h.duration)),h.repeatDelay&&(h.repeatDelay=Sl(h.repeatDelay)),!d||!f||I4e.current||o.type===!1)return xEe(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=SEe(t,e,h);if(p)return p}return tb(h)};function nb(e){return!!(oi(e)&&e.add)}const UV=e=>/^\-?\d*\.?\d+$/.test(e);function WA(e,t){e.indexOf(t)===-1&&e.push(t)}function KA(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class XA{constructor(){this.subscriptions=[]}add(t){return WA(this.subscriptions,t),()=>KA(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class DEe{constructor(t,n={}){this.version="10.16.1",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=pr;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,Mt.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Mt.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=NEe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new XA);const r=this.events[t].add(n);return t==="change"?()=>{r(),Mt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?LV(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function wf(e,t){return new DEe(e,t)}const GV=e=>t=>t.test(e),LEe={test:e=>e==="auto",parse:e=>e},HV=[pc,Ie,va,js,U3e,V3e,LEe],bh=e=>HV.find(GV(e)),FEe=[...HV,kr,$l],BEe=e=>FEe.find(GV(e));function zEe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,wf(n))}function jEe(e,t){const n=_S(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=r4e(o[a]);zEe(e,a,s)}}function VEe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&jEe(e,a)}),u}function f3(e,t,n={}){const r=_S(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(qV(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return qEe(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function qEe(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(WEe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(f3(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function WEe(e,t){return e.sortNodePosition(t)}function KEe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>f3(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=f3(e,t,n);else{const i=typeof t=="function"?_S(e,t,n.custom):t;r=Promise.all(qV(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const XEe=[...IA].reverse(),QEe=IA.length;function YEe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>KEe(e,n,r)))}function ZEe(e){let t=YEe(e);const n=eAe();let r=!0;const i=(l,u)=>{const c=_S(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&S;const A=Array.isArray(b)?b:[b];let I=A.reduce(i,{});x===!1&&(I={});const{prevResolvedValues:D={}}=g,M={...D,...I},E=P=>{T=!0,h.delete(P),g.needsAnimating[P]=!0};for(const P in M){const N=I[P],L=D[P];p.hasOwnProperty(P)||(N!==L?Z1(N)&&Z1(L)?!pV(N,L)||C?E(P):g.protectedKeys[P]=!0:N!==void 0?E(P):h.add(P):N!==void 0&&h.has(P)?E(P):g.protectedKeys[P]=!0)}g.prevProp=b,g.prevResolvedValues=I,g.isActive&&(p={...p,...I}),r&&e.blockInitialAnimation&&(T=!1),T&&!w&&f.push(...A.map(P=>({animation:P,options:{type:y,...l}})))}if(h.size){const v={};h.forEach(y=>{const g=e.getBaseTarget(y);g!==void 0&&(v[y]=g)}),f.push({animation:v})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function JEe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!pV(t,e):!1}function uu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function eAe(){return{animate:uu(!0),whileInView:uu(),whileHover:uu(),whileTap:uu(),whileDrag:uu(),whileFocus:uu(),exit:uu()}}class tAe extends Xl{constructor(t){super(t),t.animationState||(t.animationState=ZEe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),mS(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let nAe=0;class rAe extends Xl{constructor(){super(...arguments),this.id=nAe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const iAe={animation:{Feature:tAe},exit:{Feature:rAe}},L9=(e,t)=>Math.abs(e-t);function oAe(e,t){const n=L9(e.x,t.x),r=L9(e.y,t.y);return Math.sqrt(n**2+r**2)}class WV{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=Rw(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=oAe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=pr;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=Mw(c,this.transformPagePoint),Mt.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=Rw(u.type==="pointercancel"?this.lastMoveEventInfo:Mw(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!uV(t))return;this.handlers=n,this.transformPagePoint=r;const i=bS(t),o=Mw(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=pr;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,Rw(o,this.history)),this.removeListeners=_l(os(window,"pointermove",this.handlePointerMove),os(window,"pointerup",this.handlePointerUp),os(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),_s(this.updatePoint)}}function Mw(e,t){return t?{point:t(e.point)}:e}function F9(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rw({point:e},t){return{point:e,delta:F9(e,KV(t)),offset:F9(e,aAe(t)),velocity:sAe(t,.1)}}function aAe(e){return e[0]}function KV(e){return e[e.length-1]}function sAe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=KV(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Sl(t)));)n--;if(!r)return{x:0,y:0};const o=as(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Ci(e){return e.max-e.min}function h3(e,t=0,n=.01){return Math.abs(e-t)<=n}function B9(e,t,n,r=.5){e.origin=r,e.originPoint=Yt(t.min,t.max,e.origin),e.scale=Ci(n)/Ci(t),(h3(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Yt(n.min,n.max,e.origin)-e.originPoint,(h3(e.translate)||isNaN(e.translate))&&(e.translate=0)}function Sp(e,t,n,r){B9(e.x,t.x,n.x,r?r.originX:void 0),B9(e.y,t.y,n.y,r?r.originY:void 0)}function z9(e,t,n){e.min=n.min+t.min,e.max=e.min+Ci(t)}function lAe(e,t,n){z9(e.x,t.x,n.x),z9(e.y,t.y,n.y)}function j9(e,t,n){e.min=t.min-n.min,e.max=e.min+Ci(t)}function xp(e,t,n){j9(e.x,t.x,n.x),j9(e.y,t.y,n.y)}function uAe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Yt(n,e,r.max):Math.min(e,n)),e}function V9(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function cAe(e,{top:t,left:n,bottom:r,right:i}){return{x:V9(e.x,n,i),y:V9(e.y,t,r)}}function U9(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=zg(t.min,t.max-r,e.min):r>i&&(n=zg(e.min,e.max-i,t.min)),Ol(0,1,n)}function hAe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const p3=.35;function pAe(e=p3){return e===!1?e=0:e===!0&&(e=p3),{x:G9(e,"left","right"),y:G9(e,"top","bottom")}}function G9(e,t,n){return{min:H9(e,t),max:H9(e,n)}}function H9(e,t){return typeof e=="number"?e:e[t]||0}const q9=()=>({translate:0,scale:1,origin:0,originPoint:0}),yd=()=>({x:q9(),y:q9()}),W9=()=>({min:0,max:0}),Sn=()=>({x:W9(),y:W9()});function Ko(e){return[e("x"),e("y")]}function XV({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function gAe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function mAe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ow(e){return e===void 0||e===1}function g3({scale:e,scaleX:t,scaleY:n}){return!Ow(e)||!Ow(t)||!Ow(n)}function vu(e){return g3(e)||QV(e)||e.z||e.rotate||e.rotateX||e.rotateY}function QV(e){return K9(e.x)||K9(e.y)}function K9(e){return e&&e!=="0%"}function rb(e,t,n){const r=e-n,i=t*r;return n+i}function X9(e,t,n,r,i){return i!==void 0&&(e=rb(e,i,r)),rb(e,n,r)+t}function m3(e,t=0,n=1,r,i){e.min=X9(e.min,t,n,r,i),e.max=X9(e.max,t,n,r,i)}function YV(e,{x:t,y:n}){m3(e.x,t.translate,t.scale,t.originPoint),m3(e.y,n.translate,n.scale,n.originPoint)}function yAe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function Ks(e,t){e.min=e.min+t,e.max=e.max+t}function Y9(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=Yt(e.min,e.max,o);m3(e,t[n],t[r],a,t.scale)}const vAe=["x","scaleX","originX"],bAe=["y","scaleY","originY"];function vd(e,t){Y9(e.x,t,vAe),Y9(e.y,t,bAe)}function ZV(e,t){return XV(mAe(e.getBoundingClientRect(),t))}function _Ae(e,t,n){const r=ZV(e,n),{scroll:i}=t;return i&&(Ks(r.x,i.offset.x),Ks(r.y,i.offset.y)),r}const SAe=new WeakMap;class xAe{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Sn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(bS(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=dV(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ko(p=>{let m=this.getAxisMotionValue(p).get()||0;if(va.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const v=_.layout.layoutBox[p];v&&(m=Ci(v)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&Mt.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=wAe(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new WV(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&Mt.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!ny(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=uAe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&gd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=cAe(r.layoutBox,t):this.constraints=!1,this.elastic=pAe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ko(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=hAe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gd(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=_Ae(r,i.root,this.visualElement.getTransformPagePoint());let a=dAe(i.layout.layoutBox,o);if(n){const s=n(gAe(a));this.hasMutatedConstraints=!!s,s&&(a=XV(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=Ko(c=>{if(!ny(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(qA(t,r,0,n))}stopAnimation(){Ko(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ko(n=>{const{drag:r}=this.getProps();if(!ny(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-Yt(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ko(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=fAe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ko(a=>{if(!ny(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(Yt(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;SAe.set(this.visualElement,this);const t=this.visualElement.current,n=os(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();gd(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=es(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ko(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=p3,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function ny(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function wAe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class CAe extends Xl{constructor(t){super(t),this.removeGroupControls=un,this.removeListeners=un,this.controls=new xAe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||un}unmount(){this.removeGroupControls(),this.removeListeners()}}const Z9=e=>(t,n)=>{e&&Mt.update(()=>e(t,n))};class EAe extends Xl{constructor(){super(...arguments),this.removePointerDownListener=un}onPointerDown(t){this.session=new WV(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Z9(t),onStart:Z9(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&Mt.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=os(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function AAe(){const e=k.useContext($m);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=k.useId();return k.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function TAe(){return PAe(k.useContext($m))}function PAe(e){return e===null?!0:e.isPresent}const cv={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function J9(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const _h={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ie.test(e))e=parseFloat(e);else return e;const n=J9(e,t.target.x),r=J9(e,t.target.y);return`${n}% ${r}%`}},kAe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=$l.parse(e);if(i.length>5)return r;const o=$l.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=Yt(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class IAe extends bt.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;N3e(MAe),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),cv.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||Mt.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function JV(e){const[t,n]=AAe(),r=k.useContext(RA);return bt.createElement(IAe,{...e,layoutGroup:r,switchLayoutGroup:k.useContext(Kj),isPresent:t,safeToRemove:n})}const MAe={borderRadius:{..._h,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:_h,borderTopRightRadius:_h,borderBottomLeftRadius:_h,borderBottomRightRadius:_h,boxShadow:kAe},eU=["TopLeft","TopRight","BottomLeft","BottomRight"],RAe=eU.length,eM=e=>typeof e=="string"?parseFloat(e):e,tM=e=>typeof e=="number"||Ie.test(e);function OAe(e,t,n,r,i,o){i?(e.opacity=Yt(0,n.opacity!==void 0?n.opacity:1,$Ae(r)),e.opacityExit=Yt(t.opacity!==void 0?t.opacity:1,0,NAe(r))):o&&(e.opacity=Yt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(zg(e,t,r))}function rM(e,t){e.min=t.min,e.max=t.max}function Ni(e,t){rM(e.x,t.x),rM(e.y,t.y)}function iM(e,t,n,r,i){return e-=t,e=rb(e,1/n,r),i!==void 0&&(e=rb(e,1/i,r)),e}function DAe(e,t=0,n=1,r=.5,i,o=e,a=e){if(va.test(t)&&(t=parseFloat(t),t=Yt(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=Yt(o.min,o.max,r);e===o&&(s-=t),e.min=iM(e.min,t,n,s,i),e.max=iM(e.max,t,n,s,i)}function oM(e,t,[n,r,i],o,a){DAe(e,t[n],t[r],t[i],t.scale,o,a)}const LAe=["x","scaleX","originX"],FAe=["y","scaleY","originY"];function aM(e,t,n,r){oM(e.x,t,LAe,n?n.x:void 0,r?r.x:void 0),oM(e.y,t,FAe,n?n.y:void 0,r?r.y:void 0)}function sM(e){return e.translate===0&&e.scale===1}function nU(e){return sM(e.x)&&sM(e.y)}function BAe(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function rU(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function lM(e){return Ci(e.x)/Ci(e.y)}class zAe{constructor(){this.members=[]}add(t){WA(this.members,t),t.scheduleRender()}remove(t){if(KA(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function uM(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const jAe=(e,t)=>e.depth-t.depth;class VAe{constructor(){this.children=[],this.isDirty=!1}add(t){WA(this.children,t),this.isDirty=!0}remove(t){KA(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(jAe),this.isDirty=!1,this.children.forEach(t)}}function UAe(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(_s(r),e(o-t))};return Mt.read(r,!0),()=>_s(r)}function GAe(e){window.MotionDebug&&window.MotionDebug.record(e)}function HAe(e){return e instanceof SVGElement&&e.tagName!=="svg"}function qAe(e,t,n){const r=oi(e)?e:wf(e);return r.start(qA("",r,t,n)),r.animation}const cM=["","X","Y","Z"],dM=1e3;let WAe=0;const bu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function iU({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=WAe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{bu.totalNodes=bu.resolvedTargetDeltas=bu.recalculatedProjection=0,this.nodes.forEach(QAe),this.nodes.forEach(tTe),this.nodes.forEach(nTe),this.nodes.forEach(YAe),GAe(bu)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=UAe(f,250),cv.hasAnimatedSinceResize&&(cv.hasAnimatedSinceResize=!1,this.nodes.forEach(hM))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||sTe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:v}=c.getProps(),y=!this.targetLayout||!rU(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const b={...VV(m,"layout"),onPlay:_,onComplete:v};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else f||hM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_s(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(rTe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(ZAe),this.sharedNodes.forEach(iTe)}scheduleUpdateProjection(){Mt.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){Mt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=b/1e3;pM(d.x,a.x,S),pM(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(xp(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),oTe(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&BAe(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Sn()),Ni(g,this.relativeTarget)),m&&(this.animationValues=c,OAe(c,u,this.latestValues,S,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_s(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Mt.update(()=>{cv.hasAnimatedSinceResize=!0,this.currentAnimation=qAe(0,dM,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dM),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&oU(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Sn();const d=Ci(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=Ci(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}Ni(s,l),vd(s,c),Sp(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new zAe),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(fM),this.root.sharedNodes.clear()}}}function KAe(e){e.updateLayout()}function XAe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Ko(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Ci(f);f.min=r[d].min,f.max=f.min+h}):oU(o,n.layoutBox,r)&&Ko(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Ci(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=yd();Sp(s,r,n.layoutBox);const l=yd();a?Sp(l,e.applyTransform(i,!0),n.measuredBox):Sp(l,r,n.layoutBox);const u=!nU(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Sn();xp(p,n.layoutBox,f.layoutBox);const m=Sn();xp(m,r,h.layoutBox),rU(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function QAe(e){bu.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function YAe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ZAe(e){e.clearSnapshot()}function fM(e){e.clearMeasurements()}function JAe(e){e.isLayoutDirty=!1}function eTe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function hM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function tTe(e){e.resolveTargetDelta()}function nTe(e){e.calcProjection()}function rTe(e){e.resetRotation()}function iTe(e){e.removeLeadSnapshot()}function pM(e,t,n){e.translate=Yt(t.translate,0,n),e.scale=Yt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function gM(e,t,n,r){e.min=Yt(t.min,n.min,r),e.max=Yt(t.max,n.max,r)}function oTe(e,t,n,r){gM(e.x,t.x,n.x,r),gM(e.y,t.y,n.y,r)}function aTe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const sTe={duration:.45,ease:[.4,0,.1,1]},mM=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),yM=mM("applewebkit/")&&!mM("chrome/")?Math.round:un;function vM(e){e.min=yM(e.min),e.max=yM(e.max)}function lTe(e){vM(e.x),vM(e.y)}function oU(e,t,n){return e==="position"||e==="preserve-aspect"&&!h3(lM(t),lM(n),.2)}const uTe=iU({attachResizeListener:(e,t)=>es(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),$w={current:void 0},aU=iU({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!$w.current){const e=new uTe({});e.mount(window),e.setOptions({layoutScroll:!0}),$w.current=e}return $w.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),cTe={pan:{Feature:EAe},drag:{Feature:CAe,ProjectionNode:aU,MeasureLayout:JV}},dTe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function fTe(e){const t=dTe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function y3(e,t,n=1){const[r,i]=fTe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return UV(a)?parseFloat(a):a}else return a3(i)?y3(i,t,n+1):i}function hTe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!a3(o))return;const a=y3(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!a3(o))continue;const a=y3(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const pTe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),sU=e=>pTe.has(e),gTe=e=>Object.keys(e).some(sU),bM=e=>e===pc||e===Ie,_M=(e,t)=>parseFloat(e.split(", ")[t]),SM=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return _M(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?_M(o[1],e):0}},mTe=new Set(["x","y","z"]),yTe=Nm.filter(e=>!mTe.has(e));function vTe(e){const t=[];return yTe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Cf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:SM(4,13),y:SM(5,14)};Cf.translateX=Cf.x;Cf.translateY=Cf.y;const bTe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=Cf[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=Cf[u](l,o)}),e},_Te=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(sU);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=bh(c);const f=t[l];let h;if(Z1(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=bh(c);for(let _=m;_=0?window.pageYOffset:null,u=bTe(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),gS&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function STe(e,t,n,r){return gTe(t)?_Te(e,t,n,r):{target:t,transitionEnd:r}}const xTe=(e,t,n,r)=>{const i=hTe(e,t,r);return t=i.target,r=i.transitionEnd,STe(e,t,n,r)},v3={current:null},lU={current:!1};function wTe(){if(lU.current=!0,!!gS)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>v3.current=e.matches;e.addListener(t),t()}else v3.current=!1}function CTe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(oi(o))e.addValue(i,o),nb(r)&&r.add(i);else if(oi(a))e.addValue(i,wf(o,{owner:e})),nb(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,wf(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const xM=new WeakMap,uU=Object.keys(Bg),ETe=uU.length,wM=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],ATe=MA.length;class TTe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Mt.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=yS(n),this.isVariantNode=Wj(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&oi(f)&&(f.set(s[d],!1),nb(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,xM.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),lU.current||wTe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:v3.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){xM.delete(this.current),this.projection&&this.projection.unmount(),_s(this.notifyUpdate),_s(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=hc.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Mt.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Sn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=wf(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=zA(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!oi(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new XA),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class cU extends TTe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=GEe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){VEe(this,r,a);const s=xTe(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function PTe(e){return window.getComputedStyle(e)}class kTe extends cU{readValueFromInstance(t,n){if(hc.has(n)){const r=HA(n);return r&&r.default||0}else{const r=PTe(t),i=(Yj(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return ZV(t,n)}build(t,n,r,i){$A(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return BA(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;oi(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){rV(t,n,r,i)}}class ITe extends cU{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(hc.has(n)){const r=HA(n);return r&&r.default||0}return n=iV.has(n)?n:FA(n),t.getAttribute(n)}measureInstanceViewportBox(){return Sn()}scrapeMotionValuesFromProps(t,n){return aV(t,n)}build(t,n,r,i){DA(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){oV(t,n,r,i)}mount(t){this.isSVGTag=LA(t.tagName),super.mount(t)}}const MTe=(e,t)=>OA(e)?new ITe(t,{enableHardwareAcceleration:!1}):new kTe(t,{enableHardwareAcceleration:!0}),RTe={layout:{ProjectionNode:aU,MeasureLayout:JV}},OTe={...iAe,...C4e,...cTe,...RTe},dU=O3e((e,t)=>d4e(e,t,OTe,MTe));function fU(){const e=k.useRef(!1);return kA(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function $Te(){const e=fU(),[t,n]=k.useState(0),r=k.useCallback(()=>{e.current&&n(t+1)},[t]);return[k.useCallback(()=>Mt.postRender(r),[r]),t]}class NTe extends k.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function DTe({children:e,isPresent:t}){const n=k.useId(),r=k.useRef(null),i=k.useRef({width:0,height:0,top:0,left:0});return k.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` - [data-motion-pop-id="${n}"] { - position: absolute !important; - width: ${o}px !important; - height: ${a}px !important; - top: ${s}px !important; - left: ${l}px !important; - } - `),()=>{document.head.removeChild(u)}},[t]),k.createElement(NTe,{isPresent:t,childRef:r,sizeRef:i},k.cloneElement(e,{ref:r}))}const Nw=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=sV(LTe),l=k.useId(),u=k.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return k.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),k.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=k.createElement(DTe,{isPresent:n},e)),k.createElement($m.Provider,{value:u},e)};function LTe(){return new Map}function FTe(e){return k.useEffect(()=>()=>e(),[])}const Wc=e=>e.key||"";function BTe(e,t){e.forEach(n=>{const r=Wc(n);t.set(r,n)})}function zTe(e){const t=[];return k.Children.forEach(e,n=>{k.isValidElement(n)&&t.push(n)}),t}const hU=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=k.useContext(RA).forceRender||$Te()[0],l=fU(),u=zTe(e);let c=u;const d=k.useRef(new Map).current,f=k.useRef(c),h=k.useRef(new Map).current,p=k.useRef(!0);if(kA(()=>{p.current=!1,BTe(u,h),f.current=c}),FTe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return k.createElement(k.Fragment,null,c.map(y=>k.createElement(Nw,{key:Wc(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},y)));c=[...c];const m=f.current.map(Wc),_=u.map(Wc),v=m.length;for(let y=0;y{if(_.indexOf(g)!==-1)return;const b=h.get(g);if(!b)return;const S=m.indexOf(g);let x=y;if(!x){const w=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(T=>T.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};x=k.createElement(Nw,{key:Wc(b),isPresent:!1,onExitComplete:w,custom:t,presenceAffectsLayout:o,mode:a},b),d.set(g,x)}c.splice(S,0,x)}),c=c.map(y=>{const g=y.key;return d.has(g)?y:k.createElement(Nw,{key:Wc(y),isPresent:!0,presenceAffectsLayout:o,mode:a},y)}),k.createElement(k.Fragment,null,d.size?c:c.map(y=>k.cloneElement(y)))};var jTe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},pU=k.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=jTe,toastSpacing:c="0.5rem"}=e,[d,f]=k.useState(s),h=TAe();_9(()=>{h||r==null||r()},[h]),_9(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};k.useEffect(()=>{h&&o&&i()},[h,o,i]),C3e(_,d);const v=k.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),y=k.useMemo(()=>S3e(a),[a]);return q.jsx(dU.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:y,children:q.jsx(sr.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:v,children:la(n,{id:t,onClose:_})})})});pU.displayName="ToastComponent";function VTe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var CM={path:q.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[q.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),q.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),q.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Bm=Pi((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Kl("chakra-icon",s),d=Om("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??CM.viewBox;if(n&&typeof n!="string")return q.jsx(sr.svg,{as:n,...h,...u});const m=a??CM.path;return q.jsx(sr.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});Bm.displayName="Icon";function UTe(e){return q.jsx(Bm,{viewBox:"0 0 24 24",...e,children:q.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function GTe(e){return q.jsx(Bm,{viewBox:"0 0 24 24",...e,children:q.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function EM(e){return q.jsx(Bm,{viewBox:"0 0 24 24",...e,children:q.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var HTe=obe({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QA=Pi((e,t)=>{const n=Om("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Mm(e),u=Kl("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${HTe} ${o} linear infinite`,...n};return q.jsx(sr.div,{ref:t,__css:c,className:u,...l,children:r&&q.jsx(sr.span,{srOnly:!0,children:r})})});QA.displayName="Spinner";var[qTe,YA]=Im({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[WTe,ZA]=Im({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),gU={info:{icon:GTe,colorScheme:"blue"},warning:{icon:EM,colorScheme:"orange"},success:{icon:UTe,colorScheme:"green"},error:{icon:EM,colorScheme:"red"},loading:{icon:QA,colorScheme:"blue"}};function KTe(e){return gU[e].colorScheme}function XTe(e){return gU[e].icon}var mU=Pi(function(t,n){const r=ZA(),{status:i}=YA(),o={display:"inline",...r.description};return q.jsx(sr.div,{ref:n,"data-status":i,...t,className:Kl("chakra-alert__desc",t.className),__css:o})});mU.displayName="AlertDescription";function yU(e){const{status:t}=YA(),n=XTe(t),r=ZA(),i=t==="loading"?r.spinner:r.icon;return q.jsx(sr.span,{display:"inherit","data-status":t,...e,className:Kl("chakra-alert__icon",e.className),__css:i,children:e.children||q.jsx(n,{h:"100%",w:"100%"})})}yU.displayName="AlertIcon";var vU=Pi(function(t,n){const r=ZA(),{status:i}=YA();return q.jsx(sr.div,{ref:n,"data-status":i,...t,className:Kl("chakra-alert__title",t.className),__css:r.title})});vU.displayName="AlertTitle";var bU=Pi(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Mm(t),s=(r=t.colorScheme)!=null?r:KTe(i),l=t3e("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return q.jsx(qTe,{value:{status:i},children:q.jsx(WTe,{value:l,children:q.jsx(sr.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Kl("chakra-alert",t.className),__css:u})})})});bU.displayName="Alert";function QTe(e){return q.jsx(Bm,{focusable:"false","aria-hidden":!0,...e,children:q.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var _U=Pi(function(t,n){const r=Om("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Mm(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return q.jsx(sr.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||q.jsx(QTe,{width:"1em",height:"1em"})})});_U.displayName="CloseButton";var YTe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},ra=ZTe(YTe);function ZTe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=JTe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=b9(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:SU(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=Gj(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!b9(ra.getState(),i).position}}var AM=0;function JTe(e,t={}){var n,r;AM+=1;const i=(n=t.id)!=null?n:AM,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>ra.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var ePe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return q.jsxs(bU,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[q.jsx(yU,{children:u}),q.jsxs(sr.div,{flex:"1",maxWidth:"100%",children:[i&&q.jsx(vU,{id:c==null?void 0:c.title,children:i}),s&&q.jsx(mU,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&q.jsx(_U,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function SU(e={}){const{render:t,toastComponent:n=ePe}=e;return i=>typeof t=="function"?t({...i,...e}):q.jsx(n,{...i,...e})}function xU(e,t){const n=i=>{var o;return{...t,...i,position:VTe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=SU(o);return ra.notify(a,o)};return r.update=(i,o)=>{ra.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...la(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...la(o.error,s)}))},r.closeAll=ra.closeAll,r.close=ra.close,r.isActive=ra.isActive,r}var[SUe,tPe]=Im({name:"ToastOptionsContext",strict:!1}),nPe=e=>{const t=k.useSyncExternalStore(ra.subscribe,ra.getState,ra.getState),{motionVariants:n,component:r=pU,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return q.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:x3e(s),children:q.jsx(hU,{initial:!1,children:l.map(u=>q.jsx(r,{motionVariants:n,...u},u.id))})},s)});return q.jsx(lS,{...i,children:a})};function rPe(e){const{theme:t}=oj(),n=tPe();return k.useMemo(()=>xU(t.direction,{...n,...e}),[e,t.direction,n])}var iPe={duration:5e3,variant:"solid"},Bc={theme:G5e,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:iPe,forced:!1};function oPe({theme:e=Bc.theme,colorMode:t=Bc.colorMode,toggleColorMode:n=Bc.toggleColorMode,setColorMode:r=Bc.setColorMode,defaultOptions:i=Bc.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Bc){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>q.jsx(v3e,{theme:e,children:q.jsx(_A.Provider,{value:u,children:q.jsx(nPe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:xU(e.direction,i)}}var b3=Pi(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return q.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});b3.displayName="NativeImage";function aPe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=k.useState("pending");k.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=k.useRef(),f=k.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return U1(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var sPe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function lPe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var JA=Pi(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,v=aPe({...t,crossOrigin:d,ignoreFallback:_}),y=sPe(v,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:lPe(p,["onError","onLoad"])};return y?i||q.jsx(sr.img,{as:b3,className:"chakra-image__placeholder",src:r,...g}):q.jsx(sr.img,{as:b3,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});JA.displayName="Image";var wU=Pi(function(t,n){const r=Om("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Mm(t),u=a3e({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return q.jsx(sr.p,{ref:n,className:Kl("chakra-text",t.className),...u,...l,__css:r})});wU.displayName="Text";var _3=Pi(function(t,n){const r=Om("Heading",t),{className:i,...o}=Mm(t);return q.jsx(sr.h2,{ref:n,className:Kl("chakra-heading",t.className),...o,__css:r})});_3.displayName="Heading";var ib=sr("div");ib.displayName="Box";var CU=Pi(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return q.jsx(ib,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});CU.displayName="Square";var uPe=Pi(function(t,n){const{size:r,...i}=t;return q.jsx(CU,{size:r,ref:n,borderRadius:"9999px",...i})});uPe.displayName="Circle";var eT=Pi(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return q.jsx(sr.div,{ref:n,__css:d,...c})});eT.displayName="Flex";const ft=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},cPe=F.object({status:F.literal(422),data:F.object({detail:F.array(F.object({loc:F.array(F.string()),msg:F.string(),type:F.string()}))})});function Ur(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const ry={H:220,S:16},iy={H:250,S:42},oy={H:47,S:42},ay={H:40,S:70},sy={H:28,S:42},ly={H:113,S:42},uy={H:0,S:42},dPe={base:Ur(ry.H,ry.S),baseAlpha:Ur(ry.H,ry.S,!0),accent:Ur(iy.H,iy.S),accentAlpha:Ur(iy.H,iy.S,!0),working:Ur(oy.H,oy.S),workingAlpha:Ur(oy.H,oy.S,!0),gold:Ur(ay.H,ay.S),goldAlpha:Ur(ay.H,ay.S,!0),warning:Ur(sy.H,sy.S),warningAlpha:Ur(sy.H,sy.S,!0),ok:Ur(ly.H,ly.S),okAlpha:Ur(ly.H,ly.S,!0),error:Ur(uy.H,uy.S),errorAlpha:Ur(uy.H,uy.S,!0)},{definePartsStyle:fPe,defineMultiStyleConfig:hPe}=ze(mj.keys),pPe={border:"none"},gPe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:W(`${t}.200`,`${t}.700`)(e),color:W(`${t}.900`,`${t}.100`)(e),_hover:{bg:W(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:W(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:W(`${t}.300`,`${t}.600`)(e)}}}},mPe=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},yPe={},vPe=fPe(e=>({container:pPe,button:gPe(e),panel:mPe(e),icon:yPe})),bPe=hPe({variants:{invokeAI:vPe},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),_Pe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:W("base.150","base.700")(e),color:W("base.300","base.500")(e),svg:{fill:W("base.300","base.500")(e)},opacity:1},i={bg:"none",color:W("base.300","base.500")(e),svg:{fill:W("base.500","base.500")(e)},opacity:1};return{bg:W("base.250","base.600")(e),color:W("base.850","base.100")(e),borderRadius:"base",svg:{fill:W("base.850","base.100")(e)},_hover:{bg:W("base.300","base.500")(e),color:W("base.900","base.50")(e),svg:{fill:W("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:W(`${t}.400`,`${t}.700`)(e),color:W(`${t}.600`,`${t}.500`)(e),svg:{fill:W(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:W(`${t}.400`,`${t}.600`)(e),color:W("base.50","base.100")(e),borderRadius:"base",svg:{fill:W("base.50","base.100")(e)},_disabled:n,_hover:{bg:W(`${t}.500`,`${t}.500`)(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)},_disabled:n}}},SPe=e=>{const{colorScheme:t}=e,n=W("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:W(`${t}.500`,`${t}.500`)(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},xPe={variants:{invokeAI:_Pe,invokeAIOutline:SPe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:wPe,defineMultiStyleConfig:CPe}=ze(yj.keys),EPe=e=>{const{colorScheme:t}=e;return{bg:W("base.200","base.700")(e),borderColor:W("base.300","base.600")(e),color:W("base.900","base.100")(e),_checked:{bg:W(`${t}.300`,`${t}.500`)(e),borderColor:W(`${t}.300`,`${t}.500`)(e),color:W(`${t}.900`,`${t}.100`)(e),_hover:{bg:W(`${t}.400`,`${t}.500`)(e),borderColor:W(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:W(`${t}.300`,`${t}.600`)(e),borderColor:W(`${t}.300`,`${t}.600`)(e),color:W(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:W("error.600","error.300")(e)}}},APe=wPe(e=>({control:EPe(e)})),TPe=CPe({variants:{invokeAI:APe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:PPe,defineMultiStyleConfig:kPe}=ze(vj.keys),IPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},MPe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:W("accent.900","accent.50")(e),bg:W("accent.200","accent.400")(e)}}),RPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},OPe=PPe(e=>({preview:IPe,input:MPe(e),textarea:RPe})),$Pe=kPe({variants:{invokeAI:OPe},defaultProps:{size:"sm",variant:"invokeAI"}}),NPe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:W("base.700","base.300")(e),_invalid:{color:W("error.500","error.300")(e)}}),DPe={variants:{invokeAI:NPe},defaultProps:{variant:"invokeAI"}},SS=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:W("base.200","base.800")(e),bg:W("base.50","base.900")(e),borderRadius:"base",color:W("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:W("base.300","base.600")(e)},_focus:{borderColor:W("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:W("accent.300","accent.500")(e)}},_invalid:{borderColor:W("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:W("error.400","error.500")(e)}},_disabled:{borderColor:W("base.300","base.700")(e),bg:W("base.300","base.700")(e),color:W("base.600","base.400")(e),_hover:{borderColor:W("base.300","base.700")(e)}},_placeholder:{color:W("base.700","base.400")(e)},"::selection":{bg:W("accent.200","accent.400")(e)}}),{definePartsStyle:LPe,defineMultiStyleConfig:FPe}=ze(bj.keys),BPe=LPe(e=>({field:SS(e)})),zPe=FPe({variants:{invokeAI:BPe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:jPe,defineMultiStyleConfig:VPe}=ze(_j.keys),UPe=jPe(e=>({button:{fontWeight:500,bg:W("base.300","base.500")(e),color:W("base.900","base.100")(e),_hover:{bg:W("base.400","base.600")(e),color:W("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:W("base.900","base.150")(e),bg:W("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:W("base.200","base.800")(e),_hover:{bg:W("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:W("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),GPe=VPe({variants:{invokeAI:UPe},defaultProps:{variant:"invokeAI"}}),xUe={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:HPe,definePartsStyle:qPe}=ze(Sj.keys),WPe=e=>({bg:W("blackAlpha.700","blackAlpha.700")(e)}),KPe={},XPe=()=>({layerStyle:"first",maxH:"80vh"}),QPe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),YPe={},ZPe={overflowY:"scroll"},JPe={},eke=qPe(e=>({overlay:WPe(e),dialogContainer:KPe,dialog:XPe(),header:QPe(),closeButton:YPe,body:ZPe,footer:JPe})),tke=HPe({variants:{invokeAI:eke},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:nke,definePartsStyle:rke}=ze(xj.keys),ike=e=>({height:8}),oke=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...SS(e)}),ake=e=>({display:"flex"}),ske=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:W("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:W("base.900","base.100")(e)}}}),lke=rke(e=>({root:ike(e),field:oke(e),stepperGroup:ake(e),stepper:ske(e)})),uke=nke({variants:{invokeAI:lke},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:cke,definePartsStyle:EU}=ze(wj.keys),AU=en("popper-bg"),TU=en("popper-arrow-bg"),PU=en("popper-arrow-shadow-color"),dke=e=>({[TU.variable]:W("colors.base.100","colors.base.800")(e),[AU.variable]:W("colors.base.100","colors.base.800")(e),[PU.variable]:W("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:W("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),fke=e=>({[TU.variable]:W("colors.base.100","colors.base.700")(e),[AU.variable]:W("colors.base.100","colors.base.700")(e),[PU.variable]:W("colors.base.400","colors.base.400")(e),p:4,bg:W("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),hke=EU(e=>({content:dke(e),body:{padding:0}})),pke=EU(e=>({content:fke(e),body:{padding:0}})),gke=cke({variants:{invokeAI:hke,informational:pke},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:mke,definePartsStyle:yke}=ze(Cj.keys),vke=e=>({bg:"accentAlpha.700"}),bke=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.200`,`${t}.700`)(e)}},_ke=yke(e=>({filledTrack:vke(e),track:bke(e)})),Ske=mke({variants:{invokeAI:_ke},defaultProps:{variant:"invokeAI"}}),xke={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:wke,defineMultiStyleConfig:Cke}=ze(Ej.keys),Eke=e=>({color:W("base.200","base.300")(e)}),Ake=e=>({fontWeight:"600",...SS(e)}),Tke=wke(e=>({field:Ake(e),icon:Eke(e)})),Pke=Cke({variants:{invokeAI:Tke},defaultProps:{size:"sm",variant:"invokeAI"}}),TM=Pe("skeleton-start-color"),PM=Pe("skeleton-end-color"),kke={borderRadius:"base",maxW:"full",maxH:"full",_light:{[TM.variable]:"colors.base.250",[PM.variable]:"colors.base.450"},_dark:{[TM.variable]:"colors.base.700",[PM.variable]:"colors.base.500"}},Ike={variants:{invokeAI:kke},defaultProps:{variant:"invokeAI"}},{definePartsStyle:Mke,defineMultiStyleConfig:Rke}=ze(Aj.keys),Oke=e=>({bg:W("base.400","base.600")(e),h:1.5}),$ke=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.400`,`${t}.600`)(e),h:1.5}},Nke=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:W("base.50","base.100")(e)}),Dke=e=>({fontSize:"2xs",fontWeight:"500",color:W("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),Lke=Mke(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:Oke(e),filledTrack:$ke(e),thumb:Nke(e),mark:Dke(e)})),Fke=Rke({variants:{invokeAI:Lke},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Bke,definePartsStyle:zke}=ze(Tj.keys),jke=e=>{const{colorScheme:t}=e;return{bg:W("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:W(`${t}.400`,`${t}.500`)(e)}}},Vke=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.50`,`${t}.50`)(e)}},Uke=zke(e=>({container:{},track:jke(e),thumb:Vke(e)})),Gke=Bke({variants:{invokeAI:Uke},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Hke,definePartsStyle:kU}=ze(Pj.keys),qke=e=>({display:"flex",columnGap:4}),Wke=e=>({}),Kke=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:W("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:W("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:W("base.700","base.300")(e)},_selected:{bg:W("accent.400","accent.600")(e),color:W("base.50","base.100")(e),svg:{fill:W("base.50","base.100")(e),filter:W(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:W("accent.500","accent.500")(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)}}},_hover:{bg:W("base.100","base.800")(e),color:W("base.900","base.50")(e),svg:{fill:W("base.800","base.100")(e)}}}}},Xke=e=>({padding:0,height:"100%"}),Qke=kU(e=>({root:qke(e),tab:Wke(e),tablist:Kke(e),tabpanel:Xke(e)})),Yke=kU(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:W("base.600","base.400")(e),fontWeight:500,_selected:{color:W("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),Zke=Hke({variants:{line:Yke,appTabs:Qke},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),Jke=e=>({color:W("error.500","error.400")(e)}),e6e=e=>({color:W("base.500","base.400")(e)}),t6e={variants:{subtext:e6e,error:Jke}},n6e=e=>({...SS(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-50) 0%, - var(--invokeai-colors-base-50) 70%, - var(--invokeai-colors-base-200) 70%, - var(--invokeai-colors-base-200) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-50) 0%, - var(--invokeai-colors-base-50) 70%, - var(--invokeai-colors-base-200) 70%, - var(--invokeai-colors-base-200) 100%)`}},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-900) 0%, - var(--invokeai-colors-base-900) 70%, - var(--invokeai-colors-base-800) 70%, - var(--invokeai-colors-base-800) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-900) 0%, - var(--invokeai-colors-base-900) 70%, - var(--invokeai-colors-base-800) 70%, - var(--invokeai-colors-base-800) 100%)`}}},p:2}),r6e={variants:{invokeAI:n6e},defaultProps:{size:"md",variant:"invokeAI"}},i6e=en("popper-arrow-bg"),o6e=e=>({borderRadius:"base",shadow:"dark-lg",bg:W("base.700","base.200")(e),[i6e.variable]:W("colors.base.700","colors.base.200")(e),pb:1.5}),a6e={baseStyle:o6e},kM={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},s6e={".react-flow__nodesselection-rect":{...kM,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":kM},l6e={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...xke},...s6e})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:dPe,components:{Button:xPe,Input:zPe,Editable:$Pe,Textarea:r6e,Tabs:Zke,Progress:Ske,Accordion:bPe,FormLabel:DPe,Switch:Gke,NumberInput:uke,Select:Pke,Skeleton:Ike,Slider:Fke,Popover:gke,Modal:tke,Checkbox:TPe,Menu:GPe,Text:t6e,Tooltip:a6e}},u6e={defaultOptions:{isClosable:!0}},{toast:Sh}=oPe({theme:l6e,defaultOptions:u6e.defaultOptions}),c6e=()=>{pe({matcher:ln.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;ae("queue").debug({enqueueResult:ft(t)},"Batch enqueued"),Sh.isActive("batch-queued")||Sh({id:"batch-queued",title:K("queue.batchQueued"),description:K("queue.batchQueuedDesc",{count:t.enqueued,direction:n.prepend?K("queue.front"):K("queue.back")}),duration:1e3,status:"success"})}}),pe({matcher:ln.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){Sh({title:K("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),ae("queue").error({batchConfig:ft(n),error:ft(t)},K("queue.batchFailedToQueue"));return}const r=cPe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{Sh({id:"batch-failed-to-queue",title:n6(LN(i.msg),{length:128}),status:"error",description:n6(`Path: - ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=zy(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=zy(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=zy(t,"data.detail","Unknown Error"),o=15e3),Sh({title:K("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}ae("queue").error({batchConfig:ft(n),error:ft(t)},K("queue.batchFailedToQueue"))}})},zm={memoizeOptions:{resultEqualityCheck:pE}},IU=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlAdapters:o}=e,a=((d=n.initialImage)==null?void 0:d.imageName)===t,s=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.filter(on).some(f=>Gc(f.data.inputs,h=>{var p;return h.type==="ImageField"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Aa(o).some(f=>f.controlImage===t||hi(f)&&f.processedControlImage===t);return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlImage:u}},d6e=Gn([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>IU(e,r.image_name)):[]},zm),f6e=()=>{pe({matcher:ue.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1;const l=n();r.forEach(u=>{const c=IU(l,u);c.isInitialImage&&!i&&(t(kE()),i=!0),c.isCanvasImage&&!o&&(t(zE()),o=!0),c.isNodesImage&&!a&&(t(Yye()),a=!0),c.isControlImage&&!s&&(t(Tie()),s=!0)})}})},h6e=()=>{pe({matcher:ai(I1,C5),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=I1.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(C5.match(e)?e.payload:o.gallery.galleryView)==="images"?Ln:Tr,u={board_id:a??"none",categories:l};if(await r(()=>ue.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=ue.endpoints.listImages.select(u)(t());if(d){const f=yg.selectAll(d)[0],h=yg.selectById(d,e.payload.selectedImageName);n(ha(h||f||null))}else n(ha(null))}else n(ha(null))}})},p6e=ge("canvas/canvasSavedToGallery"),g6e=ge("canvas/canvasMaskSavedToGallery"),m6e=ge("canvas/canvasCopiedToClipboard"),y6e=ge("canvas/canvasDownloadedAsImage"),v6e=ge("canvas/canvasMerged"),b6e=ge("canvas/stagingAreaImageSaved"),_6e=ge("canvas/canvasMaskToControlAdapter"),S6e=ge("canvas/canvasImageToControlAdapter");let MU=null,RU=null;const wUe=e=>{MU=e},xS=()=>MU,CUe=e=>{RU=e},x6e=()=>RU,w6e=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),ob=async(e,t)=>await w6e(e.toCanvas(t)),wS=async(e,t=!1)=>{const n=xS();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return ob(a,l)},C6e=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},E6e=()=>{pe({actionCreator:m6e,effect:async(e,{dispatch:t,getState:n})=>{const r=Q_.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=wS(i);C6e(o)}catch(o){r.error(String(o)),t(nt({title:K("toast.problemCopyingCanvas"),description:K("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(nt({title:K("toast.canvasCopiedClipboard"),status:"success"}))}})},A6e=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},T6e=()=>{pe({actionCreator:y6e,effect:async(e,{dispatch:t,getState:n})=>{const r=Q_.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await wS(i)}catch(a){r.error(String(a)),t(nt({title:K("toast.problemDownloadingCanvas"),description:K("toast.problemDownloadingCanvasDesc"),status:"error"}));return}A6e(o,"canvas.png"),t(nt({title:K("toast.canvasDownloaded"),status:"success"}))}})},P6e=()=>{pe({actionCreator:S6e,effect:async(e,{dispatch:t,getState:n})=>{const r=ae("canvas"),i=n(),{id:o}=e.payload;let a;try{a=await wS(i,!0)}catch(c){r.error(String(c)),t(nt({title:K("toast.problemSavingCanvas"),description:K("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(ue.endpoints.uploadImage.initiate({file:new File([a],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Hl({id:o,controlImage:u}))}})};var tT={exports:{}},CS={},OU={},Ue={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ve<"u"?Ve:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},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 e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Ue);var tn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Ue;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.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 n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var S=this.m;return{x:S[0]*b.x+S[2]*b.y+S[4],y:S[1]*b.x+S[3]*b.y+S[5]}}translate(b,S){return this.m[4]+=this.m[0]*b+this.m[2]*S,this.m[5]+=this.m[1]*b+this.m[3]*S,this}scale(b,S){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=S,this.m[3]*=S,this}rotate(b){var S=Math.cos(b),x=Math.sin(b),w=this.m[0]*S+this.m[2]*x,C=this.m[1]*S+this.m[3]*x,T=this.m[0]*-x+this.m[2]*S,A=this.m[1]*-x+this.m[3]*S;return this.m[0]=w,this.m[1]=C,this.m[2]=T,this.m[3]=A,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,S){var x=this.m[0]+this.m[2]*S,w=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*b,T=this.m[3]+this.m[1]*b;return this.m[0]=x,this.m[1]=w,this.m[2]=C,this.m[3]=T,this}multiply(b){var S=this.m[0]*b.m[0]+this.m[2]*b.m[1],x=this.m[1]*b.m[0]+this.m[3]*b.m[1],w=this.m[0]*b.m[2]+this.m[2]*b.m[3],C=this.m[1]*b.m[2]+this.m[3]*b.m[3],T=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],A=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=S,this.m[1]=x,this.m[2]=w,this.m[3]=C,this.m[4]=T,this.m[5]=A,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*b,x=-this.m[1]*b,w=-this.m[2]*b,C=this.m[0]*b,T=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),A=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=x,this.m[2]=w,this.m[3]=C,this.m[4]=T,this.m[5]=A,this}getMatrix(){return this.m}decompose(){var b=this.m[0],S=this.m[1],x=this.m[2],w=this.m[3],C=this.m[4],T=this.m[5],A=b*w-S*x;let I={x:C,y:T,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||S!=0){var D=Math.sqrt(b*b+S*S);I.rotation=S>0?Math.acos(b/D):-Math.acos(b/D),I.scaleX=D,I.scaleY=A/D,I.skewX=(b*x+S*w)/A,I.skewY=0}else if(x!=0||w!=0){var M=Math.sqrt(x*x+w*w);I.rotation=Math.PI/2-(w>0?Math.acos(-x/M):-Math.acos(x/M)),I.scaleX=A/M,I.scaleY=M,I.skewX=0,I.skewY=(b*x+S*w)/A}return I.rotation=e.Util._getRotation(I.rotation),I}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={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]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,v=[];const y=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var b=g[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){v.push(g),v.length===1&&y(function(){const b=v;v=[],b.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,b){var S=e.Util.createImageElement();S.onload=function(){b(S)},S.src=g},_rgbToHex(g,b,S){return((1<<24)+(g<<16)+(b<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var b=parseInt(g,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var b;return g in m?(b=m[g],{r:b[0],g:b[1],b:b[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(b=_.exec(g.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var b=m[g.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var b=g.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var b=g.split(/ *, */).map((S,x)=>S.slice(-1)==="%"?x===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[b,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),x=Number(S[0])/360,w=Number(S[1])/100,C=Number(S[2])/100;let T,A,I;if(w===0)return I=C*255,{r:Math.round(I),g:Math.round(I),b:Math.round(I),a:1};C<.5?T=C*(1+w):T=C+w-C*w;const D=2*C-T,M=[0,0,0];for(let E=0;E<3;E++)A=x+1/3*-(E-1),A<0&&A++,A>1&&A--,6*A<1?I=D+(T-D)*6*A:2*A<1?I=T:3*A<2?I=D+(T-D)*(2/3-A)*6:I=D,M[E]=I*255;return{r:Math.round(M[0]),g:Math.round(M[1]),b:Math.round(M[2]),a:1}}},haveIntersection(g,b){return!(b.x>g.x+g.width||b.x+b.widthg.y+g.height||b.y+b.height1?(T=S,A=x,I=(S-w)*(S-w)+(x-C)*(x-C)):(T=g+M*(S-g),A=b+M*(x-b),I=(T-w)*(T-w)+(A-C)*(A-C))}return[T,A,I]},_getProjectionToLine(g,b,S){var x=e.Util.cloneObject(g),w=Number.MAX_VALUE;return b.forEach(function(C,T){if(!(!S&&T===b.length-1)){var A=b[(T+1)%b.length],I=e.Util._getProjectionToSegment(C.x,C.y,A.x,A.y,g.x,g.y),D=I[0],M=I[1],E=I[2];Eb.length){var T=b;b=g,g=T}for(x=0;x{b.width=0,b.height=0})},drawRoundedRectPath(g,b,S,x){let w=0,C=0,T=0,A=0;typeof x=="number"?w=C=T=A=Math.min(x,b/2,S/2):(w=Math.min(x[0]||0,b/2,S/2),C=Math.min(x[1]||0,b/2,S/2),A=Math.min(x[2]||0,b/2,S/2),T=Math.min(x[3]||0,b/2,S/2)),g.moveTo(w,0),g.lineTo(b-C,0),g.arc(b-C,C,C,Math.PI*3/2,0,!1),g.lineTo(b,S-A),g.arc(b-A,S-A,A,0,Math.PI/2,!1),g.lineTo(T,S),g.arc(T,S-T,T,Math.PI/2,Math.PI,!1),g.lineTo(0,w),g.arc(w,w,w,Math.PI,Math.PI*3/2,!1)}}})(tn);var Wt={},je={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getComponentValidator=Ee.getBooleanValidator=Ee.getNumberArrayValidator=Ee.getFunctionValidator=Ee.getStringOrGradientValidator=Ee.getStringValidator=Ee.getNumberOrAutoValidator=Ee.getNumberOrArrayOfNumbersValidator=Ee.getNumberValidator=Ee.alphaComponent=Ee.RGBComponent=void 0;const Es=Ue,cn=tn;function As(e){return cn.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||cn.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function k6e(e){return e>255?255:e<0?0:Math.round(e)}Ee.RGBComponent=k6e;function I6e(e){return e>1?1:e<1e-4?1e-4:e}Ee.alphaComponent=I6e;function M6e(){if(Es.Konva.isUnminified)return function(e,t){return cn.Util._isNumber(e)||cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Ee.getNumberValidator=M6e;function R6e(e){if(Es.Konva.isUnminified)return function(t,n){let r=cn.Util._isNumber(t),i=cn.Util._isArray(t)&&t.length==e;return!r&&!i&&cn.Util.warn(As(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Ee.getNumberOrArrayOfNumbersValidator=R6e;function O6e(){if(Es.Konva.isUnminified)return function(e,t){var n=cn.Util._isNumber(e),r=e==="auto";return n||r||cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Ee.getNumberOrAutoValidator=O6e;function $6e(){if(Es.Konva.isUnminified)return function(e,t){return cn.Util._isString(e)||cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Ee.getStringValidator=$6e;function N6e(){if(Es.Konva.isUnminified)return function(e,t){const n=cn.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Ee.getStringOrGradientValidator=N6e;function D6e(){if(Es.Konva.isUnminified)return function(e,t){return cn.Util._isFunction(e)||cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Ee.getFunctionValidator=D6e;function L6e(){if(Es.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(cn.Util._isArray(e)?e.forEach(function(r){cn.Util._isNumber(r)||cn.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Ee.getNumberArrayValidator=L6e;function F6e(){if(Es.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||cn.Util.warn(As(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Ee.getBooleanValidator=F6e;function B6e(e){if(Es.Konva.isUnminified)return function(t,n){return t==null||cn.Util.isObject(t)||cn.Util.warn(As(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Ee.getComponentValidator=B6e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=tn,n=Ee;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var v={};for(p=0;p{this._setAttr(a+d(b),void 0)}),this._fireChangeEvent(a,y,v),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(je);var Io={},ss={};Object.defineProperty(ss,"__esModule",{value:!0});ss.HitContext=ss.SceneContext=ss.Context=void 0;const $U=tn,z6e=Ue;function j6e(e){var t=[],n=e.length,r=$U.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=V6e+u.join(IM)+U6e)):(o+=s.property,t||(o+=K6e+s.val)),o+=q6e;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=Q6e&&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){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const 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(...t){this._context.clip.apply(this._context,t)}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 c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.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){this._context.fill.apply(this._context,t)}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=MM.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=j6e(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(TS);Object.defineProperty(Wt,"__esModule",{value:!0});Wt.Node=void 0;const He=tn,jm=je,dy=Io,cu=Ue,Di=TS,yn=Ee;var dv="absoluteOpacity",fy="allEventListeners",za="absoluteTransform",RM="absoluteScale",du="canvas",iIe="Change",oIe="children",aIe="konva",S3="listening",OM="mouseenter",$M="mouseleave",NM="set",DM="Shape",fv=" ",LM="stage",Vs="transform",sIe="Stage",x3="visible",lIe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(fv);let uIe=1;class Oe{constructor(t){this._id=uIe++,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===Vs||t===za)&&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===Vs||t===za,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(fv);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(du)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===za&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(du)){const{scene:t,filter:n,hit:r}=this._cache.get(du);He.Util.releaseCanvas(t,n,r),this._cache.delete(du)}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,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){He.Util.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 f=new dy.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new dy.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new dy.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(du),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(dv),this._clearSelfAndDescendantCache(RM),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(du,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(du)}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 c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.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 c=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()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==oIe&&(r=NM+He.Util._capitalize(n),He.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(S3,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(x3,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;Di.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!cu.Konva.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!==sIe&&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(Vs),this._clearSelfAndDescendantCache(za)),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 He.Transform,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(Vs);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(Vs),this._clearSelfAndDescendantCache(za),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 He.Util.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 He.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&He.Util.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(dv,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=He.Util.isObject(i)&&!He.Util._isPlainObject(i)&&!He.Util._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(),He.Util._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,He.Util._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():cu.Konva.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;Di.DD._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=Di.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Di.DD._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 He.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return He.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=Oe.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),cu.Konva[r]||(He.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=cu.Konva[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=Dw.Node.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=Dw.Node.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 c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&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},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",V=J=>{const j=z(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&$.pointer;if(j==="touch")return $.touch;if(j==="mouse")return $.mouse};function H(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Q="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);";e.stages=[];class Z extends r.Container{constructor(j){super(H(j)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{H(this.attrs)}),this._checkVisibility()}_validateAdd(j){const X=j.getType()==="Layer",ee=j.getType()==="FastLayer";X||ee||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var X=j.slice(1);j=document.getElementsByClassName(X)[0]}else{var ee;j.charAt(0)!=="#"?ee=j:ee=j.slice(1),j=document.getElementById(ee)}if(!j)throw"Can not find container in document with id "+ee}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,X=j.length,ee;for(ee=0;ee-1&&e.stages.splice(X,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Q),null)}_getPointerById(j){return this._pointerPositions.find(X=>X.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var X=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ee=X.getContext()._context,ne=this.children;return(j.x||j.y)&&ee.translate(-1*j.x,-1*j.y),ne.forEach(function(fe){if(fe.isVisible()){var de=fe._toKonvaCanvas(j);ee.drawImage(de._canvas,j.x,j.y,de.getWidth()/de.getPixelRatio(),de.getHeight()/de.getPixelRatio())}}),X}getIntersection(j){if(!j)return null;var X=this.children,ee=X.length,ne=ee-1,fe;for(fe=ne;fe>=0;fe--){const de=X[fe].getIntersection(j);if(de)return de}return null}_resizeDOM(){var j=this.width(),X=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=X+d),this.bufferCanvas.setSize(j,X),this.bufferHitCanvas.setSize(j,X),this.children.forEach(ee=>{ee.setSize({width:j,height:X}),ee.draw()})}add(j,...X){if(arguments.length>1){for(var ee=0;eeO&&t.Util.warn("The stage has "+ne+" 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."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,X])=>{this.content.addEventListener(j,ee=>{this[X](ee)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const X=V(j.type);this._fire(X.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const X=V(j.type);this._fire(X.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let X=this[j+"targetShape"];return X&&!X.getStage()&&(X=null),X}_pointerleave(j){const X=V(j.type),ee=z(j.type);if(X){this.setPointersPositions(j);var ne=this._getTargetShape(ee),fe=!a.DD.isDragging||i.Konva.hitOnDragEnabled;ne&&fe?(ne._fireAndBubble(X.pointerout,{evt:j}),ne._fireAndBubble(X.pointerleave,{evt:j}),this._fire(X.pointerleave,{evt:j,target:this,currentTarget:this}),this[ee+"targetShape"]=null):fe&&(this._fire(X.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(X.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const X=V(j.type),ee=z(j.type);if(X){this.setPointersPositions(j);var ne=!1;this._changedPointerPositions.forEach(fe=>{var de=this.getIntersection(fe);if(a.DD.justDragged=!1,i.Konva["_"+ee+"ListenClick"]=!0,!(de&&de.isListening()))return;i.Konva.capturePointerEventsEnabled&&de.setPointerCapture(fe.id),this[ee+"ClickStartShape"]=de,de._fireAndBubble(X.pointerdown,{evt:j,pointerId:fe.id}),ne=!0;const $e=j.type.indexOf("touch")>=0;de.preventDefault()&&j.cancelable&&$e&&j.preventDefault()}),ne||this._fire(X.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const X=V(j.type),ee=z(j.type);if(!X)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var ne=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!ne)return;var fe={};let de=!1;var Be=this._getTargetShape(ee);this._changedPointerPositions.forEach($e=>{const Ce=l.getCapturedShape($e.id)||this.getIntersection($e),Ke=$e.id,be={evt:j,pointerId:Ke};var zt=Be!==Ce;if(zt&&Be&&(Be._fireAndBubble(X.pointerout,Object.assign({},be),Ce),Be._fireAndBubble(X.pointerleave,Object.assign({},be),Ce)),Ce){if(fe[Ce._id])return;fe[Ce._id]=!0}Ce&&Ce.isListening()?(de=!0,zt&&(Ce._fireAndBubble(X.pointerover,Object.assign({},be),Be),Ce._fireAndBubble(X.pointerenter,Object.assign({},be),Be),this[ee+"targetShape"]=Ce),Ce._fireAndBubble(X.pointermove,Object.assign({},be))):Be&&(this._fire(X.pointerover,{evt:j,target:this,currentTarget:this,pointerId:Ke}),this[ee+"targetShape"]=null)}),de||this._fire(X.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const X=V(j.type),ee=z(j.type);if(!X)return;this.setPointersPositions(j);const ne=this[ee+"ClickStartShape"],fe=this[ee+"ClickEndShape"];var de={};let Be=!1;this._changedPointerPositions.forEach($e=>{const Ce=l.getCapturedShape($e.id)||this.getIntersection($e);if(Ce){if(Ce.releaseCapture($e.id),de[Ce._id])return;de[Ce._id]=!0}const Ke=$e.id,be={evt:j,pointerId:Ke};let zt=!1;i.Konva["_"+ee+"InDblClickWindow"]?(zt=!0,clearTimeout(this[ee+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ee+"InDblClickWindow"]=!0,clearTimeout(this[ee+"DblTimeout"])),this[ee+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ee+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),Ce&&Ce.isListening()?(Be=!0,this[ee+"ClickEndShape"]=Ce,Ce._fireAndBubble(X.pointerup,Object.assign({},be)),i.Konva["_"+ee+"ListenClick"]&&ne&&ne===Ce&&(Ce._fireAndBubble(X.pointerclick,Object.assign({},be)),zt&&fe&&fe===Ce&&Ce._fireAndBubble(X.pointerdblclick,Object.assign({},be)))):(this[ee+"ClickEndShape"]=null,i.Konva["_"+ee+"ListenClick"]&&this._fire(X.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:Ke}),zt&&this._fire(X.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:Ke}))}),Be||this._fire(X.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ee+"ListenClick"]=!1,j.cancelable&&ee!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(D,{evt:j}):this._fire(D,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const X=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());X&&X._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var X=this._getContentPosition(),ee=null,ne=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,fe=>{this._pointerPositions.push({id:fe.identifier,x:(fe.clientX-X.left)/X.scaleX,y:(fe.clientY-X.top)/X.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,fe=>{this._changedPointerPositions.push({id:fe.identifier,x:(fe.clientX-X.left)/X.scaleX,y:(fe.clientY-X.top)/X.scaleY})})):(ee=(j.clientX-X.left)/X.scaleX,ne=(j.clientY-X.top)/X.scaleY,this.pointerPos={x:ee,y:ne},this._pointerPositions=[{x:ee,y:ne,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ee,y:ne,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var j=this.container();if(!j)throw"Stage has no container. A container is required.";j.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"),j.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.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(j){j.batchDraw()}),this}}e.Stage=Z,Z.prototype.nodeType=u,(0,s._registerNode)(Z),n.Factory.addGetterSetter(Z,"container")})(LU);var Vm={},Rn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Ue,n=tn,r=je,i=Wt,o=Ee,a=Ue,s=gi;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(T){const A=this.attrs.fillRule;A?T.fill(A):T.fill()}function _(T){T.stroke()}function v(T){T.fill()}function y(T){T.stroke()}function g(){this._clearCache(l)}function b(){this._clearCache(u)}function S(){this._clearCache(c)}function x(){this._clearCache(d)}function w(){this._clearCache(f)}class C extends i.Node{constructor(A){super(A);let I;for(;I=n.Util.getRandomColor(),!(I&&!(I in e.shapes)););this.colorKey=I,e.shapes[I]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.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(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var A=p();const I=A.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(I&&I.setTransform){const D=new n.Transform;D.translate(this.fillPatternX(),this.fillPatternY()),D.rotate(t.Konva.getAngle(this.fillPatternRotation())),D.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),D.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const M=D.getMatrix(),E=typeof DOMMatrix>"u"?{a:M[0],b:M[1],c:M[2],d:M[3],e:M[4],f:M[5]}:new DOMMatrix(M);I.setTransform(E)}return I}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var A=this.fillLinearGradientColorStops();if(A){for(var I=p(),D=this.fillLinearGradientStartPoint(),M=this.fillLinearGradientEndPoint(),E=I.createLinearGradient(D.x,D.y,M.x,M.y),P=0;Pthis.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 A=this.hitStrokeWidth();return A==="auto"?this.hasStroke():this.strokeEnabled()&&!!A}intersects(A){var I=this.getStage(),D=I.bufferHitCanvas,M;return D.getContext().clear(),this.drawHit(D,null,!0),M=D.context.getImageData(Math.round(A.x),Math.round(A.y),1,1).data,M[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(A){var I;if(!this.getStage()||!((I=this.attrs.perfectDrawEnabled)!==null&&I!==void 0?I:!0))return!1;const M=A||this.hasFill(),E=this.hasStroke(),P=this.getAbsoluteOpacity()!==1;if(M&&E&&P)return!0;const N=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(M&&E&&N&&L)}setStrokeHitEnabled(A){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),A?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var A=this.size();return{x:this._centroid?-A.width/2:0,y:this._centroid?-A.height/2:0,width:A.width,height:A.height}}getClientRect(A={}){const I=A.skipTransform,D=A.relativeTo,M=this.getSelfRect(),P=!A.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,N=M.width+P,L=M.height+P,O=!A.skipShadow&&this.hasShadow(),R=O?this.shadowOffsetX():0,$=O?this.shadowOffsetY():0,z=N+Math.abs(R),V=L+Math.abs($),H=O&&this.shadowBlur()||0,Q=z+H*2,Z=V+H*2,J={width:Q,height:Z,x:-(P/2+H)+Math.min(R,0)+M.x,y:-(P/2+H)+Math.min($,0)+M.y};return I?J:this._transformedRect(J,D)}drawScene(A,I){var D=this.getLayer(),M=A||D.getCanvas(),E=M.getContext(),P=this._getCanvasCache(),N=this.getSceneFunc(),L=this.hasShadow(),O,R,$,z=M.isCache,V=I===this;if(!this.isVisible()&&!V)return this;if(P){E.save();var H=this.getAbsoluteTransform(I).getMatrix();return E.transform(H[0],H[1],H[2],H[3],H[4],H[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!N)return this;if(E.save(),this._useBufferCanvas()&&!z){O=this.getStage(),R=O.bufferCanvas,$=R.getContext(),$.clear(),$.save(),$._applyLineJoin(this);var Q=this.getAbsoluteTransform(I).getMatrix();$.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),N.call(this,$,this),$.restore();var Z=R.pixelRatio;L&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(R._canvas,0,0,R.width/Z,R.height/Z)}else{if(E._applyLineJoin(this),!V){var Q=this.getAbsoluteTransform(I).getMatrix();E.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}L&&E._applyShadow(this),N.call(this,E,this)}return E.restore(),this}drawHit(A,I,D=!1){if(!this.shouldDrawHit(I,D))return this;var M=this.getLayer(),E=A||M.hitCanvas,P=E&&E.getContext(),N=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),O=L&&L.hit;if(this.colorKey||n.Util.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()"),O){P.save();var R=this.getAbsoluteTransform(I).getMatrix();return P.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(P),P.restore(),this}if(!N)return this;if(P.save(),P._applyLineJoin(this),!(this===I)){var z=this.getAbsoluteTransform(I).getMatrix();P.transform(z[0],z[1],z[2],z[3],z[4],z[5])}return N.call(this,P,this),P.restore(),this}drawHitFromCache(A=0){var I=this._getCanvasCache(),D=this._getCachedSceneCanvas(),M=I.hit,E=M.getContext(),P=M.getWidth(),N=M.getHeight(),L,O,R,$,z,V;E.clear(),E.drawImage(D._canvas,0,0,P,N);try{for(L=E.getImageData(0,0,P,N),O=L.data,R=O.length,$=n.Util._hexToRgb(this.colorKey),z=0;zA?(O[z]=$.r,O[z+1]=$.g,O[z+2]=$.b,O[z+3]=255):O[z+3]=0;E.putImageData(L,0,0)}catch(H){n.Util.error("Unable to draw hit graph from cached scene canvas. "+H.message)}return this}hasPointerCapture(A){return s.hasPointerCapture(A,this)}setPointerCapture(A){s.setPointerCapture(A,this)}releaseCapture(A){s.releaseCapture(A,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=v,C.prototype._strokeFuncHit=y,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",x),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",w),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Rn);Object.defineProperty(Vm,"__esModule",{value:!0});Vm.Layer=void 0;const La=tn,Lw=gc,zc=Wt,rT=je,FM=Io,pIe=Ee,gIe=Rn,mIe=Ue;var yIe="#",vIe="beforeDraw",bIe="draw",zU=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],_Ie=zU.length;class Ff extends Lw.Container{constructor(t){super(t),this.canvas=new FM.SceneCanvas,this.hitCanvas=new FM.HitCanvas({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<_Ie;i++){const o=zU[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=La.Util._rgbToHex(r[0],r[1],r[2]),a=gIe.shapes[yIe+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(vIe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Lw.Container.prototype.drawScene.call(this,i,n),this._fire(bIe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Lw.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){La.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return La.Util.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 La.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Vm.Layer=Ff;Ff.prototype.nodeType="Layer";(0,mIe._registerNode)(Ff);rT.Factory.addGetterSetter(Ff,"imageSmoothingEnabled",!0);rT.Factory.addGetterSetter(Ff,"clearBeforeDraw",!0);rT.Factory.addGetterSetter(Ff,"hitGraphEnabled",!0,(0,pIe.getBooleanValidator)());var kS={};Object.defineProperty(kS,"__esModule",{value:!0});kS.FastLayer=void 0;const SIe=tn,xIe=Vm,wIe=Ue;class iT extends xIe.Layer{constructor(t){super(t),this.listening(!1),SIe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}kS.FastLayer=iT;iT.prototype.nodeType="FastLayer";(0,wIe._registerNode)(iT);var Bf={};Object.defineProperty(Bf,"__esModule",{value:!0});Bf.Group=void 0;const CIe=tn,EIe=gc,AIe=Ue;class oT extends EIe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&CIe.Util.throw("You may only add groups and shapes to groups.")}}Bf.Group=oT;oT.prototype.nodeType="Group";(0,AIe._registerNode)(oT);var zf={};Object.defineProperty(zf,"__esModule",{value:!0});zf.Animation=void 0;const Fw=Ue,BM=tn;var Bw=function(){return Fw.glob.performance&&Fw.glob.performance.now?function(){return Fw.glob.performance.now()}:function(){return new Date().getTime()}}();class ia{constructor(t,n){this.id=ia.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Bw(),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():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,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 p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,v=_._id,y,g=p.easing||e.Easings.Linear,b=!!p.yoyo,S;typeof p.duration>"u"?y=.3:p.duration===0?y=.001:y=p.duration,this.node=_,this._id=u++;var x=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);x||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},x),this.tween=new d(S,function(w){m._tweenFunc(w)},g,0,1,y*1e3,b),this._addListeners(),f.attrs[v]||(f.attrs[v]={}),f.attrs[v][this._id]||(f.attrs[v][this._id]={}),f.tweens[v]||(f.tweens[v]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,v=_._id,y,g,b,S,x,w,C,T;if(b=f.tweens[v][p],b&&delete f.attrs[v][b][p],y=_.getAttr(p),t.Util._isArray(m))if(g=[],x=Math.max(m.length,y.length),p==="points"&&m.length!==y.length&&(m.length>y.length?(C=y,y=t.Util._prepareArrayForTween(y,m,_.closed())):(w=m,m=t.Util._prepareArrayForTween(m,y,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.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(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],v;this.pause();for(v in _)delete f.tweens[p][v];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var v=1.70158;return m*(h/=_)*h*((v+1)*h-v)+p},BackEaseOut(h,p,m,_){var v=1.70158;return m*((h=h/_-1)*h*((v+1)*h+v)+1)+p},BackEaseInOut(h,p,m,_){var v=1.70158;return(h/=_/2)<1?m/2*(h*h*(((v*=1.525)+1)*h-v))+p:m/2*((h-=2)*h*(((v*=1.525)+1)*h+v)+2)+p},ElasticEaseIn(h,p,m,_,v,y){var g=0;return h===0?p:(h/=_)===1?p+m:(y||(y=_*.3),!v||v0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}IS.Arc=Ts;Ts.prototype._centroid=!0;Ts.prototype.className="Arc";Ts.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,PIe._registerNode)(Ts);MS.Factory.addGetterSetter(Ts,"innerRadius",0,(0,RS.getNumberValidator)());MS.Factory.addGetterSetter(Ts,"outerRadius",0,(0,RS.getNumberValidator)());MS.Factory.addGetterSetter(Ts,"angle",0,(0,RS.getNumberValidator)());MS.Factory.addGetterSetter(Ts,"clockwise",!1,(0,RS.getBooleanValidator)());var OS={},Um={};Object.defineProperty(Um,"__esModule",{value:!0});Um.Line=void 0;const $S=je,kIe=Rn,VU=Ee,IIe=Ue;function w3(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),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function jM(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]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),v=m/h,y=l+_,g=v-_*_,b=y*y+g>0?Math.sqrt(y*y+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,x=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((y+b)/(_+S))):0;return Math.sqrt(h)/2*(y*b-_*S+x)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(UU);Object.defineProperty(jf,"__esModule",{value:!0});jf.Path=void 0;const MIe=je,RIe=Rn,OIe=Ue,jc=UU;class An extends RIe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=An.parsePathData(this.data()),this.pathLength=An.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,v=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,v),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/v),t.rotate(-h),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 c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=An.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return An.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return An.getPointOnCubicBezier((0,jc.t2length)(t,An.getPathLength(n),m=>(0,jc.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return An.getPointOnQuadraticBezier((0,jc.t2length)(t,An.getPathLength(n),m=>(0,jc.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,An.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}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(p[0]);){var y=null,g=[],b=l,S=u,x,w,C,T,A,I,D,M,E,P;switch(h){case"l":l+=p.shift(),u+=p.shift(),y="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var N=p.shift(),L=p.shift();if(l+=N,u+=L,y="M",a.length>2&&a[a.length-1].command==="z"){for(var O=a.length-2;O>=0;O--)if(a[O].command==="M"){l=a[O].points[0]+N,u=a[O].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),y="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),y="L",g.push(l,u);break;case"H":l=p.shift(),y="L",g.push(l,u);break;case"v":u+=p.shift(),y="L",g.push(l,u);break;case"V":u=p.shift(),y="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",g.push(l,u);break;case"S":w=l,C=u,x=a[a.length-1],x.command==="C"&&(w=l+(l-x.points[2]),C=u+(u-x.points[3])),g.push(w,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),y="C",g.push(l,u);break;case"s":w=l,C=u,x=a[a.length-1],x.command==="C"&&(w=l+(l-x.points[2]),C=u+(u-x.points[3])),g.push(w,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="Q",g.push(l,u);break;case"T":w=l,C=u,x=a[a.length-1],x.command==="Q"&&(w=l+(l-x.points[0]),C=u+(u-x.points[1])),l=p.shift(),u=p.shift(),y="Q",g.push(w,C,l,u);break;case"t":w=l,C=u,x=a[a.length-1],x.command==="Q"&&(w=l+(l-x.points[0]),C=u+(u-x.points[1])),l+=p.shift(),u+=p.shift(),y="Q",g.push(w,C,l,u);break;case"A":T=p.shift(),A=p.shift(),I=p.shift(),D=p.shift(),M=p.shift(),E=l,P=u,l=p.shift(),u=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(E,P,l,u,D,M,T,A,I);break;case"a":T=p.shift(),A=p.shift(),I=p.shift(),D=p.shift(),M=p.shift(),E=l,P=u,l+=p.shift(),u+=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(E,P,l,u,D,M,T,A,I);break}a.push({command:y||h,points:g,start:{x:b,y:S},pathLength:this.calcLength(b,S,y||h,g)})}(h==="z"||h==="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=An;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,jc.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,jc.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)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=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,v=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,y=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(A){return Math.sqrt(A[0]*A[0]+A[1]*A[1])},b=function(A,I){return(A[0]*I[0]+A[1]*I[1])/(g(A)*g(I))},S=function(A,I){return(A[0]*I[1]=1&&(T=0),a===0&&T>0&&(T=T-2*Math.PI),a===1&&T<0&&(T=T+2*Math.PI),[v,y,s,l,x,T,c,a]}}jf.Path=An;An.prototype.className="Path";An.prototype._attrsAffectingSize=["data"];(0,OIe._registerNode)(An);MIe.Factory.addGetterSetter(An,"data");Object.defineProperty(OS,"__esModule",{value:!0});OS.Arrow=void 0;const NS=je,$Ie=Um,GU=Ee,NIe=Ue,VM=jf;class yc extends $Ie.Line{_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 f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=VM.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=VM.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/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,d/2),t.lineTo(-a,-d/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}}}OS.Arrow=yc;yc.prototype.className="Arrow";(0,NIe._registerNode)(yc);NS.Factory.addGetterSetter(yc,"pointerLength",10,(0,GU.getNumberValidator)());NS.Factory.addGetterSetter(yc,"pointerWidth",10,(0,GU.getNumberValidator)());NS.Factory.addGetterSetter(yc,"pointerAtBeginning",!1);NS.Factory.addGetterSetter(yc,"pointerAtEnding",!0);var DS={};Object.defineProperty(DS,"__esModule",{value:!0});DS.Circle=void 0;const DIe=je,LIe=Rn,FIe=Ee,BIe=Ue;class Vf extends LIe.Shape{_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)}}DS.Circle=Vf;Vf.prototype._centroid=!0;Vf.prototype.className="Circle";Vf.prototype._attrsAffectingSize=["radius"];(0,BIe._registerNode)(Vf);DIe.Factory.addGetterSetter(Vf,"radius",0,(0,FIe.getNumberValidator)());var LS={};Object.defineProperty(LS,"__esModule",{value:!0});LS.Ellipse=void 0;const aT=je,zIe=Rn,HU=Ee,jIe=Ue;class Yl extends zIe.Shape{_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)}}LS.Ellipse=Yl;Yl.prototype.className="Ellipse";Yl.prototype._centroid=!0;Yl.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,jIe._registerNode)(Yl);aT.Factory.addComponentsGetterSetter(Yl,"radius",["x","y"]);aT.Factory.addGetterSetter(Yl,"radiusX",0,(0,HU.getNumberValidator)());aT.Factory.addGetterSetter(Yl,"radiusY",0,(0,HU.getNumberValidator)());var FS={};Object.defineProperty(FS,"__esModule",{value:!0});FS.Image=void 0;const zw=tn,vc=je,VIe=Rn,UIe=Ue,Gm=Ee;let ka=class qU extends VIe.Shape{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?zw.Util.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?zw.Util.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=zw.Util.createImageElement();i.onload=function(){var o=new qU({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};FS.Image=ka;ka.prototype.className="Image";(0,UIe._registerNode)(ka);vc.Factory.addGetterSetter(ka,"cornerRadius",0,(0,Gm.getNumberOrArrayOfNumbersValidator)(4));vc.Factory.addGetterSetter(ka,"image");vc.Factory.addComponentsGetterSetter(ka,"crop",["x","y","width","height"]);vc.Factory.addGetterSetter(ka,"cropX",0,(0,Gm.getNumberValidator)());vc.Factory.addGetterSetter(ka,"cropY",0,(0,Gm.getNumberValidator)());vc.Factory.addGetterSetter(ka,"cropWidth",0,(0,Gm.getNumberValidator)());vc.Factory.addGetterSetter(ka,"cropHeight",0,(0,Gm.getNumberValidator)());var Ef={};Object.defineProperty(Ef,"__esModule",{value:!0});Ef.Tag=Ef.Label=void 0;const BS=je,GIe=Rn,HIe=Bf,sT=Ee,WU=Ue;var KU=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],qIe="Change.konva",WIe="none",C3="up",E3="right",A3="down",T3="left",KIe=KU.length;class lT extends HIe.Group{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)}}jS.RegularPolygon=_c;_c.prototype.className="RegularPolygon";_c.prototype._centroid=!0;_c.prototype._attrsAffectingSize=["radius"];(0,t8e._registerNode)(_c);XU.Factory.addGetterSetter(_c,"radius",0,(0,QU.getNumberValidator)());XU.Factory.addGetterSetter(_c,"sides",0,(0,QU.getNumberValidator)());var VS={};Object.defineProperty(VS,"__esModule",{value:!0});VS.Ring=void 0;const YU=je,n8e=Rn,ZU=Ee,r8e=Ue;var UM=Math.PI*2;class Sc extends n8e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,UM,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),UM,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)}}VS.Ring=Sc;Sc.prototype.className="Ring";Sc.prototype._centroid=!0;Sc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,r8e._registerNode)(Sc);YU.Factory.addGetterSetter(Sc,"innerRadius",0,(0,ZU.getNumberValidator)());YU.Factory.addGetterSetter(Sc,"outerRadius",0,(0,ZU.getNumberValidator)());var US={};Object.defineProperty(US,"__esModule",{value:!0});US.Sprite=void 0;const xc=je,i8e=Rn,o8e=zf,JU=Ee,a8e=Ue;class Ia extends i8e.Shape{constructor(t){super(t),this._updated=!0,this.anim=new o8e.Animation(()=>{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],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_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],c=r*2;t.rect(u[c+0],u[c+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 py;function Vw(){return py||(py=P3.Util.createCanvasElement().getContext(h8e),py)}function C8e(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function E8e(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function A8e(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class vn extends u8e.Shape{constructor(t){super(A8e(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(v+=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=P3.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(p8e,n),this}getWidth(){var t=this.attrs.width===Vc||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Vc||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 P3.Util.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=Vw(),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()+hy+this.fontVariant()+hy+(this.fontSize()+v8e)+w8e(this.fontFamily())}_addTextLine(t){this.align()===xh&&(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 Vw().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!==Vc&&o!==void 0,l=a!==Vc&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==qM,m=h!==S8e&&p,_=this.ellipsis();this.textArr=[],Vw().font=this._getContextFont();for(var v=_?this._getTextWidth(jw):0,y=0,g=t.length;yc)for(;b.length>0;){for(var x=0,w=b.length,C="",T=0;x>>1,I=b.slice(0,A+1),D=this._getTextWidth(I)+v;D<=c?(x=A+1,C=I,T=D):w=A}if(C){if(m){var M,E=b[C.length],P=E===hy||E===GM;P&&T<=c?M=C.length:M=Math.max(C.lastIndexOf(hy),C.lastIndexOf(GM))+1,M>0&&(x=M,C=C.slice(0,x),T=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,T),f+=i;var N=this._shouldHandleEllipsis(f);if(N){this._tryToAddEllipsisToLastLine();break}if(b=b.slice(x),b=b.trimLeft(),b.length>0&&(S=this._getTextWidth(b),S<=c)){this._addTextLine(b),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(b),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&yd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Vc&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==qM;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Vc&&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+jw)n?null:wh.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=wh.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${lG}`).join(" "),XM="nodesRect",$8e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],N8e={"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 D8e="ontouchstart"in po.Konva._global;function L8e(e,t){if(e==="rotater")return"crosshair";t+=vt.Util.degToRad(N8e[e]||0);var n=(vt.Util.radToDeg(t)%360+360)%360;return vt.Util._inRange(n,315+22.5,360)||vt.Util._inRange(n,0,22.5)?"ns-resize":vt.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":vt.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":vt.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":vt.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":vt.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":vt.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":vt.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(vt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sb=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],QM=1e8;function F8e(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 uG(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 B8e(e,t){const n=F8e(e);return uG(e,t,n)}function z8e(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(vt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on($8e.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&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(XM),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(XM,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=(po.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={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 uG(c,-po.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-QM,y:-QM,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new vt.Transform;r.rotate(-po.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.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:po.Konva.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(),sb.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new M8e.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:D8e?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=po.Konva.getAngle(this.rotation()),o=L8e(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 I8e.Shape({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()*vt.Util._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 c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let M=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(M-=Math.PI);var f=po.Konva.getAngle(this.rotation());const E=f+M,P=po.Konva.getAngle(this.rotationSnapTolerance()),L=z8e(this.rotationSnaps(),E,P)-d.rotation,O=B8e(d,L);this._fitNodesInto(O,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{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(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,v=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*v,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{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()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*v,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var y=o.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.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(p){var m=g?{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(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(vt.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(vt.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new vt.Transform;if(a.rotate(po.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:vt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new vt.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new vt.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new vt.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(vt.Util._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(vt.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.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()*vt.Util._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});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(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=""),KM.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return WM.Node.prototype.toObject.call(this)}clone(t){var n=WM.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}qS.Transformer=lt;function j8e(e){return e instanceof Array||vt.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){sb.indexOf(t)===-1&&vt.Util.warn("Unknown anchor name: "+t+". Available names are: "+sb.join(", "))}),e||[]}lt.prototype.className="Transformer";(0,R8e._registerNode)(lt);yt.Factory.addGetterSetter(lt,"enabledAnchors",sb,j8e);yt.Factory.addGetterSetter(lt,"flipEnabled",!0,(0,eu.getBooleanValidator)());yt.Factory.addGetterSetter(lt,"resizeEnabled",!0);yt.Factory.addGetterSetter(lt,"anchorSize",10,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"rotateEnabled",!0);yt.Factory.addGetterSetter(lt,"rotationSnaps",[]);yt.Factory.addGetterSetter(lt,"rotateAnchorOffset",50,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"rotationSnapTolerance",5,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderEnabled",!0);yt.Factory.addGetterSetter(lt,"anchorStroke","rgb(0, 161, 255)");yt.Factory.addGetterSetter(lt,"anchorStrokeWidth",1,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"anchorFill","white");yt.Factory.addGetterSetter(lt,"anchorCornerRadius",0,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderStroke","rgb(0, 161, 255)");yt.Factory.addGetterSetter(lt,"borderStrokeWidth",1,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderDash");yt.Factory.addGetterSetter(lt,"keepRatio",!0);yt.Factory.addGetterSetter(lt,"shiftBehavior","default");yt.Factory.addGetterSetter(lt,"centeredScaling",!1);yt.Factory.addGetterSetter(lt,"ignoreStroke",!1);yt.Factory.addGetterSetter(lt,"padding",0,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"node");yt.Factory.addGetterSetter(lt,"nodes");yt.Factory.addGetterSetter(lt,"boundBoxFunc");yt.Factory.addGetterSetter(lt,"anchorDragBoundFunc");yt.Factory.addGetterSetter(lt,"anchorStyleFunc");yt.Factory.addGetterSetter(lt,"shouldOverdrawWholeArea",!1);yt.Factory.addGetterSetter(lt,"useSingleNodeRotation",!0);yt.Factory.backCompat(lt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var WS={};Object.defineProperty(WS,"__esModule",{value:!0});WS.Wedge=void 0;const KS=je,V8e=Rn,U8e=Ue,cG=Ee,G8e=Ue;class Ps extends V8e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,U8e.Konva.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)}}WS.Wedge=Ps;Ps.prototype.className="Wedge";Ps.prototype._centroid=!0;Ps.prototype._attrsAffectingSize=["radius"];(0,G8e._registerNode)(Ps);KS.Factory.addGetterSetter(Ps,"radius",0,(0,cG.getNumberValidator)());KS.Factory.addGetterSetter(Ps,"angle",0,(0,cG.getNumberValidator)());KS.Factory.addGetterSetter(Ps,"clockwise",!1);KS.Factory.backCompat(Ps,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var XS={};Object.defineProperty(XS,"__esModule",{value:!0});XS.Blur=void 0;const YM=je,H8e=Wt,q8e=Ee;function ZM(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var W8e=[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],K8e=[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 X8e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,v,y,g,b,S,x,w,C,T,A,I,D,M=t+t+1,E=r-1,P=i-1,N=t+1,L=N*(N+1)/2,O=new ZM,R=null,$=O,z=null,V=null,H=W8e[t],Q=K8e[t];for(s=1;s>Q,I!==0?(I=255/I,n[c]=(f*H>>Q)*I,n[c+1]=(h*H>>Q)*I,n[c+2]=(p*H>>Q)*I):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=v,p-=y,m-=g,_-=z.r,v-=z.g,y-=z.b,g-=z.a,l=d+((l=o+t+1)>Q,I>0?(I=255/I,n[l]=(f*H>>Q)*I,n[l+1]=(h*H>>Q)*I,n[l+2]=(p*H>>Q)*I):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=v,p-=y,m-=g,_-=z.r,v-=z.g,y-=z.b,g-=z.a,l=o+((l=a+N)0&&X8e(t,n)};XS.Blur=Q8e;YM.Factory.addGetterSetter(H8e.Node,"blurRadius",0,(0,q8e.getNumberValidator)(),YM.Factory.afterSetFilter);var QS={};Object.defineProperty(QS,"__esModule",{value:!0});QS.Brighten=void 0;const JM=je,Y8e=Wt,Z8e=Ee,J8e=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};YS.Contrast=n9e;eR.Factory.addGetterSetter(e9e.Node,"contrast",0,(0,t9e.getNumberValidator)(),eR.Factory.afterSetFilter);var ZS={};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.Emboss=void 0;const Nl=je,JS=Wt,r9e=tn,dG=Ee,i9e=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,c=l*4,d=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:r9e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,v=a;m+v<1&&(v=0),m+v>l&&(v=0);var y=p+(m-1+v)*4,g=s[_]-s[y],b=s[_+1]-s[y+1],S=s[_+2]-s[y+2],x=g,w=x>0?x:-x,C=b>0?b:-b,T=S>0?S:-S;if(C>w&&(x=b),T>w&&(x=S),x*=t,i){var A=s[_]+x,I=s[_+1]+x,D=s[_+2]+x;s[_]=A>255?255:A<0?0:A,s[_+1]=I>255?255:I<0?0:I,s[_+2]=D>255?255:D<0?0:D}else{var M=n-x;M<0?M=0:M>255&&(M=255),s[_]=s[_+1]=s[_+2]=M}}while(--m)}while(--d)};ZS.Emboss=i9e;Nl.Factory.addGetterSetter(JS.Node,"embossStrength",.5,(0,dG.getNumberValidator)(),Nl.Factory.afterSetFilter);Nl.Factory.addGetterSetter(JS.Node,"embossWhiteLevel",.5,(0,dG.getNumberValidator)(),Nl.Factory.afterSetFilter);Nl.Factory.addGetterSetter(JS.Node,"embossDirection","top-left",null,Nl.Factory.afterSetFilter);Nl.Factory.addGetterSetter(JS.Node,"embossBlend",!1,null,Nl.Factory.afterSetFilter);var e2={};Object.defineProperty(e2,"__esModule",{value:!0});e2.Enhance=void 0;const tR=je,o9e=Wt,a9e=Ee;function Hw(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 s9e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,v,y,g,b,S,x;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),y=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),x=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),v=(s+a)*.5,y=s+h*(s-v),g=a+h*(a-v),b=(c+u)*.5,S=c+h*(c-b),x=u+h*(u-b)),f=0;fv?_:v;var y=a,g=o,b,S,x=360/g*Math.PI/180,w,C;for(S=0;Sg?y:g;var b=a,S=o,x,w,C=n.polarRotation||0,T,A;for(c=0;ct&&(b=g,S=0,x=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function x9e(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&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=b[a+0],l+=b[a+1],u+=b[a+2],c+=b[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,b[a+0]=s,b[a+1]=l,b[a+2]=u,b[a+3]=c)}};l2.Pixelate=I9e;oR.Factory.addGetterSetter(P9e.Node,"pixelSize",8,(0,k9e.getNumberValidator)(),oR.Factory.afterSetFilter);var u2={};Object.defineProperty(u2,"__esModule",{value:!0});u2.Posterize=void 0;const aR=je,M9e=Wt,R9e=Ee,O9e=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)});ub.Factory.addGetterSetter(gT.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});ub.Factory.addGetterSetter(gT.Node,"blue",0,$9e.RGBComponent,ub.Factory.afterSetFilter);var d2={};Object.defineProperty(d2,"__esModule",{value:!0});d2.RGBA=void 0;const Vg=je,f2=Wt,D9e=Ee,L9e=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)});Vg.Factory.addGetterSetter(f2.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});Vg.Factory.addGetterSetter(f2.Node,"blue",0,D9e.RGBComponent,Vg.Factory.afterSetFilter);Vg.Factory.addGetterSetter(f2.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var h2={};Object.defineProperty(h2,"__esModule",{value:!0});h2.Sepia=void 0;const F9e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};p2.Solarize=B9e;var g2={};Object.defineProperty(g2,"__esModule",{value:!0});g2.Threshold=void 0;const sR=je,z9e=Wt,j9e=Ee,V9e=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new Eh.Stage({container:o,width:r,height:i}),s=new Eh.Layer,l=new Eh.Layer;return s.add(new Eh.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new Eh.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},PMe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),cR=async(e,t)=>{const n=e.toDataURL(t);return await PMe(n,t.width,t.height)},mT=async(e,t,n,r,i)=>{const o=ae("canvas"),a=xS(),s=x6e();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await ob(u,d),h=await cR(u,d),p=await TMe(r?e.objects.filter(dL):[],l,i),m=await ob(p,l),_=await cR(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},kMe=()=>{pe({actionCreator:g6e,effect:async(e,{dispatch:t,getState:n})=>{const r=ae("canvas"),i=n(),o=await mT(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(nt({title:K("toast.problemSavingMask"),description:K("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(ue.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.maskSavedAssets")}}}))}})},IMe=()=>{pe({actionCreator:_6e,effect:async(e,{dispatch:t,getState:n})=>{const r=ae("canvas"),i=n(),{id:o}=e.payload,a=await mT(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!a)return;const{maskBlob:s}=a;if(!s){r.error("Problem getting mask layer blob"),t(nt({title:K("toast.problemImportingMask"),description:K("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:l}=i.gallery,u=await t(ue.endpoints.uploadImage.initiate({file:new File([s],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:l==="none"?void 0:l,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:c}=u;t(Hl({id:o,controlImage:c}))}})},MMe=async()=>{const e=xS();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),ob(t,t.getClientRect())},RMe=()=>{pe({actionCreator:v6e,effect:async(e,{dispatch:t})=>{const n=Q_.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await MMe();if(!r){n.error("Problem getting base layer blob"),t(nt({title:K("toast.problemMergingCanvas"),description:K("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=xS();if(!i){n.error("Problem getting canvas base layer"),t(nt({title:K("toast.problemMergingCanvas"),description:K("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()??void 0}),a=await t(ue.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(ble({kind:"image",layer:"base",imageName:s,...o}))}})},OMe=()=>{pe({actionCreator:p6e,effect:async(e,{dispatch:t,getState:n})=>{const r=ae("canvas"),i=n();let o;try{o=await wS(i)}catch(s){r.error(String(s)),t(nt({title:K("toast.problemSavingCanvas"),description:K("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(ue.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.canvasSavedGallery")}}}))}})},$Me=(e,t,n)=>{if(!(Eie.match(e)||p6.match(e)||Hl.match(e)||Aie.match(e)||g6.match(e)))return!1;const{id:i}=e.payload,o=ui(n.controlAdapters,i),a=ui(t.controlAdapters,i);if(!o||!hi(o)||!a||!hi(a)||g6.match(e)&&o.shouldAutoConfig===!0)return!1;const{controlImage:s,processorType:l,shouldAutoConfig:u}=a;return p6.match(e)&&!u?!1:l!=="none"&&!!s},NMe=()=>{pe({predicate:$Me,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=ae("session"),{id:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(wE({id:o}))}})},pG=e=>(e==null?void 0:e.type)==="image_output",DMe=()=>{pe({actionCreator:wE,effect:async(e,{dispatch:t,getState:n,take:r})=>{var u;const i=ae("session"),{id:o}=e.payload,a=ui(n().controlAdapters,o);if(!(a!=null&&a.controlImage)||!hi(a)){i.error("Unable to process ControlNet image");return}if(a.processorType==="none"||a.processorNode.type==="none")return;const s=a.processorNode.id,l={prepend:!0,batch:{graph:{nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,use_cache:!1,image:{image_name:a.controlImage}}}},runs:1}};try{const c=t(ln.endpoints.enqueueBatch.initiate(l,{fixedCacheKey:"enqueueBatch"})),d=await c.unwrap();c.reset(),i.debug({enqueueResult:ft(d)},K("queue.graphQueued"));const[f]=await r(h=>bE.match(h)&&h.payload.data.queue_batch_id===d.batch.batch_id&&h.payload.data.source_node_id===s);if(pG(f.payload.data.result)){const{image_name:h}=f.payload.data.result.image,[{payload:p}]=await r(_=>ue.endpoints.getImageDTO.matchFulfilled(_)&&_.payload.image_name===h),m=p;i.debug({controlNetId:e.payload,processedControlImage:m},"ControlNet image processed"),t(EE({id:o,processedControlImage:m.image_name}))}}catch(c){if(i.error({enqueueBatchArg:ft(l)},K("queue.graphFailedToQueue")),c instanceof Object&&"data"in c&&"status"in c&&c.status===403){const d=((u=c.data)==null?void 0:u.detail)||"Unknown Error";t(nt({title:K("queue.graphFailedToQueue"),status:"error",description:d,duration:15e3})),t(Pie()),t(Hl({id:o,controlImage:null}));return}t(nt({title:K("queue.graphFailedToQueue"),status:"error"}))}}})},yT=ge("app/enqueueRequested");ge("app/batchEnqueued");const LMe=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("

")})},dR=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),FMe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=FMe(e.data),i=BMe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},Se="positive_conditioning",we="negative_conditioning",le="denoise_latents",Kc="denoise_latents_hrf",xe="latents_to_image",tl="latents_to_image_hrf_hr",_u="latents_to_image_hrf_lr",Ah="image_to_latents_hrf",Us="resize_hrf",Qh="esrgan_hrf",Wu="linear_ui_output",xl="nsfw_checker",Nu="invisible_watermark",ve="noise",Th="noise_hrf",Mo="main_model_loader",m2="onnx_model_loader",ci="vae_loader",gG="lora_loader",st="clip_skip",Ft="image_to_latents",oa="resize_image",Ku="img2img_resize",se="canvas_output",kt="inpaint_image",jMe="scaled_inpaint_image",Vn="inpaint_image_resize_up",ir="inpaint_image_resize_down",rt="inpaint_infill",ts="inpaint_infill_resize_down",VMe="inpaint_final_image",Tt="inpaint_create_mask",UMe="inpaint_mask",Re="canvas_coherence_denoise_latents",tt="canvas_coherence_noise",Dl="canvas_coherence_noise_increment",sn="canvas_coherence_mask_edge",Je="canvas_coherence_inpaint_create_mask",Hd="tomask",gr="mask_blur",nr="mask_combine",Pt="mask_resize_up",vr="mask_resize_down",GMe="img_paste",Ph="control_net_collect",my="ip_adapter_collect",kh="t2i_adapter_collect",mi="core_metadata",Yh="esrgan",HMe="scale_image",mr="sdxl_model_loader",oe="sdxl_denoise_latents",fu="sdxl_refiner_model_loader",yy="sdxl_refiner_positive_conditioning",vy="sdxl_refiner_negative_conditioning",qo="sdxl_refiner_denoise_latents",Fi="refiner_inpaint_create_mask",kn="seamless",wo="refiner_seamless",qMe=[se,xe,tl,xl,Nu,Yh,Qh,Us,_u,Ku,kt,jMe,Vn,ir,rt,ts,VMe,Tt,UMe,GMe,HMe],mG="text_to_image_graph",k3="image_to_image_graph",yG="canvas_text_to_image_graph",I3="canvas_image_to_image_graph",y2="canvas_inpaint_graph",v2="canvas_outpaint_graph",vT="sdxl_text_to_image_graph",cb="sxdl_image_to_image_graph",b2="sdxl_canvas_text_to_image_graph",Ug="sdxl_canvas_image_to_image_graph",Ll="sdxl_canvas_inpaint_graph",Fl="sdxl_canvas_outpaint_graph",ks=(e,t,n)=>{e.nodes[mi]={id:mi,type:"core_metadata",...t},e.edges.push({source:{node_id:mi,field:"metadata"},destination:{node_id:n,field:"metadata"}})},Do=(e,t)=>{const n=e.nodes[mi];n&&Object.assign(n,t)},Ih=(e,t)=>{const n=e.nodes[mi];n&&delete n[t]},Mh=e=>!!e.nodes[mi],WMe=(e,t)=>{e.edges=e.edges.filter(n=>n.source.node_id!==mi),e.edges.push({source:{node_id:mi,field:"metadata"},destination:{node_id:t,field:"metadata"}})},eo=(e,t,n)=>{const r=yie(e.controlAdapters).filter(o=>{var a,s;return((a=o.model)==null?void 0:a.base_model)===((s=e.generation.model)==null?void 0:s.base_model)}),i=[];if(r.length){const o={id:Ph,type:"collect",is_intermediate:!0};t.nodes[Ph]=o,t.edges.push({source:{node_id:Ph,field:"collection"},destination:{node_id:n,field:"control"}}),Re in t.nodes&&t.edges.push({source:{node_id:Ph,field:"collection"},destination:{node_id:Re,field:"control"}}),r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,controlMode:f,resizeMode:h,model:p,processorType:m,weight:_}=a,v={id:`control_net_${s}`,type:"controlnet",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,control_mode:f,resize_mode:h,control_model:p,control_weight:_};if(u&&m!=="none")v.image={image_name:u};else if(l)v.image={image_name:l};else return;t.nodes[v.id]=v,i.push($f(v,["id","type","is_intermediate"])),t.edges.push({source:{node_id:v.id,field:"control"},destination:{node_id:Ph,field:"item"}})}),Do(t,{controlnets:i})}},to=(e,t,n)=>{const r=bie(e.controlAdapters).filter(i=>{var o,a;return((o=i.model)==null?void 0:o.base_model)===((a=e.generation.model)==null?void 0:a.base_model)});if(r.length){const i={id:my,type:"collect",is_intermediate:!0};t.nodes[my]=i,t.edges.push({source:{node_id:my,field:"collection"},destination:{node_id:n,field:"ip_adapter"}}),Re in t.nodes&&t.edges.push({source:{node_id:my,field:"collection"},destination:{node_id:Re,field:"ip_adapter"}});const o=[];r.forEach(a=>{if(!a.model)return;const{id:s,weight:l,model:u,beginStepPct:c,endStepPct:d}=a,f={id:`ip_adapter_${s}`,type:"ip_adapter",is_intermediate:!0,weight:l,ip_adapter_model:u,begin_step_percent:c,end_step_percent:d};if(a.controlImage)f.image={image_name:a.controlImage};else return;t.nodes[f.id]=f,o.push($f(f,["id","type","is_intermediate"])),t.edges.push({source:{node_id:f.id,field:"ip_adapter"},destination:{node_id:i.id,field:"item"}})}),Do(t,{ipAdapters:o})}},Uf=(e,t,n,r=Mo)=>{const{loras:i}=e.lora,o=n_(i);if(o===0)return;t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===st&&["clip"].includes(u.source.field)));let a="",s=0;const l=[];ps(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${gG}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};l.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,s===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:st,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:h,field:"clip"}})),s===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[y2,v2].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:Re,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Se,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:we,field:"clip"}})),a=h,s+=1}),Do(t,{loras:l})},no=(e,t,n=xe)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:xl,type:"img_nsfw",is_intermediate:!0};t.nodes[xl]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:xl,field:"image"}})},KMe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],bT=Gn(e=>e,({ui:e})=>hE(e.activeTab)?e.activeTab:"txt2img"),AUe=Gn(e=>e,({ui:e,config:t})=>{const r=KMe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),TUe=Gn(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:pE}}),ro=(e,t)=>{const r=bT(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Wu,type:"linear_ui_output",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Wu]=o;const a={node_id:Wu,field:"image"};Nu in t.nodes?t.edges.push({source:{node_id:Nu,field:"image"},destination:a}):xl in t.nodes?t.edges.push({source:{node_id:xl,field:"image"},destination:a}):se in t.nodes?t.edges.push({source:{node_id:se,field:"image"},destination:a}):tl in t.nodes?t.edges.push({source:{node_id:tl,field:"image"},destination:a}):xe in t.nodes&&t.edges.push({source:{node_id:xe,field:"image"},destination:a})},io=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[kn]={id:kn,type:"seamless",seamless_x:r,seamless_y:i},r&&Do(t,{seamless_x:r}),i&&Do(t,{seamless_y:i});let o=le;(t.id===vT||t.id===cb||t.id===b2||t.id===Ug||t.id===Ll||t.id===Fl)&&(o=oe),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:kn,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:kn,field:"vae"}},{source:{node_id:kn,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==y2||t.id===v2||t.id===Ll||t.id===Fl)&&t.edges.push({source:{node_id:kn,field:"unet"},destination:{node_id:Re,field:"unet"}})},oo=(e,t,n)=>{const r=Sie(e.controlAdapters).filter(i=>{var o,a;return((o=i.model)==null?void 0:o.base_model)===((a=e.generation.model)==null?void 0:a.base_model)});if(r.length){const i={id:kh,type:"collect",is_intermediate:!0};t.nodes[kh]=i,t.edges.push({source:{node_id:kh,field:"collection"},destination:{node_id:n,field:"t2i_adapter"}}),Re in t.nodes&&t.edges.push({source:{node_id:kh,field:"collection"},destination:{node_id:Re,field:"t2i_adapter"}});const o=[];r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,resizeMode:f,model:h,processorType:p,weight:m}=a,_={id:`t2i_adapter_${s}`,type:"t2i_adapter",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,resize_mode:f,t2i_adapter_model:h,weight:m};if(u&&p!=="none")_.image={image_name:u};else if(l)_.image={image_name:l};else return;t.nodes[_.id]=_,o.push($f(_,["id","type","is_intermediate"])),t.edges.push({source:{node_id:_.id,field:"t2i_adapter"},destination:{node_id:kh,field:"item"}})}),Do(t,{t2iAdapters:o})}},ao=(e,t,n=Mo)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r;l||(t.nodes[ci]={type:"vae_loader",id:ci,is_intermediate:!0,vae_model:r});const u=n==m2;(t.id===mG||t.id===k3||t.id===vT||t.id===cb)&&t.edges.push({source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:xe,field:"vae"}}),(t.id===yG||t.id===I3||t.id===b2||t.id==Ug)&&t.edges.push({source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:s?xe:se,field:"vae"}}),(t.id===k3||t.id===cb||t.id===I3||t.id===Ug)&&t.edges.push({source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Ft,field:"vae"}}),(t.id===y2||t.id===v2||t.id===Ll||t.id===Fl)&&(t.edges.push({source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:kt,field:"vae"}},{source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Tt,field:"vae"}},{source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:xe,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Je,field:"vae"}})),a&&(t.id===Ll||t.id===Fl)&&t.edges.push({source:{node_id:l?n:ci,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Fi,field:"vae"}}),r&&Do(t,{vae:r})},so=(e,t,n=xe)=>{const i=bT(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[xl];if(!o)return;const s={id:Nu,type:"img_watermark",is_intermediate:i};t.nodes[Nu]=s,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:xl,field:"image"},destination:{node_id:Nu,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Nu,field:"image"}})},XMe=(e,t)=>{const n=ae("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:y,boundingBoxScaleMethod:g}=e.canvas,b=d==="fp32",S=!0,x=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let w=Mo;const C=h,T={id:I3,nodes:{[w]:{type:"main_model_loader",id:w,is_intermediate:S,model:o},[st]:{type:"clip_skip",id:st,is_intermediate:S,skipped_layers:f},[Se]:{type:"compel",id:Se,is_intermediate:S,prompt:r},[we]:{type:"compel",id:we,is_intermediate:S,prompt:i},[ve]:{type:"noise",id:ve,is_intermediate:S,use_cpu:C,seed:l,width:x?y.width:_,height:x?y.height:v},[Ft]:{type:"i2l",id:Ft,is_intermediate:S},[le]:{type:"denoise_latents",id:le,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[se]:{type:"l2i",id:se,is_intermediate:S}},edges:[{source:{node_id:w,field:"unet"},destination:{node_id:le,field:"unet"}},{source:{node_id:w,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:le,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:le,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:le,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:le,field:"latents"}}]};return x?(T.nodes[Ku]={id:Ku,type:"img_resize",is_intermediate:S,image:t,width:y.width,height:y.height},T.nodes[xe]={id:xe,type:"l2i",is_intermediate:S,fp32:b},T.nodes[se]={id:se,type:"img_resize",is_intermediate:S,width:_,height:v},T.edges.push({source:{node_id:Ku,field:"image"},destination:{node_id:Ft,field:"image"}},{source:{node_id:le,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}})):(T.nodes[se]={type:"l2i",id:se,is_intermediate:S,fp32:b},T.nodes[Ft].image=t,T.edges.push({source:{node_id:le,field:"latents"},destination:{node_id:se,field:"latents"}})),ks(T,{generation_mode:"img2img",cfg_scale:a,width:x?y.width:_,height:x?y.height:v,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,clip_skip:f,strength:c,init_image:t.image_name},se),(p||m)&&(io(e,T,w),w=kn),Uf(e,T,le),ao(e,T,w),eo(e,T,le),to(e,T,le),oo(e,T,le),e.system.shouldUseNSFWChecker&&no(e,T,se),e.system.shouldUseWatermarker&&so(e,T,se),ro(e,T),T},QMe=(e,t,n)=>{const r=ae("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:v,canvasCoherenceStrength:y,clipSkip:g,seamlessXAxis:b,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:x,height:w}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:T}=e.canvas,A=!0,I=f==="fp32",D=["auto","manual"].includes(T);let M=Mo;const E=h,P={id:y2,nodes:{[M]:{type:"main_model_loader",id:M,is_intermediate:A,model:a},[st]:{type:"clip_skip",id:st,is_intermediate:A,skipped_layers:g},[Se]:{type:"compel",id:Se,is_intermediate:A,prompt:i},[we]:{type:"compel",id:we,is_intermediate:A,prompt:o},[gr]:{type:"img_blur",id:gr,is_intermediate:A,radius:p,blur_type:m},[kt]:{type:"i2l",id:kt,is_intermediate:A,fp32:I},[ve]:{type:"noise",id:ve,use_cpu:E,seed:d,is_intermediate:A},[Tt]:{type:"create_denoise_mask",id:Tt,is_intermediate:A,fp32:I},[le]:{type:"denoise_latents",id:le,is_intermediate:A,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[tt]:{type:"noise",id:tt,use_cpu:E,seed:d+1,is_intermediate:A},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:A},[Re]:{type:"denoise_latents",id:Re,is_intermediate:A,steps:v,cfg_scale:s,scheduler:l,denoising_start:1-y,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:A,fp32:I},[se]:{type:"color_correct",id:se,is_intermediate:A,reference:t}},edges:[{source:{node_id:M,field:"unet"},destination:{node_id:le,field:"unet"}},{source:{node_id:M,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:le,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:le,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:le,field:"noise"}},{source:{node_id:kt,field:"latents"},destination:{node_id:le,field:"latents"}},{source:{node_id:gr,field:"image"},destination:{node_id:Tt,field:"mask"}},{source:{node_id:Tt,field:"denoise_mask"},destination:{node_id:le,field:"denoise_mask"}},{source:{node_id:M,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:le,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:Re,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(D){const N=C.width,L=C.height;P.nodes[Vn]={type:"img_resize",id:Vn,is_intermediate:A,width:N,height:L,image:t},P.nodes[Pt]={type:"img_resize",id:Pt,is_intermediate:A,width:N,height:L,image:n},P.nodes[ir]={type:"img_resize",id:ir,is_intermediate:A,width:x,height:w},P.nodes[vr]={type:"img_resize",id:vr,is_intermediate:A,width:x,height:w},P.nodes[ve].width=N,P.nodes[ve].height=L,P.nodes[tt].width=N,P.nodes[tt].height=L,P.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:kt,field:"image"}},{source:{node_id:Pt,field:"image"},destination:{node_id:gr,field:"image"}},{source:{node_id:Vn,field:"image"},destination:{node_id:Tt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:ir,field:"image"}},{source:{node_id:ir,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:se,field:"mask"}})}else P.nodes[ve].width=x,P.nodes[ve].height=w,P.nodes[tt].width=x,P.nodes[tt].height=w,P.nodes[kt]={...P.nodes[kt],image:t},P.nodes[gr]={...P.nodes[gr],image:n},P.nodes[Tt]={...P.nodes[Tt],image:t},P.edges.push({source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:se,field:"mask"}});return _!=="unmasked"&&(P.nodes[Je]={type:"create_denoise_mask",id:Je,is_intermediate:A,fp32:I},D?P.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:Je,field:"image"}}):P.nodes[Je]={...P.nodes[Je],image:t},_==="mask"&&(D?P.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:Je,field:"mask"}}):P.nodes[Je]={...P.nodes[Je],mask:n}),_==="edge"&&(P.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:A,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},D?P.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:sn,field:"image"}}):P.nodes[sn]={...P.nodes[sn],image:n},P.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Je,field:"mask"}})),P.edges.push({source:{node_id:Je,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(b||S)&&(io(e,P,M),M=kn),ao(e,P,M),Uf(e,P,le,M),eo(e,P,le),to(e,P,le),oo(e,P,le),e.system.shouldUseNSFWChecker&&no(e,P,se),e.system.shouldUseWatermarker&&so(e,P,se),ro(e,P),P},YMe=(e,t,n)=>{const r=ae("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:v,infillTileSize:y,infillPatchmatchDownscaleSize:g,infillMethod:b,clipSkip:S,seamlessXAxis:x,seamlessYAxis:w}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:A,boundingBoxScaleMethod:I}=e.canvas,D=f==="fp32",M=!0,E=["auto","manual"].includes(I);let P=Mo;const N=h,L={id:v2,nodes:{[P]:{type:"main_model_loader",id:P,is_intermediate:M,model:a},[st]:{type:"clip_skip",id:st,is_intermediate:M,skipped_layers:S},[Se]:{type:"compel",id:Se,is_intermediate:M,prompt:i},[we]:{type:"compel",id:we,is_intermediate:M,prompt:o},[Hd]:{type:"tomask",id:Hd,is_intermediate:M,image:t},[nr]:{type:"mask_combine",id:nr,is_intermediate:M,mask2:n},[kt]:{type:"i2l",id:kt,is_intermediate:M,fp32:D},[ve]:{type:"noise",id:ve,use_cpu:N,seed:d,is_intermediate:M},[Tt]:{type:"create_denoise_mask",id:Tt,is_intermediate:M,fp32:D},[le]:{type:"denoise_latents",id:le,is_intermediate:M,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[tt]:{type:"noise",id:tt,use_cpu:N,seed:d+1,is_intermediate:M},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:M},[Re]:{type:"denoise_latents",id:Re,is_intermediate:M,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:M,fp32:D},[se]:{type:"color_correct",id:se,is_intermediate:M}},edges:[{source:{node_id:P,field:"unet"},destination:{node_id:le,field:"unet"}},{source:{node_id:P,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:rt,field:"image"},destination:{node_id:kt,field:"image"}},{source:{node_id:Hd,field:"image"},destination:{node_id:nr,field:"mask1"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:le,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:le,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:le,field:"noise"}},{source:{node_id:kt,field:"latents"},destination:{node_id:le,field:"latents"}},{source:{node_id:E?Pt:nr,field:"image"},destination:{node_id:Tt,field:"mask"}},{source:{node_id:Tt,field:"denoise_mask"},destination:{node_id:le,field:"denoise_mask"}},{source:{node_id:P,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:le,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:rt,field:"image"},destination:{node_id:Tt,field:"image"}},{source:{node_id:Re,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(b==="patchmatch"&&(L.nodes[rt]={type:"infill_patchmatch",id:rt,is_intermediate:M,downscale:g}),b==="lama"&&(L.nodes[rt]={type:"infill_lama",id:rt,is_intermediate:M}),b==="cv2"&&(L.nodes[rt]={type:"infill_cv2",id:rt,is_intermediate:M}),b==="tile"&&(L.nodes[rt]={type:"infill_tile",id:rt,is_intermediate:M,tile_size:y}),E){const O=A.width,R=A.height;L.nodes[Vn]={type:"img_resize",id:Vn,is_intermediate:M,width:O,height:R,image:t},L.nodes[Pt]={type:"img_resize",id:Pt,is_intermediate:M,width:O,height:R},L.nodes[ir]={type:"img_resize",id:ir,is_intermediate:M,width:C,height:T},L.nodes[ts]={type:"img_resize",id:ts,is_intermediate:M,width:C,height:T},L.nodes[vr]={type:"img_resize",id:vr,is_intermediate:M,width:C,height:T},L.nodes[ve].width=O,L.nodes[ve].height=R,L.nodes[tt].width=O,L.nodes[tt].height=R,L.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:rt,field:"image"}},{source:{node_id:nr,field:"image"},destination:{node_id:Pt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:ir,field:"image"}},{source:{node_id:Pt,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:rt,field:"image"},destination:{node_id:ts,field:"image"}},{source:{node_id:ts,field:"image"},destination:{node_id:se,field:"reference"}},{source:{node_id:ir,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:se,field:"mask"}})}else L.nodes[rt]={...L.nodes[rt],image:t},L.nodes[ve].width=C,L.nodes[ve].height=T,L.nodes[tt].width=C,L.nodes[tt].height=T,L.nodes[kt]={...L.nodes[kt],image:t},L.edges.push({source:{node_id:rt,field:"image"},destination:{node_id:se,field:"reference"}},{source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:nr,field:"image"},destination:{node_id:se,field:"mask"}});return m!=="unmasked"&&(L.nodes[Je]={type:"create_denoise_mask",id:Je,is_intermediate:M,fp32:D},L.edges.push({source:{node_id:rt,field:"image"},destination:{node_id:Je,field:"image"}}),m==="mask"&&(E?L.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:Je,field:"mask"}}):L.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Je,field:"mask"}})),m==="edge"&&(L.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:M,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},E?L.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:sn,field:"image"}}):L.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:sn,field:"image"}}),L.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Je,field:"mask"}})),L.edges.push({source:{node_id:Je,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(x||w)&&(io(e,L,P),P=kn),ao(e,L,P),Uf(e,L,le,P),eo(e,L,le),to(e,L,le),oo(e,L,le),e.system.shouldUseNSFWChecker&&no(e,L,se),e.system.shouldUseWatermarker&&so(e,L,se),ro(e,L),L},Gf=(e,t,n,r=mr)=>{const{loras:i}=e.lora,o=n_(i);if(o===0)return;const a=[],s=r;let l=r;[kn,Fi].includes(r)&&(l=mr),t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field)));let u="",c=0;ps(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${gG}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a.push(NF.parse({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Ll,Fl].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:Re,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Se,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:we,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Se,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:we,field:"clip2"}})),u=m,c+=1}),Do(t,{loras:a})},wc=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},Hf=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,v=m==="fp32",y=["auto","manual"].includes(_);if(!a)return;Do(t,{refiner_model:a,refiner_positive_aesthetic_score:s,refiner_negative_aesthetic_score:l,refiner_cfg_scale:d,refiner_scheduler:c,refiner_start:f,refiner_steps:u});const g=r||mr,{joinedPositiveStylePrompt:b,joinedNegativeStylePrompt:S}=wc(e,!0);t.edges=t.edges.filter(x=>!(x.source.node_id===n&&["latents"].includes(x.source.field))),t.edges=t.edges.filter(x=>!(x.source.node_id===g&&["vae"].includes(x.source.field))),t.nodes[fu]={type:"sdxl_refiner_model_loader",id:fu,model:a},t.nodes[yy]={type:"sdxl_refiner_compel_prompt",id:yy,style:b,aesthetic_score:s},t.nodes[vy]={type:"sdxl_refiner_compel_prompt",id:vy,style:S,aesthetic_score:l},t.nodes[qo]={type:"denoise_latents",id:qo,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[wo]={id:wo,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:fu,field:"unet"},destination:{node_id:wo,field:"unet"}},{source:{node_id:fu,field:"vae"},destination:{node_id:wo,field:"vae"}},{source:{node_id:wo,field:"unet"},destination:{node_id:qo,field:"unet"}})):t.edges.push({source:{node_id:fu,field:"unet"},destination:{node_id:qo,field:"unet"}}),t.edges.push({source:{node_id:fu,field:"clip2"},destination:{node_id:yy,field:"clip2"}},{source:{node_id:fu,field:"clip2"},destination:{node_id:vy,field:"clip2"}},{source:{node_id:yy,field:"conditioning"},destination:{node_id:qo,field:"positive_conditioning"}},{source:{node_id:vy,field:"conditioning"},destination:{node_id:qo,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:qo,field:"latents"}}),(t.id===Ll||t.id===Fl)&&(t.nodes[Fi]={type:"create_denoise_mask",id:Fi,is_intermediate:!0,fp32:v},y?t.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:Fi,field:"image"}}):t.nodes[Fi]={...t.nodes[Fi],image:i},t.id===Ll&&(y?t.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:Fi,field:"mask"}}):t.nodes[Fi]={...t.nodes[Fi],mask:o}),t.id===Fl&&t.edges.push({source:{node_id:y?Pt:nr,field:"image"},destination:{node_id:Fi,field:"mask"}}),t.edges.push({source:{node_id:Fi,field:"denoise_mask"},destination:{node_id:qo,field:"denoise_mask"}})),t.id===b2||t.id===Ug?t.edges.push({source:{node_id:qo,field:"latents"},destination:{node_id:y?xe:se,field:"latents"}}):t.edges.push({source:{node_id:qo,field:"latents"},destination:{node_id:xe,field:"latents"}})},ZMe=(e,t)=>{const n=ae("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:v,height:y}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:b}=e.canvas,S=c==="fp32",x=!0,w=["auto","manual"].includes(b);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=mr;const T=d,{joinedPositiveStylePrompt:A,joinedNegativeStylePrompt:I}=wc(e),D={id:Ug,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:r,style:A},[we]:{type:"sdxl_compel_prompt",id:we,prompt:i,style:I},[ve]:{type:"noise",id:ve,is_intermediate:x,use_cpu:T,seed:l,width:w?g.width:v,height:w?g.height:y},[Ft]:{type:"i2l",id:Ft,is_intermediate:x,fp32:S},[oe]:{type:"denoise_latents",id:oe,is_intermediate:x,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:oe,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:we,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:oe,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:oe,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:oe,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:oe,field:"latents"}}]};return w?(D.nodes[Ku]={id:Ku,type:"img_resize",is_intermediate:x,image:t,width:g.width,height:g.height},D.nodes[xe]={id:xe,type:"l2i",is_intermediate:x,fp32:S},D.nodes[se]={id:se,type:"img_resize",is_intermediate:x,width:v,height:y},D.edges.push({source:{node_id:Ku,field:"image"},destination:{node_id:Ft,field:"image"}},{source:{node_id:oe,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}})):(D.nodes[se]={type:"l2i",id:se,is_intermediate:x,fp32:S},D.nodes[Ft].image=t,D.edges.push({source:{node_id:oe,field:"latents"},destination:{node_id:se,field:"latents"}})),ks(D,{generation_mode:"img2img",cfg_scale:a,width:w?g.width:v,height:w?g.height:y,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:T?"cpu":"cuda",scheduler:s,strength:_,init_image:t.image_name},se),(f||h)&&(io(e,D,C),C=kn),p&&(Hf(e,D,oe,C),(f||h)&&(C=wo)),ao(e,D,C),Gf(e,D,oe,C),eo(e,D,oe),to(e,D,oe),oo(e,D,oe),e.system.shouldUseNSFWChecker&&no(e,D,se),e.system.shouldUseWatermarker&&so(e,D,se),ro(e,D),D},JMe=(e,t,n)=>{const r=ae("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:v,seamlessXAxis:y,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:b,shouldUseSDXLRefiner:S,refinerStart:x}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:w,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:A}=e.canvas,I=d==="fp32",D=!0,M=["auto","manual"].includes(A);let E=mr;const P=f,{joinedPositiveStylePrompt:N,joinedNegativeStylePrompt:L}=wc(e),O={id:Ll,nodes:{[E]:{type:"sdxl_model_loader",id:E,model:a},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:i,style:N},[we]:{type:"sdxl_compel_prompt",id:we,prompt:o,style:L},[gr]:{type:"img_blur",id:gr,is_intermediate:D,radius:h,blur_type:p},[kt]:{type:"i2l",id:kt,is_intermediate:D,fp32:I},[ve]:{type:"noise",id:ve,use_cpu:P,seed:c,is_intermediate:D},[Tt]:{type:"create_denoise_mask",id:Tt,is_intermediate:D,fp32:I},[oe]:{type:"denoise_latents",id:oe,is_intermediate:D,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(x,1-b):1-b,denoising_end:S?x:1},[tt]:{type:"noise",id:tt,use_cpu:P,seed:c+1,is_intermediate:D},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:D},[Re]:{type:"denoise_latents",id:Re,is_intermediate:D,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:D,fp32:I},[se]:{type:"color_correct",id:se,is_intermediate:D,reference:t}},edges:[{source:{node_id:E,field:"unet"},destination:{node_id:oe,field:"unet"}},{source:{node_id:E,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:E,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:we,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:oe,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:oe,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:oe,field:"noise"}},{source:{node_id:kt,field:"latents"},destination:{node_id:oe,field:"latents"}},{source:{node_id:gr,field:"image"},destination:{node_id:Tt,field:"mask"}},{source:{node_id:Tt,field:"denoise_mask"},destination:{node_id:oe,field:"denoise_mask"}},{source:{node_id:E,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:oe,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:Re,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(M){const R=T.width,$=T.height;O.nodes[Vn]={type:"img_resize",id:Vn,is_intermediate:D,width:R,height:$,image:t},O.nodes[Pt]={type:"img_resize",id:Pt,is_intermediate:D,width:R,height:$,image:n},O.nodes[ir]={type:"img_resize",id:ir,is_intermediate:D,width:w,height:C},O.nodes[vr]={type:"img_resize",id:vr,is_intermediate:D,width:w,height:C},O.nodes[ve].width=R,O.nodes[ve].height=$,O.nodes[tt].width=R,O.nodes[tt].height=$,O.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:kt,field:"image"}},{source:{node_id:Pt,field:"image"},destination:{node_id:gr,field:"image"}},{source:{node_id:Vn,field:"image"},destination:{node_id:Tt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:ir,field:"image"}},{source:{node_id:ir,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:se,field:"mask"}})}else O.nodes[ve].width=w,O.nodes[ve].height=C,O.nodes[tt].width=w,O.nodes[tt].height=C,O.nodes[kt]={...O.nodes[kt],image:t},O.nodes[gr]={...O.nodes[gr],image:n},O.nodes[Tt]={...O.nodes[Tt],image:t},O.edges.push({source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:se,field:"mask"}});return m!=="unmasked"&&(O.nodes[Je]={type:"create_denoise_mask",id:Je,is_intermediate:D,fp32:I},M?O.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:Je,field:"image"}}):O.nodes[Je]={...O.nodes[Je],image:t},m==="mask"&&(M?O.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:Je,field:"mask"}}):O.nodes[Je]={...O.nodes[Je],mask:n}),m==="edge"&&(O.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:D,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},M?O.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:sn,field:"image"}}):O.nodes[sn]={...O.nodes[sn],image:n},O.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Je,field:"mask"}})),O.edges.push({source:{node_id:Je,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(y||g)&&(io(e,O,E),E=kn),S&&(Hf(e,O,Re,E,t,n),(y||g)&&(E=wo)),ao(e,O,E),Gf(e,O,oe,E),eo(e,O,oe),to(e,O,oe),oo(e,O,oe),e.system.shouldUseNSFWChecker&&no(e,O,se),e.system.shouldUseWatermarker&&so(e,O,se),ro(e,O),O},eRe=(e,t,n)=>{const r=ae("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:v,infillPatchmatchDownscaleSize:y,infillMethod:g,seamlessXAxis:b,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:x,shouldUseSDXLRefiner:w,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:A}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:I,boundingBoxScaleMethod:D}=e.canvas,M=d==="fp32",E=!0,P=["auto","manual"].includes(D);let N=mr;const L=f,{joinedPositiveStylePrompt:O,joinedNegativeStylePrompt:R}=wc(e),$={id:Fl,nodes:{[mr]:{type:"sdxl_model_loader",id:mr,model:a},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:i,style:O},[we]:{type:"sdxl_compel_prompt",id:we,prompt:o,style:R},[Hd]:{type:"tomask",id:Hd,is_intermediate:E,image:t},[nr]:{type:"mask_combine",id:nr,is_intermediate:E,mask2:n},[kt]:{type:"i2l",id:kt,is_intermediate:E,fp32:M},[ve]:{type:"noise",id:ve,use_cpu:L,seed:c,is_intermediate:E},[Tt]:{type:"create_denoise_mask",id:Tt,is_intermediate:E,fp32:M},[oe]:{type:"denoise_latents",id:oe,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:w?Math.min(C,1-x):1-x,denoising_end:w?C:1},[tt]:{type:"noise",id:tt,use_cpu:L,seed:c+1,is_intermediate:E},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:E},[Re]:{type:"denoise_latents",id:Re,is_intermediate:E,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:E,fp32:M},[se]:{type:"color_correct",id:se,is_intermediate:E}},edges:[{source:{node_id:mr,field:"unet"},destination:{node_id:oe,field:"unet"}},{source:{node_id:mr,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:mr,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:mr,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:mr,field:"clip2"},destination:{node_id:we,field:"clip2"}},{source:{node_id:rt,field:"image"},destination:{node_id:kt,field:"image"}},{source:{node_id:Hd,field:"image"},destination:{node_id:nr,field:"mask1"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:oe,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:oe,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:oe,field:"noise"}},{source:{node_id:kt,field:"latents"},destination:{node_id:oe,field:"latents"}},{source:{node_id:P?Pt:nr,field:"image"},destination:{node_id:Tt,field:"mask"}},{source:{node_id:Tt,field:"denoise_mask"},destination:{node_id:oe,field:"denoise_mask"}},{source:{node_id:N,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:oe,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:rt,field:"image"},destination:{node_id:Tt,field:"image"}},{source:{node_id:Re,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(g==="patchmatch"&&($.nodes[rt]={type:"infill_patchmatch",id:rt,is_intermediate:E,downscale:y}),g==="lama"&&($.nodes[rt]={type:"infill_lama",id:rt,is_intermediate:E}),g==="cv2"&&($.nodes[rt]={type:"infill_cv2",id:rt,is_intermediate:E}),g==="tile"&&($.nodes[rt]={type:"infill_tile",id:rt,is_intermediate:E,tile_size:v}),P){const z=I.width,V=I.height;$.nodes[Vn]={type:"img_resize",id:Vn,is_intermediate:E,width:z,height:V,image:t},$.nodes[Pt]={type:"img_resize",id:Pt,is_intermediate:E,width:z,height:V},$.nodes[ir]={type:"img_resize",id:ir,is_intermediate:E,width:T,height:A},$.nodes[ts]={type:"img_resize",id:ts,is_intermediate:E,width:T,height:A},$.nodes[vr]={type:"img_resize",id:vr,is_intermediate:E,width:T,height:A},$.nodes[ve].width=z,$.nodes[ve].height=V,$.nodes[tt].width=z,$.nodes[tt].height=V,$.edges.push({source:{node_id:Vn,field:"image"},destination:{node_id:rt,field:"image"}},{source:{node_id:nr,field:"image"},destination:{node_id:Pt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:ir,field:"image"}},{source:{node_id:Pt,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:rt,field:"image"},destination:{node_id:ts,field:"image"}},{source:{node_id:ts,field:"image"},destination:{node_id:se,field:"reference"}},{source:{node_id:ir,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:se,field:"mask"}})}else $.nodes[rt]={...$.nodes[rt],image:t},$.nodes[ve].width=T,$.nodes[ve].height=A,$.nodes[tt].width=T,$.nodes[tt].height=A,$.nodes[kt]={...$.nodes[kt],image:t},$.edges.push({source:{node_id:rt,field:"image"},destination:{node_id:se,field:"reference"}},{source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}},{source:{node_id:nr,field:"image"},destination:{node_id:se,field:"mask"}});return p!=="unmasked"&&($.nodes[Je]={type:"create_denoise_mask",id:Je,is_intermediate:E,fp32:M},$.edges.push({source:{node_id:rt,field:"image"},destination:{node_id:Je,field:"image"}}),p==="mask"&&(P?$.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:Je,field:"mask"}}):$.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Je,field:"mask"}})),p==="edge"&&($.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:E,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},P?$.edges.push({source:{node_id:Pt,field:"image"},destination:{node_id:sn,field:"image"}}):$.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:sn,field:"image"}}),$.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Je,field:"mask"}})),$.edges.push({source:{node_id:Je,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(b||S)&&(io(e,$,N),N=kn),w&&(Hf(e,$,Re,N,t),(b||S)&&(N=wo)),ao(e,$,N),Gf(e,$,oe,N),eo(e,$,oe),to(e,$,oe),oo(e,$,oe),e.system.shouldUseNSFWChecker&&no(e,$,se),e.system.shouldUseWatermarker&&so(e,$,se),ro(e,$),$},tRe=e=>{const t=ae("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,v=u==="fp32",y=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:b,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const x=c,w=i.model_type==="onnx";let C=w?m2:mr;const T=w?"onnx_model_loader":"sdxl_model_loader",A=w?{type:"t2l_onnx",id:oe,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:oe,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?S:1},{joinedPositiveStylePrompt:I,joinedNegativeStylePrompt:D}=wc(e),M={id:b2,nodes:{[C]:{type:T,id:C,is_intermediate:y,model:i},[Se]:{type:w?"prompt_onnx":"sdxl_compel_prompt",id:Se,is_intermediate:y,prompt:n,style:I},[we]:{type:w?"prompt_onnx":"sdxl_compel_prompt",id:we,is_intermediate:y,prompt:r,style:D},[ve]:{type:"noise",id:ve,is_intermediate:y,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:x},[A.id]:A},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:oe,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:we,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:oe,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:oe,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:oe,field:"noise"}}]};return g?(M.nodes[xe]={id:xe,type:w?"l2i_onnx":"l2i",is_intermediate:y,fp32:v},M.nodes[se]={id:se,type:"img_resize",is_intermediate:y,width:h,height:p},M.edges.push({source:{node_id:oe,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}})):(M.nodes[se]={type:w?"l2i_onnx":"l2i",id:se,is_intermediate:y,fp32:v},M.edges.push({source:{node_id:oe,field:"latents"},destination:{node_id:se,field:"latents"}})),ks(M,{generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:x?"cpu":"cuda",scheduler:a},se),(d||f)&&(io(e,M,C),C=kn),b&&(Hf(e,M,oe,C),(d||f)&&(C=wo)),Gf(e,M,oe,C),ao(e,M,C),eo(e,M,oe),to(e,M,oe),oo(e,M,oe),e.system.shouldUseNSFWChecker&&no(e,M,se),e.system.shouldUseWatermarker&&so(e,M,se),ro(e,M),M},nRe=e=>{const t=ae("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:v}=e.canvas,y=u==="fp32",g=!0,b=["auto","manual"].includes(v);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,x=i.model_type==="onnx";let w=x?m2:Mo;const C=x?"onnx_model_loader":"main_model_loader",T=x?{type:"t2l_onnx",id:le,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:le,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},A={id:yG,nodes:{[w]:{type:C,id:w,is_intermediate:g,model:i},[st]:{type:"clip_skip",id:st,is_intermediate:g,skipped_layers:c},[Se]:{type:x?"prompt_onnx":"compel",id:Se,is_intermediate:g,prompt:n},[we]:{type:x?"prompt_onnx":"compel",id:we,is_intermediate:g,prompt:r},[ve]:{type:"noise",id:ve,is_intermediate:g,seed:s,width:b?_.width:p,height:b?_.height:m,use_cpu:S},[T.id]:T},edges:[{source:{node_id:w,field:"unet"},destination:{node_id:le,field:"unet"}},{source:{node_id:w,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:le,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:le,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:le,field:"noise"}}]};return b?(A.nodes[xe]={id:xe,type:x?"l2i_onnx":"l2i",is_intermediate:g,fp32:y},A.nodes[se]={id:se,type:"img_resize",is_intermediate:g,width:p,height:m},A.edges.push({source:{node_id:le,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:se,field:"image"}})):(A.nodes[se]={type:x?"l2i_onnx":"l2i",id:se,is_intermediate:g,fp32:y},A.edges.push({source:{node_id:le,field:"latents"},destination:{node_id:se,field:"latents"}})),ks(A,{generation_mode:"txt2img",cfg_scale:o,width:b?_.width:p,height:b?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,clip_skip:c},se),(f||h)&&(io(e,A,w),w=kn),ao(e,A,w),Uf(e,A,le,w),eo(e,A,le),to(e,A,le),oo(e,A,le),e.system.shouldUseNSFWChecker&&no(e,A,se),e.system.shouldUseWatermarker&&so(e,A,se),ro(e,A),A},rRe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=tRe(e):i=nRe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=ZMe(e,n):i=XMe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=JMe(e,n,r):i=QMe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=eRe(e,n,r):i=YMe(e,n,r)}return i},qw=({count:e,start:t,min:n=Rie,max:r=dp})=>{const i=t??yre(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){const h=qw({count:r,start:o?void 0:a}),p=[];t.nodes[ve]&&p.push({node_path:ve,field_name:"seed",items:h}),Mh(t)&&(Ih(t,"seed"),p.push({node_path:mi,field_name:"seed",items:h})),t.nodes[tt]&&p.push({node_path:tt,field_name:"seed",items:h.map(m=>(m+1)%dp)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=qw({count:u.length*r,start:o?void 0:a});t.nodes[ve]&&h.push({node_path:ve,field_name:"seed",items:_}),Mh(t)&&(Ih(t,"seed"),h.push({node_path:mi,field_name:"seed",items:_})),t.nodes[tt]&&h.push({node_path:tt,field_name:"seed",items:_.map(v=>(v+1)%dp)})}else{const _=qw({count:r,start:o?void 0:a});t.nodes[ve]&&p.push({node_path:ve,field_name:"seed",items:_}),Mh(t)&&(Ih(t,"seed"),p.push({node_path:mi,field_name:"seed",items:_})),t.nodes[tt]&&p.push({node_path:tt,field_name:"seed",items:_.map(v=>(v+1)%dp)}),d.push(p)}const m=c==="PER_PROMPT"?wre(r).flatMap(()=>u):u;if(t.nodes[Se]&&h.push({node_path:Se,field_name:"prompt",items:m}),Mh(t)&&(Ih(t,"positive_prompt"),h.push({node_path:mi,field_name:"positive_prompt",items:m})),s&&(i==null?void 0:i.base_model)==="sdxl"){const _=m.map(v=>[v,l].join(" "));t.nodes[Se]&&h.push({node_path:Se,field_name:"style",items:_}),Mh(t)&&(Ih(t,"positive_style_prompt"),h.push({node_path:mi,field_name:"positive_style_prompt",items:m}))}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},iRe=()=>{pe({predicate:e=>yT.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=ae("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await mT(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=zMe(h,m);if(o.system.enableImageDebugging){const S=await dR(f),x=await dR(p);LMe([{base64:x,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let v,y;["img2img","inpaint","outpaint"].includes(_)&&(v=await n(ue.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(y=await n(ue.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=rRe(o,_,v,y);r.debug({graph:ft(g)},"Canvas graph built"),n(zz(g));const b=vG(o,g,i);try{const S=n(ln.endpoints.enqueueBatch.initiate(b,{fixedCacheKey:"enqueueBatch"})),x=await S.unwrap();S.reset();const w=x.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(_le({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(Sle(w))}catch{}}})},oRe=e=>{const t=ae("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:v,seamlessYAxis:y}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=_==="fp32",b=!0;let S=Mo;const x=m,w={id:k3,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:b},[st]:{type:"clip_skip",id:st,skipped_layers:p,is_intermediate:b},[Se]:{type:"compel",id:Se,prompt:n,is_intermediate:b},[we]:{type:"compel",id:we,prompt:r,is_intermediate:b},[ve]:{type:"noise",id:ve,use_cpu:x,seed:s,is_intermediate:b},[xe]:{type:"l2i",id:xe,fp32:g,is_intermediate:b},[le]:{type:"denoise_latents",id:le,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:b},[Ft]:{type:"i2l",id:Ft,fp32:g,is_intermediate:b}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:le,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:le,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:le,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:le,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:le,field:"latents"}},{source:{node_id:le,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:oa,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};w.nodes[oa]=C,w.edges.push({source:{node_id:oa,field:"image"},destination:{node_id:Ft,field:"image"}}),w.edges.push({source:{node_id:oa,field:"width"},destination:{node_id:ve,field:"width"}}),w.edges.push({source:{node_id:oa,field:"height"},destination:{node_id:ve,field:"height"}})}else w.nodes[Ft].image={image_name:u.imageName},w.edges.push({source:{node_id:Ft,field:"width"},destination:{node_id:ve,field:"width"}}),w.edges.push({source:{node_id:Ft,field:"height"},destination:{node_id:ve,field:"height"}});return ks(w,{generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:x?"cpu":"cuda",scheduler:a,clip_skip:p,strength:c,init_image:u.imageName},xe),(v||y)&&(io(e,w,S),S=kn),ao(e,w,S),Uf(e,w,le,S),eo(e,w,le),to(e,w,le),oo(e,w,le),e.system.shouldUseNSFWChecker&&no(e,w),e.system.shouldUseWatermarker&&so(e,w),ro(e,w),w},aRe=e=>{const t=ae("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:v,negativeStylePrompt:y,shouldUseSDXLRefiner:g,refinerStart:b,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const x=p==="fp32",w=!0;let C=mr;const T=h,{joinedPositiveStylePrompt:A,joinedNegativeStylePrompt:I}=wc(e),D={id:cb,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:w},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:n,style:A,is_intermediate:w},[we]:{type:"sdxl_compel_prompt",id:we,prompt:r,style:I,is_intermediate:w},[ve]:{type:"noise",id:ve,use_cpu:T,seed:s,is_intermediate:w},[xe]:{type:"l2i",id:xe,fp32:x,is_intermediate:w},[oe]:{type:"denoise_latents",id:oe,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(b,1-S):1-S,denoising_end:g?b:1,is_intermediate:w},[Ft]:{type:"i2l",id:Ft,fp32:x,is_intermediate:w}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:oe,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:we,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:oe,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:oe,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:oe,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:oe,field:"latents"}},{source:{node_id:oe,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const M={id:oa,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};D.nodes[oa]=M,D.edges.push({source:{node_id:oa,field:"image"},destination:{node_id:Ft,field:"image"}}),D.edges.push({source:{node_id:oa,field:"width"},destination:{node_id:ve,field:"width"}}),D.edges.push({source:{node_id:oa,field:"height"},destination:{node_id:ve,field:"height"}})}else D.nodes[Ft].image={image_name:u.imageName},D.edges.push({source:{node_id:Ft,field:"width"},destination:{node_id:ve,field:"width"}}),D.edges.push({source:{node_id:Ft,field:"height"},destination:{node_id:ve,field:"height"}});return ks(D,{generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:T?"cpu":"cuda",scheduler:a,strength:S,init_image:u.imageName,positive_style_prompt:v,negative_style_prompt:y},xe),(m||_)&&(io(e,D,C),C=kn),g&&(Hf(e,D,oe),(m||_)&&(C=wo)),ao(e,D,C),Gf(e,D,oe,C),eo(e,D,oe),to(e,D,oe),oo(e,D,oe),e.system.shouldUseNSFWChecker&&no(e,D),e.system.shouldUseWatermarker&&so(e,D),ro(e,D),D},sRe=e=>{const t=ae("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:v,refinerStart:y}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",S=!0,{joinedPositiveStylePrompt:x,joinedNegativeStylePrompt:w}=wc(e);let C=mr;const T={id:vT,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:n,style:x,is_intermediate:S},[we]:{type:"sdxl_compel_prompt",id:we,prompt:r,style:w,is_intermediate:S},[ve]:{type:"noise",id:ve,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[oe]:{type:"denoise_latents",id:oe,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:v?y:1,is_intermediate:S},[xe]:{type:"l2i",id:xe,fp32:b,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:oe,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:we,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:oe,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:oe,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:oe,field:"noise"}},{source:{node_id:oe,field:"latents"},destination:{node_id:xe,field:"latents"}}]};return ks(T,{generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,positive_style_prompt:m,negative_style_prompt:_},xe),(h||p)&&(io(e,T,C),C=kn),v&&(Hf(e,T,oe),(h||p)&&(C=wo)),ao(e,T,C),Gf(e,T,oe,C),eo(e,T,oe),to(e,T,oe),oo(e,T,oe),e.system.shouldUseNSFWChecker&&no(e,T),e.system.shouldUseWatermarker&&so(e,T),ro(e,T),T};function lRe(e){const t=["vae","control","ip_adapter","metadata","unet","positive_conditioning","negative_conditioning"],n=[];e.edges.forEach(r=>{r.destination.node_id===le&&t.includes(r.destination.field)&&n.push({source:{node_id:r.source.node_id,field:r.source.field},destination:{node_id:Kc,field:r.destination.field}})}),e.edges=e.edges.concat(n)}function uRe(e,t,n){const r=t/n;let i;e=="sdxl"?i=1024:i=512;const o=Math.floor(i*.5),a=i*i;let s,l;r>1?(l=Math.max(o,Math.sqrt(a/r)),s=l*r):(s=Math.max(o,Math.sqrt(a*r)),l=s/r),s=Math.min(t,s),l=Math.min(n,l);const u=Mr(Math.floor(s),8),c=Mr(Math.floor(l),8);return{newWidth:u,newHeight:c}}const cRe=(e,t)=>{var _;if(!e.generation.hrfEnabled||e.config.disabledSDFeatures.includes("hrf")||((_=e.generation.model)==null?void 0:_.model_type)==="onnx")return;const n=ae("txt2img"),{vae:r,hrfStrength:i,hrfEnabled:o,hrfMethod:a}=e.generation,s=!r,l=e.generation.width,u=e.generation.height,c=e.generation.model?e.generation.model.base_model:"sd1",{newWidth:d,newHeight:f}=uRe(c,l,u),h=t.nodes[le],p=t.nodes[ve],m=t.nodes[xe];if(!h){n.error("originalDenoiseLatentsNode is undefined");return}if(!p){n.error("originalNoiseNode is undefined");return}if(!m){n.error("originalLatentsToImageNode is undefined");return}if(p&&(p.width=d,p.height=f),t.nodes[_u]={type:"l2i",id:_u,fp32:m==null?void 0:m.fp32,is_intermediate:!0},t.edges.push({source:{node_id:le,field:"latents"},destination:{node_id:_u,field:"latents"}},{source:{node_id:s?Mo:ci,field:"vae"},destination:{node_id:_u,field:"vae"}}),t.nodes[Us]={id:Us,type:"img_resize",is_intermediate:!0,width:l,height:u},a=="ESRGAN"){let v="RealESRGAN_x2plus.pth";l*u/(d*f)>2&&(v="RealESRGAN_x4plus.pth"),t.nodes[Qh]={id:Qh,type:"esrgan",model_name:v,is_intermediate:!0},t.edges.push({source:{node_id:_u,field:"image"},destination:{node_id:Qh,field:"image"}},{source:{node_id:Qh,field:"image"},destination:{node_id:Us,field:"image"}})}else t.edges.push({source:{node_id:_u,field:"image"},destination:{node_id:Us,field:"image"}});t.nodes[Th]={type:"noise",id:Th,seed:p==null?void 0:p.seed,use_cpu:p==null?void 0:p.use_cpu,is_intermediate:!0},t.edges.push({source:{node_id:Us,field:"height"},destination:{node_id:Th,field:"height"}},{source:{node_id:Us,field:"width"},destination:{node_id:Th,field:"width"}}),t.nodes[Ah]={type:"i2l",id:Ah,is_intermediate:!0},t.edges.push({source:{node_id:s?Mo:ci,field:"vae"},destination:{node_id:Ah,field:"vae"}},{source:{node_id:Us,field:"image"},destination:{node_id:Ah,field:"image"}}),t.nodes[Kc]={type:"denoise_latents",id:Kc,is_intermediate:!0,cfg_scale:h==null?void 0:h.cfg_scale,scheduler:h==null?void 0:h.scheduler,steps:h==null?void 0:h.steps,denoising_start:1-e.generation.hrfStrength,denoising_end:1},t.edges.push({source:{node_id:Ah,field:"latents"},destination:{node_id:Kc,field:"latents"}},{source:{node_id:Th,field:"noise"},destination:{node_id:Kc,field:"noise"}}),lRe(t),t.nodes[tl]={type:"l2i",id:tl,fp32:m==null?void 0:m.fp32,is_intermediate:!0},t.edges.push({source:{node_id:s?Mo:ci,field:"vae"},destination:{node_id:tl,field:"vae"}},{source:{node_id:Kc,field:"latents"},destination:{node_id:tl,field:"latents"}}),Do(t,{hrf_strength:i,hrf_enabled:o,hrf_method:a}),WMe(t,tl)},dRe=e=>{const t=ae("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const v=f==="fp32",y=!0,g=i.model_type==="onnx";let b=g?m2:Mo;const S=g?"onnx_model_loader":"main_model_loader",x=g?{type:"t2l_onnx",id:le,is_intermediate:y,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:le,is_intermediate:y,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},w={id:mG,nodes:{[b]:{type:S,id:b,is_intermediate:y,model:i},[st]:{type:"clip_skip",id:st,skipped_layers:c,is_intermediate:y},[Se]:{type:g?"prompt_onnx":"compel",id:Se,prompt:n,is_intermediate:y},[we]:{type:g?"prompt_onnx":"compel",id:we,prompt:r,is_intermediate:y},[ve]:{type:"noise",id:ve,seed:m,width:l,height:u,use_cpu:_,is_intermediate:y},[x.id]:x,[xe]:{type:g?"l2i_onnx":"l2i",id:xe,fp32:v,is_intermediate:y}},edges:[{source:{node_id:b,field:"unet"},destination:{node_id:le,field:"unet"}},{source:{node_id:b,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:we,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:le,field:"positive_conditioning"}},{source:{node_id:we,field:"conditioning"},destination:{node_id:le,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:le,field:"noise"}},{source:{node_id:le,field:"latents"},destination:{node_id:xe,field:"latents"}}]};return ks(w,{generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,clip_skip:c},xe),(h||p)&&(io(e,w,b),b=kn),ao(e,w,b),Uf(e,w,le,b),eo(e,w,le),to(e,w,le),oo(e,w,le),e.generation.hrfEnabled&&!g&&cRe(e,w),e.system.shouldUseNSFWChecker&&no(e,w),e.system.shouldUseWatermarker&&so(e,w),ro(e,w),w},fRe=()=>{pe({predicate:e=>yT.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=sRe(r):a=aRe(r):e.payload.tabName==="txt2img"?a=dRe(r):a=oRe(r);const s=vG(r,a,o);n(ln.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},hRe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function pRe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+gRe(n)+'"]';if(!hRe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function gRe(e){return e.replace(/"/g,'\\"')}function mRe(e){return e.length!==0}const yRe=99,bG="; ",_G=", or ",_T="Validation error",SG=": ";class xG extends Error{constructor(n,r=[]){super(n);W2(this,"details");W2(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function ST(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>ST(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(mRe(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${pRe(e.path)}"`}return e.message}function wG(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:_T}function PUe(e,t={}){const{issueSeparator:n=bG,unionSeparator:r=_G,prefixSeparator:i=SG,prefix:o=_T}=t,a=ST(e,n,r),s=wG(a,o,i);return new xG(s,[e])}function fR(e,t={}){const{maxIssuesInMessage:n=yRe,issueSeparator:r=bG,unionSeparator:i=_G,prefixSeparator:o=SG,prefix:a=_T}=t,s=e.errors.slice(0,n).map(u=>ST(u,r,i)).join(r),l=wG(s,a,o);return new xG(l,e.errors)}const vRe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=FF.safeParse(o);if(!a.success){const{message:s}=fR(a.error,{prefix:ce.t("nodes.unableToParseNode")});ae("nodes").warn({node:ft(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=BF.safeParse(o);if(!a.success){const{message:s}=fR(a.error,{prefix:ce.t("nodes.unableToParseEdge")});ae("nodes").warn({edge:ft(o)},s);return}i.edges.push(a.data)}),i},bRe=e=>{if(e.type==="ColorField"&&e.value){const t=Ye(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},_Re=e=>{const{nodes:t,edges:n}=e,i=t.filter(on).reduce((l,u)=>{const{id:c,data:d}=u,{type:f,inputs:h,isIntermediate:p,embedWorkflow:m}=d,_=Jp(h,(y,g,b)=>{const S=bRe(g);return y[b]=S,y},{});_.use_cache=u.data.useCache;const v={type:f,id:c,..._,is_intermediate:p};return m&&Object.assign(v,{workflow:vRe(e)}),Object.assign(l,{[c]:v}),l},{}),a=n.filter(l=>l.type!=="collapsed").reduce((l,u)=>{const{source:c,target:d,sourceHandle:f,targetHandle:h}=u;return l.push({source:{node_id:c,field:f},destination:{node_id:d,field:h}}),l},[]);return a.forEach(l=>{const u=i[l.destination.node_id],c=l.destination.field;i[l.destination.node_id]=$f(u,c)}),{id:yl(),nodes:i,edges:a}},SRe=()=>{pe({predicate:e=>yT.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:_Re(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(ln.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},xRe=()=>{pe({matcher:ue.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=ae("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},wRe=()=>{pe({matcher:ue.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=ae("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},xT=ge("deleteImageModal/imageDeletionConfirmed"),kUe=Gn(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],zm),CG=Gn([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?Ln:Tr,offset:0,limit:Dle,is_intermediate:!1}},zm),CRe=()=>{pe({actionCreator:xT,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(jE(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=CG(l),{data:m}=ue.endpoints.listImages.select(p)(l),_=m?Dt.getSelectors().selectAll(m):[],v=_.findIndex(S=>S.image_name===h),y=_.filter(S=>S.image_name!==h),g=al(v,0,y.length-1),b=y[g];t(ha(b||null))}s.isCanvasImage&&t(zE()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(kE()),ps(Aa(n().controlAdapters),m=>{(m.controlImage===h.image_name||hi(m)&&m.processedControlImage===h.image_name)&&(t(Hl({id:m.id,controlImage:null})),t(EE({id:m.id,processedControlImage:null})))}),n().nodes.nodes.forEach(m=>{on(m)&&ps(m.data.inputs,_=>{var v;_.type==="ImageField"&&((v=_.value)==null?void 0:v.image_name)===h.image_name&&t(rS({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(ue.endpoints.deleteImage.initiate(a));await r(h=>ue.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(No.util.invalidateTags([{type:"Board",id:a.board_id??"none"}]))}})},ERe=()=>{pe({actionCreator:xT,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(ue.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=CG(o),{data:s}=ue.endpoints.listImages.select(a)(o),l=s?Dt.getSelectors().selectAll(s)[0]:void 0;t(ha(l||null)),t(jE(!1)),i.some(u=>u.isCanvasImage)&&t(zE()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(kE()),ps(Aa(n().controlAdapters),d=>{(d.controlImage===u.image_name||hi(d)&&d.processedControlImage===u.image_name)&&(t(Hl({id:d.id,controlImage:null})),t(EE({id:d.id,processedControlImage:null})))}),n().nodes.nodes.forEach(d=>{on(d)&&ps(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(rS({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},ARe=()=>{pe({matcher:ue.endpoints.deleteImage.matchPending,effect:()=>{}})},TRe=()=>{pe({matcher:ue.endpoints.deleteImage.matchFulfilled,effect:e=>{ae("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},PRe=()=>{pe({matcher:ue.endpoints.deleteImage.matchRejected,effect:e=>{ae("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},EG=ge("dnd/dndDropped"),kRe=()=>{pe({actionCreator:EG,effect:async(e,{dispatch:t})=>{const n=ae("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:ft(r),overData:ft(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(Zye({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(ha(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(u_(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROL_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{id:o}=i.context;t(Hl({id:o,controlImage:r.payload.imageDTO.image_name})),t(AE({id:o,isEnabled:!0}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(YL(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(rS({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(ue.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(ue.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(ue.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(ue.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},IRe=()=>{pe({matcher:ue.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=ae("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},MRe=()=>{pe({matcher:ue.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=ae("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},RRe=()=>{pe({actionCreator:Tle,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=d6e(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlImage)||a.some(l=>l.isNodesImage);if(o||s){t(jE(!0));return}t(xT({imageDTOs:r,imagesUsage:a}))}})},ORe=()=>{pe({matcher:ue.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=ae("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:K("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(nt({...l,...u}));else{t(ue.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=Qe.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${K("toast.addedToBoard")} ${d.board_name}`:`${K("toast.addedToBoard")} ${a}`;t(nt({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(YL(i)),t(nt({...l,description:K("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROL_ADAPTER_IMAGE"){const{id:u}=s;t(AE({id:u,isEnabled:!0})),t(Hl({id:u,controlImage:i.image_name})),t(nt({...l,description:K("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(u_(i)),t(nt({...l,description:K("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(rS({nodeId:u,fieldName:c,value:i})),t(nt({...l,description:`${K("toast.setNodeField")} ${c}`}));return}}})},$Re=()=>{pe({matcher:ue.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=ae("images"),r={arg:{...$f(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(nt({title:K("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},NRe=()=>{pe({matcher:ue.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(VF(a))}})},DRe=()=>{pe({matcher:ue.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(VF(a))}})},LRe=ge("generation/initialImageSelected"),FRe=ge("generation/modelSelected"),BRe=()=>{pe({actionCreator:LRe,effect:(e,{dispatch:t})=>{if(!e.payload){t(nt(vs({title:K("toast.imageNotLoadedDesc"),status:"error"})));return}t(u_(e.payload)),t(nt(vs(K("toast.sentToImageToImage"))))}})},zRe=()=>{pe({actionCreator:FRe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=ae("models"),i=t(),o=bm.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;ps(i.lora.loras,(f,h)=>{f.base_model!==s&&(n(GF(h)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(cL(null)),c+=1),Aa(i.controlAdapters).forEach(f=>{var h;((h=f.model)==null?void 0:h.base_model)!==s&&(n(AE({id:f.id,isEnabled:!1})),c+=1)}),c>0&&n(nt(vs({title:K("toast.baseModelChangedCleared",{count:c}),status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(v6(1024)),n(b6(1024)),n(H6({width:1024,height:1024}))):(n(v6(512)),n(b6(512)),n(H6({width:512,height:512})))),n(sl(a))}})},Gg=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),hR=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),pR=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),gR=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),mR=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),yR=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),vR=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),M3=Yi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),jRe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Bs=e=>{const t=[];return e.forEach(n=>{const r={...Ye(n),id:jRe(n)};t.push(r)}),t},Xo=No.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${fp.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return hR.setAll(hR.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${fp.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return Gg.setAll(Gg.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:["Model"]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:["Model"]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:["Model"]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:["Model"]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:["Model"]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:["Model"]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:["Model"]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return pR.setAll(pR.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:Pr}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:Pr}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return gR.setAll(gR.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return mR.setAll(mR.getInitialState(),n)}}),getT2IAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"t2i_adapter"}}),providesTags:t=>{const n=[{type:"T2IAdapterModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"T2IAdapterModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return yR.setAll(yR.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return M3.setAll(M3.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:Pr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return vR.setAll(vR.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${fp.stringify(t,{})}`})}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:IUe,useGetOnnxModelsQuery:MUe,useGetControlNetModelsQuery:RUe,useGetIPAdapterModelsQuery:OUe,useGetT2IAdapterModelsQuery:$Ue,useGetLoRAModelsQuery:NUe,useGetTextualInversionModelsQuery:DUe,useGetVaeModelsQuery:LUe,useUpdateMainModelsMutation:FUe,useDeleteMainModelsMutation:BUe,useImportMainModelsMutation:zUe,useAddMainModelsMutation:jUe,useConvertMainModelsMutation:VUe,useMergeMainModelsMutation:UUe,useDeleteLoRAModelsMutation:GUe,useUpdateLoRAModelsMutation:HUe,useSyncModelsMutation:qUe,useGetModelsInFolderQuery:WUe,useGetCheckpointConfigsQuery:KUe}=Xo,VRe=()=>{pe({predicate:e=>Xo.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=ae("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=Gg.getSelectors().selectAll(e.payload);if(o.length===0){n(sl(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=bm.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(sl(s.data))}}),pe({predicate:e=>Xo.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=ae("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=Gg.getSelectors().selectAll(e.payload);if(o.length===0){n(d8(null)),n(nve(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=TE.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(d8(s.data))}}),pe({matcher:Xo.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=ae("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Gc(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=M3.getSelectors().selectAll(e.payload)[0];if(!a){n(sl(null));return}const s=lL.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(cL(s.data))}}),pe({matcher:Xo.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ae("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;ps(i,(o,a)=>{Gc(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(GF(a))})}}),pe({matcher:Xo.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ae("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),mie(t().controlAdapters).forEach(i=>{Gc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(Rx({id:i.id}))})}}),pe({matcher:Xo.endpoints.getT2IAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ae("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),_ie(t().controlAdapters).forEach(i=>{Gc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(Rx({id:i.id}))})}}),pe({matcher:Xo.endpoints.getIPAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ae("models").info({models:e.payload.entities},`IP Adapter models loaded (${e.payload.ids.length})`),vie(t().controlAdapters).forEach(i=>{Gc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(Rx({id:i.id}))})}}),pe({matcher:Xo.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{ae("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},URe=No.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),GRe=ai(Qoe,Rle,Ile,Mle,yE),HRe=()=>{pe({matcher:GRe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(Fx(!0));try{const l=t(URe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(Ole(u.prompts)),t($le(u.error)),t(q6(!1)),t(Fx(!1))}catch{t(q6(!0)),t(Fx(!1))}}})},zs=e=>e.$ref.split("/").slice(-1)[0],qRe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&ba(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&ba(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},WRe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&ba(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&ba(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},KRe=({schemaObject:e,baseField:t})=>{const n=ba(e.item_default)&&Lne(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},XRe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&ba(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&ba(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},QRe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&ba(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&ba(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},YRe=({schemaObject:e,baseField:t})=>{const n=ba(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},ZRe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},JRe=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},eOe=({schemaObject:e,baseField:t})=>{const n=hE(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},tOe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),nOe=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),rOe=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Dne(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},iOe=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),oOe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),aOe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),sOe=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),lOe=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),uOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),cOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),dOe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterModelField",default:e.default??void 0}),fOe=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),hOe=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),pOe=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),gOe=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),mOe=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),yOe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),vOe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),bOe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),_Oe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),SOe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),xOe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),wOe=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),COe=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),EOe=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),AOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),TOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),POe=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),kOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),IOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterPolymorphic",default:e.default??void 0}),MOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),ROe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterField",default:e.default??void 0}),OOe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterPolymorphic",default:e.default??void 0}),$Oe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),NOe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},DOe=({baseField:e})=>({...e,type:"Collection",default:[]}),LOe=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),FOe=({baseField:e})=>({...e,type:"Any",default:void 0}),BOe=({baseField:e})=>({...e,type:"MetadataItemField",default:void 0}),zOe=({baseField:e})=>({...e,type:"MetadataItemCollection",default:void 0}),jOe=({baseField:e})=>({...e,type:"MetadataItemPolymorphic",default:void 0}),VOe=({baseField:e})=>({...e,type:"MetadataField",default:void 0}),UOe=({baseField:e})=>({...e,type:"MetadataCollection",default:void 0}),GOe=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),HOe=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),qOe=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),WOe=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),R3=e=>{if(O0(e)){if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=O0(e.items)?e.items.type:zs(e.items);return En(t)?void 0:eye(t)?dA[t]:void 0}else if(!En(e.type))return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&au(t[0]))return zs(t[0])}else if(e.anyOf){const t=e.anyOf.filter(i=>!(O0(i)&&i.type==="null"));if(t.length===1){if(au(t[0]))return zs(t[0]);if(O0(t[0]))return R3(t[0])}let n,r;if(sI(t[0])){const i=t[0].items,o=t[1];au(i)&&au(o)?(n=zs(i),r=zs(o)):$0(i)&&$0(o)&&(n=i.type,r=o.type)}else if(sI(t[1])){const i=t[0],o=t[1].items;au(i)&&au(o)?(n=zs(i),r=zs(o)):$0(i)&&$0(o)&&(n=i.type,r=o.type)}if(n===r&&nye(n))return fz[n]}}else if(au(e))return zs(e)},AG={BoardField:fOe,Any:FOe,boolean:tOe,BooleanCollection:rOe,BooleanPolymorphic:nOe,ClipField:COe,Collection:DOe,CollectionItem:LOe,ColorCollection:qOe,ColorField:GOe,ColorPolymorphic:HOe,ConditioningCollection:xOe,ConditioningField:_Oe,ConditioningPolymorphic:SOe,ControlCollection:POe,ControlField:AOe,ControlNetModelField:uOe,ControlPolymorphic:TOe,DenoiseMaskField:mOe,enum:NOe,float:XRe,FloatCollection:YRe,FloatPolymorphic:QRe,ImageCollection:gOe,ImageField:hOe,ImagePolymorphic:pOe,integer:qRe,IntegerCollection:KRe,IntegerPolymorphic:WRe,IPAdapterCollection:MOe,IPAdapterField:kOe,IPAdapterModelField:cOe,IPAdapterPolymorphic:IOe,LatentsCollection:bOe,LatentsField:yOe,LatentsPolymorphic:vOe,LoRAModelField:lOe,MetadataItemField:BOe,MetadataItemCollection:zOe,MetadataItemPolymorphic:jOe,MetadataField:VOe,MetadataCollection:UOe,MainModelField:iOe,Scheduler:WOe,SDXLMainModelField:oOe,SDXLRefinerModelField:aOe,string:ZRe,StringCollection:eOe,StringPolymorphic:JRe,T2IAdapterCollection:$Oe,T2IAdapterField:ROe,T2IAdapterModelField:dOe,T2IAdapterPolymorphic:OOe,UNetField:wOe,VaeField:EOe,VaeModelField:sOe},KOe=e=>!!(e&&e in AG),XOe=(e,t,n,r)=>{var p;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l,ui_choice_labels:u,item_default:c}=t,d={input:Vh.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((p=e.required)==null?void 0:p.includes(n))??!1,ui_order:l,ui_choice_labels:u,item_default:c},f={name:n,title:t.title??(n?mE(n):""),description:t.description??"",fieldKind:"input",...d};if(!KOe(r))return;const h=AG[r];if(h)return h({schemaObject:t,baseField:f})},QOe=["id","type","use_cache"],YOe=["type"],ZOe=["IsIntermediate"],JOe=["graph","linear_ui_output"],e7e=(e,t)=>!!(QOe.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),t7e=e=>!!ZOe.includes(e),n7e=(e,t)=>!YOe.includes(t),r7e=e=>!JOe.includes(e.properties.type.default),i7e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(ufe).filter(r7e).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var S,x;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version;let h=!1;const p=Jp(s.properties,(w,C,T)=>{if(e7e(l,T))return ae("nodes").trace({node:l,fieldName:T,field:ft(C)},"Skipped reserved input field"),w;if(!lI(C))return ae("nodes").warn({node:l,propertyName:T,property:ft(C)},"Unhandled input property"),w;const A=C.ui_type??R3(C);if(!A)return ae("nodes").warn({node:l,fieldName:T,fieldType:A,field:ft(C)},"Missing input field type"),w;if(A==="WorkflowField")return h=!0,w;if(t7e(A))return ae("nodes").trace({node:l,fieldName:T,fieldType:A,field:ft(C)},`Skipping reserved input field type: ${A}`),w;if(!aI(A))return ae("nodes").warn({node:l,fieldName:T,fieldType:A,field:ft(C)},`Skipping unknown input field type: ${A}`),w;const I=XOe(s,C,T,A);return I?(w[T]=I,w):(ae("nodes").warn({node:l,fieldName:T,fieldType:A,field:ft(C)},"Skipping input field with no template"),w)},{}),m=s.output.$ref.split("/").pop();if(!m)return ae("nodes").warn({outputRefObject:ft(s.output)},"No output schema name found in ref object"),a;const _=(x=(S=e.components)==null?void 0:S.schemas)==null?void 0:x[m];if(!_)return ae("nodes").warn({outputSchemaName:m},"Output schema not found"),a;if(!cfe(_))return ae("nodes").error({outputSchema:ft(_)},"Invalid output schema"),a;const v=_.properties.type.default,y=Jp(_.properties,(w,C,T)=>{if(!n7e(l,T))return ae("nodes").trace({type:l,propertyName:T,property:ft(C)},"Skipped reserved output field"),w;if(!lI(C))return ae("nodes").warn({type:l,propertyName:T,property:ft(C)},"Unhandled output property"),w;const A=C.ui_type??R3(C);return aI(A)?(w[T]={fieldKind:"output",name:T,title:C.title??(T?mE(T):""),description:C.description??"",type:A,ui_hidden:C.ui_hidden??!1,ui_type:C.ui_type,ui_order:C.ui_order},w):(ae("nodes").warn({fieldName:T,fieldType:A,field:ft(C)},"Skipping unknown output field type"),w)},{}),g=s.properties.use_cache.default,b={title:u,type:l,version:f,tags:c,description:d,outputType:v,inputs:p,outputs:y,useCache:g,withWorkflow:h};return Object.assign(a,{[l]:b}),a},{})},o7e=()=>{pe({actionCreator:Pg.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=ae("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=i7e(i,o,a);r.debug({nodeTemplates:ft(s)},`Built ${n_(s)} node templates`),t(wz(s))}}),pe({actionCreator:Pg.rejected,effect:e=>{ae("system").error({error:ft(e.error)},"Problem retrieving OpenAPI Schema")}})},a7e=()=>{pe({actionCreator:kD,effect:(e,{dispatch:t,getState:n})=>{ae("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!n_(i.nodeTemplates)&&!s.includes("nodes")&&t(Pg()),a.isInitialized?t(No.util.resetApiState()):t(lve(!0)),t(yE(e.payload))}})},s7e=()=>{pe({actionCreator:ID,effect:(e,{dispatch:t})=>{ae("socketio").debug("Disconnected"),t(MD(e.payload))}})},l7e=()=>{pe({actionCreator:DD,effect:(e,{dispatch:t})=>{ae("socketio").trace(e.payload,"Generator progress"),t(SE(e.payload))}})},u7e=()=>{pe({actionCreator:$D,effect:(e,{dispatch:t})=>{ae("socketio").debug(e.payload,"Session complete"),t(ND(e.payload))}})},c7e=["load_image","image"],d7e=()=>{pe({actionCreator:bE,effect:async(e,{dispatch:t,getState:n})=>{const r=ae("socketio"),{data:i}=e.payload;r.debug({data:ft(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s,source_node_id:l}=i;if(pG(o)&&!c7e.includes(a.type)&&!qMe.includes(l)){const{image_name:u}=o.image,{canvas:c,gallery:d}=n(),f=t(ue.endpoints.getImageDTO.initiate(u,{forceRefetch:!0})),h=await f.unwrap();if(f.unsubscribe(),c.batchIds.includes(s)&&[Wu].includes(i.source_node_id)&&t(mle(h)),!h.is_intermediate){t(ue.util.updateQueryData("listImages",{board_id:h.board_id??"none",categories:Ln},m=>{Dt.addOne(m,h)})),t(Qe.util.updateQueryData("getBoardImagesTotal",h.board_id??"none",m=>{m.total+=1})),t(ue.util.invalidateTags([{type:"Board",id:h.board_id??"none"}]));const{shouldAutoSwitch:p}=d;p&&(d.galleryView!=="images"&&t(C5("images")),h.board_id&&h.board_id!==d.selectedBoardId&&t(I1({boardId:h.board_id,selectedImageName:h.image_name})),!h.board_id&&d.selectedBoardId!=="none"&&t(I1({boardId:"none",selectedImageName:h.image_name})),t(ha(h)))}}t(_E(e.payload))}})},f7e=()=>{pe({actionCreator:OD,effect:(e,{dispatch:t})=>{ae("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(r_(e.payload))}})},h7e=()=>{pe({actionCreator:UD,effect:(e,{dispatch:t})=>{ae("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(GD(e.payload))}})},p7e=()=>{pe({actionCreator:RD,effect:(e,{dispatch:t})=>{ae("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(vE(e.payload))}})},g7e=()=>{pe({actionCreator:LD,effect:(e,{dispatch:t})=>{const n=ae("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(FD(e.payload))}}),pe({actionCreator:BD,effect:(e,{dispatch:t})=>{const n=ae("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(zD(e.payload))}})},m7e=()=>{pe({actionCreator:HD,effect:async(e,{dispatch:t})=>{const n=ae("socketio"),{queue_item:r,batch_status:i,queue_status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r.item_id} status updated: ${r.status}`),t(ln.util.updateQueryData("listQueueItems",void 0,a=>{xu.updateOne(a,{id:r.item_id,changes:r})})),t(ln.util.updateQueryData("getQueueStatus",void 0,a=>{a&&Object.assign(a.queue,o)})),t(ln.util.updateQueryData("getBatchStatus",{batch_id:i.batch_id},()=>i)),t(ln.util.updateQueryData("getQueueItem",r.item_id,a=>{a&&Object.assign(a,r)})),t(ln.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus"])),t(i_(e.payload))}})},y7e=()=>{pe({actionCreator:jD,effect:(e,{dispatch:t})=>{ae("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(VD(e.payload))}})},v7e=()=>{pe({actionCreator:Bre,effect:(e,{dispatch:t})=>{ae("socketio").debug(e.payload,"Subscribed"),t(zre(e.payload))}})},b7e=()=>{pe({actionCreator:jre,effect:(e,{dispatch:t})=>{ae("socketio").debug(e.payload,"Unsubscribed"),t(Vre(e.payload))}})},_7e=()=>{pe({actionCreator:b6e,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(ue.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(ue.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(nt({title:K("toast.imageSaved"),status:"success"}))}catch(i){t(nt({title:K("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},XUe=["sd-1","sd-2","sdxl","sdxl-refiner"],S7e=["sd-1","sd-2","sdxl"],QUe=["sdxl"],YUe=["sd-1","sd-2"],ZUe=["sdxl-refiner"],x7e=()=>{pe({actionCreator:Nz,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(Xo.endpoints.getMainModels.initiate(S7e)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(sl(null));return}const u=Gg.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(sl(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(sl({base_model:c,model_name:d,model_type:f}))}catch{n(sl(null))}}}})},w7e=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:Yh,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Wu,type:"linear_ui_output",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}},o={id:"adhoc-esrgan-graph",nodes:{[Yh]:r,[Wu]:i},edges:[{source:{node_id:Yh,field:"image"},destination:{node_id:Wu,field:"image"}}]};return ks(o,{},Yh),Do(o,{esrgan_model:t}),o},_2=()=>KL(),S2=zL;function C7e(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function _R(e,t,n){e.loadNamespaces(t,TG(e,n))}function SR(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,TG(e,r))}function E7e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===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 A7e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(O3("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):E7e(e,t,n)}const T7e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,P7e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},k7e=e=>P7e[e],I7e=e=>e.replace(T7e,k7e);let $3={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:I7e};function M7e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$3={...$3,...e}}function R7e(){return $3}let PG;function O7e(e){PG=e}function $7e(){return PG}const N7e={type:"3rdParty",init(e){M7e(e.options.react),O7e(e)}},D7e=k.createContext();class L7e{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const F7e=(e,t)=>{const n=k.useRef();return k.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function kG(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=k.useContext(D7e)||{},o=n||r||$7e();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new L7e),!o){O3("You will need to pass in an i18next instance by using initReactI18next");const g=(S,x)=>typeof x=="string"?x:x&&typeof x=="object"&&typeof x.defaultValue=="string"?x.defaultValue:Array.isArray(S)?S[S.length-1]:S,b=[g,{},!1];return b.t=g,b.i18n={},b.ready=!1,b}o.options.react&&o.options.react.wait!==void 0&&O3("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...R7e(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>A7e(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=k.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=F7e(p),_=k.useRef(!0);k.useEffect(()=>{const{bindI18n:g,bindI18nStore:b}=a;_.current=!0,!c&&!s&&(t.lng?SR(o,t.lng,u,()=>{_.current&&h(d)}):_R(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),b&&o&&o.store.on(b,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(x=>o.off(x,S)),b&&o&&b.split(" ").forEach(x=>o.store.off(x,S))}},[o,p]);const v=k.useRef(!0);k.useEffect(()=>{_.current&&!v.current&&h(d),v.current=!1},[o,l]);const y=[f,o,c];if(y.t=f,y.i18n=o,y.ready=c,c||!c&&!s)return y;throw new Promise(g=>{t.lng?SR(o,t.lng,u,()=>g()):_R(o,u,()=>g())})}const B7e=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},z7e=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},j7e=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},IG=e=>Gn(wT,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=B7e(e,i),a=z7e(o,i),s=r.includes("x2")?2:4,l=j7e(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},zm),JUe=e=>{const{t}=kG(),n=k.useMemo(()=>IG(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=S2(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},V7e=ge("upscale/upscaleRequested"),U7e=()=>{pe({actionCreator:V7e,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=ae("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=IG(i)(a);if(!s){r.error({imageDTO:i},K(l??"parameters.isAllowedToUpscale.tooLarge")),t(nt({title:K(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d={prepend:!0,batch:{graph:w7e({image_name:o,esrganModelName:u,autoAddBoardId:c}),runs:1}};try{const h=t(ln.endpoints.enqueueBatch.initiate(d,{fixedCacheKey:"enqueueBatch"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:ft(p)},K("queue.graphQueued"))}catch(h){if(r.error({enqueueBatchArg:ft(d)},K("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(nt({title:K("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(nt({title:K("queue.graphFailedToQueue"),status:"error"}))}}})},G7e=Ta(null),H7e=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,db=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(H7e);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},xR=e=>e==="*"||e==="x"||e==="X",wR=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},q7e=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],W7e=(e,t)=>{if(xR(e)||xR(t))return 0;const[n,r]=q7e(wR(e),wR(t));return n>r?1:n{for(let n=0;n{const n=db(e),r=db(t),i=n.pop(),o=r.pop(),a=bd(n,r);return a!==0?a:i&&o?bd(i.split("."),o.split(".")):i||o?i?-1:1:0},K7e=(e,t,n)=>{X7e(n);const r=MG(e,t);return RG[n].includes(r)},RG={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},CR=Object.keys(RG),X7e=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(CR.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${CR.join("|")}`)},hv=(e,t)=>{if(t=t.replace(/([><=]+)\s+/g,"$1"),t.includes("||"))return t.split("||").some(_=>hv(e,_));if(t.includes(" - ")){const[_,v]=t.split(" - ",2);return hv(e,`>=${_} <=${v}`)}else if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every(_=>hv(e,_));const n=t.match(/^([<>=~^]+)/),r=n?n[1]:"=";if(r!=="^"&&r!=="~")return K7e(e,t,r);const[i,o,a,,s]=db(e),[l,u,c,,d]=db(t),f=[i,o,a],h=[l,u??"x",c??"x"];if(d&&(!s||bd(f,h)!==0||bd(s.split("."),d.split("."))===-1))return!1;const p=h.findIndex(_=>_!=="0")+1,m=r==="~"?2:p>1?p:1;return!(bd(f.slice(0,m),h.slice(0,m))!==0||bd(f.slice(m),h.slice(m))===-1)},Q7e=(e,t)=>{const n=Ye(e),{nodes:r,edges:i}=n,o=[],a=r.filter(w5),s=gE(a,"id");return r.forEach(l=>{if(!w5(l))return;const u=t[l.data.type];if(!u){o.push({message:`${ce.t("nodes.node")} "${l.data.type}" ${ce.t("nodes.skipped")}`,issues:[`${ce.t("nodes.nodeType")}"${l.data.type}" ${ce.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&MG(u.version,l.data.version)!==0){o.push({message:`${ce.t("nodes.node")} "${l.data.type}" ${ce.t("nodes.mismatchedVersion")}`,issues:[`${ce.t("nodes.node")} "${l.data.type}" v${l.data.version} ${ce.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:ft(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${ce.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${ce.t("nodes.doesNotExist")}`):f.push(`${ce.t("nodes.outputNode")} ${l.source} ${ce.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${ce.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${ce.t("nodes.doesNotExist")}`):f.push(`${ce.t("nodes.inputNode")} ${l.target} ${ce.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${ce.t("nodes.sourceNode")} "${l.source}" ${ce.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${ce.t("nodes.sourceNode")}"${l.target}" ${ce.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},Y7e=()=>{pe({actionCreator:o1e,effect:(e,{dispatch:t,getState:n})=>{const r=ae("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=Q7e(i,o);t(Jye(a)),s.length?(t(nt(vs({title:K("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(nt(vs({title:K("toast.workflowLoaded"),status:"success"}))),t(Nz("nodes")),requestAnimationFrame(()=>{var l;(l=G7e.get())==null||l.fitView()})}})},Z7e={Any:void 0,enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterCollection:[],IPAdapterField:void 0,IPAdapterModelField:void 0,IPAdapterPolymorphic:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,MetadataItemField:void 0,MetadataItemCollection:[],MetadataItemPolymorphic:void 0,MetadataField:void 0,MetadataCollection:[],LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",T2IAdapterCollection:[],T2IAdapterField:void 0,T2IAdapterModelField:void 0,T2IAdapterPolymorphic:void 0,UNetField:void 0,VaeField:void 0,VaeModelField:void 0},J7e=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??Z7e[t.type],n},Ww={dragHandle:`.${dz}`},e$e=(e,t,n)=>{const r=yl();if(e==="current_image")return{...Ww,id:r,type:"current_image",position:t,data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(e==="notes")return{...Ww,id:r,type:"notes",position:t,data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};if(n===void 0){console.error(`Unable to find template ${e}.`);return}const i=Jp(n.inputs,(s,l,u)=>{const c=yl(),d=J7e(c,l);return s[u]=d,s},{}),o=Jp(n.outputs,(s,l,u)=>{const d={id:yl(),name:u,type:l.type,fieldKind:"output"};return s[u]=d,s},{});return{...Ww,id:r,type:"invocation",position:t,data:{id:r,type:e,version:n.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:e!=="save_image",inputs:i,outputs:o,useCache:n.useCache}}},t$e=()=>{const e=_2(),t=S2(r=>r.system.toastQueue),n=rPe();return k.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(ove())},[e,n,t]),null},n$e=()=>{const e=_2();return k.useCallback(n=>e(nt(vs(n))),[e])},eGe=k.memo(t$e),fb=(e,t)=>!on(e)||!t?!1:e.data.version!==t.version,OG=(e,t)=>{if(!fb(e,t)||!on(e)||!t||!e.data.version)return!1;const r=gfe.parse(t.version).major;return hv(e.data.version,`^${r}`)},$G=(e,t)=>{if(!OG(e,t)||!on(e)||!t||!e.data.version)return;const r=e$e(e.data.type,e.position,t),i=Ye(e);return i.data.version=t.version,vD(i,r),i},tGe=e=>{const t=_2(),n=n$e(),{t:r}=kG(),i=k.useMemo(()=>Gn(wT,({nodes:c})=>{const d=c.nodes.find(h=>h.id===e),f=c.nodeTemplates[(d==null?void 0:d.data.type)??""];return{node:d,nodeTemplate:f}},zm),[e]),{node:o,nodeTemplate:a}=S2(i),s=k.useMemo(()=>fb(o,a),[o,a]),l=k.useMemo(()=>OG(o,a),[o,a]),u=k.useCallback(()=>{const c=fb(o,a),d=$G(o,a);if(!d){c&&n({title:r("nodes.unableToUpdateNodes",{count:1})});return}t(xz({nodeId:d.id,node:d}))},[t,o,a,r,n]);return{needsUpdate:s,mayUpdate:l,updateNode:u}},r$e=()=>{pe({actionCreator:a1e,effect:(e,{dispatch:t,getState:n})=>{const r=ae("nodes"),i=n().nodes.nodes,o=n().nodes.nodeTemplates;let a=0;i.forEach(s=>{const l=o[s.data.type],u=fb(s,l),c=$G(s,l);if(!c){u&&a++;return}t(xz({nodeId:c.id,node:c}))}),a&&(r.warn(`Unable to update ${a} nodes. Please report this issue.`),t(nt(vs({title:K("nodes.unableToUpdateNodes",{count:a})}))))}})},NG=iN(),pe=NG.startListening;ORe();$Re();BRe();CRe();ERe();ARe();TRe();PRe();f6e();RRe();NRe();DRe();iRe();SRe();fRe();h1e();c6e();OMe();kMe();P6e();IMe();T6e();E6e();RMe();_7e();d1e();l7e();u7e();d7e();f7e();p7e();a7e();s7e();v7e();b7e();g7e();y7e();h7e();m7e();DMe();NMe();xRe();wRe();IRe();MRe();h6e();o7e();Y7e();r$e();kRe();zRe();m1e();VRe();p1e();f1e();U7e();x7e();HRe();const i$e={canvas:wle,gallery:Cfe,generation:Zoe,nodes:eve,postprocessing:tve,system:uve,config:Fre,ui:pve,hotkeys:hve,controlAdapters:kie,dynamicPrompts:Nle,deleteImageModal:Ple,changeBoardModal:Ele,lora:Tfe,modelmanager:fve,sdxl:rve,queue:dae,[No.reducerPath]:No.reducer},o$e=Mf(i$e),a$e=Bve(o$e),s$e=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlAdapters","dynamicPrompts","lora","modelmanager"],DG=F$({reducer:a$e,enhancers:e=>e.concat(zve(window.localStorage,s$e,{persistDebounce:300,serialize:Zve,unserialize:e1e,prefix:jve})).concat(aN()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(No.middleware).concat(vve).prepend(NG.middleware),devTools:{actionSanitizer:s1e,stateSanitizer:u1e,trace:!0,predicate:(e,t)=>!l1e.includes(t.type)}}),wT=e=>e;PF.set(DG);const l$e=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{ae("socketio").debug("Connected"),r(kD());const o=Nn.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(nt(vs({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(ID())}),t.on("invocation_started",i=>{r(RD({data:i}))}),t.on("generator_progress",i=>{r(DD({data:i}))}),t.on("invocation_error",i=>{r(OD({data:i}))}),t.on("invocation_complete",i=>{r(bE({data:i}))}),t.on("graph_execution_state_complete",i=>{r($D({data:i}))}),t.on("model_load_started",i=>{r(LD({data:i}))}),t.on("model_load_completed",i=>{r(BD({data:i}))}),t.on("session_retrieval_error",i=>{r(jD({data:i}))}),t.on("invocation_retrieval_error",i=>{r(UD({data:i}))}),t.on("queue_item_status_changed",i=>{r(HD({data:i}))})},wa=Object.create(null);wa.open="0";wa.close="1";wa.ping="2";wa.pong="3";wa.message="4";wa.upgrade="5";wa.noop="6";const pv=Object.create(null);Object.keys(wa).forEach(e=>{pv[wa[e]]=e});const N3={type:"error",data:"parser error"},LG=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FG=typeof ArrayBuffer=="function",BG=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,CT=({type:e,data:t},n,r)=>LG&&t instanceof Blob?n?r(t):ER(t,r):FG&&(t instanceof ArrayBuffer||BG(t))?n?r(t):ER(new Blob([t]),r):r(wa[e]+(t||"")),ER=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function AR(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Kw;function u$e(e,t){if(LG&&e.data instanceof Blob)return e.data.arrayBuffer().then(AR).then(t);if(FG&&(e.data instanceof ArrayBuffer||BG(e.data)))return t(AR(e.data));CT(e,!1,n=>{Kw||(Kw=new TextEncoder),t(Kw.encode(n))})}const TR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zh=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),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},d$e=typeof ArrayBuffer=="function",ET=(e,t)=>{if(typeof e!="string")return{type:"message",data:zG(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:f$e(e.substring(1),t)}:pv[n]?e.length>1?{type:pv[n],data:e.substring(1)}:{type:pv[n]}:N3},f$e=(e,t)=>{if(d$e){const n=c$e(e);return zG(n,t)}else return{base64:!0,data:e}},zG=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},jG=String.fromCharCode(30),h$e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{CT(o,!1,s=>{r[a]=s,++i===n&&t(r.join(jG))})})},p$e=(e,t)=>{const n=e.split(jG),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Xw;function by(e){return e.reduce((t,n)=>t+n.length,0)}function _y(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(N3);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(by(n)e){s.enqueue(N3);break}}}})}const VG=4;function Cn(e){if(e)return y$e(e)}function y$e(e){for(var t in Cn.prototype)e[t]=Cn.prototype[t];return e}Cn.prototype.on=Cn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Cn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Cn.prototype.off=Cn.prototype.removeListener=Cn.prototype.removeAllListeners=Cn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function UG(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const v$e=Gi.setTimeout,b$e=Gi.clearTimeout;function x2(e,t){t.useNativeTimers?(e.setTimeoutFn=v$e.bind(Gi),e.clearTimeoutFn=b$e.bind(Gi)):(e.setTimeoutFn=Gi.setTimeout.bind(Gi),e.clearTimeoutFn=Gi.clearTimeout.bind(Gi))}const _$e=1.33;function S$e(e){return typeof e=="string"?x$e(e):Math.ceil((e.byteLength||e.size)*_$e)}function x$e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function w$e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function C$e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function HG(){const e=IR(+new Date);return e!==kR?(PR=0,kR=e):e+"."+IR(PR++)}for(;Sy{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)};p$e(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,h$e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=HG()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new qd(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}}let qd=class gv extends Cn{constructor(t,n){super(),x2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=UG(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new WG(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=gv.requestsCount++,gv.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=P$e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete gv.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()}};qd.requestsCount=0;qd.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",MR);else if(typeof addEventListener=="function"){const e="onpagehide"in Gi?"pagehide":"unload";addEventListener(e,MR,!1)}}function MR(){for(let e in qd.requests)qd.requests.hasOwnProperty(e)&&qd.requests[e].abort()}const TT=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),xy=Gi.WebSocket||Gi.MozWebSocket,RR=!0,M$e="arraybuffer",OR=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class R$e extends AT{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=OR?{}:UG(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=RR&&!OR?n?new xy(t,n):new xy(t):new xy(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,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{RR&&this.ws.send(o)}catch{}i&&TT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=HG()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!xy}}class O$e extends AT{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=m$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=g$e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&TT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const $$e={websocket:R$e,webtransport:O$e,polling:I$e},N$e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,D$e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function L3(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=N$e.exec(e||""),o={},a=14;for(;a--;)o[D$e[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=L$e(o,o.path),o.queryKey=F$e(o,o.query),o}function L$e(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 F$e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let KG=class Xc extends Cn{constructor(t,n={}){super(),this.binaryType=M$e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=L3(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=L3(n.host).host),x2(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","webtransport"],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:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=C$e(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=VG,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new $$e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Xc.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;Xc.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Xc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{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),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Xc.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){Xc.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,XG=Object.prototype.toString,V$e=typeof Blob=="function"||typeof Blob<"u"&&XG.call(Blob)==="[object BlobConstructor]",U$e=typeof File=="function"||typeof File<"u"&&XG.call(File)==="[object FileConstructor]";function PT(e){return z$e&&(e instanceof ArrayBuffer||j$e(e))||V$e&&e instanceof Blob||U$e&&e instanceof File}function mv(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{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._queueSeq++,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(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}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:Ze.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 Ze.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 Ze.EVENT:case Ze.BINARY_EVENT:this.onevent(t);break;case Ze.ACK:case Ze.BINARY_ACK:this.onack(t);break;case Ze.DISCONNECT:this.ondisconnect();break;case Ze.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:Ze.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"),this._drainQueue(!0)}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:Ze.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}qf.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};qf.prototype.reset=function(){this.attempts=0};qf.prototype.setMin=function(e){this.ms=e};qf.prototype.setMax=function(e){this.max=e};qf.prototype.setJitter=function(e){this.jitter=e};class z3 extends Cn{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,x2(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 qf({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||Q$e;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 KG(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=vo(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=vo(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(vo(t,"ping",this.onping.bind(this)),vo(t,"data",this.ondata.bind(this)),vo(t,"error",this.onerror.bind(this)),vo(t,"close",this.onclose.bind(this)),vo(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){TT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new QG(this,t,n),this.nsps[t]=r),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(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Rh={};function yv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=B$e(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=Rh[i]&&o in Rh[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new z3(r,t):(Rh[i]||(Rh[i]=new z3(r,t)),l=Rh[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(yv,{Manager:z3,Socket:QG,io:yv,connect:yv});const NR=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=mg.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=gg.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=yv(n,r);return a=>s=>l=>{e||(l$e({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},Z$e=""+new URL("logo-13003d72.png",import.meta.url).href,J$e=()=>q.jsxs(eT,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[q.jsx(JA,{src:Z$e,w:"8rem",h:"8rem"}),q.jsx(QA,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),eNe=k.memo(J$e);function j3(e){"@babel/helpers - typeof";return j3=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},j3(e)}var YG=[],tNe=YG.forEach,nNe=YG.slice;function V3(e){return tNe.call(nNe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function ZG(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":j3(XMLHttpRequest))==="object"}function rNe(e){return!!e&&typeof e.then=="function"}function iNe(e){return rNe(e)?e:Promise.resolve(e)}function oNe(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 U3={exports:{}},wy={exports:{}},DR;function aNe(){return DR||(DR=1,function(e,t){var n=typeof self<"u"?self:Ve,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(E){return E&&DataView.prototype.isPrototypeOf(E)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var P={next:function(){var N=E.shift();return{done:N===void 0,value:N}}};return s.iterable&&(P[Symbol.iterator]=function(){return P}),P}function p(E){this.map={},E instanceof p?E.forEach(function(P,N){this.append(N,P)},this):Array.isArray(E)?E.forEach(function(P){this.append(P[0],P[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(P){this.append(P,E[P])},this)}p.prototype.append=function(E,P){E=d(E),P=f(P);var N=this.map[E];this.map[E]=N?N+", "+P:P},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,P){this.map[d(E)]=f(P)},p.prototype.forEach=function(E,P){for(var N in this.map)this.map.hasOwnProperty(N)&&E.call(P,this.map[N],N,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(P,N){E.push(N)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(P){E.push(P)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(P,N){E.push([N,P])}),h(E)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function _(E){return new Promise(function(P,N){E.onload=function(){P(E.result)},E.onerror=function(){N(E.error)}})}function v(E){var P=new FileReader,N=_(P);return P.readAsArrayBuffer(E),N}function y(E){var P=new FileReader,N=_(P);return P.readAsText(E),N}function g(E){for(var P=new Uint8Array(E),N=new Array(P.length),L=0;L-1?P:E}function C(E,P){P=P||{};var N=P.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,P.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!N&&E._bodyInit!=null&&(N=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new p(P.headers)),this.method=w(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&N)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(N)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function T(E){var P=new FormData;return E.trim().split("&").forEach(function(N){if(N){var L=N.split("="),O=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");P.append(decodeURIComponent(O),decodeURIComponent(R))}}),P}function A(E){var P=new p,N=E.replace(/\r?\n[\t ]+/g," ");return N.split(/\r?\n/).forEach(function(L){var O=L.split(":"),R=O.shift().trim();if(R){var $=O.join(":").trim();P.append(R,$)}}),P}S.call(C.prototype);function I(E,P){P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in P?P.statusText:"OK",this.headers=new p(P.headers),this.url=P.url||"",this._initBody(E)}S.call(I.prototype),I.prototype.clone=function(){return new I(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},I.error=function(){var E=new I(null,{status:0,statusText:""});return E.type="error",E};var D=[301,302,303,307,308];I.redirect=function(E,P){if(D.indexOf(P)===-1)throw new RangeError("Invalid status code");return new I(null,{status:P,headers:{location:E}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(P,N){this.message=P,this.name=N;var L=Error(P);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function M(E,P){return new Promise(function(N,L){var O=new C(E,P);if(O.signal&&O.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function $(){R.abort()}R.onload=function(){var z={status:R.status,statusText:R.statusText,headers:A(R.getAllResponseHeaders()||"")};z.url="responseURL"in R?R.responseURL:z.headers.get("X-Request-URL");var V="response"in R?R.response:R.responseText;N(new I(V,z))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(O.method,O.url,!0),O.credentials==="include"?R.withCredentials=!0:O.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),O.headers.forEach(function(z,V){R.setRequestHeader(V,z)}),O.signal&&(O.signal.addEventListener("abort",$),R.onreadystatechange=function(){R.readyState===4&&O.signal.removeEventListener("abort",$)}),R.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return M.polyfill=!0,o.fetch||(o.fetch=M,o.Headers=p,o.Request=C,o.Response=I),a.Headers=p,a.Request=C,a.Response=I,a.fetch=M,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}(wy,wy.exports)),wy.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Ve<"u"&&Ve.fetch?n=Ve.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof oNe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||aNe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(U3,U3.exports);var JG=U3.exports;const eH=Bl(JG),LR=iO({__proto__:null,default:eH},[JG]);function hb(e){"@babel/helpers - typeof";return hb=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},hb(e)}var ls;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?ls=global.fetch:typeof window<"u"&&window.fetch?ls=window.fetch:ls=fetch);var Hg;ZG()&&(typeof global<"u"&&global.XMLHttpRequest?Hg=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Hg=window.XMLHttpRequest));var pb;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?pb=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(pb=window.ActiveXObject));!ls&&LR&&!Hg&&!pb&&(ls=eH||LR);typeof ls!="function"&&(ls=void 0);var G3=function(t,n){if(n&&hb(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},FR=function(t,n,r){ls(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)},BR=!1,sNe=function(t,n,r,i){t.queryStringParams&&(n=G3(n,t.queryStringParams));var o=V3({},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=V3({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},BR?{}:a);try{FR(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]}),FR(n,s,i),BR=!0}catch(u){i(u)}}},lNe=function(t,n,r,i){r&&hb(r)==="object"&&(r=G3("",r).slice(1)),t.queryStringParams&&(n=G3(n,t.queryStringParams));try{var o;Hg?o=new Hg:o=new pb("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)}},uNe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},ls&&n.indexOf("file:")!==0)return sNe(t,n,r,i);if(ZG()||typeof ActiveXObject=="function")return lNe(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function qg(e){"@babel/helpers - typeof";return qg=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},qg(e)}function cNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zR(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};cNe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return dNe(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=V3(i,this.options||{},pNe()),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=iNe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{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,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{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(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();nH.type="backend";ce.use(nH).use(N7e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const w2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wf(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function IT(e){return"nodeType"in e}function zr(e){var t,n;return e?Wf(e)?e:IT(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function MT(e){const{Document:t}=zr(e);return e instanceof t}function qm(e){return Wf(e)?!1:e instanceof zr(e).HTMLElement}function gNe(e){return e instanceof zr(e).SVGElement}function Kf(e){return e?Wf(e)?e.document:IT(e)?MT(e)?e:qm(e)?e.ownerDocument:document:document:document}const Ca=w2?k.useLayoutEffect:k.useEffect;function C2(e){const t=k.useRef(e);return Ca(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Wg(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return Ca(()=>{n.current!==e&&(n.current=e)},t),n}function Wm(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function gb(e){const t=C2(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function mb(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let Qw={};function E2(e,t){return k.useMemo(()=>{if(t)return t;const n=Qw[e]==null?0:Qw[e]+1;return Qw[e]=n,e+"-"+n},[e,t])}function rH(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const Wd=rH(1),yb=rH(-1);function yNe(e){return"clientX"in e&&"clientY"in e}function RT(e){if(!e)return!1;const{KeyboardEvent:t}=zr(e.target);return t&&e instanceof t}function vNe(e){if(!e)return!1;const{TouchEvent:t}=zr(e.target);return t&&e instanceof t}function Kg(e){if(vNe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return yNe(e)?{x:e.clientX,y:e.clientY}:null}const Xg=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Xg.Translate.toString(e),Xg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),jR="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bNe(e){return e.matches(jR)?e:e.querySelector(jR)}const _Ne={display:"none"};function SNe(e){let{id:t,value:n}=e;return bt.createElement("div",{id:t,style:_Ne},n)}const xNe={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function wNe(e){let{id:t,announcement:n}=e;return bt.createElement("div",{id:t,style:xNe,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function CNe(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const iH=k.createContext(null);function ENe(e){const t=k.useContext(iH);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function ANe(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const TNe={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},PNe={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function kNe(e){let{announcements:t=PNe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=TNe}=e;const{announce:o,announcement:a}=CNe(),s=E2("DndLiveRegion"),[l,u]=k.useState(!1);if(k.useEffect(()=>{u(!0)},[]),ENe(k.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=bt.createElement(bt.Fragment,null,bt.createElement(SNe,{id:r,value:i.draggable}),bt.createElement(wNe,{id:s,announcement:a}));return n?pi.createPortal(c,n):c}var Pn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Pn||(Pn={}));function vb(){}function VR(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function INe(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Lo=Object.freeze({x:0,y:0});function MNe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function RNe(e,t){const n=Kg(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function ONe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $Ne(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function NNe(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function DNe(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function LNe(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=LNe(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort($Ne)};function BNe(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const zNe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&BNe(r,s)){const u=NNe(s).reduce((d,f)=>d+MNe(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(ONe)};function jNe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function oH(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Lo}function VNe(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const UNe=VNe(1);function aH(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function GNe(e,t,n){const r=aH(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const HNe={ignoreTransform:!1};function Km(e,t){t===void 0&&(t=HNe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=zr(e).getComputedStyle(e);u&&(n=GNe(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function UR(e){return Km(e,{ignoreTransform:!0})}function qNe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function WNe(e,t){return t===void 0&&(t=zr(e).getComputedStyle(e)),t.position==="fixed"}function KNe(e,t){t===void 0&&(t=zr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function OT(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(MT(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!qm(i)||gNe(i)||n.includes(i))return n;const o=zr(e).getComputedStyle(i);return i!==e&&KNe(i,o)&&n.push(i),WNe(i,o)?n:r(i.parentNode)}return e?r(e):n}function sH(e){const[t]=OT(e,1);return t??null}function Yw(e){return!w2||!e?null:Wf(e)?e:IT(e)?MT(e)||e===Kf(e).scrollingElement?window:qm(e)?e:null:null}function lH(e){return Wf(e)?e.scrollX:e.scrollLeft}function uH(e){return Wf(e)?e.scrollY:e.scrollTop}function H3(e){return{x:lH(e),y:uH(e)}}var zn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zn||(zn={}));function cH(e){return!w2||!e?!1:e===document.scrollingElement}function dH(e){const t={x:0,y:0},n=cH(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const XNe={x:.2,y:.2};function QNe(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=XNe);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=dH(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=zn.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=zn.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=zn.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=zn.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function YNe(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function fH(e){return e.reduce((t,n)=>Wd(t,H3(n)),Lo)}function ZNe(e){return e.reduce((t,n)=>t+lH(n),0)}function JNe(e){return e.reduce((t,n)=>t+uH(n),0)}function hH(e,t){if(t===void 0&&(t=Km),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);sH(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const eDe=[["x",["left","right"],ZNe],["y",["top","bottom"],JNe]];class $T{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=OT(n),i=fH(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of eDe)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class wp{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function tDe(e){const{EventTarget:t}=zr(e);return e instanceof t?e:Kf(e)}function Zw(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ji;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ji||(ji={}));function GR(e){e.preventDefault()}function nDe(e){e.stopPropagation()}var At;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(At||(At={}));const pH={start:[At.Space,At.Enter],cancel:[At.Esc],end:[At.Space,At.Enter]},rDe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case At.Right:return{...n,x:n.x+25};case At.Left:return{...n,x:n.x-25};case At.Down:return{...n,y:n.y+25};case At.Up:return{...n,y:n.y-25}}};class gH{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new wp(Kf(n)),this.windowListeners=new wp(zr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ji.Resize,this.handleCancel),this.windowListeners.add(ji.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ji.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&hH(r),n(Lo)}handleKeyDown(t){if(RT(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=pH,coordinateGetter:a=rDe,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Lo;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=yb(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:v,isRight:y,isLeft:g,isBottom:b,maxScroll:S,minScroll:x}=dH(m),w=YNe(m),C={x:Math.min(_===At.Right?w.right-w.width/2:w.right,Math.max(_===At.Right?w.left:w.left+w.width/2,d.x)),y:Math.min(_===At.Down?w.bottom-w.height/2:w.bottom,Math.max(_===At.Down?w.top:w.top+w.height/2,d.y))},T=_===At.Right&&!y||_===At.Left&&!g,A=_===At.Down&&!b||_===At.Up&&!v;if(T&&C.x!==d.x){const I=m.scrollLeft+f.x,D=_===At.Right&&I<=S.x||_===At.Left&&I>=x.x;if(D&&!f.y){m.scrollTo({left:I,behavior:s});return}D?h.x=m.scrollLeft-I:h.x=_===At.Right?m.scrollLeft-S.x:m.scrollLeft-x.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(A&&C.y!==d.y){const I=m.scrollTop+f.y,D=_===At.Down&&I<=S.y||_===At.Up&&I>=x.y;if(D&&!f.x){m.scrollTo({top:I,behavior:s});return}D?h.y=m.scrollTop-I:h.y=_===At.Down?m.scrollTop-S.y:m.scrollTop-x.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,Wd(yb(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gH.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=pH,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function HR(e){return!!(e&&"distance"in e)}function qR(e){return!!(e&&"delay"in e)}class NT{constructor(t,n,r){var i;r===void 0&&(r=tDe(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Kf(a),this.documentListeners=new wp(this.document),this.listeners=new wp(r),this.windowListeners=new wp(zr(a)),this.initialCoordinates=(i=Kg(o))!=null?i:Lo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ji.Resize,this.handleCancel),this.windowListeners.add(ji.DragStart,GR),this.windowListeners.add(ji.VisibilityChange,this.handleCancel),this.windowListeners.add(ji.ContextMenu,GR),this.documentListeners.add(ji.Keydown,this.handleKeydown),n){if(HR(n))return;if(qR(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ji.Click,nDe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ji.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=Kg(t))!=null?n:Lo,u=yb(i,l);if(!r&&s){if(qR(s))return Zw(u,s.tolerance)?this.handleCancel():void 0;if(HR(s))return s.tolerance!=null&&Zw(u,s.tolerance)?this.handleCancel():Zw(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===At.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const iDe={move:{name:"pointermove"},end:{name:"pointerup"}};class mH extends NT{constructor(t){const{event:n}=t,r=Kf(n.target);super(t,iDe,r)}}mH.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const oDe={move:{name:"mousemove"},end:{name:"mouseup"}};var q3;(function(e){e[e.RightClick=2]="RightClick"})(q3||(q3={}));class yH extends NT{constructor(t){super(t,oDe,Kf(t.event.target))}}yH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===q3.RightClick?!1:(r==null||r({event:n}),!0)}}];const Jw={move:{name:"touchmove"},end:{name:"touchend"}};class vH extends NT{constructor(t){super(t,Jw)}static setup(){return window.addEventListener(Jw.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Jw.move.name,t)};function t(){}}}vH.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Cp;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Cp||(Cp={}));var bb;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bb||(bb={}));function aDe(e){let{acceleration:t,activator:n=Cp.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=bb.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=lDe({delta:d,disabled:!o}),[p,m]=mNe(),_=k.useRef({x:0,y:0}),v=k.useRef({x:0,y:0}),y=k.useMemo(()=>{switch(n){case Cp.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Cp.DraggableRect:return i}},[n,i,l]),g=k.useRef(null),b=k.useCallback(()=>{const x=g.current;if(!x)return;const w=_.current.x*v.current.x,C=_.current.y*v.current.y;x.scrollBy(w,C)},[]),S=k.useMemo(()=>s===bb.TreeOrder?[...u].reverse():u,[s,u]);k.useEffect(()=>{if(!o||!u.length||!y){m();return}for(const x of S){if((r==null?void 0:r(x))===!1)continue;const w=u.indexOf(x),C=c[w];if(!C)continue;const{direction:T,speed:A}=QNe(x,C,y,t,f);for(const I of["x","y"])h[I][T[I]]||(A[I]=0,T[I]=0);if(A.x>0||A.y>0){m(),g.current=x,p(b,a),_.current=A,v.current=T;return}}_.current={x:0,y:0},v.current={x:0,y:0},m()},[t,b,r,m,o,a,JSON.stringify(y),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const sDe={x:{[zn.Backward]:!1,[zn.Forward]:!1},y:{[zn.Backward]:!1,[zn.Forward]:!1}};function lDe(e){let{delta:t,disabled:n}=e;const r=mb(t);return Wm(i=>{if(n||!r||!i)return sDe;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[zn.Backward]:i.x[zn.Backward]||o.x===-1,[zn.Forward]:i.x[zn.Forward]||o.x===1},y:{[zn.Backward]:i.y[zn.Backward]||o.y===-1,[zn.Forward]:i.y[zn.Forward]||o.y===1}}},[n,t,r])}function uDe(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Wm(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function cDe(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var Qg;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qg||(Qg={}));var W3;(function(e){e.Optimized="optimized"})(W3||(W3={}));const WR=new Map;function dDe(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=k.useState(null),{frequency:s,measure:l,strategy:u}=i,c=k.useRef(e),d=_(),f=Wg(d),h=k.useCallback(function(v){v===void 0&&(v=[]),!f.current&&a(y=>y===null?v:y.concat(v.filter(g=>!y.includes(g))))},[f]),p=k.useRef(null),m=Wm(v=>{if(d&&!n)return WR;if(!v||v===WR||c.current!==e||o!=null){const y=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){y.set(g.id,g.rect.current);continue}const b=g.node.current,S=b?new $T(l(b),b):null;g.rect.current=S,S&&y.set(g.id,S)}return y}return v},[e,o,n,d,l]);return k.useEffect(()=>{c.current=e},[e]),k.useEffect(()=>{d||h()},[n,d]),k.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Qg.Always:return!1;case Qg.BeforeDragging:return n;default:return!n}}}function DT(e,t){return Wm(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function fDe(e,t){return DT(e,t)}function hDe(e){let{callback:t,disabled:n}=e;const r=C2(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function A2(e){let{callback:t,disabled:n}=e;const r=C2(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function pDe(e){return new $T(Km(e),e)}function KR(e,t,n){t===void 0&&(t=pDe);const[r,i]=k.useReducer(s,null),o=hDe({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=A2({callback:i});return Ca(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function gDe(e){const t=DT(e);return oH(e,t)}const XR=[];function mDe(e){const t=k.useRef(e),n=Wm(r=>e?r&&r!==XR&&e&&t.current&&e.parentNode===t.current.parentNode?r:OT(e):XR,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function yDe(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const a=Yw(o.target);a&&n(s=>s?(s.set(a,H3(a)),new Map(s)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=Yw(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,H3(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=Yw(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>Wd(o,a),Lo):fH(e):Lo,[e,t])}function QR(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==Lo;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?yb(e,n.current):Lo}function vDe(e){k.useEffect(()=>{if(!w2)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function bDe(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function bH(e){return k.useMemo(()=>e?qNe(e):null,[e])}const eC=[];function _De(e,t){t===void 0&&(t=Km);const[n]=e,r=bH(n?zr(n):null),[i,o]=k.useReducer(s,eC),a=A2({callback:o});return e.length>0&&i===eC&&o(),Ca(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>cH(l)?r:new $T(t(l),l)):eC}}function _H(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qm(t)?t:e}function SDe(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(u=>{for(const{target:c}of u)if(qm(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=A2({callback:i}),a=k.useCallback(u=>{const c=_H(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=gb(a);return k.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const xDe=[{sensor:mH,options:{}},{sensor:gH,options:{}}],wDe={current:{}},vv={draggable:{measure:UR},droppable:{measure:UR,strategy:Qg.WhileDragging,frequency:W3.Optimized},dragOverlay:{measure:Km}};class Ep extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const CDe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ep,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vb},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vv,measureDroppableContainers:vb,windowRect:null,measuringScheduled:!1},SH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vb,draggableNodes:new Map,over:null,measureDroppableContainers:vb},Xm=k.createContext(SH),xH=k.createContext(CDe);function EDe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ep}}}function ADe(e,t){switch(t.type){case Pn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Pn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Pn.DragEnd:case Pn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Pn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Ep(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Pn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Ep(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Pn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Ep(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function TDe(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(Xm),o=mb(r),a=mb(n==null?void 0:n.id);return k.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!RT(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=bNe(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function wH(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function PDe(e){return k.useMemo(()=>({draggable:{...vv.draggable,...e==null?void 0:e.draggable},droppable:{...vv.droppable,...e==null?void 0:e.droppable},dragOverlay:{...vv.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function kDe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Ca(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=oH(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=sH(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const T2=k.createContext({...Lo,scaleX:1,scaleY:1});var Xs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Xs||(Xs={}));const IDe=k.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=xDe,collisionDetection:d=FNe,measuring:f,modifiers:h,...p}=t;const m=k.useReducer(ADe,void 0,EDe),[_,v]=m,[y,g]=ANe(),[b,S]=k.useState(Xs.Uninitialized),x=b===Xs.Initialized,{draggable:{active:w,nodes:C,translate:T},droppable:{containers:A}}=_,I=w?C.get(w):null,D=k.useRef({initial:null,translated:null}),M=k.useMemo(()=>{var Kt;return w!=null?{id:w,data:(Kt=I==null?void 0:I.data)!=null?Kt:wDe,rect:D}:null},[w,I]),E=k.useRef(null),[P,N]=k.useState(null),[L,O]=k.useState(null),R=Wg(p,Object.values(p)),$=E2("DndDescribedBy",a),z=k.useMemo(()=>A.getEnabled(),[A]),V=PDe(f),{droppableRects:H,measureDroppableContainers:Q,measuringScheduled:Z}=dDe(z,{dragging:x,dependencies:[T.x,T.y],config:V.droppable}),J=uDe(C,w),j=k.useMemo(()=>L?Kg(L):null,[L]),X=nu(),ee=fDe(J,V.draggable.measure);kDe({activeNode:w?C.get(w):null,config:X.layoutShiftCompensation,initialRect:ee,measure:V.draggable.measure});const ne=KR(J,V.draggable.measure,ee),fe=KR(J?J.parentElement:null),de=k.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Be=A.getNodeFor((n=de.current.over)==null?void 0:n.id),$e=SDe({measure:V.dragOverlay.measure}),Ce=(r=$e.nodeRef.current)!=null?r:J,Ke=x?(i=$e.rect)!=null?i:ne:null,be=!!($e.nodeRef.current&&$e.rect),zt=gDe(be?null:ne),Wn=bH(Ce?zr(Ce):null),nn=mDe(x?Be??J:null),Rt=_De(nn),St=wH(h,{transform:{x:T.x-zt.x,y:T.y-zt.y,scaleX:1,scaleY:1},activatorEvent:L,active:M,activeNodeRect:ne,containerNodeRect:fe,draggingNodeRect:Ke,over:de.current.over,overlayNodeRect:$e.rect,scrollableAncestors:nn,scrollableAncestorRects:Rt,windowRect:Wn}),bn=j?Wd(j,T):null,jr=yDe(nn),lo=QR(jr),ki=QR(jr,[ne]),lr=Wd(St,lo),Kn=Ke?UNe(Ke,St):null,Sr=M&&Kn?d({active:M,collisionRect:Kn,droppableRects:H,droppableContainers:z,pointerCoordinates:bn}):null,rn=DNe(Sr,"id"),[Ot,si]=k.useState(null),Ii=be?St:Wd(St,ki),uo=jNe(Ii,(o=Ot==null?void 0:Ot.rect)!=null?o:null,ne),Ma=k.useCallback((Kt,xt)=>{let{sensor:Qn,options:$n}=xt;if(E.current==null)return;const ur=C.get(E.current);if(!ur)return;const xr=Kt.nativeEvent,Vr=new Qn({active:E.current,activeNode:ur,event:xr,options:$n,context:de,onStart(wr){const Yn=E.current;if(Yn==null)return;const Ra=C.get(Yn);if(!Ra)return;const{onDragStart:Is}=R.current,Ms={active:{id:Yn,data:Ra.data,rect:D}};pi.unstable_batchedUpdates(()=>{Is==null||Is(Ms),S(Xs.Initializing),v({type:Pn.DragStart,initialCoordinates:wr,active:Yn}),y({type:"onDragStart",event:Ms})})},onMove(wr){v({type:Pn.DragMove,coordinates:wr})},onEnd:Vo(Pn.DragEnd),onCancel:Vo(Pn.DragCancel)});pi.unstable_batchedUpdates(()=>{N(Vr),O(Kt.nativeEvent)});function Vo(wr){return async function(){const{active:Ra,collisions:Is,over:Ms,scrollAdjustedTranslate:Cc}=de.current;let Oa=null;if(Ra&&Cc){const{cancelDrop:Cr}=R.current;Oa={activatorEvent:xr,active:Ra,collisions:Is,delta:Cc,over:Ms},wr===Pn.DragEnd&&typeof Cr=="function"&&await Promise.resolve(Cr(Oa))&&(wr=Pn.DragCancel)}E.current=null,pi.unstable_batchedUpdates(()=>{v({type:wr}),S(Xs.Uninitialized),si(null),N(null),O(null);const Cr=wr===Pn.DragEnd?"onDragEnd":"onDragCancel";if(Oa){const ru=R.current[Cr];ru==null||ru(Oa),y({type:Cr,event:Oa})}})}}},[C]),Xn=k.useCallback((Kt,xt)=>(Qn,$n)=>{const ur=Qn.nativeEvent,xr=C.get($n);if(E.current!==null||!xr||ur.dndKit||ur.defaultPrevented)return;const Vr={active:xr};Kt(Qn,xt.options,Vr)===!0&&(ur.dndKit={capturedBy:xt.sensor},E.current=$n,Ma(Qn,xt))},[C,Ma]),co=cDe(c,Xn);vDe(c),Ca(()=>{ne&&b===Xs.Initializing&&S(Xs.Initialized)},[ne,b]),k.useEffect(()=>{const{onDragMove:Kt}=R.current,{active:xt,activatorEvent:Qn,collisions:$n,over:ur}=de.current;if(!xt||!Qn)return;const xr={active:xt,activatorEvent:Qn,collisions:$n,delta:{x:lr.x,y:lr.y},over:ur};pi.unstable_batchedUpdates(()=>{Kt==null||Kt(xr),y({type:"onDragMove",event:xr})})},[lr.x,lr.y]),k.useEffect(()=>{const{active:Kt,activatorEvent:xt,collisions:Qn,droppableContainers:$n,scrollAdjustedTranslate:ur}=de.current;if(!Kt||E.current==null||!xt||!ur)return;const{onDragOver:xr}=R.current,Vr=$n.get(rn),Vo=Vr&&Vr.rect.current?{id:Vr.id,rect:Vr.rect.current,data:Vr.data,disabled:Vr.disabled}:null,wr={active:Kt,activatorEvent:xt,collisions:Qn,delta:{x:ur.x,y:ur.y},over:Vo};pi.unstable_batchedUpdates(()=>{si(Vo),xr==null||xr(wr),y({type:"onDragOver",event:wr})})},[rn]),Ca(()=>{de.current={activatorEvent:L,active:M,activeNode:J,collisionRect:Kn,collisions:Sr,droppableRects:H,draggableNodes:C,draggingNode:Ce,draggingNodeRect:Ke,droppableContainers:A,over:Ot,scrollableAncestors:nn,scrollAdjustedTranslate:lr},D.current={initial:Ke,translated:Kn}},[M,J,Sr,Kn,C,Ce,Ke,H,A,Ot,nn,lr]),aDe({...X,delta:T,draggingRect:Kn,pointerCoordinates:bn,scrollableAncestors:nn,scrollableAncestorRects:Rt});const tu=k.useMemo(()=>({active:M,activeNode:J,activeNodeRect:ne,activatorEvent:L,collisions:Sr,containerNodeRect:fe,dragOverlay:$e,draggableNodes:C,droppableContainers:A,droppableRects:H,over:Ot,measureDroppableContainers:Q,scrollableAncestors:nn,scrollableAncestorRects:Rt,measuringConfiguration:V,measuringScheduled:Z,windowRect:Wn}),[M,J,ne,L,Sr,fe,$e,C,A,H,Ot,Q,nn,Rt,V,Z,Wn]),jo=k.useMemo(()=>({activatorEvent:L,activators:co,active:M,activeNodeRect:ne,ariaDescribedById:{draggable:$},dispatch:v,draggableNodes:C,over:Ot,measureDroppableContainers:Q}),[L,co,M,ne,v,$,C,Ot,Q]);return bt.createElement(iH.Provider,{value:g},bt.createElement(Xm.Provider,{value:jo},bt.createElement(xH.Provider,{value:tu},bt.createElement(T2.Provider,{value:uo},u)),bt.createElement(TDe,{disabled:(s==null?void 0:s.restoreFocus)===!1})),bt.createElement(kNe,{...s,hiddenTextDescribedById:$}));function nu(){const Kt=(P==null?void 0:P.autoScrollEnabled)===!1,xt=typeof l=="object"?l.enabled===!1:l===!1,Qn=x&&!Kt&&!xt;return typeof l=="object"?{...l,enabled:Qn}:{enabled:Qn}}}),MDe=k.createContext(null),YR="button",RDe="Droppable";function nGe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=E2(RDe),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=k.useContext(Xm),{role:h=YR,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,v=k.useContext(_?T2:MDe),[y,g]=gb(),[b,S]=gb(),x=bDe(a,t),w=Wg(n);Ca(()=>(d.set(t,{id:t,key:o,node:y,activatorNode:b,data:w}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const C=k.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===YR?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:x,node:y,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:v}}function ODe(){return k.useContext(xH)}const $De="Droppable",NDe={timeout:25};function rGe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=E2($De),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=k.useContext(Xm),c=k.useRef({disabled:n}),d=k.useRef(!1),f=k.useRef(null),h=k.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...NDe,...i},v=Wg(m??r),y=k.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),h.current=null},_)},[_]),g=A2({callback:y,disabled:p||!a}),b=k.useCallback((C,T)=>{g&&(T&&(g.unobserve(T),d.current=!1),C&&g.observe(C))},[g]),[S,x]=gb(b),w=Wg(t);return k.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Ca(()=>(s({type:Pn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:w}}),()=>s({type:Pn.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==c.current.disabled&&(s({type:Pn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:x}}function DDe(e){let{animation:t,children:n}=e;const[r,i]=k.useState(null),[o,a]=k.useState(null),s=mb(n);return!n&&!r&&s&&i(s),Ca(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),bt.createElement(bt.Fragment,null,n,r?k.cloneElement(r,{ref:a}):null)}const LDe={x:0,y:0,scaleX:1,scaleY:1};function FDe(e){let{children:t}=e;return bt.createElement(Xm.Provider,{value:SH},bt.createElement(T2.Provider,{value:LDe},t))}const BDe={position:"fixed",touchAction:"none"},zDe=e=>RT(e)?"transform 250ms ease":void 0,jDe=k.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=zDe}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...BDe,width:s.width,height:s.height,top:s.top,left:s.left,transform:Xg.Transform.toString(d),transformOrigin:i&&r?RNe(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return bt.createElement(n,{className:a,style:f,ref:t},o)}),VDe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},UDe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Xg.Transform.toString(t)},{transform:Xg.Transform.toString(n)}]},GDe={duration:250,easing:"ease",keyframes:UDe,sideEffects:VDe({styles:{active:{opacity:"0"}}})};function HDe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return C2((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=_H(a);if(!u)return;const{transform:c}=zr(a).getComputedStyle(a),d=aH(c);if(!d)return;const f=typeof t=="function"?t:qDe(t);return hH(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function qDe(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...GDe,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),v=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{v.onfinish=()=>{_==null||_(),y()}})}}let ZR=0;function WDe(e){return k.useMemo(()=>{if(e!=null)return ZR++,ZR},[e])}const KDe=bt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:g,scrollableAncestorRects:b,windowRect:S}=ODe(),x=k.useContext(T2),w=WDe(d==null?void 0:d.id),C=wH(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:b,transform:x,windowRect:S}),T=DT(f),A=HDe({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:y}),I=T?_.setRef:void 0;return bt.createElement(FDe,null,bt.createElement(DDe,{animation:A},d&&w?bt.createElement(jDe,{key:w,id:d.id,ref:I,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:T,style:{zIndex:u,...i},transform:C},n):null))}),XDe=Gn([wT,bT],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),QDe=()=>{const e=S2(XDe);return k.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=Kg(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},YDe=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return zNe({...e,droppableContainers:n})};function ZDe(e){return q.jsx(IDe,{...e})}const Cy=28,JR={w:Cy,h:Cy,maxW:Cy,maxH:Cy,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},JDe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return q.jsx(ib,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:q.jsx(wU,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return q.jsx(ib,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:q.jsx(JA,{sx:{...JR},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?q.jsxs(eT,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...JR},children:[q.jsx(_3,{children:e.dragData.payload.imageDTOs.length}),q.jsx(_3,{size:"sm",children:"Images"})]}):null},eLe=k.memo(JDe),tLe=e=>{const[t,n]=k.useState(null),r=ae("images"),i=_2(),o=k.useCallback(d=>{r.trace({dragData:ft(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=k.useCallback(d=>{var h;r.trace({dragData:ft(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(EG({overData:f,activeData:t})),n(null))},[t,i,r]),s=VR(yH,{activationConstraint:{distance:10}}),l=VR(vH,{activationConstraint:{distance:10}}),u=INe(s,l),c=QDe();return q.jsxs(ZDe,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:YDe,autoScroll:!1,children:[e.children,q.jsx(KDe,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:q.jsx(hU,{children:t&&q.jsx(dU.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:q.jsx(eLe,{dragData:t})},"overlay-drag-image")})})]})},nLe=k.memo(tLe),eO=Ta(void 0),tO=Ta(void 0),rLe=k.lazy(()=>v$(()=>import("./App-cd19f6f7.js"),["./App-cd19f6f7.js","./MantineProvider-094ba0de.js","./App-6125620a.css"],import.meta.url)),iLe=k.lazy(()=>v$(()=>import("./ThemeLocaleProvider-37ef62a0.js"),["./ThemeLocaleProvider-37ef62a0.js","./MantineProvider-094ba0de.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),oLe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(k.useEffect(()=>(t&&gg.set(t),e&&mg.set(e),o&&S1.set(o),a&&Nn.set(a),Dz(),i&&i.length>0?H5(NR(),...i):H5(NR()),()=>{mg.set(void 0),gg.set(void 0),S1.set(void 0),Nn.set(fL)}),[e,t,i,o,a]),k.useEffect(()=>(l&&eO.set(l),()=>{eO.set(void 0)}),[l]),k.useEffect(()=>(r&&tO.set(r),()=>{tO.set(void 0)}),[r]),q.jsx(bt.StrictMode,{children:q.jsx(Vse,{store:DG,children:q.jsx(bt.Suspense,{fallback:q.jsx(eNe,{}),children:q.jsx(iLe,{children:q.jsx(nLe,{children:q.jsx(rLe,{config:n,selectedImage:s})})})})})})),aLe=k.memo(oLe);tC.createRoot(document.getElementById("root")).render(q.jsx(aLe,{}));export{_9 as $,qn as A,_o as B,lme as C,ri as D,vl as E,Qo as F,tje as G,aA as H,Pi as I,Bm as J,Im as K,sr as L,Kl as M,w3e as N,pUe as O,dme as P,dUe as Q,hU as R,Zp as S,dU as T,t3e as U,Mm as V,QA as W,Om as X,fUe as Y,hUe as Z,U1 as _,uN as a,Eze as a$,obe as a0,gUe as a1,la as a2,Bl as a3,v1 as a4,UK as a5,bt as a6,Vj as a7,vUe as a8,a3e as a9,Rze as aA,H1e as aB,vA as aC,Yz as aD,W1e as aE,pi as aF,XT as aG,uS as aH,_2 as aI,VVe as aJ,pze as aK,$ze as aL,Nze as aM,cze as aN,lze as aO,wU as aP,Gc as aQ,d6e as aR,IU as aS,OVe as aT,dze as aU,jE as aV,xT as aW,rUe as aX,JA as aY,Z$e as aZ,ce as a_,ma as aa,ij as ab,lS as ac,AAe as ad,_U as ae,mUe as af,Pe as ag,cUe as ah,yUe as ai,Gn as aj,wT as ak,pE as al,S2 as am,Sze as an,Cm as ao,tF as ap,TF as aq,Q_ as ar,ae as as,ib as at,eT as au,_3 as av,bT as aw,zm as ax,n$e as ay,kG as az,Wb as b,FRe as b$,Oze as b0,JFe as b1,Tie as b2,zE as b3,nt as b4,RLe as b5,YVe as b6,DVe as b7,iUe as b8,nUe as b9,K as bA,Gze as bB,Kze as bC,gze as bD,mze as bE,Pze as bF,I1 as bG,vze as bH,al as bI,y0 as bJ,Wze as bK,Hze as bL,qze as bM,lLe as bN,ELe as bO,ALe as bP,TLe as bQ,PLe as bR,Qoe as bS,rFe as bT,wVe as bU,CVe as bV,OLe as bW,cFe as bX,ILe as bY,ZLe as bZ,DLe as b_,jve as ba,NVe as bb,FVe as bc,ave as bd,sve as be,KVe as bf,QVe as bg,LVe as bh,JVe as bi,BVe as bj,$Ve as bk,_ze as bl,xUe as bm,nq as bn,dLe as bo,uLe as bp,cLe as bq,Ve as br,bze as bs,jze as bt,zze as bu,yze as bv,Xze as bw,rGe as bx,nGe as by,yl as bz,zQ as c,Aze as c$,MLe as c0,iFe as c1,FLe as c2,cL as c3,kLe as c4,gFe as c5,$Le as c6,v6 as c7,NLe as c8,b6 as c9,d8 as cA,TVe as cB,PVe as cC,kVe as cD,HLe as cE,IVe as cF,qLe as cG,MVe as cH,WLe as cI,RVe as cJ,Jze as cK,gg as cL,C6e as cM,kze as cN,Iu as cO,No as cP,wfe as cQ,ge as cR,eO as cS,Vze as cT,Uze as cU,Tle as cV,o1e as cW,Nz as cX,YL as cY,uze as cZ,CG as c_,ULe as ca,eFe as cb,KLe as cc,AFe as cd,TFe as ce,GLe as cf,PFe as cg,NUe as ch,BLe as ci,pR as cj,eje as ck,RUe as cl,zLe as cm,gR as cn,Su as co,hie as cp,wie as cq,$Ue as cr,yR as cs,pie as ct,OUe as cu,VLe as cv,mR as cw,gie as cx,LRe as cy,LLe as cz,Ane as d,Dje as d$,yg as d0,VF as d1,uUe as d2,Tze as d3,R0 as d4,C5 as d5,rBe as d6,QFe as d7,VFe as d8,UFe as d9,sje as dA,wze as dB,xze as dC,cje as dD,mE as dE,Mje as dF,ije as dG,Eje as dH,Aje as dI,Boe as dJ,Tje as dK,xLe as dL,Pje as dM,rS as dN,Foe as dO,Rje as dP,bm as dQ,qUe as dR,vs as dS,MUe as dT,YUe as dU,IUe as dV,Oje as dW,$je as dX,ZUe as dY,Nje as dZ,QUe as d_,KFe as da,on as db,sA as dc,ps as dd,Aa as de,hi as df,WFe as dg,XLe as dh,yT as di,XFe as dj,tUe as dk,hE as dl,Kje as dm,Cze as dn,Wje as dp,tGe as dq,yVe as dr,hVe as ds,pVe as dt,_Ve as du,gVe as dv,bVe as dw,vVe as dx,vRe as dy,jje as dz,cD as e,IFe as e$,Lje as e0,lL as e1,LUe as e2,Fje as e3,zoe as e4,kje as e5,joe as e6,Ije as e7,Cje as e8,mVe as e9,S6e as eA,_6e as eB,vLe as eC,bLe as eD,a_ as eE,_Le as eF,Aie as eG,SLe as eH,mLe as eI,gLe as eJ,AE as eK,xie as eL,vie as eM,bie as eN,mie as eO,yie as eP,_ie as eQ,Sie as eR,hLe as eS,DUe as eT,EVe as eU,TE as eV,nve as eW,S7e as eX,TUe as eY,MFe as eZ,Yoe as e_,Od as ea,$f as eb,tFe as ec,Ile as ed,Mle as ee,fze as ef,Yze as eg,Zze as eh,GF as ei,Qze as ej,n_ as ek,kFe as el,wFe as em,CFe as en,EFe as eo,Mie as ep,ui as eq,p6 as er,yLe as es,Fze as et,Dze as eu,Lze as ev,Hl as ew,H6 as ex,Eie as ey,g6 as ez,yN as f,dz as f$,Mr as f0,JLe as f1,fFe as f2,Rie as f3,dp as f4,pFe as f5,AVe as f6,sFe as f7,lFe as f8,uFe as f9,jVe as fA,zUe as fB,XUe as fC,WUe as fD,zVe as fE,UUe as fF,VUe as fG,FUe as fH,HUe as fI,CLe as fJ,BUe as fK,GUe as fL,wLe as fM,QB as fN,oje as fO,e$e as fP,Vje as fQ,hje as fR,pje as fS,rye as fT,l8 as fU,kB as fV,Pm as fW,nje as fX,wu as fY,Gje as fZ,eUe as f_,oFe as fa,aFe as fb,Xoe as fc,vFe as fd,yFe as fe,SBe as ff,FFe as fg,ize as fh,xBe as fi,SFe as fj,xFe as fk,_Fe as fl,kE as fm,YFe as fn,xVe as fo,JUe as fp,V7e as fq,HVe as fr,ue as fs,Qe as ft,Dt as fu,ha as fv,jLe as fw,kUe as fx,KUe as fy,jUe as fz,EN as g,ZBe as g$,zL as g0,Vh as g1,uje as g2,aje as g3,Uje as g4,Hje as g5,Zje as g6,rje as g7,qje as g8,z1 as g9,PUe as gA,fR as gB,ft as gC,Yye as gD,Pg as gE,Rl as gF,dVe as gG,aVe as gH,cVe as gI,sVe as gJ,iVe as gK,Xje as gL,uVe as gM,uz as gN,lUe as gO,oUe as gP,aUe as gQ,sUe as gR,iBe as gS,qFe as gT,eBe as gU,nBe as gV,xu as gW,OU as gX,Cq as gY,Ue as gZ,OBe as g_,Te as ga,K7e as gb,Zye as gc,G0 as gd,lje as ge,Jje as gf,Qje as gg,Sje as gh,vje as gi,yje as gj,mje as gk,xje as gl,Yje as gm,nVe as gn,tVe as go,fVe as gp,G7e as gq,bje as gr,_je as gs,SVe as gt,rVe as gu,eVe as gv,oVe as gw,Y0e as gx,fb as gy,a1e as gz,e_ as h,rze as h$,YBe as h0,yBe as h1,VBe as h2,eze as h3,x6e as h4,cBe as h5,PBe as h6,Eh as h7,EBe as h8,dBe as h9,bBe as hA,$Be as hB,RBe as hC,kBe as hD,NFe as hE,DFe as hF,sze as hG,CUe as hH,wUe as hI,NBe as hJ,g6e as hK,jBe as hL,DBe as hM,mBe as hN,uBe as hO,KBe as hP,WBe as hQ,BBe as hR,LBe as hS,FBe as hT,oze as hU,HBe as hV,aze as hW,aBe as hX,oBe as hY,CBe as hZ,wBe as h_,xS as ha,TBe as hb,sBe as hc,ABe as hd,lBe as he,hBe as hf,$Fe as hg,OFe as hh,RFe as hi,JBe as hj,wre as hk,ba as hl,dL as hm,tae as hn,BFe as ho,zFe as hp,jFe as hq,QBe as hr,gBe as hs,pBe as ht,yle as hu,XBe as hv,b6e as hw,vle as hx,mT as hy,zMe as hz,_ne as i,v6e as i0,p6e as i1,m6e as i2,y6e as i3,LFe as i4,vBe as i5,AUe as i6,rPe as i7,UVe as i8,GVe as i9,Lre as ia,g1e as ib,eGe as ic,tO as id,nj as ie,_A as ig,ua as ih,U5e as ii,v3e as ij,bUe as ik,ube as il,SUe as im,nPe as io,l6e as ip,u6e as iq,rbe as ir,En as j,eee as k,Jb as l,Of as m,gm as n,ni as o,Qb as p,tE as q,gN as r,sE as s,ym as t,rD as u,k as v,q as w,Ji as x,dn as y,Fd as z}; diff --git a/invokeai/frontend/web/dist/assets/index-f820e2e3.js b/invokeai/frontend/web/dist/assets/index-f820e2e3.js new file mode 100644 index 0000000000..2276172ddf --- /dev/null +++ b/invokeai/frontend/web/dist/assets/index-f820e2e3.js @@ -0,0 +1,157 @@ +var fq=Object.defineProperty;var hq=(e,t,n)=>t in e?fq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Q2=(e,t,n)=>(hq(e,typeof t!="symbol"?t+"":t,n),n),Y2=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var te=(e,t,n)=>(Y2(e,t,"read from private field"),n?n.call(e):t.get(e)),Gt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},$i=(e,t,n,r)=>(Y2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var eh=(e,t,n,r)=>({set _(i){$i(e,t,i,n)},get _(){return te(e,t,r)}}),Go=(e,t,n)=>(Y2(e,t,"access private method"),n);function gO(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var He=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pq(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var mO={exports:{}},Sb={},yO={exports:{}},Ke={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var rm=Symbol.for("react.element"),gq=Symbol.for("react.portal"),mq=Symbol.for("react.fragment"),yq=Symbol.for("react.strict_mode"),vq=Symbol.for("react.profiler"),bq=Symbol.for("react.provider"),_q=Symbol.for("react.context"),Sq=Symbol.for("react.forward_ref"),xq=Symbol.for("react.suspense"),wq=Symbol.for("react.memo"),Cq=Symbol.for("react.lazy"),JA=Symbol.iterator;function Eq(e){return e===null||typeof e!="object"?null:(e=JA&&e[JA]||e["@@iterator"],typeof e=="function"?e:null)}var vO={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bO=Object.assign,_O={};function Pf(e,t,n){this.props=e,this.context=t,this.refs=_O,this.updater=n||vO}Pf.prototype.isReactComponent={};Pf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Pf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function SO(){}SO.prototype=Pf.prototype;function t4(e,t,n){this.props=e,this.context=t,this.refs=_O,this.updater=n||vO}var n4=t4.prototype=new SO;n4.constructor=t4;bO(n4,Pf.prototype);n4.isPureReactComponent=!0;var eP=Array.isArray,xO=Object.prototype.hasOwnProperty,r4={current:null},wO={key:!0,ref:!0,__self:!0,__source:!0};function CO(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)xO.call(t,r)&&!wO.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,U=$[B];if(0>>1;Bi(Y,O))Zi(V,Y)?($[B]=V,$[Z]=O,B=Z):($[B]=Y,$[q]=O,B=q);else if(Zi(V,O))$[B]=V,$[Z]=O,B=Z;else break e}}return L}function i($,L){var O=$.sortIndex-L.sortIndex;return O!==0?O:$.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,g=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m($){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=$)r(u),L.sortIndex=L.expirationTime,t(l,L);else break;L=n(u)}}function v($){if(g=!1,m($),!p)if(n(l)!==null)p=!0,R(S);else{var L=n(u);L!==null&&D(v,L.startTime-$)}}function S($,L){p=!1,g&&(g=!1,b(x),x=-1),h=!0;var O=f;try{for(m(L),d=n(l);d!==null&&(!(d.expirationTime>L)||$&&!I());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var U=B(d.expirationTime<=L);L=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),m(L)}else r(l);d=n(l)}if(d!==null)var j=!0;else{var q=n(u);q!==null&&D(v,q.startTime-L),j=!1}return j}finally{d=null,f=O,h=!1}}var w=!1,C=null,x=-1,P=5,E=-1;function I(){return!(e.unstable_now()-E$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(f){case 1:case 2:case 3:var L=3;break;default:L=f}var O=f;f=L;try{return $()}finally{f=O}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,L){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var O=f;f=$;try{return L()}finally{f=O}},e.unstable_scheduleCallback=function($,L,O){var B=e.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0B?($.sortIndex=O,t(u,$),n(l)===null&&$===n(u)&&(g?(b(x),x=-1):g=!0,D(v,O-B))):($.sortIndex=U,t(l,$),p||h||(p=!0,R(S))),$},e.unstable_shouldYield=I,e.unstable_wrapCallback=function($){var L=f;return function(){var O=f;f=L;try{return $.apply(this,arguments)}finally{f=O}}}})(PO);AO.exports=PO;var Dq=AO.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var kO=k,wi=Dq;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sC=Object.prototype.hasOwnProperty,Lq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,rP={},iP={};function Fq(e){return sC.call(iP,e)?!0:sC.call(rP,e)?!1:Lq.test(e)?iP[e]=!0:(rP[e]=!0,!1)}function Bq(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zq(e,t,n,r){if(t===null||typeof t>"u"||Bq(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Br(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var sr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){sr[e]=new Br(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];sr[t]=new Br(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){sr[e]=new Br(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){sr[e]=new Br(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){sr[e]=new Br(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){sr[e]=new Br(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){sr[e]=new Br(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){sr[e]=new Br(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){sr[e]=new Br(e,5,!1,e.toLowerCase(),null,!1,!1)});var o4=/[\-:]([a-z])/g;function a4(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(o4,a4);sr[t]=new Br(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(o4,a4);sr[t]=new Br(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(o4,a4);sr[t]=new Br(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){sr[e]=new Br(e,1,!1,e.toLowerCase(),null,!1,!1)});sr.xlinkHref=new Br("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){sr[e]=new Br(e,1,!1,e.toLowerCase(),null,!0,!0)});function s4(e,t,n,r){var i=sr.hasOwnProperty(t)?sr[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` +`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{ex=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Nh(e):""}function Vq(e){switch(e.tag){case 5:return Nh(e.type);case 16:return Nh("Lazy");case 13:return Nh("Suspense");case 19:return Nh("SuspenseList");case 0:case 2:case 15:return e=tx(e.type,!1),e;case 11:return e=tx(e.type.render,!1),e;case 1:return e=tx(e.type,!0),e;default:return""}}function dC(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Yc:return"Fragment";case Qc:return"Portal";case lC:return"Profiler";case l4:return"StrictMode";case uC:return"Suspense";case cC:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case RO:return(e.displayName||"Context")+".Consumer";case MO:return(e._context.displayName||"Context")+".Provider";case u4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case c4:return t=e.displayName||null,t!==null?t:dC(e.type)||"Memo";case Gs:t=e._payload,e=e._init;try{return dC(e(t))}catch{}}return null}function jq(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dC(t);case 8:return t===l4?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function wl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $O(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Uq(e){var t=$O(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function r0(e){e._valueTracker||(e._valueTracker=Uq(e))}function NO(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$O(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function _v(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fC(e,t){var n=t.checked;return en({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function aP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=wl(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function DO(e,t){t=t.checked,t!=null&&s4(e,"checked",t,!1)}function hC(e,t){DO(e,t);var n=wl(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pC(e,t.type,n):t.hasOwnProperty("defaultValue")&&pC(e,t.type,wl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function sP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function pC(e,t,n){(t!=="number"||_v(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dh=Array.isArray;function _d(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=i0.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function kp(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var tp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Gq=["Webkit","ms","Moz","O"];Object.keys(tp).forEach(function(e){Gq.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),tp[t]=tp[e]})});function zO(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||tp.hasOwnProperty(e)&&tp[e]?(""+t).trim():t+"px"}function VO(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=zO(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Hq=en({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yC(e,t){if(t){if(Hq[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function vC(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bC=null;function d4(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _C=null,Sd=null,xd=null;function cP(e){if(e=am(e)){if(typeof _C!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=Tb(t),_C(e.stateNode,e.type,t))}}function jO(e){Sd?xd?xd.push(e):xd=[e]:Sd=e}function UO(){if(Sd){var e=Sd,t=xd;if(xd=Sd=null,cP(e),t)for(e=0;e>>=0,e===0?32:31-(nW(e)/rW|0)|0}var o0=64,a0=4194304;function Lh(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Cv(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=Lh(s):(o&=a,o!==0&&(r=Lh(o)))}else a=n&~i,a!==0?r=Lh(a):o!==0&&(r=Lh(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function im(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-To(t),e[t]=n}function sW(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=rp),bP=String.fromCharCode(32),_P=!1;function u7(e,t){switch(e){case"keyup":return NW.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c7(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zc=!1;function LW(e,t){switch(e){case"compositionend":return c7(t);case"keypress":return t.which!==32?null:(_P=!0,bP);case"textInput":return e=t.data,e===bP&&_P?null:e;default:return null}}function FW(e,t){if(Zc)return e==="compositionend"||!b4&&u7(e,t)?(e=s7(),Iy=m4=il=null,Zc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=CP(n)}}function p7(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?p7(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function g7(){for(var e=window,t=_v();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=_v(e.document)}return t}function _4(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function WW(e){var t=g7(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&p7(n.ownerDocument.documentElement,n)){if(r!==null&&_4(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=EP(n,o);var a=EP(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jc=null,TC=null,op=null,AC=!1;function TP(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;AC||Jc==null||Jc!==_v(r)||(r=Jc,"selectionStart"in r&&_4(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),op&&Np(op,r)||(op=r,r=Av(TC,"onSelect"),0nd||(e.current=OC[nd],OC[nd]=null,nd--)}function Mt(e,t){nd++,OC[nd]=e.current,e.current=t}var Cl={},br=Vl(Cl),Zr=Vl(!1),Xu=Cl;function ef(e,t){var n=e.type.contextTypes;if(!n)return Cl;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jr(e){return e=e.childContextTypes,e!=null}function kv(){zt(Zr),zt(br)}function OP(e,t,n){if(br.current!==Cl)throw Error(ne(168));Mt(br,t),Mt(Zr,n)}function C7(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(ne(108,jq(e)||"Unknown",i));return en({},n,r)}function Iv(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cl,Xu=br.current,Mt(br,e),Mt(Zr,Zr.current),!0}function $P(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=C7(e,t,Xu),r.__reactInternalMemoizedMergedChildContext=e,zt(Zr),zt(br),Mt(br,e)):zt(Zr),Mt(Zr,n)}var ja=null,Ab=!1,gx=!1;function E7(e){ja===null?ja=[e]:ja.push(e)}function oK(e){Ab=!0,E7(e)}function jl(){if(!gx&&ja!==null){gx=!0;var e=0,t=vt;try{var n=ja;for(vt=1;e>=a,i-=a,Qa=1<<32-To(t)+i|n<x?(P=C,C=null):P=C.sibling;var E=f(b,C,m[x],v);if(E===null){C===null&&(C=P);break}e&&C&&E.alternate===null&&t(b,C),y=o(E,y,x),w===null?S=E:w.sibling=E,w=E,C=P}if(x===m.length)return n(b,C),qt&&hu(b,x),S;if(C===null){for(;xx?(P=C,C=null):P=C.sibling;var I=f(b,C,E.value,v);if(I===null){C===null&&(C=P);break}e&&C&&I.alternate===null&&t(b,C),y=o(I,y,x),w===null?S=I:w.sibling=I,w=I,C=P}if(E.done)return n(b,C),qt&&hu(b,x),S;if(C===null){for(;!E.done;x++,E=m.next())E=d(b,E.value,v),E!==null&&(y=o(E,y,x),w===null?S=E:w.sibling=E,w=E);return qt&&hu(b,x),S}for(C=r(b,C);!E.done;x++,E=m.next())E=h(C,b,x,E.value,v),E!==null&&(e&&E.alternate!==null&&C.delete(E.key===null?x:E.key),y=o(E,y,x),w===null?S=E:w.sibling=E,w=E);return e&&C.forEach(function(N){return t(b,N)}),qt&&hu(b,x),S}function _(b,y,m,v){if(typeof m=="object"&&m!==null&&m.type===Yc&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case n0:e:{for(var S=m.key,w=y;w!==null;){if(w.key===S){if(S=m.type,S===Yc){if(w.tag===7){n(b,w.sibling),y=i(w,m.props.children),y.return=b,b=y;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Gs&&VP(S)===w.type){n(b,w.sibling),y=i(w,m.props),y.ref=ah(b,w,m),y.return=b,b=y;break e}n(b,w);break}else t(b,w);w=w.sibling}m.type===Yc?(y=Fu(m.props.children,b.mode,v,m.key),y.return=b,b=y):(v=Fy(m.type,m.key,m.props,null,b.mode,v),v.ref=ah(b,y,m),v.return=b,b=v)}return a(b);case Qc:e:{for(w=m.key;y!==null;){if(y.key===w)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(b,y.sibling),y=i(y,m.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=wx(m,b.mode,v),y.return=b,b=y}return a(b);case Gs:return w=m._init,_(b,y,w(m._payload),v)}if(Dh(m))return p(b,y,m,v);if(th(m))return g(b,y,m,v);h0(b,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,y!==null&&y.tag===6?(n(b,y.sibling),y=i(y,m),y.return=b,b=y):(n(b,y),y=xx(m,b.mode,v),y.return=b,b=y),a(b)):n(b,y)}return _}var nf=O7(!0),$7=O7(!1),sm={},fa=Vl(sm),Bp=Vl(sm),zp=Vl(sm);function Pu(e){if(e===sm)throw Error(ne(174));return e}function k4(e,t){switch(Mt(zp,t),Mt(Bp,e),Mt(fa,sm),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:mC(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=mC(t,e)}zt(fa),Mt(fa,t)}function rf(){zt(fa),zt(Bp),zt(zp)}function N7(e){Pu(zp.current);var t=Pu(fa.current),n=mC(t,e.type);t!==n&&(Mt(Bp,e),Mt(fa,n))}function I4(e){Bp.current===e&&(zt(fa),zt(Bp))}var Yt=Vl(0);function Dv(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var mx=[];function M4(){for(var e=0;en?n:4,e(!0);var r=yx.transition;yx.transition={};try{e(!1),t()}finally{vt=n,yx.transition=r}}function Y7(){return Yi().memoizedState}function uK(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Z7(e))J7(t,n);else if(n=k7(e,t,n,r),n!==null){var i=$r();Ao(n,e,r,i),e$(n,t,r)}}function cK(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Z7(e))J7(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,Oo(s,a)){var l=t.interleaved;l===null?(i.next=i,A4(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=k7(e,t,i,r),n!==null&&(i=$r(),Ao(n,e,r,i),e$(n,t,r))}}function Z7(e){var t=e.alternate;return e===Jt||t!==null&&t===Jt}function J7(e,t){ap=Lv=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function e$(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,h4(e,n)}}var Fv={readContext:Qi,useCallback:dr,useContext:dr,useEffect:dr,useImperativeHandle:dr,useInsertionEffect:dr,useLayoutEffect:dr,useMemo:dr,useReducer:dr,useRef:dr,useState:dr,useDebugValue:dr,useDeferredValue:dr,useTransition:dr,useMutableSource:dr,useSyncExternalStore:dr,useId:dr,unstable_isNewReconciler:!1},dK={readContext:Qi,useCallback:function(e,t){return Ko().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:UP,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,$y(4194308,4,q7.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $y(4194308,4,e,t)},useInsertionEffect:function(e,t){return $y(4,2,e,t)},useMemo:function(e,t){var n=Ko();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ko();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=uK.bind(null,Jt,e),[r.memoizedState,e]},useRef:function(e){var t=Ko();return e={current:e},t.memoizedState=e},useState:jP,useDebugValue:D4,useDeferredValue:function(e){return Ko().memoizedState=e},useTransition:function(){var e=jP(!1),t=e[0];return e=lK.bind(null,e[1]),Ko().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Jt,i=Ko();if(qt){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),Hn===null)throw Error(ne(349));Yu&30||F7(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,UP(z7.bind(null,r,o,e),[e]),r.flags|=2048,Up(9,B7.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ko(),t=Hn.identifierPrefix;if(qt){var n=Ya,r=Qa;n=(r&~(1<<32-To(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Vp++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[ra]=t,e[Fp]=r,u$(e,t,!1,!1),t.stateNode=e;e:{switch(a=vC(n,r),n){case"dialog":Nt("cancel",e),Nt("close",e),i=r;break;case"iframe":case"object":case"embed":Nt("load",e),i=r;break;case"video":case"audio":for(i=0;iaf&&(t.flags|=128,r=!0,sh(o,!1),t.lanes=4194304)}else{if(!r)if(e=Dv(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),sh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!qt)return fr(t),null}else 2*mn()-o.renderingStartTime>af&&n!==1073741824&&(t.flags|=128,r=!0,sh(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=mn(),t.sibling=null,n=Yt.current,Mt(Yt,r?n&1|2:n&1),t):(fr(t),null);case 22:case 23:return j4(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?pi&1073741824&&(fr(t),t.subtreeFlags&6&&(t.flags|=8192)):fr(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function bK(e,t){switch(x4(t),t.tag){case 1:return Jr(t.type)&&kv(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rf(),zt(Zr),zt(br),M4(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return I4(t),null;case 13:if(zt(Yt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));tf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zt(Yt),null;case 4:return rf(),null;case 10:return T4(t.type._context),null;case 22:case 23:return j4(),null;case 24:return null;default:return null}}var g0=!1,yr=!1,_K=typeof WeakSet=="function"?WeakSet:Set,be=null;function ad(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){an(e,t,r)}else n.current=null}function HC(e,t,n){try{n()}catch(r){an(e,t,r)}}var ZP=!1;function SK(e,t){if(PC=Ev,e=g7(),_4(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(kC={focusedElem:e,selectionRange:n},Ev=!1,be=t;be!==null;)if(t=be,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,be=e;else for(;be!==null;){t=be;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,_=p.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?g:mo(t.type,g),_);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(v){an(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,be=e;break}be=t.return}return p=ZP,ZP=!1,p}function sp(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&HC(t,n,o)}i=i.next}while(i!==r)}}function Ib(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qC(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function f$(e){var t=e.alternate;t!==null&&(e.alternate=null,f$(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ra],delete t[Fp],delete t[RC],delete t[rK],delete t[iK])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function h$(e){return e.tag===5||e.tag===3||e.tag===4}function JP(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||h$(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function WC(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Pv));else if(r!==4&&(e=e.child,e!==null))for(WC(e,t,n),e=e.sibling;e!==null;)WC(e,t,n),e=e.sibling}function KC(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(KC(e,t,n),e=e.sibling;e!==null;)KC(e,t,n),e=e.sibling}var tr=null,vo=!1;function Os(e,t,n){for(n=n.child;n!==null;)p$(e,t,n),n=n.sibling}function p$(e,t,n){if(da&&typeof da.onCommitFiberUnmount=="function")try{da.onCommitFiberUnmount(xb,n)}catch{}switch(n.tag){case 5:yr||ad(n,t);case 6:var r=tr,i=vo;tr=null,Os(e,t,n),tr=r,vo=i,tr!==null&&(vo?(e=tr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tr.removeChild(n.stateNode));break;case 18:tr!==null&&(vo?(e=tr,n=n.stateNode,e.nodeType===8?px(e.parentNode,n):e.nodeType===1&&px(e,n),Op(e)):px(tr,n.stateNode));break;case 4:r=tr,i=vo,tr=n.stateNode.containerInfo,vo=!0,Os(e,t,n),tr=r,vo=i;break;case 0:case 11:case 14:case 15:if(!yr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&HC(n,t,a),i=i.next}while(i!==r)}Os(e,t,n);break;case 1:if(!yr&&(ad(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){an(n,t,s)}Os(e,t,n);break;case 21:Os(e,t,n);break;case 22:n.mode&1?(yr=(r=yr)||n.memoizedState!==null,Os(e,t,n),yr=r):Os(e,t,n);break;default:Os(e,t,n)}}function ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _K),t.forEach(function(r){var i=IK.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ho(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=mn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wK(r/1960))-r,10e?16:e,ol===null)var r=!1;else{if(e=ol,ol=null,Vv=0,st&6)throw Error(ne(331));var i=st;for(st|=4,be=e.current;be!==null;){var o=be,a=o.child;if(be.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lmn()-z4?Lu(e,0):B4|=n),ei(e,t)}function x$(e,t){t===0&&(e.mode&1?(t=a0,a0<<=1,!(a0&130023424)&&(a0=4194304)):t=1);var n=$r();e=ds(e,t),e!==null&&(im(e,t,n),ei(e,n))}function kK(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),x$(e,n)}function IK(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ne(314))}r!==null&&r.delete(t),x$(e,n)}var w$;w$=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Zr.current)Xr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xr=!1,yK(e,t,n);Xr=!!(e.flags&131072)}else Xr=!1,qt&&t.flags&1048576&&T7(t,Rv,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ny(e,t),e=t.pendingProps;var i=ef(t,br.current);Cd(t,n),i=O4(null,t,r,e,i,n);var o=$4();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jr(r)?(o=!0,Iv(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,P4(t),i.updater=Pb,t.stateNode=i,i._reactInternals=t,FC(t,r,e,n),t=VC(null,t,r,!0,o,n)):(t.tag=0,qt&&o&&S4(t),Mr(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ny(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=RK(r),e=mo(r,e),i){case 0:t=zC(null,t,r,e,n);break e;case 1:t=XP(null,t,r,e,n);break e;case 11:t=WP(null,t,r,e,n);break e;case 14:t=KP(null,t,r,mo(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mo(r,i),zC(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mo(r,i),XP(e,t,r,i,n);case 3:e:{if(a$(t),e===null)throw Error(ne(387));r=t.pendingProps,o=t.memoizedState,i=o.element,I7(e,t),Nv(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=of(Error(ne(423)),t),t=QP(e,t,r,n,i);break e}else if(r!==i){i=of(Error(ne(424)),t),t=QP(e,t,r,n,i);break e}else for(bi=dl(t.stateNode.containerInfo.firstChild),_i=t,qt=!0,_o=null,n=$7(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tf(),r===i){t=fs(e,t,n);break e}Mr(e,t,r,n)}t=t.child}return t;case 5:return N7(t),e===null&&NC(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,IC(r,i)?a=null:o!==null&&IC(r,o)&&(t.flags|=32),o$(e,t),Mr(e,t,a,n),t.child;case 6:return e===null&&NC(t),null;case 13:return s$(e,t,n);case 4:return k4(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=nf(t,null,r,n):Mr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mo(r,i),WP(e,t,r,i,n);case 7:return Mr(e,t,t.pendingProps,n),t.child;case 8:return Mr(e,t,t.pendingProps.children,n),t.child;case 12:return Mr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Mt(Ov,r._currentValue),r._currentValue=a,o!==null)if(Oo(o.value,a)){if(o.children===i.children&&!Zr.current){t=fs(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=ns(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),DC(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(ne(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),DC(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Mr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Cd(t,n),i=Qi(i),r=r(i),t.flags|=1,Mr(e,t,r,n),t.child;case 14:return r=t.type,i=mo(r,t.pendingProps),i=mo(r.type,i),KP(e,t,r,i,n);case 15:return r$(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mo(r,i),Ny(e,t),t.tag=1,Jr(r)?(e=!0,Iv(t)):e=!1,Cd(t,n),R7(t,r,i),FC(t,r,i,n),VC(null,t,r,!0,e,n);case 19:return l$(e,t,n);case 22:return i$(e,t,n)}throw Error(ne(156,t.tag))};function C$(e,t){return QO(e,t)}function MK(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wi(e,t,n,r){return new MK(e,t,n,r)}function G4(e){return e=e.prototype,!(!e||!e.isReactComponent)}function RK(e){if(typeof e=="function")return G4(e)?1:0;if(e!=null){if(e=e.$$typeof,e===u4)return 11;if(e===c4)return 14}return 2}function gl(e,t){var n=e.alternate;return n===null?(n=Wi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Fy(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")G4(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Yc:return Fu(n.children,i,o,t);case l4:a=8,i|=8;break;case lC:return e=Wi(12,n,t,i|2),e.elementType=lC,e.lanes=o,e;case uC:return e=Wi(13,n,t,i),e.elementType=uC,e.lanes=o,e;case cC:return e=Wi(19,n,t,i),e.elementType=cC,e.lanes=o,e;case OO:return Rb(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case MO:a=10;break e;case RO:a=9;break e;case u4:a=11;break e;case c4:a=14;break e;case Gs:a=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=Wi(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Fu(e,t,n,r){return e=Wi(7,e,r,t),e.lanes=n,e}function Rb(e,t,n,r){return e=Wi(22,e,r,t),e.elementType=OO,e.lanes=n,e.stateNode={isHidden:!1},e}function xx(e,t,n){return e=Wi(6,e,null,t),e.lanes=n,e}function wx(e,t,n){return t=Wi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function OK(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=rx(0),this.expirationTimes=rx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rx(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function H4(e,t,n,r,i,o,a,s,l){return e=new OK(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Wi(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},P4(o),e}function $K(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(P$)}catch(e){console.error(e)}}P$(),TO.exports=Ai;var mi=TO.exports;const vLe=Bl(mi);var lk=mi;aC.createRoot=lk.createRoot,aC.hydrateRoot=lk.hydrateRoot;const BK="modulepreload",zK=function(e,t){return new URL(e,t).href},uk={},k$=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=zK(o,r),o in uk)return;uk[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":BK,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function Un(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Lb(e)?2:Fb(e)?3:0}function ml(e,t){return El(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function By(e,t){return El(e)===2?e.get(t):e[t]}function I$(e,t,n){var r=El(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function M$(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Lb(e){return qK&&e instanceof Map}function Fb(e){return WK&&e instanceof Set}function Ln(e){return e.o||e.t}function Q4(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=O$(e);delete t[Fe];for(var n=Ad(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=VK),Object.freeze(e),t&&hs(e,function(n,r){return lm(r,!0)},!0)),e}function VK(){Un(2)}function Y4(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function ha(e){var t=e5[e];return t||Un(18,e),t}function Z4(e,t){e5[e]||(e5[e]=t)}function Hp(){return Wp}function Cx(e,t){t&&(ha("Patches"),e.u=[],e.s=[],e.v=t)}function Gv(e){JC(e),e.p.forEach(jK),e.p=null}function JC(e){e===Wp&&(Wp=e.l)}function ck(e){return Wp={p:[],l:Wp,h:e,m:!0,_:0}}function jK(e){var t=e[Fe];t.i===0||t.i===1?t.j():t.g=!0}function Ex(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||ha("ES5").S(t,e,r),r?(n[Fe].P&&(Gv(t),Un(4)),ti(e)&&(e=Hv(t,e),t.l||qv(t,e)),t.u&&ha("Patches").M(n[Fe].t,e,t.u,t.s)):e=Hv(t,n,[]),Gv(t),t.u&&t.v(t.u,t.s),e!==zb?e:void 0}function Hv(e,t,n){if(Y4(t))return t;var r=t[Fe];if(!r)return hs(t,function(s,l){return dk(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return qv(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=Q4(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),hs(o,function(s,l){return dk(e,r,i,s,l,n,a)}),qv(e,i,!1),n&&e.u&&ha("Patches").N(r,n,e.u,e.s)}return r.o}function dk(e,t,n,r,i,o,a){if(Dr(i)){var s=Hv(e,i,o&&t&&t.i!==3&&!ml(t.R,r)?o.concat(r):void 0);if(I$(n,r,s),!Dr(s))return;e.m=!1}else a&&n.add(i);if(ti(i)&&!Y4(i)){if(!e.h.D&&e._<1)return;Hv(e,i),t&&t.A.l||qv(e,i)}}function qv(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&lm(t,n)}function Tx(e,t){var n=e[Fe];return(n?Ln(n):e)[t]}function fk(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Wr(e){e.P||(e.P=!0,e.l&&Wr(e.l))}function Ax(e){e.o||(e.o=Q4(e.t))}function qp(e,t,n){var r=Lb(t)?ha("MapSet").F(t,n):Fb(t)?ha("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Hp(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=Kp;a&&(l=[s],u=Bh);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):ha("ES5").J(t,n);return(n?n.A:Hp()).p.push(r),r}function Bb(e){return Dr(e)||Un(22,e),function t(n){if(!ti(n))return n;var r,i=n[Fe],o=El(n);if(i){if(!i.P&&(i.i<4||!ha("ES5").K(i)))return i.t;i.I=!0,r=hk(n,o),i.I=!1}else r=hk(n,o);return hs(r,function(a,s){i&&By(i.t,a)===s||I$(r,a,t(s))}),o===3?new Set(r):r}(e)}function hk(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Q4(e)}function J4(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[Fe];return Kp.get(l,o)},set:function(l){var u=this[Fe];Kp.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][Fe];if(!s.P)switch(s.i){case 5:r(s)&&Wr(s);break;case 4:n(s)&&Wr(s)}}}function n(o){for(var a=o.t,s=o.k,l=Ad(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==Fe){var d=a[c];if(d===void 0&&!ml(a,c))return!0;var f=s[c],h=f&&f[Fe];if(h?h.t!==d:!M$(f,d))return!0}}var p=!!a[Fe];return l.length!==Ad(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?b-1:0),m=1;m1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=ha("Patches").$;return Dr(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),Ci=new $$,N$=Ci.produce,nE=Ci.produceWithPatches.bind(Ci),XK=Ci.setAutoFreeze.bind(Ci),QK=Ci.setUseProxies.bind(Ci),t5=Ci.applyPatches.bind(Ci),YK=Ci.createDraft.bind(Ci),ZK=Ci.finishDraft.bind(Ci);const Ul=N$,bLe=Object.freeze(Object.defineProperty({__proto__:null,Immer:$$,applyPatches:t5,castDraft:GK,castImmutable:HK,createDraft:YK,current:Bb,default:Ul,enableAllPlugins:UK,enableES5:J4,enableMapSet:R$,enablePatches:eE,finishDraft:ZK,freeze:lm,immerable:Td,isDraft:Dr,isDraftable:ti,nothing:zb,original:X4,produce:N$,produceWithPatches:nE,setAutoFreeze:XK,setUseProxies:QK},Symbol.toStringTag,{value:"Module"}));function Xp(e){"@babel/helpers - typeof";return Xp=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},Xp(e)}function JK(e,t){if(Xp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Xp(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eX(e){var t=JK(e,"string");return Xp(t)==="symbol"?t:String(t)}function tX(e,t,n){return t=eX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mk(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 yk(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(nr(1));return n(um)(e,t)}if(typeof e!="function")throw new Error(nr(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(nr(3));return o}function d(g){if(typeof g!="function")throw new Error(nr(4));if(l)throw new Error(nr(5));var _=!0;return u(),s.push(g),function(){if(_){if(l)throw new Error(nr(6));_=!1,u();var y=s.indexOf(g);s.splice(y,1),a=null}}}function f(g){if(!nX(g))throw new Error(nr(7));if(typeof g.type>"u")throw new Error(nr(8));if(l)throw new Error(nr(9));try{l=!0,o=i(o,g)}finally{l=!1}for(var _=a=s,b=0;b<_.length;b++){var y=_[b];y()}return g}function h(g){if(typeof g!="function")throw new Error(nr(10));i=g,f({type:sf.REPLACE})}function p(){var g,_=d;return g={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(nr(11));function m(){y.next&&y.next(c())}m();var v=_(m);return{unsubscribe:v}}},g[vk]=function(){return this},g}return f({type:sf.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[vk]=p,r}var D$=um;function rX(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:sf.INIT});if(typeof r>"u")throw new Error(nr(12));if(typeof n(void 0,{type:sf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(nr(13))})}function Mf(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(nr(14));d[h]=_,c=c||_!==g}return c=c||o.length!==Object.keys(l).length,c?d:l}}function bk(e,t){return function(){return t(e.apply(this,arguments))}}function L$(e,t){if(typeof e=="function")return bk(e,t);if(typeof e!="object"||e===null)throw new Error(nr(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=bk(i,t))}return n}function lf(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return Wv}function i(s,l){r(s)===Wv&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var F$=function(t,n){return t===n};function sX(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]-1}function vX(e){return""+e}function bX(e){return function(){return function(t){return function(n){return t(n)}}}}var H$=function(e){j$(t,e);function t(){for(var n=[],r=0;r",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,b){var y=t?t+"."+_:_;if(l){var m=i.some(function(v){return v instanceof RegExp?v.test(y):y===v});if(m)return"continue"}if(!n(b))return{value:{keyPath:y,value:b}};if(typeof b=="object"&&(a=K$(b,y,n,r,i,o),a))return{value:a}},c=0,d=s;c0;if(y){var m=p.filter(function(v){return u(_,v,g)}).length>0;m&&(g.ids=Object.keys(g.entities))}}function f(p,g){return h([p],g)}function h(p,g){var _=eN(p,e,g),b=_[0],y=_[1];d(y,g),n(b,g)}return{removeAll:MX(l),addOne:gn(t),addMany:gn(n),setOne:gn(r),setMany:gn(i),setAll:gn(o),updateOne:gn(c),updateMany:gn(d),upsertOne:gn(f),upsertMany:gn(h),removeOne:gn(a),removeMany:gn(s)}}function RX(e,t){var n=tN(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(y,m){return s([y],m)}function s(y,m){y=Bu(y);var v=y.filter(function(S){return!(cp(S,e)in m.entities)});v.length!==0&&_(v,m)}function l(y,m){return u([y],m)}function u(y,m){y=Bu(y),y.length!==0&&_(y,m)}function c(y,m){y=Bu(y),m.entities={},m.ids=[],s(y,m)}function d(y,m){return f([y],m)}function f(y,m){for(var v=!1,S=0,w=y;S-1;return n&&r}function fm(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Ub(){for(var e=[],t=0;t0)for(var m=h.getState(),v=Array.from(n.values()),S=0,w=v;SMath.floor(e/t)*t,Rr=(e,t)=>Math.round(e/t)*t;var XX=typeof global=="object"&&global&&global.Object===Object&&global;const bN=XX;var QX=typeof self=="object"&&self&&self.Object===Object&&self,YX=bN||QX||Function("return this")();const Ta=YX;var ZX=Ta.Symbol;const Zi=ZX;var _N=Object.prototype,JX=_N.hasOwnProperty,eQ=_N.toString,uh=Zi?Zi.toStringTag:void 0;function tQ(e){var t=JX.call(e,uh),n=e[uh];try{e[uh]=void 0;var r=!0}catch{}var i=eQ.call(e);return r&&(t?e[uh]=n:delete e[uh]),i}var nQ=Object.prototype,rQ=nQ.toString;function iQ(e){return rQ.call(e)}var oQ="[object Null]",aQ="[object Undefined]",Ak=Zi?Zi.toStringTag:void 0;function Bo(e){return e==null?e===void 0?aQ:oQ:Ak&&Ak in Object(e)?tQ(e):iQ(e)}function ni(e){return e!=null&&typeof e=="object"}var sQ="[object Symbol]";function Gb(e){return typeof e=="symbol"||ni(e)&&Bo(e)==sQ}function SN(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=zQ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function GQ(e){return function(){return e}}var HQ=function(){try{var e=fc(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Jv=HQ;var qQ=Jv?function(e,t){return Jv(e,"toString",{configurable:!0,enumerable:!1,value:GQ(t),writable:!0})}:Hb;const WQ=qQ;var KQ=UQ(WQ);const EN=KQ;function TN(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var eY=9007199254740991,tY=/^(?:0|[1-9]\d*)$/;function lE(e,t){var n=typeof e;return t=t??eY,!!t&&(n=="number"||n!="symbol"&&tY.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=iY}function Of(e){return e!=null&&uE(e.length)&&!sE(e)}function Wb(e,t,n){if(!ri(n))return!1;var r=typeof t;return(r=="number"?Of(n)&&lE(t,n.length):r=="string"&&t in n)?mm(n[t],e):!1}function IN(e){return kN(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&Wb(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function bZ(e,t){var n=this.__data__,r=Xb(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function xs(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?LN(s,t-1,n,r,i):gE(i,s):r||(i[i.length]=s)}return i}function DZ(e){var t=e==null?0:e.length;return t?LN(e,1):[]}function LZ(e){return EN(PN(e,void 0,DZ),e+"")}var FZ=NN(Object.getPrototypeOf,Object);const mE=FZ;var BZ="[object Object]",zZ=Function.prototype,VZ=Object.prototype,FN=zZ.toString,jZ=VZ.hasOwnProperty,UZ=FN.call(Object);function BN(e){if(!ni(e)||Bo(e)!=BZ)return!1;var t=mE(e);if(t===null)return!0;var n=jZ.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&FN.call(n)==UZ}function zN(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:zN(e,t,n)}var GZ="\\ud800-\\udfff",HZ="\\u0300-\\u036f",qZ="\\ufe20-\\ufe2f",WZ="\\u20d0-\\u20ff",KZ=HZ+qZ+WZ,XZ="\\ufe0e\\ufe0f",QZ="\\u200d",YZ=RegExp("["+QZ+GZ+KZ+XZ+"]");function Zb(e){return YZ.test(e)}function ZZ(e){return e.split("")}var jN="\\ud800-\\udfff",JZ="\\u0300-\\u036f",eJ="\\ufe20-\\ufe2f",tJ="\\u20d0-\\u20ff",nJ=JZ+eJ+tJ,rJ="\\ufe0e\\ufe0f",iJ="["+jN+"]",a5="["+nJ+"]",s5="\\ud83c[\\udffb-\\udfff]",oJ="(?:"+a5+"|"+s5+")",UN="[^"+jN+"]",GN="(?:\\ud83c[\\udde6-\\uddff]){2}",HN="[\\ud800-\\udbff][\\udc00-\\udfff]",aJ="\\u200d",qN=oJ+"?",WN="["+rJ+"]?",sJ="(?:"+aJ+"(?:"+[UN,GN,HN].join("|")+")"+WN+qN+")*",lJ=WN+qN+sJ,uJ="(?:"+[UN+a5+"?",a5,GN,HN,iJ].join("|")+")",cJ=RegExp(s5+"(?="+s5+")|"+uJ+lJ,"g");function dJ(e){return e.match(cJ)||[]}function KN(e){return Zb(e)?dJ(e):ZZ(e)}function fJ(e){return function(t){t=cf(t);var n=Zb(t)?KN(t):void 0,r=n?n[0]:t.charAt(0),i=n?VN(n,1).join(""):t.slice(1);return r[e]()+i}}var hJ=fJ("toUpperCase");const XN=hJ;function QN(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function al(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=zy(n),n=n===n?n:0),t!==void 0&&(t=zy(t),t=t===t?t:0),ree(zy(e),t,n)}function iee(){this.__data__=new xs,this.size=0}function oee(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function aee(e){return this.__data__.get(e)}function see(e){return this.__data__.has(e)}var lee=200;function uee(e,t){var n=this.__data__;if(n instanceof xs){var r=n.__data__;if(!Jp||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&Gte?new eg:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),Rf(e,gD(e),n),r&&(n=fp(n,are|sre|lre,ore));for(var i=t.length;i--;)ire(n,t[i]);return n});const $f=ure;var cre=AD("length");const dre=cre;var MD="\\ud800-\\udfff",fre="\\u0300-\\u036f",hre="\\ufe20-\\ufe2f",pre="\\u20d0-\\u20ff",gre=fre+hre+pre,mre="\\ufe0e\\ufe0f",yre="["+MD+"]",h5="["+gre+"]",p5="\\ud83c[\\udffb-\\udfff]",vre="(?:"+h5+"|"+p5+")",RD="[^"+MD+"]",OD="(?:\\ud83c[\\udde6-\\uddff]){2}",$D="[\\ud800-\\udbff][\\udc00-\\udfff]",bre="\\u200d",ND=vre+"?",DD="["+mre+"]?",_re="(?:"+bre+"(?:"+[RD,OD,$D].join("|")+")"+DD+ND+")*",Sre=DD+ND+_re,xre="(?:"+[RD+h5+"?",h5,OD,$D,yre].join("|")+")",l6=RegExp(p5+"(?="+p5+")|"+xre+Sre,"g");function wre(e){for(var t=l6.lastIndex=0;l6.test(e);)++t;return t}function LD(e){return Zb(e)?wre(e):dre(e)}var Cre=Math.floor,Ere=Math.random;function Tre(e,t){return e+Cre(Ere()*(t-e+1))}var Are=parseFloat,Pre=Math.min,kre=Math.random;function Ire(e,t,n){if(n&&typeof n!="boolean"&&Wb(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=Md(e),t===void 0?(t=e,e=0):t=Md(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=kre();return Pre(e+i*(t-e+Are("1e-"+((i+"").length-1))),t)}return Tre(e,t)}var Mre=Math.ceil,Rre=Math.max;function Ore(e,t,n,r){for(var i=-1,o=Rre(Mre((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function $re(e){return function(t,n,r){return r&&typeof r!="number"&&Wb(t,n,r)&&(n=r=void 0),t=Md(t),n===void 0?(n=t,t=0):n=Md(n),r=r===void 0?t=o)return e;var s=n-LD(r);if(s<1)return r;var l=a?VN(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),tre(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,cf(Gre.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Zv(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Hre=1/0,qre=Rd&&1/bE(new Rd([,-0]))[1]==Hre?function(e){return new Rd(e)}:BQ;const Wre=qre;var Kre=200;function FD(e,t,n){var r=-1,i=JQ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=Bne;else if(o>=Kre){var u=t?null:Wre(e);if(u)return bE(u);a=!1,i=xD,l=new eg}else l=t?[]:s;e:for(;++r{Od(e,t.payload)}}}),{configChanged:Qre}=zD.actions,Yre=zD.reducer,VD=ge("socket/socketConnected"),CE=ge("socket/appSocketConnected"),jD=ge("socket/socketDisconnected"),UD=ge("socket/appSocketDisconnected"),Zre=ge("socket/socketSubscribedSession"),Jre=ge("socket/appSocketSubscribedSession"),eie=ge("socket/socketUnsubscribedSession"),tie=ge("socket/appSocketUnsubscribedSession"),GD=ge("socket/socketInvocationStarted"),EE=ge("socket/appSocketInvocationStarted"),TE=ge("socket/socketInvocationComplete"),AE=ge("socket/appSocketInvocationComplete"),HD=ge("socket/socketInvocationError"),i_=ge("socket/appSocketInvocationError"),qD=ge("socket/socketGraphExecutionStateComplete"),WD=ge("socket/appSocketGraphExecutionStateComplete"),KD=ge("socket/socketGeneratorProgress"),PE=ge("socket/appSocketGeneratorProgress"),XD=ge("socket/socketModelLoadStarted"),QD=ge("socket/appSocketModelLoadStarted"),YD=ge("socket/socketModelLoadCompleted"),ZD=ge("socket/appSocketModelLoadCompleted"),JD=ge("socket/socketSessionRetrievalError"),eL=ge("socket/appSocketSessionRetrievalError"),tL=ge("socket/socketInvocationRetrievalError"),nL=ge("socket/appSocketInvocationRetrievalError"),rL=ge("socket/socketQueueItemStatusChanged"),o_=ge("socket/appSocketQueueItemStatusChanged");let S0;const nie=new Uint8Array(16);function rie(){if(!S0&&(S0=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!S0))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S0(nie)}const er=[];for(let e=0;e<256;++e)er.push((e+256).toString(16).slice(1));function iie(e,t=0){return er[e[t+0]]+er[e[t+1]]+er[e[t+2]]+er[e[t+3]]+"-"+er[e[t+4]]+er[e[t+5]]+"-"+er[e[t+6]]+er[e[t+7]]+"-"+er[e[t+8]]+er[e[t+9]]+"-"+er[e[t+10]]+er[e[t+11]]+er[e[t+12]]+er[e[t+13]]+er[e[t+14]]+er[e[t+15]]}const oie=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),c6={randomUUID:oie};function yl(e,t,n){if(c6.randomUUID&&!t&&!e)return c6.randomUUID();e=e||{};const r=e.random||(e.rng||rie)();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 iie(r)}const aie={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class t1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||aie,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function ch(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function d6(e){return e==null?"":""+e}function sie(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function kE(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const 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 f6(e,t,n){const{obj:r,k:i}=kE(e,t,Object);r[i]=n}function lie(e,t,n,r){const{obj:i,k:o}=kE(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function n1(e,t){const{obj:n,k:r}=kE(e,t);if(n)return n[r]}function uie(e,t,n){const r=n1(e,n);return r!==void 0?r:n1(t,n)}function iL(e,t,n){for(const 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]):iL(e[r],t[r],n):e[r]=t[r]);return e}function kc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var cie={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function die(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>cie[t]):e}const fie=[" ",",","?","!",";"];function hie(e,t,n){t=t||"",n=n||"";const r=fie.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function r1(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let 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]}const u=r.slice(o+a).join(n);return u?r1(l,u,n):void 0}i=i[r[o]]}return i}function i1(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class h6 extends a_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=n1(this.data,s);return l||!a||typeof r!="string"?l:r1(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),f6(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=n1(this.data,s)||{};i?iL(l,r,o):l={...l,...r},f6(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var oL={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const p6={};class o1 extends a_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),sie(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=sa.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!hie(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const v=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${v}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${v}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,g=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(g)<0&&!(typeof b=="string"&&g==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const v=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=v,d.usedParams=this.getUsedParamsDetails(n),d):v}if(o){const v=g==="[object Array]",S=v?[]:{},w=v?p:h;for(const C in f)if(Object.prototype.hasOwnProperty.call(f,C)){const x=`${w}${o}${C}`;S[C]=this.translate(x,{...n,joinArrays:!1,ns:s}),S[C]===x&&(S[C]=f[C])}f=S}}else if(y&&typeof b=="string"&&g==="[object Array]")f=f.join(b),f&&(f=this.extendTranslation(f,t,n,r));else{let v=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",C=o1.hasDefaultValue(n),x=w?this.pluralResolver.getSuffix(u,n.count,n):"",P=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",E=n[`defaultValue${x}`]||n[`defaultValue${P}`]||n.defaultValue;!this.isValidLookup(f)&&C&&(v=!0,f=E),this.isValidLookup(f)||(S=!0,f=a);const N=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,M=C&&E!==f&&this.options.updateMissing;if(S||v||M){if(this.logger.log(M?"updateKey":"missingKey",u,l,a,M?E:f),o){const D=this.resolve(a,{...n,keySeparator:!1});D&&D.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.")}let T=[];const A=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&A&&A[0])for(let D=0;D{const O=C&&L!==f?L:N;this.options.missingKeyHandler?this.options.missingKeyHandler(D,l,$,O,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(D,l,$,O,M,n),this.emit("missingKey",D,l,$,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?T.forEach(D=>{this.pluralResolver.getSuffixes(D,n).forEach($=>{R([D],a+$,n[`defaultValue${$}`]||E)})}):R(T,a,E))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||v)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,v?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!p6[`${g[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(p6[`${g[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${s}" 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!!!")),g.forEach(b=>{if(this.isValidLookup(r))return;a=b;const y=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,c,b,_,n);else{let v;f&&(v=this.pluralResolver.getSuffix(b,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(c+v),n.ordinal&&v.indexOf(w)===0&&y.push(c+v.replace(w,this.options.pluralSeparator)),h&&y.push(c+S)),p){const C=`${c}${this.options.contextSeparator}${n.context}`;y.push(C),f&&(y.push(C+v),n.ordinal&&v.indexOf(w)===0&&y.push(C+v.replace(w,this.options.pluralSeparator)),h&&y.push(C+S))}}let m;for(;m=y.pop();)this.isValidLookup(r)||(o=m,r=this.getResource(b,_,m,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&typeof t.replace!="string";let i=r?t.replace:t;if(r&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const o of n)delete i[o]}return i}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function $x(e){return e.charAt(0).toUpperCase()+e.slice(1)}class g6{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=sa.create("languageUtils")}getScriptPartFromCode(t){if(t=i1(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=i1(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=$x(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=$x(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=$x(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let pie=[{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}],gie={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const mie=["v1","v2","v3"],yie=["v4"],m6={zero:0,one:1,two:2,few:3,many:4,other:5};function vie(){const e={};return pie.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:gie[t.fc]}})}),e}class bie{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=sa.create("pluralResolver"),(!this.options.compatibilityJSON||yie.includes(this.options.compatibilityJSON))&&(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=vie()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(i1(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>m6[i]-m6[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!mie.includes(this.options.compatibilityJSON)}}function y6(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=uie(e,t,n);return!o&&i&&typeof n=="string"&&(o=r1(e,n,r),o===void 0&&(o=r1(t,n,r))),o}class _ie{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=sa.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:die,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?kc(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?kc(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?kc(n.nestingPrefix):n.nestingPrefixEscaped||kc("$t("),this.nestingSuffix=n.nestingSuffix?kc(n.nestingSuffix):n.nestingSuffixEscaped||kc(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const y=y6(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:p}):y}const g=p.split(this.formatSeparator),_=g.shift().trim(),b=g.join(this.formatSeparator).trim();return this.format(y6(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const g=o[1].trim();if(a=c(g),a===void 0)if(typeof d=="function"){const b=d(t,o,i);a=typeof b=="string"?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=d6(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=d6(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function Sie(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function Ic(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(i1(i),o),t[a]=s),s(r)}}class xie{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=sa.create("formatter"),this.options=t,this.formats={number:Ic((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:Ic((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:Ic((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:Ic((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:Ic((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Ic(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=Sie(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function wie(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class Cie extends a_{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=sa.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{lie(l.loaded,[o],a),wie(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=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."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function v6(){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:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function b6(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 x0(){}function Eie(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class ng extends a_{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=b6(t),this.services={},this.logger=sa,this.modules={external:[]},Eie(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=v6();this.options={...i,...this.options,...b6(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?sa.init(o(this.modules.logger),this.options):sa.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=xie);const d=new g6(this.options);this.store=new h6(this.options.resources,this.options);const f=this.services;f.logger=sa,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new bie(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new _ie(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Cie(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=x0),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=ch(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x0;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],a=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=ch();return t||(t=this.languages),n||(n=this.options.ns),r||(r=x0),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&oL.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=ch();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&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;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=ch();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=ch();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["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"],r=this.services&&this.services.languageUtils||new g6(v6());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new ng(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x0;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new ng(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new h6(this.store.data,i),o.services.resourceStore=o.store),o.translator=new o1(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c{switch(t){case"controlnet":return Od(Ye(Tie),{id:e,...n});case"t2i_adapter":return Od(Ye(Aie),{id:e,...n});case"ip_adapter":return Od(Ye(Pie),{id:e,...n});default:throw new Error(`Unknown control adapter type: ${t}`)}},IE=ge("controlAdapters/imageProcessed"),s_=e=>e.type==="controlnet",aL=e=>e.type==="ip_adapter",ME=e=>e.type==="t2i_adapter",gi=e=>s_(e)||ME(e),pn=Ji(),{selectById:di,selectAll:Aa,selectEntities:xLe,selectIds:wLe,selectTotal:CLe}=pn.getSelectors(),m5=pn.getInitialState({pendingControlImages:[]}),kie=e=>Aa(e).filter(s_),Iie=e=>Aa(e).filter(s_).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),Mie=e=>Aa(e).filter(aL),Rie=e=>Aa(e).filter(aL).filter(t=>t.isEnabled&&t.model&&!!t.controlImage),Oie=e=>Aa(e).filter(ME),$ie=e=>Aa(e).filter(ME).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),sL=Wt({name:"controlAdapters",initialState:m5,reducers:{controlAdapterAdded:{reducer:(e,t)=>{const{id:n,type:r,overrides:i}=t.payload;pn.addOne(e,_6(n,r,i))},prepare:({type:e,overrides:t})=>({payload:{id:yl(),type:e,overrides:t}})},controlAdapterRecalled:(e,t)=>{pn.addOne(e,t.payload)},controlAdapterDuplicated:{reducer:(e,t)=>{const{id:n,newId:r}=t.payload,i=di(e,n);if(!i)return;const o=Od(Ye(i),{id:r,isEnabled:!0});pn.addOne(e,o)},prepare:e=>({payload:{id:e,newId:yl()}})},controlAdapterAddedFromImage:{reducer:(e,t)=>{const{id:n,type:r,controlImage:i}=t.payload;pn.addOne(e,_6(n,r,{controlImage:i}))},prepare:e=>({payload:{...e,id:yl()}})},controlAdapterRemoved:(e,t)=>{pn.removeOne(e,t.payload.id)},controlAdapterIsEnabledChanged:(e,t)=>{const{id:n,isEnabled:r}=t.payload;pn.updateOne(e,{id:n,changes:{isEnabled:r}})},controlAdapterImageChanged:(e,t)=>{const{id:n,controlImage:r}=t.payload,i=di(e,n);i&&(pn.updateOne(e,{id:n,changes:{controlImage:r,processedControlImage:null}}),r!==null&&gi(i)&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlAdapterProcessedImageChanged:(e,t)=>{const{id:n,processedControlImage:r}=t.payload,i=di(e,n);i&&gi(i)&&(pn.updateOne(e,{id:n,changes:{processedControlImage:r}}),e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlAdapterModelCleared:(e,t)=>{pn.updateOne(e,{id:t.payload.id,changes:{model:null}})},controlAdapterModelChanged:(e,t)=>{const{id:n,model:r}=t.payload,i=di(e,n);if(!i)return;if(!gi(i)){pn.updateOne(e,{id:n,changes:{model:r}});return}const o={id:n,changes:{model:r}};if(o.changes.processedControlImage=null,i.shouldAutoConfig){let a;for(const s in w0)if(r.model_name.includes(s)){a=w0[s];break}a?(o.changes.processorType=a,o.changes.processorNode=Su[a].default):(o.changes.processorType="none",o.changes.processorNode=Su.none.default)}pn.updateOne(e,o)},controlAdapterWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload;pn.updateOne(e,{id:n,changes:{weight:r}})},controlAdapterBeginStepPctChanged:(e,t)=>{const{id:n,beginStepPct:r}=t.payload;pn.updateOne(e,{id:n,changes:{beginStepPct:r}})},controlAdapterEndStepPctChanged:(e,t)=>{const{id:n,endStepPct:r}=t.payload;pn.updateOne(e,{id:n,changes:{endStepPct:r}})},controlAdapterControlModeChanged:(e,t)=>{const{id:n,controlMode:r}=t.payload,i=di(e,n);!i||!s_(i)||pn.updateOne(e,{id:n,changes:{controlMode:r}})},controlAdapterResizeModeChanged:(e,t)=>{const{id:n,resizeMode:r}=t.payload,i=di(e,n);!i||!gi(i)||pn.updateOne(e,{id:n,changes:{resizeMode:r}})},controlAdapterProcessorParamsChanged:(e,t)=>{const{id:n,params:r}=t.payload,i=di(e,n);if(!i||!gi(i)||!i.processorNode)return;const o=Od(Ye(i.processorNode),r);pn.updateOne(e,{id:n,changes:{shouldAutoConfig:!1,processorNode:o}})},controlAdapterProcessortTypeChanged:(e,t)=>{const{id:n,processorType:r}=t.payload,i=di(e,n);if(!i||!gi(i))return;const o=Ye(Su[r].default);pn.updateOne(e,{id:n,changes:{processorType:r,processedControlImage:null,processorNode:o,shouldAutoConfig:!1}})},controlAdapterAutoConfigToggled:(e,t)=>{var o;const{id:n}=t.payload,r=di(e,n);if(!r||!gi(r))return;const i={id:n,changes:{shouldAutoConfig:!r.shouldAutoConfig}};if(i.changes.shouldAutoConfig){let a;for(const s in w0)if((o=r.model)!=null&&o.model_name.includes(s)){a=w0[s];break}a?(i.changes.processorType=a,i.changes.processorNode=Su[a].default):(i.changes.processorType="none",i.changes.processorNode=Su.none.default)}pn.updateOne(e,i)},controlAdaptersReset:()=>Ye(m5),pendingControlImagesCleared:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(IE,(t,n)=>{const r=di(t,n.payload.id);r&&r.controlImage!==null&&(t.pendingControlImages=Xre(t.pendingControlImages.concat(n.payload.id)))}),e.addCase(i_,t=>{t.pendingControlImages=[]})}}),{controlAdapterAdded:Nie,controlAdapterRecalled:Die,controlAdapterDuplicated:ELe,controlAdapterAddedFromImage:Lie,controlAdapterRemoved:TLe,controlAdapterImageChanged:Hl,controlAdapterProcessedImageChanged:RE,controlAdapterIsEnabledChanged:OE,controlAdapterModelChanged:S6,controlAdapterWeightChanged:ALe,controlAdapterBeginStepPctChanged:PLe,controlAdapterEndStepPctChanged:kLe,controlAdapterControlModeChanged:ILe,controlAdapterResizeModeChanged:MLe,controlAdapterProcessorParamsChanged:Fie,controlAdapterProcessortTypeChanged:Bie,controlAdaptersReset:zie,controlAdapterAutoConfigToggled:x6,pendingControlImagesCleared:Vie,controlAdapterModelCleared:Nx}=sL.actions,jie=sL.reducer,Uie=si(Nie,Lie,Die),RLe={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},OLe={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Gie={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},$Le={lycoris:"LyCORIS",diffusers:"Diffusers"},Hie=0,hp=4294967295;var ut;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ut||(ut={}));var y5;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(y5||(y5={}));const he=ut.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return he.undefined;case"string":return he.string;case"number":return isNaN(e)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(e)?he.array:e===null?he.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?he.promise:typeof Map<"u"&&e instanceof Map?he.map:typeof Set<"u"&&e instanceof Set?he.set:typeof Date<"u"&&e instanceof Date?he.date:he.object;default:return he.unknown}},ie=ut.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),qie=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ko extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ko.create=e=>new ko(e);const rg=(e,t)=>{let n;switch(e.code){case ie.invalid_type:e.received===he.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ut.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${ut.joinValues(e.keys,", ")}`;break;case ie.invalid_union:n="Invalid input";break;case ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ut.joinValues(e.options)}`;break;case ie.invalid_enum_value:n=`Invalid enum value. Expected ${ut.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:n="Invalid function arguments";break;case ie.invalid_return_type:n="Invalid function return type";break;case ie.invalid_date:n="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ut.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ie.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ie.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ie.custom:n="Invalid input";break;case ie.invalid_intersection_types:n="Intersection results could not be merged";break;case ie.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:n="Number must be finite";break;default:n=t.defaultError,ut.assertNever(e)}return{message:n}};let lL=rg;function Wie(e){lL=e}function a1(){return lL}const s1=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},Kie=[];function ye(e,t){const n=s1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a1(),rg].filter(r=>!!r)});e.common.issues.push(n)}class _r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Le;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return _r.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return Le;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const Le=Object.freeze({status:"aborted"}),uL=e=>({status:"dirty",value:e}),Lr=e=>({status:"valid",value:e}),v5=e=>e.status==="aborted",b5=e=>e.status==="dirty",ig=e=>e.status==="valid",l1=e=>typeof Promise<"u"&&e instanceof Promise;var Ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ie||(Ie={}));class Sa{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const w6=(e,t)=>{if(ig(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ko(e.common.issues);return this._error=n,this._error}}};function Be(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class ze{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new _r,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(l1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:i.path,parent:i});return w6(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(l1(i)?i:Promise.resolve(i));return w6(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:ie.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new No({schema:this,typeName:Oe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return rs.create(this,this._def)}nullable(){return rc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Io.create(this,this._def)}promise(){return hf.create(this,this._def)}or(t){return lg.create([this,t],this._def)}and(t){return ug.create(this,t,this._def)}transform(t){return new No({...Be(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new pg({...Be(this._def),innerType:this,defaultValue:n,typeName:Oe.ZodDefault})}brand(){return new dL({typeName:Oe.ZodBranded,type:this,...Be(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new f1({...Be(this._def),innerType:this,catchValue:n,typeName:Oe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return _m.create(this,t)}readonly(){return p1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xie=/^c[^\s-]{8,}$/i,Qie=/^[a-z][a-z0-9]*$/,Yie=/^[0-9A-HJKMNP-TV-Z]{26}$/,Zie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Jie=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,eoe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Dx;const toe=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,noe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,roe=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ioe(e,t){return!!((t==="v4"||!t)&&toe.test(e)||(t==="v6"||!t)&&noe.test(e))}class Eo extends ze{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==he.string){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.string,received:o.parsedType}),Le}const r=new _r;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),ye(i,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.lengtht.test(i),{validation:n,code:ie.invalid_string,...Ie.errToObj(r)})}_addCheck(t){return new Eo({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ie.errToObj(t)})}datetime(t){var n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...Ie.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ie.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ie.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ie.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ie.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ie.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ie.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ie.errToObj(n)})}nonempty(t){return this.min(1,Ie.errToObj(t))}trim(){return new Eo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Eo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Eo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Eo({checks:[],typeName:Oe.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Be(e)})};function ooe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class Pl extends ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==he.number){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.number,received:o.parsedType}),Le}let r;const i=new _r;for(const o of this._def.checks)o.kind==="int"?ut.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?ooe(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.not_finite,message:o.message}),i.dirty()):ut.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ie.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ie.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ie.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ie.toString(n))}setLimit(t,n,r,i){return new Pl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ie.toString(i)}]})}_addCheck(t){return new Pl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ie.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ie.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ie.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&ut.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Pl({checks:[],typeName:Oe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class kl extends ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==he.bigint){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.bigint,received:o.parsedType}),Le}let r;const i=new _r;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ye(r,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ut.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ie.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ie.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ie.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ie.toString(n))}setLimit(t,n,r,i){return new kl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ie.toString(i)}]})}_addCheck(t){return new kl({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ie.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ie.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new kl({checks:[],typeName:Oe.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Be(e)})};class og extends ze{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==he.boolean){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.boolean,received:r.parsedType}),Le}return Lr(t.data)}}og.create=e=>new og({typeName:Oe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class tc extends ze{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==he.date){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_type,expected:he.date,received:o.parsedType}),Le}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ye(o,{code:ie.invalid_date}),Le}const r=new _r;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),ye(i,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):ut.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new tc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ie.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ie.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew tc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Oe.ZodDate,...Be(e)});class u1 extends ze{_parse(t){if(this._getType(t)!==he.symbol){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.symbol,received:r.parsedType}),Le}return Lr(t.data)}}u1.create=e=>new u1({typeName:Oe.ZodSymbol,...Be(e)});class ag extends ze{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.undefined,received:r.parsedType}),Le}return Lr(t.data)}}ag.create=e=>new ag({typeName:Oe.ZodUndefined,...Be(e)});class sg extends ze{_parse(t){if(this._getType(t)!==he.null){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.null,received:r.parsedType}),Le}return Lr(t.data)}}sg.create=e=>new sg({typeName:Oe.ZodNull,...Be(e)});class ff extends ze{constructor(){super(...arguments),this._any=!0}_parse(t){return Lr(t.data)}}ff.create=e=>new ff({typeName:Oe.ZodAny,...Be(e)});class zu extends ze{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Lr(t.data)}}zu.create=e=>new zu({typeName:Oe.ZodUnknown,...Be(e)});class gs extends ze{_parse(t){const n=this._getOrReturnCtx(t);return ye(n,{code:ie.invalid_type,expected:he.never,received:n.parsedType}),Le}}gs.create=e=>new gs({typeName:Oe.ZodNever,...Be(e)});class c1 extends ze{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.void,received:r.parsedType}),Le}return Lr(t.data)}}c1.create=e=>new c1({typeName:Oe.ZodVoid,...Be(e)});class Io extends ze{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==he.array)return ye(n,{code:ie.invalid_type,expected:he.array,received:n.parsedType}),Le;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(ye(n,{code:ie.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Sa(n,a,n.path,s)))).then(a=>_r.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Sa(n,a,n.path,s)));return _r.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Io({...this._def,minLength:{value:t,message:Ie.toString(n)}})}max(t,n){return new Io({...this._def,maxLength:{value:t,message:Ie.toString(n)}})}length(t,n){return new Io({...this._def,exactLength:{value:t,message:Ie.toString(n)}})}nonempty(t){return this.min(1,t)}}Io.create=(e,t)=>new Io({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Be(t)});function Hc(e){if(e instanceof Qt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=rs.create(Hc(r))}return new Qt({...e._def,shape:()=>t})}else return e instanceof Io?new Io({...e._def,type:Hc(e.element)}):e instanceof rs?rs.create(Hc(e.unwrap())):e instanceof rc?rc.create(Hc(e.unwrap())):e instanceof xa?xa.create(e.items.map(t=>Hc(t))):e}class Qt extends ze{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=ut.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==he.object){const u=this._getOrReturnCtx(t);return ye(u,{code:ie.invalid_type,expected:he.object,received:u.parsedType}),Le}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof gs&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Sa(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof gs){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(ye(i,{code:ie.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Sa(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>_r.mergeObjectSync(r,u)):_r.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Ie.errToObj,new Qt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=Ie.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Qt({...this._def,unknownKeys:"strip"})}passthrough(){return new Qt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Qt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Qt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Oe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Qt({...this._def,catchall:t})}pick(t){const n={};return ut.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Qt({...this._def,shape:()=>n})}omit(t){const n={};return ut.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Qt({...this._def,shape:()=>n})}deepPartial(){return Hc(this)}partial(t){const n={};return ut.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new Qt({...this._def,shape:()=>n})}required(t){const n={};return ut.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof rs;)o=o._def.innerType;n[r]=o}}),new Qt({...this._def,shape:()=>n})}keyof(){return cL(ut.objectKeys(this.shape))}}Qt.create=(e,t)=>new Qt({shape:()=>e,unknownKeys:"strip",catchall:gs.create(),typeName:Oe.ZodObject,...Be(t)});Qt.strictCreate=(e,t)=>new Qt({shape:()=>e,unknownKeys:"strict",catchall:gs.create(),typeName:Oe.ZodObject,...Be(t)});Qt.lazycreate=(e,t)=>new Qt({shape:e,unknownKeys:"strip",catchall:gs.create(),typeName:Oe.ZodObject,...Be(t)});class lg extends ze{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new ko(s.ctx.common.issues));return ye(n,{code:ie.invalid_union,unionErrors:a}),Le}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new ko(l));return ye(n,{code:ie.invalid_union,unionErrors:s}),Le}}get options(){return this._def.options}}lg.create=(e,t)=>new lg({options:e,typeName:Oe.ZodUnion,...Be(t)});const jy=e=>e instanceof dg?jy(e.schema):e instanceof No?jy(e.innerType()):e instanceof fg?[e.value]:e instanceof Il?e.options:e instanceof hg?Object.keys(e.enum):e instanceof pg?jy(e._def.innerType):e instanceof ag?[void 0]:e instanceof sg?[null]:null;class l_ extends ze{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.object)return ye(n,{code:ie.invalid_type,expected:he.object,received:n.parsedType}),Le;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ye(n,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Le)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=jy(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new l_({typeName:Oe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Be(r)})}}function _5(e,t){const n=Zs(e),r=Zs(t);if(e===t)return{valid:!0,data:e};if(n===he.object&&r===he.object){const i=ut.objectKeys(t),o=ut.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=_5(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===he.array&&r===he.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(v5(o)||v5(a))return Le;const s=_5(o.value,a.value);return s.valid?((b5(o)||b5(a))&&n.dirty(),{status:n.value,value:s.data}):(ye(r,{code:ie.invalid_intersection_types}),Le)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ug.create=(e,t,n)=>new ug({left:e,right:t,typeName:Oe.ZodIntersection,...Be(n)});class xa extends ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.array)return ye(r,{code:ie.invalid_type,expected:he.array,received:r.parsedType}),Le;if(r.data.lengththis._def.items.length&&(ye(r,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Sa(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>_r.mergeArray(n,a)):_r.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new xa({...this._def,rest:t})}}xa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xa({items:e,typeName:Oe.ZodTuple,rest:null,...Be(t)})};class cg extends ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.object)return ye(r,{code:ie.invalid_type,expected:he.object,received:r.parsedType}),Le;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Sa(r,s,r.path,s)),value:a._parse(new Sa(r,r.data[s],r.path,s))});return r.common.async?_r.mergeObjectAsync(n,i):_r.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ze?new cg({keyType:t,valueType:n,typeName:Oe.ZodRecord,...Be(r)}):new cg({keyType:Eo.create(),valueType:t,typeName:Oe.ZodRecord,...Be(n)})}}class d1 extends ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.map)return ye(r,{code:ie.invalid_type,expected:he.map,received:r.parsedType}),Le;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new Sa(r,s,r.path,[u,"key"])),value:o._parse(new Sa(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return Le;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return Le;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}d1.create=(e,t,n)=>new d1({valueType:t,keyType:e,typeName:Oe.ZodMap,...Be(n)});class nc extends ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.set)return ye(r,{code:ie.invalid_type,expected:he.set,received:r.parsedType}),Le;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ye(r,{code:ie.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return Le;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new Sa(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new nc({...this._def,minSize:{value:t,message:Ie.toString(n)}})}max(t,n){return new nc({...this._def,maxSize:{value:t,message:Ie.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}nc.create=(e,t)=>new nc({valueType:e,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Be(t)});class $d extends ze{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.function)return ye(n,{code:ie.invalid_type,expected:he.function,received:n.parsedType}),Le;function r(s,l){return s1({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,a1(),rg].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:l}})}function i(s,l){return s1({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,a1(),rg].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof hf){const s=this;return Lr(async function(...l){const u=new ko([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return Lr(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new ko([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new ko([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new $d({...this._def,args:xa.create(t).rest(zu.create())})}returns(t){return new $d({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new $d({args:t||xa.create([]).rest(zu.create()),returns:n||zu.create(),typeName:Oe.ZodFunction,...Be(r)})}}class dg extends ze{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dg.create=(e,t)=>new dg({getter:e,typeName:Oe.ZodLazy,...Be(t)});class fg extends ze{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ye(n,{received:n.data,code:ie.invalid_literal,expected:this._def.value}),Le}return{status:"valid",value:t.data}}get value(){return this._def.value}}fg.create=(e,t)=>new fg({value:e,typeName:Oe.ZodLiteral,...Be(t)});function cL(e,t){return new Il({values:e,typeName:Oe.ZodEnum,...Be(t)})}class Il extends ze{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ye(n,{expected:ut.joinValues(r),received:n.parsedType,code:ie.invalid_type}),Le}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return ye(n,{received:n.data,code:ie.invalid_enum_value,options:r}),Le}return Lr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Il.create(t)}exclude(t){return Il.create(this.options.filter(n=>!t.includes(n)))}}Il.create=cL;class hg extends ze{_parse(t){const n=ut.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==he.string&&r.parsedType!==he.number){const i=ut.objectValues(n);return ye(r,{expected:ut.joinValues(i),received:r.parsedType,code:ie.invalid_type}),Le}if(n.indexOf(t.data)===-1){const i=ut.objectValues(n);return ye(r,{received:r.data,code:ie.invalid_enum_value,options:i}),Le}return Lr(t.data)}get enum(){return this._def.values}}hg.create=(e,t)=>new hg({values:e,typeName:Oe.ZodNativeEnum,...Be(t)});class hf extends ze{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.promise&&n.common.async===!1)return ye(n,{code:ie.invalid_type,expected:he.promise,received:n.parsedType}),Le;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return Lr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}hf.create=(e,t)=>new hf({type:e,typeName:Oe.ZodPromise,...Be(t)});class No extends ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{ye(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Le:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Le:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ig(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ig(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);ut.assertNever(i)}}No.create=(e,t,n)=>new No({schema:e,typeName:Oe.ZodEffects,effect:t,...Be(n)});No.createWithPreprocess=(e,t,n)=>new No({schema:t,effect:{type:"preprocess",transform:e},typeName:Oe.ZodEffects,...Be(n)});class rs extends ze{_parse(t){return this._getType(t)===he.undefined?Lr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:Oe.ZodOptional,...Be(t)});class rc extends ze{_parse(t){return this._getType(t)===he.null?Lr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}rc.create=(e,t)=>new rc({innerType:e,typeName:Oe.ZodNullable,...Be(t)});class pg extends ze{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}pg.create=(e,t)=>new pg({innerType:e,typeName:Oe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Be(t)});class f1 extends ze{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return l1(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ko(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ko(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}f1.create=(e,t)=>new f1({innerType:e,typeName:Oe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Be(t)});class h1 extends ze{_parse(t){if(this._getType(t)!==he.nan){const r=this._getOrReturnCtx(t);return ye(r,{code:ie.invalid_type,expected:he.nan,received:r.parsedType}),Le}return{status:"valid",value:t.data}}}h1.create=e=>new h1({typeName:Oe.ZodNaN,...Be(e)});const aoe=Symbol("zod_brand");class dL extends ze{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class _m extends ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Le:o.status==="dirty"?(n.dirty(),uL(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Le:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new _m({in:t,out:n,typeName:Oe.ZodPipeline})}}class p1 extends ze{_parse(t){const n=this._def.innerType._parse(t);return ig(n)&&(n.value=Object.freeze(n.value)),n}}p1.create=(e,t)=>new p1({innerType:e,typeName:Oe.ZodReadonly,...Be(t)});const fL=(e,t={},n)=>e?ff.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):ff.create(),soe={object:Qt.lazycreate};var Oe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Oe||(Oe={}));const loe=(e,t={message:`Input not instance of ${e.name}`})=>fL(n=>n instanceof e,t),hL=Eo.create,pL=Pl.create,uoe=h1.create,coe=kl.create,gL=og.create,doe=tc.create,foe=u1.create,hoe=ag.create,poe=sg.create,goe=ff.create,moe=zu.create,yoe=gs.create,voe=c1.create,boe=Io.create,_oe=Qt.create,Soe=Qt.strictCreate,xoe=lg.create,woe=l_.create,Coe=ug.create,Eoe=xa.create,Toe=cg.create,Aoe=d1.create,Poe=nc.create,koe=$d.create,Ioe=dg.create,Moe=fg.create,Roe=Il.create,Ooe=hg.create,$oe=hf.create,C6=No.create,Noe=rs.create,Doe=rc.create,Loe=No.createWithPreprocess,Foe=_m.create,Boe=()=>hL().optional(),zoe=()=>pL().optional(),Voe=()=>gL().optional(),joe={string:e=>Eo.create({...e,coerce:!0}),number:e=>Pl.create({...e,coerce:!0}),boolean:e=>og.create({...e,coerce:!0}),bigint:e=>kl.create({...e,coerce:!0}),date:e=>tc.create({...e,coerce:!0})},Uoe=Le;var F=Object.freeze({__proto__:null,defaultErrorMap:rg,setErrorMap:Wie,getErrorMap:a1,makeIssue:s1,EMPTY_PATH:Kie,addIssueToContext:ye,ParseStatus:_r,INVALID:Le,DIRTY:uL,OK:Lr,isAborted:v5,isDirty:b5,isValid:ig,isAsync:l1,get util(){return ut},get objectUtil(){return y5},ZodParsedType:he,getParsedType:Zs,ZodType:ze,ZodString:Eo,ZodNumber:Pl,ZodBigInt:kl,ZodBoolean:og,ZodDate:tc,ZodSymbol:u1,ZodUndefined:ag,ZodNull:sg,ZodAny:ff,ZodUnknown:zu,ZodNever:gs,ZodVoid:c1,ZodArray:Io,ZodObject:Qt,ZodUnion:lg,ZodDiscriminatedUnion:l_,ZodIntersection:ug,ZodTuple:xa,ZodRecord:cg,ZodMap:d1,ZodSet:nc,ZodFunction:$d,ZodLazy:dg,ZodLiteral:fg,ZodEnum:Il,ZodNativeEnum:hg,ZodPromise:hf,ZodEffects:No,ZodTransformer:No,ZodOptional:rs,ZodNullable:rc,ZodDefault:pg,ZodCatch:f1,ZodNaN:h1,BRAND:aoe,ZodBranded:dL,ZodPipeline:_m,ZodReadonly:p1,custom:fL,Schema:ze,ZodSchema:ze,late:soe,get ZodFirstPartyTypeKind(){return Oe},coerce:joe,any:goe,array:boe,bigint:coe,boolean:gL,date:doe,discriminatedUnion:woe,effect:C6,enum:Roe,function:koe,instanceof:loe,intersection:Coe,lazy:Ioe,literal:Moe,map:Aoe,nan:uoe,nativeEnum:Ooe,never:yoe,null:poe,nullable:Doe,number:pL,object:_oe,oboolean:Voe,onumber:zoe,optional:Noe,ostring:Boe,pipeline:Foe,preprocess:Loe,promise:$oe,record:Toe,set:Poe,strictObject:Soe,string:hL,symbol:foe,transformer:C6,tuple:Eoe,undefined:hoe,union:xoe,unknown:moe,void:voe,NEVER:Uoe,ZodIssueCode:ie,quotelessJson:qie,ZodError:ko});const Goe=F.string(),NLe=e=>Goe.safeParse(e).success,Hoe=F.string(),DLe=e=>Hoe.safeParse(e).success,qoe=F.string(),LLe=e=>qoe.safeParse(e).success,Woe=F.string(),FLe=e=>Woe.safeParse(e).success,Koe=F.number().int().min(1),BLe=e=>Koe.safeParse(e).success,Xoe=F.number().min(1),zLe=e=>Xoe.safeParse(e).success,mL=F.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a","lcm"]),VLe=e=>mL.safeParse(e).success,jLe={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral",lcm:"LCM"},Qoe=F.number().int().min(0).max(hp),ULe=e=>Qoe.safeParse(e).success,yL=F.number().multipleOf(8).min(64),GLe=e=>yL.safeParse(e).success,vL=F.number().multipleOf(8).min(64),HLe=e=>vL.safeParse(e).success;F.tuple([yL,vL]);const ql=F.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),u_=F.object({model_name:F.string().min(1),base_model:ql,model_type:F.literal("main")}),qLe=e=>u_.safeParse(e).success,$E=F.object({model_name:F.string().min(1),base_model:F.literal("sdxl-refiner"),model_type:F.literal("main")}),WLe=e=>$E.safeParse(e).success,bL=F.object({model_name:F.string().min(1),base_model:ql,model_type:F.literal("onnx")}),Sm=F.union([u_,bL]),_L=F.object({model_name:F.string().min(1),base_model:ql}),KLe=e=>_L.safeParse(e).success,Yoe=F.object({model_name:F.string().min(1),base_model:ql}),XLe=e=>Yoe.safeParse(e).success,Zoe=F.object({model_name:F.string().min(1),base_model:ql}),QLe=e=>Zoe.safeParse(e).success,Joe=F.object({model_name:F.string().min(1),base_model:ql}),eae=F.object({model_name:F.string().min(1),base_model:ql}),YLe=e=>eae.safeParse(e).success,ZLe=e=>Joe.safeParse(e).success,tae=F.number().min(0).max(1),JLe=e=>tae.safeParse(e).success;F.enum(["fp16","fp32"]);const nae=F.enum(["ESRGAN","bilinear"]),eFe=e=>nae.safeParse(e).success,rae=F.number().min(1).max(10),tFe=e=>rae.safeParse(e).success,iae=F.number().min(1).max(10),nFe=e=>iae.safeParse(e).success,oae=F.number().min(0).max(1),rFe=e=>oae.safeParse(e).success;F.enum(["box","gaussian"]);F.enum(["unmasked","mask","edge"]);const aae=F.boolean(),iFe=e=>aae.safeParse(e).success&&e!==null&&e!==void 0,NE={hrfStrength:.45,hrfEnabled:!1,hrfMethod:"ESRGAN",cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},sae=NE,SL=Wt({name:"generation",initialState:sae,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=al(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=al(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},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},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},resetParametersState:e=>({...e,...NE}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Gie[e.model.base_model];e.clipSkip=al(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},setHrfStrength:(e,t)=>{e.hrfStrength=t.payload},setHrfEnabled:(e,t)=>{e.hrfEnabled=t.payload},setHrfMethod:(e,t)=>{e.hrfMethod=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=Rr(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Qre,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=u_.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}}),e.addMatcher(Uie,(t,n)=>{n.payload.type==="t2i_adapter"&&(t.width=Rr(t.width,64),t.height=Rr(t.height,64))})}}),{clampSymmetrySteps:oFe,clearInitialImage:DE,resetParametersState:aFe,resetSeed:sFe,setCfgScale:lFe,setWidth:E6,setHeight:T6,toggleSize:uFe,setImg2imgStrength:cFe,setInfillMethod:lae,setIterations:dFe,setPerlin:fFe,setPositivePrompt:uae,setNegativePrompt:hFe,setScheduler:pFe,setMaskBlur:gFe,setMaskBlurMethod:mFe,setCanvasCoherenceMode:yFe,setCanvasCoherenceSteps:vFe,setCanvasCoherenceStrength:bFe,setSeed:_Fe,setSeedWeights:SFe,setShouldFitToWidthHeight:xFe,setShouldGenerateVariations:wFe,setShouldRandomizeSeed:CFe,setSteps:EFe,setThreshold:TFe,setInfillTileSize:AFe,setInfillPatchmatchDownscaleSize:PFe,setVariationAmount:kFe,setShouldUseSymmetry:IFe,setHorizontalSymmetrySteps:MFe,setVerticalSymmetrySteps:RFe,initialImageChanged:c_,modelChanged:sl,vaeSelected:xL,setSeamlessXAxis:OFe,setSeamlessYAxis:$Fe,setClipSkip:NFe,setHrfEnabled:DFe,setHrfStrength:LFe,setHrfMethod:FFe,shouldUseCpuNoiseChanged:BFe,setAspectRatio:cae,setShouldLockAspectRatio:zFe,vaePrecisionChanged:VFe}=SL.actions,dae=SL.reducer,C0=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},E0=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},jFe=.999,UFe=.1,GFe=20,T0=.95,HFe=30,qFe=10,fae=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),Mc=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=Rr(s/o,64)):o<1&&(r.height=s,r.width=Rr(s*o,64)),a=r.width*r.height;return r},hae=e=>({width:Rr(e.width,64),height:Rr(e.height,64)}),WFe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],KFe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],wL=e=>e.kind==="line"&&e.layer==="mask",XFe=e=>e.kind==="line"&&e.layer==="base",pae=e=>e.kind==="image"&&e.layer==="base",QFe=e=>e.kind==="fillRect"&&e.layer==="base",YFe=e=>e.kind==="eraseRect"&&e.layer==="base",gae=e=>e.kind==="line";let Tr=[],Pa=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),--r.lc||r.off())}},notify(i){let o=!Tr.length;for(let a=0;a(e.events=e.events||{},e.events[n+P0]||(e.events[n+P0]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+P0](),delete e.events[n+P0])}),vae=1e3,bae=(e,t)=>yae(e,r=>{let i=t(r);i&&e.events[A0].push(i)},mae,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[A0]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[A0])a();e.events[A0]=[]}},vae)},()=>{e.listen=i,e.off=o}}),_ae=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=Pa(void 0,Math.max(...e.map(o=>o.l))+1);return bae(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const CL="default",Dn=Pa(CL),Sae={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},xae=Sae,EL=Wt({name:"queue",initialState:xae,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:ZFe,listPriorityChanged:JFe,listParamsReset:wae,queueItemSelectionToggled:eBe,resumeProcessorOnEnqueueChanged:tBe}=EL.actions,Cae=EL.reducer,TL="%[a-f0-9]{2}",A6=new RegExp("("+TL+")|([^%]+?)","gi"),P6=new RegExp("("+TL+")+","gi");function S5(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],S5(n),S5(r))}function Eae(e){try{return decodeURIComponent(e)}catch{let t=e.match(A6)||[];for(let n=1;ne==null,Iae=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),x5=Symbol("encodeFragmentIdentifier");function Mae(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Sn(t,e),"[",i,"]"].join("")]:[...n,[Sn(t,e),"[",Sn(i,e),"]=",Sn(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Sn(t,e),"[]"].join("")]:[...n,[Sn(t,e),"[]=",Sn(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Sn(t,e),":list="].join("")]:[...n,[Sn(t,e),":list=",Sn(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Sn(n,e),t,Sn(i,e)].join("")]:[[r,Sn(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Sn(t,e)]:[...n,[Sn(t,e),"=",Sn(r,e)].join("")]}}function Rae(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&Ua(r,e).includes(e.arrayFormatSeparator);r=a?Ua(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>Ua(l,e)):r===null?r:Ua(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Ua(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>Ua(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function PL(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Sn(e,t){return t.encode?t.strict?Iae(e):encodeURIComponent(e):e}function Ua(e,t){return t.decode?Aae(e):e}function kL(e){return Array.isArray(e)?e.sort():typeof e=="object"?kL(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function IL(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function Oae(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function k6(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function LE(e){e=IL(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function FE(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},PL(t.arrayFormatSeparator);const n=Rae(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=AL(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:Ua(s,t),n(Ua(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=k6(s,t);else r[i]=k6(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=kL(a):i[o]=a,i},Object.create(null))}function ML(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},PL(t.arrayFormatSeparator);const n=a=>t.skipNull&&kae(e[a])||t.skipEmptyString&&e[a]==="",r=Mae(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?Sn(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Sn(a,t)+"[]":s.reduce(r(a),[]).join("&"):Sn(a,t)+"="+Sn(s,t)}).filter(a=>a.length>0).join("&")}function RL(e,t){var i;t={decode:!0,...t};let[n,r]=AL(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:FE(LE(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Ua(r,t)}:{}}}function OL(e,t){t={encode:!0,strict:!0,[x5]:!0,...t};const n=IL(e.url).split("?")[0]||"",r=LE(e.url),i={...FE(r,{sort:!1}),...e.query};let o=ML(i,t);o&&(o=`?${o}`);let a=Oae(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[x5]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function $L(e,t,n){n={parseFragmentIdentifier:!0,[x5]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=RL(e,n);return OL({url:r,query:Pae(i,t),fragmentIdentifier:o},n)}function $ae(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return $L(e,r,n)}const pp=Object.freeze(Object.defineProperty({__proto__:null,exclude:$ae,extract:LE,parse:FE,parseUrl:RL,pick:$L,stringify:ML,stringifyUrl:OL},Symbol.toStringTag,{value:"Module"}));var g1=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function Gae(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var O6=$o;function LL(e,t){if(e===t||!(O6(e)&&O6(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},qae=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function N6(e){if(!$o(e))return e;for(var t=sn({},e),n=0,r=Object.entries(t);n"u"&&s===$6&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(m,v){return v1(t,null,function(){var S,w,C,x,P,E,I,N,M,T,A,R,D,$,L,O,B,U,j,q,Y,Z,V,K,ee,re,fe,Se,Me,De,Ee,tt,ot,we,Xn,Vt;return g1(this,function(Ot){switch(Ot.label){case 0:return S=v.signal,w=v.getState,C=v.extra,x=v.endpoint,P=v.forced,E=v.type,N=typeof m=="string"?{url:m}:m,M=N.url,T=N.headers,A=T===void 0?new Headers(b.headers):T,R=N.params,D=R===void 0?void 0:R,$=N.responseHandler,L=$===void 0?g??"json":$,O=N.validateStatus,B=O===void 0?_??Hae:O,U=N.timeout,j=U===void 0?p:U,q=M6(N,["url","headers","params","responseHandler","validateStatus","timeout"]),Y=sn(la(sn({},b),{signal:S}),q),A=new Headers(N6(A)),Z=Y,[4,o(A,{getState:w,extra:C,endpoint:x,forced:P,type:E})];case 1:Z.headers=Ot.sent()||A,V=function(xt){return typeof xt=="object"&&($o(xt)||Array.isArray(xt)||typeof xt.toJSON=="function")},!Y.headers.has("content-type")&&V(Y.body)&&Y.headers.set("content-type",f),V(Y.body)&&c(Y.headers)&&(Y.body=JSON.stringify(Y.body,h)),D&&(K=~M.indexOf("?")?"&":"?",ee=l?l(D):new URLSearchParams(N6(D)),M+=K+ee),M=jae(r,M),re=new Request(M,Y),fe=new Request(M,Y),I={request:fe},Me=!1,De=j&&setTimeout(function(){Me=!0,v.abort()},j),Ot.label=2;case 2:return Ot.trys.push([2,4,5,6]),[4,s(re)];case 3:return Se=Ot.sent(),[3,6];case 4:return Ee=Ot.sent(),[2,{error:{status:Me?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Ee)},meta:I}];case 5:return De&&clearTimeout(De),[7];case 6:tt=Se.clone(),I.response=tt,we="",Ot.label=7;case 7:return Ot.trys.push([7,9,,10]),[4,Promise.all([y(Se,L).then(function(xt){return ot=xt},function(xt){return Xn=xt}),tt.text().then(function(xt){return we=xt},function(){})])];case 8:if(Ot.sent(),Xn)throw Xn;return[3,10];case 9:return Vt=Ot.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Se.status,data:we,error:String(Vt)},meta:I}];case 10:return[2,B(Se,ot)?{data:ot,meta:I}:{error:{status:Se.status,data:ot},meta:I}]}})})};function y(m,v){return v1(this,null,function(){var S;return g1(this,function(w){switch(w.label){case 0:return typeof v=="function"?[2,v(m)]:(v==="content-type"&&(v=c(m.headers)?"json":"text"),v!=="json"?[3,2]:[4,m.text()]);case 1:return S=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,m.text()]}})})}}var D6=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),BE=ge("__rtkq/focused"),FL=ge("__rtkq/unfocused"),zE=ge("__rtkq/online"),BL=ge("__rtkq/offline"),wa;(function(e){e.query="query",e.mutation="mutation"})(wa||(wa={}));function zL(e){return e.type===wa.query}function Kae(e){return e.type===wa.mutation}function VE(e,t,n,r,i,o){return Xae(e)?e(t,n,r,i).map(w5).map(o):Array.isArray(e)?e.map(w5).map(o):[]}function Xae(e){return typeof e=="function"}function w5(e){return typeof e=="string"?{type:e}:e}function Lx(e){return e!=null}var gg=Symbol("forceQueryFn"),C5=function(e){return typeof e[gg]=="function"};function Qae(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:y,buildInitiateMutation:m,getRunningQueryThunk:p,getRunningMutationThunk:g,getRunningQueriesThunk:_,getRunningMutationsThunk:b,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. + Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. + See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var v=function(S){return Array.from(S.values()).flatMap(function(w){return w?Object.values(w):[]})};return m1(m1([],v(a)),v(s)).filter(Lx)}function p(v,S){return function(w){var C,x=o.endpointDefinitions[v],P=t({queryArgs:S,endpointDefinition:x,endpointName:v});return(C=a.get(w))==null?void 0:C[P]}}function g(v,S){return function(w){var C;return(C=s.get(w))==null?void 0:C[S]}}function _(){return function(v){return Object.values(a.get(v)||{}).filter(Lx)}}function b(){return function(v){return Object.values(s.get(v)||{}).filter(Lx)}}function y(v,S){var w=function(C,x){var P=x===void 0?{}:x,E=P.subscribe,I=E===void 0?!0:E,N=P.forceRefetch,M=P.subscriptionOptions,T=gg,A=P[T];return function(R,D){var $,L,O=t({queryArgs:C,endpointDefinition:S,endpointName:v}),B=n(($={type:"query",subscribe:I,forceRefetch:N,subscriptionOptions:M,endpointName:v,originalArgs:C,queryCacheKey:O},$[gg]=A,$)),U=i.endpoints[v].select(C),j=R(B),q=U(D()),Y=j.requestId,Z=j.abort,V=q.requestId!==Y,K=(L=a.get(R))==null?void 0:L[O],ee=function(){return U(D())},re=Object.assign(A?j.then(ee):V&&!K?Promise.resolve(q):Promise.all([K,j]).then(ee),{arg:C,requestId:Y,subscriptionOptions:M,queryCacheKey:O,abort:Z,unwrap:function(){return v1(this,null,function(){var Se;return g1(this,function(Me){switch(Me.label){case 0:return[4,re];case 1:if(Se=Me.sent(),Se.isError)throw Se.error;return[2,Se.data]}})})},refetch:function(){return R(w(C,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){I&&R(u({queryCacheKey:O,requestId:Y}))},updateSubscriptionOptions:function(Se){re.subscriptionOptions=Se,R(d({endpointName:v,requestId:Y,queryCacheKey:O,options:Se}))}});if(!K&&!V&&!A){var fe=a.get(R)||{};fe[O]=re,a.set(R,fe),re.then(function(){delete fe[O],Object.keys(fe).length||a.delete(R)})}return re}};return w}function m(v){return function(S,w){var C=w===void 0?{}:w,x=C.track,P=x===void 0?!0:x,E=C.fixedCacheKey;return function(I,N){var M=r({type:"mutation",endpointName:v,originalArgs:S,track:P,fixedCacheKey:E}),T=I(M),A=T.requestId,R=T.abort,D=T.unwrap,$=T.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),L=function(){I(c({requestId:A,fixedCacheKey:E}))},O=Object.assign($,{arg:T.arg,requestId:A,abort:R,unwrap:D,unsubscribe:L,reset:L}),B=s.get(I)||{};return s.set(I,B),B[A]=O,O.then(function(){delete B[A],Object.keys(B).length||s.delete(I)}),E&&(B[E]=O,O.then(function(){B[E]===O&&(delete B[E],Object.keys(B).length||s.delete(I))})),O}}}}function L6(e){return e}function Yae(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=e.assertTagType,l=function(v,S,w,C){return function(x,P){var E=i[v],I=o({queryArgs:S,endpointDefinition:E,endpointName:v});if(x(a.internalActions.queryResultPatched({queryCacheKey:I,patches:w})),!!C){var N=a.endpoints[v].select(S)(P()),M=VE(E.providesTags,N.data,void 0,S,{},s);x(a.internalActions.updateProvidedBy({queryCacheKey:I,providedTags:M}))}}},u=function(v,S,w,C){return C===void 0&&(C=!0),function(x,P){var E,I,N=a.endpoints[v],M=N.select(S)(P()),T={patches:[],inversePatches:[],undo:function(){return x(a.util.patchQueryData(v,S,T.inversePatches,C))}};if(M.status===Ht.uninitialized)return T;var A;if("data"in M)if(ti(M.data)){var R=nE(M.data,w),D=R[0],$=R[1],L=R[2];(E=T.patches).push.apply(E,$),(I=T.inversePatches).push.apply(I,L),A=D}else A=w(M.data),T.patches.push({op:"replace",path:[],value:A}),T.inversePatches.push({op:"replace",path:[],value:M.data});return x(a.util.patchQueryData(v,S,T.patches,C)),T}},c=function(v,S,w){return function(C){var x;return C(a.endpoints[v].initiate(S,(x={subscribe:!1,forceRefetch:!0},x[gg]=function(){return{data:w}},x)))}},d=function(v,S){return v1(t,[v,S],function(w,C){var x,P,E,I,N,M,T,A,R,D,$,L,O,B,U,j,q,Y,Z=C.signal,V=C.abort,K=C.rejectWithValue,ee=C.fulfillWithValue,re=C.dispatch,fe=C.getState,Se=C.extra;return g1(this,function(Me){switch(Me.label){case 0:x=i[w.endpointName],Me.label=1;case 1:return Me.trys.push([1,8,,13]),P=L6,E=void 0,I={signal:Z,abort:V,dispatch:re,getState:fe,extra:Se,endpoint:w.endpointName,type:w.type,forced:w.type==="query"?f(w,fe()):void 0},N=w.type==="query"?w[gg]:void 0,N?(E=N(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(w.originalArgs),I,x.extraOptions)]:[3,4];case 3:return E=Me.sent(),x.transformResponse&&(P=x.transformResponse),[3,6];case 4:return[4,x.queryFn(w.originalArgs,I,x.extraOptions,function(De){return r(De,I,x.extraOptions)})];case 5:E=Me.sent(),Me.label=6;case 6:if(typeof process<"u",E.error)throw new D6(E.error,E.meta);return $=ee,[4,P(E.data,E.meta,w.originalArgs)];case 7:return[2,$.apply(void 0,[Me.sent(),(q={fulfilledTimeStamp:Date.now(),baseQueryMeta:E.meta},q[ku]=!0,q)])];case 8:if(L=Me.sent(),O=L,!(O instanceof D6))return[3,12];B=L6,x.query&&x.transformErrorResponse&&(B=x.transformErrorResponse),Me.label=9;case 9:return Me.trys.push([9,11,,12]),U=K,[4,B(O.value,O.meta,w.originalArgs)];case 10:return[2,U.apply(void 0,[Me.sent(),(Y={baseQueryMeta:O.meta},Y[ku]=!0,Y)])];case 11:return j=Me.sent(),O=j,[3,12];case 12:throw typeof process<"u",console.error(O),O;case 13:return[2]}})})};function f(v,S){var w,C,x,P,E=(C=(w=S[n])==null?void 0:w.queries)==null?void 0:C[v.queryCacheKey],I=(x=S[n])==null?void 0:x.config.refetchOnMountOrArgChange,N=E==null?void 0:E.fulfilledTimeStamp,M=(P=v.forceRefetch)!=null?P:v.subscribe&&I;return M?M===!0||(Number(new Date)-Number(N))/1e3>=M:!1}var h=Xv(n+"/executeQuery",d,{getPendingMeta:function(){var v;return v={startedTimeStamp:Date.now()},v[ku]=!0,v},condition:function(v,S){var w=S.getState,C,x,P,E=w(),I=(x=(C=E[n])==null?void 0:C.queries)==null?void 0:x[v.queryCacheKey],N=I==null?void 0:I.fulfilledTimeStamp,M=v.originalArgs,T=I==null?void 0:I.originalArgs,A=i[v.endpointName];return C5(v)?!0:(I==null?void 0:I.status)==="pending"?!1:f(v,E)||zL(A)&&((P=A==null?void 0:A.forceRefetch)!=null&&P.call(A,{currentArg:M,previousArg:T,endpointState:I,state:E}))?!0:!N},dispatchConditionRejection:!0}),p=Xv(n+"/executeMutation",d,{getPendingMeta:function(){var v;return v={startedTimeStamp:Date.now()},v[ku]=!0,v}}),g=function(v){return"force"in v},_=function(v){return"ifOlderThan"in v},b=function(v,S,w){return function(C,x){var P=g(w)&&w.force,E=_(w)&&w.ifOlderThan,I=function(A){return A===void 0&&(A=!0),a.endpoints[v].initiate(S,{forceRefetch:A})},N=a.endpoints[v].select(S)(x());if(P)C(I());else if(E){var M=N==null?void 0:N.fulfilledTimeStamp;if(!M){C(I());return}var T=(Number(new Date)-Number(new Date(M)))/1e3>=E;T&&C(I())}else C(I(!1))}};function y(v){return function(S){var w,C;return((C=(w=S==null?void 0:S.meta)==null?void 0:w.arg)==null?void 0:C.endpointName)===v}}function m(v,S){return{matchPending:Pd(Ub(v),y(S)),matchFulfilled:Pd(Gl(v),y(S)),matchRejected:Pd(uf(v),y(S))}}return{queryThunk:h,mutationThunk:p,prefetch:b,updateQueryData:u,upsertQueryData:c,patchQueryData:l,buildMatchThunkActions:m}}function VL(e,t,n,r){return VE(n[e.meta.arg.endpointName][t],Gl(e)?e.payload:void 0,hm(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function k0(e,t,n){var r=e[t];r&&n(r)}function mg(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function F6(e,t,n){var r=e[mg(t)];r&&n(r)}var dh={};function Zae(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=ge(t+"/resetApiState"),f=Wt({name:t+"/queries",initialState:dh,reducers:{removeQueryResult:{reducer:function(S,w){var C=w.payload.queryCacheKey;delete S[C]},prepare:jc()},queryResultPatched:{reducer:function(S,w){var C=w.payload,x=C.queryCacheKey,P=C.patches;k0(S,x,function(E){E.data=t5(E.data,P.concat())})},prepare:jc()}},extraReducers:function(S){S.addCase(n.pending,function(w,C){var x=C.meta,P=C.meta.arg,E,I,N=C5(P);(P.subscribe||N)&&((I=w[E=P.queryCacheKey])!=null||(w[E]={status:Ht.uninitialized,endpointName:P.endpointName})),k0(w,P.queryCacheKey,function(M){M.status=Ht.pending,M.requestId=N&&M.requestId?M.requestId:x.requestId,P.originalArgs!==void 0&&(M.originalArgs=P.originalArgs),M.startedTimeStamp=x.startedTimeStamp})}).addCase(n.fulfilled,function(w,C){var x=C.meta,P=C.payload;k0(w,x.arg.queryCacheKey,function(E){var I;if(!(E.requestId!==x.requestId&&!C5(x.arg))){var N=o[x.arg.endpointName].merge;if(E.status=Ht.fulfilled,N)if(E.data!==void 0){var M=x.fulfilledTimeStamp,T=x.arg,A=x.baseQueryMeta,R=x.requestId,D=Ul(E.data,function($){return N($,P,{arg:T.originalArgs,baseQueryMeta:A,fulfilledTimeStamp:M,requestId:R})});E.data=D}else E.data=P;else E.data=(I=o[x.arg.endpointName].structuralSharing)==null||I?LL(Dr(E.data)?X4(E.data):E.data,P):P;delete E.error,E.fulfilledTimeStamp=x.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,C){var x=C.meta,P=x.condition,E=x.arg,I=x.requestId,N=C.error,M=C.payload;k0(w,E.queryCacheKey,function(T){if(!P){if(T.requestId!==I)return;T.status=Ht.rejected,T.error=M??N}})}).addMatcher(l,function(w,C){for(var x=s(C).queries,P=0,E=Object.entries(x);P"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Sse:_se;GL.useSyncExternalStore=pf.useSyncExternalStore!==void 0?pf.useSyncExternalStore:xse;UL.exports=GL;var wse=UL.exports,HL={exports:{}},qL={};/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var d_=k,Cse=wse;function Ese(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tse=typeof Object.is=="function"?Object.is:Ese,Ase=Cse.useSyncExternalStore,Pse=d_.useRef,kse=d_.useEffect,Ise=d_.useMemo,Mse=d_.useDebugValue;qL.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Pse(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=Ise(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,Tse(c,h))return p;var g=r(h);return i!==void 0&&i(p,g)?p:(c=h,d=g)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=Ase(e,o[0],o[1]);return kse(function(){a.hasValue=!0,a.value=s},[s]),Mse(s),s};HL.exports=qL;var WL=HL.exports;const Rse=Bl(WL);function Ose(e){e()}let KL=Ose;const $se=e=>KL=e,Nse=()=>KL,H6=Symbol.for("react-redux-context"),q6=typeof globalThis<"u"?globalThis:{};function Dse(){var e;if(!k.createContext)return{};const t=(e=q6[H6])!=null?e:q6[H6]=new Map;let n=t.get(k.createContext);return n||(n=k.createContext(null),t.set(k.createContext,n)),n}const Ml=Dse();function jE(e=Ml){return function(){return k.useContext(e)}}const XL=jE(),Lse=()=>{throw new Error("uSES not initialized!")};let QL=Lse;const Fse=e=>{QL=e},Bse=(e,t)=>e===t;function zse(e=Ml){const t=e===Ml?XL:jE(e);return function(r,i={}){const{equalityFn:o=Bse,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();k.useRef(!0);const h=k.useCallback({[r.name](g){return r(g)}}[r.name],[r,d,a]),p=QL(u.addNestedSub,l.getState,c||l.getState,h,o);return k.useDebugValue(p),p}}const YL=zse();function b1(){return b1=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const W6={notify(){},get:()=>[]};function Zse(e,t){let n,r=W6,i=0,o=!1;function a(g){c();const _=r.subscribe(g);let b=!1;return()=>{b||(b=!0,_(),d())}}function s(){r.notify()}function l(){p.onStateChange&&p.onStateChange()}function u(){return o}function c(){i++,n||(n=t?t.addNestedSub(l):e.subscribe(l),r=Yse())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=W6)}function f(){o||(o=!0,c())}function h(){o&&(o=!1,d())}const p={addNestedSub:a,notifyNestedSubs:s,handleChangeWrapper:l,isSubscribed:u,trySubscribe:f,tryUnsubscribe:h,getListeners:()=>r};return p}const Jse=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ele=Jse?k.useLayoutEffect:k.useEffect;function K6(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function _1(e,t){if(K6(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=Zse(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=k.useMemo(()=>e.getState(),[e]);ele(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||Ml;return k.createElement(l.Provider,{value:a},n)}function rF(e=Ml){const t=e===Ml?XL:jE(e);return function(){const{store:r}=t();return r}}const iF=rF();function nle(e=Ml){const t=e===Ml?iF:rF(e);return function(){return t().dispatch}}const oF=nle();Fse(WL.useSyncExternalStoreWithSelector);$se(mi.unstable_batchedUpdates);var rle=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n_le({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Ele=["AppVersion","AppConfig","Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","IntermediatesCount","SessionQueueItem","SessionQueueStatus","SessionProcessorStatus","CurrentSessionQueueItem","NextSessionQueueItem","BatchStatus","InvocationCacheStatus","Model","T2IAdapterModel","MainModel","OnnxModel","VaeModel","IPAdapterModel","TextualInversionModel","ControlNetModel","LoRAModel","SDXLRefinerModel","Workflow"],kr="LIST",Tle=async(e,t,n)=>{const r=vg.get(),i=yg.get(),o=x1.get();return Wae({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},Do=vle({baseQuery:Tle,reducerPath:"api",tagTypes:Ele,endpoints:()=>({})}),Ale=e=>{const t=e?pp.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Dn.get()}/list?${t}`:`queue/${Dn.get()}/list`},xu=Ji({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),un=Do.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Dn.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,O0(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Dn.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Dn.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Dn.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,O0(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Dn.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,O0(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Dn.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Dn.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Dn.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Dn.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Dn.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Dn.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(un.util.updateQueryData("listQueueItems",void 0,o=>{xu.updateOne(o,{id:t,changes:{status:i.status,completed_at:i.completed_at,updated_at:i.updated_at}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Dn.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,O0(r)}catch{}},invalidatesTags:["SessionQueueStatus","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:Ale(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Dn.get()}/list`,transformResponse:t=>xu.addMany(xu.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{xu.addMany(t,xu.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:nBe,useEnqueueBatchMutation:rBe,usePauseProcessorMutation:iBe,useResumeProcessorMutation:oBe,useClearQueueMutation:aBe,usePruneQueueMutation:sBe,useGetCurrentQueueItemQuery:lBe,useGetQueueStatusQuery:uBe,useGetQueueItemQuery:cBe,useGetNextQueueItemQuery:dBe,useListQueueItemsQuery:fBe,useCancelQueueItemMutation:hBe,useGetBatchStatusQuery:pBe}=un,O0=e=>{e(un.util.updateQueryData("listQueueItems",void 0,t=>{xu.removeAll(t),t.has_more=!1})),e(wae()),e(un.endpoints.listQueueItems.initiate(void 0))},zh={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},aF={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:zh,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,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",batchIds:[]},sF=Wt({name:"canvas",initialState:aF,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(Ye(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!wL(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,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:b0(al(r,64,512),64),height:b0(al(i,64,512),64)},s={x:Rr(r/2-a.width/2,64),y:Rr(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=Mc(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(Ye(e.layerState)),e.layerState={...Ye(zh),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=E0(o.width,o.height,r,i,T0),u=C0(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=hae(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=Mc(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=fae(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=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},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Ye(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Ye(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=Ye(Ye(zh)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Ye(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(Ye(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(Ye(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(gae);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Ye(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Ye(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(Ye(e.layerState)),e.layerState=Ye(zh),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(pae)){const o=E0(i.width,i.height,512,512,T0),a=C0(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=Mc(s);e.scaledBoundingBoxDimensions=l}}},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 c=r?1:E0(i,o,l,u,T0),d=C0(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=E0(i,o,512,512,T0),d=C0(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=Mc(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(Ye(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=Ye(zh).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},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:b0(al(o,64,512),64),height:b0(al(a,64,512),64)},l={x:Rr(o/2-s.width/2,64),y:Rr(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=Mc(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=Mc(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},setShouldAntialias:(e,t)=>{e.shouldAntialias=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(Ye(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}},extraReducers:e=>{e.addCase(o_,(t,n)=>{const r=n.payload.data.batch_status;t.batchIds.includes(r.batch_id)&&r.in_progress===0&&r.pending===0&&(t.batchIds=t.batchIds.filter(i=>i!==r.batch_id))}),e.addCase(cae,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=Rr(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=Rr(t.scaledBoundingBoxDimensions.width/r,64))}),e.addMatcher(un.endpoints.clearQueue.matchFulfilled,t=>{t.batchIds=[]}),e.addMatcher(un.endpoints.cancelByBatchIds.matchFulfilled,(t,n)=>{t.batchIds=t.batchIds.filter(r=>!n.meta.arg.originalArgs.batch_ids.includes(r))})}}),{addEraseRect:gBe,addFillRect:mBe,addImageToStagingArea:Ple,addLine:yBe,addPointToCurrentLine:vBe,clearCanvasHistory:bBe,clearMask:_Be,commitColorPickerColor:SBe,commitStagingAreaImage:kle,discardStagedImages:Ile,fitBoundingBoxToStage:xBe,mouseLeftCanvas:wBe,nextStagingAreaImage:CBe,prevStagingAreaImage:EBe,redo:TBe,resetCanvas:KE,resetCanvasInteractionState:ABe,resetCanvasView:PBe,setBoundingBoxCoordinates:kBe,setBoundingBoxDimensions:Z6,setBoundingBoxPreviewFill:IBe,setBoundingBoxScaleMethod:MBe,flipBoundingBoxAxes:RBe,setBrushColor:OBe,setBrushSize:$Be,setColorPickerColor:NBe,setCursorPosition:DBe,setInitialCanvasImage:lF,setIsDrawing:LBe,setIsMaskEnabled:FBe,setIsMouseOverBoundingBox:BBe,setIsMoveBoundingBoxKeyHeld:zBe,setIsMoveStageKeyHeld:VBe,setIsMovingBoundingBox:jBe,setIsMovingStage:UBe,setIsTransformingBoundingBox:GBe,setLayer:HBe,setMaskColor:qBe,setMergedCanvas:Mle,setShouldAutoSave:WBe,setShouldCropToBoundingBoxOnSave:KBe,setShouldDarkenOutsideBoundingBox:XBe,setShouldLockBoundingBox:QBe,setShouldPreserveMaskedArea:YBe,setShouldShowBoundingBox:ZBe,setShouldShowBrush:JBe,setShouldShowBrushPreview:eze,setShouldShowCanvasDebugInfo:tze,setShouldShowCheckboardTransparency:nze,setShouldShowGrid:rze,setShouldShowIntermediates:ize,setShouldShowStagingImage:oze,setShouldShowStagingOutline:aze,setShouldSnapToGrid:sze,setStageCoordinates:lze,setStageScale:uze,setTool:cze,toggleShouldLockBoundingBox:dze,toggleTool:fze,undo:hze,setScaledBoundingBoxDimensions:pze,setShouldRestrictStrokesToBox:gze,stagingAreaInitialized:Rle,setShouldAntialias:mze,canvasResized:yze,canvasBatchIdAdded:Ole,canvasBatchIdsReset:$le}=sF.actions,Nle=sF.reducer,Dle={isModalOpen:!1,imagesToChange:[]},uF=Wt({name:"changeBoardModal",initialState:Dle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:vze,imagesToChangeSelected:bze,changeBoardReset:_ze}=uF.actions,Lle=uF.reducer,Fle={imagesToDelete:[],isModalOpen:!1},cF=Wt({name:"deleteImageModal",initialState:Fle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:XE,imagesToDeleteSelected:Ble,imageDeletionCanceled:Sze}=cF.actions,zle=cF.reducer,QE={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},Vle=QE,dF=Wt({name:"dynamicPrompts",initialState:Vle,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=QE.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:jle,maxPromptsReset:Ule,combinatorialToggled:Gle,promptsChanged:Hle,parsingErrorChanged:qle,isErrorChanged:J6,isLoadingChanged:Ux,seedBehaviourChanged:xze}=dF.actions,Wle=dF.reducer,Fn=["general"],Pr=["control","mask","user","other"],Kle=100,$0=20,Xle=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:n{if(!e)return!1;const n=bg.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},Ni=e=>Fn.includes(e.image_category)?Fn:Pr,Lt=Ji({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Xle(t.created_at,e.created_at)}),bg=Lt.getSelectors(),Vi=e=>`images/?${pp.stringify(e,{arrayFormat:"none"})}`,Qe=Do.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:kr}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:kr}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Vi({board_id:t??"none",categories:Fn,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),getBoardAssetsTotal:e.query({query:t=>({url:Vi({board_id:t??"none",categories:Pr,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:kr}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:wze,useListAllBoardsQuery:Cze,useGetBoardImagesTotalQuery:Eze,useGetBoardAssetsTotalQuery:Tze,useCreateBoardMutation:Aze,useUpdateBoardMutation:Pze,useListAllImageNamesForBoardQuery:kze}=Qe;var fF={},R_={},O_={};Object.defineProperty(O_,"__esModule",{value:!0});O_.createLogMethods=void 0;var Qle=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};O_.createLogMethods=Qle;var YE={},$_={};Object.defineProperty($_,"__esModule",{value:!0});$_.boolean=void 0;const Yle=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};$_.boolean=Yle;var N_={};Object.defineProperty(N_,"__esModule",{value:!0});N_.isBooleanable=void 0;const Zle=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};N_.isBooleanable=Zle;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=$_;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=N_;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(YE);var eI=Object.prototype.toString,hF=function(t){var n=eI.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&eI.call(t.callee)==="[object Function]"),r},Gx,tI;function Jle(){if(tI)return Gx;tI=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=hF,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",g=n.call(h)==="[object Function]",_=r(h),b=p&&n.call(h)==="[object String]",y=[];if(!p&&!g&&!_)throw new TypeError("Object.keys called on a non-object");var m=a&&g;if(b&&h.length>0&&!t.call(h,0))for(var v=0;v0)for(var S=0;S"u"||!Bn?We:Bn(Uint8Array),ju={"%AggregateError%":typeof AggregateError>"u"?We:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?We:ArrayBuffer,"%ArrayIteratorPrototype%":Rc&&Bn?Bn([][Symbol.iterator]()):We,"%AsyncFromSyncIteratorPrototype%":We,"%AsyncFunction%":qc,"%AsyncGenerator%":qc,"%AsyncGeneratorFunction%":qc,"%AsyncIteratorPrototype%":qc,"%Atomics%":typeof Atomics>"u"?We:Atomics,"%BigInt%":typeof BigInt>"u"?We:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?We:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?We:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?We:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?We:Float32Array,"%Float64Array%":typeof Float64Array>"u"?We:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?We:FinalizationRegistry,"%Function%":gF,"%GeneratorFunction%":qc,"%Int8Array%":typeof Int8Array>"u"?We:Int8Array,"%Int16Array%":typeof Int16Array>"u"?We:Int16Array,"%Int32Array%":typeof Int32Array>"u"?We:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Rc&&Bn?Bn(Bn([][Symbol.iterator]())):We,"%JSON%":typeof JSON=="object"?JSON:We,"%Map%":typeof Map>"u"?We:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Rc||!Bn?We:Bn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?We:Promise,"%Proxy%":typeof Proxy>"u"?We:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?We:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?We:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Rc||!Bn?We:Bn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?We:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Rc&&Bn?Bn(""[Symbol.iterator]()):We,"%Symbol%":Rc?Symbol:We,"%SyntaxError%":gf,"%ThrowTypeError%":gue,"%TypedArray%":yue,"%TypeError%":Nd,"%Uint8Array%":typeof Uint8Array>"u"?We:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?We:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?We:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?We:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?We:WeakMap,"%WeakRef%":typeof WeakRef>"u"?We:WeakRef,"%WeakSet%":typeof WeakSet>"u"?We:WeakSet};if(Bn)try{null.error}catch(e){var vue=Bn(Bn(e));ju["%Error.prototype%"]=vue}var bue=function e(t){var n;if(t==="%AsyncFunction%")n=qx("async function () {}");else if(t==="%GeneratorFunction%")n=qx("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=qx("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Bn&&(n=Bn(i.prototype))}return ju[t]=n,n},aI={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xm=pF,w1=pue,_ue=xm.call(Function.call,Array.prototype.concat),Sue=xm.call(Function.apply,Array.prototype.splice),sI=xm.call(Function.call,String.prototype.replace),C1=xm.call(Function.call,String.prototype.slice),xue=xm.call(Function.call,RegExp.prototype.exec),wue=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Cue=/\\(\\)?/g,Eue=function(t){var n=C1(t,0,1),r=C1(t,-1);if(n==="%"&&r!=="%")throw new gf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new gf("invalid intrinsic syntax, expected opening `%`");var i=[];return sI(t,wue,function(o,a,s,l){i[i.length]=s?sI(l,Cue,"$1"):a||o}),i},Tue=function(t,n){var r=t,i;if(w1(aI,r)&&(i=aI[r],r="%"+i[0]+"%"),w1(ju,r)){var o=ju[r];if(o===qc&&(o=bue(r)),typeof o>"u"&&!n)throw new Nd("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new gf("intrinsic "+t+" does not exist!")},Aue=function(t,n){if(typeof t!="string"||t.length===0)throw new Nd("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Nd('"allowMissing" argument must be a boolean');if(xue(/^%?[^%]*%?$/,t)===null)throw new gf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Eue(t),i=r.length>0?r[0]:"",o=Tue("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],Sue(r,_ue([0,1],u)));for(var c=1,d=!0;c=r.length){var g=Vu(s,f);d=!!g,d&&"get"in g&&!("originalValue"in g.get)?s=g.get:s=s[f]}else d=w1(s,f),s=s[f];d&&!l&&(ju[a]=s)}}return s},Pue=Aue,T5=Pue("%Object.defineProperty%",!0),A5=function(){if(T5)try{return T5({},"a",{value:1}),!0}catch{return!1}return!1};A5.hasArrayLengthDefineBug=function(){if(!A5())return null;try{return T5([],"length",{value:1}).length!==1}catch{return!0}};var kue=A5,Iue=nue,Mue=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Rue=Object.prototype.toString,Oue=Array.prototype.concat,mF=Object.defineProperty,$ue=function(e){return typeof e=="function"&&Rue.call(e)==="[object Function]"},Nue=kue(),yF=mF&&Nue,Due=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!$ue(r)||!r())return}yF?mF(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},vF=function(e,t){var n=arguments.length>2?arguments[2]:{},r=Iue(t);Mue&&(r=Oue.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};B_.testComparisonRange=ice;var z_={};Object.defineProperty(z_,"__esModule",{value:!0});z_.testRange=void 0;var oce=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};z_.testRange=oce;(function(e){var t=He&&He.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,lce.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};V_.highlight=cce;var j_={},EF={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(He,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+g)),d=g}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(EF);var dce=EF.exports,ic={},TF={},Wl={};Wl.__esModule=void 0;Wl.__esModule=!0;var fce=typeof Object.setPrototypeOf=="function",hce=typeof Object.getPrototypeOf=="function",pce=typeof Object.defineProperty=="function",gce=typeof Object.create=="function",mce=typeof Object.prototype.hasOwnProperty=="function",yce=function(t,n){fce?Object.setPrototypeOf(t,n):t.__proto__=n};Wl.setPrototypeOf=yce;var vce=function(t){return hce?Object.getPrototypeOf(t):t.__proto__||t.prototype};Wl.getPrototypeOf=vce;var lI=!1,bce=function e(t,n,r){if(pce&&!lI)try{Object.defineProperty(t,n,r)}catch{lI=!0,e(t,n,r)}else t[n]=r.value};Wl.defineProperty=bce;var AF=function(t,n){return mce?t.hasOwnProperty(t,n):t[n]===void 0};Wl.hasOwnProperty=AF;var _ce=function(t,n){if(gce)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)AF(n,o)&&(i[o]=n[o].value);return i};Wl.objectCreate=_ce;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=Wl,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var g=new Error(u);g.name=p.name,p.stack=g.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(TF);var PF=He&&He.__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){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(ic,"__esModule",{value:!0});ic.SyntaxError=ic.LiqeError=void 0;var Sce=TF,kF=function(e){PF(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Sce.ExtendableError);ic.LiqeError=kF;var xce=function(e){PF(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(kF);ic.SyntaxError=xce;var JE={},E1=He&&He.__assign||function(){return E1=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:$a},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};JE.default=wce;var IF={},U_={},Em={};Object.defineProperty(Em,"__esModule",{value:!0});Em.isSafePath=void 0;var Cce=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,Ece=function(e){return Cce.test(e)};Em.isSafePath=Ece;Object.defineProperty(U_,"__esModule",{value:!0});U_.createGetValueFunctionBody=void 0;var Tce=Em,Ace=function(e){if(!(0,Tce.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};U_.createGetValueFunctionBody=Ace;(function(e){var t=He&&He.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,Oce=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new RF.default.Parser(Mce),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(Rce);throw r?new Pce.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,Ice.hydrateAst)(n[0]);return i};j_.parse=Oce;var G_={};Object.defineProperty(G_,"__esModule",{value:!0});G_.test=void 0;var $ce=wm,Nce=function(e,t){return(0,$ce.filter)(e,[t]).length===1};G_.test=Nce;var OF={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(OF);var H_={};Object.defineProperty(H_,"__esModule",{value:!0});H_.isSafeUnquotedExpression=void 0;var Dce=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};H_.isSafeUnquotedExpression=Dce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=wm;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=V_;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=j_;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=G_;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=ic;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=OF;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=H_;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(CF);var Tm={},$F={},oc={};Object.defineProperty(oc,"__esModule",{value:!0});oc.ROARR_LOG_FORMAT_VERSION=oc.ROARR_VERSION=void 0;oc.ROARR_VERSION="5.0.0";oc.ROARR_LOG_FORMAT_VERSION="2.0.0";var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0});Nf.logLevels=void 0;Nf.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var NF={},q_={};Object.defineProperty(q_,"__esModule",{value:!0});q_.hasOwnProperty=void 0;const Lce=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);q_.hasOwnProperty=Lce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=q_;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(NF);var W_={};Object.defineProperty(W_,"__esModule",{value:!0});W_.isBrowser=void 0;const Fce=()=>typeof window<"u";W_.isBrowser=Fce;var K_={};Object.defineProperty(K_,"__esModule",{value:!0});K_.isTruthy=void 0;const Bce=e=>["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());K_.isTruthy=Bce;var DF={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMockLogger=void 0;const t=Nf,n=(i,o)=>(a,s,l,u,c,d,f,h,p,g)=>{i.child({logLevel:o})(a,s,l,u,c,d,f,h,p,g)},r=(i,o)=>{const a=()=>{};return a.adopt=async s=>s(),a.child=()=>(0,e.createMockLogger)(i,o),a.getContext=()=>({}),a.debug=n(a,t.logLevels.debug),a.debugOnce=n(a,t.logLevels.debug),a.error=n(a,t.logLevels.error),a.errorOnce=n(a,t.logLevels.error),a.fatal=n(a,t.logLevels.fatal),a.fatalOnce=n(a,t.logLevels.fatal),a.info=n(a,t.logLevels.info),a.infoOnce=n(a,t.logLevels.info),a.trace=n(a,t.logLevels.trace),a.traceOnce=n(a,t.logLevels.trace),a.warn=n(a,t.logLevels.warn),a.warnOnce=n(a,t.logLevels.warn),a};e.createMockLogger=r})(DF);var LF={},X_={},Q_={};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.tokenize=void 0;const zce=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,Vce=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=zce.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};Q_.tokenize=Vce;Object.defineProperty(X_,"__esModule",{value:!0});X_.createPrintf=void 0;const uI=YE,jce=Q_,Uce=(e,t)=>t.placeholder,Gce=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Uce,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=jce.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=uI.boolean(c)?"true":"false";else if(u.conversion==="B")l+=uI.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};X_.createPrintf=Gce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=X_;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(LF);var P5={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(b){return b.length<5e3&&!i.test(b)?`"${b}"`:JSON.stringify(b)}function a(b){if(b.length>200)return b.sort();for(let y=1;ym;)b[v]=b[v-1],v--;b[v]=m}return b}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(b){return s.call(b)!==void 0&&b.length!==0}function u(b,y,m){b.length= 1`)}return m===void 0?1/0:m}function h(b){return b===1?"1 item":`${b} items`}function p(b){const y=new Set;for(const m of b)(typeof m=="string"||typeof m=="number")&&y.add(String(m));return y}function g(b){if(n.call(b,"strict")){const y=b.strict;if(typeof y!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(y)return m=>{let v=`Object can not safely be stringified. Received type ${typeof m}`;throw typeof m!="function"&&(v+=` (${m.toString()})`),new Error(v)}}}function _(b){b={...b};const y=g(b);y&&(b.bigint===void 0&&(b.bigint=!1),"circularValue"in b||(b.circularValue=Error));const m=c(b),v=d(b,"bigint"),S=d(b,"deterministic"),w=f(b,"maximumDepth"),C=f(b,"maximumBreadth");function x(M,T,A,R,D,$){let L=T[M];switch(typeof L=="object"&&L!==null&&typeof L.toJSON=="function"&&(L=L.toJSON(M)),L=R.call(T,M,L),typeof L){case"string":return o(L);case"object":{if(L===null)return"null";if(A.indexOf(L)!==-1)return m;let O="",B=",";const U=$;if(Array.isArray(L)){if(L.length===0)return"[]";if(wC){const fe=L.length-C-1;O+=`${B}"... ${h(fe)} not stringified"`}return D!==""&&(O+=` +${U}`),A.pop(),`[${O}]`}let j=Object.keys(L);const q=j.length;if(q===0)return"{}";if(wC){const K=q-C;O+=`${Z}"...":${Y}"${h(K)} not stringified"`,Z=B}return D!==""&&Z.length>1&&(O=` +${$}${O} +${U}`),A.pop(),`{${O}}`}case"number":return isFinite(L)?String(L):y?y(L):"null";case"boolean":return L===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(L);default:return y?y(L):void 0}}function P(M,T,A,R,D,$){switch(typeof T=="object"&&T!==null&&typeof T.toJSON=="function"&&(T=T.toJSON(M)),typeof T){case"string":return o(T);case"object":{if(T===null)return"null";if(A.indexOf(T)!==-1)return m;const L=$;let O="",B=",";if(Array.isArray(T)){if(T.length===0)return"[]";if(wC){const V=T.length-C-1;O+=`${B}"... ${h(V)} not stringified"`}return D!==""&&(O+=` +${L}`),A.pop(),`[${O}]`}A.push(T);let U="";D!==""&&($+=D,B=`, +${$}`,U=" ");let j="";for(const q of R){const Y=P(q,T[q],A,R,D,$);Y!==void 0&&(O+=`${j}${o(q)}:${U}${Y}`,j=B)}return D!==""&&j.length>1&&(O=` +${$}${O} +${L}`),A.pop(),`{${O}}`}case"number":return isFinite(T)?String(T):y?y(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(T);default:return y?y(T):void 0}}function E(M,T,A,R,D){switch(typeof T){case"string":return o(T);case"object":{if(T===null)return"null";if(typeof T.toJSON=="function"){if(T=T.toJSON(M),typeof T!="object")return E(M,T,A,R,D);if(T===null)return"null"}if(A.indexOf(T)!==-1)return m;const $=D;if(Array.isArray(T)){if(T.length===0)return"[]";if(wC){const re=T.length-C-1;Y+=`${Z}"... ${h(re)} not stringified"`}return Y+=` +${$}`,A.pop(),`[${Y}]`}let L=Object.keys(T);const O=L.length;if(O===0)return"{}";if(wC){const Y=O-C;U+=`${j}"...": "${h(Y)} not stringified"`,j=B}return j!==""&&(U=` +${D}${U} +${$}`),A.pop(),`{${U}}`}case"number":return isFinite(T)?String(T):y?y(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(T);default:return y?y(T):void 0}}function I(M,T,A){switch(typeof T){case"string":return o(T);case"object":{if(T===null)return"null";if(typeof T.toJSON=="function"){if(T=T.toJSON(M),typeof T!="object")return I(M,T,A);if(T===null)return"null"}if(A.indexOf(T)!==-1)return m;let R="";if(Array.isArray(T)){if(T.length===0)return"[]";if(wC){const q=T.length-C-1;R+=`,"... ${h(q)} not stringified"`}return A.pop(),`[${R}]`}let D=Object.keys(T);const $=D.length;if($===0)return"{}";if(wC){const B=$-C;R+=`${L}"...":"${h(B)} not stringified"`}return A.pop(),`{${R}}`}case"number":return isFinite(T)?String(T):y?y(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(T);default:return y?y(T):void 0}}function N(M,T,A){if(arguments.length>1){let R="";if(typeof A=="number"?R=" ".repeat(Math.min(A,10)):typeof A=="string"&&(R=A.slice(0,10)),T!=null){if(typeof T=="function")return x("",{"":M},[],T,R,"");if(Array.isArray(T))return P("",M,[],p(T),R,"")}if(R.length!==0)return E("",M,[],R,"")}return I("",M,[])}return N}})(P5,P5.exports);var Hce=P5.exports;(function(e){var t=He&&He.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=oc,r=Nf,i=NF,o=W_,a=K_,s=DF,l=LF,u=t(Hce);let c=!1;const d=()=>globalThis.ROARR,f=()=>({messageContext:{},transforms:[]}),h=()=>{const v=d().asyncLocalStorage;if(!v)throw new Error("AsyncLocalContext is unavailable.");const S=v.getStore();return S||f()},p=()=>!!d().asyncLocalStorage,g=()=>{if(p()){const v=h();return(0,i.hasOwnProperty)(v,"sequenceRoot")&&(0,i.hasOwnProperty)(v,"sequence")&&typeof v.sequence=="number"?String(v.sequenceRoot)+"."+String(v.sequence++):String(d().sequence++)}return String(d().sequence++)},_=(v,S)=>(w,C,x,P,E,I,N,M,T,A)=>{v.child({logLevel:S})(w,C,x,P,E,I,N,M,T,A)},b=1e3,y=(v,S)=>(w,C,x,P,E,I,N,M,T,A)=>{const R=(0,u.default)({a:w,b:C,c:x,d:P,e:E,f:I,g:N,h:M,i:T,j:A,logLevel:S});if(!R)throw new Error("Expected key to be a string");const D=d().onceLog;D.has(R)||(D.add(R),D.size>b&&D.clear(),v.child({logLevel:S})(w,C,x,P,E,I,N,M,T,A))},m=(v,S={},w=[])=>{var C;if(!(0,o.isBrowser)()&&typeof process<"u"&&!(0,a.isTruthy)((C={}.ROARR_LOG)!==null&&C!==void 0?C:""))return(0,s.createMockLogger)(v,S);const x=(P,E,I,N,M,T,A,R,D,$)=>{const L=Date.now(),O=g();let B;p()?B=h():B=f();let U,j;if(typeof P=="string"?U={...B.messageContext,...S}:U={...B.messageContext,...S,...P},typeof P=="string"&&E===void 0)j=P;else if(typeof P=="string"){if(!P.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");j=(0,l.printf)(P,E,I,N,M,T,A,R,D,$)}else{let Y=E;if(typeof E!="string")if(E===void 0)Y="";else throw new TypeError("Message must be a string. Received "+typeof E+".");j=(0,l.printf)(Y,I,N,M,T,A,R,D,$)}let q={context:U,message:j,sequence:O,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const Y of[...B.transforms,...w])if(q=Y(q),typeof q!="object"||q===null)throw new Error("Message transform function must return a message object.");v(q)};return x.child=P=>{let E;return p()?E=h():E=f(),typeof P=="function"?(0,e.createLogger)(v,{...E.messageContext,...S,...P},[P,...w]):(0,e.createLogger)(v,{...E.messageContext,...S,...P},w)},x.getContext=()=>{let P;return p()?P=h():P=f(),{...P.messageContext,...S}},x.adopt=async(P,E)=>{if(!p())return c===!1&&(c=!0,v({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:g(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),P();const I=h();let N;(0,i.hasOwnProperty)(I,"sequenceRoot")&&(0,i.hasOwnProperty)(I,"sequence")&&typeof I.sequence=="number"?N=I.sequenceRoot+"."+String(I.sequence++):N=String(d().sequence++);let M={...I.messageContext};const T=[...I.transforms];typeof E=="function"?T.push(E):M={...M,...E};const A=d().asyncLocalStorage;if(!A)throw new Error("Async local context unavailable.");return A.run({messageContext:M,sequence:0,sequenceRoot:N,transforms:T},()=>P())},x.debug=_(x,r.logLevels.debug),x.debugOnce=y(x,r.logLevels.debug),x.error=_(x,r.logLevels.error),x.errorOnce=y(x,r.logLevels.error),x.fatal=_(x,r.logLevels.fatal),x.fatalOnce=y(x,r.logLevels.fatal),x.info=_(x,r.logLevels.info),x.infoOnce=y(x,r.logLevels.info),x.trace=_(x,r.logLevels.trace),x.traceOnce=y(x,r.logLevels.trace),x.warn=_(x,r.logLevels.warn),x.warnOnce=y(x,r.logLevels.warn),x};e.createLogger=m})($F);var Y_={},qce=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},Wce=He&&He.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.createRoarrInitialGlobalStateBrowser=void 0;const cI=oc,dI=Wce(qce),Kce=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(dI.default),t.includes(cI.ROARR_VERSION)||t.push(cI.ROARR_VERSION),t.sort(dI.default),{sequence:0,...e,versions:t}};Y_.createRoarrInitialGlobalStateBrowser=Kce;var Z_={};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.getLogLevelName=void 0;const Xce=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";Z_.getLogLevelName=Xce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const t=$F,r=(0,Y_.createRoarrInitialGlobalStateBrowser)(globalThis.ROARR||{});e.ROARR=r,globalThis.ROARR=r;const i=l=>JSON.stringify(l),o=(0,t.createLogger)(l=>{var u;r.write&&r.write(((u=r.serializeMessage)!==null&&u!==void 0?u:i)(l))});e.Roarr=o;var a=Nf;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return a.logLevels}});var s=Z_;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return s.getLogLevelName}})})(Tm);var fI=He&&He.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?g("%c ".concat(p," %c").concat(f?" [".concat(String(f),"]:"):"","%c ").concat(u.message," %O"),b,y,m,h):g("%c ".concat(p," %c").concat(f?" [".concat(String(f),"]:"):"","%c ").concat(u.message),b,y,m)}}:function(l){var u=JSON.parse(l),c=u.context,d=c.logLevel,f=c.namespace,h=fI(c,["logLevel","namespace"]);if(!(s&&!(0,k5.test)(s,u))){var p=(0,hI.getLogLevelName)(Number(d)),g=a[p];Object.keys(h).length>0?g("".concat(p," ").concat(f?" [".concat(String(f),"]:"):""," ").concat(u.message),h):g("".concat(p," ").concat(f?" [".concat(String(f),"]:"):""," ").concat(u.message))}}};R_.createLogWriter=rde;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=R_;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(fF);Tm.ROARR.write=fF.createLogWriter();const FF={};Tm.Roarr.child(FF);const J_=Pa(Tm.Roarr.child(FF)),se=e=>J_.get().child({namespace:e}),Ize=["trace","debug","info","warn","error","fatal"],Mze={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},BF=Pa(),zF=F.enum(["Any","BoardField","boolean","BooleanCollection","BooleanPolymorphic","ClipField","Collection","CollectionItem","ColorCollection","ColorField","ColorPolymorphic","ConditioningCollection","ConditioningField","ConditioningPolymorphic","ControlCollection","ControlField","ControlNetModelField","ControlPolymorphic","DenoiseMaskField","enum","float","FloatCollection","FloatPolymorphic","ImageCollection","ImageField","ImagePolymorphic","integer","IntegerCollection","IntegerPolymorphic","IPAdapterCollection","IPAdapterField","IPAdapterModelField","IPAdapterPolymorphic","LatentsCollection","LatentsField","LatentsPolymorphic","LoRAModelField","MainModelField","MetadataField","MetadataCollection","MetadataItemField","MetadataItemCollection","MetadataItemPolymorphic","ONNXModelField","Scheduler","SDXLMainModelField","SDXLRefinerModelField","string","StringCollection","StringPolymorphic","T2IAdapterCollection","T2IAdapterField","T2IAdapterModelField","T2IAdapterPolymorphic","UNetField","VaeField","VaeModelField"]),ide=F.enum(["WorkflowField","IsIntermediate","MetadataField"]),gI=e=>zF.safeParse(e).success||ide.safeParse(e).success;F.enum(["connection","direct","any"]);const VF=F.object({id:F.string().trim().min(1),name:F.string().trim().min(1),type:zF}),ode=VF.extend({fieldKind:F.literal("output")}),Ae=VF.extend({fieldKind:F.literal("input"),label:F.string()}),Cs=F.object({model_name:F.string().trim().min(1),base_model:ql}),Df=F.object({image_name:F.string().trim().min(1)}),ade=F.object({board_id:F.string().trim().min(1)}),T1=F.object({latents_name:F.string().trim().min(1),seed:F.number().int().optional()}),A1=F.object({conditioning_name:F.string().trim().min(1)}),sde=F.object({mask_name:F.string().trim().min(1),masked_latents_name:F.string().trim().min(1).optional()}),lde=Ae.extend({type:F.literal("integer"),value:F.number().int().optional()}),ude=Ae.extend({type:F.literal("IntegerCollection"),value:F.array(F.number().int()).optional()}),cde=Ae.extend({type:F.literal("IntegerPolymorphic"),value:F.number().int().optional()}),dde=Ae.extend({type:F.literal("float"),value:F.number().optional()}),fde=Ae.extend({type:F.literal("FloatCollection"),value:F.array(F.number()).optional()}),hde=Ae.extend({type:F.literal("FloatPolymorphic"),value:F.number().optional()}),pde=Ae.extend({type:F.literal("string"),value:F.string().optional()}),gde=Ae.extend({type:F.literal("StringCollection"),value:F.array(F.string()).optional()}),mde=Ae.extend({type:F.literal("StringPolymorphic"),value:F.string().optional()}),yde=Ae.extend({type:F.literal("boolean"),value:F.boolean().optional()}),vde=Ae.extend({type:F.literal("BooleanCollection"),value:F.array(F.boolean()).optional()}),bde=Ae.extend({type:F.literal("BooleanPolymorphic"),value:F.boolean().optional()}),_de=Ae.extend({type:F.literal("enum"),value:F.string().optional()}),Sde=Ae.extend({type:F.literal("LatentsField"),value:T1.optional()}),xde=Ae.extend({type:F.literal("LatentsCollection"),value:F.array(T1).optional()}),wde=Ae.extend({type:F.literal("LatentsPolymorphic"),value:F.union([T1,F.array(T1)]).optional()}),Cde=Ae.extend({type:F.literal("DenoiseMaskField"),value:sde.optional()}),Ede=Ae.extend({type:F.literal("ConditioningField"),value:A1.optional()}),Tde=Ae.extend({type:F.literal("ConditioningCollection"),value:F.array(A1).optional()}),Ade=Ae.extend({type:F.literal("ConditioningPolymorphic"),value:F.union([A1,F.array(A1)]).optional()}),Pde=Cs,_g=F.object({image:Df,control_model:Pde,control_weight:F.union([F.number(),F.array(F.number())]).optional(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional(),control_mode:F.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:F.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),kde=Ae.extend({type:F.literal("ControlField"),value:_g.optional()}),Ide=Ae.extend({type:F.literal("ControlPolymorphic"),value:F.union([_g,F.array(_g)]).optional()}),Mde=Ae.extend({type:F.literal("ControlCollection"),value:F.array(_g).optional()}),Rde=Cs,Sg=F.object({image:Df,ip_adapter_model:Rde,weight:F.number(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional()}),Ode=Ae.extend({type:F.literal("IPAdapterField"),value:Sg.optional()}),$de=Ae.extend({type:F.literal("IPAdapterPolymorphic"),value:F.union([Sg,F.array(Sg)]).optional()}),Nde=Ae.extend({type:F.literal("IPAdapterCollection"),value:F.array(Sg).optional()}),Dde=Cs,xg=F.object({image:Df,t2i_adapter_model:Dde,weight:F.union([F.number(),F.array(F.number())]).optional(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional(),resize_mode:F.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),Lde=Ae.extend({type:F.literal("T2IAdapterField"),value:xg.optional()}),Fde=Ae.extend({type:F.literal("T2IAdapterPolymorphic"),value:F.union([xg,F.array(xg)]).optional()}),Bde=Ae.extend({type:F.literal("T2IAdapterCollection"),value:F.array(xg).optional()}),zde=F.enum(["onnx","main","vae","lora","controlnet","embedding"]),Vde=F.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),mf=Cs.extend({model_type:zde,submodel:Vde.optional()}),jF=mf.extend({weight:F.number().optional()}),jde=F.object({unet:mf,scheduler:mf,loras:F.array(jF)}),Ude=Ae.extend({type:F.literal("UNetField"),value:jde.optional()}),Gde=F.object({tokenizer:mf,text_encoder:mf,skipped_layers:F.number(),loras:F.array(jF)}),Hde=Ae.extend({type:F.literal("ClipField"),value:Gde.optional()}),qde=F.object({vae:mf}),Wde=Ae.extend({type:F.literal("VaeField"),value:qde.optional()}),Kde=Ae.extend({type:F.literal("ImageField"),value:Df.optional()}),Xde=Ae.extend({type:F.literal("BoardField"),value:ade.optional()}),Qde=Ae.extend({type:F.literal("ImagePolymorphic"),value:Df.optional()}),Yde=Ae.extend({type:F.literal("ImageCollection"),value:F.array(Df).optional()}),Zde=Ae.extend({type:F.literal("MainModelField"),value:Sm.optional()}),Jde=Ae.extend({type:F.literal("SDXLMainModelField"),value:Sm.optional()}),efe=Ae.extend({type:F.literal("SDXLRefinerModelField"),value:Sm.optional()}),UF=Cs,tfe=Ae.extend({type:F.literal("VaeModelField"),value:UF.optional()}),GF=Cs,nfe=Ae.extend({type:F.literal("LoRAModelField"),value:GF.optional()}),rfe=Cs,ife=Ae.extend({type:F.literal("ControlNetModelField"),value:rfe.optional()}),ofe=Cs,afe=Ae.extend({type:F.literal("IPAdapterModelField"),value:ofe.optional()}),sfe=Cs,lfe=Ae.extend({type:F.literal("T2IAdapterModelField"),value:sfe.optional()}),ufe=Ae.extend({type:F.literal("Collection"),value:F.array(F.any()).optional()}),cfe=Ae.extend({type:F.literal("CollectionItem"),value:F.any().optional()}),P1=F.object({label:F.string(),value:F.any()}),dfe=Ae.extend({type:F.literal("MetadataItemField"),value:P1.optional()}),ffe=Ae.extend({type:F.literal("MetadataItemCollection"),value:F.array(P1).optional()}),hfe=Ae.extend({type:F.literal("MetadataItemPolymorphic"),value:F.union([P1,F.array(P1)]).optional()}),HF=F.record(F.any()),pfe=Ae.extend({type:F.literal("MetadataField"),value:HF.optional()}),gfe=Ae.extend({type:F.literal("MetadataCollection"),value:F.array(HF).optional()}),k1=F.object({r:F.number().int().min(0).max(255),g:F.number().int().min(0).max(255),b:F.number().int().min(0).max(255),a:F.number().int().min(0).max(255)}),mfe=Ae.extend({type:F.literal("ColorField"),value:k1.optional()}),yfe=Ae.extend({type:F.literal("ColorCollection"),value:F.array(k1).optional()}),vfe=Ae.extend({type:F.literal("ColorPolymorphic"),value:F.union([k1,F.array(k1)]).optional()}),bfe=Ae.extend({type:F.literal("Scheduler"),value:mL.optional()}),_fe=Ae.extend({type:F.literal("Any"),value:F.any().optional()}),Sfe=F.discriminatedUnion("type",[_fe,Xde,vde,yde,bde,Hde,ufe,cfe,mfe,yfe,vfe,Ede,Tde,Ade,kde,ife,Mde,Ide,Cde,_de,fde,dde,hde,Yde,Qde,Kde,ude,cde,lde,Ode,afe,Nde,$de,Sde,xde,wde,nfe,Zde,bfe,Jde,efe,gde,mde,pde,Lde,lfe,Bde,Fde,Ude,Wde,tfe,dfe,ffe,hfe,pfe,gfe]),Rze=e=>!!(e&&e.fieldKind==="input"),Oze=e=>!!(e&&e.fieldKind==="input"),N0=e=>!!(e&&!("$ref"in e)),mI=e=>!!(e&&!("$ref"in e)&&e.type==="array"),D0=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),au=e=>!!(e&&"$ref"in e),xfe=e=>"class"in e&&e.class==="invocation",wfe=e=>"class"in e&&e.class==="output",yI=e=>!("$ref"in e),qF=F.object({lora:GF.deepPartial(),weight:F.number()}),Cfe=_g.deepPartial(),Efe=Sg.deepPartial(),Tfe=xg.deepPartial(),Afe=F.object({app_version:F.string().nullish().catch(null),generation_mode:F.string().nullish().catch(null),created_by:F.string().nullish().catch(null),positive_prompt:F.string().nullish().catch(null),negative_prompt:F.string().nullish().catch(null),width:F.number().int().nullish().catch(null),height:F.number().int().nullish().catch(null),seed:F.number().int().nullish().catch(null),rand_device:F.string().nullish().catch(null),cfg_scale:F.number().nullish().catch(null),steps:F.number().int().nullish().catch(null),scheduler:F.string().nullish().catch(null),clip_skip:F.number().int().nullish().catch(null),model:F.union([u_.deepPartial(),bL.deepPartial()]).nullish().catch(null),controlnets:F.array(Cfe).nullish().catch(null),ipAdapters:F.array(Efe).nullish().catch(null),t2iAdapters:F.array(Tfe).nullish().catch(null),loras:F.array(qF).nullish().catch(null),vae:UF.nullish().catch(null),strength:F.number().nullish().catch(null),hrf_enabled:F.boolean().nullish().catch(null),hrf_strength:F.number().nullish().catch(null),hrf_method:F.string().nullish().catch(null),init_image:F.string().nullish().catch(null),positive_style_prompt:F.string().nullish().catch(null),negative_style_prompt:F.string().nullish().catch(null),refiner_model:$E.deepPartial().nullish().catch(null),refiner_cfg_scale:F.number().nullish().catch(null),refiner_steps:F.number().int().nullish().catch(null),refiner_scheduler:F.string().nullish().catch(null),refiner_positive_aesthetic_score:F.number().nullish().catch(null),refiner_negative_aesthetic_score:F.number().nullish().catch(null),refiner_start:F.number().nullish().catch(null)}).passthrough(),eT=F.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))}),Pfe=eT.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}}),vI=F.object({id:F.string().trim().min(1),type:F.string().trim().min(1),inputs:F.record(Sfe),outputs:F.record(ode),label:F.string(),isOpen:F.boolean(),notes:F.string(),embedWorkflow:F.boolean(),isIntermediate:F.boolean(),useCache:F.boolean().optional(),version:eT.optional()}),kfe=F.preprocess(e=>{var t;try{const n=vI.parse(e);if(!Hne(n,"useCache")){const r=(t=BF.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},vI.extend({useCache:F.boolean()})),Ife=F.object({id:F.string().trim().min(1),type:F.literal("notes"),label:F.string(),isOpen:F.boolean(),notes:F.string()}),WF=F.object({x:F.number(),y:F.number()}).default({x:0,y:0}),I1=F.number().gt(0).nullish(),KF=F.object({id:F.string().trim().min(1),type:F.literal("invocation"),data:kfe,width:I1,height:I1,position:WF}),I5=e=>KF.safeParse(e).success,Mfe=F.object({id:F.string().trim().min(1),type:F.literal("notes"),data:Ife,width:I1,height:I1,position:WF}),XF=F.discriminatedUnion("type",[KF,Mfe]),Rfe=F.object({source:F.string().trim().min(1),sourceHandle:F.string().trim().min(1),target:F.string().trim().min(1),targetHandle:F.string().trim().min(1),id:F.string().trim().min(1),type:F.literal("default")}),Ofe=F.object({source:F.string().trim().min(1),target:F.string().trim().min(1),id:F.string().trim().min(1),type:F.literal("collapsed")}),QF=F.union([Rfe,Ofe]),$fe=F.object({nodeId:F.string().trim().min(1),fieldName:F.string().trim().min(1)}),Nfe="1.0.0",Dfe=F.object({name:F.string().default(""),author:F.string().default(""),description:F.string().default(""),version:F.string().default(""),contact:F.string().default(""),tags:F.string().default(""),notes:F.string().default(""),nodes:F.array(XF).default([]),edges:F.array(QF).default([]),exposedFields:F.array($fe).default([]),meta:F.object({version:eT}).default({version:Nfe})});Dfe.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(I5),o=xE(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${de.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${de.t("nodes.doesNotExist")}`):c.push(`${de.t("nodes.outputNode")} ${a.source} ${de.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${de.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${de.t("nodes.doesNotExist")}`):c.push(`${de.t("nodes.inputNode")} ${a.target} ${de.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${de.t("nodes.edge")} "${d} -> ${f}" ${de.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const on=e=>!!(e&&e.type==="invocation"),$ze=e=>!!(e&&!["notes","current_image"].includes(e.type)),bI=e=>!!(e&&e.type==="notes");var wu=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(wu||{});const ce=Do.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Vi(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Vi({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Vi({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Lt.addMany(Lt.getInitialState(),n)},merge:(t,n)=>{Lt.addMany(t,bg.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;bg.selectAll(i).forEach(o=>{n(ce.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:"images/intermediates"}),providesTags:["IntermediatesCount"]}),clearIntermediates:e.mutation({query:()=>({url:"images/intermediates",method:"DELETE"}),invalidatesTags:["IntermediatesCount"]}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],transformResponse:t=>{if(t){const n=Afe.safeParse(t);if(n.success)return n.data;se("images").warn("Problem parsing metadata")}},keepUnusedDataFor:86400}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a=Pr.includes(t.image_category),s={board_id:o??"none",categories:Ni(t)},l=[];l.push(n(ce.util.updateQueryData("listImages",s,u=>{Lt.removeOne(u,i)}))),l.push(n(Qe.util.updateQueryData(a?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));try{await r}catch{l.forEach(u=>{u.undo()})}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=xE(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:Ni(s)};n(ce.util.updateQueryData("listImages",l,c=>{Lt.removeOne(c,a)}));const u=Pr.includes(s.image_category);n(Qe.util.updateQueryData(u?"getBoardAssetsTotal":"getBoardImagesTotal",s.board_id??"none",c=>{c.total=Math.max(c.total-1,0)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(ce.util.updateQueryData("getImageDTO",t.image_name,u=>{Object.assign(u,{is_intermediate:n})})));const s=Ni(t),l=Pr.includes(t.image_category);if(n)a.push(r(ce.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},u=>{Lt.removeOne(u,t.image_name)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));else{a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",p=>{p.total+=1})));const u={board_id:t.board_id??"none",categories:s},c=ce.endpoints.listImages.select(u)(o()),{data:d}=Fn.includes(t.image_category)?Qe.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=ou(c.data,t);(f||h)&&a.push(r(ce.util.updateQueryData("listImages",u,p=>{Lt.upsertOne(p,t)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(ce.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=Ni(r[0]),o=r[0].board_id??void 0;return[{type:"ImageList",id:Vi({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=Ni(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(ce.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=ce.endpoints.listImages.select(d)(i()),{data:h}=Fn.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(l??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),g=((h==null?void 0:h.total)??0)>=$0?ou(f.data,u):!0;(p||g)&&n(ce.util.updateQueryData("listImages",d,_=>{Lt.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=Ni(r[0]),o=r[0].board_id??void 0;return[{type:"ImageList",id:Vi({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=Ni(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(ce.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=ce.endpoints.listImages.select(d)(i()),{data:h}=Fn.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(l??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),g=((h==null?void 0:h.total)??0)>=$0?ou(f.data,u):!0;(p||g)&&n(ce.util.updateQueryData("listImages",d,_=>{Lt.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(ce.util.upsertQueryData("getImageDTO",i.image_name,i));const o=Ni(i);n(ce.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Lt.addOne(a,i)})),n(Qe.util.updateQueryData("getBoardAssetsTotal",i.board_id??"none",a=>{a.total+=1}))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:kr},{type:"ImageList",id:Vi({board_id:"none",categories:Fn})},{type:"ImageList",id:Vi({board_id:"none",categories:Pr})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(ce.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))}),n(Qe.util.updateQueryData("getBoardAssetsTotal",t,l=>{l.total=0})),n(Qe.util.updateQueryData("getBoardImagesTotal",t,l=>{l.total=0}));const a=[{categories:Fn},{categories:Pr}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(ce.util.updateQueryData("listImages",l,u=>{Lt.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:kr},{type:"ImageList",id:Vi({board_id:"none",categories:Fn})},{type:"ImageList",id:Vi({board_id:"none",categories:Pr})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:Fn},{categories:Pr}].forEach(s=>{n(ce.util.updateQueryData("listImages",s,l=>{Lt.removeMany(l,o)}))}),n(Qe.util.updateQueryData("getBoardAssetsTotal",t,s=>{s.total=0})),n(Qe.util.updateQueryData("getBoardImagesTotal",t,s=>{s.total=0}))}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r})=>[{type:"Board",id:r}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=Ni(n),l=Pr.includes(n.image_category);if(a.push(r(ce.util.updateQueryData("getImageDTO",n.image_name,u=>{u.board_id=t}))),!n.is_intermediate){a.push(r(ce.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},p=>{Lt.removeOne(p,n.image_name)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",n.board_id??"none",p=>{p.total=Math.max(p.total-1,0)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",p=>{p.total+=1})));const u={board_id:t??"none",categories:s},c=ce.endpoints.listImages.select(u)(o()),{data:d}=Fn.includes(n.image_category)?Qe.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=ou(c.data,n);(f||h)&&a.push(r(ce.util.updateQueryData("listImages",u,p=>{Lt.addOne(p,n)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=Ni(t),a=[],s=Pr.includes(t.image_category);a.push(n(ce.util.updateQueryData("getImageDTO",t.image_name,h=>{h.board_id=void 0}))),a.push(n(ce.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},h=>{Lt.removeOne(h,t.image_name)}))),a.push(n(Qe.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",h=>{h.total=Math.max(h.total-1,0)}))),a.push(n(Qe.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal","none",h=>{h.total+=1})));const l={board_id:"none",categories:o},u=ce.endpoints.listImages.select(l)(i()),{data:c}=Fn.includes(t.image_category)?Qe.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),d=u.data&&u.data.ids.length>=((c==null?void 0:c.total)??0),f=ou(u.data,t);(d||f)&&a.push(n(ce.util.updateQueryData("listImages",l,h=>{Lt.upsertOne(h,t)})));try{await r}catch{a.forEach(h=>h.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{board_id:r})=>[{type:"Board",id:r??"none"}],async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(ce.util.updateQueryData("getImageDTO",l,y=>{y.board_id=t==="none"?void 0:t}));const u=n.find(y=>y.image_name===l);if(!u)return;const c=Ni(u),d=u.board_id,f=Pr.includes(u.image_category);r(ce.util.updateQueryData("listImages",{board_id:d??"none",categories:c},y=>{Lt.removeOne(y,u.image_name)})),r(Qe.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",d??"none",y=>{y.total=Math.max(y.total-1,0)})),r(Qe.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",y=>{y.total+=1}));const h={board_id:t,categories:c},p=ce.endpoints.listImages.select(h)(o()),{data:g}=Fn.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(t??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(t??"none")(o()),_=p.data&&p.data.ids.length>=((g==null?void 0:g.total)??0),b=((g==null?void 0:g.total)??0)>=$0?ou(p.data,u):!0;(_||b)&&r(ce.util.updateQueryData("listImages",h,y=>{Lt.upsertOne(y,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||o.push({type:"Board",id:s})}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(ce.util.updateQueryData("getImageDTO",s,_=>{_.board_id=void 0}));const l=t.find(_=>_.image_name===s);if(!l)return;const u=Ni(l),c=Pr.includes(l.image_category);n(ce.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},_=>{Lt.removeOne(_,l.image_name)})),n(Qe.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal",l.board_id??"none",_=>{_.total=Math.max(_.total-1,0)})),n(Qe.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal","none",_=>{_.total+=1}));const d={board_id:"none",categories:u},f=ce.endpoints.listImages.select(d)(i()),{data:h}=Fn.includes(l.image_category)?Qe.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),g=((h==null?void 0:h.total)??0)>=$0?ou(f.data,l):!0;(p||g)&&n(ce.util.updateQueryData("listImages",d,_=>{Lt.upsertOne(_,{...l,board_id:"none"})}))})}catch{}}}),bulkDownloadImages:e.mutation({query:({image_names:t,board_id:n})=>({url:"images/download",method:"POST",body:{image_names:t,board_id:n}})})})}),{useGetIntermediatesCountQuery:Nze,useListImagesQuery:Dze,useLazyListImagesQuery:Lze,useGetImageDTOQuery:Fze,useGetImageMetadataQuery:Bze,useDeleteImageMutation:zze,useDeleteImagesMutation:Vze,useUploadImageMutation:jze,useClearIntermediatesMutation:Uze,useAddImagesToBoardMutation:Gze,useRemoveImagesFromBoardMutation:Hze,useAddImageToBoardMutation:qze,useRemoveImageFromBoardMutation:Wze,useChangeImageIsIntermediateMutation:Kze,useChangeImageSessionIdMutation:Xze,useDeleteBoardAndImagesMutation:Qze,useDeleteBoardMutation:Yze,useStarImagesMutation:Zze,useUnstarImagesMutation:Jze,useBulkDownloadImagesMutation:eVe}=ce,YF={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},ZF=Wt({name:"gallery",initialState:YF,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=g5(t.payload,n=>n.image_name)},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(Ffe,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(Qe.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:pa,shouldAutoSwitchChanged:tVe,autoAssignBoardOnClickChanged:nVe,setGalleryImageMinimumWidth:rVe,boardIdSelected:M1,autoAddBoardIdChanged:iVe,galleryViewChanged:M5,selectionChanged:JF,boardSearchTextChanged:oVe}=ZF.actions,Lfe=ZF.reducer,Ffe=si(ce.endpoints.deleteBoard.matchFulfilled,ce.endpoints.deleteBoardAndImages.matchFulfilled),_I={weight:.75},Bfe={loras:{}},eB=Wt({name:"lora",initialState:Bfe,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,..._I}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=_I.weight)}}}),{loraAdded:aVe,loraRemoved:tB,loraWeightChanged:sVe,loraWeightReset:lVe,lorasCleared:uVe,loraRecalled:cVe}=eB.actions,zfe=eB.reducer;function to(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},Vfe=e=>e?SI(e):SI,{useSyncExternalStoreWithSelector:jfe}=Rse;function nB(e,t=e.getState,n){const r=jfe(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return k.useDebugValue(r),r}const xI=(e,t)=>{const n=Vfe(e),r=(i,o=t)=>nB(n,i,o);return Object.assign(r,n),r},Ufe=(e,t)=>e?xI(e,t):xI;function ii(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function eS(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}qy.prototype=eS.prototype={constructor:qy,on:function(e,t){var n=this._,r=Hfe(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),CI.hasOwnProperty(t)?{space:CI[t],local:e}:e}function Wfe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===R5&&t.documentElement.namespaceURI===R5?t.createElement(e):t.createElementNS(n,e)}}function Kfe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rB(e){var t=tS(e);return(t.local?Kfe:Wfe)(t)}function Xfe(){}function tT(e){return e==null?Xfe:function(){return this.querySelector(e)}}function Qfe(e){typeof e!="function"&&(e=tT(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=m&&(m=y+1);!(S=_[m])&&++m=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function She(e){e||(e=xhe);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function whe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Che(){return Array.from(this)}function Ehe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Dhe:typeof t=="function"?Fhe:Lhe)(e,t,n??"")):yf(this.node(),e)}function yf(e,t){return e.style.getPropertyValue(t)||lB(e).getComputedStyle(e,null).getPropertyValue(t)}function zhe(e){return function(){delete this[e]}}function Vhe(e,t){return function(){this[e]=t}}function jhe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Uhe(e,t){return arguments.length>1?this.each((t==null?zhe:typeof t=="function"?jhe:Vhe)(e,t)):this.node()[e]}function uB(e){return e.trim().split(/^|\s+/)}function nT(e){return e.classList||new cB(e)}function cB(e){this._node=e,this._names=uB(e.getAttribute("class")||"")}cB.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function dB(e,t){for(var n=nT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ype(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function O5(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}O5.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ape(e){return!e.ctrlKey&&!e.button}function Ppe(){return this.parentNode}function kpe(e,t){return t??{x:e.x,y:e.y}}function Ipe(){return navigator.maxTouchPoints||"ontouchstart"in this}function Mpe(){var e=Ape,t=Ppe,n=kpe,r=Ipe,i={},o=eS("start","drag","end"),a=0,s,l,u,c,d=0;function f(v){v.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,Tpe).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,S){if(!(c||!e.call(this,v,S))){var w=m(this,t.call(this,v,S),v,S,"mouse");w&&(So(v.view).on("mousemove.drag",p,wg).on("mouseup.drag",g,wg),gB(v.view),Xx(v),u=!1,s=v.clientX,l=v.clientY,w("start",v))}}function p(v){if(Dd(v),!u){var S=v.clientX-s,w=v.clientY-l;u=S*S+w*w>d}i.mouse("drag",v)}function g(v){So(v.view).on("mousemove.drag mouseup.drag",null),mB(v.view,u),Dd(v),i.mouse("end",v)}function _(v,S){if(e.call(this,v,S)){var w=v.changedTouches,C=t.call(this,v,S),x=w.length,P,E;for(P=0;P>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?F0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?F0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ope.exec(e))?new Yr(t[1],t[2],t[3],1):(t=$pe.exec(e))?new Yr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Npe.exec(e))?F0(t[1],t[2],t[3],t[4]):(t=Dpe.exec(e))?F0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Lpe.exec(e))?MI(t[1],t[2]/100,t[3]/100,1):(t=Fpe.exec(e))?MI(t[1],t[2]/100,t[3]/100,t[4]):EI.hasOwnProperty(e)?PI(EI[e]):e==="transparent"?new Yr(NaN,NaN,NaN,0):null}function PI(e){return new Yr(e>>16&255,e>>8&255,e&255,1)}function F0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Yr(e,t,n,r)}function Vpe(e){return e instanceof Pm||(e=Tg(e)),e?(e=e.rgb(),new Yr(e.r,e.g,e.b,e.opacity)):new Yr}function $5(e,t,n,r){return arguments.length===1?Vpe(e):new Yr(e,t,n,r??1)}function Yr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rT(Yr,$5,yB(Pm,{brighter(e){return e=e==null?O1:Math.pow(O1,e),new Yr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cg:Math.pow(Cg,e),new Yr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Yr(Uu(this.r),Uu(this.g),Uu(this.b),$1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:kI,formatHex:kI,formatHex8:jpe,formatRgb:II,toString:II}));function kI(){return`#${Mu(this.r)}${Mu(this.g)}${Mu(this.b)}`}function jpe(){return`#${Mu(this.r)}${Mu(this.g)}${Mu(this.b)}${Mu((isNaN(this.opacity)?1:this.opacity)*255)}`}function II(){const e=$1(this.opacity);return`${e===1?"rgb(":"rgba("}${Uu(this.r)}, ${Uu(this.g)}, ${Uu(this.b)}${e===1?")":`, ${e})`}`}function $1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Uu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mu(e){return e=Uu(e),(e<16?"0":"")+e.toString(16)}function MI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new xo(e,t,n,r)}function vB(e){if(e instanceof xo)return new xo(e.h,e.s,e.l,e.opacity);if(e instanceof Pm||(e=Tg(e)),!e)return new xo;if(e instanceof xo)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new xo(a,s,l,e.opacity)}function Upe(e,t,n,r){return arguments.length===1?vB(e):new xo(e,t,n,r??1)}function xo(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rT(xo,Upe,yB(Pm,{brighter(e){return e=e==null?O1:Math.pow(O1,e),new xo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cg:Math.pow(Cg,e),new xo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Yr(Qx(e>=240?e-240:e+120,i,r),Qx(e,i,r),Qx(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new xo(RI(this.h),B0(this.s),B0(this.l),$1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=$1(this.opacity);return`${e===1?"hsl(":"hsla("}${RI(this.h)}, ${B0(this.s)*100}%, ${B0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function RI(e){return e=(e||0)%360,e<0?e+360:e}function B0(e){return Math.max(0,Math.min(1,e||0))}function Qx(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const bB=e=>()=>e;function Gpe(e,t){return function(n){return e+n*t}}function Hpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function qpe(e){return(e=+e)==1?_B:function(t,n){return n-t?Hpe(t,n,e):bB(isNaN(t)?n:t)}}function _B(e,t){var n=t-e;return n?Gpe(e,n):bB(isNaN(e)?t:e)}const OI=function e(t){var n=qpe(t);function r(i,o){var a=n((i=$5(i)).r,(o=$5(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=_B(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function qs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var N5=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yx=new RegExp(N5.source,"g");function Wpe(e){return function(){return e}}function Kpe(e){return function(t){return e(t)+""}}function Xpe(e,t){var n=N5.lastIndex=Yx.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=N5.exec(e))&&(i=Yx.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:qs(r,i)})),n=Yx.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:qs(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:qs(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var g=h.push(i(h)+"scale(",null,",",null,")");p.push({i:g-4,x:qs(u,d)},{i:g-2,x:qs(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,g=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--vf}function DI(){ac=(D1=Ag.now())+nS,vf=Vh=0;try{oge()}finally{vf=0,sge(),ac=0}}function age(){var e=Ag.now(),t=e-D1;t>wB&&(nS-=t,D1=e)}function sge(){for(var e,t=N1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:N1=n);jh=e,L5(r)}function L5(e){if(!vf){Vh&&(Vh=clearTimeout(Vh));var t=e-ac;t>24?(e<1/0&&(Vh=setTimeout(DI,e-Ag.now()-nS)),fh&&(fh=clearInterval(fh))):(fh||(D1=Ag.now(),fh=setInterval(age,wB)),vf=1,CB(DI))}}function LI(e,t,n){var r=new L1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var lge=eS("start","end","cancel","interrupt"),uge=[],TB=0,FI=1,F5=2,Wy=3,BI=4,B5=5,Ky=6;function rS(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;cge(e,n,{name:t,index:r,group:i,on:lge,tween:uge,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:TB})}function oT(e,t){var n=zo(e,t);if(n.state>TB)throw new Error("too late; already scheduled");return n}function ka(e,t){var n=zo(e,t);if(n.state>Wy)throw new Error("too late; already running");return n}function zo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function cge(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=EB(o,0,n.time);function o(u){n.state=FI,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==FI)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===Wy)return LI(a);h.state===BI?(h.state=Ky,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cF5&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function zge(e,t,n){var r,i,o=Bge(t)?oT:ka;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function Vge(e,t){var n=this._id;return arguments.length<2?zo(this.node(),n).on.on(e):this.each(zge(n,e,t))}function jge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uge(){return this.on("end.remove",jge(this._id))}function Gge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tT(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function gme(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Za(e,t,n){this.k=e,this.x=t,this.y=n}Za.prototype={constructor:Za,scale:function(e){return e===1?this:new Za(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Za(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vl=new Za(1,0,0);Za.prototype;function Zx(e){e.stopImmediatePropagation()}function hh(e){e.preventDefault(),e.stopImmediatePropagation()}function mme(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yme(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function zI(){return this.__zoom||vl}function vme(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bme(){return navigator.maxTouchPoints||"ontouchstart"in this}function _me(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Sme(){var e=mme,t=yme,n=_me,r=vme,i=bme,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=rge,u=eS("start","zoom","end"),c,d,f,h=500,p=150,g=0,_=10;function b(T){T.property("__zoom",zI).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",E).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(T,A,R,D){var $=T.selection?T.selection():T;$.property("__zoom",zI),T!==$?S(T,A,R,D):$.interrupt().each(function(){w(this,arguments).event(D).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(T,A,R,D){b.scaleTo(T,function(){var $=this.__zoom.k,L=typeof A=="function"?A.apply(this,arguments):A;return $*L},R,D)},b.scaleTo=function(T,A,R,D){b.transform(T,function(){var $=t.apply(this,arguments),L=this.__zoom,O=R==null?v($):typeof R=="function"?R.apply(this,arguments):R,B=L.invert(O),U=typeof A=="function"?A.apply(this,arguments):A;return n(m(y(L,U),O,B),$,a)},R,D)},b.translateBy=function(T,A,R,D){b.transform(T,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof R=="function"?R.apply(this,arguments):R),t.apply(this,arguments),a)},null,D)},b.translateTo=function(T,A,R,D,$){b.transform(T,function(){var L=t.apply(this,arguments),O=this.__zoom,B=D==null?v(L):typeof D=="function"?D.apply(this,arguments):D;return n(vl.translate(B[0],B[1]).scale(O.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof R=="function"?-R.apply(this,arguments):-R),L,a)},D,$)};function y(T,A){return A=Math.max(o[0],Math.min(o[1],A)),A===T.k?T:new Za(A,T.x,T.y)}function m(T,A,R){var D=A[0]-R[0]*T.k,$=A[1]-R[1]*T.k;return D===T.x&&$===T.y?T:new Za(T.k,D,$)}function v(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function S(T,A,R,D){T.on("start.zoom",function(){w(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(D).end()}).tween("zoom",function(){var $=this,L=arguments,O=w($,L).event(D),B=t.apply($,L),U=R==null?v(B):typeof R=="function"?R.apply($,L):R,j=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),q=$.__zoom,Y=typeof A=="function"?A.apply($,L):A,Z=l(q.invert(U).concat(j/q.k),Y.invert(U).concat(j/Y.k));return function(V){if(V===1)V=Y;else{var K=Z(V),ee=j/K[2];V=new Za(ee,U[0]-K[0]*ee,U[1]-K[1]*ee)}O.zoom(null,V)}})}function w(T,A,R){return!R&&T.__zooming||new C(T,A)}function C(T,A){this.that=T,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,A),this.taps=0}C.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,A){return this.mouse&&T!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var A=So(this.that).datum();u.call(T,this.that,new gme(T,{sourceEvent:this.sourceEvent,target:b,type:T,transform:this.that.__zoom,dispatch:u}),A)}};function x(T,...A){if(!e.apply(this,arguments))return;var R=w(this,A).event(T),D=this.__zoom,$=Math.max(o[0],Math.min(o[1],D.k*Math.pow(2,r.apply(this,arguments)))),L=Yo(T);if(R.wheel)(R.mouse[0][0]!==L[0]||R.mouse[0][1]!==L[1])&&(R.mouse[1]=D.invert(R.mouse[0]=L)),clearTimeout(R.wheel);else{if(D.k===$)return;R.mouse=[L,D.invert(L)],Xy(this),R.start()}hh(T),R.wheel=setTimeout(O,p),R.zoom("mouse",n(m(y(D,$),R.mouse[0],R.mouse[1]),R.extent,a));function O(){R.wheel=null,R.end()}}function P(T,...A){if(f||!e.apply(this,arguments))return;var R=T.currentTarget,D=w(this,A,!0).event(T),$=So(T.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",j,!0),L=Yo(T,R),O=T.clientX,B=T.clientY;gB(T.view),Zx(T),D.mouse=[L,this.__zoom.invert(L)],Xy(this),D.start();function U(q){if(hh(q),!D.moved){var Y=q.clientX-O,Z=q.clientY-B;D.moved=Y*Y+Z*Z>g}D.event(q).zoom("mouse",n(m(D.that.__zoom,D.mouse[0]=Yo(q,R),D.mouse[1]),D.extent,a))}function j(q){$.on("mousemove.zoom mouseup.zoom",null),mB(q.view,D.moved),hh(q),D.event(q).end()}}function E(T,...A){if(e.apply(this,arguments)){var R=this.__zoom,D=Yo(T.changedTouches?T.changedTouches[0]:T,this),$=R.invert(D),L=R.k*(T.shiftKey?.5:2),O=n(m(y(R,L),D,$),t.apply(this,A),a);hh(T),s>0?So(this).transition().duration(s).call(S,O,D,T):So(this).call(b.transform,O,D,T)}}function I(T,...A){if(e.apply(this,arguments)){var R=T.touches,D=R.length,$=w(this,A,T.changedTouches.length===D).event(T),L,O,B,U;for(Zx(T),O=0;O"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},IB=ys.error001();function fn(e,t){const n=k.useContext(iS);if(n===null)throw new Error(IB);return nB(n,e,t)}const Kn=()=>{const e=k.useContext(iS);if(e===null)throw new Error(IB);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},wme=e=>e.userSelectionActive?"none":"all";function Cme({position:e,children:t,className:n,style:r,...i}){const o=fn(wme),a=`${e}`.split("-");return J.createElement("div",{className:to(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i},t)}function Eme({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:J.createElement(Cme,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev"},J.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Tme=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=k.useRef(null),[f,h]=k.useState({x:0,y:0,width:0,height:0}),p=to(["react-flow__edge-textwrapper",u]);return k.useEffect(()=>{if(d.current){const g=d.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),typeof n>"u"||!n?null:J.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c},i&&J.createElement("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),J.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r},n),l)};var Ame=k.memo(Tme);const sT=e=>({width:e.offsetWidth,height:e.offsetHeight}),bf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lT=(e={x:0,y:0},t)=>({x:bf(e.x,t[0][0],t[1][0]),y:bf(e.y,t[0][1],t[1][1])}),VI=(e,t,n)=>en?-bf(Math.abs(e-n),1,50)/50:0,MB=(e,t)=>{const n=VI(e.x,35,t.width-35)*20,r=VI(e.y,35,t.height-35)*20;return[n,r]},RB=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},OB=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Pg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),$B=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),jI=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),dVe=(e,t)=>$B(OB(Pg(e),Pg(t))),z5=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Pme=e=>Ki(e.width)&&Ki(e.height)&&Ki(e.x)&&Ki(e.y),Ki=e=>!isNaN(e)&&isFinite(e),Rn=Symbol.for("internals"),NB=["Enter"," ","Escape"],kme=(e,t)=>{},Ime=e=>"nativeEvent"in e;function V5(e){var i,o;const t=Ime(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const DB=e=>"clientX"in e,bl=(e,t)=>{var o,a;const n=DB(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},F1=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},km=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>J.createElement(J.Fragment,null,J.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&J.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Ki(n)&&Ki(r)?J.createElement(Ame,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null);km.displayName="BaseEdge";function ph(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function LB({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,b,y]=BB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return J.createElement(km,{path:_,labelX:b,labelY:y,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:g})});uT.displayName="SimpleBezierEdge";const GI={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},Mme=({source:e,sourcePosition:t=Pe.Bottom,target:n})=>t===Pe.Left||t===Pe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Rme({source:e,sourcePosition:t=Pe.Bottom,target:n,targetPosition:r=Pe.Top,center:i,offset:o}){const a=GI[t],s=GI[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=Mme({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,g;const _={x:0,y:0},b={x:0,y:0},[y,m,v,S]=LB({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||y,g=i.y||m;const C=[{x:p,y:l.y},{x:p,y:u.y}],x=[{x:l.x,y:g},{x:u.x,y:g}];a[d]===f?h=d==="x"?C:x:h=d==="x"?x:C}else{const C=[{x:l.x,y:u.y}],x=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?x:C:h=a.y===f?C:x,t===r){const M=Math.abs(e[d]-n[d]);if(M<=o){const T=Math.min(o-1,o-M);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*T:b[d]=(u[d]>n[d]?-1:1)*T}}if(t!==r){const M=d==="x"?"y":"x",T=a[d]===s[M],A=l[M]>u[M],R=l[M]=N?(p=(P.x+E.x)/2,g=h[0].y):(p=h[0].x,g=(P.y+E.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+b.x,y:u.y+b.y},n],p,g,v,S]}function Ome(e,t,n,r){const i=Math.min(HI(e,t)/2,HI(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let m="";return y>0&&y{const[b,y,m]=j5({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return J.createElement(km,{path:b,labelX:y,labelY:m,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});oS.displayName="SmoothStepEdge";const cT=k.memo(e=>{var t;return J.createElement(oS,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});cT.displayName="StepEdge";function $me({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=LB({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const dT=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,g,_]=$me({sourceX:e,sourceY:t,targetX:n,targetY:r});return J.createElement(km,{path:p,labelX:g,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});dT.displayName="StraightEdge";function j0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qI({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Pe.Left:return[t-j0(t-r,o),n];case Pe.Right:return[t+j0(r-t,o),n];case Pe.Top:return[t,n-j0(n-i,o)];case Pe.Bottom:return[t,n+j0(i-n,o)]}}function zB({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:i,targetPosition:o=Pe.Top,curvature:a=.25}){const[s,l]=qI({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=qI({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=FB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const z1=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Pe.Bottom,targetPosition:o=Pe.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:g,interactionWidth:_})=>{const[b,y,m]=zB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:g==null?void 0:g.curvature});return J.createElement(km,{path:b,labelX:y,labelY:m,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});z1.displayName="BezierEdge";const fT=k.createContext(null),Nme=fT.Provider;fT.Consumer;const Dme=()=>k.useContext(fT),Lme=e=>"id"in e&&"source"in e&&"target"in e,VB=e=>"id"in e&&!("source"in e)&&!("target"in e),Fme=(e,t,n)=>{if(!VB(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},Bme=(e,t,n)=>{if(!VB(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},jB=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,U5=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,zme=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Uh=(e,t)=>{if(!e.source||!e.target)return t;let n;return Lme(e)?n={...e}:n={...e,id:jB(e)},zme(n,t)?t:t.concat(n)},Vme=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?jB(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},UB=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},jme=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),Fd=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},hT=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=Fd(i,t).positionAbsolute;return OB(r,Pg({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $B(n)},GB=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:g}=Fd(c,s),_={x:g.x,y:g.y,width:d||0,height:f||0},b=z5(l,_),y=typeof d>"u"||typeof f>"u"||d===null||f===null,m=o&&b>0,v=(d||0)*(f||0);(y||m||b>=v||c.dragging)&&u.push(c)}),u},pT=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},HB=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=bf(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},mu=(e,t=0)=>e.transition().duration(t);function WI(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function Ume(e,t,n,r,i,o){const{x:a,y:s}=bl(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const g=gT(void 0,u),_=u.getAttribute("data-handleid"),b=o({nodeId:p,id:_,type:g});if(b)return{handle:{id:_,type:g,nodeId:p,x:n.x,y:n.y},validHandleResult:b}}}let c=[],d=1/0;if(i.forEach(p=>{const g=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(g<=r){const _=o(p);g<=d&&(gp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:g})=>h?p.type==="target":f?g.isValid:!0)||c[0]}const Gme={source:null,target:null,sourceHandle:null,targetHandle:null},qB=()=>({handleDomNode:null,isValid:!1,connection:Gme,endHandle:null});function WB(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...qB(),handleDomNode:l};if(l){const c=gT(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),g={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=g,h&&p&&(t===sc.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(g))}return u}function Hme({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Rn]){const{handleBounds:a}=o[Rn];let s=[],l=[];a&&(s=WI(o,a,"source",`${t}-${n}-${r}`),l=WI(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function gT(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Jx(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function qme(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function KB({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=RB(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:g,panBy:_,getNodes:b,cancelConnection:y}=o();let m=0,v;const{x:S,y:w}=bl(e),C=c==null?void 0:c.elementFromPoint(S,w),x=gT(l,C),P=f==null?void 0:f.getBoundingClientRect();if(!P||!x)return;let E,I=bl(e,P),N=!1,M=null,T=!1,A=null;const R=Hme({nodes:b(),nodeId:n,handleId:t,handleType:x}),D=()=>{if(!h)return;const[O,B]=MB(I,P);_({x:O,y:B}),m=requestAnimationFrame(D)};a({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:x,connectionStartHandle:{nodeId:n,handleId:t,type:x},connectionEndHandle:null}),g==null||g(e,{nodeId:n,handleId:t,handleType:x});function $(O){const{transform:B}=o();I=bl(O,P);const{handle:U,validHandleResult:j}=Ume(O,c,UB(I,B,!1,[1,1]),p,R,q=>WB(q,d,n,t,i?"target":"source",s,c));if(v=U,N||(D(),N=!0),A=j.handleDomNode,M=j.connection,T=j.isValid,a({connectionPosition:v&&T?jme({x:v.x,y:v.y},B):I,connectionStatus:qme(!!v,T),connectionEndHandle:j.endHandle}),!v&&!T&&!A)return Jx(E);M.source!==M.target&&A&&(Jx(E),E=A,A.classList.add("connecting","react-flow__handle-connecting"),A.classList.toggle("valid",T),A.classList.toggle("react-flow__handle-valid",T))}function L(O){var B,U;(v||A)&&M&&T&&(r==null||r(M)),(U=(B=o()).onConnectEnd)==null||U.call(B,O),l&&(u==null||u(O)),Jx(E),y(),cancelAnimationFrame(m),N=!1,T=!1,M=null,A=null,c.removeEventListener("mousemove",$),c.removeEventListener("mouseup",L),c.removeEventListener("touchmove",$),c.removeEventListener("touchend",L)}c.addEventListener("mousemove",$),c.addEventListener("mouseup",L),c.addEventListener("touchmove",$),c.addEventListener("touchend",L)}const KI=()=>!0,Wme=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Kme=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},XB=k.forwardRef(({type:e="source",position:t=Pe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var P,E;const p=a||null,g=e==="target",_=Kn(),b=Dme(),{connectOnClick:y,noPanClassName:m}=fn(Wme,ii),{connecting:v,clickConnecting:S}=fn(Kme(b,p,e),ii);b||(E=(P=_.getState()).onError)==null||E.call(P,"010",ys.error010());const w=I=>{const{defaultEdgeOptions:N,onConnect:M,hasDefaultEdges:T}=_.getState(),A={...N,...I};if(T){const{edges:R,setEdges:D}=_.getState();D(Uh(A,R))}M==null||M(A),s==null||s(A)},C=I=>{if(!b)return;const N=DB(I);i&&(N&&I.button===0||!N)&&KB({event:I,handleId:p,nodeId:b,onConnect:w,isTarget:g,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||KI}),N?c==null||c(I):d==null||d(I)},x=I=>{const{onClickConnectStart:N,onClickConnectEnd:M,connectionClickStartHandle:T,connectionMode:A,isValidConnection:R}=_.getState();if(!b||!T&&!i)return;if(!T){N==null||N(I,{nodeId:b,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:p}});return}const D=RB(I.target),$=n||R||KI,{connection:L,isValid:O}=WB({nodeId:b,id:p,type:e},A,T.nodeId,T.handleId||null,T.type,$,D);O&&w(L),M==null||M(I),_.setState({connectionClickStartHandle:null})};return J.createElement("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${p}-${e}`,className:to(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!g,target:g,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!v||o&&v)}]),onMouseDown:C,onTouchStart:C,onClick:y?x:void 0,ref:h,...f},l)});XB.displayName="Handle";var V1=k.memo(XB);const QB=({data:e,isConnectable:t,targetPosition:n=Pe.Top,sourcePosition:r=Pe.Bottom})=>J.createElement(J.Fragment,null,J.createElement(V1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,J.createElement(V1,{type:"source",position:r,isConnectable:t}));QB.displayName="DefaultNode";var G5=k.memo(QB);const YB=({data:e,isConnectable:t,sourcePosition:n=Pe.Bottom})=>J.createElement(J.Fragment,null,e==null?void 0:e.label,J.createElement(V1,{type:"source",position:n,isConnectable:t}));YB.displayName="InputNode";var ZB=k.memo(YB);const JB=({data:e,isConnectable:t,targetPosition:n=Pe.Top})=>J.createElement(J.Fragment,null,J.createElement(V1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);JB.displayName="OutputNode";var ez=k.memo(JB);const mT=()=>null;mT.displayName="GroupNode";const Xme=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),U0=e=>e.id;function Qme(e,t){return ii(e.selectedNodes.map(U0),t.selectedNodes.map(U0))&&ii(e.selectedEdges.map(U0),t.selectedEdges.map(U0))}const tz=k.memo(({onSelectionChange:e})=>{const t=Kn(),{selectedNodes:n,selectedEdges:r}=fn(Xme,Qme);return k.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});tz.displayName="SelectionListener";const Yme=e=>!!e.onSelectionChange;function Zme({onSelectionChange:e}){const t=fn(Yme);return e||t?J.createElement(tz,{onSelectionChange:e}):null}const Jme=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Oc(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ue(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const e0e=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:g,maxZoom:_,nodeExtent:b,onNodesChange:y,onEdgesChange:m,elementsSelectable:v,connectionMode:S,snapGrid:w,snapToGrid:C,translateExtent:x,connectOnClick:P,defaultEdgeOptions:E,fitView:I,fitViewOptions:N,onNodesDelete:M,onEdgesDelete:T,onNodeDrag:A,onNodeDragStart:R,onNodeDragStop:D,onSelectionDrag:$,onSelectionDragStart:L,onSelectionDragStop:O,noPanClassName:B,nodeOrigin:U,rfId:j,autoPanOnConnect:q,autoPanOnNodeDrag:Y,onError:Z,connectionRadius:V,isValidConnection:K,nodeDragThreshold:ee})=>{const{setNodes:re,setEdges:fe,setDefaultNodesAndEdges:Se,setMinZoom:Me,setMaxZoom:De,setTranslateExtent:Ee,setNodeExtent:tt,reset:ot}=fn(Jme,ii),we=Kn();return k.useEffect(()=>{const Xn=r==null?void 0:r.map(Vt=>({...Vt,...E}));return Se(n,Xn),()=>{ot()}},[]),Ue("defaultEdgeOptions",E,we.setState),Ue("connectionMode",S,we.setState),Ue("onConnect",i,we.setState),Ue("onConnectStart",o,we.setState),Ue("onConnectEnd",a,we.setState),Ue("onClickConnectStart",s,we.setState),Ue("onClickConnectEnd",l,we.setState),Ue("nodesDraggable",u,we.setState),Ue("nodesConnectable",c,we.setState),Ue("nodesFocusable",d,we.setState),Ue("edgesFocusable",f,we.setState),Ue("edgesUpdatable",h,we.setState),Ue("elementsSelectable",v,we.setState),Ue("elevateNodesOnSelect",p,we.setState),Ue("snapToGrid",C,we.setState),Ue("snapGrid",w,we.setState),Ue("onNodesChange",y,we.setState),Ue("onEdgesChange",m,we.setState),Ue("connectOnClick",P,we.setState),Ue("fitViewOnInit",I,we.setState),Ue("fitViewOnInitOptions",N,we.setState),Ue("onNodesDelete",M,we.setState),Ue("onEdgesDelete",T,we.setState),Ue("onNodeDrag",A,we.setState),Ue("onNodeDragStart",R,we.setState),Ue("onNodeDragStop",D,we.setState),Ue("onSelectionDrag",$,we.setState),Ue("onSelectionDragStart",L,we.setState),Ue("onSelectionDragStop",O,we.setState),Ue("noPanClassName",B,we.setState),Ue("nodeOrigin",U,we.setState),Ue("rfId",j,we.setState),Ue("autoPanOnConnect",q,we.setState),Ue("autoPanOnNodeDrag",Y,we.setState),Ue("onError",Z,we.setState),Ue("connectionRadius",V,we.setState),Ue("isValidConnection",K,we.setState),Ue("nodeDragThreshold",ee,we.setState),Oc(e,re),Oc(t,fe),Oc(g,Me),Oc(_,De),Oc(x,Ee),Oc(b,tt),null},XI={display:"none"},t0e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},nz="react-flow__node-desc",rz="react-flow__edge-desc",n0e="react-flow__aria-live",r0e=e=>e.ariaLiveMessage;function i0e({rfId:e}){const t=fn(r0e);return J.createElement("div",{id:`${n0e}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:t0e},t)}function o0e({rfId:e,disableKeyboardA11y:t}){return J.createElement(J.Fragment,null,J.createElement("div",{id:`${nz}-${e}`,style:XI},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),J.createElement("div",{id:`${rz}-${e}`,style:XI},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&J.createElement(i0e,{rfId:e}))}var kg=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=k.useState(!1),i=k.useRef(!1),o=k.useRef(new Set([])),[a,s]=k.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return k.useEffect(()=>{const l=typeof document<"u"?document:null,u=(t==null?void 0:t.target)||l;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&V5(h))return!1;const g=YI(h.code,s);o.current.add(h[g]),QI(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&V5(h))return!1;const g=YI(h.code,s);QI(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[g]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",c),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{u==null||u.removeEventListener("keydown",c),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function QI(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function YI(e,t){return t.includes(e)?"code":"key"}function iz(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=Fd(i,r);return iz(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Rn])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Rn])==null?void 0:s.z)??0:n.z??0},r)}function oz(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=iz(r,e,{...r.position,z:((i=r[Rn])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Rn].z=s,n!=null&&n[r.id]&&(r[Rn].isParent=!0)}})}function ew(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(Ki(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Rn,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Rn])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),oz(i,n,o),i}function az(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var y;const b=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(y=t.nodes)!=null&&y.length?b&&t.nodes.some(m=>m.id===_.id):b}),g=p.every(_=>_.width&&_.height);if(p.length>0&&g){const _=hT(p,d),[b,y,m]=HB(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),v=vl.translate(b,y).scale(m);return typeof t.duration=="number"&&t.duration>0?s.transform(mu(l,t.duration),v):s.transform(l,v),!0}}return!1}function a0e(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Rn]:r[Rn],selected:n.selected})}),new Map(t)}function s0e(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function G0({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:a0e(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:s0e(t,o)}),s==null||s(t))}const $c=()=>{},l0e={zoomIn:$c,zoomOut:$c,zoomTo:$c,getZoom:()=>1,setViewport:$c,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:$c,fitBounds:$c,project:e=>e,viewportInitialized:!1},u0e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),c0e=()=>{const e=Kn(),{d3Zoom:t,d3Selection:n}=fn(u0e,ii);return k.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(mu(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(mu(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(mu(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=vl.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(mu(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>az(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=vl.translate(d,f).scale(c);t.transform(mu(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=HB(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=vl.translate(c,d).scale(f);t.transform(mu(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return UB(i,o,a,s)},viewportInitialized:!0}:l0e,[t,n])};function sz(){const e=c0e(),t=Kn(),n=k.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),r=k.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=k.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(_=>({..._}))},[]),o=k.useCallback(g=>{const{edges:_=[]}=t.getState();return _.find(b=>b.id===g)},[]),a=k.useCallback(g=>{const{getNodes:_,setNodes:b,hasDefaultNodes:y,onNodesChange:m}=t.getState(),v=_(),S=typeof g=="function"?g(v):g;if(y)b(S);else if(m){const w=S.length===0?v.map(C=>({type:"remove",id:C.id})):S.map(C=>({item:C,type:"reset"}));m(w)}},[]),s=k.useCallback(g=>{const{edges:_=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:m}=t.getState(),v=typeof g=="function"?g(_):g;if(y)b(v);else if(m){const S=v.length===0?_.map(w=>({type:"remove",id:w.id})):v.map(w=>({item:w,type:"reset"}));m(S)}},[]),l=k.useCallback(g=>{const _=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:m,onNodesChange:v}=t.getState();if(m){const w=[...b(),..._];y(w)}else if(v){const S=_.map(w=>({item:w,type:"add"}));v(S)}},[]),u=k.useCallback(g=>{const _=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:m,onEdgesChange:v}=t.getState();if(m)y([...b,..._]);else if(v){const S=_.map(w=>({item:w,type:"add"}));v(S)}},[]),c=k.useCallback(()=>{const{getNodes:g,edges:_=[],transform:b}=t.getState(),[y,m,v]=b;return{nodes:g().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:y,y:m,zoom:v}}},[]),d=k.useCallback(({nodes:g,edges:_})=>{const{nodeInternals:b,getNodes:y,edges:m,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:C,onNodesChange:x,onEdgesChange:P}=t.getState(),E=(g||[]).map(A=>A.id),I=(_||[]).map(A=>A.id),N=y().reduce((A,R)=>{const D=!E.includes(R.id)&&R.parentNode&&A.find(L=>L.id===R.parentNode);return(typeof R.deletable=="boolean"?R.deletable:!0)&&(E.includes(R.id)||D)&&A.push(R),A},[]),M=m.filter(A=>typeof A.deletable=="boolean"?A.deletable:!0),T=M.filter(A=>I.includes(A.id));if(N||T){const A=pT(N,M),R=[...T,...A],D=R.reduce(($,L)=>($.includes(L.id)||$.push(L.id),$),[]);if((S||v)&&(S&&t.setState({edges:m.filter($=>!D.includes($.id))}),v&&(N.forEach($=>{b.delete($.id)}),t.setState({nodeInternals:new Map(b)}))),D.length>0&&(C==null||C(R),P&&P(D.map($=>({id:$,type:"remove"})))),N.length>0&&(w==null||w(N),x)){const $=N.map(L=>({id:L.id,type:"remove"}));x($)}}},[]),f=k.useCallback(g=>{const _=Pme(g),b=_?null:t.getState().nodeInternals.get(g.id);return[_?g:jI(b),b,_]},[]),h=k.useCallback((g,_=!0,b)=>{const[y,m,v]=f(g);return y?(b||t.getState().getNodes()).filter(S=>{if(!v&&(S.id===m.id||!S.positionAbsolute))return!1;const w=jI(S),C=z5(w,y);return _&&C>0||C>=g.width*g.height}):[]},[]),p=k.useCallback((g,_,b=!0)=>{const[y]=f(g);if(!y)return!1;const m=z5(y,_);return b&&m>0||m>=g.width*g.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}const d0e={actInsideInputWithModifier:!1};var f0e=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Kn(),{deleteElements:r}=sz(),i=kg(e,d0e),o=kg(t);k.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function h0e(e){const t=Kn();k.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=sT(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",ys.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const yT={position:"absolute",width:"100%",height:"100%",top:0,left:0},p0e=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,H0=e=>({x:e.x,y:e.y,zoom:e.k}),Nc=(e,t)=>e.target.closest(`.${t}`),ZI=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),JI=e=>{const t=e.ctrlKey&&F1()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},g0e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),m0e=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=Ru.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:g,zoomActivationKeyCode:_,preventScrolling:b=!0,children:y,noWheelClassName:m,noPanClassName:v})=>{const S=k.useRef(),w=Kn(),C=k.useRef(!1),x=k.useRef(!1),P=k.useRef(null),E=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:N,d3ZoomHandler:M,userSelectionActive:T}=fn(g0e,ii),A=kg(_),R=k.useRef(0),D=k.useRef(!1),$=k.useRef();return h0e(P),k.useEffect(()=>{if(P.current){const L=P.current.getBoundingClientRect(),O=Sme().scaleExtent([p,g]).translateExtent(h),B=So(P.current).call(O),U=vl.translate(f.x,f.y).scale(bf(f.zoom,p,g)),j=[[0,0],[L.width,L.height]],q=O.constrain()(U,j,h);O.transform(B,q),O.wheelDelta(JI),w.setState({d3Zoom:O,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:P.current.closest(".react-flow")})}},[]),k.useEffect(()=>{N&&I&&(a&&!A&&!T?N.on("wheel.zoom",L=>{if(Nc(L,m))return!1;L.preventDefault(),L.stopImmediatePropagation();const O=N.property("__zoom").k||1,B=F1();if(L.ctrlKey&&o&&B){const ee=Yo(L),re=JI(L),fe=O*Math.pow(2,re);I.scaleTo(N,fe,ee,L);return}const U=L.deltaMode===1?20:1;let j=l===Ru.Vertical?0:L.deltaX*U,q=l===Ru.Horizontal?0:L.deltaY*U;!B&&L.shiftKey&&l!==Ru.Vertical&&(j=L.deltaY*U,q=0),I.translateBy(N,-(j/O)*s,-(q/O)*s,{internal:!0});const Y=H0(N.property("__zoom")),{onViewportChangeStart:Z,onViewportChange:V,onViewportChangeEnd:K}=w.getState();clearTimeout($.current),D.current||(D.current=!0,t==null||t(L,Y),Z==null||Z(Y)),D.current&&(e==null||e(L,Y),V==null||V(Y),$.current=setTimeout(()=>{n==null||n(L,Y),K==null||K(Y),D.current=!1},150))},{passive:!1}):typeof M<"u"&&N.on("wheel.zoom",function(L,O){if(!b||Nc(L,m))return null;L.preventDefault(),M.call(this,L,O)},{passive:!1}))},[T,a,l,N,I,M,A,o,b,m,t,e,n]),k.useEffect(()=>{I&&I.on("start",L=>{var U,j;if(!L.sourceEvent||L.sourceEvent.internal)return null;R.current=(U=L.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:O}=w.getState(),B=H0(L.transform);C.current=!0,E.current=B,((j=L.sourceEvent)==null?void 0:j.type)==="mousedown"&&w.setState({paneDragging:!0}),O==null||O(B),t==null||t(L.sourceEvent,B)})},[I,t]),k.useEffect(()=>{I&&(T&&!C.current?I.on("zoom",null):T||I.on("zoom",L=>{var B;const{onViewportChange:O}=w.getState();if(w.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),x.current=!!(r&&ZI(d,R.current??0)),(e||O)&&!((B=L.sourceEvent)!=null&&B.internal)){const U=H0(L.transform);O==null||O(U),e==null||e(L.sourceEvent,U)}}))},[T,I,e,d,r]),k.useEffect(()=>{I&&I.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:O}=w.getState();if(C.current=!1,w.setState({paneDragging:!1}),r&&ZI(d,R.current??0)&&!x.current&&r(L.sourceEvent),x.current=!1,(n||O)&&p0e(E.current,L.transform)){const B=H0(L.transform);E.current=B,clearTimeout(S.current),S.current=setTimeout(()=>{O==null||O(B),n==null||n(L.sourceEvent,B)},a?150:0)}})},[I,a,d,n,r]),k.useEffect(()=>{I&&I.filter(L=>{const O=A||i,B=o&&L.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&L.button===1&&L.type==="mousedown"&&(Nc(L,"react-flow__node")||Nc(L,"react-flow__edge")))return!0;if(!d&&!O&&!a&&!u&&!o||T||!u&&L.type==="dblclick"||Nc(L,m)&&L.type==="wheel"||Nc(L,v)&&(L.type!=="wheel"||a&&L.type==="wheel")||!o&&L.ctrlKey&&L.type==="wheel"||!O&&!a&&!B&&L.type==="wheel"||!d&&(L.type==="mousedown"||L.type==="touchstart")||Array.isArray(d)&&!d.includes(L.button)&&(L.type==="mousedown"||L.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||L.type==="wheel")&&U})},[T,I,i,o,a,u,d,c,A]),J.createElement("div",{className:"react-flow__renderer",ref:P,style:yT},y)},y0e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function v0e(){const{userSelectionActive:e,userSelectionRect:t}=fn(y0e,ii);return e&&t?J.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function e8(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function lz(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&e8(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&e8(r,a);break}case"remove":return r}return r.push(a),r},n)}function yu(e,t){return lz(e,t)}function su(e,t){return lz(e,t)}const Ws=(e,t)=>({id:e,type:"select",selected:t});function ld(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(Ws(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(Ws(r.id,!1))),n},[])}const tw=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},b0e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),uz=k.memo(({isSelecting:e,selectionMode:t=Rl.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=k.useRef(null),h=Kn(),p=k.useRef(0),g=k.useRef(0),_=k.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:m}=fn(b0e,ii),v=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,g.current=0},S=M=>{o==null||o(M),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=M=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){M.preventDefault();return}a==null||a(M)},C=s?M=>s(M):void 0,x=M=>{const{resetSelectedElements:T,domNode:A}=h.getState();if(_.current=A==null?void 0:A.getBoundingClientRect(),!y||!e||M.button!==0||M.target!==f.current||!_.current)return;const{x:R,y:D}=bl(M,_.current);T(),h.setState({userSelectionRect:{width:0,height:0,startX:R,startY:D,x:R,y:D}}),r==null||r(M)},P=M=>{const{userSelectionRect:T,nodeInternals:A,edges:R,transform:D,onNodesChange:$,onEdgesChange:L,nodeOrigin:O,getNodes:B}=h.getState();if(!e||!_.current||!T)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=bl(M,_.current),j=T.startX??0,q=T.startY??0,Y={...T,x:U.xre.id),ee=V.map(re=>re.id);if(p.current!==ee.length){p.current=ee.length;const re=ld(Z,ee);re.length&&($==null||$(re))}if(g.current!==K.length){g.current=K.length;const re=ld(R,K);re.length&&(L==null||L(re))}h.setState({userSelectionRect:Y})},E=M=>{if(M.button!==0)return;const{userSelectionRect:T}=h.getState();!b&&T&&M.target===f.current&&(S==null||S(M)),h.setState({nodesSelectionActive:p.current>0}),v(),i==null||i(M)},I=M=>{b&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(M)),v()},N=y&&(e||b);return J.createElement("div",{className:to(["react-flow__pane",{dragging:m,selection:e}]),onClick:N?void 0:tw(S,f),onContextMenu:tw(w,f),onWheel:tw(C,f),onMouseEnter:N?void 0:l,onMouseDown:N?x:void 0,onMouseMove:N?P:u,onMouseUp:N?E:void 0,onMouseLeave:N?I:c,ref:f,style:yT},d,J.createElement(v0e,null))});uz.displayName="Pane";function cz(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:cz(n,t):!1}function t8(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function _0e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!cz(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height,expandParent:i.expandParent}})}function S0e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function dz(e,t,n,r,i=[0,0],o){const a=S0e(e,e.extent||r);let s=a;if(e.extent==="parent"&&!e.expandParent)if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=Fd(c,i).positionAbsolute;s=c&&Ki(d)&&Ki(f)&&Ki(c.width)&&Ki(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",ys.error005()),s=a;else if(e.extent&&e.parentNode&&e.extent!=="parent"){const c=n.get(e.parentNode),{x:d,y:f}=Fd(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=Fd(c,i).positionAbsolute}const u=s&&s!=="parent"?lT(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function nw({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const n8=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...sT(l)}})};function gh(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function H5({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",ys.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function x0e(){const e=Kn();return k.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function rw(e){return(t,n,r)=>e==null?void 0:e(t,r)}function fz({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=Kn(),[l,u]=k.useState(!1),c=k.useRef([]),d=k.useRef({x:null,y:null}),f=k.useRef(0),h=k.useRef(null),p=k.useRef({x:0,y:0}),g=k.useRef(null),_=k.useRef(!1),b=k.useRef(!1),y=x0e();return k.useEffect(()=>{if(e!=null&&e.current){const m=So(e.current),v=({x:C,y:x})=>{const{nodeInternals:P,onNodeDrag:E,onSelectionDrag:I,updateNodePositions:N,nodeExtent:M,snapGrid:T,snapToGrid:A,nodeOrigin:R,onError:D}=s.getState();d.current={x:C,y:x};let $=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&M){const B=hT(c.current,R);L=Pg(B)}if(c.current=c.current.map(B=>{const U={x:C-B.distance.x,y:x-B.distance.y};A&&(U.x=T[0]*Math.round(U.x/T[0]),U.y=T[1]*Math.round(U.y/T[1]));const j=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];c.current.length>1&&M&&!B.extent&&(j[0][0]=B.positionAbsolute.x-L.x+M[0][0],j[1][0]=B.positionAbsolute.x+(B.width??0)-L.x2+M[1][0],j[0][1]=B.positionAbsolute.y-L.y+M[0][1],j[1][1]=B.positionAbsolute.y+(B.height??0)-L.y2+M[1][1]);const q=dz(B,U,P,j,R,D);return $=$||B.position.x!==q.position.x||B.position.y!==q.position.y,B.position=q.position,B.positionAbsolute=q.positionAbsolute,B}),!$)return;N(c.current,!0,!0),u(!0);const O=i?E:rw(I);if(O&&g.current){const[B,U]=nw({nodeId:i,dragItems:c.current,nodeInternals:P});O(g.current,B,U)}},S=()=>{if(!h.current)return;const[C,x]=MB(p.current,h.current);if(C!==0||x!==0){const{transform:P,panBy:E}=s.getState();d.current.x=(d.current.x??0)-C/P[2],d.current.y=(d.current.y??0)-x/P[2],E({x:C,y:x})&&v(d.current)}f.current=requestAnimationFrame(S)},w=C=>{var R;const{nodeInternals:x,multiSelectionActive:P,nodesDraggable:E,unselectNodesAndEdges:I,onNodeDragStart:N,onSelectionDragStart:M}=s.getState();b.current=!0;const T=i?N:rw(M);(!a||!o)&&!P&&i&&((R=x.get(i))!=null&&R.selected||I()),i&&o&&a&&H5({id:i,store:s,nodeRef:e});const A=y(C);if(d.current=A,c.current=_0e(x,E,A,i),T&&c.current){const[D,$]=nw({nodeId:i,dragItems:c.current,nodeInternals:x});T(C.sourceEvent,D,$)}};if(t)m.on(".drag",null);else{const C=Mpe().on("start",x=>{const{domNode:P,nodeDragThreshold:E}=s.getState();E===0&&w(x);const I=y(x);d.current=I,h.current=(P==null?void 0:P.getBoundingClientRect())||null,p.current=bl(x.sourceEvent,h.current)}).on("drag",x=>{var N,M;const P=y(x),{autoPanOnNodeDrag:E,nodeDragThreshold:I}=s.getState();if(!_.current&&b.current&&E&&(_.current=!0,S()),!b.current){const T=P.xSnapped-(((N=d==null?void 0:d.current)==null?void 0:N.x)??0),A=P.ySnapped-(((M=d==null?void 0:d.current)==null?void 0:M.y)??0);Math.sqrt(T*T+A*A)>I&&w(x)}(d.current.x!==P.xSnapped||d.current.y!==P.ySnapped)&&c.current&&b.current&&(g.current=x.sourceEvent,p.current=bl(x.sourceEvent,h.current),v(P))}).on("end",x=>{if(b.current&&(u(!1),_.current=!1,b.current=!1,cancelAnimationFrame(f.current),c.current)){const{updateNodePositions:P,nodeInternals:E,onNodeDragStop:I,onSelectionDragStop:N}=s.getState(),M=i?I:rw(N);if(P(c.current,!1,!1),M){const[T,A]=nw({nodeId:i,dragItems:c.current,nodeInternals:E});M(x.sourceEvent,T,A)}}}).filter(x=>{const P=x.target;return!x.button&&(!n||!t8(P,`.${n}`,e))&&(!r||t8(P,r,e))});return m.call(C),()=>{m.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,y]),l}function hz(){const e=Kn();return k.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,g=n.x*f*p,_=n.y*h*p,b=d.map(y=>{if(y.positionAbsolute){const m={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+_};s&&(m.x=l[0]*Math.round(m.x/l[0]),m.y=l[1]*Math.round(m.y/l[1]));const{positionAbsolute:v,position:S}=dz(y,m,r,i,void 0,u);y.position=S,y.positionAbsolute=v}return y});o(b,!0,!1)},[])}const Bd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var mh=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:g,style:_,className:b,isDraggable:y,isSelectable:m,isConnectable:v,isFocusable:S,selectNodesOnDrag:w,sourcePosition:C,targetPosition:x,hidden:P,resizeObserver:E,dragHandle:I,zIndex:N,isParent:M,noDragClassName:T,noPanClassName:A,initialized:R,disableKeyboardA11y:D,ariaLabel:$,rfId:L})=>{const O=Kn(),B=k.useRef(null),U=k.useRef(C),j=k.useRef(x),q=k.useRef(r),Y=m||y||c||d||f||h,Z=hz(),V=gh(n,O.getState,d),K=gh(n,O.getState,f),ee=gh(n,O.getState,h),re=gh(n,O.getState,p),fe=gh(n,O.getState,g),Se=Ee=>{const{nodeDragThreshold:tt}=O.getState();if(m&&(!w||!y||tt>0)&&H5({id:n,store:O,nodeRef:B}),c){const ot=O.getState().nodeInternals.get(n);ot&&c(Ee,{...ot})}},Me=Ee=>{if(!V5(Ee))if(NB.includes(Ee.key)&&m){const tt=Ee.key==="Escape";H5({id:n,store:O,unselect:tt,nodeRef:B})}else!D&&y&&u&&Object.prototype.hasOwnProperty.call(Bd,Ee.key)&&(O.setState({ariaLiveMessage:`Moved selected node ${Ee.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),Z({x:Bd[Ee.key].x,y:Bd[Ee.key].y,isShiftPressed:Ee.shiftKey}))};k.useEffect(()=>{if(B.current&&!P){const Ee=B.current;return E==null||E.observe(Ee),()=>E==null?void 0:E.unobserve(Ee)}},[P]),k.useEffect(()=>{const Ee=q.current!==r,tt=U.current!==C,ot=j.current!==x;B.current&&(Ee||tt||ot)&&(Ee&&(q.current=r),tt&&(U.current=C),ot&&(j.current=x),O.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,C,x]);const De=fz({nodeRef:B,disabled:P||!y,noDragClassName:T,handleSelector:I,nodeId:n,isSelectable:m,selectNodesOnDrag:w});return P?null:J.createElement("div",{className:to(["react-flow__node",`react-flow__node-${r}`,{[A]:y},b,{selected:u,selectable:m,parent:M,dragging:De}]),ref:B,style:{zIndex:N,transform:`translate(${s}px,${l}px)`,pointerEvents:Y?"all":"none",visibility:R?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:V,onMouseMove:K,onMouseLeave:ee,onContextMenu:re,onClick:Se,onDoubleClick:fe,onKeyDown:S?Me:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":D?void 0:`${nz}-${L}`,"aria-label":$},J.createElement(Nme,{value:n},J.createElement(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:v,sourcePosition:C,targetPosition:x,dragging:De,dragHandle:I,zIndex:N})))};return t.displayName="NodeWrapper",k.memo(t)};const w0e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...hT(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function C0e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Kn(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=fn(w0e,ii),c=hz(),d=k.useRef(null);if(k.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),fz({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const g=r.getState().getNodes().filter(_=>_.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Bd,p.key)&&c({x:Bd[p.key].x,y:Bd[p.key].y,isShiftPressed:p.shiftKey})};return J.createElement("div",{className:to(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l}},J.createElement("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}}))}var E0e=k.memo(C0e);const T0e=e=>e.nodesSelectionActive,pz=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:_,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:m,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:C,panOnScrollMode:x,zoomOnDoubleClick:P,panOnDrag:E,defaultViewport:I,translateExtent:N,minZoom:M,maxZoom:T,preventScrolling:A,onSelectionContextMenu:R,noWheelClassName:D,noPanClassName:$,disableKeyboardA11y:L})=>{const O=fn(T0e),B=kg(d),j=kg(b)||E,q=B||f&&j!==!0;return f0e({deleteKeyCode:s,multiSelectionKeyCode:_}),J.createElement(m0e,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:m,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:C,panOnScrollMode:x,zoomOnDoubleClick:P,panOnDrag:!B&&j,defaultViewport:I,translateExtent:N,minZoom:M,maxZoom:T,zoomActivationKeyCode:y,preventScrolling:A,noWheelClassName:D,noPanClassName:$},J.createElement(uz,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:j,isSelecting:!!q,selectionMode:h},e,O&&J.createElement(E0e,{onSelectionContextMenu:R,noPanClassName:$,disableKeyboardA11y:L})))};pz.displayName="FlowRenderer";var A0e=k.memo(pz);function P0e(e){return fn(k.useCallback(n=>e?GB(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function k0e(e){const t={input:mh(e.input||ZB),default:mh(e.default||G5),output:mh(e.output||ez),group:mh(e.group||mT)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=mh(e[o]||G5),i),n);return{...t,...r}}const I0e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},M0e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),gz=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=fn(M0e,ii),s=P0e(e.onlyRenderVisibleElements),l=k.useRef(),u=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return k.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),J.createElement("div",{className:"react-flow__nodes",style:yT},s.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",ys.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),b=e.nodeExtent?lT(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=(b==null?void 0:b.x)??0,m=(b==null?void 0:b.y)??0,v=I0e({x:y,y:m,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return J.createElement(f,{key:c.id,id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||Pe.Bottom,targetPosition:c.targetPosition||Pe.Top,hidden:c.hidden,xPos:y,yPos:m,xPosOrigin:v.x,yPosOrigin:v.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:g,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Rn])==null?void 0:S.z)??0,isParent:!!((w=c[Rn])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel})}))};gz.displayName="NodeRenderer";var R0e=k.memo(gz);const O0e=(e,t,n)=>n===Pe.Left?e-t:n===Pe.Right?e+t:e,$0e=(e,t,n)=>n===Pe.Top?e-t:n===Pe.Bottom?e+t:e,r8="react-flow__edgeupdater",i8=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>J.createElement("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:to([r8,`${r8}-${s}`]),cx:O0e(t,r,e),cy:$0e(n,r,e),r,stroke:"transparent",fill:"transparent"}),N0e=()=>!0;var Dc=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:_,source:b,target:y,sourceX:m,sourceY:v,targetX:S,targetY:w,sourcePosition:C,targetPosition:x,elementsSelectable:P,hidden:E,sourceHandleId:I,targetHandleId:N,onContextMenu:M,onMouseEnter:T,onMouseMove:A,onMouseLeave:R,edgeUpdaterRadius:D,onEdgeUpdate:$,onEdgeUpdateStart:L,onEdgeUpdateEnd:O,markerEnd:B,markerStart:U,rfId:j,ariaLabel:q,isFocusable:Y,isUpdatable:Z,pathOptions:V,interactionWidth:K})=>{const ee=k.useRef(null),[re,fe]=k.useState(!1),[Se,Me]=k.useState(!1),De=Kn(),Ee=k.useMemo(()=>`url(#${U5(U,j)})`,[U,j]),tt=k.useMemo(()=>`url(#${U5(B,j)})`,[B,j]);if(E)return null;const ot=rn=>{var _n;const{edges:$t,addSelectedEdges:li,unselectNodesAndEdges:Ri,multiSelectionActive:fo}=De.getState(),jr=$t.find(ui=>ui.id===n);jr&&(P&&(De.setState({nodesSelectionActive:!1}),jr.selected&&fo?(Ri({nodes:[],edges:[jr]}),(_n=ee.current)==null||_n.blur()):li([n])),a&&a(rn,jr))},we=ph(n,De.getState,s),Xn=ph(n,De.getState,M),Vt=ph(n,De.getState,T),Ot=ph(n,De.getState,A),xt=ph(n,De.getState,R),bn=(rn,$t)=>{if(rn.button!==0)return;const{edges:li,isValidConnection:Ri}=De.getState(),fo=$t?y:b,jr=($t?N:I)||null,_n=$t?"target":"source",ui=Ri||N0e,tu=$t,jo=li.find(wt=>wt.id===n);Me(!0),L==null||L(rn,jo,_n);const nu=wt=>{Me(!1),O==null||O(wt,jo,_n)};KB({event:rn,handleId:jr,nodeId:fo,onConnect:wt=>$==null?void 0:$(jo,wt),isTarget:tu,getState:De.getState,setState:De.setState,isValidConnection:ui,edgeUpdaterType:_n,onEdgeUpdateEnd:nu})},Vr=rn=>bn(rn,!0),co=rn=>bn(rn,!1),Mi=()=>fe(!0),ur=()=>fe(!1),Qn=!P&&!a,xr=rn=>{var $t;if(NB.includes(rn.key)&&P){const{unselectNodesAndEdges:li,addSelectedEdges:Ri,edges:fo}=De.getState();rn.key==="Escape"?(($t=ee.current)==null||$t.blur(),li({edges:[fo.find(_n=>_n.id===n)]})):Ri([n])}};return J.createElement("g",{className:to(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Qn,updating:re}]),onClick:ot,onDoubleClick:we,onContextMenu:Xn,onMouseEnter:Vt,onMouseMove:Ot,onMouseLeave:xt,onKeyDown:Y?xr:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":q===null?void 0:q||`Edge from ${b} to ${y}`,"aria-describedby":Y?`${rz}-${j}`:void 0,ref:ee},!Se&&J.createElement(e,{id:n,source:b,target:y,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,data:o,style:_,sourceX:m,sourceY:v,targetX:S,targetY:w,sourcePosition:C,targetPosition:x,sourceHandleId:I,targetHandleId:N,markerStart:Ee,markerEnd:tt,pathOptions:V,interactionWidth:K}),Z&&J.createElement(J.Fragment,null,(Z==="source"||Z===!0)&&J.createElement(i8,{position:C,centerX:m,centerY:v,radius:D,onMouseDown:Vr,onMouseEnter:Mi,onMouseOut:ur,type:"source"}),(Z==="target"||Z===!0)&&J.createElement(i8,{position:x,centerX:S,centerY:w,radius:D,onMouseDown:co,onMouseEnter:Mi,onMouseOut:ur,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function D0e(e){const t={default:Dc(e.default||z1),straight:Dc(e.bezier||dT),step:Dc(e.step||cT),smoothstep:Dc(e.step||oS),simplebezier:Dc(e.simplebezier||uT)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=Dc(e[o]||z1),i),n);return{...t,...r}}function o8(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case Pe.Top:return{x:r+o/2,y:i};case Pe.Right:return{x:r+o,y:i+a/2};case Pe.Bottom:return{x:r+o/2,y:i+a};case Pe.Left:return{x:r,y:i+a/2}}}function a8(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const L0e=(e,t,n,r,i,o)=>{const a=o8(n,e,t),s=o8(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function F0e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Pg({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function s8(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Rn])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const B0e=[{level:0,isMaxLevel:!0,edges:[]}];function z0e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=Ki(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),g=Math.max(((c=h==null?void 0:h[Rn])==null?void 0:c.z)||0,((d=f==null?void 0:f[Rn])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?g:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?B0e:o}function V0e(e,t,n){const r=fn(k.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&F0e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return z0e(r,t,n)}const j0e=({color:e="none",strokeWidth:t=1})=>J.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),U0e=({color:e="none",strokeWidth:t=1})=>J.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),l8={[B1.Arrow]:j0e,[B1.ArrowClosed]:U0e};function G0e(e){const t=Kn();return k.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(l8,e)?l8[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ys.error009(e)),null)},[e])}const H0e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=G0e(t);return l?J.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0"},J.createElement(l,{color:n,strokeWidth:a})):null},q0e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=U5(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},mz=({defaultColor:e,rfId:t})=>{const n=fn(k.useCallback(q0e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return J.createElement("defs",null,n.map(r=>J.createElement(H0e,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};mz.displayName="MarkerDefinitions";var W0e=k.memo(mz);const K0e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),yz=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:g,children:_})=>{const{edgesFocusable:b,edgesUpdatable:y,elementsSelectable:m,width:v,height:S,connectionMode:w,nodeInternals:C,onError:x}=fn(K0e,ii),P=V0e(t,C,n);return v?J.createElement(J.Fragment,null,P.map(({level:E,edges:I,isMaxLevel:N})=>J.createElement("svg",{key:E,style:{zIndex:E},width:v,height:S,className:"react-flow__edges react-flow__container"},N&&J.createElement(W0e,{defaultColor:e,rfId:r}),J.createElement("g",null,I.map(M=>{const[T,A,R]=s8(C.get(M.source)),[D,$,L]=s8(C.get(M.target));if(!R||!L)return null;let O=M.type||"default";i[O]||(x==null||x("011",ys.error011(O)),O="default");const B=i[O]||i.default,U=w===sc.Strict?$.target:($.target??[]).concat($.source??[]),j=a8(A.source,M.sourceHandle),q=a8(U,M.targetHandle),Y=(j==null?void 0:j.position)||Pe.Bottom,Z=(q==null?void 0:q.position)||Pe.Top,V=!!(M.focusable||b&&typeof M.focusable>"u"),K=typeof a<"u"&&(M.updatable||y&&typeof M.updatable>"u");if(!j||!q)return x==null||x("008",ys.error008(j,M)),null;const{sourceX:ee,sourceY:re,targetX:fe,targetY:Se}=L0e(T,j,Y,D,q,Z);return J.createElement(B,{key:M.id,id:M.id,className:to([M.className,o]),type:O,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:ee,sourceY:re,targetX:fe,targetY:Se,sourcePosition:Y,targetPosition:Z,elementsSelectable:m,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:g,rfId:r,ariaLabel:M.ariaLabel,isFocusable:V,isUpdatable:K,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth})})))),_):null};yz.displayName="EdgeRenderer";var X0e=k.memo(yz);const Q0e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Y0e({children:e}){const t=fn(Q0e);return J.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function Z0e(e){const t=sz(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const J0e={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top},vz=({nodeId:e,handleType:t,style:n,type:r=Js.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,C,x;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=fn(k.useCallback(P=>({fromNode:P.nodeInternals.get(e),handleId:P.connectionHandleId,toX:(P.connectionPosition.x-P.transform[0])/P.transform[2],toY:(P.connectionPosition.y-P.transform[1])/P.transform[2],connectionMode:P.connectionMode}),[e]),ii),d=(w=a==null?void 0:a[Rn])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===sc.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(P=>P.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,g=h?h.y+h.height/2:a.height??0,_=(((C=a.positionAbsolute)==null?void 0:C.x)??0)+p,b=(((x=a.positionAbsolute)==null?void 0:x.y)??0)+g,y=h==null?void 0:h.position,m=y?J0e[y]:null;if(!y||!m)return null;if(i)return J.createElement(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:b,toX:l,toY:u,fromPosition:y,toPosition:m,connectionStatus:o});let v="";const S={sourceX:_,sourceY:b,sourcePosition:y,targetX:l,targetY:u,targetPosition:m};return r===Js.Bezier?[v]=zB(S):r===Js.Step?[v]=j5({...S,borderRadius:0}):r===Js.SmoothStep?[v]=j5(S):r===Js.SimpleBezier?[v]=BB(S):v=`M${_},${b} ${l},${u}`,J.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};vz.displayName="ConnectionLine";const eye=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function tye({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=fn(eye,ii);return!(i&&o&&s&&a)?null:J.createElement("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},J.createElement("g",{className:to(["react-flow__connection",u])},J.createElement(vz,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})))}function u8(e,t){return k.useRef(null),Kn(),k.useMemo(()=>t(e),[e])}const bz=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:g,onSelectionEnd:_,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:m,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:w,selectionMode:C,multiSelectionKeyCode:x,panActivationKeyCode:P,zoomActivationKeyCode:E,deleteKeyCode:I,onlyRenderVisibleElements:N,elementsSelectable:M,selectNodesOnDrag:T,defaultViewport:A,translateExtent:R,minZoom:D,maxZoom:$,preventScrolling:L,defaultMarkerColor:O,zoomOnScroll:B,zoomOnPinch:U,panOnScroll:j,panOnScrollSpeed:q,panOnScrollMode:Y,zoomOnDoubleClick:Z,panOnDrag:V,onPaneClick:K,onPaneMouseEnter:ee,onPaneMouseMove:re,onPaneMouseLeave:fe,onPaneScroll:Se,onPaneContextMenu:Me,onEdgeUpdate:De,onEdgeContextMenu:Ee,onEdgeMouseEnter:tt,onEdgeMouseMove:ot,onEdgeMouseLeave:we,edgeUpdaterRadius:Xn,onEdgeUpdateStart:Vt,onEdgeUpdateEnd:Ot,noDragClassName:xt,noWheelClassName:bn,noPanClassName:Vr,elevateEdgesOnSelect:co,disableKeyboardA11y:Mi,nodeOrigin:ur,nodeExtent:Qn,rfId:xr})=>{const rn=u8(e,k0e),$t=u8(t,D0e);return Z0e(o),J.createElement(A0e,{onPaneClick:K,onPaneMouseEnter:ee,onPaneMouseMove:re,onPaneMouseLeave:fe,onPaneContextMenu:Me,onPaneScroll:Se,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:w,selectionMode:C,onSelectionStart:g,onSelectionEnd:_,multiSelectionKeyCode:x,panActivationKeyCode:P,zoomActivationKeyCode:E,elementsSelectable:M,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:B,zoomOnPinch:U,zoomOnDoubleClick:Z,panOnScroll:j,panOnScrollSpeed:q,panOnScrollMode:Y,panOnDrag:V,defaultViewport:A,translateExtent:R,minZoom:D,maxZoom:$,onSelectionContextMenu:p,preventScrolling:L,noDragClassName:xt,noWheelClassName:bn,noPanClassName:Vr,disableKeyboardA11y:Mi},J.createElement(Y0e,null,J.createElement(X0e,{edgeTypes:$t,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:De,onlyRenderVisibleElements:N,onEdgeContextMenu:Ee,onEdgeMouseEnter:tt,onEdgeMouseMove:ot,onEdgeMouseLeave:we,onEdgeUpdateStart:Vt,onEdgeUpdateEnd:Ot,edgeUpdaterRadius:Xn,defaultMarkerColor:O,noPanClassName:Vr,elevateEdgesOnSelect:!!co,disableKeyboardA11y:Mi,rfId:xr},J.createElement(tye,{style:y,type:b,component:m,containerStyle:v})),J.createElement("div",{className:"react-flow__edgelabel-renderer"}),J.createElement(R0e,{nodeTypes:rn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:T,onlyRenderVisibleElements:N,noPanClassName:Vr,noDragClassName:xt,disableKeyboardA11y:Mi,nodeOrigin:ur,nodeExtent:Qn,rfId:xr})))};bz.displayName="GraphView";var nye=k.memo(bz);const q5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ns={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:q5,nodeExtent:q5,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:sc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:kme,isValidConnection:void 0},rye=()=>Ufe((e,t)=>({...Ns,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:ew(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?ew(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((g,_)=>{const b=i.get(_.id);if(b){const y=sT(_.nodeElement);!!(y.width&&y.height&&(b.width!==y.width||b.height!==y.height||_.forceUpdate))&&(i.set(b.id,{...b,[Rn]:{...b[Rn],handleBounds:{source:n8(".source",_.nodeElement,f,u),target:n8(".target",_.nodeElement,f,u)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);oz(i,u);const p=a||o&&!a&&az(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=yu(n,s()),c=ew(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Ws(l,!0)):(a=ld(o(),n),s=ld(i,[])),G0({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Ws(l,!0)):(a=ld(i,n),s=ld(o(),[])),G0({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,Ws(c.id,!1))),u=s.map(c=>Ws(c.id,!1));G0({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>Ws(s.id,!1)),a=n.filter(s=>s.selected).map(s=>Ws(s.id,!1));G0({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=lT(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=vl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Ns.connectionNodeId,connectionHandleId:Ns.connectionHandleId,connectionHandleType:Ns.connectionHandleType,connectionStatus:Ns.connectionStatus,connectionStartHandle:Ns.connectionStartHandle,connectionEndHandle:Ns.connectionEndHandle}),reset:()=>e({...Ns})}),Object.is),_z=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=rye()),J.createElement(xme,{value:t.current},e)};_z.displayName="ReactFlowProvider";const Sz=({children:e})=>k.useContext(iS)?J.createElement(J.Fragment,null,e):J.createElement(_z,null,e);Sz.displayName="ReactFlowWrapper";const iye={input:ZB,default:G5,output:ez,group:mT},oye={default:z1,straight:dT,step:cT,smoothstep:oS,simplebezier:uT},aye=[0,0],sye=[15,15],lye={x:0,y:0,zoom:1},uye={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},cye=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=iye,edgeTypes:a=oye,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:C,onNodeDrag:x,onNodeDragStop:P,onNodesDelete:E,onEdgesDelete:I,onSelectionChange:N,onSelectionDragStart:M,onSelectionDrag:T,onSelectionDragStop:A,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:$,connectionMode:L=sc.Strict,connectionLineType:O=Js.Bezier,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:j,deleteKeyCode:q="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:Z=!1,selectionMode:V=Rl.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:ee=F1()?"Meta":"Control",zoomActivationKeyCode:re=F1()?"Meta":"Control",snapToGrid:fe=!1,snapGrid:Se=sye,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:De=!0,nodesDraggable:Ee,nodesConnectable:tt,nodesFocusable:ot,nodeOrigin:we=aye,edgesFocusable:Xn,edgesUpdatable:Vt,elementsSelectable:Ot,defaultViewport:xt=lye,minZoom:bn=.5,maxZoom:Vr=2,translateExtent:co=q5,preventScrolling:Mi=!0,nodeExtent:ur,defaultMarkerColor:Qn="#b1b1b7",zoomOnScroll:xr=!0,zoomOnPinch:rn=!0,panOnScroll:$t=!1,panOnScrollSpeed:li=.5,panOnScrollMode:Ri=Ru.Free,zoomOnDoubleClick:fo=!0,panOnDrag:jr=!0,onPaneClick:_n,onPaneMouseEnter:ui,onPaneMouseMove:tu,onPaneMouseLeave:jo,onPaneScroll:nu,onPaneContextMenu:Xt,children:wt,onEdgeUpdate:Yn,onEdgeContextMenu:Nn,onEdgeDoubleClick:cr,onEdgeMouseEnter:wr,onEdgeMouseMove:Ur,onEdgeMouseLeave:Uo,onEdgeUpdateStart:Cr,onEdgeUpdateEnd:Zn,edgeUpdaterRadius:Ra=10,onNodesChange:Is,onEdgesChange:Ms,noDragClassName:Cc="nodrag",noWheelClassName:Oa="nowheel",noPanClassName:Er="nopan",fitView:ru=!1,fitViewOptions:M2,connectOnClick:R2=!0,attributionPosition:O2,proOptions:$2,defaultEdgeOptions:Rs,elevateNodesOnSelect:N2=!0,elevateEdgesOnSelect:D2=!1,disableKeyboardA11y:Ym=!1,autoPanOnConnect:L2=!0,autoPanOnNodeDrag:F2=!0,connectionRadius:B2=20,isValidConnection:Qf,onError:z2,style:Ec,id:Tc,nodeDragThreshold:V2,...Ac},Zm)=>{const Yf=Tc||"1";return J.createElement("div",{...Ac,style:{...Ec,...uye},ref:Zm,className:to(["react-flow",i]),"data-testid":"rf__wrapper",id:Tc},J.createElement(Sz,null,J.createElement(nye,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:a,connectionLineType:O,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:j,selectionKeyCode:Y,selectionOnDrag:Z,selectionMode:V,deleteKeyCode:q,multiSelectionKeyCode:ee,panActivationKeyCode:K,zoomActivationKeyCode:re,onlyRenderVisibleElements:Me,selectNodesOnDrag:De,defaultViewport:xt,translateExtent:co,minZoom:bn,maxZoom:Vr,preventScrolling:Mi,zoomOnScroll:xr,zoomOnPinch:rn,zoomOnDoubleClick:fo,panOnScroll:$t,panOnScrollSpeed:li,panOnScrollMode:Ri,panOnDrag:jr,onPaneClick:_n,onPaneMouseEnter:ui,onPaneMouseMove:tu,onPaneMouseLeave:jo,onPaneScroll:nu,onPaneContextMenu:Xt,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:$,onEdgeUpdate:Yn,onEdgeContextMenu:Nn,onEdgeDoubleClick:cr,onEdgeMouseEnter:wr,onEdgeMouseMove:Ur,onEdgeMouseLeave:Uo,onEdgeUpdateStart:Cr,onEdgeUpdateEnd:Zn,edgeUpdaterRadius:Ra,defaultMarkerColor:Qn,noDragClassName:Cc,noWheelClassName:Oa,noPanClassName:Er,elevateEdgesOnSelect:D2,rfId:Yf,disableKeyboardA11y:Ym,nodeOrigin:we,nodeExtent:ur}),J.createElement(e0e,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:Ee,nodesConnectable:tt,nodesFocusable:ot,edgesFocusable:Xn,edgesUpdatable:Vt,elementsSelectable:Ot,elevateNodesOnSelect:N2,minZoom:bn,maxZoom:Vr,nodeExtent:ur,onNodesChange:Is,onEdgesChange:Ms,snapToGrid:fe,snapGrid:Se,connectionMode:L,translateExtent:co,connectOnClick:R2,defaultEdgeOptions:Rs,fitView:ru,fitViewOptions:M2,onNodesDelete:E,onEdgesDelete:I,onNodeDragStart:C,onNodeDrag:x,onNodeDragStop:P,onSelectionDrag:T,onSelectionDragStart:M,onSelectionDragStop:A,noPanClassName:Er,nodeOrigin:we,rfId:Yf,autoPanOnConnect:L2,autoPanOnNodeDrag:F2,onError:z2,connectionRadius:B2,isValidConnection:Qf,nodeDragThreshold:V2}),J.createElement(Zme,{onSelectionChange:N}),wt,J.createElement(Eme,{proOptions:$2,position:O2}),J.createElement(o0e,{rfId:Yf,disableKeyboardA11y:Ym})))});cye.displayName="ReactFlow";const dye=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function fVe({children:e}){const t=fn(dye);return t?mi.createPortal(e,t):null}function hVe(){const e=Kn();return k.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function fye(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const Ig=Xv("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,fye()))}catch(n){return t({error:n})}}),pVe=500,gVe=320,xz="node-drag-handle",mVe=["ImageField","ImageCollection"],yVe={input:"inputs",output:"outputs"},q0=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection","T2IAdapterCollection","IPAdapterCollection","MetadataItemCollection","MetadataCollection"],Gh=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic","T2IAdapterPolymorphic","IPAdapterPolymorphic","MetadataItemPolymorphic"],vVe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField","T2IAdapterModelField","IPAdapterModelField"],vT={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection",T2IAdapterField:"T2IAdapterCollection",IPAdapterField:"IPAdapterCollection",MetadataItemField:"MetadataItemCollection",MetadataField:"MetadataCollection"},hye=e=>!!(e&&e in vT),wz={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic",T2IAdapterField:"T2IAdapterPolymorphic",IPAdapterField:"IPAdapterPolymorphic",MetadataItemField:"MetadataItemPolymorphic"},pye={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField",T2IAdapterPolymorphic:"T2IAdapterField",IPAdapterPolymorphic:"IPAdapterField",MetadataItemPolymorphic:"MetadataItemField"},bVe=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField","T2IAdapterModelField"],gye=e=>!!(e&&e in wz),_Ve={Any:{color:"gray.500",description:"Any field type is accepted.",title:"Any"},MetadataField:{color:"gray.500",description:"A metadata dict.",title:"Metadata Dict"},MetadataCollection:{color:"gray.500",description:"A collection of metadata dicts.",title:"Metadata Dict Collection"},MetadataItemField:{color:"gray.500",description:"A metadata item.",title:"Metadata Item"},MetadataItemCollection:{color:"gray.500",description:"Any field type is accepted.",title:"Metadata Item Collection"},MetadataItemPolymorphic:{color:"gray.500",description:"MetadataItem or MetadataItemCollection field types are accepted.",title:"Metadata Item Polymorphic"},boolean:{color:"green.500",description:X("nodes.booleanDescription"),title:X("nodes.boolean")},BooleanCollection:{color:"green.500",description:X("nodes.booleanCollectionDescription"),title:X("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:X("nodes.booleanPolymorphicDescription"),title:X("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:X("nodes.clipFieldDescription"),title:X("nodes.clipField")},Collection:{color:"base.500",description:X("nodes.collectionDescription"),title:X("nodes.collection")},CollectionItem:{color:"base.500",description:X("nodes.collectionItemDescription"),title:X("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:X("nodes.colorCollectionDescription"),title:X("nodes.colorCollection")},ColorField:{color:"pink.300",description:X("nodes.colorFieldDescription"),title:X("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:X("nodes.colorPolymorphicDescription"),title:X("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:X("nodes.conditioningCollectionDescription"),title:X("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:X("nodes.conditioningFieldDescription"),title:X("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:X("nodes.conditioningPolymorphicDescription"),title:X("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:X("nodes.controlCollectionDescription"),title:X("nodes.controlCollection")},ControlField:{color:"teal.500",description:X("nodes.controlFieldDescription"),title:X("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:X("nodes.denoiseMaskFieldDescription"),title:X("nodes.denoiseMaskField")},enum:{color:"blue.500",description:X("nodes.enumDescription"),title:X("nodes.enum")},float:{color:"orange.500",description:X("nodes.floatDescription"),title:X("nodes.float")},FloatCollection:{color:"orange.500",description:X("nodes.floatCollectionDescription"),title:X("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:X("nodes.floatPolymorphicDescription"),title:X("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:X("nodes.imageCollectionDescription"),title:X("nodes.imageCollection")},ImageField:{color:"purple.500",description:X("nodes.imageFieldDescription"),title:X("nodes.imageField")},BoardField:{color:"purple.500",description:X("nodes.imageFieldDescription"),title:X("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:X("nodes.imagePolymorphicDescription"),title:X("nodes.imagePolymorphic")},integer:{color:"red.500",description:X("nodes.integerDescription"),title:X("nodes.integer")},IntegerCollection:{color:"red.500",description:X("nodes.integerCollectionDescription"),title:X("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:X("nodes.integerPolymorphicDescription"),title:X("nodes.integerPolymorphic")},IPAdapterCollection:{color:"teal.500",description:X("nodes.ipAdapterCollectionDescription"),title:X("nodes.ipAdapterCollection")},IPAdapterField:{color:"teal.500",description:X("nodes.ipAdapterDescription"),title:X("nodes.ipAdapter")},IPAdapterModelField:{color:"teal.500",description:X("nodes.ipAdapterModelDescription"),title:X("nodes.ipAdapterModel")},IPAdapterPolymorphic:{color:"teal.500",description:X("nodes.ipAdapterPolymorphicDescription"),title:X("nodes.ipAdapterPolymorphic")},LatentsCollection:{color:"pink.500",description:X("nodes.latentsCollectionDescription"),title:X("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:X("nodes.latentsFieldDescription"),title:X("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:X("nodes.latentsPolymorphicDescription"),title:X("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:X("nodes.loRAModelFieldDescription"),title:X("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:X("nodes.mainModelFieldDescription"),title:X("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:X("nodes.oNNXModelFieldDescription"),title:X("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:X("nodes.schedulerDescription"),title:X("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:X("nodes.sDXLMainModelFieldDescription"),title:X("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:X("nodes.sDXLRefinerModelFieldDescription"),title:X("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:X("nodes.stringDescription"),title:X("nodes.string")},StringCollection:{color:"yellow.500",description:X("nodes.stringCollectionDescription"),title:X("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:X("nodes.stringPolymorphicDescription"),title:X("nodes.stringPolymorphic")},T2IAdapterCollection:{color:"teal.500",description:X("nodes.t2iAdapterCollectionDescription"),title:X("nodes.t2iAdapterCollection")},T2IAdapterField:{color:"teal.500",description:X("nodes.t2iAdapterFieldDescription"),title:X("nodes.t2iAdapterField")},T2IAdapterModelField:{color:"teal.500",description:"TODO",title:"T2I-Adapter"},T2IAdapterPolymorphic:{color:"teal.500",description:"T2I-Adapter info passed between nodes.",title:"T2I-Adapter Polymorphic"},UNetField:{color:"red.500",description:X("nodes.uNetFieldDescription"),title:X("nodes.uNetField")},VaeField:{color:"blue.500",description:X("nodes.vaeFieldDescription"),title:X("nodes.vaeField")},VaeModelField:{color:"teal.500",description:X("nodes.vaeModelFieldDescription"),title:X("nodes.vaeModelField")}},c8=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},mye=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!q0.includes(t),r=t==="CollectionItem"&&!q0.includes(e)&&!Gh.includes(e),i=Gh.includes(t)&&(()=>{if(!Gh.includes(t))return!1;const c=pye[t],d=vT[c];return e===c||e===d})(),o=e==="Collection"&&(q0.includes(t)||Gh.includes(t)),a=t==="Collection"&&q0.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"||t==="Any"};var yye="\0",lu="\0",d8="",Hr,Du,hi,Jg,Kd,Xd,ji,Jo,nl,ea,rl,Ga,Ha,Qd,Yd,qa,yo,em,W5,hO;let vye=(hO=class{constructor(t){Gt(this,em);Gt(this,Hr,!0);Gt(this,Du,!1);Gt(this,hi,!1);Gt(this,Jg,void 0);Gt(this,Kd,()=>{});Gt(this,Xd,()=>{});Gt(this,ji,{});Gt(this,Jo,{});Gt(this,nl,{});Gt(this,ea,{});Gt(this,rl,{});Gt(this,Ga,{});Gt(this,Ha,{});Gt(this,Qd,0);Gt(this,Yd,0);Gt(this,qa,void 0);Gt(this,yo,void 0);t&&($i(this,Hr,t.hasOwnProperty("directed")?t.directed:!0),$i(this,Du,t.hasOwnProperty("multigraph")?t.multigraph:!1),$i(this,hi,t.hasOwnProperty("compound")?t.compound:!1)),te(this,hi)&&($i(this,qa,{}),$i(this,yo,{}),te(this,yo)[lu]={})}isDirected(){return te(this,Hr)}isMultigraph(){return te(this,Du)}isCompound(){return te(this,hi)}setGraph(t){return $i(this,Jg,t),this}graph(){return te(this,Jg)}setDefaultNodeLabel(t){return $i(this,Kd,t),typeof t!="function"&&$i(this,Kd,()=>t),this}nodeCount(){return te(this,Qd)}nodes(){return Object.keys(te(this,ji))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(te(t,Jo)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(te(t,ea)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return te(this,ji).hasOwnProperty(t)?(arguments.length>1&&(te(this,ji)[t]=n),this):(te(this,ji)[t]=arguments.length>1?n:te(this,Kd).call(this,t),te(this,hi)&&(te(this,qa)[t]=lu,te(this,yo)[t]={},te(this,yo)[lu][t]=!0),te(this,Jo)[t]={},te(this,nl)[t]={},te(this,ea)[t]={},te(this,rl)[t]={},++eh(this,Qd)._,this)}node(t){return te(this,ji)[t]}hasNode(t){return te(this,ji).hasOwnProperty(t)}removeNode(t){var n=this;if(te(this,ji).hasOwnProperty(t)){var r=i=>n.removeEdge(te(n,Ga)[i]);delete te(this,ji)[t],te(this,hi)&&(Go(this,em,W5).call(this,t),delete te(this,qa)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete te(this,yo)[t]),Object.keys(te(this,Jo)[t]).forEach(r),delete te(this,Jo)[t],delete te(this,nl)[t],Object.keys(te(this,ea)[t]).forEach(r),delete te(this,ea)[t],delete te(this,rl)[t],--eh(this,Qd)._}return this}setParent(t,n){if(!te(this,hi))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=lu;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),Go(this,em,W5).call(this,t),te(this,qa)[t]=n,te(this,yo)[n][t]=!0,this}parent(t){if(te(this,hi)){var n=te(this,qa)[t];if(n!==lu)return n}}children(t=lu){if(te(this,hi)){var n=te(this,yo)[t];if(n)return Object.keys(n)}else{if(t===lu)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=te(this,nl)[t];if(n)return Object.keys(n)}successors(t){var n=te(this,rl)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:te(this,Hr),multigraph:te(this,Du),compound:te(this,hi)});n.setGraph(this.graph());var r=this;Object.entries(te(this,ji)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(te(this,Ga)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return te(this,hi)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return $i(this,Xd,t),typeof t!="function"&&$i(this,Xd,()=>t),this}edgeCount(){return te(this,Yd)}edges(){return Object.values(te(this,Ga))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=Hh(te(this,Hr),t,n,r);if(te(this,Ha).hasOwnProperty(s))return o&&(te(this,Ha)[s]=i),this;if(r!==void 0&&!te(this,Du))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),te(this,Ha)[s]=o?i:te(this,Xd).call(this,t,n,r);var l=bye(te(this,Hr),t,n,r);return t=l.v,n=l.w,Object.freeze(l),te(this,Ga)[s]=l,f8(te(this,nl)[n],t),f8(te(this,rl)[t],n),te(this,Jo)[n][s]=l,te(this,ea)[t][s]=l,eh(this,Yd)._++,this}edge(t,n,r){var i=arguments.length===1?iw(te(this,Hr),arguments[0]):Hh(te(this,Hr),t,n,r);return te(this,Ha)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?iw(te(this,Hr),arguments[0]):Hh(te(this,Hr),t,n,r);return te(this,Ha).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?iw(te(this,Hr),arguments[0]):Hh(te(this,Hr),t,n,r),o=te(this,Ga)[i];return o&&(t=o.v,n=o.w,delete te(this,Ha)[i],delete te(this,Ga)[i],h8(te(this,nl)[n],t),h8(te(this,rl)[t],n),delete te(this,Jo)[n][i],delete te(this,ea)[t][i],eh(this,Yd)._--),this}inEdges(t,n){var r=te(this,Jo)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=te(this,ea)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},Hr=new WeakMap,Du=new WeakMap,hi=new WeakMap,Jg=new WeakMap,Kd=new WeakMap,Xd=new WeakMap,ji=new WeakMap,Jo=new WeakMap,nl=new WeakMap,ea=new WeakMap,rl=new WeakMap,Ga=new WeakMap,Ha=new WeakMap,Qd=new WeakMap,Yd=new WeakMap,qa=new WeakMap,yo=new WeakMap,em=new WeakSet,W5=function(t){delete te(this,yo)[te(this,qa)[t]][t]},hO);function f8(e,t){e[t]?e[t]++:e[t]=1}function h8(e,t){--e[t]||delete e[t]}function Hh(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+d8+o+d8+(r===void 0?yye:r)}function bye(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function iw(e,t){return Hh(e,t.v,t.w,t.name)}var bT=vye,_ye="2.1.13",Sye={Graph:bT,version:_ye},xye=bT,wye={write:Cye,read:Aye};function Cye(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Eye(e),edges:Tye(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function Eye(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Tye(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Aye(e){var t=new xye(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var Pye=kye;function kye(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var pr,Wa,tm,K5,nm,X5,Zd,Qy,pO;let Iye=(pO=class{constructor(){Gt(this,tm);Gt(this,nm);Gt(this,Zd);Gt(this,pr,[]);Gt(this,Wa,{})}size(){return te(this,pr).length}keys(){return te(this,pr).map(function(t){return t.key})}has(t){return te(this,Wa).hasOwnProperty(t)}priority(t){var n=te(this,Wa)[t];if(n!==void 0)return te(this,pr)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return te(this,pr)[0].key}add(t,n){var r=te(this,Wa);if(t=String(t),!r.hasOwnProperty(t)){var i=te(this,pr),o=i.length;return r[t]=o,i.push({key:t,priority:n}),Go(this,nm,X5).call(this,o),!0}return!1}removeMin(){Go(this,Zd,Qy).call(this,0,te(this,pr).length-1);var t=te(this,pr).pop();return delete te(this,Wa)[t.key],Go(this,tm,K5).call(this,0),t.key}decrease(t,n){var r=te(this,Wa)[t];if(n>te(this,pr)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+te(this,pr)[r].priority+" New: "+n);te(this,pr)[r].priority=n,Go(this,nm,X5).call(this,r)}},pr=new WeakMap,Wa=new WeakMap,tm=new WeakSet,K5=function(t){var n=te(this,pr),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function Oye(e,t,n,r){return $ye(e,String(t),n||Rye,r||function(i){return e.outEdges(i)})}function $ye(e,t,n,r){var i={},o=new Mye,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var Nye=Ez,Dye=Lye;function Lye(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=Nye(e,i,t,n),r},{})}var Tz=Fye;function Fye(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var Bye=Tz,zye=Vye;function Vye(e){return Bye(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var jye=Gye,Uye=()=>1;function Gye(e,t,n){return Hye(e,t||Uye,n||function(r){return e.outEdges(r)})}function Hye(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?Xye:Qye,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function Xye(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),Iz(t(o[0]),a=>i.push([a,!1])))}}function Qye(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),Iz(t(o),a=>i.push(a)))}}function Iz(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var Yye=kz,Zye=Jye;function Jye(e,t){return Yye(e,t,"post")}var eve=kz,tve=nve;function nve(e,t){return eve(e,t,"pre")}var rve=bT,ive=Cz,ove=ave;function ave(e,t){var n=new rve,r={},i=new ive,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var sve={components:Pye,dijkstra:Ez,dijkstraAll:Dye,findCycles:zye,floydWarshall:jye,isAcyclic:qye,postorder:Zye,preorder:tve,prim:ove,tarjan:Tz,topsort:Pz},g8=Sye,lve={Graph:g8.Graph,json:wye,alg:sve,version:g8.version};const m8=Bl(lve),y8=(e,t,n,r)=>{const i=new m8.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),m8.alg.isAcyclic(i)},v8=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),mye(n,i.type)||(o=!1),o},b8=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=y8(u,c,t,n),p=v8(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=y8(c,d,t,n),g=v8(n,o,a,e,u);if(p&&g)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},uve="1.0.0",ow={status:wu.PENDING,error:null,progress:null,progressImage:null,outputs:[]},Y5={meta:{version:uve},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},Mz={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:Y5,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:Rl.Partial},Ar=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!on(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},Rz=Wt({name:"nodes",initialState:Mz,reducers:{nodesChanged:(e,t)=>{e.nodes=yu(t.payload,e.nodes)},nodeReplaced:(e,t)=>{const n=e.nodes.findIndex(r=>r.id===t.payload.nodeId);n<0||(e.nodes[n]=t.payload.node)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=c8(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=yu(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=su(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!on(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...ow},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=b8(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=Uh({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=su(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=Uh(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=Vme(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!on(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=Uh({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=b8(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=Uh({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=g5(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!SE(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!on(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!on(o)&&!bI(o)||(o.data.isOpen=r,!on(o)))return;const a=pT([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=Bme(o,e.nodes,e.edges).filter(d=>on(d)&&d.data.isOpen===!1),u=Fme(o,e.nodes,e.edges).filter(d=>on(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(g=>g.source===d.source&&g.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(g=>g.source===d.source&&g.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=su(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=su(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),on(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];on(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=yu(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{Ar(e,t)},fieldNumberValueChanged:(e,t)=>{Ar(e,t)},fieldBooleanValueChanged:(e,t)=>{Ar(e,t)},fieldBoardValueChanged:(e,t)=>{Ar(e,t)},fieldImageValueChanged:(e,t)=>{Ar(e,t)},fieldColorValueChanged:(e,t)=>{Ar(e,t)},fieldMainModelValueChanged:(e,t)=>{Ar(e,t)},fieldRefinerModelValueChanged:(e,t)=>{Ar(e,t)},fieldVaeModelValueChanged:(e,t)=>{Ar(e,t)},fieldLoRAModelValueChanged:(e,t)=>{Ar(e,t)},fieldControlNetModelValueChanged:(e,t)=>{Ar(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{Ar(e,t)},fieldT2IAdapterModelValueChanged:(e,t)=>{Ar(e,t)},fieldEnumModelValueChanged:(e,t)=>{Ar(e,t)},fieldSchedulerValueChanged:(e,t)=>{Ar(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!on(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=Ye(s.value);if(!l){s.value=i;return}s.value=g5(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];bI(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=Ye(Y5)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=yu(n.map(o=>({item:{...o,dragHandle:`.${xz}`},type:"add"})),[]),e.edges=su(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...ow},o),{})},workflowReset:e=>{e.workflow=Ye(Y5)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=yu(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=su(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(Ye),e.edgesToCopy=e.edges.filter(t=>t.selected).map(Ye),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(Ye),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(Ye);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=yl();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=c8(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=yu(a.concat(s),e.nodes),e.edges=su(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...ow}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?Rl.Full:Rl.Partial}},extraReducers:e=>{e.addCase(Ig.pending,t=>{t.isReady=!1}),e.addCase(EE,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=wu.IN_PROGRESS)}),e.addCase(AE,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=wu.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(i_,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=wu.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(PE,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=wu.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(o_,(t,n)=>{["in_progress"].includes(n.payload.data.queue_item.status)&&ps(t.nodeExecutionStates,r=>{r.status=wu.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:wVe,addNodePopoverOpened:CVe,addNodePopoverToggled:EVe,connectionEnded:TVe,connectionMade:AVe,connectionStarted:PVe,edgeDeleted:kVe,edgeChangeStarted:IVe,edgesChanged:MVe,edgesDeleted:RVe,edgeUpdated:OVe,fieldBoardValueChanged:$Ve,fieldBooleanValueChanged:NVe,fieldColorValueChanged:DVe,fieldControlNetModelValueChanged:LVe,fieldEnumModelValueChanged:FVe,fieldImageValueChanged:aS,fieldIPAdapterModelValueChanged:BVe,fieldT2IAdapterModelValueChanged:zVe,fieldLabelChanged:VVe,fieldLoRAModelValueChanged:jVe,fieldMainModelValueChanged:UVe,fieldNumberValueChanged:GVe,fieldRefinerModelValueChanged:HVe,fieldSchedulerValueChanged:qVe,fieldStringValueChanged:WVe,fieldVaeModelValueChanged:KVe,imageCollectionFieldValueChanged:XVe,mouseOverFieldChanged:QVe,mouseOverNodeChanged:YVe,nodeAdded:ZVe,nodeReplaced:Oz,nodeEditorReset:cve,nodeEmbedWorkflowChanged:JVe,nodeExclusivelySelected:eje,nodeIsIntermediateChanged:tje,nodeIsOpenChanged:nje,nodeLabelChanged:rje,nodeNotesChanged:ije,nodeOpacityChanged:oje,nodesChanged:aje,nodesDeleted:sje,nodeTemplatesBuilt:$z,nodeUseCacheChanged:lje,notesNodeValueChanged:uje,selectedAll:cje,selectedEdgesChanged:dje,selectedNodesChanged:fje,selectionCopied:hje,selectionModeChanged:pje,selectionPasted:gje,shouldAnimateEdgesChanged:mje,shouldColorEdgesChanged:yje,shouldShowFieldTypeLegendChanged:vje,shouldShowMinimapPanelChanged:bje,shouldSnapToGridChanged:_je,shouldValidateGraphChanged:Sje,viewportChanged:xje,workflowAuthorChanged:wje,workflowContactChanged:Cje,workflowDescriptionChanged:Eje,workflowExposedFieldAdded:dve,workflowExposedFieldRemoved:Tje,workflowLoaded:fve,workflowNameChanged:Aje,workflowNotesChanged:Pje,workflowTagsChanged:kje,workflowVersionChanged:Ije,edgeAdded:Mje}=Rz.actions,hve=Rz.reducer,Nz={esrganModelName:"RealESRGAN_x4plus.pth"},Dz=Wt({name:"postprocessing",initialState:Nz,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:Rje}=Dz.actions,pve=Dz.reducer,Lz={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},Fz=Wt({name:"sdxl",initialState:Lz,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:Oje,setNegativeStylePromptSDXL:$je,setShouldConcatSDXLStylePrompt:Nje,setShouldUseSDXLRefiner:gve,setSDXLImg2ImgDenoisingStrength:Dje,refinerModelChanged:_8,setRefinerSteps:Lje,setRefinerCFGScale:Fje,setRefinerScheduler:Bje,setRefinerPositiveAestheticScore:zje,setRefinerNegativeAestheticScore:Vje,setRefinerStart:jje}=Fz.actions,mve=Fz.reducer,yve=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),vs=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},Bz={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},zz=Wt({name:"system",initialState:Bz,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(CE,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(UD,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(EE,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(PE,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:yve(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(AE,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(WD,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(QD,t=>{t.status="LOADING_MODEL"}),e.addCase(ZD,t=>{t.status="CONNECTED"}),e.addCase(o_,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.queue_item.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(wve,(t,n)=>{t.toastQueue.push(vs({title:X("toast.serverError"),status:"error",description:wE(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:Uje,setEnableImageDebugging:Gje,addToast:it,clearToastQueue:vve,consoleLogLevelChanged:Hje,shouldLogToConsoleChanged:qje,shouldAntialiasProgressImageChanged:Wje,languageChanged:Kje,shouldUseNSFWCheckerChanged:bve,shouldUseWatermarkerChanged:_ve,setShouldEnableInformationalPopovers:Xje,isInitializedChanged:Sve}=zz.actions,xve=zz.reducer,wve=si(i_,eL,nL),Cve={searchFolder:null,advancedAddScanModel:null},Vz=Wt({name:"modelmanager",initialState:Cve,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:Qje,setAdvancedAddScanModel:Yje}=Vz.actions,Eve=Vz.reducer,jz={shift:!1,ctrl:!1,meta:!1},Uz=Wt({name:"hotkeys",initialState:jz,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:Zje,ctrlKeyPressed:Jje,metaKeyPressed:eUe}=Uz.actions,Tve=Uz.reducer,Gz={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},Hz=Wt({name:"ui",initialState:Gz,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(c_,t=>{t.activeTab="img2img"})}}),{setActiveTab:qz,setShouldShowImageDetails:tUe,setShouldUseCanvasBetaLayout:nUe,setShouldShowExistingModelsInSearch:rUe,setShouldUseSliders:iUe,setShouldHidePreview:oUe,setShouldShowProgressInViewer:aUe,favoriteSchedulersChanged:sUe,toggleEmbeddingPicker:lUe,setShouldAutoChangeDimensions:uUe,contextMenusClosed:cUe,panelsChanged:dUe}=Hz.actions,Ave=Hz.reducer,Pve=pq(iX);Wz=Z5=void 0;var kve=Pve,Ive=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return kve.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function Xz(e,t){if(e){if(typeof e=="string")return x8(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x8(e,t)}}function x8(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?Gve:Hve;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function T8(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function A8(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){T8(o,r,i,a,s,"next",l)}function s(l){T8(o,r,i,a,s,"throw",l)}a(void 0)})}}var Wve=function(){var e=A8(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield Bve(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=A8(function*(){var p=Kz(t.getState(),n);yield qve(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),ST(p,d)||t.dispatch({type:$ve,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(Dve(f,u)):t.subscribe(Nve(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const Kve=Wve;function Mg(e){"@babel/helpers - typeof";return Mg=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},Mg(e)}function P8(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 lw(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=lw({},r));var o=typeof t=="function"?t:Mf(t);switch(i.type){case J5:{var a=lw(lw({},n.state),i.payload||{});return n.state=o(a,{type:J5,payload:a}),n.state}default:return o(r,i)}}},Jve=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,b){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,b){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var g=function(b){return function(y,m,v){var S=b(y,m,v);return Kve(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return g};const fUe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],e1e="@@invokeai-",t1e=["cursorPosition"],n1e=["pendingControlImages"],r1e=["prompts"],i1e=["selection","selectedBoardId","galleryView"],o1e=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],a1e=[],s1e=[],l1e=["isInitialized","isConnected","denoiseProgress","status"],u1e=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],c1e={canvas:t1e,gallery:i1e,generation:a1e,nodes:o1e,postprocessing:s1e,system:l1e,ui:u1e,controlNet:n1e,dynamicPrompts:r1e},d1e=(e,t)=>{const n=$f(e,c1e[t]??[]);return JSON.stringify(n)},f1e={canvas:aF,gallery:YF,generation:NE,nodes:Mz,postprocessing:Nz,system:Bz,config:BD,ui:Gz,hotkeys:jz,controlAdapters:m5,dynamicPrompts:QE,sdxl:Lz},h1e=(e,t)=>ID(JSON.parse(e),f1e[t]),p1e=ge("nodes/textToImageGraphBuilt"),g1e=ge("nodes/imageToImageGraphBuilt"),Yz=ge("nodes/canvasGraphBuilt"),m1e=ge("nodes/nodesGraphBuilt"),y1e=si(p1e,g1e,Yz,m1e),v1e=ge("nodes/workflowLoadRequested"),b1e=ge("nodes/updateAllNodesRequested"),_1e=e=>{if(y1e(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return Ig.fulfilled.match(e)?{...e,payload:""}:$z.match(e)?{...e,payload:""}:e},S1e=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],x1e=e=>e,w1e=si(kle,Ile),C1e=()=>{pe({matcher:w1e,effect:async(e,{dispatch:t,getState:n})=>{const r=se("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(un.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(it({title:X("queue.cancelBatchSucceeded"),status:"success"}))),t($le())}catch{r.error("Failed to cancel canvas batches"),t(it({title:X("queue.cancelBatchFailed"),status:"error"}))}}})};ge("app/appStarted");const E1e=()=>{pe({matcher:ce.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Vi({board_id:"none",categories:Fn}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Lt.getSelectors().selectAll(i)[0];t(pa(o??null))}}})},T1e=()=>{pe({matcher:un.endpoints.enqueueBatch.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=un.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(un.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},Zz=Do.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:hUe,useGetAppConfigQuery:pUe,useClearInvocationCacheMutation:gUe,useDisableInvocationCacheMutation:mUe,useEnableInvocationCacheMutation:yUe,useGetInvocationCacheStatusQuery:vUe}=Zz,A1e=()=>{pe({matcher:Zz.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(lae(r[0])),i.includes("nsfw_checker")||n(bve(!1)),o.includes("invisible_watermark")||n(_ve(!1))}})},P1e=ge("app/appStarted"),k1e=()=>{pe({actionCreator:P1e,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})};function I1e(e){if(e.sheet)return e.sheet;for(var t=0;t0?ir(Lf,--oi):0,_f--,wn===10&&(_f=1,uS--),wn}function Si(){return wn=oi2||Og(wn)>3?"":" "}function U1e(e,t){for(;--t&&Si()&&!(wn<48||wn>102||wn>57&&wn<65||wn>70&&wn<97););return Im(e,Yy()+(t<6&&ma()==32&&Si()==32))}function n3(e){for(;Si();)switch(wn){case e:return oi;case 34:case 39:e!==34&&e!==39&&n3(wn);break;case 40:e===41&&n3(e);break;case 92:Si();break}return oi}function G1e(e,t){for(;Si()&&e+wn!==47+10;)if(e+wn===42+42&&ma()===47)break;return"/*"+Im(t,oi-1)+"*"+lS(e===47?e:Si())}function H1e(e){for(;!Og(ma());)Si();return Im(e,oi)}function q1e(e){return iV(Jy("",null,null,null,[""],e=rV(e),0,[0],e))}function Jy(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,g=1,_=1,b=1,y=0,m="",v=i,S=o,w=r,C=m;_;)switch(p=y,y=Si()){case 40:if(p!=108&&ir(C,d-1)==58){t3(C+=ht(Zy(y),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:C+=Zy(y);break;case 9:case 10:case 13:case 32:C+=j1e(p);break;case 92:C+=U1e(Yy()-1,7);continue;case 47:switch(ma()){case 42:case 47:W0(W1e(G1e(Si(),Yy()),t,n),l);break;default:C+="/"}break;case 123*g:s[u++]=ta(C)*b;case 125*g:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+c:b==-1&&(C=ht(C,/\f/g,"")),h>0&&ta(C)-d&&W0(h>32?I8(C+";",r,n,d-1):I8(ht(C," ","")+";",r,n,d-2),l);break;case 59:C+=";";default:if(W0(w=k8(C,t,n,u,c,i,s,m,v=[],S=[],d),o),y===123)if(c===0)Jy(C,t,w,w,v,o,d,s,S);else switch(f===99&&ir(C,3)===110?100:f){case 100:case 108:case 109:case 115:Jy(e,w,w,r&&W0(k8(e,w,w,0,0,i,s,m,i,v=[],d),S),i,S,d,s,r?v:S);break;default:Jy(C,w,w,w,[""],S,0,s,S)}}u=c=h=0,g=b=1,m=C="",d=a;break;case 58:d=1+ta(C),h=p;default:if(g<1){if(y==123)--g;else if(y==125&&g++==0&&V1e()==125)continue}switch(C+=lS(y),y*g){case 38:b=c>0?1:(C+="\f",-1);break;case 44:s[u++]=(ta(C)-1)*b,b=1;break;case 64:ma()===45&&(C+=Zy(Si())),f=ma(),c=d=ta(m=C+=H1e(Yy())),y++;break;case 45:p===45&&ta(C)==2&&(g=0)}}return o}function k8(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=CT(f),p=0,g=0,_=0;p0?f[b]+" "+y:ht(y,/&\f/g,f[b])))&&(l[_++]=m);return cS(e,t,n,i===0?xT:s,l,u,c)}function W1e(e,t,n){return cS(e,t,n,Jz,lS(z1e()),Rg(e,2,-2),0)}function I8(e,t,n,r){return cS(e,t,n,wT,Rg(e,0,r),Rg(e,r+1,-1),r)}function zd(e,t){for(var n="",r=CT(e),i=0;i6)switch(ir(e,t+1)){case 109:if(ir(e,t+4)!==45)break;case 102:return ht(e,/(.+:)(.+)-([^]+)/,"$1"+ft+"$2-$3$1"+U1+(ir(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~t3(e,"stretch")?aV(ht(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ir(e,t+1)!==115)break;case 6444:switch(ir(e,ta(e)-3-(~t3(e,"!important")&&10))){case 107:return ht(e,":",":"+ft)+e;case 101:return ht(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ft+(ir(e,14)===45?"inline-":"")+"box$3$1"+ft+"$2$3$1"+hr+"$2box$3")+e}break;case 5936:switch(ir(e,t+11)){case 114:return ft+e+hr+ht(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ft+e+hr+ht(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ft+e+hr+ht(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ft+e+hr+e+e}return e}var nbe=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case wT:t.return=aV(t.value,t.length);break;case eV:return zd([yh(t,{value:ht(t.value,"@","@"+ft)})],i);case xT:if(t.length)return B1e(t.props,function(o){switch(F1e(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return zd([yh(t,{props:[ht(o,/:(read-\w+)/,":"+U1+"$1")]})],i);case"::placeholder":return zd([yh(t,{props:[ht(o,/:(plac\w+)/,":"+ft+"input-$1")]}),yh(t,{props:[ht(o,/:(plac\w+)/,":"+U1+"$1")]}),yh(t,{props:[ht(o,/:(plac\w+)/,hr+"input-$1")]})],i)}return""})}},rbe=[nbe],ibe=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(g){var _=g.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(g),g.setAttribute("data-s",""))})}var i=t.stylisPlugins||rbe,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(g){for(var _=g.getAttribute("data-emotion").split(" "),b=1;b<_.length;b++)o[_[b]]=!0;s.push(g)});var l,u=[ebe,tbe];{var c,d=[K1e,Q1e(function(g){c.insert(g)})],f=X1e(u.concat(i,d)),h=function(_){return zd(q1e(_),f)};l=function(_,b,y,m){c=y,h(_?_+"{"+b.styles+"}":b.styles),m&&(p.inserted[b.name]=!0)}}var p={key:n,sheet:new R1e({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},obe=!0;function abe(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var sV=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||obe===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},lV=function(t,n,r){sV(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function sbe(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var lbe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ube=/[A-Z]|^ms/g,cbe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,uV=function(t){return t.charCodeAt(1)===45},O8=function(t){return t!=null&&typeof t!="boolean"},uw=oV(function(e){return uV(e)?e:e.replace(ube,"-$&").toLowerCase()}),$8=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(cbe,function(r,i,o){return na={name:i,styles:o,next:na},i})}return lbe[t]!==1&&!uV(t)&&typeof n=="number"&&n!==0?n+"px":n};function $g(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return na={name:n.name,styles:n.styles,next:na},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)na={name:r.name,styles:r.styles,next:na},r=r.next;var i=n.styles+";";return i}return dbe(e,t,n)}case"function":{if(e!==void 0){var o=na,a=n(e);return na=o,$g(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function dbe(e,t,n){var r="";if(Array.isArray(n))for(var i=0;ioe.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),Tbe=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=k.useState(null),o=k.useRef(null),[,a]=k.useState({});k.useEffect(()=>a({}),[]);const s=wbe(),l=Sbe();G1(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=TT,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?oe.jsx(Ebe,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?mi.createPortal(oe.jsx(pV,{value:o.current,children:u}),o.current):oe.jsx("span",{ref:c=>{c&&i(c)}})},Abe=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=k.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=TT),l},[i]),[,s]=k.useState({});return G1(()=>s({}),[]),G1(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?mi.createPortal(oe.jsx(pV,{value:r?a:null,children:t}),a):null};function dS(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?oe.jsx(Abe,{containerRef:n,...r}):oe.jsx(Tbe,{...r})}dS.className=TT;dS.selector=Cbe;dS.displayName="Portal";function gV(){const e=k.useContext(Ng);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var AT=k.createContext({});AT.displayName="ColorModeContext";function fS(){const e=k.useContext(AT);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function bUe(e,t){const{colorMode:n}=fS();return n==="dark"?t:e}function mV(){const e=fS(),t=gV();return{...e,theme:t}}function Pbe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function kbe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function _Ue(e,t,n){const r=gV();return Ibe(e,t,n)(r)}function Ibe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return Pbe(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return kbe(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Kl=(...e)=>e.filter(Boolean).join(" ");function Mbe(){return!1}function ya(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var SUe=e=>{const{condition:t,message:n}=e;t&&Mbe()&&console.warn(n)};function ua(e,...t){return Rbe(e)?e(...t):e}var Rbe=e=>typeof e=="function",xUe=e=>e?"":void 0,wUe=e=>e?!0:void 0;function CUe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function EUe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var H1={exports:{}};H1.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",g="[object Map]",_="[object Number]",b="[object Null]",y="[object Object]",m="[object Proxy]",v="[object RegExp]",S="[object Set]",w="[object String]",C="[object Undefined]",x="[object WeakMap]",P="[object ArrayBuffer]",E="[object DataView]",I="[object Float32Array]",N="[object Float64Array]",M="[object Int8Array]",T="[object Int16Array]",A="[object Int32Array]",R="[object Uint8Array]",D="[object Uint8ClampedArray]",$="[object Uint16Array]",L="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[I]=j[N]=j[M]=j[T]=j[A]=j[R]=j[D]=j[$]=j[L]=!0,j[s]=j[l]=j[P]=j[c]=j[E]=j[d]=j[f]=j[h]=j[g]=j[_]=j[y]=j[v]=j[S]=j[w]=j[x]=!1;var q=typeof He=="object"&&He&&He.Object===Object&&He,Y=typeof self=="object"&&self&&self.Object===Object&&self,Z=q||Y||Function("return this")(),V=t&&!t.nodeType&&t,K=V&&!0&&e&&!e.nodeType&&e,ee=K&&K.exports===V,re=ee&&q.process,fe=function(){try{var z=K&&K.require&&K.require("util").types;return z||re&&re.binding&&re.binding("util")}catch{}}(),Se=fe&&fe.isTypedArray;function Me(z,G,Q){switch(Q.length){case 0:return z.call(G);case 1:return z.call(G,Q[0]);case 2:return z.call(G,Q[0],Q[1]);case 3:return z.call(G,Q[0],Q[1],Q[2])}return z.apply(G,Q)}function De(z,G){for(var Q=-1,me=Array(z);++Q-1}function Oa(z,G){var Q=this.__data__,me=Ec(Q,z);return me<0?(++this.size,Q.push([z,G])):Q[me][1]=G,this}Zn.prototype.clear=Ra,Zn.prototype.delete=Is,Zn.prototype.get=Ms,Zn.prototype.has=Cc,Zn.prototype.set=Oa;function Er(z){var G=-1,Q=z==null?0:z.length;for(this.clear();++G1?Q[nt-1]:void 0,jt=nt>2?Q[2]:void 0;for(Ct=z.length>3&&typeof Ct=="function"?(nt--,Ct):void 0,jt&&YH(Q[0],Q[1],jt)&&(Ct=nt<3?void 0:Ct,nt=1),G=Object(G);++me-1&&z%1==0&&z0){if(++G>=i)return arguments[0]}else G=0;return z.apply(void 0,arguments)}}function oq(z){if(z!=null){try{return xt.call(z)}catch{}try{return z+""}catch{}}return""}function e0(z,G){return z===G||z!==z&&G!==G}var G2=Zm(function(){return arguments}())?Zm:function(z){return Zf(z)&&bn.call(z,"callee")&&!fo.call(z,"callee")},H2=Array.isArray;function q2(z){return z!=null&&KA(z.length)&&!W2(z)}function aq(z){return Zf(z)&&q2(z)}var WA=tu||dq;function W2(z){if(!iu(z))return!1;var G=Ac(z);return G==h||G==p||G==u||G==m}function KA(z){return typeof z=="number"&&z>-1&&z%1==0&&z<=a}function iu(z){var G=typeof z;return z!=null&&(G=="object"||G=="function")}function Zf(z){return z!=null&&typeof z=="object"}function sq(z){if(!Zf(z)||Ac(z)!=y)return!1;var G=li(z);if(G===null)return!0;var Q=bn.call(G,"constructor")&&G.constructor;return typeof Q=="function"&&Q instanceof Q&&xt.call(Q)==Mi}var XA=Se?Ee(Se):LH;function lq(z){return qH(z,QA(z))}function QA(z){return q2(z)?B2(z,!0):FH(z)}var uq=WH(function(z,G,Q,me){GA(z,G,Q,me)});function cq(z){return function(){return z}}function YA(z){return z}function dq(){return!1}e.exports=uq})(H1,H1.exports);var Obe=H1.exports;const ca=Bl(Obe);var $be=e=>/!(important)?$/.test(e),L8=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,Nbe=(e,t)=>n=>{const r=String(t),i=$be(r),o=L8(r),a=e?`${e}.${o}`:o;let s=ya(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=L8(s),i?`${s} !important`:s};function PT(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=Nbe(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var K0=(...e)=>t=>e.reduce((n,r)=>r(n),t);function Di(e,t){return n=>{const r={property:n,scale:e};return r.transform=PT({scale:e,transform:t}),r}}var Dbe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function Lbe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:Dbe(t),transform:n?PT({scale:n,compose:r}):r}}var yV=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function Fbe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...yV].join(" ")}function Bbe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...yV].join(" ")}var zbe={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},Vbe={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function jbe(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Ube={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},r3={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},Gbe=new Set(Object.values(r3)),i3=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Hbe=e=>e.trim();function qbe(e,t){if(e==null||i3.has(e))return e;if(!(o3(e)||i3.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(Hbe).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in r3?r3[l]:l;u.unshift(c);const d=u.map(f=>{if(Gbe.has(f))return f;const h=f.indexOf(" "),[p,g]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=o3(g)?g:g&&g.split(" "),b=`colors.${p}`,y=b in t.__cssMap?t.__cssMap[b].varRef:p;return _?[y,...Array.isArray(_)?_:[_]].join(" "):y});return`${s}(${d.join(", ")})`}var o3=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),Wbe=(e,t)=>qbe(e,t??{});function Kbe(e){return/^var\(--.+\)$/.test(e)}var Xbe=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},qo=e=>t=>`${e}(${t})`,Je={filter(e){return e!=="auto"?e:zbe},backdropFilter(e){return e!=="auto"?e:Vbe},ring(e){return jbe(Je.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?Fbe():e==="auto-gpu"?Bbe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=Xbe(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(Kbe(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:Wbe,blur:qo("blur"),opacity:qo("opacity"),brightness:qo("brightness"),contrast:qo("contrast"),dropShadow:qo("drop-shadow"),grayscale:qo("grayscale"),hueRotate:e=>qo("hue-rotate")(Je.degree(e)),invert:qo("invert"),saturate:qo("saturate"),sepia:qo("sepia"),bgImage(e){return e==null||o3(e)||i3.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=Ube[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},H={borderWidths:Di("borderWidths"),borderStyles:Di("borderStyles"),colors:Di("colors"),borders:Di("borders"),gradients:Di("gradients",Je.gradient),radii:Di("radii",Je.px),space:Di("space",K0(Je.vh,Je.px)),spaceT:Di("space",K0(Je.vh,Je.px)),degreeT(e){return{property:e,transform:Je.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:PT({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:Di("sizes",K0(Je.vh,Je.px)),sizesT:Di("sizes",K0(Je.vh,Je.fraction)),shadows:Di("shadows"),logical:Lbe,blur:Di("blur",Je.blur)},ev={background:H.colors("background"),backgroundColor:H.colors("backgroundColor"),backgroundImage:H.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Je.bgClip},bgSize:H.prop("backgroundSize"),bgPosition:H.prop("backgroundPosition"),bg:H.colors("background"),bgColor:H.colors("backgroundColor"),bgPos:H.prop("backgroundPosition"),bgRepeat:H.prop("backgroundRepeat"),bgAttachment:H.prop("backgroundAttachment"),bgGradient:H.gradients("backgroundImage"),bgClip:{transform:Je.bgClip}};Object.assign(ev,{bgImage:ev.backgroundImage,bgImg:ev.backgroundImage});var dt={border:H.borders("border"),borderWidth:H.borderWidths("borderWidth"),borderStyle:H.borderStyles("borderStyle"),borderColor:H.colors("borderColor"),borderRadius:H.radii("borderRadius"),borderTop:H.borders("borderTop"),borderBlockStart:H.borders("borderBlockStart"),borderTopLeftRadius:H.radii("borderTopLeftRadius"),borderStartStartRadius:H.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:H.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:H.radii("borderTopRightRadius"),borderStartEndRadius:H.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:H.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:H.borders("borderRight"),borderInlineEnd:H.borders("borderInlineEnd"),borderBottom:H.borders("borderBottom"),borderBlockEnd:H.borders("borderBlockEnd"),borderBottomLeftRadius:H.radii("borderBottomLeftRadius"),borderBottomRightRadius:H.radii("borderBottomRightRadius"),borderLeft:H.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:H.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:H.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:H.borders(["borderLeft","borderRight"]),borderInline:H.borders("borderInline"),borderY:H.borders(["borderTop","borderBottom"]),borderBlock:H.borders("borderBlock"),borderTopWidth:H.borderWidths("borderTopWidth"),borderBlockStartWidth:H.borderWidths("borderBlockStartWidth"),borderTopColor:H.colors("borderTopColor"),borderBlockStartColor:H.colors("borderBlockStartColor"),borderTopStyle:H.borderStyles("borderTopStyle"),borderBlockStartStyle:H.borderStyles("borderBlockStartStyle"),borderBottomWidth:H.borderWidths("borderBottomWidth"),borderBlockEndWidth:H.borderWidths("borderBlockEndWidth"),borderBottomColor:H.colors("borderBottomColor"),borderBlockEndColor:H.colors("borderBlockEndColor"),borderBottomStyle:H.borderStyles("borderBottomStyle"),borderBlockEndStyle:H.borderStyles("borderBlockEndStyle"),borderLeftWidth:H.borderWidths("borderLeftWidth"),borderInlineStartWidth:H.borderWidths("borderInlineStartWidth"),borderLeftColor:H.colors("borderLeftColor"),borderInlineStartColor:H.colors("borderInlineStartColor"),borderLeftStyle:H.borderStyles("borderLeftStyle"),borderInlineStartStyle:H.borderStyles("borderInlineStartStyle"),borderRightWidth:H.borderWidths("borderRightWidth"),borderInlineEndWidth:H.borderWidths("borderInlineEndWidth"),borderRightColor:H.colors("borderRightColor"),borderInlineEndColor:H.colors("borderInlineEndColor"),borderRightStyle:H.borderStyles("borderRightStyle"),borderInlineEndStyle:H.borderStyles("borderInlineEndStyle"),borderTopRadius:H.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:H.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:H.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:H.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(dt,{rounded:dt.borderRadius,roundedTop:dt.borderTopRadius,roundedTopLeft:dt.borderTopLeftRadius,roundedTopRight:dt.borderTopRightRadius,roundedTopStart:dt.borderStartStartRadius,roundedTopEnd:dt.borderStartEndRadius,roundedBottom:dt.borderBottomRadius,roundedBottomLeft:dt.borderBottomLeftRadius,roundedBottomRight:dt.borderBottomRightRadius,roundedBottomStart:dt.borderEndStartRadius,roundedBottomEnd:dt.borderEndEndRadius,roundedLeft:dt.borderLeftRadius,roundedRight:dt.borderRightRadius,roundedStart:dt.borderInlineStartRadius,roundedEnd:dt.borderInlineEndRadius,borderStart:dt.borderInlineStart,borderEnd:dt.borderInlineEnd,borderTopStartRadius:dt.borderStartStartRadius,borderTopEndRadius:dt.borderStartEndRadius,borderBottomStartRadius:dt.borderEndStartRadius,borderBottomEndRadius:dt.borderEndEndRadius,borderStartRadius:dt.borderInlineStartRadius,borderEndRadius:dt.borderInlineEndRadius,borderStartWidth:dt.borderInlineStartWidth,borderEndWidth:dt.borderInlineEndWidth,borderStartColor:dt.borderInlineStartColor,borderEndColor:dt.borderInlineEndColor,borderStartStyle:dt.borderInlineStartStyle,borderEndStyle:dt.borderInlineEndStyle});var Qbe={color:H.colors("color"),textColor:H.colors("color"),fill:H.colors("fill"),stroke:H.colors("stroke")},a3={boxShadow:H.shadows("boxShadow"),mixBlendMode:!0,blendMode:H.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:H.prop("backgroundBlendMode"),opacity:!0};Object.assign(a3,{shadow:a3.boxShadow});var Ybe={filter:{transform:Je.filter},blur:H.blur("--chakra-blur"),brightness:H.propT("--chakra-brightness",Je.brightness),contrast:H.propT("--chakra-contrast",Je.contrast),hueRotate:H.propT("--chakra-hue-rotate",Je.hueRotate),invert:H.propT("--chakra-invert",Je.invert),saturate:H.propT("--chakra-saturate",Je.saturate),dropShadow:H.propT("--chakra-drop-shadow",Je.dropShadow),backdropFilter:{transform:Je.backdropFilter},backdropBlur:H.blur("--chakra-backdrop-blur"),backdropBrightness:H.propT("--chakra-backdrop-brightness",Je.brightness),backdropContrast:H.propT("--chakra-backdrop-contrast",Je.contrast),backdropHueRotate:H.propT("--chakra-backdrop-hue-rotate",Je.hueRotate),backdropInvert:H.propT("--chakra-backdrop-invert",Je.invert),backdropSaturate:H.propT("--chakra-backdrop-saturate",Je.saturate)},q1={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Je.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:H.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:H.space("gap"),rowGap:H.space("rowGap"),columnGap:H.space("columnGap")};Object.assign(q1,{flexDir:q1.flexDirection});var vV={gridGap:H.space("gridGap"),gridColumnGap:H.space("gridColumnGap"),gridRowGap:H.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},Zbe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Je.outline},outlineOffset:!0,outlineColor:H.colors("outlineColor")},Bi={width:H.sizesT("width"),inlineSize:H.sizesT("inlineSize"),height:H.sizes("height"),blockSize:H.sizes("blockSize"),boxSize:H.sizes(["width","height"]),minWidth:H.sizes("minWidth"),minInlineSize:H.sizes("minInlineSize"),minHeight:H.sizes("minHeight"),minBlockSize:H.sizes("minBlockSize"),maxWidth:H.sizes("maxWidth"),maxInlineSize:H.sizes("maxInlineSize"),maxHeight:H.sizes("maxHeight"),maxBlockSize:H.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:H.propT("float",Je.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(Bi,{w:Bi.width,h:Bi.height,minW:Bi.minWidth,maxW:Bi.maxWidth,minH:Bi.minHeight,maxH:Bi.maxHeight,overscroll:Bi.overscrollBehavior,overscrollX:Bi.overscrollBehaviorX,overscrollY:Bi.overscrollBehaviorY});var Jbe={listStyleType:!0,listStylePosition:!0,listStylePos:H.prop("listStylePosition"),listStyleImage:!0,listStyleImg:H.prop("listStyleImage")};function e_e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},n_e=t_e(e_e),r_e={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},i_e={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},cw=(e,t,n)=>{const r={},i=n_e(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},o_e={srOnly:{transform(e){return e===!0?r_e:e==="focusable"?i_e:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>cw(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>cw(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>cw(t,e,n)}},gp={position:!0,pos:H.prop("position"),zIndex:H.prop("zIndex","zIndices"),inset:H.spaceT("inset"),insetX:H.spaceT(["left","right"]),insetInline:H.spaceT("insetInline"),insetY:H.spaceT(["top","bottom"]),insetBlock:H.spaceT("insetBlock"),top:H.spaceT("top"),insetBlockStart:H.spaceT("insetBlockStart"),bottom:H.spaceT("bottom"),insetBlockEnd:H.spaceT("insetBlockEnd"),left:H.spaceT("left"),insetInlineStart:H.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:H.spaceT("right"),insetInlineEnd:H.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(gp,{insetStart:gp.insetInlineStart,insetEnd:gp.insetInlineEnd});var a_e={ring:{transform:Je.ring},ringColor:H.colors("--chakra-ring-color"),ringOffset:H.prop("--chakra-ring-offset-width"),ringOffsetColor:H.colors("--chakra-ring-offset-color"),ringInset:H.prop("--chakra-ring-inset")},Dt={margin:H.spaceT("margin"),marginTop:H.spaceT("marginTop"),marginBlockStart:H.spaceT("marginBlockStart"),marginRight:H.spaceT("marginRight"),marginInlineEnd:H.spaceT("marginInlineEnd"),marginBottom:H.spaceT("marginBottom"),marginBlockEnd:H.spaceT("marginBlockEnd"),marginLeft:H.spaceT("marginLeft"),marginInlineStart:H.spaceT("marginInlineStart"),marginX:H.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:H.spaceT("marginInline"),marginY:H.spaceT(["marginTop","marginBottom"]),marginBlock:H.spaceT("marginBlock"),padding:H.space("padding"),paddingTop:H.space("paddingTop"),paddingBlockStart:H.space("paddingBlockStart"),paddingRight:H.space("paddingRight"),paddingBottom:H.space("paddingBottom"),paddingBlockEnd:H.space("paddingBlockEnd"),paddingLeft:H.space("paddingLeft"),paddingInlineStart:H.space("paddingInlineStart"),paddingInlineEnd:H.space("paddingInlineEnd"),paddingX:H.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:H.space("paddingInline"),paddingY:H.space(["paddingTop","paddingBottom"]),paddingBlock:H.space("paddingBlock")};Object.assign(Dt,{m:Dt.margin,mt:Dt.marginTop,mr:Dt.marginRight,me:Dt.marginInlineEnd,marginEnd:Dt.marginInlineEnd,mb:Dt.marginBottom,ml:Dt.marginLeft,ms:Dt.marginInlineStart,marginStart:Dt.marginInlineStart,mx:Dt.marginX,my:Dt.marginY,p:Dt.padding,pt:Dt.paddingTop,py:Dt.paddingY,px:Dt.paddingX,pb:Dt.paddingBottom,pl:Dt.paddingLeft,ps:Dt.paddingInlineStart,paddingStart:Dt.paddingInlineStart,pr:Dt.paddingRight,pe:Dt.paddingInlineEnd,paddingEnd:Dt.paddingInlineEnd});var s_e={textDecorationColor:H.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:H.shadows("textShadow")},l_e={clipPath:!0,transform:H.propT("transform",Je.transform),transformOrigin:!0,translateX:H.spaceT("--chakra-translate-x"),translateY:H.spaceT("--chakra-translate-y"),skewX:H.degreeT("--chakra-skew-x"),skewY:H.degreeT("--chakra-skew-y"),scaleX:H.prop("--chakra-scale-x"),scaleY:H.prop("--chakra-scale-y"),scale:H.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:H.degreeT("--chakra-rotate")},u_e={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:H.prop("transitionDuration","transition.duration"),transitionProperty:H.prop("transitionProperty","transition.property"),transitionTimingFunction:H.prop("transitionTimingFunction","transition.easing")},c_e={fontFamily:H.prop("fontFamily","fonts"),fontSize:H.prop("fontSize","fontSizes",Je.px),fontWeight:H.prop("fontWeight","fontWeights"),lineHeight:H.prop("lineHeight","lineHeights"),letterSpacing:H.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},d_e={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:H.spaceT("scrollMargin"),scrollMarginTop:H.spaceT("scrollMarginTop"),scrollMarginBottom:H.spaceT("scrollMarginBottom"),scrollMarginLeft:H.spaceT("scrollMarginLeft"),scrollMarginRight:H.spaceT("scrollMarginRight"),scrollMarginX:H.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:H.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:H.spaceT("scrollPadding"),scrollPaddingTop:H.spaceT("scrollPaddingTop"),scrollPaddingBottom:H.spaceT("scrollPaddingBottom"),scrollPaddingLeft:H.spaceT("scrollPaddingLeft"),scrollPaddingRight:H.spaceT("scrollPaddingRight"),scrollPaddingX:H.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:H.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function bV(e){return ya(e)&&e.reference?e.reference:String(e)}var hS=(e,...t)=>t.map(bV).join(` ${e} `).replace(/calc/g,""),F8=(...e)=>`calc(${hS("+",...e)})`,B8=(...e)=>`calc(${hS("-",...e)})`,s3=(...e)=>`calc(${hS("*",...e)})`,z8=(...e)=>`calc(${hS("/",...e)})`,V8=e=>{const t=bV(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:s3(t,-1)},Cu=Object.assign(e=>({add:(...t)=>Cu(F8(e,...t)),subtract:(...t)=>Cu(B8(e,...t)),multiply:(...t)=>Cu(s3(e,...t)),divide:(...t)=>Cu(z8(e,...t)),negate:()=>Cu(V8(e)),toString:()=>e.toString()}),{add:F8,subtract:B8,multiply:s3,divide:z8,negate:V8});function f_e(e,t="-"){return e.replace(/\s+/g,t)}function h_e(e){const t=f_e(e.toString());return g_e(p_e(t))}function p_e(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function g_e(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function m_e(e,t=""){return[t,e].filter(Boolean).join("-")}function y_e(e,t){return`var(${e}${t?`, ${t}`:""})`}function v_e(e,t=""){return h_e(`--${m_e(e,t)}`)}function ke(e,t,n){const r=v_e(e,n);return{variable:r,reference:y_e(r,t)}}function b_e(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=ke(`${e}-${i}`,o);continue}n[r]=ke(`${e}-${r}`)}return n}function __e(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function S_e(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function l3(e){if(e==null)return e;const{unitless:t}=S_e(e);return t||typeof e=="number"?`${e}px`:e}var _V=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,kT=e=>Object.fromEntries(Object.entries(e).sort(_V));function j8(e){const t=kT(e);return Object.assign(Object.values(t),t)}function x_e(e){const t=Object.keys(kT(e));return new Set(t)}function U8(e){var t;if(!e)return e;e=(t=l3(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function qh(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${l3(e)})`),t&&n.push("and",`(max-width: ${l3(t)})`),n.join(" ")}function w_e(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=j8(e),r=Object.entries(e).sort(_V).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?U8(d):void 0,{_minW:U8(s),breakpoint:a,minW:s,maxW:d,maxWQuery:qh(null,d),minWQuery:qh(s),minMaxQuery:qh(s,d)}}),i=x_e(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:kT(e),asArray:j8(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>qh(a)).slice(1)],toArrayValue(a){if(!ya(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;__e(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var Jn={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},Ds=e=>SV(t=>e(t,"&"),"[role=group]","[data-group]",".group"),Da=e=>SV(t=>e(t,"~ &"),"[data-peer]",".peer"),SV=(e,...t)=>t.map(e).join(", "),pS={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:Ds(Jn.hover),_peerHover:Da(Jn.hover),_groupFocus:Ds(Jn.focus),_peerFocus:Da(Jn.focus),_groupFocusVisible:Ds(Jn.focusVisible),_peerFocusVisible:Da(Jn.focusVisible),_groupActive:Ds(Jn.active),_peerActive:Da(Jn.active),_groupDisabled:Ds(Jn.disabled),_peerDisabled:Da(Jn.disabled),_groupInvalid:Ds(Jn.invalid),_peerInvalid:Da(Jn.invalid),_groupChecked:Ds(Jn.checked),_peerChecked:Da(Jn.checked),_groupFocusWithin:Ds(Jn.focusWithin),_peerFocusWithin:Da(Jn.focusWithin),_peerPlaceholderShown:Da(Jn.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},xV=Object.keys(pS);function G8(e,t){return ke(String(e).replace(/\./g,"-"),void 0,t)}function C_e(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=G8(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,g=`${h}.-${p.join(".")}`,_=Cu.negate(s),b=Cu.negate(u);r[g]={value:_,var:l,varRef:b}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=G8(p,t==null?void 0:t.cssVarPrefix);return _},d=ya(s)?s:{default:s};n=ca(n,Object.entries(d).reduce((f,[h,p])=>{var g,_;if(!p)return f;const b=c(`${p}`);if(h==="default")return f[l]=b,f;const y=(_=(g=pS)==null?void 0:g[h])!=null?_:h;return f[y]={[l]:b},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function E_e(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function T_e(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function A_e(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function H8(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(A_e(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var P_e=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function k_e(e){return T_e(e,P_e)}function I_e(e){return e.semanticTokens}function M_e(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var R_e=e=>xV.includes(e)||e==="default";function O_e({tokens:e,semanticTokens:t}){const n={};return H8(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),H8(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(R_e)}),n}function $_e(e){var t;const n=M_e(e),r=k_e(n),i=I_e(n),o=O_e({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=C_e(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:w_e(n.breakpoints)}),n}var IT=ca({},ev,dt,Qbe,q1,Bi,Ybe,a_e,Zbe,vV,o_e,gp,a3,Dt,d_e,c_e,s_e,l_e,Jbe,u_e),N_e=Object.assign({},Dt,Bi,q1,vV,gp),TUe=Object.keys(N_e),D_e=[...Object.keys(IT),...xV],L_e={...IT,...pS},F_e=e=>e in L_e,B_e=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=ua(e[a],t);if(s==null)continue;if(s=ya(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!V_e(t),U_e=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=z_e(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function G_e(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=ua(o,r),d=B_e(c)(r);let f={};for(let h in d){const p=d[h];let g=ua(p,r);h in n&&(h=n[h]),j_e(h,g)&&(g=U_e(r,g));let _=t[h];if(_===!0&&(_={property:h}),ya(g)){f[h]=(s=f[h])!=null?s:{},f[h]=ca({},f[h],i(g,!0));continue}let b=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,g,r,c))!=null?u:g;b=_!=null&&_.processResult?i(b,!0):b;const y=ua(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const m=ua(_.static,r);f=ca({},f,m)}if(y&&Array.isArray(y)){for(const m of y)f[m]=b;continue}if(y){y==="&"&&ya(b)?f=ca({},f,b):f[y]=b;continue}if(ya(b)){f=ca({},f,b);continue}f[h]=b}return f};return i}var wV=e=>t=>G_e({theme:t,pseudos:pS,configs:IT})(e);function Ve(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function H_e(e,t){if(Array.isArray(e))return e;if(ya(e))return t(e);if(e!=null)return[e]}function q_e(e,t){for(let n=t+1;n{ca(u,{[m]:f?y[m]:{[b]:y[m]}})});continue}if(!h){f?ca(u,y):u[b]=y;continue}u[b]=y}}return u}}function K_e(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=W_e(o);return ca({},ua((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function AUe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Rm(e){return E_e(e,["styleConfig","size","variant","colorScheme"])}var X_e={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},Q_e={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},Y_e={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},Z_e={property:X_e,easing:Q_e,duration:Y_e},J_e=Z_e,eSe={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},tSe=eSe,nSe={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},rSe=nSe,iSe={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},oSe=iSe,aSe={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},sSe=aSe,lSe={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},uSe=lSe,cSe={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},dSe=cSe,fSe={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},hSe=fSe,pSe={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},CV=pSe,EV={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},gSe={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},mSe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},ySe={...EV,...gSe,container:mSe},TV=ySe,vSe={breakpoints:oSe,zIndices:tSe,radii:uSe,blur:hSe,colors:sSe,...CV,sizes:TV,shadows:dSe,space:EV,borders:rSe,transition:J_e},{defineMultiStyleConfig:bSe,definePartsStyle:Wh}=Ve(["stepper","step","title","description","indicator","separator","icon","number"]),Ka=ke("stepper-indicator-size"),ud=ke("stepper-icon-size"),cd=ke("stepper-title-font-size"),Kh=ke("stepper-description-font-size"),vh=ke("stepper-accent-color"),_Se=Wh(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[vh.variable]:`colors.${e}.500`,_dark:{[vh.variable]:`colors.${e}.200`}},title:{fontSize:cd.reference,fontWeight:"medium"},description:{fontSize:Kh.reference,color:"chakra-subtle-text"},number:{fontSize:cd.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:ud.reference,height:ud.reference},indicator:{flexShrink:0,borderRadius:"full",width:Ka.reference,height:Ka.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:vh.reference},"&[data-status=complete]":{bg:vh.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:vh.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Ka.reference} - 8px)`,top:`calc(${Ka.reference} + 4px)`,insetStart:`calc(${Ka.reference} / 2 - 1px)`}}})),SSe=bSe({baseStyle:_Se,sizes:{xs:Wh({stepper:{[Ka.variable]:"sizes.4",[ud.variable]:"sizes.3",[cd.variable]:"fontSizes.xs",[Kh.variable]:"fontSizes.xs"}}),sm:Wh({stepper:{[Ka.variable]:"sizes.6",[ud.variable]:"sizes.4",[cd.variable]:"fontSizes.sm",[Kh.variable]:"fontSizes.xs"}}),md:Wh({stepper:{[Ka.variable]:"sizes.8",[ud.variable]:"sizes.5",[cd.variable]:"fontSizes.md",[Kh.variable]:"fontSizes.sm"}}),lg:Wh({stepper:{[Ka.variable]:"sizes.10",[ud.variable]:"sizes.6",[cd.variable]:"fontSizes.lg",[Kh.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function mt(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return mt(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return mt(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var AV=mt("accordion").parts("root","container","button","panel").extend("icon"),xSe=mt("alert").parts("title","description","container").extend("icon","spinner"),wSe=mt("avatar").parts("label","badge","container").extend("excessLabel","group"),CSe=mt("breadcrumb").parts("link","item","container").extend("separator");mt("button").parts();var PV=mt("checkbox").parts("control","icon","container").extend("label");mt("progress").parts("track","filledTrack").extend("label");var ESe=mt("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),kV=mt("editable").parts("preview","input","textarea"),TSe=mt("form").parts("container","requiredIndicator","helperText"),ASe=mt("formError").parts("text","icon"),IV=mt("input").parts("addon","field","element","group"),PSe=mt("list").parts("container","item","icon"),MV=mt("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),RV=mt("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),OV=mt("numberinput").parts("root","field","stepperGroup","stepper");mt("pininput").parts("field");var $V=mt("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),NV=mt("progress").parts("label","filledTrack","track"),kSe=mt("radio").parts("container","control","label"),DV=mt("select").parts("field","icon"),LV=mt("slider").parts("container","track","thumb","filledTrack","mark"),ISe=mt("stat").parts("container","label","helpText","number","icon"),FV=mt("switch").parts("container","track","thumb","label"),MSe=mt("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),BV=mt("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),RSe=mt("tag").parts("container","label","closeButton"),OSe=mt("card").parts("container","header","body","footer");mt("stepper").parts("stepper","step","title","description","indicator","separator","icon","number");function Ou(e,t,n){return Math.min(Math.max(e,n),t)}class $Se extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Xh=$Se;function MT(e){if(typeof e!="string")throw new Xh(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=jSe.test(e)?LSe(e):e;const n=FSe.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(Dg(s,2),16)),parseInt(Dg(a[3]||"f",2),16)/255]}const r=BSe.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=zSe.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=VSe.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(Ou(0,100,s)!==s)throw new Xh(e);if(Ou(0,100,l)!==l)throw new Xh(e);return[...USe(a,s,l),Number.isNaN(u)?1:u]}throw new Xh(e)}function NSe(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const q8=e=>parseInt(e.replace(/_/g,""),36),DSe="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=q8(t.substring(0,3)),r=q8(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function LSe(e){const t=e.toLowerCase().trim(),n=DSe[NSe(t)];if(!n)throw new Xh(e);return`#${n}`}const Dg=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),FSe=new RegExp(`^#${Dg("([a-f0-9])",3)}([a-f0-9])?$`,"i"),BSe=new RegExp(`^#${Dg("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),zSe=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Dg(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),VSe=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,jSe=/^[a-z]+$/i,W8=e=>Math.round(e*255),USe=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(W8);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(W8)};function GSe(e,t,n,r){return`rgba(${Ou(0,255,e).toFixed()}, ${Ou(0,255,t).toFixed()}, ${Ou(0,255,n).toFixed()}, ${parseFloat(Ou(0,1,r).toFixed(3))})`}function HSe(e,t){const[n,r,i,o]=MT(e);return GSe(n,r,i,o-t)}function qSe(e){const[t,n,r,i]=MT(e);let o=a=>{const s=Ou(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function WSe(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,Or=(e,t,n)=>{const r=WSe(e,`colors.${t}`,t);try{return qSe(r),r}catch{return n??"#000000"}},XSe=e=>{const[t,n,r]=MT(e);return(t*299+n*587+r*114)/1e3},QSe=e=>t=>{const n=Or(t,e);return XSe(n)<128?"dark":"light"},YSe=e=>t=>QSe(e)(t)==="dark",Sf=(e,t)=>n=>{const r=Or(n,e);return HSe(r,1-t)};function K8(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + 45deg, + ${t} 25%, + transparent 25%, + transparent 50%, + ${t} 50%, + ${t} 75%, + transparent 75%, + transparent + )`,backgroundSize:`${e} ${e}`}}var ZSe=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function JSe(e){const t=ZSe();return!e||KSe(e)?t:e.string&&e.colors?t2e(e.string,e.colors):e.string&&!e.colors?e2e(e.string):e.colors&&!e.string?n2e(e.colors):t}function e2e(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function t2e(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function RT(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function zV(e){return ya(e)&&e.reference?e.reference:String(e)}var gS=(e,...t)=>t.map(zV).join(` ${e} `).replace(/calc/g,""),X8=(...e)=>`calc(${gS("+",...e)})`,Q8=(...e)=>`calc(${gS("-",...e)})`,u3=(...e)=>`calc(${gS("*",...e)})`,Y8=(...e)=>`calc(${gS("/",...e)})`,Z8=e=>{const t=zV(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:u3(t,-1)},Xa=Object.assign(e=>({add:(...t)=>Xa(X8(e,...t)),subtract:(...t)=>Xa(Q8(e,...t)),multiply:(...t)=>Xa(u3(e,...t)),divide:(...t)=>Xa(Y8(e,...t)),negate:()=>Xa(Z8(e)),toString:()=>e.toString()}),{add:X8,subtract:Q8,multiply:u3,divide:Y8,negate:Z8});function r2e(e){return!Number.isInteger(parseFloat(e.toString()))}function i2e(e,t="-"){return e.replace(/\s+/g,t)}function VV(e){const t=i2e(e.toString());return t.includes("\\.")?e:r2e(e)?t.replace(".","\\."):e}function o2e(e,t=""){return[t,VV(e)].filter(Boolean).join("-")}function a2e(e,t){return`var(${VV(e)}${t?`, ${t}`:""})`}function s2e(e,t=""){return`--${o2e(e,t)}`}function tn(e,t){const n=s2e(e,t==null?void 0:t.prefix);return{variable:n,reference:a2e(n,l2e(t==null?void 0:t.fallback))}}function l2e(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:u2e,definePartsStyle:tv}=Ve(FV.keys),mp=tn("switch-track-width"),Gu=tn("switch-track-height"),dw=tn("switch-track-diff"),c2e=Xa.subtract(mp,Gu),c3=tn("switch-thumb-x"),bh=tn("switch-bg"),d2e=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[mp.reference],height:[Gu.reference],transitionProperty:"common",transitionDuration:"fast",[bh.variable]:"colors.gray.300",_dark:{[bh.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[bh.variable]:`colors.${t}.500`,_dark:{[bh.variable]:`colors.${t}.200`}},bg:bh.reference}},f2e={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[Gu.reference],height:[Gu.reference],_checked:{transform:`translateX(${c3.reference})`}},h2e=tv(e=>({container:{[dw.variable]:c2e,[c3.variable]:dw.reference,_rtl:{[c3.variable]:Xa(dw).negate().toString()}},track:d2e(e),thumb:f2e})),p2e={sm:tv({container:{[mp.variable]:"1.375rem",[Gu.variable]:"sizes.3"}}),md:tv({container:{[mp.variable]:"1.875rem",[Gu.variable]:"sizes.4"}}),lg:tv({container:{[mp.variable]:"2.875rem",[Gu.variable]:"sizes.6"}})},g2e=u2e({baseStyle:h2e,sizes:p2e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:m2e,definePartsStyle:Vd}=Ve(MSe.keys),y2e=Vd({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),W1={"&[data-is-numeric=true]":{textAlign:"end"}},v2e=Vd(e=>{const{colorScheme:t}=e;return{th:{color:W("gray.600","gray.400")(e),borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...W1},td:{borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...W1},caption:{color:W("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),b2e=Vd(e=>{const{colorScheme:t}=e;return{th:{color:W("gray.600","gray.400")(e),borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...W1},td:{borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...W1},caption:{color:W("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e)},td:{background:W(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),_2e={simple:v2e,striped:b2e,unstyled:{}},S2e={sm:Vd({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Vd({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Vd({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},x2e=m2e({baseStyle:y2e,variants:_2e,sizes:S2e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),Kr=ke("tabs-color"),wo=ke("tabs-bg"),X0=ke("tabs-border-color"),{defineMultiStyleConfig:w2e,definePartsStyle:va}=Ve(BV.keys),C2e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},E2e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},T2e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},A2e={p:4},P2e=va(e=>({root:C2e(e),tab:E2e(e),tablist:T2e(e),tabpanel:A2e})),k2e={sm:va({tab:{py:1,px:4,fontSize:"sm"}}),md:va({tab:{fontSize:"md",py:2,px:4}}),lg:va({tab:{fontSize:"lg",py:3,px:4}})},I2e=va(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[Kr.variable]:`colors.${t}.600`,_dark:{[Kr.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[wo.variable]:"colors.gray.200",_dark:{[wo.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:Kr.reference,bg:wo.reference}}}),M2e=va(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[X0.variable]:"transparent",_selected:{[Kr.variable]:`colors.${t}.600`,[X0.variable]:"colors.white",_dark:{[Kr.variable]:`colors.${t}.300`,[X0.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:X0.reference},color:Kr.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),R2e=va(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[wo.variable]:"colors.gray.50",_dark:{[wo.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[wo.variable]:"colors.white",[Kr.variable]:`colors.${t}.600`,_dark:{[wo.variable]:"colors.gray.800",[Kr.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:Kr.reference,bg:wo.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),O2e=va(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:Or(n,`${t}.700`),bg:Or(n,`${t}.100`)}}}}),$2e=va(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[Kr.variable]:"colors.gray.600",_dark:{[Kr.variable]:"inherit"},_selected:{[Kr.variable]:"colors.white",[wo.variable]:`colors.${t}.600`,_dark:{[Kr.variable]:"colors.gray.800",[wo.variable]:`colors.${t}.300`}},color:Kr.reference,bg:wo.reference}}}),N2e=va({}),D2e={line:I2e,enclosed:M2e,"enclosed-colored":R2e,"soft-rounded":O2e,"solid-rounded":$2e,unstyled:N2e},L2e=w2e({baseStyle:P2e,sizes:k2e,variants:D2e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),yn=b_e("badge",["bg","color","shadow"]),F2e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:yn.bg.reference,color:yn.color.reference,boxShadow:yn.shadow.reference},B2e=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.500`,.6)(n);return{[yn.bg.variable]:`colors.${t}.500`,[yn.color.variable]:"colors.white",_dark:{[yn.bg.variable]:r,[yn.color.variable]:"colors.whiteAlpha.800"}}},z2e=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.200`,.16)(n);return{[yn.bg.variable]:`colors.${t}.100`,[yn.color.variable]:`colors.${t}.800`,_dark:{[yn.bg.variable]:r,[yn.color.variable]:`colors.${t}.200`}}},V2e=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.200`,.8)(n);return{[yn.color.variable]:`colors.${t}.500`,_dark:{[yn.color.variable]:r},[yn.shadow.variable]:`inset 0 0 0px 1px ${yn.color.reference}`}},j2e={solid:B2e,subtle:z2e,outline:V2e},yp={baseStyle:F2e,variants:j2e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:U2e,definePartsStyle:Hu}=Ve(RSe.keys),J8=ke("tag-bg"),e9=ke("tag-color"),fw=ke("tag-shadow"),nv=ke("tag-min-height"),rv=ke("tag-min-width"),iv=ke("tag-font-size"),ov=ke("tag-padding-inline"),G2e={fontWeight:"medium",lineHeight:1.2,outline:0,[e9.variable]:yn.color.reference,[J8.variable]:yn.bg.reference,[fw.variable]:yn.shadow.reference,color:e9.reference,bg:J8.reference,boxShadow:fw.reference,borderRadius:"md",minH:nv.reference,minW:rv.reference,fontSize:iv.reference,px:ov.reference,_focusVisible:{[fw.variable]:"shadows.outline"}},H2e={lineHeight:1.2,overflow:"visible"},q2e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},W2e=Hu({container:G2e,label:H2e,closeButton:q2e}),K2e={sm:Hu({container:{[nv.variable]:"sizes.5",[rv.variable]:"sizes.5",[iv.variable]:"fontSizes.xs",[ov.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:Hu({container:{[nv.variable]:"sizes.6",[rv.variable]:"sizes.6",[iv.variable]:"fontSizes.sm",[ov.variable]:"space.2"}}),lg:Hu({container:{[nv.variable]:"sizes.8",[rv.variable]:"sizes.8",[iv.variable]:"fontSizes.md",[ov.variable]:"space.3"}})},X2e={subtle:Hu(e=>{var t;return{container:(t=yp.variants)==null?void 0:t.subtle(e)}}),solid:Hu(e=>{var t;return{container:(t=yp.variants)==null?void 0:t.solid(e)}}),outline:Hu(e=>{var t;return{container:(t=yp.variants)==null?void 0:t.outline(e)}})},Q2e=U2e({variants:X2e,baseStyle:W2e,sizes:K2e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Ja,defineMultiStyleConfig:Y2e}=Ve(IV.keys),dd=ke("input-height"),fd=ke("input-font-size"),hd=ke("input-padding"),pd=ke("input-border-radius"),Z2e=Ja({addon:{height:dd.reference,fontSize:fd.reference,px:hd.reference,borderRadius:pd.reference},field:{width:"100%",height:dd.reference,fontSize:fd.reference,px:hd.reference,borderRadius:pd.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),Ls={lg:{[fd.variable]:"fontSizes.lg",[hd.variable]:"space.4",[pd.variable]:"radii.md",[dd.variable]:"sizes.12"},md:{[fd.variable]:"fontSizes.md",[hd.variable]:"space.4",[pd.variable]:"radii.md",[dd.variable]:"sizes.10"},sm:{[fd.variable]:"fontSizes.sm",[hd.variable]:"space.3",[pd.variable]:"radii.sm",[dd.variable]:"sizes.8"},xs:{[fd.variable]:"fontSizes.xs",[hd.variable]:"space.2",[pd.variable]:"radii.sm",[dd.variable]:"sizes.6"}},J2e={lg:Ja({field:Ls.lg,group:Ls.lg}),md:Ja({field:Ls.md,group:Ls.md}),sm:Ja({field:Ls.sm,group:Ls.sm}),xs:Ja({field:Ls.xs,group:Ls.xs})};function OT(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||W("blue.500","blue.300")(e),errorBorderColor:n||W("red.500","red.300")(e)}}var exe=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=OT(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:W("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Or(t,r),boxShadow:`0 0 0 1px ${Or(t,r)}`},_focusVisible:{zIndex:1,borderColor:Or(t,n),boxShadow:`0 0 0 1px ${Or(t,n)}`}},addon:{border:"1px solid",borderColor:W("inherit","whiteAlpha.50")(e),bg:W("gray.100","whiteAlpha.300")(e)}}}),txe=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=OT(e);return{field:{border:"2px solid",borderColor:"transparent",bg:W("gray.100","whiteAlpha.50")(e),_hover:{bg:W("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Or(t,r)},_focusVisible:{bg:"transparent",borderColor:Or(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:W("gray.100","whiteAlpha.50")(e)}}}),nxe=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=OT(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Or(t,r),boxShadow:`0px 1px 0px 0px ${Or(t,r)}`},_focusVisible:{borderColor:Or(t,n),boxShadow:`0px 1px 0px 0px ${Or(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),rxe=Ja({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),ixe={outline:exe,filled:txe,flushed:nxe,unstyled:rxe},gt=Y2e({baseStyle:Z2e,sizes:J2e,variants:ixe,defaultProps:{size:"md",variant:"outline"}}),t9,oxe={...(t9=gt.baseStyle)==null?void 0:t9.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},n9,r9,axe={outline:e=>{var t,n;return(n=(t=gt.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=gt.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=gt.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(r9=(n9=gt.variants)==null?void 0:n9.unstyled.field)!=null?r9:{}},i9,o9,a9,s9,l9,u9,c9,d9,sxe={xs:(o9=(i9=gt.sizes)==null?void 0:i9.xs.field)!=null?o9:{},sm:(s9=(a9=gt.sizes)==null?void 0:a9.sm.field)!=null?s9:{},md:(u9=(l9=gt.sizes)==null?void 0:l9.md.field)!=null?u9:{},lg:(d9=(c9=gt.sizes)==null?void 0:c9.lg.field)!=null?d9:{}},lxe={baseStyle:oxe,sizes:sxe,variants:axe,defaultProps:{size:"md",variant:"outline"}},Q0=tn("tooltip-bg"),hw=tn("tooltip-fg"),uxe=tn("popper-arrow-bg"),cxe={bg:Q0.reference,color:hw.reference,[Q0.variable]:"colors.gray.700",[hw.variable]:"colors.whiteAlpha.900",_dark:{[Q0.variable]:"colors.gray.300",[hw.variable]:"colors.gray.900"},[uxe.variable]:Q0.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},dxe={baseStyle:cxe},{defineMultiStyleConfig:fxe,definePartsStyle:Qh}=Ve(NV.keys),hxe=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=W(K8(),K8("1rem","rgba(0,0,0,0.1)"))(e),a=W(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( + to right, + transparent 0%, + ${Or(n,a)} 50%, + transparent 100% + )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},pxe={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},gxe=e=>({bg:W("gray.100","whiteAlpha.300")(e)}),mxe=e=>({transitionProperty:"common",transitionDuration:"slow",...hxe(e)}),yxe=Qh(e=>({label:pxe,filledTrack:mxe(e),track:gxe(e)})),vxe={xs:Qh({track:{h:"1"}}),sm:Qh({track:{h:"2"}}),md:Qh({track:{h:"3"}}),lg:Qh({track:{h:"4"}})},bxe=fxe({sizes:vxe,baseStyle:yxe,defaultProps:{size:"md",colorScheme:"blue"}}),_xe=e=>typeof e=="function";function Nr(e,...t){return _xe(e)?e(...t):e}var{definePartsStyle:av,defineMultiStyleConfig:Sxe}=Ve(PV.keys),vp=ke("checkbox-size"),xxe=e=>{const{colorScheme:t}=e;return{w:vp.reference,h:vp.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:W(`${t}.500`,`${t}.200`)(e),borderColor:W(`${t}.500`,`${t}.200`)(e),color:W("white","gray.900")(e),_hover:{bg:W(`${t}.600`,`${t}.300`)(e),borderColor:W(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:W("gray.200","transparent")(e),bg:W("gray.200","whiteAlpha.300")(e),color:W("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:W(`${t}.500`,`${t}.200`)(e),borderColor:W(`${t}.500`,`${t}.200`)(e),color:W("white","gray.900")(e)},_disabled:{bg:W("gray.100","whiteAlpha.100")(e),borderColor:W("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:W("red.500","red.300")(e)}}},wxe={_disabled:{cursor:"not-allowed"}},Cxe={userSelect:"none",_disabled:{opacity:.4}},Exe={transitionProperty:"transform",transitionDuration:"normal"},Txe=av(e=>({icon:Exe,container:wxe,control:Nr(xxe,e),label:Cxe})),Axe={sm:av({control:{[vp.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:av({control:{[vp.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:av({control:{[vp.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},K1=Sxe({baseStyle:Txe,sizes:Axe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Pxe,definePartsStyle:sv}=Ve(kSe.keys),kxe=e=>{var t;const n=(t=Nr(K1.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},Ixe=sv(e=>{var t,n,r,i;return{label:(n=(t=K1).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=K1).baseStyle)==null?void 0:i.call(r,e).container,control:kxe(e)}}),Mxe={md:sv({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:sv({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:sv({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},Rxe=Pxe({baseStyle:Ixe,sizes:Mxe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Oxe,definePartsStyle:$xe}=Ve(DV.keys),Y0=ke("select-bg"),f9,Nxe={...(f9=gt.baseStyle)==null?void 0:f9.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Y0.reference,[Y0.variable]:"colors.white",_dark:{[Y0.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Y0.reference}},Dxe={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},Lxe=$xe({field:Nxe,icon:Dxe}),Z0={paddingInlineEnd:"8"},h9,p9,g9,m9,y9,v9,b9,_9,Fxe={lg:{...(h9=gt.sizes)==null?void 0:h9.lg,field:{...(p9=gt.sizes)==null?void 0:p9.lg.field,...Z0}},md:{...(g9=gt.sizes)==null?void 0:g9.md,field:{...(m9=gt.sizes)==null?void 0:m9.md.field,...Z0}},sm:{...(y9=gt.sizes)==null?void 0:y9.sm,field:{...(v9=gt.sizes)==null?void 0:v9.sm.field,...Z0}},xs:{...(b9=gt.sizes)==null?void 0:b9.xs,field:{...(_9=gt.sizes)==null?void 0:_9.xs.field,...Z0},icon:{insetEnd:"1"}}},Bxe=Oxe({baseStyle:Lxe,sizes:Fxe,variants:gt.variants,defaultProps:gt.defaultProps}),pw=ke("skeleton-start-color"),gw=ke("skeleton-end-color"),zxe={[pw.variable]:"colors.gray.100",[gw.variable]:"colors.gray.400",_dark:{[pw.variable]:"colors.gray.800",[gw.variable]:"colors.gray.600"},background:pw.reference,borderColor:gw.reference,opacity:.7,borderRadius:"sm"},Vxe={baseStyle:zxe},mw=ke("skip-link-bg"),jxe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[mw.variable]:"colors.white",_dark:{[mw.variable]:"colors.gray.700"},bg:mw.reference}},Uxe={baseStyle:jxe},{defineMultiStyleConfig:Gxe,definePartsStyle:mS}=Ve(LV.keys),Lg=ke("slider-thumb-size"),Fg=ke("slider-track-size"),el=ke("slider-bg"),Hxe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...RT({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},qxe=e=>({...RT({orientation:e.orientation,horizontal:{h:Fg.reference},vertical:{w:Fg.reference}}),overflow:"hidden",borderRadius:"sm",[el.variable]:"colors.gray.200",_dark:{[el.variable]:"colors.whiteAlpha.200"},_disabled:{[el.variable]:"colors.gray.300",_dark:{[el.variable]:"colors.whiteAlpha.300"}},bg:el.reference}),Wxe=e=>{const{orientation:t}=e;return{...RT({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:Lg.reference,h:Lg.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},Kxe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[el.variable]:`colors.${t}.500`,_dark:{[el.variable]:`colors.${t}.200`},bg:el.reference}},Xxe=mS(e=>({container:Hxe(e),track:qxe(e),thumb:Wxe(e),filledTrack:Kxe(e)})),Qxe=mS({container:{[Lg.variable]:"sizes.4",[Fg.variable]:"sizes.1"}}),Yxe=mS({container:{[Lg.variable]:"sizes.3.5",[Fg.variable]:"sizes.1"}}),Zxe=mS({container:{[Lg.variable]:"sizes.2.5",[Fg.variable]:"sizes.0.5"}}),Jxe={lg:Qxe,md:Yxe,sm:Zxe},ewe=Gxe({baseStyle:Xxe,sizes:Jxe,defaultProps:{size:"md",colorScheme:"blue"}}),Eu=tn("spinner-size"),twe={width:[Eu.reference],height:[Eu.reference]},nwe={xs:{[Eu.variable]:"sizes.3"},sm:{[Eu.variable]:"sizes.4"},md:{[Eu.variable]:"sizes.6"},lg:{[Eu.variable]:"sizes.8"},xl:{[Eu.variable]:"sizes.12"}},rwe={baseStyle:twe,sizes:nwe,defaultProps:{size:"md"}},{defineMultiStyleConfig:iwe,definePartsStyle:jV}=Ve(ISe.keys),owe={fontWeight:"medium"},awe={opacity:.8,marginBottom:"2"},swe={verticalAlign:"baseline",fontWeight:"semibold"},lwe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},uwe=jV({container:{},label:owe,helpText:awe,number:swe,icon:lwe}),cwe={md:jV({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},dwe=iwe({baseStyle:uwe,sizes:cwe,defaultProps:{size:"md"}}),yw=ke("kbd-bg"),fwe={[yw.variable]:"colors.gray.100",_dark:{[yw.variable]:"colors.whiteAlpha.100"},bg:yw.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},hwe={baseStyle:fwe},pwe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},gwe={baseStyle:pwe},{defineMultiStyleConfig:mwe,definePartsStyle:ywe}=Ve(PSe.keys),vwe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},bwe=ywe({icon:vwe}),_we=mwe({baseStyle:bwe}),{defineMultiStyleConfig:Swe,definePartsStyle:xwe}=Ve(MV.keys),Zo=ke("menu-bg"),vw=ke("menu-shadow"),wwe={[Zo.variable]:"#fff",[vw.variable]:"shadows.sm",_dark:{[Zo.variable]:"colors.gray.700",[vw.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:Zo.reference,boxShadow:vw.reference},Cwe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[Zo.variable]:"colors.gray.100",_dark:{[Zo.variable]:"colors.whiteAlpha.100"}},_active:{[Zo.variable]:"colors.gray.200",_dark:{[Zo.variable]:"colors.whiteAlpha.200"}},_expanded:{[Zo.variable]:"colors.gray.100",_dark:{[Zo.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:Zo.reference},Ewe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},Twe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},Awe={opacity:.6},Pwe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},kwe={transitionProperty:"common",transitionDuration:"normal"},Iwe=xwe({button:kwe,list:wwe,item:Cwe,groupTitle:Ewe,icon:Twe,command:Awe,divider:Pwe}),Mwe=Swe({baseStyle:Iwe}),{defineMultiStyleConfig:Rwe,definePartsStyle:d3}=Ve(RV.keys),bw=ke("modal-bg"),_w=ke("modal-shadow"),Owe={bg:"blackAlpha.600",zIndex:"modal"},$we=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},Nwe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[bw.variable]:"colors.white",[_w.variable]:"shadows.lg",_dark:{[bw.variable]:"colors.gray.700",[_w.variable]:"shadows.dark-lg"},bg:bw.reference,boxShadow:_w.reference}},Dwe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},Lwe={position:"absolute",top:"2",insetEnd:"3"},Fwe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},Bwe={px:"6",py:"4"},zwe=d3(e=>({overlay:Owe,dialogContainer:Nr($we,e),dialog:Nr(Nwe,e),header:Dwe,closeButton:Lwe,body:Nr(Fwe,e),footer:Bwe}));function po(e){return d3(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var Vwe={xs:po("xs"),sm:po("sm"),md:po("md"),lg:po("lg"),xl:po("xl"),"2xl":po("2xl"),"3xl":po("3xl"),"4xl":po("4xl"),"5xl":po("5xl"),"6xl":po("6xl"),full:po("full")},jwe=Rwe({baseStyle:zwe,sizes:Vwe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:Uwe,definePartsStyle:UV}=Ve(OV.keys),$T=tn("number-input-stepper-width"),GV=tn("number-input-input-padding"),Gwe=Xa($T).add("0.5rem").toString(),Sw=tn("number-input-bg"),xw=tn("number-input-color"),ww=tn("number-input-border-color"),Hwe={[$T.variable]:"sizes.6",[GV.variable]:Gwe},qwe=e=>{var t,n;return(n=(t=Nr(gt.baseStyle,e))==null?void 0:t.field)!=null?n:{}},Wwe={width:$T.reference},Kwe={borderStart:"1px solid",borderStartColor:ww.reference,color:xw.reference,bg:Sw.reference,[xw.variable]:"colors.chakra-body-text",[ww.variable]:"colors.chakra-border-color",_dark:{[xw.variable]:"colors.whiteAlpha.800",[ww.variable]:"colors.whiteAlpha.300"},_active:{[Sw.variable]:"colors.gray.200",_dark:{[Sw.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},Xwe=UV(e=>{var t;return{root:Hwe,field:(t=Nr(qwe,e))!=null?t:{},stepperGroup:Wwe,stepper:Kwe}});function J0(e){var t,n,r;const i=(t=gt.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=CV.fontSizes[a];return UV({field:{...i.field,paddingInlineEnd:GV.reference,verticalAlign:"top"},stepper:{fontSize:Xa(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var Qwe={xs:J0("xs"),sm:J0("sm"),md:J0("md"),lg:J0("lg")},Ywe=Uwe({baseStyle:Xwe,sizes:Qwe,variants:gt.variants,defaultProps:gt.defaultProps}),S9,Zwe={...(S9=gt.baseStyle)==null?void 0:S9.field,textAlign:"center"},Jwe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},x9,w9,eCe={outline:e=>{var t,n,r;return(r=(n=Nr((t=gt.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=Nr((t=gt.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=Nr((t=gt.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(w9=(x9=gt.variants)==null?void 0:x9.unstyled.field)!=null?w9:{}},tCe={baseStyle:Zwe,sizes:Jwe,variants:eCe,defaultProps:gt.defaultProps},{defineMultiStyleConfig:nCe,definePartsStyle:rCe}=Ve($V.keys),ey=tn("popper-bg"),iCe=tn("popper-arrow-bg"),C9=tn("popper-arrow-shadow-color"),oCe={zIndex:10},aCe={[ey.variable]:"colors.white",bg:ey.reference,[iCe.variable]:ey.reference,[C9.variable]:"colors.gray.200",_dark:{[ey.variable]:"colors.gray.700",[C9.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},sCe={px:3,py:2,borderBottomWidth:"1px"},lCe={px:3,py:2},uCe={px:3,py:2,borderTopWidth:"1px"},cCe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},dCe=rCe({popper:oCe,content:aCe,header:sCe,body:lCe,footer:uCe,closeButton:cCe}),fCe=nCe({baseStyle:dCe}),{definePartsStyle:f3,defineMultiStyleConfig:hCe}=Ve(ESe.keys),Cw=ke("drawer-bg"),Ew=ke("drawer-box-shadow");function Lc(e){return f3(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var pCe={bg:"blackAlpha.600",zIndex:"modal"},gCe={display:"flex",zIndex:"modal",justifyContent:"center"},mCe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[Cw.variable]:"colors.white",[Ew.variable]:"shadows.lg",_dark:{[Cw.variable]:"colors.gray.700",[Ew.variable]:"shadows.dark-lg"},bg:Cw.reference,boxShadow:Ew.reference}},yCe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},vCe={position:"absolute",top:"2",insetEnd:"3"},bCe={px:"6",py:"2",flex:"1",overflow:"auto"},_Ce={px:"6",py:"4"},SCe=f3(e=>({overlay:pCe,dialogContainer:gCe,dialog:Nr(mCe,e),header:yCe,closeButton:vCe,body:bCe,footer:_Ce})),xCe={xs:Lc("xs"),sm:Lc("md"),md:Lc("lg"),lg:Lc("2xl"),xl:Lc("4xl"),full:Lc("full")},wCe=hCe({baseStyle:SCe,sizes:xCe,defaultProps:{size:"xs"}}),{definePartsStyle:CCe,defineMultiStyleConfig:ECe}=Ve(kV.keys),TCe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},ACe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},PCe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},kCe=CCe({preview:TCe,input:ACe,textarea:PCe}),ICe=ECe({baseStyle:kCe}),{definePartsStyle:MCe,defineMultiStyleConfig:RCe}=Ve(TSe.keys),jd=ke("form-control-color"),OCe={marginStart:"1",[jd.variable]:"colors.red.500",_dark:{[jd.variable]:"colors.red.300"},color:jd.reference},$Ce={mt:"2",[jd.variable]:"colors.gray.600",_dark:{[jd.variable]:"colors.whiteAlpha.600"},color:jd.reference,lineHeight:"normal",fontSize:"sm"},NCe=MCe({container:{width:"100%",position:"relative"},requiredIndicator:OCe,helperText:$Ce}),DCe=RCe({baseStyle:NCe}),{definePartsStyle:LCe,defineMultiStyleConfig:FCe}=Ve(ASe.keys),Ud=ke("form-error-color"),BCe={[Ud.variable]:"colors.red.500",_dark:{[Ud.variable]:"colors.red.300"},color:Ud.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},zCe={marginEnd:"0.5em",[Ud.variable]:"colors.red.500",_dark:{[Ud.variable]:"colors.red.300"},color:Ud.reference},VCe=LCe({text:BCe,icon:zCe}),jCe=FCe({baseStyle:VCe}),UCe={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},GCe={baseStyle:UCe},HCe={fontFamily:"heading",fontWeight:"bold"},qCe={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},WCe={baseStyle:HCe,sizes:qCe,defaultProps:{size:"xl"}},{defineMultiStyleConfig:KCe,definePartsStyle:XCe}=Ve(CSe.keys),Tw=ke("breadcrumb-link-decor"),QCe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:Tw.reference,[Tw.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[Tw.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},YCe=XCe({link:QCe}),ZCe=KCe({baseStyle:YCe}),JCe={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},HV=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:W("gray.800","whiteAlpha.900")(e),_hover:{bg:W("gray.100","whiteAlpha.200")(e)},_active:{bg:W("gray.200","whiteAlpha.300")(e)}};const r=Sf(`${t}.200`,.12)(n),i=Sf(`${t}.200`,.24)(n);return{color:W(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:W(`${t}.50`,r)(e)},_active:{bg:W(`${t}.100`,i)(e)}}},e5e=e=>{const{colorScheme:t}=e,n=W("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...Nr(HV,e)}},t5e={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},n5e=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=W("gray.100","whiteAlpha.200")(e);return{bg:l,color:W("gray.800","whiteAlpha.900")(e),_hover:{bg:W("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:W("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=t5e[n])!=null?t:{},s=W(r,`${n}.200`)(e);return{bg:s,color:W(i,"gray.800")(e),_hover:{bg:W(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:W(a,`${n}.400`)(e)}}},r5e=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:W(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:W(`${t}.700`,`${t}.500`)(e)}}},i5e={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},o5e={ghost:HV,outline:e5e,solid:n5e,link:r5e,unstyled:i5e},a5e={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},s5e={baseStyle:JCe,variants:o5e,sizes:a5e,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:qu,defineMultiStyleConfig:l5e}=Ve(OSe.keys),X1=ke("card-bg"),is=ke("card-padding"),qV=ke("card-shadow"),lv=ke("card-radius"),WV=ke("card-border-width","0"),KV=ke("card-border-color"),u5e=qu({container:{[X1.variable]:"colors.chakra-body-bg",backgroundColor:X1.reference,boxShadow:qV.reference,borderRadius:lv.reference,color:"chakra-body-text",borderWidth:WV.reference,borderColor:KV.reference},body:{padding:is.reference,flex:"1 1 0%"},header:{padding:is.reference},footer:{padding:is.reference}}),c5e={sm:qu({container:{[lv.variable]:"radii.base",[is.variable]:"space.3"}}),md:qu({container:{[lv.variable]:"radii.md",[is.variable]:"space.5"}}),lg:qu({container:{[lv.variable]:"radii.xl",[is.variable]:"space.7"}})},d5e={elevated:qu({container:{[qV.variable]:"shadows.base",_dark:{[X1.variable]:"colors.gray.700"}}}),outline:qu({container:{[WV.variable]:"1px",[KV.variable]:"colors.chakra-border-color"}}),filled:qu({container:{[X1.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[is.variable]:0},header:{[is.variable]:0},footer:{[is.variable]:0}}},f5e=l5e({baseStyle:u5e,variants:d5e,sizes:c5e,defaultProps:{variant:"elevated",size:"md"}}),bp=tn("close-button-size"),_h=tn("close-button-bg"),h5e={w:[bp.reference],h:[bp.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[_h.variable]:"colors.blackAlpha.100",_dark:{[_h.variable]:"colors.whiteAlpha.100"}},_active:{[_h.variable]:"colors.blackAlpha.200",_dark:{[_h.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:_h.reference},p5e={lg:{[bp.variable]:"sizes.10",fontSize:"md"},md:{[bp.variable]:"sizes.8",fontSize:"xs"},sm:{[bp.variable]:"sizes.6",fontSize:"2xs"}},g5e={baseStyle:h5e,sizes:p5e,defaultProps:{size:"md"}},{variants:m5e,defaultProps:y5e}=yp,v5e={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:yn.bg.reference,color:yn.color.reference,boxShadow:yn.shadow.reference},b5e={baseStyle:v5e,variants:m5e,defaultProps:y5e},_5e={w:"100%",mx:"auto",maxW:"prose",px:"4"},S5e={baseStyle:_5e},x5e={opacity:.6,borderColor:"inherit"},w5e={borderStyle:"solid"},C5e={borderStyle:"dashed"},E5e={solid:w5e,dashed:C5e},T5e={baseStyle:x5e,variants:E5e,defaultProps:{variant:"solid"}},{definePartsStyle:A5e,defineMultiStyleConfig:P5e}=Ve(AV.keys),k5e={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},I5e={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},M5e={pt:"2",px:"4",pb:"5"},R5e={fontSize:"1.25em"},O5e=A5e({container:k5e,button:I5e,panel:M5e,icon:R5e}),$5e=P5e({baseStyle:O5e}),{definePartsStyle:Om,defineMultiStyleConfig:N5e}=Ve(xSe.keys),xi=ke("alert-fg"),bs=ke("alert-bg"),D5e=Om({container:{bg:bs.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:xi.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:xi.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function NT(e){const{theme:t,colorScheme:n}=e,r=Sf(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var L5e=Om(e=>{const{colorScheme:t}=e,n=NT(e);return{container:{[xi.variable]:`colors.${t}.600`,[bs.variable]:n.light,_dark:{[xi.variable]:`colors.${t}.200`,[bs.variable]:n.dark}}}}),F5e=Om(e=>{const{colorScheme:t}=e,n=NT(e);return{container:{[xi.variable]:`colors.${t}.600`,[bs.variable]:n.light,_dark:{[xi.variable]:`colors.${t}.200`,[bs.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:xi.reference}}}),B5e=Om(e=>{const{colorScheme:t}=e,n=NT(e);return{container:{[xi.variable]:`colors.${t}.600`,[bs.variable]:n.light,_dark:{[xi.variable]:`colors.${t}.200`,[bs.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:xi.reference}}}),z5e=Om(e=>{const{colorScheme:t}=e;return{container:{[xi.variable]:"colors.white",[bs.variable]:`colors.${t}.600`,_dark:{[xi.variable]:"colors.gray.900",[bs.variable]:`colors.${t}.200`},color:xi.reference}}}),V5e={subtle:L5e,"left-accent":F5e,"top-accent":B5e,solid:z5e},j5e=N5e({baseStyle:D5e,variants:V5e,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:XV,defineMultiStyleConfig:U5e}=Ve(wSe.keys),Gd=ke("avatar-border-color"),_p=ke("avatar-bg"),Bg=ke("avatar-font-size"),xf=ke("avatar-size"),G5e={borderRadius:"full",border:"0.2em solid",borderColor:Gd.reference,[Gd.variable]:"white",_dark:{[Gd.variable]:"colors.gray.800"}},H5e={bg:_p.reference,fontSize:Bg.reference,width:xf.reference,height:xf.reference,lineHeight:"1",[_p.variable]:"colors.gray.200",_dark:{[_p.variable]:"colors.whiteAlpha.400"}},q5e=e=>{const{name:t,theme:n}=e,r=t?JSe({string:t}):"colors.gray.400",i=YSe(r)(n);let o="white";return i||(o="gray.800"),{bg:_p.reference,fontSize:Bg.reference,color:o,borderColor:Gd.reference,verticalAlign:"top",width:xf.reference,height:xf.reference,"&:not([data-loaded])":{[_p.variable]:r},[Gd.variable]:"colors.white",_dark:{[Gd.variable]:"colors.gray.800"}}},W5e={fontSize:Bg.reference,lineHeight:"1"},K5e=XV(e=>({badge:Nr(G5e,e),excessLabel:Nr(H5e,e),container:Nr(q5e,e),label:W5e}));function Fs(e){const t=e!=="100%"?TV[e]:void 0;return XV({container:{[xf.variable]:t??e,[Bg.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[xf.variable]:t??e,[Bg.variable]:`calc(${t??e} / 2.5)`}})}var X5e={"2xs":Fs(4),xs:Fs(6),sm:Fs(8),md:Fs(12),lg:Fs(16),xl:Fs(24),"2xl":Fs(32),full:Fs("100%")},Q5e=U5e({baseStyle:K5e,sizes:X5e,defaultProps:{size:"md"}}),Y5e={Accordion:$5e,Alert:j5e,Avatar:Q5e,Badge:yp,Breadcrumb:ZCe,Button:s5e,Checkbox:K1,CloseButton:g5e,Code:b5e,Container:S5e,Divider:T5e,Drawer:wCe,Editable:ICe,Form:DCe,FormError:jCe,FormLabel:GCe,Heading:WCe,Input:gt,Kbd:hwe,Link:gwe,List:_we,Menu:Mwe,Modal:jwe,NumberInput:Ywe,PinInput:tCe,Popover:fCe,Progress:bxe,Radio:Rxe,Select:Bxe,Skeleton:Vxe,SkipLink:Uxe,Slider:ewe,Spinner:rwe,Stat:dwe,Switch:g2e,Table:x2e,Tabs:L2e,Tag:Q2e,Textarea:lxe,Tooltip:dxe,Card:f5e,Stepper:SSe},Z5e={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},J5e={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},e3e="ltr",t3e={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},n3e={semanticTokens:Z5e,direction:e3e,...vSe,components:Y5e,styles:J5e,config:t3e};function r3e(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function i3e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},QV=o3e(i3e);function YV(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var ZV=e=>YV(e,t=>t!=null);function a3e(e){return typeof e=="function"}function JV(e,...t){return a3e(e)?e(...t):e}function PUe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var s3e=typeof Element<"u",l3e=typeof Map=="function",u3e=typeof Set=="function",c3e=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function uv(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!uv(e[r],t[r]))return!1;return!0}var o;if(l3e&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!uv(r.value[1],t.get(r.value[0])))return!1;return!0}if(u3e&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(c3e&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();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;if(s3e&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!uv(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var d3e=function(t,n){try{return uv(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const f3e=Bl(d3e);function ej(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=mV(),s=e?QV(o,`components.${e}`):void 0,l=r||s,u=ca({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},ZV(r3e(i,["children"]))),c=k.useRef({});if(l){const f=K_e(l)(u);f3e(c.current,f)||(c.current=f)}return c.current}function $m(e,t={}){return ej(e,t)}function h3e(e,t={}){return ej(e,t)}var p3e=new Set([...D_e,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),g3e=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function m3e(e){return g3e.has(e)||!p3e.has(e)}function y3e(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function v3e(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var b3e=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,_3e=oV(function(e){return b3e.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),S3e=_3e,x3e=function(t){return t!=="theme"},E9=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?S3e:x3e},T9=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},w3e=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return sV(n,r,i),hbe(function(){return lV(n,r,i)}),null},C3e=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=T9(t,n,r),l=s||E9(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=YV(a,(d,f)=>F_e(f)),l=JV(e,t),u=y3e({},i,l,ZV(s),o),c=wV(u)(t.theme);return r?[c,r]:c};function Aw(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=m3e);const i=A3e({baseStyle:n}),o=T3e(e,r)(i);return J.forwardRef(function(l,u){const{colorMode:c,forced:d}=fS();return J.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function P3e(){const e=new Map;return new Proxy(Aw,{apply(t,n,r){return Aw(...r)},get(t,n){return e.has(n)||e.set(n,Aw(n)),e.get(n)}})}var lr=P3e();function Ii(e){return k.forwardRef(e)}function k3e(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=k.createContext(void 0);i.displayName=r;function o(){var a;const s=k.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function I3e(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=k.useMemo(()=>$_e(n),[n]);return oe.jsxs(mbe,{theme:i,children:[oe.jsx(M3e,{root:t}),r]})}function M3e({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return oe.jsx(hV,{styles:n=>({[t]:n.__cssVars})})}k3e({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function kUe(){const{colorMode:e}=fS();return oe.jsx(hV,{styles:t=>{const n=QV(t,"styles.global"),r=JV(n,{theme:t,colorMode:e});return r?wV(r)(t):void 0}})}var R3e=(e,t)=>e.find(n=>n.id===t);function P9(e,t){const n=tj(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function tj(e,t){for(const[n,r]of Object.entries(e))if(R3e(r,t))return n}function O3e(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function $3e(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function N3e(e,t=[]){const n=k.useRef(e);return k.useEffect(()=>{n.current=e}),k.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function D3e(e,t){const n=N3e(e);k.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function k9(e,t){const n=k.useRef(!1),r=k.useRef(!1);k.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),k.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const nj=k.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),yS=k.createContext({}),Nm=k.createContext(null),vS=typeof document<"u",DT=vS?k.useLayoutEffect:k.useEffect,rj=k.createContext({strict:!1});function L3e(e,t,n,r){const{visualElement:i}=k.useContext(yS),o=k.useContext(rj),a=k.useContext(Nm),s=k.useContext(nj).reducedMotion,l=k.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;k.useInsertionEffect(()=>{u&&u.update(n,a)});const c=k.useRef(!!window.HandoffAppearAnimations);return DT(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),k.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function gd(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function F3e(e,t,n){return k.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gd(n)&&(n.current=r))},[t])}function zg(e){return typeof e=="string"||Array.isArray(e)}function bS(e){return typeof e=="object"&&typeof e.start=="function"}const LT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],FT=["initial",...LT];function _S(e){return bS(e.animate)||FT.some(t=>zg(e[t]))}function ij(e){return!!(_S(e)||e.variants)}function B3e(e,t){if(_S(e)){const{initial:n,animate:r}=e;return{initial:n===!1||zg(n)?n:void 0,animate:zg(r)?r:void 0}}return e.inherit!==!1?t:{}}function z3e(e){const{initial:t,animate:n}=B3e(e,k.useContext(yS));return k.useMemo(()=>({initial:t,animate:n}),[I9(t),I9(n)])}function I9(e){return Array.isArray(e)?e.join(" "):e}const M9={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Vg={};for(const e in M9)Vg[e]={isEnabled:t=>M9[e].some(n=>!!t[n])};function V3e(e){for(const t in e)Vg[t]={...Vg[t],...e[t]}}const BT=k.createContext({}),oj=k.createContext({}),j3e=Symbol.for("motionComponentSymbol");function U3e({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&V3e(e);function o(s,l){let u;const c={...k.useContext(nj),...s,layoutId:G3e(s)},{isStatic:d}=c,f=z3e(s),h=r(s,d);if(!d&&vS){f.visualElement=L3e(i,h,c,t);const p=k.useContext(oj),g=k.useContext(rj).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,g,e,p))}return k.createElement(yS.Provider,{value:f},u&&f.visualElement?k.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,F3e(h,f.visualElement,l),h,d,f.visualElement))}const a=k.forwardRef(o);return a[j3e]=i,a}function G3e({layoutId:e}){const t=k.useContext(BT).id;return t&&e!==void 0?t+"-"+e:e}function H3e(e){function t(r,i={}){return U3e(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const q3e=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function zT(e){return typeof e!="string"||e.includes("-")?!1:!!(q3e.indexOf(e)>-1||/[A-Z]/.test(e))}const Y1={};function W3e(e){Object.assign(Y1,e)}const Dm=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hc=new Set(Dm);function aj(e,{layout:t,layoutId:n}){return hc.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Y1[e]||e==="opacity")}const ai=e=>!!(e&&e.getVelocity),K3e={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},X3e=Dm.length;function Q3e(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),lj=sj("--"),h3=sj("var(--"),Y3e=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,Z3e=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ol=(e,t,n)=>Math.min(Math.max(n,e),t),pc={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Sp={...pc,transform:e=>Ol(0,1,e)},ty={...pc,default:1},xp=e=>Math.round(e*1e5)/1e5,SS=/(-)?([\d]*\.?[\d])+/g,uj=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,J3e=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lm(e){return typeof e=="string"}const Fm=e=>({test:t=>Lm(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vs=Fm("deg"),ba=Fm("%"),Re=Fm("px"),e4e=Fm("vh"),t4e=Fm("vw"),R9={...ba,parse:e=>ba.parse(e)/100,transform:e=>ba.transform(e*100)},O9={...pc,transform:Math.round},cj={borderWidth:Re,borderTopWidth:Re,borderRightWidth:Re,borderBottomWidth:Re,borderLeftWidth:Re,borderRadius:Re,radius:Re,borderTopLeftRadius:Re,borderTopRightRadius:Re,borderBottomRightRadius:Re,borderBottomLeftRadius:Re,width:Re,maxWidth:Re,height:Re,maxHeight:Re,size:Re,top:Re,right:Re,bottom:Re,left:Re,padding:Re,paddingTop:Re,paddingRight:Re,paddingBottom:Re,paddingLeft:Re,margin:Re,marginTop:Re,marginRight:Re,marginBottom:Re,marginLeft:Re,rotate:Vs,rotateX:Vs,rotateY:Vs,rotateZ:Vs,scale:ty,scaleX:ty,scaleY:ty,scaleZ:ty,skew:Vs,skewX:Vs,skewY:Vs,distance:Re,translateX:Re,translateY:Re,translateZ:Re,x:Re,y:Re,z:Re,perspective:Re,transformPerspective:Re,opacity:Sp,originX:R9,originY:R9,originZ:Re,zIndex:O9,fillOpacity:Sp,strokeOpacity:Sp,numOctaves:O9};function VT(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(lj(d)){o[d]=f;continue}const h=cj[d],p=Z3e(f,h);if(hc.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=Q3e(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const jT=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function dj(e,t,n){for(const r in t)!ai(t[r])&&!aj(r,n)&&(e[r]=t[r])}function n4e({transformTemplate:e},t,n){return k.useMemo(()=>{const r=jT();return VT(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function r4e(e,t,n){const r=e.style||{},i={};return dj(i,r,e),Object.assign(i,n4e(e,t,n)),e.transformValues?e.transformValues(i):i}function i4e(e,t,n){const r={},i=r4e(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const o4e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Z1(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||o4e.has(e)}let fj=e=>!Z1(e);function a4e(e){e&&(fj=t=>t.startsWith("on")?!Z1(t):e(t))}try{a4e(require("@emotion/is-prop-valid").default)}catch{}function s4e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(fj(i)||n===!0&&Z1(i)||!t&&!Z1(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function $9(e,t,n){return typeof e=="string"?e:Re.transform(t+n*e)}function l4e(e,t,n){const r=$9(t,e.x,e.width),i=$9(n,e.y,e.height);return`${r} ${i}`}const u4e={offset:"stroke-dashoffset",array:"stroke-dasharray"},c4e={offset:"strokeDashoffset",array:"strokeDasharray"};function d4e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?u4e:c4e;e[o.offset]=Re.transform(-r);const a=Re.transform(t),s=Re.transform(n);e[o.array]=`${a} ${s}`}function UT(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(VT(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:g}=e;h.transform&&(g&&(p.transform=h.transform),delete h.transform),g&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=l4e(g,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&d4e(h,a,s,l,!1)}const hj=()=>({...jT(),attrs:{}}),GT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function f4e(e,t,n,r){const i=k.useMemo(()=>{const o=hj();return UT(o,t,{enableHardwareAcceleration:!1},GT(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};dj(o,e.style,e),i.style={...o,...i.style}}return i}function h4e(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(zT(n)?f4e:i4e)(r,o,a,n),c={...s4e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=k.useMemo(()=>ai(d)?d.get():d,[d]);return k.createElement(n,{...c,children:f})}}const HT=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function pj(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const gj=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function mj(e,t,n,r){pj(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(gj.has(i)?i:HT(i),t.attrs[i])}function qT(e,t){const{style:n}=e,r={};for(const i in n)(ai(n[i])||t.style&&ai(t.style[i])||aj(i,e))&&(r[i]=n[i]);return r}function yj(e,t){const n=qT(e,t);for(const r in e)if(ai(e[r])||ai(t[r])){const i=Dm.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function WT(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function vj(e){const t=k.useRef(null);return t.current===null&&(t.current=e()),t.current}const J1=e=>Array.isArray(e),p4e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),g4e=e=>J1(e)?e[e.length-1]||0:e;function cv(e){const t=ai(e)?e.get():e;return p4e(t)?t.toValue():t}function m4e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:y4e(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const bj=e=>(t,n)=>{const r=k.useContext(yS),i=k.useContext(Nm),o=()=>m4e(e,t,r,i);return n?o():vj(o)};function y4e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=cv(o[f]);let{initial:a,animate:s}=e;const l=_S(e),u=ij(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!bS(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=WT(e,h);if(!p)return;const{transitionEnd:g,transition:_,...b}=p;for(const y in b){let m=b[y];if(Array.isArray(m)){const v=c?m.length-1:0;m=m[v]}m!==null&&(i[y]=m)}for(const y in g)i[y]=g[y]}),i}const cn=e=>e;class N9{constructor(){this.order=[],this.scheduled=new Set}add(t){if(!this.scheduled.has(t))return this.scheduled.add(t),this.order.push(t),!0}remove(t){const n=this.order.indexOf(t);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(t))}clear(){this.order.length=0,this.scheduled.clear()}}function v4e(e){let t=new N9,n=new N9,r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.add(l)&&d&&i&&(r=t.order.length),l},cancel:l=>{n.remove(l),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.clear(),r=t.order.length,r)for(let u=0;u(d[f]=v4e(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,b4e),1),i.timestamp=d,i.isProcessing=!0,ny.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:ny.reduce((d,f)=>{const h=o[f];return d[f]=(p,g=!1,_=!1)=>(n||l(),h.schedule(p,g,_)),d},{}),cancel:d=>ny.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:Rt,cancel:_s,state:zn,steps:Pw}=_4e(typeof requestAnimationFrame<"u"?requestAnimationFrame:cn,!0),S4e={useVisualState:bj({scrapeMotionValuesFromProps:yj,createRenderState:hj,onMount:(e,t,{renderState:n,latestValues:r})=>{Rt.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Rt.render(()=>{UT(n,r,{enableHardwareAcceleration:!1},GT(t.tagName),e.transformTemplate),mj(t,n)})}})},x4e={useVisualState:bj({scrapeMotionValuesFromProps:qT,createRenderState:jT})};function w4e(e,{forwardMotionProps:t=!1},n,r){return{...zT(e)?S4e:x4e,preloadedFeatures:n,useRender:h4e(t),createVisualElement:r,Component:e}}function es(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const _j=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function xS(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const C4e=e=>t=>_j(t)&&e(t,xS(t));function os(e,t,n,r){return es(e,t,C4e(n),r)}const E4e=(e,t)=>n=>t(e(n)),_l=(...e)=>e.reduce(E4e);function Sj(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const D9=Sj("dragHorizontal"),L9=Sj("dragVertical");function xj(e){let t=!1;if(e==="y")t=L9();else if(e==="x")t=D9();else{const n=D9(),r=L9();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function wj(){const e=xj(!0);return e?(e(),!1):!0}class Xl{constructor(t){this.isMounted=!1,this.node=t}update(){}}function F9(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||wj())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&Rt.update(()=>s[r](o,a))};return os(e.current,n,i,{passive:!e.getProps()[r]})}class T4e extends Xl{mount(){this.unmount=_l(F9(this.node,!0),F9(this.node,!1))}unmount(){}}class A4e extends Xl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=_l(es(this.node.current,"focus",()=>this.onFocus()),es(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Cj=(e,t)=>t?e===t?!0:Cj(e,t.parentElement):!1;function kw(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,xS(n))}class P4e extends Xl{constructor(){super(...arguments),this.removeStartListeners=cn,this.removeEndListeners=cn,this.removeAccessibleListeners=cn,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=os(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();Rt.update(()=>{Cj(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=os(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=_l(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||kw("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&Rt.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=es(this.node.current,"keyup",a),kw("down",(s,l)=>{this.startPress(s,l)})},n=es(this.node.current,"keydown",t),r=()=>{this.isPressing&&kw("cancel",(o,a)=>this.cancelPress(o,a))},i=es(this.node.current,"blur",r);this.removeAccessibleListeners=_l(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Rt.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!wj()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Rt.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=os(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=es(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=_l(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const p3=new WeakMap,Iw=new WeakMap,k4e=e=>{const t=p3.get(e.target);t&&t(e)},I4e=e=>{e.forEach(k4e)};function M4e({root:e,...t}){const n=e||document;Iw.has(n)||Iw.set(n,{});const r=Iw.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(I4e,{root:e,...t})),r[i]}function R4e(e,t,n){const r=M4e(t);return p3.set(e,n),r.observe(e),()=>{p3.delete(e),r.unobserve(e)}}const O4e={some:0,all:1};class $4e extends Xl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:O4e[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return R4e(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(N4e(t,n))&&this.startObserver()}unmount(){}}function N4e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const D4e={inView:{Feature:$4e},tap:{Feature:P4e},focus:{Feature:A4e},hover:{Feature:T4e}};function Ej(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function F4e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function wS(e,t,n){const r=e.getProps();return WT(r,t,n!==void 0?n:r.custom,L4e(e),F4e(e))}const B4e="framerAppearId",z4e="data-"+HT(B4e);let V4e=cn,KT=cn;const Sl=e=>e*1e3,as=e=>e/1e3,j4e={current:!1},Tj=e=>Array.isArray(e)&&typeof e[0]=="number";function Aj(e){return!!(!e||typeof e=="string"&&Pj[e]||Tj(e)||Array.isArray(e)&&e.every(Aj))}const Yh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Pj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yh([0,.65,.55,1]),circOut:Yh([.55,0,1,.45]),backIn:Yh([.31,.01,.66,-.59]),backOut:Yh([.33,1.53,.69,.99])};function kj(e){if(e)return Tj(e)?Yh(e):Array.isArray(e)?e.map(kj):Pj[e]}function U4e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=kj(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function G4e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const Ij=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,H4e=1e-7,q4e=12;function W4e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=Ij(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>H4e&&++sW4e(o,0,1,e,n);return o=>o===0||o===1?o:Ij(i(o),t,r)}const K4e=Bm(.42,0,1,1),X4e=Bm(0,0,.58,1),Mj=Bm(.42,0,.58,1),Q4e=e=>Array.isArray(e)&&typeof e[0]!="number",Rj=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Oj=e=>t=>1-e(1-t),$j=e=>1-Math.sin(Math.acos(e)),XT=Oj($j),Y4e=Rj(XT),Nj=Bm(.33,1.53,.69,.99),QT=Oj(Nj),Z4e=Rj(QT),J4e=e=>(e*=2)<1?.5*QT(e):.5*(2-Math.pow(2,-10*(e-1))),eEe={linear:cn,easeIn:K4e,easeInOut:Mj,easeOut:X4e,circIn:$j,circInOut:Y4e,circOut:XT,backIn:QT,backInOut:Z4e,backOut:Nj,anticipate:J4e},B9=e=>{if(Array.isArray(e)){KT(e.length===4);const[t,n,r,i]=e;return Bm(t,n,r,i)}else if(typeof e=="string")return eEe[e];return e},YT=(e,t)=>n=>!!(Lm(n)&&J3e.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),Dj=(e,t,n)=>r=>{if(!Lm(r))return r;const[i,o,a,s]=r.match(SS);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},tEe=e=>Ol(0,255,e),Mw={...pc,transform:e=>Math.round(tEe(e))},$u={test:YT("rgb","red"),parse:Dj("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Mw.transform(e)+", "+Mw.transform(t)+", "+Mw.transform(n)+", "+xp(Sp.transform(r))+")"};function nEe(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const g3={test:YT("#"),parse:nEe,transform:$u.transform},md={test:YT("hsl","hue"),parse:Dj("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ba.transform(xp(t))+", "+ba.transform(xp(n))+", "+xp(Sp.transform(r))+")"},Ir={test:e=>$u.test(e)||g3.test(e)||md.test(e),parse:e=>$u.test(e)?$u.parse(e):md.test(e)?md.parse(e):g3.parse(e),transform:e=>Lm(e)?e:e.hasOwnProperty("red")?$u.transform(e):md.transform(e)},Zt=(e,t,n)=>-n*e+n*t+e;function Rw(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function rEe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=Rw(l,s,e+1/3),o=Rw(l,s,e),a=Rw(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const Ow=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},iEe=[g3,$u,md],oEe=e=>iEe.find(t=>t.test(e));function z9(e){const t=oEe(e);let n=t.parse(e);return t===md&&(n=rEe(n)),n}const Lj=(e,t)=>{const n=z9(e),r=z9(t),i={...n};return o=>(i.red=Ow(n.red,r.red,o),i.green=Ow(n.green,r.green,o),i.blue=Ow(n.blue,r.blue,o),i.alpha=Zt(n.alpha,r.alpha,o),$u.transform(i))};function aEe(e){var t,n;return isNaN(e)&&Lm(e)&&(((t=e.match(SS))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(uj))===null||n===void 0?void 0:n.length)||0)>0}const Fj={regex:Y3e,countKey:"Vars",token:"${v}",parse:cn},Bj={regex:uj,countKey:"Colors",token:"${c}",parse:Ir.parse},zj={regex:SS,countKey:"Numbers",token:"${n}",parse:pc.parse};function $w(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function eb(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&$w(n,Fj),$w(n,Bj),$w(n,zj),n}function Vj(e){return eb(e).values}function jj(e){const{values:t,numColors:n,numVars:r,tokenised:i}=eb(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function lEe(e){const t=Vj(e);return jj(e)(t.map(sEe))}const $l={test:aEe,parse:Vj,createTransformer:jj,getAnimatableNone:lEe},Uj=(e,t)=>n=>`${n>0?t:e}`;function Gj(e,t){return typeof e=="number"?n=>Zt(e,t,n):Ir.test(e)?Lj(e,t):e.startsWith("var(")?Uj(e,t):qj(e,t)}const Hj=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>Gj(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Gj(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},qj=(e,t)=>{const n=$l.createTransformer(t),r=eb(e),i=eb(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?_l(Hj(r.values,i.values),n):Uj(e,t)},jg=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},V9=(e,t)=>n=>Zt(e,t,n);function cEe(e){return typeof e=="number"?V9:typeof e=="string"?Ir.test(e)?Lj:qj:Array.isArray(e)?Hj:typeof e=="object"?uEe:V9}function dEe(e,t,n){const r=[],i=n||cEe(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=dEe(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(Ol(e[0],e[o-1],u)):l}function fEe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=jg(0,t,r);e.push(Zt(n,1,i))}}function hEe(e){const t=[0];return fEe(t,e.length-1),t}function pEe(e,t){return e.map(n=>n*t)}function gEe(e,t){return e.map(()=>t||Mj).splice(0,e.length-1)}function tb({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=Q4e(r)?r.map(B9):B9(r),o={done:!1,value:t[0]},a=pEe(n&&n.length===t.length?n:hEe(t),e),s=Wj(a,t,{ease:Array.isArray(i)?i:gEe(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function Kj(e,t){return t?e*(1e3/t):0}const mEe=5;function Xj(e,t,n){const r=Math.max(t-mEe,0);return Kj(n-e(r),t-r)}const Nw=.001,yEe=.01,j9=10,vEe=.05,bEe=1;function _Ee({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;V4e(e<=Sl(j9));let a=1-t;a=Ol(vEe,bEe,a),e=Ol(yEe,j9,as(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=m3(u,a),p=Math.exp(-d);return Nw-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),g=m3(Math.pow(u,2),a);return(-i(u)+Nw>0?-1:1)*((f-h)*p)/g}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-Nw+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=xEe(i,o,s);if(e=Sl(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const SEe=12;function xEe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function EEe(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!U9(e,CEe)&&U9(e,wEe)){const n=_Ee(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function Qj({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=EEe(r),h=c?-as(c):0,p=l/(2*Math.sqrt(s*u)),g=o-i,_=as(Math.sqrt(s/u)),b=Math.abs(g)<5;n||(n=b?.01:2),t||(t=b?.005:.5);let y;if(p<1){const m=m3(_,p);y=v=>{const S=Math.exp(-p*_*v);return o-S*((h+p*_*g)/m*Math.sin(m*v)+g*Math.cos(m*v))}}else if(p===1)y=m=>o-Math.exp(-_*m)*(g+(h+_*g)*m);else{const m=_*Math.sqrt(p*p-1);y=v=>{const S=Math.exp(-p*_*v),w=Math.min(m*v,300);return o-S*((h+p*_*g)*Math.sinh(w)+m*g*Math.cosh(w))/m}}return{calculatedDuration:f&&d||null,next:m=>{const v=y(m);if(f)a.done=m>=d;else{let S=h;m!==0&&(p<1?S=Xj(y,m,v):S=0);const w=Math.abs(S)<=n,C=Math.abs(o-v)<=t;a.done=w&&C}return a.value=a.done?o:v,a}}}function G9({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=x=>s!==void 0&&xl,p=x=>s===void 0?l:l===void 0||Math.abs(s-x)-g*Math.exp(-x/r),m=x=>b+y(x),v=x=>{const P=y(x),E=m(x);f.done=Math.abs(P)<=u,f.value=f.done?b:E};let S,w;const C=x=>{h(f.value)&&(S=x,w=Qj({keyframes:[f.value,p(f.value)],velocity:Xj(m,x,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return C(0),{calculatedDuration:null,next:x=>{let P=!1;return!w&&S===void 0&&(P=!0,v(x),C(x)),S!==void 0&&x>S?w.next(x-S):(!P&&v(x),f)}}}const TEe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Rt.update(t,!0),stop:()=>_s(t),now:()=>zn.isProcessing?zn.timestamp:performance.now()}},H9=2e4;function q9(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=H9?1/0:t}const AEe={decay:G9,inertia:G9,tween:tb,keyframes:tb,spring:Qj};function nb({autoplay:e=!0,delay:t=0,driver:n=TEe,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,g,_;const b=()=>{_=new Promise(B=>{g=B})};b();let y;const m=AEe[i]||tb;let v;m!==tb&&typeof r[0]!="number"&&(v=Wj([0,100],r,{clamp:!1}),r=[0,100]);const S=m({...f,keyframes:r});let w;s==="mirror"&&(w=m({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let C="idle",x=null,P=null,E=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=q9(S));const{calculatedDuration:I}=S;let N=1/0,M=1/0;I!==null&&(N=I+a,M=N*(o+1)-a);let T=0;const A=B=>{if(P===null)return;h>0&&(P=Math.min(P,B)),h<0&&(P=Math.min(B-M/h,P)),x!==null?T=x:T=Math.round(B-P)*h;const U=T-t*(h>=0?1:-1),j=h>=0?U<0:U>M;T=Math.max(U,0),C==="finished"&&x===null&&(T=M);let q=T,Y=S;if(o){const ee=T/N;let re=Math.floor(ee),fe=ee%1;!fe&&ee>=1&&(fe=1),fe===1&&re--,re=Math.min(re,o+1);const Se=!!(re%2);Se&&(s==="reverse"?(fe=1-fe,a&&(fe-=a/N)):s==="mirror"&&(Y=w));let Me=Ol(0,1,fe);T>M&&(Me=s==="reverse"&&Se?1:0),q=Me*N}const Z=j?{done:!1,value:r[0]}:Y.next(q);v&&(Z.value=v(Z.value));let{done:V}=Z;!j&&I!==null&&(V=h>=0?T>=M:T<=0);const K=x===null&&(C==="finished"||C==="running"&&V);return d&&d(Z.value),K&&$(),Z},R=()=>{y&&y.stop(),y=void 0},D=()=>{C="idle",R(),g(),b(),P=E=null},$=()=>{C="finished",c&&c(),R(),g()},L=()=>{if(p)return;y||(y=n(A));const B=y.now();l&&l(),x!==null?P=B-x:(!P||C==="finished")&&(P=B),C==="finished"&&b(),E=P,x=null,C="running",y.start()};e&&L();const O={then(B,U){return _.then(B,U)},get time(){return as(T)},set time(B){B=Sl(B),T=B,x!==null||!y||h===0?x=B:P=y.now()-B/h},get duration(){const B=S.calculatedDuration===null?q9(S):S.calculatedDuration;return as(B)},get speed(){return h},set speed(B){B===h||!y||(h=B,O.time=as(T))},get state(){return C},play:L,pause:()=>{C="paused",x=T},stop:()=>{p=!0,C!=="idle"&&(C="idle",u&&u(),D())},cancel:()=>{E!==null&&A(E),D()},complete:()=>{C="finished"},sample:B=>(P=0,A(B))};return O}function PEe(e){let t;return()=>(t===void 0&&(t=e()),t)}const kEe=PEe(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),IEe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),ry=10,MEe=2e4,REe=(e,t)=>t.type==="spring"||e==="backgroundColor"||!Aj(t.ease);function OEe(e,t,{onUpdate:n,onComplete:r,...i}){if(!(kEe()&&IEe.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(y=>{s=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(REe(t,i)){const y=nb({...i,repeat:0,delay:0});let m={done:!1,value:c[0]};const v=[];let S=0;for(;!m.done&&Sp.cancel(),_=()=>{Rt.update(g),s(),u()};return p.onfinish=()=>{e.set(G4e(c,i)),r&&r(),_()},{then(y,m){return l.then(y,m)},attachTimeline(y){return p.timeline=y,p.onfinish=null,cn},get time(){return as(p.currentTime||0)},set time(y){p.currentTime=Sl(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return as(d)},play:()=>{a||(p.play(),_s(g))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const m=nb({...i,autoplay:!1});e.setWithVelocity(m.sample(y-ry).value,m.sample(y).value,ry)}_()},complete:()=>p.finish(),cancel:_}}function $Ee({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:cn,pause:cn,stop:cn,then:o=>(o(),Promise.resolve()),cancel:cn,complete:cn});return t?nb({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const NEe={type:"spring",stiffness:500,damping:25,restSpeed:10},DEe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),LEe={type:"keyframes",duration:.8},FEe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},BEe=(e,{keyframes:t})=>t.length>2?LEe:hc.has(e)?e.startsWith("scale")?DEe(t[1]):NEe:FEe,y3=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&($l.test(t)||t==="0")&&!t.startsWith("url(")),zEe=new Set(["brightness","contrast","saturate","opacity"]);function VEe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(SS)||[];if(!r)return e;const i=n.replace(r,"");let o=zEe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const jEe=/([a-z-]*)\(.*?\)/g,v3={...$l,getAnimatableNone:e=>{const t=e.match(jEe);return t?t.map(VEe).join(" "):e}},UEe={...cj,color:Ir,backgroundColor:Ir,outlineColor:Ir,fill:Ir,stroke:Ir,borderColor:Ir,borderTopColor:Ir,borderRightColor:Ir,borderBottomColor:Ir,borderLeftColor:Ir,filter:v3,WebkitFilter:v3},ZT=e=>UEe[e];function Yj(e,t){let n=ZT(e);return n!==v3&&(n=$l),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Zj=e=>/^0[^.\s]+$/.test(e);function GEe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||Zj(e)}function HEe(e,t,n,r){const i=y3(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=Jj(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-Sl(a);const l=HEe(t,e,n,o),u=l[0],c=l[l.length-1],d=y3(e,u),f=y3(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(qEe(o)||(h={...h,...BEe(e,h)}),h.duration&&(h.duration=Sl(h.duration)),h.repeatDelay&&(h.repeatDelay=Sl(h.repeatDelay)),!d||!f||j4e.current||o.type===!1)return $Ee(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=OEe(t,e,h);if(p)return p}return nb(h)};function rb(e){return!!(ai(e)&&e.add)}const eU=e=>/^\-?\d*\.?\d+$/.test(e);function eA(e,t){e.indexOf(t)===-1&&e.push(t)}function tA(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class nA{constructor(){this.subscriptions=[]}add(t){return eA(this.subscriptions,t),()=>tA(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class KEe{constructor(t,n={}){this.version="10.16.4",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=zn;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,Rt.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Rt.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=WEe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new nA);const r=this.events[t].add(n);return t==="change"?()=>{r(),Rt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Kj(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function wf(e,t){return new KEe(e,t)}const tU=e=>t=>t.test(e),XEe={test:e=>e==="auto",parse:e=>e},nU=[pc,Re,ba,Vs,t4e,e4e,XEe],Sh=e=>nU.find(tU(e)),QEe=[...nU,Ir,$l],YEe=e=>QEe.find(tU(e));function ZEe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,wf(n))}function JEe(e,t){const n=wS(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=g4e(o[a]);ZEe(e,a,s)}}function eTe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(g)}return a&&Promise.all(u).then(()=>{a&&JEe(e,a)}),u}function b3(e,t,n={}){const r=wS(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(rU(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return iTe(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function iTe(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(oTe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(b3(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function oTe(e,t){return e.sortNodePosition(t)}function aTe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>b3(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=b3(e,t,n);else{const i=typeof t=="function"?wS(e,t,n.custom):t;r=Promise.all(rU(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const sTe=[...LT].reverse(),lTe=LT.length;function uTe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>aTe(e,n,r)))}function cTe(e){let t=uTe(e);const n=fTe();let r=!0;const i=(l,u)=>{const c=wS(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},g=1/0;for(let b=0;bg&&S;const E=Array.isArray(v)?v:[v];let I=E.reduce(i,{});w===!1&&(I={});const{prevResolvedValues:N={}}=m,M={...N,...I},T=A=>{P=!0,h.delete(A),m.needsAnimating[A]=!0};for(const A in M){const R=I[A],D=N[A];p.hasOwnProperty(A)||(R!==D?J1(R)&&J1(D)?!Ej(R,D)||x?T(A):m.protectedKeys[A]=!0:R!==void 0?T(A):h.add(A):R!==void 0&&h.has(A)?T(A):m.protectedKeys[A]=!0)}m.prevProp=v,m.prevResolvedValues=I,m.isActive&&(p={...p,...I}),r&&e.blockInitialAnimation&&(P=!1),P&&!C&&f.push(...E.map(A=>({animation:A,options:{type:y,...l}})))}if(h.size){const b={};h.forEach(y=>{const m=e.getBaseTarget(y);m!==void 0&&(b[y]=m)}),f.push({animation:b})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function dTe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Ej(t,e):!1}function uu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fTe(){return{animate:uu(!0),whileInView:uu(),whileHover:uu(),whileTap:uu(),whileDrag:uu(),whileFocus:uu(),exit:uu()}}class hTe extends Xl{constructor(t){super(t),t.animationState||(t.animationState=cTe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),bS(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let pTe=0;class gTe extends Xl{constructor(){super(...arguments),this.id=pTe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const mTe={animation:{Feature:hTe},exit:{Feature:gTe}},W9=(e,t)=>Math.abs(e-t);function yTe(e,t){const n=W9(e.x,t.x),r=W9(e.y,t.y);return Math.sqrt(n**2+r**2)}class iU{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=Lw(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=yTe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=zn;this.history.push({...f,timestamp:h});const{onStart:p,onMove:g}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=Dw(c,this.transformPagePoint),Rt.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=Lw(u.type==="pointercancel"?this.lastMoveEventInfo:Dw(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!_j(t))return;this.handlers=n,this.transformPagePoint=r;const i=xS(t),o=Dw(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=zn;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,Lw(o,this.history)),this.removeListeners=_l(os(window,"pointermove",this.handlePointerMove),os(window,"pointerup",this.handlePointerUp),os(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),_s(this.updatePoint)}}function Dw(e,t){return t?{point:t(e.point)}:e}function K9(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Lw({point:e},t){return{point:e,delta:K9(e,oU(t)),offset:K9(e,vTe(t)),velocity:bTe(t,.1)}}function vTe(e){return e[0]}function oU(e){return e[e.length-1]}function bTe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=oU(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Sl(t)));)n--;if(!r)return{x:0,y:0};const o=as(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Ti(e){return e.max-e.min}function _3(e,t=0,n=.01){return Math.abs(e-t)<=n}function X9(e,t,n,r=.5){e.origin=r,e.originPoint=Zt(t.min,t.max,e.origin),e.scale=Ti(n)/Ti(t),(_3(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Zt(n.min,n.max,e.origin)-e.originPoint,(_3(e.translate)||isNaN(e.translate))&&(e.translate=0)}function wp(e,t,n,r){X9(e.x,t.x,n.x,r?r.originX:void 0),X9(e.y,t.y,n.y,r?r.originY:void 0)}function Q9(e,t,n){e.min=n.min+t.min,e.max=e.min+Ti(t)}function _Te(e,t,n){Q9(e.x,t.x,n.x),Q9(e.y,t.y,n.y)}function Y9(e,t,n){e.min=t.min-n.min,e.max=e.min+Ti(t)}function Cp(e,t,n){Y9(e.x,t.x,n.x),Y9(e.y,t.y,n.y)}function STe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Zt(n,e,r.max):Math.min(e,n)),e}function Z9(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function xTe(e,{top:t,left:n,bottom:r,right:i}){return{x:Z9(e.x,n,i),y:Z9(e.y,t,r)}}function J9(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=jg(t.min,t.max-r,e.min):r>i&&(n=jg(e.min,e.max-i,t.min)),Ol(0,1,n)}function ETe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const S3=.35;function TTe(e=S3){return e===!1?e=0:e===!0&&(e=S3),{x:eM(e,"left","right"),y:eM(e,"top","bottom")}}function eM(e,t,n){return{min:tM(e,t),max:tM(e,n)}}function tM(e,t){return typeof e=="number"?e:e[t]||0}const nM=()=>({translate:0,scale:1,origin:0,originPoint:0}),yd=()=>({x:nM(),y:nM()}),rM=()=>({min:0,max:0}),xn=()=>({x:rM(),y:rM()});function Xo(e){return[e("x"),e("y")]}function aU({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function ATe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function PTe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Fw(e){return e===void 0||e===1}function x3({scale:e,scaleX:t,scaleY:n}){return!Fw(e)||!Fw(t)||!Fw(n)}function vu(e){return x3(e)||sU(e)||e.z||e.rotate||e.rotateX||e.rotateY}function sU(e){return iM(e.x)||iM(e.y)}function iM(e){return e&&e!=="0%"}function ib(e,t,n){const r=e-n,i=t*r;return n+i}function oM(e,t,n,r,i){return i!==void 0&&(e=ib(e,i,r)),ib(e,n,r)+t}function w3(e,t=0,n=1,r,i){e.min=oM(e.min,t,n,r,i),e.max=oM(e.max,t,n,r,i)}function lU(e,{x:t,y:n}){w3(e.x,t.translate,t.scale,t.originPoint),w3(e.y,n.translate,n.scale,n.originPoint)}function kTe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function Ks(e,t){e.min=e.min+t,e.max=e.max+t}function sM(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=Zt(e.min,e.max,o);w3(e,t[n],t[r],a,t.scale)}const ITe=["x","scaleX","originX"],MTe=["y","scaleY","originY"];function vd(e,t){sM(e.x,t,ITe),sM(e.y,t,MTe)}function uU(e,t){return aU(PTe(e.getBoundingClientRect(),t))}function RTe(e,t,n){const r=uU(e,n),{scroll:i}=t;return i&&(Ks(r.x,i.offset.x),Ks(r.y,i.offset.y)),r}const OTe=new WeakMap;class $Te{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=xn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(xS(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=xj(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Xo(p=>{let g=this.getAxisMotionValue(p).get()||0;if(ba.test(g)){const{projection:_}=this.visualElement;if(_&&_.layout){const b=_.layout.layoutBox[p];b&&(g=Ti(b)*(parseFloat(g)/100))}}this.originPoint[p]=g}),f&&Rt.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=NTe(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new iU(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&Rt.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!iy(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=STe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&gd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=xTe(r.layoutBox,t):this.constraints=!1,this.elastic=TTe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Xo(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=ETe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gd(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=RTe(r,i.root,this.visualElement.getTransformPagePoint());let a=wTe(i.layout.layoutBox,o);if(n){const s=n(ATe(a));this.hasMutatedConstraints=!!s,s&&(a=aU(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=Xo(c=>{if(!iy(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(JT(t,r,0,n))}stopAnimation(){Xo(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Xo(n=>{const{drag:r}=this.getProps();if(!iy(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-Zt(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Xo(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=CTe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Xo(a=>{if(!iy(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(Zt(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;OTe.set(this.visualElement,this);const t=this.visualElement.current,n=os(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();gd(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=es(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Xo(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=S3,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function iy(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function NTe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class DTe extends Xl{constructor(t){super(t),this.removeGroupControls=cn,this.removeListeners=cn,this.controls=new $Te(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||cn}unmount(){this.removeGroupControls(),this.removeListeners()}}const lM=e=>(t,n)=>{e&&Rt.update(()=>e(t,n))};class LTe extends Xl{constructor(){super(...arguments),this.removePointerDownListener=cn}onPointerDown(t){this.session=new iU(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:lM(t),onStart:lM(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&Rt.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=os(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function FTe(){const e=k.useContext(Nm);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=k.useId();return k.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function BTe(){return zTe(k.useContext(Nm))}function zTe(e){return e===null?!0:e.isPresent}const dv={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function uM(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const xh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Re.test(e))e=parseFloat(e);else return e;const n=uM(e,t.target.x),r=uM(e,t.target.y);return`${n}% ${r}%`}},VTe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=$l.parse(e);if(i.length>5)return r;const o=$l.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=Zt(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class jTe extends J.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;W3e(UTe),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),dv.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||Rt.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function cU(e){const[t,n]=FTe(),r=k.useContext(BT);return J.createElement(jTe,{...e,layoutGroup:r,switchLayoutGroup:k.useContext(oj),isPresent:t,safeToRemove:n})}const UTe={borderRadius:{...xh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:xh,borderTopRightRadius:xh,borderBottomLeftRadius:xh,borderBottomRightRadius:xh,boxShadow:VTe},dU=["TopLeft","TopRight","BottomLeft","BottomRight"],GTe=dU.length,cM=e=>typeof e=="string"?parseFloat(e):e,dM=e=>typeof e=="number"||Re.test(e);function HTe(e,t,n,r,i,o){i?(e.opacity=Zt(0,n.opacity!==void 0?n.opacity:1,qTe(r)),e.opacityExit=Zt(t.opacity!==void 0?t.opacity:1,0,WTe(r))):o&&(e.opacity=Zt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(jg(e,t,r))}function hM(e,t){e.min=t.min,e.max=t.max}function Li(e,t){hM(e.x,t.x),hM(e.y,t.y)}function pM(e,t,n,r,i){return e-=t,e=ib(e,1/n,r),i!==void 0&&(e=ib(e,1/i,r)),e}function KTe(e,t=0,n=1,r=.5,i,o=e,a=e){if(ba.test(t)&&(t=parseFloat(t),t=Zt(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=Zt(o.min,o.max,r);e===o&&(s-=t),e.min=pM(e.min,t,n,s,i),e.max=pM(e.max,t,n,s,i)}function gM(e,t,[n,r,i],o,a){KTe(e,t[n],t[r],t[i],t.scale,o,a)}const XTe=["x","scaleX","originX"],QTe=["y","scaleY","originY"];function mM(e,t,n,r){gM(e.x,t,XTe,n?n.x:void 0,r?r.x:void 0),gM(e.y,t,QTe,n?n.y:void 0,r?r.y:void 0)}function yM(e){return e.translate===0&&e.scale===1}function hU(e){return yM(e.x)&&yM(e.y)}function YTe(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function pU(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function vM(e){return Ti(e.x)/Ti(e.y)}class ZTe{constructor(){this.members=[]}add(t){eA(this.members,t),t.scheduleRender()}remove(t){if(tA(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function bM(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const JTe=(e,t)=>e.depth-t.depth;class eAe{constructor(){this.children=[],this.isDirty=!1}add(t){eA(this.children,t),this.isDirty=!0}remove(t){tA(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(JTe),this.isDirty=!1,this.children.forEach(t)}}function tAe(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(_s(r),e(o-t))};return Rt.read(r,!0),()=>_s(r)}function nAe(e){window.MotionDebug&&window.MotionDebug.record(e)}function rAe(e){return e instanceof SVGElement&&e.tagName!=="svg"}function iAe(e,t,n){const r=ai(e)?e:wf(e);return r.start(JT("",r,t,n)),r.animation}const _M=["","X","Y","Z"],SM=1e3;let oAe=0;const bu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function gU({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=oAe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{bu.totalNodes=bu.resolvedTargetDeltas=bu.recalculatedProjection=0,this.nodes.forEach(lAe),this.nodes.forEach(hAe),this.nodes.forEach(pAe),this.nodes.forEach(uAe),nAe(bu)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=tAe(f,250),dv.hasAnimatedSinceResize&&(dv.hasAnimatedSinceResize=!1,this.nodes.forEach(wM))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||c.getDefaultTransition()||bAe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:b}=c.getProps(),y=!this.targetLayout||!pU(this.targetLayout,p)||h,m=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,m);const v={...Jj(g,"layout"),onPlay:_,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else f||wM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_s(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(gAe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(cAe),this.sharedNodes.forEach(mAe)}scheduleUpdateProjection(){Rt.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){Rt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=v/1e3;CM(d.x,a.x,S),CM(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cp(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),yAe(this.relativeTarget,this.relativeTargetOrigin,f,S),m&&YTe(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=xn()),Li(m,this.relativeTarget)),g&&(this.animationValues=c,HTe(c,u,this.latestValues,S,y,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_s(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Rt.update(()=>{dv.hasAnimatedSinceResize=!0,this.currentAnimation=iAe(0,SM,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(SM),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&mU(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||xn();const d=Ti(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=Ti(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}Li(s,l),vd(s,c),wp(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new ZTe),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c<_M.length;c++){const d="rotate"+_M[c];l[d]&&(u[d]=l[d],a.setStaticValue(d,0))}a.render();for(const c in u)a.setStaticValue(c,u[c]);a.scheduleRender()}getProjectionStyles(a={}){var s,l;const u={};if(!this.instance||this.isSVG)return u;if(this.isVisible)u.visibility="";else return{visibility:"hidden"};const c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=cv(a.pointerEvents)||"",u.transform=c?c(this.latestValues,""):"none",u;const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){const g={};return this.options.layoutId&&(g.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,g.pointerEvents=cv(a.pointerEvents)||""),this.hasProjected&&!vu(this.latestValues)&&(g.transform=c?c({},""):"none",this.hasProjected=!1),g}const f=d.animationValues||d.latestValues;this.applyTransformsToTarget(),u.transform=bM(this.projectionDeltaWithTransform,this.treeScale,f),c&&(u.transform=c(f,u.transform));const{x:h,y:p}=this.projectionDelta;u.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,d.animationValues?u.opacity=d===this?(l=(s=f.opacity)!==null&&s!==void 0?s:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:u.opacity=d===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const g in Y1){if(f[g]===void 0)continue;const{correct:_,applyTo:b}=Y1[g],y=u.transform==="none"?f[g]:_(f[g],d);if(b){const m=b.length;for(let v=0;v{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(xM),this.root.sharedNodes.clear()}}}function aAe(e){e.updateLayout()}function sAe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Xo(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Ti(f);f.min=r[d].min,f.max=f.min+h}):mU(o,n.layoutBox,r)&&Xo(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Ti(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=yd();wp(s,r,n.layoutBox);const l=yd();a?wp(l,e.applyTransform(i,!0),n.measuredBox):wp(l,r,n.layoutBox);const u=!hU(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=xn();Cp(p,n.layoutBox,f.layoutBox);const g=xn();Cp(g,r,h.layoutBox),pU(p,g)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function lAe(e){bu.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function uAe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function cAe(e){e.clearSnapshot()}function xM(e){e.clearMeasurements()}function dAe(e){e.isLayoutDirty=!1}function fAe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function wM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hAe(e){e.resolveTargetDelta()}function pAe(e){e.calcProjection()}function gAe(e){e.resetRotation()}function mAe(e){e.removeLeadSnapshot()}function CM(e,t,n){e.translate=Zt(t.translate,0,n),e.scale=Zt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function EM(e,t,n,r){e.min=Zt(t.min,n.min,r),e.max=Zt(t.max,n.max,r)}function yAe(e,t,n,r){EM(e.x,t.x,n.x,r),EM(e.y,t.y,n.y,r)}function vAe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const bAe={duration:.45,ease:[.4,0,.1,1]},TM=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),AM=TM("applewebkit/")&&!TM("chrome/")?Math.round:cn;function PM(e){e.min=AM(e.min),e.max=AM(e.max)}function _Ae(e){PM(e.x),PM(e.y)}function mU(e,t,n){return e==="position"||e==="preserve-aspect"&&!_3(vM(t),vM(n),.2)}const SAe=gU({attachResizeListener:(e,t)=>es(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Bw={current:void 0},yU=gU({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Bw.current){const e=new SAe({});e.mount(window),e.setOptions({layoutScroll:!0}),Bw.current=e}return Bw.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),xAe={pan:{Feature:LTe},drag:{Feature:DTe,ProjectionNode:yU,MeasureLayout:cU}},wAe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function CAe(e){const t=wAe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function C3(e,t,n=1){const[r,i]=CAe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return eU(a)?parseFloat(a):a}else return h3(i)?C3(i,t,n+1):i}function EAe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!h3(o))return;const a=C3(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!h3(o))continue;const a=C3(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const TAe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),vU=e=>TAe.has(e),AAe=e=>Object.keys(e).some(vU),kM=e=>e===pc||e===Re,IM=(e,t)=>parseFloat(e.split(", ")[t]),MM=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return IM(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?IM(o[1],e):0}},PAe=new Set(["x","y","z"]),kAe=Dm.filter(e=>!PAe.has(e));function IAe(e){const t=[];return kAe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Cf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:MM(4,13),y:MM(5,14)};Cf.translateX=Cf.x;Cf.translateY=Cf.y;const MAe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=Cf[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=Cf[u](l,o)}),e},RAe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(vU);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=Sh(c);const f=t[l];let h;if(J1(f)){const p=f.length,g=f[0]===null?1:0;c=f[g],d=Sh(c);for(let _=g;_=0?window.pageYOffset:null,u=MAe(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),vS&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function OAe(e,t,n,r){return AAe(t)?RAe(e,t,n,r):{target:t,transitionEnd:r}}const $Ae=(e,t,n,r)=>{const i=EAe(e,t,r);return t=i.target,r=i.transitionEnd,OAe(e,t,n,r)},E3={current:null},bU={current:!1};function NAe(){if(bU.current=!0,!!vS)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>E3.current=e.matches;e.addListener(t),t()}else E3.current=!1}function DAe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(ai(o))e.addValue(i,o),rb(r)&&r.add(i);else if(ai(a))e.addValue(i,wf(o,{owner:e})),rb(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,wf(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const RM=new WeakMap,_U=Object.keys(Vg),LAe=_U.length,OM=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],FAe=FT.length;class BAe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Rt.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=_S(n),this.isVariantNode=ij(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&ai(f)&&(f.set(s[d],!1),rb(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,RM.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),bU.current||NAe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:E3.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){RM.delete(this.current),this.projection&&this.projection.unmount(),_s(this.notifyUpdate),_s(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=hc.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Rt.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):xn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=wf(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=WT(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!ai(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new nA),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class SU extends BAe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=nTe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){eTe(this,r,a);const s=$Ae(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function zAe(e){return window.getComputedStyle(e)}class VAe extends SU{readValueFromInstance(t,n){if(hc.has(n)){const r=ZT(n);return r&&r.default||0}else{const r=zAe(t),i=(lj(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return uU(t,n)}build(t,n,r,i){VT(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return qT(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ai(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){pj(t,n,r,i)}}class jAe extends SU{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(hc.has(n)){const r=ZT(n);return r&&r.default||0}return n=gj.has(n)?n:HT(n),t.getAttribute(n)}measureInstanceViewportBox(){return xn()}scrapeMotionValuesFromProps(t,n){return yj(t,n)}build(t,n,r,i){UT(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){mj(t,n,r,i)}mount(t){this.isSVGTag=GT(t.tagName),super.mount(t)}}const UAe=(e,t)=>zT(e)?new jAe(t,{enableHardwareAcceleration:!1}):new VAe(t,{enableHardwareAcceleration:!0}),GAe={layout:{ProjectionNode:yU,MeasureLayout:cU}},HAe={...mTe,...D4e,...xAe,...GAe},xU=H3e((e,t)=>w4e(e,t,HAe,UAe));function wU(){const e=k.useRef(!1);return DT(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function qAe(){const e=wU(),[t,n]=k.useState(0),r=k.useCallback(()=>{e.current&&n(t+1)},[t]);return[k.useCallback(()=>Rt.postRender(r),[r]),t]}class WAe extends k.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function KAe({children:e,isPresent:t}){const n=k.useId(),r=k.useRef(null),i=k.useRef({width:0,height:0,top:0,left:0});return k.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${s}px !important; + left: ${l}px !important; + } + `),()=>{document.head.removeChild(u)}},[t]),k.createElement(WAe,{isPresent:t,childRef:r,sizeRef:i},k.cloneElement(e,{ref:r}))}const zw=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=vj(XAe),l=k.useId(),u=k.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return k.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),k.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=k.createElement(KAe,{isPresent:n},e)),k.createElement(Nm.Provider,{value:u},e)};function XAe(){return new Map}function QAe(e){return k.useEffect(()=>()=>e(),[])}const Wc=e=>e.key||"";function YAe(e,t){e.forEach(n=>{const r=Wc(n);t.set(r,n)})}function ZAe(e){const t=[];return k.Children.forEach(e,n=>{k.isValidElement(n)&&t.push(n)}),t}const CU=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=k.useContext(BT).forceRender||qAe()[0],l=wU(),u=ZAe(e);let c=u;const d=k.useRef(new Map).current,f=k.useRef(c),h=k.useRef(new Map).current,p=k.useRef(!0);if(DT(()=>{p.current=!1,YAe(u,h),f.current=c}),QAe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return k.createElement(k.Fragment,null,c.map(y=>k.createElement(zw,{key:Wc(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},y)));c=[...c];const g=f.current.map(Wc),_=u.map(Wc),b=g.length;for(let y=0;y{if(_.indexOf(m)!==-1)return;const v=h.get(m);if(!v)return;const S=g.indexOf(m);let w=y;if(!w){const C=()=>{h.delete(m),d.delete(m);const x=f.current.findIndex(P=>P.key===m);if(f.current.splice(x,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};w=k.createElement(zw,{key:Wc(v),isPresent:!1,onExitComplete:C,custom:t,presenceAffectsLayout:o,mode:a},v),d.set(m,w)}c.splice(S,0,w)}),c=c.map(y=>{const m=y.key;return d.has(m)?y:k.createElement(zw,{key:Wc(y),isPresent:!0,presenceAffectsLayout:o,mode:a},y)}),k.createElement(k.Fragment,null,d.size?c:c.map(y=>k.cloneElement(y)))};var JAe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},EU=k.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=JAe,toastSpacing:c="0.5rem"}=e,[d,f]=k.useState(s),h=BTe();k9(()=>{h||r==null||r()},[h]),k9(()=>{f(s)},[s]);const p=()=>f(null),g=()=>f(s),_=()=>{h&&i()};k.useEffect(()=>{h&&o&&i()},[h,o,i]),D3e(_,d);const b=k.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),y=k.useMemo(()=>O3e(a),[a]);return oe.jsx(xU.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:g,custom:{position:a},style:y,children:oe.jsx(lr.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:ua(n,{id:t,onClose:_})})})});EU.displayName="ToastComponent";function ePe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var $M={path:oe.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[oe.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),oe.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),oe.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},zm=Ii((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Kl("chakra-icon",s),d=$m("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??$M.viewBox;if(n&&typeof n!="string")return oe.jsx(lr.svg,{as:n,...h,...u});const g=a??$M.path;return oe.jsx(lr.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:g})});zm.displayName="Icon";function tPe(e){return oe.jsx(zm,{viewBox:"0 0 24 24",...e,children:oe.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function nPe(e){return oe.jsx(zm,{viewBox:"0 0 24 24",...e,children:oe.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function NM(e){return oe.jsx(zm,{viewBox:"0 0 24 24",...e,children:oe.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var rPe=vbe({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),rA=Ii((e,t)=>{const n=$m("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Rm(e),u=Kl("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${rPe} ${o} linear infinite`,...n};return oe.jsx(lr.div,{ref:t,__css:c,className:u,...l,children:r&&oe.jsx(lr.span,{srOnly:!0,children:r})})});rA.displayName="Spinner";var[iPe,iA]=Mm({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[oPe,oA]=Mm({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),TU={info:{icon:nPe,colorScheme:"blue"},warning:{icon:NM,colorScheme:"orange"},success:{icon:tPe,colorScheme:"green"},error:{icon:NM,colorScheme:"red"},loading:{icon:rA,colorScheme:"blue"}};function aPe(e){return TU[e].colorScheme}function sPe(e){return TU[e].icon}var AU=Ii(function(t,n){const r=oA(),{status:i}=iA(),o={display:"inline",...r.description};return oe.jsx(lr.div,{ref:n,"data-status":i,...t,className:Kl("chakra-alert__desc",t.className),__css:o})});AU.displayName="AlertDescription";function PU(e){const{status:t}=iA(),n=sPe(t),r=oA(),i=t==="loading"?r.spinner:r.icon;return oe.jsx(lr.span,{display:"inherit","data-status":t,...e,className:Kl("chakra-alert__icon",e.className),__css:i,children:e.children||oe.jsx(n,{h:"100%",w:"100%"})})}PU.displayName="AlertIcon";var kU=Ii(function(t,n){const r=oA(),{status:i}=iA();return oe.jsx(lr.div,{ref:n,"data-status":i,...t,className:Kl("chakra-alert__title",t.className),__css:r.title})});kU.displayName="AlertTitle";var IU=Ii(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Rm(t),s=(r=t.colorScheme)!=null?r:aPe(i),l=h3e("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return oe.jsx(iPe,{value:{status:i},children:oe.jsx(oPe,{value:l,children:oe.jsx(lr.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Kl("chakra-alert",t.className),__css:u})})})});IU.displayName="Alert";function lPe(e){return oe.jsx(zm,{focusable:"false","aria-hidden":!0,...e,children:oe.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var MU=Ii(function(t,n){const r=$m("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Rm(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return oe.jsx(lr.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||oe.jsx(lPe,{width:"1em",height:"1em"})})});MU.displayName="CloseButton";var uPe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},ia=cPe(uPe);function cPe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=dPe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=P9(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:RU(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=tj(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!P9(ia.getState(),i).position}}var DM=0;function dPe(e,t={}){var n,r;DM+=1;const i=(n=t.id)!=null?n:DM,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>ia.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var fPe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return oe.jsxs(IU,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[oe.jsx(PU,{children:u}),oe.jsxs(lr.div,{flex:"1",maxWidth:"100%",children:[i&&oe.jsx(kU,{id:c==null?void 0:c.title,children:i}),s&&oe.jsx(AU,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&oe.jsx(MU,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function RU(e={}){const{render:t,toastComponent:n=fPe}=e;return i=>typeof t=="function"?t({...i,...e}):oe.jsx(n,{...i,...e})}function OU(e,t){const n=i=>{var o;return{...t,...i,position:ePe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=RU(o);return ia.notify(a,o)};return r.update=(i,o)=>{ia.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...ua(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...ua(o.error,s)}))},r.closeAll=ia.closeAll,r.close=ia.close,r.isActive=ia.isActive,r}var[MUe,hPe]=Mm({name:"ToastOptionsContext",strict:!1}),pPe=e=>{const t=k.useSyncExternalStore(ia.subscribe,ia.getState,ia.getState),{motionVariants:n,component:r=EU,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return oe.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${s}`,id:`chakra-toast-manager-${s}`,style:$3e(s),children:oe.jsx(CU,{initial:!1,children:l.map(u=>oe.jsx(r,{motionVariants:n,...u},u.id))})},s)});return oe.jsx(dS,{...i,children:a})};function gPe(e){const{theme:t}=mV(),n=hPe();return k.useMemo(()=>OU(t.direction,{...n,...e}),[e,t.direction,n])}var mPe={duration:5e3,variant:"solid"},Fc={theme:n3e,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:mPe,forced:!1};function yPe({theme:e=Fc.theme,colorMode:t=Fc.colorMode,toggleColorMode:n=Fc.toggleColorMode,setColorMode:r=Fc.setColorMode,defaultOptions:i=Fc.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Fc){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>oe.jsx(I3e,{theme:e,children:oe.jsx(AT.Provider,{value:u,children:oe.jsx(pPe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:OU(e.direction,i)}}var T3=Ii(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return oe.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});T3.displayName="NativeImage";function vPe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=k.useState("pending");k.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=k.useRef(),f=k.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=g=>{h(),c("loaded"),i==null||i(g)},p.onerror=g=>{h(),c("failed"),o==null||o(g)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return G1(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var bPe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function _Pe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var aA=Ii(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,g=r!==void 0||i!==void 0,_=u!=null||c||!g,b=vPe({...t,crossOrigin:d,ignoreFallback:_}),y=bPe(b,f),m={ref:n,objectFit:l,objectPosition:s,..._?p:_Pe(p,["onError","onLoad"])};return y?i||oe.jsx(lr.img,{as:T3,className:"chakra-image__placeholder",src:r,...m}):oe.jsx(lr.img,{as:T3,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...m})});aA.displayName="Image";var $U=Ii(function(t,n){const r=$m("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Rm(t),u=v3e({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return oe.jsx(lr.p,{ref:n,className:Kl("chakra-text",t.className),...u,...l,__css:r})});$U.displayName="Text";var A3=Ii(function(t,n){const r=$m("Heading",t),{className:i,...o}=Rm(t);return oe.jsx(lr.h2,{ref:n,className:Kl("chakra-heading",t.className),...o,__css:r})});A3.displayName="Heading";var ob=lr("div");ob.displayName="Box";var NU=Ii(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return oe.jsx(ob,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});NU.displayName="Square";var SPe=Ii(function(t,n){const{size:r,...i}=t;return oe.jsx(NU,{size:r,ref:n,borderRadius:"9999px",...i})});SPe.displayName="Circle";var sA=Ii(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return oe.jsx(lr.div,{ref:n,__css:d,...c})});sA.displayName="Flex";const pt=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},xPe=F.object({status:F.literal(422),data:F.object({detail:F.array(F.object({loc:F.array(F.string()),msg:F.string(),type:F.string()}))})});function Gr(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const oy={H:220,S:16},ay={H:250,S:42},sy={H:47,S:42},ly={H:40,S:70},uy={H:28,S:42},cy={H:113,S:42},dy={H:0,S:42},wPe={base:Gr(oy.H,oy.S),baseAlpha:Gr(oy.H,oy.S,!0),accent:Gr(ay.H,ay.S),accentAlpha:Gr(ay.H,ay.S,!0),working:Gr(sy.H,sy.S),workingAlpha:Gr(sy.H,sy.S,!0),gold:Gr(ly.H,ly.S),goldAlpha:Gr(ly.H,ly.S,!0),warning:Gr(uy.H,uy.S),warningAlpha:Gr(uy.H,uy.S,!0),ok:Gr(cy.H,cy.S),okAlpha:Gr(cy.H,cy.S,!0),error:Gr(dy.H,dy.S),errorAlpha:Gr(dy.H,dy.S,!0)},{definePartsStyle:CPe,defineMultiStyleConfig:EPe}=Ve(AV.keys),TPe={border:"none"},APe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:W(`${t}.200`,`${t}.700`)(e),color:W(`${t}.900`,`${t}.100`)(e),_hover:{bg:W(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:W(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:W(`${t}.300`,`${t}.600`)(e)}}}},PPe=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},kPe={},IPe=CPe(e=>({container:TPe,button:APe(e),panel:PPe(e),icon:kPe})),MPe=EPe({variants:{invokeAI:IPe},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),RPe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:W("base.150","base.700")(e),color:W("base.300","base.500")(e),svg:{fill:W("base.300","base.500")(e)},opacity:1},i={bg:"none",color:W("base.300","base.500")(e),svg:{fill:W("base.500","base.500")(e)},opacity:1};return{bg:W("base.250","base.600")(e),color:W("base.850","base.100")(e),borderRadius:"base",svg:{fill:W("base.850","base.100")(e)},_hover:{bg:W("base.300","base.500")(e),color:W("base.900","base.50")(e),svg:{fill:W("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:W(`${t}.400`,`${t}.700`)(e),color:W(`${t}.600`,`${t}.500`)(e),svg:{fill:W(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:W(`${t}.400`,`${t}.600`)(e),color:W("base.50","base.100")(e),borderRadius:"base",svg:{fill:W("base.50","base.100")(e)},_disabled:n,_hover:{bg:W(`${t}.500`,`${t}.500`)(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)},_disabled:n}}},OPe=e=>{const{colorScheme:t}=e,n=W("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:W(`${t}.500`,`${t}.500`)(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},$Pe={variants:{invokeAI:RPe,invokeAIOutline:OPe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:NPe,defineMultiStyleConfig:DPe}=Ve(PV.keys),LPe=e=>{const{colorScheme:t}=e;return{bg:W("base.200","base.700")(e),borderColor:W("base.300","base.600")(e),color:W("base.900","base.100")(e),_checked:{bg:W(`${t}.300`,`${t}.500`)(e),borderColor:W(`${t}.300`,`${t}.500`)(e),color:W(`${t}.900`,`${t}.100`)(e),_hover:{bg:W(`${t}.400`,`${t}.500`)(e),borderColor:W(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:W(`${t}.300`,`${t}.600`)(e),borderColor:W(`${t}.300`,`${t}.600`)(e),color:W(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:W("error.600","error.300")(e)}}},FPe=NPe(e=>({control:LPe(e)})),BPe=DPe({variants:{invokeAI:FPe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:zPe,defineMultiStyleConfig:VPe}=Ve(kV.keys),jPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},UPe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:W("accent.900","accent.50")(e),bg:W("accent.200","accent.400")(e)}}),GPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},HPe=zPe(e=>({preview:jPe,input:UPe(e),textarea:GPe})),qPe=VPe({variants:{invokeAI:HPe},defaultProps:{size:"sm",variant:"invokeAI"}}),WPe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:W("base.700","base.300")(e),_invalid:{color:W("error.500","error.300")(e)}}),KPe={variants:{invokeAI:WPe},defaultProps:{variant:"invokeAI"}},CS=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:W("base.200","base.800")(e),bg:W("base.50","base.900")(e),borderRadius:"base",color:W("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:W("base.300","base.600")(e)},_focus:{borderColor:W("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:W("accent.300","accent.500")(e)}},_invalid:{borderColor:W("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:W("error.400","error.500")(e)}},_disabled:{borderColor:W("base.300","base.700")(e),bg:W("base.300","base.700")(e),color:W("base.600","base.400")(e),_hover:{borderColor:W("base.300","base.700")(e)}},_placeholder:{color:W("base.700","base.400")(e)},"::selection":{bg:W("accent.200","accent.400")(e)}}),{definePartsStyle:XPe,defineMultiStyleConfig:QPe}=Ve(IV.keys),YPe=XPe(e=>({field:CS(e)})),ZPe=QPe({variants:{invokeAI:YPe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:JPe,defineMultiStyleConfig:eke}=Ve(MV.keys),tke=JPe(e=>({button:{fontWeight:500,bg:W("base.300","base.500")(e),color:W("base.900","base.100")(e),_hover:{bg:W("base.400","base.600")(e),color:W("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:W("base.900","base.150")(e),bg:W("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:W("base.200","base.800")(e),_hover:{bg:W("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:W("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),nke=eke({variants:{invokeAI:tke},defaultProps:{variant:"invokeAI"}}),RUe={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:rke,definePartsStyle:ike}=Ve(RV.keys),oke=e=>({bg:W("blackAlpha.700","blackAlpha.700")(e)}),ake={},ske=()=>({layerStyle:"first",maxH:"80vh"}),lke=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),uke={},cke={overflowY:"scroll"},dke={},fke=ike(e=>({overlay:oke(e),dialogContainer:ake,dialog:ske(),header:lke(),closeButton:uke,body:cke,footer:dke})),hke=rke({variants:{invokeAI:fke},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:pke,definePartsStyle:gke}=Ve(OV.keys),mke=e=>({height:8}),yke=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...CS(e)}),vke=e=>({display:"flex"}),bke=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:W("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:W("base.900","base.100")(e)}}}),_ke=gke(e=>({root:mke(e),field:yke(e),stepperGroup:vke(e),stepper:bke(e)})),Ske=pke({variants:{invokeAI:_ke},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:xke,definePartsStyle:DU}=Ve($V.keys),LU=tn("popper-bg"),FU=tn("popper-arrow-bg"),BU=tn("popper-arrow-shadow-color"),wke=e=>({[FU.variable]:W("colors.base.100","colors.base.800")(e),[LU.variable]:W("colors.base.100","colors.base.800")(e),[BU.variable]:W("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:W("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),Cke=e=>({[FU.variable]:W("colors.base.100","colors.base.700")(e),[LU.variable]:W("colors.base.100","colors.base.700")(e),[BU.variable]:W("colors.base.400","colors.base.400")(e),p:4,bg:W("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),Eke=DU(e=>({content:wke(e),body:{padding:0}})),Tke=DU(e=>({content:Cke(e),body:{padding:0}})),Ake=xke({variants:{invokeAI:Eke,informational:Tke},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:Pke,definePartsStyle:kke}=Ve(NV.keys),Ike=e=>({bg:"accentAlpha.700"}),Mke=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.200`,`${t}.700`)(e)}},Rke=kke(e=>({filledTrack:Ike(e),track:Mke(e)})),Oke=Pke({variants:{invokeAI:Rke},defaultProps:{variant:"invokeAI"}}),$ke={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:Nke,defineMultiStyleConfig:Dke}=Ve(DV.keys),Lke=e=>({color:W("base.200","base.300")(e)}),Fke=e=>({fontWeight:"600",...CS(e)}),Bke=Nke(e=>({field:Fke(e),icon:Lke(e)})),zke=Dke({variants:{invokeAI:Bke},defaultProps:{size:"sm",variant:"invokeAI"}}),LM=ke("skeleton-start-color"),FM=ke("skeleton-end-color"),Vke={borderRadius:"base",maxW:"full",maxH:"full",_light:{[LM.variable]:"colors.base.250",[FM.variable]:"colors.base.450"},_dark:{[LM.variable]:"colors.base.700",[FM.variable]:"colors.base.500"}},jke={variants:{invokeAI:Vke},defaultProps:{variant:"invokeAI"}},{definePartsStyle:Uke,defineMultiStyleConfig:Gke}=Ve(LV.keys),Hke=e=>({bg:W("base.400","base.600")(e),h:1.5}),qke=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.400`,`${t}.600`)(e),h:1.5}},Wke=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:W("base.50","base.100")(e)}),Kke=e=>({fontSize:"2xs",fontWeight:"500",color:W("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),Xke=Uke(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:Hke(e),filledTrack:qke(e),thumb:Wke(e),mark:Kke(e)})),Qke=Gke({variants:{invokeAI:Xke},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Yke,definePartsStyle:Zke}=Ve(FV.keys),Jke=e=>{const{colorScheme:t}=e;return{bg:W("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:W(`${t}.400`,`${t}.500`)(e)}}},e6e=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.50`,`${t}.50`)(e)}},t6e=Zke(e=>({container:{},track:Jke(e),thumb:e6e(e)})),n6e=Yke({variants:{invokeAI:t6e},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:r6e,definePartsStyle:zU}=Ve(BV.keys),i6e=e=>({display:"flex",columnGap:4}),o6e=e=>({}),a6e=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:W("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:W("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:W("base.700","base.300")(e)},_selected:{bg:W("accent.400","accent.600")(e),color:W("base.50","base.100")(e),svg:{fill:W("base.50","base.100")(e),filter:W(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:W("accent.500","accent.500")(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)}}},_hover:{bg:W("base.100","base.800")(e),color:W("base.900","base.50")(e),svg:{fill:W("base.800","base.100")(e)}}}}},s6e=e=>({padding:0,height:"100%"}),l6e=zU(e=>({root:i6e(e),tab:o6e(e),tablist:a6e(e),tabpanel:s6e(e)})),u6e=zU(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:W("base.600","base.400")(e),fontWeight:500,_selected:{color:W("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),c6e=r6e({variants:{line:u6e,appTabs:l6e},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),d6e=e=>({color:W("error.500","error.400")(e)}),f6e=e=>({color:W("base.500","base.400")(e)}),h6e={variants:{subtext:f6e,error:d6e}},p6e=e=>({...CS(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`}},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`}}},p:2}),g6e={variants:{invokeAI:p6e},defaultProps:{size:"md",variant:"invokeAI"}},m6e=tn("popper-arrow-bg"),y6e=e=>({borderRadius:"base",shadow:"dark-lg",bg:W("base.700","base.200")(e),[m6e.variable]:W("colors.base.700","colors.base.200")(e),pb:1.5}),v6e={baseStyle:y6e},BM={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},b6e={".react-flow__nodesselection-rect":{...BM,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":BM},_6e={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...$ke},...b6e})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:wPe,components:{Button:$Pe,Input:ZPe,Editable:qPe,Textarea:g6e,Tabs:c6e,Progress:Oke,Accordion:MPe,FormLabel:KPe,Switch:n6e,NumberInput:Ske,Select:zke,Skeleton:jke,Slider:Qke,Popover:Ake,Modal:hke,Checkbox:BPe,Menu:nke,Text:h6e,Tooltip:v6e}},S6e={defaultOptions:{isClosable:!0}},{toast:wh}=yPe({theme:_6e,defaultOptions:S6e.defaultOptions}),x6e=()=>{pe({matcher:un.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;se("queue").debug({enqueueResult:pt(t)},"Batch enqueued"),wh.isActive("batch-queued")||wh({id:"batch-queued",title:X("queue.batchQueued"),description:X("queue.batchQueuedDesc",{count:t.enqueued,direction:n.prepend?X("queue.front"):X("queue.back")}),duration:1e3,status:"success"})}}),pe({matcher:un.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){wh({title:X("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),se("queue").error({batchConfig:pt(n),error:pt(t)},X("queue.batchFailedToQueue"));return}const r=xPe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{wh({id:"batch-failed-to-queue",title:u6(XN(i.msg),{length:128}),status:"error",description:u6(`Path: + ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=Vy(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=Vy(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=Vy(t,"data.detail","Unknown Error"),o=15e3),wh({title:X("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}se("queue").error({batchConfig:pt(n),error:pt(t)},X("queue.batchFailedToQueue"))}})},Vm={memoizeOptions:{resultEqualityCheck:SE}},VU=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlAdapters:o}=e,a=((d=n.initialImage)==null?void 0:d.imageName)===t,s=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.filter(on).some(f=>Gc(f.data.inputs,h=>{var p;return h.type==="ImageField"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Aa(o).some(f=>f.controlImage===t||gi(f)&&f.processedControlImage===t);return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlImage:u}},w6e=qn([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>VU(e,r.image_name)):[]},Vm),C6e=()=>{pe({matcher:ce.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1;const l=n();r.forEach(u=>{const c=VU(l,u);c.isInitialImage&&!i&&(t(DE()),i=!0),c.isCanvasImage&&!o&&(t(KE()),o=!0),c.isNodesImage&&!a&&(t(cve()),a=!0),c.isControlImage&&!s&&(t(zie()),s=!0)})}})},E6e=()=>{pe({matcher:si(M1,M5),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=M1.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(M5.match(e)?e.payload:o.gallery.galleryView)==="images"?Fn:Pr,u={board_id:a??"none",categories:l};if(await r(()=>ce.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=ce.endpoints.listImages.select(u)(t());if(d){const f=bg.selectAll(d)[0],h=bg.selectById(d,e.payload.selectedImageName);n(pa(h||f||null))}else n(pa(null))}else n(pa(null))}})},T6e=ge("canvas/canvasSavedToGallery"),A6e=ge("canvas/canvasMaskSavedToGallery"),P6e=ge("canvas/canvasCopiedToClipboard"),k6e=ge("canvas/canvasDownloadedAsImage"),I6e=ge("canvas/canvasMerged"),M6e=ge("canvas/stagingAreaImageSaved"),R6e=ge("canvas/canvasMaskToControlAdapter"),O6e=ge("canvas/canvasImageToControlAdapter");let jU=null,UU=null;const OUe=e=>{jU=e},ES=()=>jU,$Ue=e=>{UU=e},$6e=()=>UU,N6e=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),ab=async(e,t)=>await N6e(e.toCanvas(t)),TS=async(e,t=!1)=>{const n=ES();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return ab(a,l)},D6e=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},L6e=()=>{pe({actionCreator:P6e,effect:async(e,{dispatch:t,getState:n})=>{const r=J_.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=TS(i);D6e(o)}catch(o){r.error(String(o)),t(it({title:X("toast.problemCopyingCanvas"),description:X("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(it({title:X("toast.canvasCopiedClipboard"),status:"success"}))}})},F6e=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},B6e=()=>{pe({actionCreator:k6e,effect:async(e,{dispatch:t,getState:n})=>{const r=J_.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await TS(i)}catch(a){r.error(String(a)),t(it({title:X("toast.problemDownloadingCanvas"),description:X("toast.problemDownloadingCanvasDesc"),status:"error"}));return}F6e(o,"canvas.png"),t(it({title:X("toast.canvasDownloaded"),status:"success"}))}})},z6e=()=>{pe({actionCreator:O6e,effect:async(e,{dispatch:t,getState:n})=>{const r=se("canvas"),i=n(),{id:o}=e.payload;let a;try{a=await TS(i,!0)}catch(c){r.error(String(c)),t(it({title:X("toast.problemSavingCanvas"),description:X("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(ce.endpoints.uploadImage.initiate({file:new File([a],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:X("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Hl({id:o,controlImage:u}))}})};var lA={exports:{}},AS={},GU={},Ge={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;const t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof He<"u"?He:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.3",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},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 e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Ge);var nn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Ge;class n{constructor(v=[1,0,0,1,0,0]){this.dirty=!1,this.m=v&&v.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 n(this.m)}copyInto(v){v.m[0]=this.m[0],v.m[1]=this.m[1],v.m[2]=this.m[2],v.m[3]=this.m[3],v.m[4]=this.m[4],v.m[5]=this.m[5]}point(v){var S=this.m;return{x:S[0]*v.x+S[2]*v.y+S[4],y:S[1]*v.x+S[3]*v.y+S[5]}}translate(v,S){return this.m[4]+=this.m[0]*v+this.m[2]*S,this.m[5]+=this.m[1]*v+this.m[3]*S,this}scale(v,S){return this.m[0]*=v,this.m[1]*=v,this.m[2]*=S,this.m[3]*=S,this}rotate(v){var S=Math.cos(v),w=Math.sin(v),C=this.m[0]*S+this.m[2]*w,x=this.m[1]*S+this.m[3]*w,P=this.m[0]*-w+this.m[2]*S,E=this.m[1]*-w+this.m[3]*S;return this.m[0]=C,this.m[1]=x,this.m[2]=P,this.m[3]=E,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(v,S){var w=this.m[0]+this.m[2]*S,C=this.m[1]+this.m[3]*S,x=this.m[2]+this.m[0]*v,P=this.m[3]+this.m[1]*v;return this.m[0]=w,this.m[1]=C,this.m[2]=x,this.m[3]=P,this}multiply(v){var S=this.m[0]*v.m[0]+this.m[2]*v.m[1],w=this.m[1]*v.m[0]+this.m[3]*v.m[1],C=this.m[0]*v.m[2]+this.m[2]*v.m[3],x=this.m[1]*v.m[2]+this.m[3]*v.m[3],P=this.m[0]*v.m[4]+this.m[2]*v.m[5]+this.m[4],E=this.m[1]*v.m[4]+this.m[3]*v.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=C,this.m[3]=x,this.m[4]=P,this.m[5]=E,this}invert(){var v=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*v,w=-this.m[1]*v,C=-this.m[2]*v,x=this.m[0]*v,P=v*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),E=v*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=C,this.m[3]=x,this.m[4]=P,this.m[5]=E,this}getMatrix(){return this.m}decompose(){var v=this.m[0],S=this.m[1],w=this.m[2],C=this.m[3],x=this.m[4],P=this.m[5],E=v*C-S*w;let I={x,y:P,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(v!=0||S!=0){var N=Math.sqrt(v*v+S*S);I.rotation=S>0?Math.acos(v/N):-Math.acos(v/N),I.scaleX=N,I.scaleY=E/N,I.skewX=(v*w+S*C)/E,I.skewY=0}else if(w!=0||C!=0){var M=Math.sqrt(w*w+C*C);I.rotation=Math.PI/2-(C>0?Math.acos(-w/M):-Math.acos(w/M)),I.scaleX=E/M,I.scaleY=M,I.skewX=0,I.skewY=(v*w+S*C)/E}return I.rotation=e.Util._getRotation(I.rotation),I}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",g={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]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const y=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(m){setTimeout(m,60)};e.Util={_isElement(m){return!!(m&&m.nodeType==1)},_isFunction(m){return!!(m&&m.constructor&&m.call&&m.apply)},_isPlainObject(m){return!!m&&m.constructor===Object},_isArray(m){return Object.prototype.toString.call(m)===r},_isNumber(m){return Object.prototype.toString.call(m)===i&&!isNaN(m)&&isFinite(m)},_isString(m){return Object.prototype.toString.call(m)===o},_isBoolean(m){return Object.prototype.toString.call(m)===a},isObject(m){return m instanceof Object},isValidSelector(m){if(typeof m!="string")return!1;var v=m[0];return v==="#"||v==="."||v===v.toUpperCase()},_sign(m){return m===0||m>0?1:-1},requestAnimFrame(m){b.push(m),b.length===1&&y(function(){const v=b;b=[],v.forEach(function(S){S()})})},createCanvasElement(){var m=document.createElement("canvas");try{m.style=m.style||{}}catch{}return m},createImageElement(){return document.createElement("img")},_isInDocument(m){for(;m=m.parentNode;)if(m==document)return!0;return!1},_urlToImage(m,v){var S=e.Util.createImageElement();S.onload=function(){v(S)},S.src=m},_rgbToHex(m,v,S){return((1<<24)+(m<<16)+(v<<8)+S).toString(16).slice(1)},_hexToRgb(m){m=m.replace(u,c);var v=parseInt(m,16);return{r:v>>16&255,g:v>>8&255,b:v&255}},getRandomColor(){for(var m=(Math.random()*16777215<<0).toString(16);m.length<6;)m=d+m;return u+m},getRGB(m){var v;return m in g?(v=g[m],{r:v[0],g:v[1],b:v[2]}):m[0]===u?this._hexToRgb(m.substring(1)):m.substr(0,4)===p?(v=_.exec(m.replace(/ /g,"")),{r:parseInt(v[1],10),g:parseInt(v[2],10),b:parseInt(v[3],10)}):{r:0,g:0,b:0}},colorToRGBA(m){return m=m||"black",e.Util._namedColorToRBA(m)||e.Util._hex3ColorToRGBA(m)||e.Util._hex4ColorToRGBA(m)||e.Util._hex6ColorToRGBA(m)||e.Util._hex8ColorToRGBA(m)||e.Util._rgbColorToRGBA(m)||e.Util._rgbaColorToRGBA(m)||e.Util._hslColorToRGBA(m)},_namedColorToRBA(m){var v=g[m.toLowerCase()];return v?{r:v[0],g:v[1],b:v[2],a:1}:null},_rgbColorToRGBA(m){if(m.indexOf("rgb(")===0){m=m.match(/rgb\(([^)]+)\)/)[1];var v=m.split(/ *, */).map(Number);return{r:v[0],g:v[1],b:v[2],a:1}}},_rgbaColorToRGBA(m){if(m.indexOf("rgba(")===0){m=m.match(/rgba\(([^)]+)\)/)[1];var v=m.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:v[0],g:v[1],b:v[2],a:v[3]}}},_hex8ColorToRGBA(m){if(m[0]==="#"&&m.length===9)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:parseInt(m.slice(7,9),16)/255}},_hex6ColorToRGBA(m){if(m[0]==="#"&&m.length===7)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:1}},_hex4ColorToRGBA(m){if(m[0]==="#"&&m.length===5)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:parseInt(m[4]+m[4],16)/255}},_hex3ColorToRGBA(m){if(m[0]==="#"&&m.length===4)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:1}},_hslColorToRGBA(m){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(m)){const[v,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(m),w=Number(S[0])/360,C=Number(S[1])/100,x=Number(S[2])/100;let P,E,I;if(C===0)return I=x*255,{r:Math.round(I),g:Math.round(I),b:Math.round(I),a:1};x<.5?P=x*(1+C):P=x+C-x*C;const N=2*x-P,M=[0,0,0];for(let T=0;T<3;T++)E=w+1/3*-(T-1),E<0&&E++,E>1&&E--,6*E<1?I=N+(P-N)*6*E:2*E<1?I=P:3*E<2?I=N+(P-N)*(2/3-E)*6:I=N,M[T]=I*255;return{r:Math.round(M[0]),g:Math.round(M[1]),b:Math.round(M[2]),a:1}}},haveIntersection(m,v){return!(v.x>m.x+m.width||v.x+v.widthm.y+m.height||v.y+v.height1?(P=S,E=w,I=(S-C)*(S-C)+(w-x)*(w-x)):(P=m+M*(S-m),E=v+M*(w-v),I=(P-C)*(P-C)+(E-x)*(E-x))}return[P,E,I]},_getProjectionToLine(m,v,S){var w=e.Util.cloneObject(m),C=Number.MAX_VALUE;return v.forEach(function(x,P){if(!(!S&&P===v.length-1)){var E=v[(P+1)%v.length],I=e.Util._getProjectionToSegment(x.x,x.y,E.x,E.y,m.x,m.y),N=I[0],M=I[1],T=I[2];Tv.length){var P=v;v=m,m=P}for(w=0;w{v.width=0,v.height=0})},drawRoundedRectPath(m,v,S,w){let C=0,x=0,P=0,E=0;typeof w=="number"?C=x=P=E=Math.min(w,v/2,S/2):(C=Math.min(w[0]||0,v/2,S/2),x=Math.min(w[1]||0,v/2,S/2),E=Math.min(w[2]||0,v/2,S/2),P=Math.min(w[3]||0,v/2,S/2)),m.moveTo(C,0),m.lineTo(v-x,0),m.arc(v-x,x,x,Math.PI*3/2,0,!1),m.lineTo(v,S-E),m.arc(v-E,S-E,E,0,Math.PI/2,!1),m.lineTo(P,S),m.arc(P,S-P,P,Math.PI/2,Math.PI,!1),m.lineTo(0,C),m.arc(C,C,C,Math.PI,Math.PI*3/2,!1)}}})(nn);var Kt={},je={},Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.getComponentValidator=Te.getBooleanValidator=Te.getNumberArrayValidator=Te.getFunctionValidator=Te.getStringOrGradientValidator=Te.getStringValidator=Te.getNumberOrAutoValidator=Te.getNumberOrArrayOfNumbersValidator=Te.getNumberValidator=Te.alphaComponent=Te.RGBComponent=void 0;const Es=Ge,dn=nn;function Ts(e){return dn.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||dn.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function V6e(e){return e>255?255:e<0?0:Math.round(e)}Te.RGBComponent=V6e;function j6e(e){return e>1?1:e<1e-4?1e-4:e}Te.alphaComponent=j6e;function U6e(){if(Es.Konva.isUnminified)return function(e,t){return dn.Util._isNumber(e)||dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Te.getNumberValidator=U6e;function G6e(e){if(Es.Konva.isUnminified)return function(t,n){let r=dn.Util._isNumber(t),i=dn.Util._isArray(t)&&t.length==e;return!r&&!i&&dn.Util.warn(Ts(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Te.getNumberOrArrayOfNumbersValidator=G6e;function H6e(){if(Es.Konva.isUnminified)return function(e,t){var n=dn.Util._isNumber(e),r=e==="auto";return n||r||dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Te.getNumberOrAutoValidator=H6e;function q6e(){if(Es.Konva.isUnminified)return function(e,t){return dn.Util._isString(e)||dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Te.getStringValidator=q6e;function W6e(){if(Es.Konva.isUnminified)return function(e,t){const n=dn.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Te.getStringOrGradientValidator=W6e;function K6e(){if(Es.Konva.isUnminified)return function(e,t){return dn.Util._isFunction(e)||dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Te.getFunctionValidator=K6e;function X6e(){if(Es.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(dn.Util._isArray(e)?e.forEach(function(r){dn.Util._isNumber(r)||dn.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Te.getNumberArrayValidator=X6e;function Q6e(){if(Es.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||dn.Util.warn(Ts(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Te.getBooleanValidator=Q6e;function Y6e(e){if(Es.Konva.isUnminified)return function(t,n){return t==null||dn.Util.isObject(t)||dn.Util.warn(Ts(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Te.getComponentValidator=Y6e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=nn,n=Te;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,g;o.prototype[f]=function(){var b={};for(p=0;p{this._setAttr(a+d(v),void 0)}),this._fireChangeEvent(a,y,b),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(je);var Mo={},ss={};Object.defineProperty(ss,"__esModule",{value:!0});ss.HitContext=ss.SceneContext=ss.Context=void 0;const HU=nn,Z6e=Ge;function J6e(e){var t=[],n=e.length,r=HU.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=eIe+u.join(zM)+tIe)):(o+=s.property,t||(o+=aIe+s.val)),o+=iIe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=lIe&&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){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const 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(...t){this._context.clip.apply(this._context,t)}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 c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.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){this._context.fill.apply(this._context,t)}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=VM.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=J6e(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(IS);Object.defineProperty(Kt,"__esModule",{value:!0});Kt.Node=void 0;const qe=nn,jm=je,hy=Mo,cu=Ge,Fi=IS,vn=Te;var fv="absoluteOpacity",py="allEventListeners",za="absoluteTransform",jM="absoluteScale",du="canvas",mIe="Change",yIe="children",vIe="konva",P3="listening",UM="mouseenter",GM="mouseleave",HM="set",qM="Shape",hv=" ",WM="stage",js="transform",bIe="Stage",k3="visible",_Ie=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(hv);let SIe=1;class Ne{constructor(t){this._id=SIe++,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===js||t===za)&&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===js||t===za,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(hv);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(du)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===za&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(du)){const{scene:t,filter:n,hit:r}=this._cache.get(du);qe.Util.releaseCanvas(t,n,r),this._cache.delete(du)}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()||void 0}));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,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){qe.Util.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 f=new hy.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new hy.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new hy.HitCanvas({pixelRatio:d,width:i,height:o}),g=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(du),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),g.save(),_.save(),g.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(fv),this._clearSelfAndDescendantCache(jM),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,g.restore(),_.restore(),c&&(g.save(),g.beginPath(),g.rect(0,0,i,o),g.closePath(),g.setAttr("strokeStyle","red"),g.setAttr("lineWidth",5),g.stroke(),g.restore()),this._cache.set(du,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(du)}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=1/0,o=1/0,a=-1/0,s=-1/0,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.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 c=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()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==yIe&&(r=HM+qe.Util._capitalize(n),qe.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(P3,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(k3,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;Fi.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!cu.Konva.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(c){for(i=[],o=c.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}const u=this.getStage();return n.nodeType!==bIe&&u&&l(u.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(js),this._clearSelfAndDescendantCache(za)),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(){const t=this.getStage();if(!t)return null;var n=t.getPointerPosition();if(!n)return null;var r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}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 qe.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){const{x:n,y:r,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(js);var o=this._getAbsoluteTransform().copy();return o.invert(),o.translate(t.x,t.y),t={x:this.attrs.x+o.getTranslation().x,y:this.attrs.y+o.getTranslation().y},this._setTransform(i),this.setPosition({x:t.x,y:t.y}),this._clearCache(js),this._clearSelfAndDescendantCache(za),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 qe.Util.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 qe.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&qe.Util.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(fv,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=qe.Util.isObject(i)&&!qe.Util._isPlainObject(i)&&!qe.Util._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(),qe.Util._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,qe.Util._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():cu.Konva.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;Fi.DD._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=Fi.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Fi.DD._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 qe.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return qe.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=Ne.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),cu.Konva[r]||(qe.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=cu.Konva[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=Vw.Node.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=Vw.Node.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(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 c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var g=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";g&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),g&&o.restore(),u&&o.restore()}getClientRect(t={}){var n,r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(g){if(g.visible()){var _=g.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hZ.indexOf("pointer")>=0?"pointer":Z.indexOf("touch")>=0?"touch":"mouse",U=Z=>{const V=B(Z);if(V==="pointer")return i.Konva.pointerEventsEnabled&&O.pointer;if(V==="touch")return O.touch;if(V==="mouse")return O.mouse};function j(Z={}){return(Z.clipFunc||Z.clipWidth||Z.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Z}const q="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);";e.stages=[];class Y extends r.Container{constructor(V){super(j(V)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{j(this.attrs)}),this._checkVisibility()}_validateAdd(V){const K=V.getType()==="Layer",ee=V.getType()==="FastLayer";K||ee||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const V=this.visible()?"":"none";this.content.style.display=V}setContainer(V){if(typeof V===c){if(V.charAt(0)==="."){var K=V.slice(1);V=document.getElementsByClassName(K)[0]}else{var ee;V.charAt(0)!=="#"?ee=V:ee=V.slice(1),V=document.getElementById(ee)}if(!V)throw"Can not find container in document with id "+ee}return this._setAttr("container",V),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),V.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var V=this.children,K=V.length,ee;for(ee=0;ee-1&&e.stages.splice(K,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const V=this._pointerPositions[0]||this._changedPointerPositions[0];return V?{x:V.x,y:V.y}:(t.Util.warn(q),null)}_getPointerById(V){return this._pointerPositions.find(K=>K.id===V)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(V){V=V||{},V.x=V.x||0,V.y=V.y||0,V.width=V.width||this.width(),V.height=V.height||this.height();var K=new o.SceneCanvas({width:V.width,height:V.height,pixelRatio:V.pixelRatio||1}),ee=K.getContext()._context,re=this.children;return(V.x||V.y)&&ee.translate(-1*V.x,-1*V.y),re.forEach(function(fe){if(fe.isVisible()){var Se=fe._toKonvaCanvas(V);ee.drawImage(Se._canvas,V.x,V.y,Se.getWidth()/Se.getPixelRatio(),Se.getHeight()/Se.getPixelRatio())}}),K}getIntersection(V){if(!V)return null;var K=this.children,ee=K.length,re=ee-1,fe;for(fe=re;fe>=0;fe--){const Se=K[fe].getIntersection(V);if(Se)return Se}return null}_resizeDOM(){var V=this.width(),K=this.height();this.content&&(this.content.style.width=V+d,this.content.style.height=K+d),this.bufferCanvas.setSize(V,K),this.bufferHitCanvas.setSize(V,K),this.children.forEach(ee=>{ee.setSize({width:V,height:K}),ee.draw()})}add(V,...K){if(arguments.length>1){for(var ee=0;ee$&&t.Util.warn("The stage has "+re+" 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."),V.setSize({width:this.width(),height:this.height()}),V.draw(),i.Konva.isBrowser&&this.content.appendChild(V.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(V){return l.hasPointerCapture(V,this)}setPointerCapture(V){l.setPointerCapture(V,this)}releaseCapture(V){l.releaseCapture(V,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&L.forEach(([V,K])=>{this.content.addEventListener(V,ee=>{this[K](ee)},{passive:!1})})}_pointerenter(V){this.setPointersPositions(V);const K=U(V.type);K&&this._fire(K.pointerenter,{evt:V,target:this,currentTarget:this})}_pointerover(V){this.setPointersPositions(V);const K=U(V.type);K&&this._fire(K.pointerover,{evt:V,target:this,currentTarget:this})}_getTargetShape(V){let K=this[V+"targetShape"];return K&&!K.getStage()&&(K=null),K}_pointerleave(V){const K=U(V.type),ee=B(V.type);if(K){this.setPointersPositions(V);var re=this._getTargetShape(ee),fe=!a.DD.isDragging||i.Konva.hitOnDragEnabled;re&&fe?(re._fireAndBubble(K.pointerout,{evt:V}),re._fireAndBubble(K.pointerleave,{evt:V}),this._fire(K.pointerleave,{evt:V,target:this,currentTarget:this}),this[ee+"targetShape"]=null):fe&&(this._fire(K.pointerleave,{evt:V,target:this,currentTarget:this}),this._fire(K.pointerout,{evt:V,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(V){const K=U(V.type),ee=B(V.type);if(K){this.setPointersPositions(V);var re=!1;this._changedPointerPositions.forEach(fe=>{var Se=this.getIntersection(fe);if(a.DD.justDragged=!1,i.Konva["_"+ee+"ListenClick"]=!0,!Se||!Se.isListening())return;i.Konva.capturePointerEventsEnabled&&Se.setPointerCapture(fe.id),this[ee+"ClickStartShape"]=Se,Se._fireAndBubble(K.pointerdown,{evt:V,pointerId:fe.id}),re=!0;const Me=V.type.indexOf("touch")>=0;Se.preventDefault()&&V.cancelable&&Me&&V.preventDefault()}),re||this._fire(K.pointerdown,{evt:V,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(V){const K=U(V.type),ee=B(V.type);if(!K)return;a.DD.isDragging&&a.DD.node.preventDefault()&&V.cancelable&&V.preventDefault(),this.setPointersPositions(V);var re=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!re)return;var fe={};let Se=!1;var Me=this._getTargetShape(ee);this._changedPointerPositions.forEach(De=>{const Ee=l.getCapturedShape(De.id)||this.getIntersection(De),tt=De.id,ot={evt:V,pointerId:tt};var we=Me!==Ee;if(we&&Me&&(Me._fireAndBubble(K.pointerout,{...ot},Ee),Me._fireAndBubble(K.pointerleave,{...ot},Ee)),Ee){if(fe[Ee._id])return;fe[Ee._id]=!0}Ee&&Ee.isListening()?(Se=!0,we&&(Ee._fireAndBubble(K.pointerover,{...ot},Me),Ee._fireAndBubble(K.pointerenter,{...ot},Me),this[ee+"targetShape"]=Ee),Ee._fireAndBubble(K.pointermove,{...ot})):Me&&(this._fire(K.pointerover,{evt:V,target:this,currentTarget:this,pointerId:tt}),this[ee+"targetShape"]=null)}),Se||this._fire(K.pointermove,{evt:V,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(V){const K=U(V.type),ee=B(V.type);if(!K)return;this.setPointersPositions(V);const re=this[ee+"ClickStartShape"],fe=this[ee+"ClickEndShape"];var Se={};let Me=!1;this._changedPointerPositions.forEach(De=>{const Ee=l.getCapturedShape(De.id)||this.getIntersection(De);if(Ee){if(Ee.releaseCapture(De.id),Se[Ee._id])return;Se[Ee._id]=!0}const tt=De.id,ot={evt:V,pointerId:tt};let we=!1;i.Konva["_"+ee+"InDblClickWindow"]?(we=!0,clearTimeout(this[ee+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ee+"InDblClickWindow"]=!0,clearTimeout(this[ee+"DblTimeout"])),this[ee+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ee+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),Ee&&Ee.isListening()?(Me=!0,this[ee+"ClickEndShape"]=Ee,Ee._fireAndBubble(K.pointerup,{...ot}),i.Konva["_"+ee+"ListenClick"]&&re&&re===Ee&&(Ee._fireAndBubble(K.pointerclick,{...ot}),we&&fe&&fe===Ee&&Ee._fireAndBubble(K.pointerdblclick,{...ot}))):(this[ee+"ClickEndShape"]=null,i.Konva["_"+ee+"ListenClick"]&&this._fire(K.pointerclick,{evt:V,target:this,currentTarget:this,pointerId:tt}),we&&this._fire(K.pointerdblclick,{evt:V,target:this,currentTarget:this,pointerId:tt}))}),Me||this._fire(K.pointerup,{evt:V,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ee+"ListenClick"]=!1,V.cancelable&&ee!=="touch"&&V.preventDefault()}_contextmenu(V){this.setPointersPositions(V);var K=this.getIntersection(this.getPointerPosition());K&&K.isListening()?K._fireAndBubble(N,{evt:V}):this._fire(N,{evt:V,target:this,currentTarget:this})}_wheel(V){this.setPointersPositions(V);var K=this.getIntersection(this.getPointerPosition());K&&K.isListening()?K._fireAndBubble(D,{evt:V}):this._fire(D,{evt:V,target:this,currentTarget:this})}_pointercancel(V){this.setPointersPositions(V);const K=l.getCapturedShape(V.pointerId)||this.getIntersection(this.getPointerPosition());K&&K._fireAndBubble(S,l.createEvent(V)),l.releaseCapture(V.pointerId)}_lostpointercapture(V){l.releaseCapture(V.pointerId)}setPointersPositions(V){var K=this._getContentPosition(),ee=null,re=null;V=V||window.event,V.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(V.touches,fe=>{this._pointerPositions.push({id:fe.identifier,x:(fe.clientX-K.left)/K.scaleX,y:(fe.clientY-K.top)/K.scaleY})}),Array.prototype.forEach.call(V.changedTouches||V.touches,fe=>{this._changedPointerPositions.push({id:fe.identifier,x:(fe.clientX-K.left)/K.scaleX,y:(fe.clientY-K.top)/K.scaleY})})):(ee=(V.clientX-K.left)/K.scaleX,re=(V.clientY-K.top)/K.scaleY,this.pointerPos={x:ee,y:re},this._pointerPositions=[{x:ee,y:re,id:t.Util._getFirstPointerId(V)}],this._changedPointerPositions=[{x:ee,y:re,id:t.Util._getFirstPointerId(V)}])}_setPointerPosition(V){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(V)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var V=this.content.getBoundingClientRect();return{top:V.top,left:V.left,scaleX:V.width/this.content.clientWidth||1,scaleY:V.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var V=this.container();if(!V)throw"Stage has no container. A container is required.";V.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"),V.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.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(V){V.batchDraw()}),this}}e.Stage=Y,Y.prototype.nodeType=u,(0,s._registerNode)(Y),n.Factory.addGetterSetter(Y,"container")})(KU);var Um={},On={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Ge,n=nn,r=je,i=Kt,o=Te,a=Ge,s=yi;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function g(P){const E=this.attrs.fillRule;E?P.fill(E):P.fill()}function _(P){P.stroke()}function b(P){P.fill()}function y(P){P.stroke()}function m(){this._clearCache(l)}function v(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function C(){this._clearCache(f)}class x extends i.Node{constructor(E){super(E);let I;for(;I=n.Util.getRandomColor(),!(I&&!(I in e.shapes)););this.colorKey=I,e.shapes[I]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.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(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var E=p();const I=E.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(I&&I.setTransform){const N=new n.Transform;N.translate(this.fillPatternX(),this.fillPatternY()),N.rotate(t.Konva.getAngle(this.fillPatternRotation())),N.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),N.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const M=N.getMatrix(),T=typeof DOMMatrix>"u"?{a:M[0],b:M[1],c:M[2],d:M[3],e:M[4],f:M[5]}:new DOMMatrix(M);I.setTransform(T)}return I}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var E=this.fillLinearGradientColorStops();if(E){for(var I=p(),N=this.fillLinearGradientStartPoint(),M=this.fillLinearGradientEndPoint(),T=I.createLinearGradient(N.x,N.y,M.x,M.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 E=this.hitStrokeWidth();return E==="auto"?this.hasStroke():this.strokeEnabled()&&!!E}intersects(E){var I=this.getStage();if(!I)return!1;const N=I.bufferHitCanvas;return N.getContext().clear(),this.drawHit(N,void 0,!0),N.context.getImageData(Math.round(E.x),Math.round(E.y),1,1).data[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(E){var I;if(!this.getStage()||!((I=this.attrs.perfectDrawEnabled)!==null&&I!==void 0?I:!0))return!1;const M=E||this.hasFill(),T=this.hasStroke(),A=this.getAbsoluteOpacity()!==1;if(M&&T&&A)return!0;const R=this.hasShadow(),D=this.shadowForStrokeEnabled();return!!(M&&T&&R&&D)}setStrokeHitEnabled(E){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),E?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var E=this.size();return{x:this._centroid?-E.width/2:0,y:this._centroid?-E.height/2:0,width:E.width,height:E.height}}getClientRect(E={}){const I=E.skipTransform,N=E.relativeTo,M=this.getSelfRect(),A=!E.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,R=M.width+A,D=M.height+A,$=!E.skipShadow&&this.hasShadow(),L=$?this.shadowOffsetX():0,O=$?this.shadowOffsetY():0,B=R+Math.abs(L),U=D+Math.abs(O),j=$&&this.shadowBlur()||0,q=B+j*2,Y=U+j*2,Z={width:q,height:Y,x:-(A/2+j)+Math.min(L,0)+M.x,y:-(A/2+j)+Math.min(O,0)+M.y};return I?Z:this._transformedRect(Z,N)}drawScene(E,I){var N=this.getLayer(),M=E||N.getCanvas(),T=M.getContext(),A=this._getCanvasCache(),R=this.getSceneFunc(),D=this.hasShadow(),$,L,O,B=M.isCache,U=I===this;if(!this.isVisible()&&!U)return this;if(A){T.save();var j=this.getAbsoluteTransform(I).getMatrix();return T.transform(j[0],j[1],j[2],j[3],j[4],j[5]),this._drawCachedSceneCanvas(T),T.restore(),this}if(!R)return this;if(T.save(),this._useBufferCanvas()&&!B){$=this.getStage(),L=$.bufferCanvas,O=L.getContext(),O.clear(),O.save(),O._applyLineJoin(this);var q=this.getAbsoluteTransform(I).getMatrix();O.transform(q[0],q[1],q[2],q[3],q[4],q[5]),R.call(this,O,this),O.restore();var Y=L.pixelRatio;D&&T._applyShadow(this),T._applyOpacity(this),T._applyGlobalCompositeOperation(this),T.drawImage(L._canvas,0,0,L.width/Y,L.height/Y)}else{if(T._applyLineJoin(this),!U){var q=this.getAbsoluteTransform(I).getMatrix();T.transform(q[0],q[1],q[2],q[3],q[4],q[5]),T._applyOpacity(this),T._applyGlobalCompositeOperation(this)}D&&T._applyShadow(this),R.call(this,T,this)}return T.restore(),this}drawHit(E,I,N=!1){if(!this.shouldDrawHit(I,N))return this;var M=this.getLayer(),T=E||M.hitCanvas,A=T&&T.getContext(),R=this.hitFunc()||this.sceneFunc(),D=this._getCanvasCache(),$=D&&D.hit;if(this.colorKey||n.Util.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()"),$){A.save();var L=this.getAbsoluteTransform(I).getMatrix();return A.transform(L[0],L[1],L[2],L[3],L[4],L[5]),this._drawCachedHitCanvas(A),A.restore(),this}if(!R)return this;if(A.save(),A._applyLineJoin(this),!(this===I)){var B=this.getAbsoluteTransform(I).getMatrix();A.transform(B[0],B[1],B[2],B[3],B[4],B[5])}return R.call(this,A,this),A.restore(),this}drawHitFromCache(E=0){var I=this._getCanvasCache(),N=this._getCachedSceneCanvas(),M=I.hit,T=M.getContext(),A=M.getWidth(),R=M.getHeight(),D,$,L,O,B,U;T.clear(),T.drawImage(N._canvas,0,0,A,R);try{for(D=T.getImageData(0,0,A,R),$=D.data,L=$.length,O=n.Util._hexToRgb(this.colorKey),B=0;BE?($[B]=O.r,$[B+1]=O.g,$[B+2]=O.b,$[B+3]=255):$[B+3]=0;T.putImageData(D,0,0)}catch(j){n.Util.error("Unable to draw hit graph from cached scene canvas. "+j.message)}return this}hasPointerCapture(E){return s.hasPointerCapture(E,this)}setPointerCapture(E){s.setPointerCapture(E,this)}releaseCapture(E){s.releaseCapture(E,this)}}e.Shape=x,x.prototype._fillFunc=g,x.prototype._strokeFunc=_,x.prototype._fillFuncHit=b,x.prototype._strokeFuncHit=y,x.prototype._centroid=!1,x.prototype.nodeType="Shape",(0,a._registerNode)(x),x.prototype.eventListeners={},x.prototype.on.call(x.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",m),x.prototype.on.call(x.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),x.prototype.on.call(x.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),x.prototype.on.call(x.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),x.prototype.on.call(x.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",C),r.Factory.addGetterSetter(x,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(x,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(x,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(x,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(x,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(x,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(x,"lineJoin"),r.Factory.addGetterSetter(x,"lineCap"),r.Factory.addGetterSetter(x,"sceneFunc"),r.Factory.addGetterSetter(x,"hitFunc"),r.Factory.addGetterSetter(x,"dash"),r.Factory.addGetterSetter(x,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(x,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(x,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(x,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"fillPatternImage"),r.Factory.addGetterSetter(x,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(x,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(x,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(x,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(x,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(x,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(x,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(x,"fillEnabled",!0),r.Factory.addGetterSetter(x,"strokeEnabled",!0),r.Factory.addGetterSetter(x,"shadowEnabled",!0),r.Factory.addGetterSetter(x,"dashEnabled",!0),r.Factory.addGetterSetter(x,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(x,"fillPriority","color"),r.Factory.addComponentsGetterSetter(x,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(x,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(x,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(x,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(x,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(x,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(x,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(x,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(x,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(x,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(x,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(x,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(x,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(x,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(x,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(x,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(x,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(x,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(x,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(x,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(x,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(x,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(x,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(x,"fillPatternRotation",0),r.Factory.addGetterSetter(x,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(x,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(On);Object.defineProperty(Um,"__esModule",{value:!0});Um.Layer=void 0;const La=nn,jw=gc,Bc=Kt,cA=je,KM=Mo,TIe=Te,AIe=On,PIe=Ge;var kIe="#",IIe="beforeDraw",MIe="draw",YU=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],RIe=YU.length;class Bf extends jw.Container{constructor(t){super(t),this.canvas=new KM.SceneCanvas,this.hitCanvas=new KM.HitCanvas({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;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(IIe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),jw.Container.prototype.drawScene.call(this,i,n),this._fire(MIe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),jw.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){La.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return La.Util.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 La.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Um.Layer=Bf;Bf.prototype.nodeType="Layer";(0,PIe._registerNode)(Bf);cA.Factory.addGetterSetter(Bf,"imageSmoothingEnabled",!0);cA.Factory.addGetterSetter(Bf,"clearBeforeDraw",!0);cA.Factory.addGetterSetter(Bf,"hitGraphEnabled",!0,(0,TIe.getBooleanValidator)());var RS={};Object.defineProperty(RS,"__esModule",{value:!0});RS.FastLayer=void 0;const OIe=nn,$Ie=Um,NIe=Ge;class dA extends $Ie.Layer{constructor(t){super(t),this.listening(!1),OIe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}RS.FastLayer=dA;dA.prototype.nodeType="FastLayer";(0,NIe._registerNode)(dA);var zf={};Object.defineProperty(zf,"__esModule",{value:!0});zf.Group=void 0;const DIe=nn,LIe=gc,FIe=Ge;class fA extends LIe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&DIe.Util.throw("You may only add groups and shapes to groups.")}}zf.Group=fA;fA.prototype.nodeType="Group";(0,FIe._registerNode)(fA);var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0});Vf.Animation=void 0;const Uw=Ge,XM=nn,Gw=function(){return Uw.glob.performance&&Uw.glob.performance.now?function(){return Uw.glob.performance.now()}:function(){return new Date().getTime()}}();class oa{constructor(t,n){this.id=oa.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Gw(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){let n=[];return t&&(n=Array.isArray(t)?t:[t]),this.layers=n,this}getLayers(){return this.layers}addLayer(t){const n=this.layers,r=n.length;for(let i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,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 p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var g=this,_=p.node,b=_._id,y,m=p.easing||e.Easings.Linear,v=!!p.yoyo,S;typeof p.duration>"u"?y=.3:p.duration===0?y=.001:y=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){g.tween.onEnterFrame()},w),this.tween=new d(S,function(C){g._tweenFunc(C)},m,0,1,y*1e3,v),this._addListeners(),f.attrs[b]||(f.attrs[b]={}),f.attrs[b][this._id]||(f.attrs[b][this._id]={}),f.tweens[b]||(f.tweens[b]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,g){var _=this.node,b=_._id,y,m,v,S,w,C,x,P;if(v=f.tweens[b][p],v&&delete f.attrs[b][v][p],y=_.getAttr(p),t.Util._isArray(g))if(m=[],w=Math.max(g.length,y.length),p==="points"&&g.length!==y.length&&(g.length>y.length?(x=y,y=t.Util._prepareArrayForTween(y,g,_.closed())):(C=g,g=t.Util._prepareArrayForTween(g,y,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,g=f.attrs[p._id][this._id];g.points&&g.points.trueEnd&&p.setAttr("points",g.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,g=f.attrs[p._id][this._id];g.points&&g.points.trueStart&&p.points(g.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(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,g=this._id,_=f.tweens[p],b;this.pause();for(b in _)delete f.tweens[p][b];delete f.attrs[p][g]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var g=new f(h);g.play()},e.Easings={BackEaseIn(h,p,g,_){var b=1.70158;return g*(h/=_)*h*((b+1)*h-b)+p},BackEaseOut(h,p,g,_){var b=1.70158;return g*((h=h/_-1)*h*((b+1)*h+b)+1)+p},BackEaseInOut(h,p,g,_){var b=1.70158;return(h/=_/2)<1?g/2*(h*h*(((b*=1.525)+1)*h-b))+p:g/2*((h-=2)*h*(((b*=1.525)+1)*h+b)+2)+p},ElasticEaseIn(h,p,g,_,b,y){var m=0;return h===0?p:(h/=_)===1?p+g:(y||(y=_*.3),!b||b0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}OS.Arc=As;As.prototype._centroid=!0;As.prototype.className="Arc";As.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,zIe._registerNode)(As);$S.Factory.addGetterSetter(As,"innerRadius",0,(0,NS.getNumberValidator)());$S.Factory.addGetterSetter(As,"outerRadius",0,(0,NS.getNumberValidator)());$S.Factory.addGetterSetter(As,"angle",0,(0,NS.getNumberValidator)());$S.Factory.addGetterSetter(As,"clockwise",!1,(0,NS.getBooleanValidator)());var DS={},Gm={};Object.defineProperty(Gm,"__esModule",{value:!0});Gm.Line=void 0;const LS=je,VIe=On,JU=Te,jIe=Ge;function I3(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),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function YM(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]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),g=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),b=g/h,y=l+_,m=b-_*_,v=y*y+m>0?Math.sqrt(y*y+m):0,S=_*_+m>0?Math.sqrt(_*_+m):0,w=_+Math.sqrt(_*_+m)!==0?m*Math.log(Math.abs((y+v)/(_+S))):0;return Math.sqrt(h)/2*(y*v-_*S+w)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(eG);Object.defineProperty(jf,"__esModule",{value:!0});jf.Path=void 0;const UIe=je,GIe=On,HIe=Ge,zc=eG;class An extends GIe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=An.parsePathData(this.data()),this.pathLength=An.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,b=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,b),t.arc(0,0,g,d,d+f,1-p),t.scale(1/_,1/b),t.rotate(-h),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 c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const g=An.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(g.x,g.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return An.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return An.getPointOnCubicBezier((0,zc.t2length)(t,An.getPathLength(n),g=>(0,zc.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],g)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return An.getPointOnQuadraticBezier((0,zc.t2length)(t,An.getPathLength(n),g=>(0,zc.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],g)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,An.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}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(p[0]);){var y="",m=[],v=l,S=u,w,C,x,P,E,I,N,M,T,A;switch(h){case"l":l+=p.shift(),u+=p.shift(),y="L",m.push(l,u);break;case"L":l=p.shift(),u=p.shift(),m.push(l,u);break;case"m":var R=p.shift(),D=p.shift();if(l+=R,u+=D,y="M",a.length>2&&a[a.length-1].command==="z"){for(var $=a.length-2;$>=0;$--)if(a[$].command==="M"){l=a[$].points[0]+R,u=a[$].points[1]+D;break}}m.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),y="M",m.push(l,u),h="L";break;case"h":l+=p.shift(),y="L",m.push(l,u);break;case"H":l=p.shift(),y="L",m.push(l,u);break;case"v":u+=p.shift(),y="L",m.push(l,u);break;case"V":u=p.shift(),y="L",m.push(l,u);break;case"C":m.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),m.push(l,u);break;case"c":m.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",m.push(l,u);break;case"S":C=l,x=u,w=a[a.length-1],w.command==="C"&&(C=l+(l-w.points[2]),x=u+(u-w.points[3])),m.push(C,x,p.shift(),p.shift()),l=p.shift(),u=p.shift(),y="C",m.push(l,u);break;case"s":C=l,x=u,w=a[a.length-1],w.command==="C"&&(C=l+(l-w.points[2]),x=u+(u-w.points[3])),m.push(C,x,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",m.push(l,u);break;case"Q":m.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),m.push(l,u);break;case"q":m.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="Q",m.push(l,u);break;case"T":C=l,x=u,w=a[a.length-1],w.command==="Q"&&(C=l+(l-w.points[0]),x=u+(u-w.points[1])),l=p.shift(),u=p.shift(),y="Q",m.push(C,x,l,u);break;case"t":C=l,x=u,w=a[a.length-1],w.command==="Q"&&(C=l+(l-w.points[0]),x=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),y="Q",m.push(C,x,l,u);break;case"A":P=p.shift(),E=p.shift(),I=p.shift(),N=p.shift(),M=p.shift(),T=l,A=u,l=p.shift(),u=p.shift(),y="A",m=this.convertEndpointToCenterParameterization(T,A,l,u,N,M,P,E,I);break;case"a":P=p.shift(),E=p.shift(),I=p.shift(),N=p.shift(),M=p.shift(),T=l,A=u,l+=p.shift(),u+=p.shift(),y="A",m=this.convertEndpointToCenterParameterization(T,A,l,u,N,M,P,E,I);break}a.push({command:y||h,points:m,start:{x:v,y:S},pathLength:this.calcLength(v,S,y||h,m)})}(h==="z"||h==="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=An;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,zc.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,zc.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)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=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var g=p*s*f/l,_=p*-l*d/s,b=(t+r)/2+Math.cos(c)*g-Math.sin(c)*_,y=(n+i)/2+Math.sin(c)*g+Math.cos(c)*_,m=function(E){return Math.sqrt(E[0]*E[0]+E[1]*E[1])},v=function(E,I){return(E[0]*I[0]+E[1]*I[1])/(m(E)*m(I))},S=function(E,I){return(E[0]*I[1]=1&&(P=0),a===0&&P>0&&(P=P-2*Math.PI),a===1&&P<0&&(P=P+2*Math.PI),[b,y,s,l,w,P,c,a]}}jf.Path=An;An.prototype.className="Path";An.prototype._attrsAffectingSize=["data"];(0,HIe._registerNode)(An);UIe.Factory.addGetterSetter(An,"data");Object.defineProperty(DS,"__esModule",{value:!0});DS.Arrow=void 0;const FS=je,qIe=Gm,tG=Te,WIe=Ge,ZM=jf;class yc extends qIe.Line{_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 f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=ZM.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=ZM.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/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,d/2),t.lineTo(-a,-d/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}}}DS.Arrow=yc;yc.prototype.className="Arrow";(0,WIe._registerNode)(yc);FS.Factory.addGetterSetter(yc,"pointerLength",10,(0,tG.getNumberValidator)());FS.Factory.addGetterSetter(yc,"pointerWidth",10,(0,tG.getNumberValidator)());FS.Factory.addGetterSetter(yc,"pointerAtBeginning",!1);FS.Factory.addGetterSetter(yc,"pointerAtEnding",!0);var BS={};Object.defineProperty(BS,"__esModule",{value:!0});BS.Circle=void 0;const KIe=je,XIe=On,QIe=Te,YIe=Ge;class Uf extends XIe.Shape{_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)}}BS.Circle=Uf;Uf.prototype._centroid=!0;Uf.prototype.className="Circle";Uf.prototype._attrsAffectingSize=["radius"];(0,YIe._registerNode)(Uf);KIe.Factory.addGetterSetter(Uf,"radius",0,(0,QIe.getNumberValidator)());var zS={};Object.defineProperty(zS,"__esModule",{value:!0});zS.Ellipse=void 0;const hA=je,ZIe=On,nG=Te,JIe=Ge;class Yl extends ZIe.Shape{_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)}}zS.Ellipse=Yl;Yl.prototype.className="Ellipse";Yl.prototype._centroid=!0;Yl.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,JIe._registerNode)(Yl);hA.Factory.addComponentsGetterSetter(Yl,"radius",["x","y"]);hA.Factory.addGetterSetter(Yl,"radiusX",0,(0,nG.getNumberValidator)());hA.Factory.addGetterSetter(Yl,"radiusY",0,(0,nG.getNumberValidator)());var VS={};Object.defineProperty(VS,"__esModule",{value:!0});VS.Image=void 0;const Hw=nn,vc=je,e8e=On,t8e=Ge,Hm=Te;let Ia=class rG extends e8e.Shape{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?Hw.Util.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?Hw.Util.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=Hw.Util.createImageElement();i.onload=function(){var o=new rG({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};VS.Image=Ia;Ia.prototype.className="Image";(0,t8e._registerNode)(Ia);vc.Factory.addGetterSetter(Ia,"cornerRadius",0,(0,Hm.getNumberOrArrayOfNumbersValidator)(4));vc.Factory.addGetterSetter(Ia,"image");vc.Factory.addComponentsGetterSetter(Ia,"crop",["x","y","width","height"]);vc.Factory.addGetterSetter(Ia,"cropX",0,(0,Hm.getNumberValidator)());vc.Factory.addGetterSetter(Ia,"cropY",0,(0,Hm.getNumberValidator)());vc.Factory.addGetterSetter(Ia,"cropWidth",0,(0,Hm.getNumberValidator)());vc.Factory.addGetterSetter(Ia,"cropHeight",0,(0,Hm.getNumberValidator)());var Ef={};Object.defineProperty(Ef,"__esModule",{value:!0});Ef.Tag=Ef.Label=void 0;const jS=je,n8e=On,r8e=zf,pA=Te,iG=Ge;var oG=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],i8e="Change.konva",o8e="none",M3="up",R3="right",O3="down",$3="left",a8e=oG.length;class gA extends r8e.Group{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)}}GS.RegularPolygon=_c;_c.prototype.className="RegularPolygon";_c.prototype._centroid=!0;_c.prototype._attrsAffectingSize=["radius"];(0,h8e._registerNode)(_c);aG.Factory.addGetterSetter(_c,"radius",0,(0,sG.getNumberValidator)());aG.Factory.addGetterSetter(_c,"sides",0,(0,sG.getNumberValidator)());var HS={};Object.defineProperty(HS,"__esModule",{value:!0});HS.Ring=void 0;const lG=je,p8e=On,uG=Te,g8e=Ge;var JM=Math.PI*2;class Sc extends p8e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,JM,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),JM,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)}}HS.Ring=Sc;Sc.prototype.className="Ring";Sc.prototype._centroid=!0;Sc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,g8e._registerNode)(Sc);lG.Factory.addGetterSetter(Sc,"innerRadius",0,(0,uG.getNumberValidator)());lG.Factory.addGetterSetter(Sc,"outerRadius",0,(0,uG.getNumberValidator)());var qS={};Object.defineProperty(qS,"__esModule",{value:!0});qS.Sprite=void 0;const xc=je,m8e=On,y8e=Vf,cG=Te,v8e=Ge;class Ma extends m8e.Shape{constructor(t){super(t),this._updated=!0,this.anim=new y8e.Animation(()=>{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],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_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],c=r*2;t.rect(u[c+0],u[c+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 my;function Ww(){return my||(my=N3.Util.createCanvasElement().getContext(E8e),my)}function D8e(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function L8e(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function F8e(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class hn extends S8e.Shape{constructor(t){super(F8e(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n<$8e;n++)this.on(gG[n]+C8e,this._setTextData);this._setTextData()}_sceneFunc(t){var n=this.textArr,r=n.length;if(this.text()){var i=this.padding(),o=this.fontSize(),a=this.lineHeight()*o,s=this.verticalAlign(),l=this.direction(),u=0,c=this.align(),d=this.getWidth(),f=this.letterSpacing(),h=this.fill(),p=this.textDecoration(),g=p.indexOf("underline")!==-1,_=p.indexOf("line-through")!==-1,b;l=l===fG?t.direction:l;var y=0,y=a/2,m=0,v=0;for(l===nR&&t.setAttr("direction",l),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",tR),t.setAttr("textAlign",hG),s===tR?u=(this.getHeight()-r*a-i*2)/2:s===k8e&&(u=this.getHeight()-r*a-i*2),t.translate(i,u+i),b=0;b1&&(y+=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=N3.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(T8e,n),this}getWidth(){var t=this.attrs.width===Vc||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Vc||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 N3.Util.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=Ww(),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()+gy+this.fontVariant()+gy+(this.fontSize()+I8e)+N8e(this.fontFamily())}_addTextLine(t){this.align()===Ch&&(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 Ww().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!==Vc&&o!==void 0,l=a!==Vc&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==rR,g=h!==O8e&&p,_=this.ellipsis();this.textArr=[],Ww().font=this._getContextFont();for(var b=_?this._getTextWidth(qw):0,y=0,m=t.length;yc)for(;v.length>0;){for(var w=0,C=v.length,x="",P=0;w>>1,I=v.slice(0,E+1),N=this._getTextWidth(I)+b;N<=c?(w=E+1,x=I,P=N):C=E}if(x){if(g){var M,T=v[x.length],A=T===gy||T===eR;A&&P<=c?M=x.length:M=Math.max(x.lastIndexOf(gy),x.lastIndexOf(eR))+1,M>0&&(w=M,x=x.slice(0,w),P=this._getTextWidth(x))}x=x.trimRight(),this._addTextLine(x),r=Math.max(r,P),f+=i;var R=this._shouldHandleEllipsis(f);if(R){this._tryToAddEllipsisToLastLine();break}if(v=v.slice(w),v=v.trimLeft(),v.length>0&&(S=this._getTextWidth(v),S<=c)){this._addTextLine(v),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(v),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&yd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Vc&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==rR;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Vc&&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+qw)n?null:Eh.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=Eh.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${_G}`).join(" "),aR="nodesRect",q8e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],W8e={"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 K8e="ontouchstart"in go.Konva._global;function X8e(e,t,n){if(e==="rotater")return n;t+=_t.Util.degToRad(W8e[e]||0);var r=(_t.Util.radToDeg(t)%360+360)%360;return _t.Util._inRange(r,315+22.5,360)||_t.Util._inRange(r,0,22.5)?"ns-resize":_t.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":_t.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":_t.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":_t.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":_t.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":_t.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":_t.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(_t.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var lb=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],sR=1e8;function Q8e(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 SG(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{...e,rotation:e.rotation+t,x:r,y:i}}function Y8e(e,t){const n=Q8e(e);return SG(e,t,n)}function Z8e(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(_t.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(q8e.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&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(aR),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(aR,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=(go.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={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 SG(c,-go.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-sR,y:-sR,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new _t.Transform;r.rotate(-go.Konva.getAngle(this.rotation()));var i=1/0,o=1/0,a=-1/0,s=-1/0;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.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:go.Konva.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(),lb.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var n=new U8e.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:K8e?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=go.Konva.getAngle(this.rotation()),o=this.rotateAnchorCursor(),a=X8e(t,i,o);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new j8e.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,r){var i=r.getParent(),o=i.padding();n.beginPath(),n.rect(-o,-o,r.width()+o*2,r.height()+o*2),n.moveTo(r.width()/2,-o),i.rotateEnabled()&&n.lineTo(r.width()/2,-i.rotateAnchorOffset()*_t.Util._sign(r.height())-o),n.fillStrokeShape(r)},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 c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let M=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(M-=Math.PI);var f=go.Konva.getAngle(this.rotation());const T=f+M,A=go.Konva.getAngle(this.rotationSnapTolerance()),D=Z8e(this.rotationSnaps(),T,A)-d.rotation,$=Y8e(d,D);this._fitNodesInto($,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var m=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var g=m?{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(g.x-o.x(),2)+Math.pow(g.y-o.y(),2));var _=this.findOne(".top-left").x()>g.x?-1:1,b=this.findOne(".top-left").y()>g.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-left").x(g.x-n),this.findOne(".top-left").y(g.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var g=m?{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()-g.x,2)+Math.pow(g.y-o.y(),2));var _=this.findOne(".top-right").x()g.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-right").x(g.x+n),this.findOne(".top-right").y(g.y-r)}var y=o.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.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(p){var g=m?{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(g.x-o.x(),2)+Math.pow(o.y()-g.y,2));var _=g.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(_t.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(_t.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}var o=new _t.Transform;if(o.rotate(go.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const f=o.point({x:-this.padding()*2,y:0});t.x+=f.x,t.y+=f.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const f=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,t.width+=this.padding()*2}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const f=o.point({x:0,y:-this.padding()*2});t.x+=f.x,t.y+=f.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,t.height+=this.padding()*2}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const f=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,t.height+=this.padding()*2}if(this.boundBoxFunc()){const f=this.boundBoxFunc()(r,t);f?t=f:_t.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,s=new _t.Transform;s.translate(r.x,r.y),s.rotate(r.rotation),s.scale(r.width/a,r.height/a);const l=new _t.Transform,u=t.width/a,c=t.height/a;this.flipEnabled()===!1?(l.translate(t.x,t.y),l.rotate(t.rotation),l.translate(t.width<0?t.width:0,t.height<0?t.height:0),l.scale(Math.abs(u),Math.abs(c))):(l.translate(t.x,t.y),l.rotate(t.rotation),l.scale(u,c));const d=l.multiply(s.invert());this._nodes.forEach(f=>{var h;const p=f.getParent().getAbsoluteTransform(),g=f.getTransform().copy();g.translate(f.offsetX(),f.offsetY());const _=new _t.Transform;_.multiply(p.copy().invert()).multiply(d).multiply(p).multiply(g);const b=_.decompose();f.setAttrs(b),this._fire("transform",{evt:n,target:f}),f._fire("transform",{evt:n,target:f}),(h=f.getLayer())===null||h===void 0||h.batchDraw()}),this.rotation(_t.Util._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(_t.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.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()*_t.Util._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});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(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=""),oR.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return iR.Node.prototype.toObject.call(this)}clone(t){var n=iR.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}XS.Transformer=lt;function J8e(e){return e instanceof Array||_t.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){lb.indexOf(t)===-1&&_t.Util.warn("Unknown anchor name: "+t+". Available names are: "+lb.join(", "))}),e||[]}lt.prototype.className="Transformer";(0,G8e._registerNode)(lt);yt.Factory.addGetterSetter(lt,"enabledAnchors",lb,J8e);yt.Factory.addGetterSetter(lt,"flipEnabled",!0,(0,eu.getBooleanValidator)());yt.Factory.addGetterSetter(lt,"resizeEnabled",!0);yt.Factory.addGetterSetter(lt,"anchorSize",10,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"rotateEnabled",!0);yt.Factory.addGetterSetter(lt,"rotationSnaps",[]);yt.Factory.addGetterSetter(lt,"rotateAnchorOffset",50,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"rotateAnchorCursor","crosshair");yt.Factory.addGetterSetter(lt,"rotationSnapTolerance",5,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderEnabled",!0);yt.Factory.addGetterSetter(lt,"anchorStroke","rgb(0, 161, 255)");yt.Factory.addGetterSetter(lt,"anchorStrokeWidth",1,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"anchorFill","white");yt.Factory.addGetterSetter(lt,"anchorCornerRadius",0,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderStroke","rgb(0, 161, 255)");yt.Factory.addGetterSetter(lt,"borderStrokeWidth",1,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderDash");yt.Factory.addGetterSetter(lt,"keepRatio",!0);yt.Factory.addGetterSetter(lt,"shiftBehavior","default");yt.Factory.addGetterSetter(lt,"centeredScaling",!1);yt.Factory.addGetterSetter(lt,"ignoreStroke",!1);yt.Factory.addGetterSetter(lt,"padding",0,(0,eu.getNumberValidator)());yt.Factory.addGetterSetter(lt,"node");yt.Factory.addGetterSetter(lt,"nodes");yt.Factory.addGetterSetter(lt,"boundBoxFunc");yt.Factory.addGetterSetter(lt,"anchorDragBoundFunc");yt.Factory.addGetterSetter(lt,"anchorStyleFunc");yt.Factory.addGetterSetter(lt,"shouldOverdrawWholeArea",!1);yt.Factory.addGetterSetter(lt,"useSingleNodeRotation",!0);yt.Factory.backCompat(lt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var QS={};Object.defineProperty(QS,"__esModule",{value:!0});QS.Wedge=void 0;const YS=je,e9e=On,t9e=Ge,xG=Te,n9e=Ge;class Ps extends e9e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,t9e.Konva.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)}}QS.Wedge=Ps;Ps.prototype.className="Wedge";Ps.prototype._centroid=!0;Ps.prototype._attrsAffectingSize=["radius"];(0,n9e._registerNode)(Ps);YS.Factory.addGetterSetter(Ps,"radius",0,(0,xG.getNumberValidator)());YS.Factory.addGetterSetter(Ps,"angle",0,(0,xG.getNumberValidator)());YS.Factory.addGetterSetter(Ps,"clockwise",!1);YS.Factory.backCompat(Ps,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var ZS={};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.Blur=void 0;const lR=je,r9e=Kt,i9e=Te;function uR(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var o9e=[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],a9e=[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 s9e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,g,_,b,y,m,v,S,w,C,x,P,E,I,N,M=t+t+1,T=r-1,A=i-1,R=t+1,D=R*(R+1)/2,$=new uR,L=null,O=$,B=null,U=null,j=o9e[t],q=a9e[t];for(s=1;s>q,I!==0?(I=255/I,n[c]=(f*j>>q)*I,n[c+1]=(h*j>>q)*I,n[c+2]=(p*j>>q)*I):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=b,p-=y,g-=m,_-=B.r,b-=B.g,y-=B.b,m-=B.a,l=d+((l=o+t+1)>q,I>0?(I=255/I,n[l]=(f*j>>q)*I,n[l+1]=(h*j>>q)*I,n[l+2]=(p*j>>q)*I):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=b,p-=y,g-=m,_-=B.r,b-=B.g,y-=B.b,m-=B.a,l=o+((l=a+R)0&&s9e(t,n)};ZS.Blur=l9e;lR.Factory.addGetterSetter(r9e.Node,"blurRadius",0,(0,i9e.getNumberValidator)(),lR.Factory.afterSetFilter);var JS={};Object.defineProperty(JS,"__esModule",{value:!0});JS.Brighten=void 0;const cR=je,u9e=Kt,c9e=Te,d9e=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};e2.Contrast=p9e;dR.Factory.addGetterSetter(f9e.Node,"contrast",0,(0,h9e.getNumberValidator)(),dR.Factory.afterSetFilter);var t2={};Object.defineProperty(t2,"__esModule",{value:!0});t2.Emboss=void 0;const Nl=je,n2=Kt,g9e=nn,wG=Te,m9e=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,c=l*4,d=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:g9e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,g=l;do{var _=f+(g-1)*4,b=a;g+b<1&&(b=0),g+b>l&&(b=0);var y=p+(g-1+b)*4,m=s[_]-s[y],v=s[_+1]-s[y+1],S=s[_+2]-s[y+2],w=m,C=w>0?w:-w,x=v>0?v:-v,P=S>0?S:-S;if(x>C&&(w=v),P>C&&(w=S),w*=t,i){var E=s[_]+w,I=s[_+1]+w,N=s[_+2]+w;s[_]=E>255?255:E<0?0:E,s[_+1]=I>255?255:I<0?0:I,s[_+2]=N>255?255:N<0?0:N}else{var M=n-w;M<0?M=0:M>255&&(M=255),s[_]=s[_+1]=s[_+2]=M}}while(--g)}while(--d)};t2.Emboss=m9e;Nl.Factory.addGetterSetter(n2.Node,"embossStrength",.5,(0,wG.getNumberValidator)(),Nl.Factory.afterSetFilter);Nl.Factory.addGetterSetter(n2.Node,"embossWhiteLevel",.5,(0,wG.getNumberValidator)(),Nl.Factory.afterSetFilter);Nl.Factory.addGetterSetter(n2.Node,"embossDirection","top-left",null,Nl.Factory.afterSetFilter);Nl.Factory.addGetterSetter(n2.Node,"embossBlend",!1,null,Nl.Factory.afterSetFilter);var r2={};Object.defineProperty(r2,"__esModule",{value:!0});r2.Enhance=void 0;const fR=je,y9e=Kt,v9e=Te;function Qw(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 b9e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,g,_,b,y,m,v,S,w;for(h>0?(g=i+h*(255-i),_=r-h*(r-0),y=s+h*(255-s),m=a-h*(a-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,g=i+h*(i-p),_=r+h*(r-p),b=(s+a)*.5,y=s+h*(s-b),m=a+h*(a-b),v=(c+u)*.5,S=c+h*(c-v),w=u+h*(u-v)),f=0;fb?_:b;var y=a,m=o,v,S,w=360/m*Math.PI/180,C,x;for(S=0;Sm?y:m;var v=a,S=o,w,C,x=n.polarRotation||0,P,E;for(c=0;ct&&(v=m,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function $9e(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&&h=0&&p=n))for(o=g;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=v[a+0],l+=v[a+1],u+=v[a+2],c+=v[a+3],m+=1);for(s=s/m,l=l/m,u=u/m,c=c/m,i=h;i=n))for(o=g;o<_;o+=1)o>=r||(a=(n*o+i)*4,v[a+0]=s,v[a+1]=l,v[a+2]=u,v[a+3]=c)}};d2.Pixelate=j9e;mR.Factory.addGetterSetter(z9e.Node,"pixelSize",8,(0,V9e.getNumberValidator)(),mR.Factory.afterSetFilter);var f2={};Object.defineProperty(f2,"__esModule",{value:!0});f2.Posterize=void 0;const yR=je,U9e=Kt,G9e=Te,H9e=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)});cb.Factory.addGetterSetter(xA.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});cb.Factory.addGetterSetter(xA.Node,"blue",0,q9e.RGBComponent,cb.Factory.afterSetFilter);var p2={};Object.defineProperty(p2,"__esModule",{value:!0});p2.RGBA=void 0;const Gg=je,g2=Kt,K9e=Te,X9e=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)});Gg.Factory.addGetterSetter(g2.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});Gg.Factory.addGetterSetter(g2.Node,"blue",0,K9e.RGBComponent,Gg.Factory.afterSetFilter);Gg.Factory.addGetterSetter(g2.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var m2={};Object.defineProperty(m2,"__esModule",{value:!0});m2.Sepia=void 0;const Q9e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};y2.Solarize=Y9e;var v2={};Object.defineProperty(v2,"__esModule",{value:!0});v2.Threshold=void 0;const vR=je,Z9e=Kt,J9e=Te,eMe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new Ah.Stage({container:o,width:r,height:i}),s=new Ah.Layer,l=new Ah.Layer;return s.add(new Ah.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new Ah.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},zMe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),SR=async(e,t)=>{const n=e.toDataURL(t);return await zMe(n,t.width,t.height)},wA=async(e,t,n,r,i)=>{const o=se("canvas"),a=ES(),s=$6e();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await ab(u,d),h=await SR(u,d),p=await BMe(r?e.objects.filter(wL):[],l,i),g=await ab(p,l),_=await SR(p,l);return{baseBlob:f,baseImageData:h,maskBlob:g,maskImageData:_}},VMe=()=>{pe({actionCreator:A6e,effect:async(e,{dispatch:t,getState:n})=>{const r=se("canvas"),i=n(),o=await wA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(it({title:X("toast.problemSavingMask"),description:X("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(ce.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:X("toast.maskSavedAssets")}}}))}})},jMe=()=>{pe({actionCreator:R6e,effect:async(e,{dispatch:t,getState:n})=>{const r=se("canvas"),i=n(),{id:o}=e.payload,a=await wA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!a)return;const{maskBlob:s}=a;if(!s){r.error("Problem getting mask layer blob"),t(it({title:X("toast.problemImportingMask"),description:X("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:l}=i.gallery,u=await t(ce.endpoints.uploadImage.initiate({file:new File([s],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:l==="none"?void 0:l,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:X("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:c}=u;t(Hl({id:o,controlImage:c}))}})},UMe=async()=>{const e=ES();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),ab(t,t.getClientRect())},GMe=()=>{pe({actionCreator:I6e,effect:async(e,{dispatch:t})=>{const n=J_.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await UMe();if(!r){n.error("Problem getting base layer blob"),t(it({title:X("toast.problemMergingCanvas"),description:X("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=ES();if(!i){n.error("Problem getting canvas base layer"),t(it({title:X("toast.problemMergingCanvas"),description:X("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()??void 0}),a=await t(ce.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:X("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(Mle({kind:"image",layer:"base",imageName:s,...o}))}})},HMe=()=>{pe({actionCreator:T6e,effect:async(e,{dispatch:t,getState:n})=>{const r=se("canvas"),i=n();let o;try{o=await TS(i)}catch(s){r.error(String(s)),t(it({title:X("toast.problemSavingCanvas"),description:X("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(ce.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:X("toast.canvasSavedGallery")}}}))}})},qMe=(e,t,n)=>{if(!(Fie.match(e)||S6.match(e)||Hl.match(e)||Bie.match(e)||x6.match(e)))return!1;const{id:i}=e.payload,o=di(n.controlAdapters,i),a=di(t.controlAdapters,i);if(!o||!gi(o)||!a||!gi(a)||x6.match(e)&&o.shouldAutoConfig===!0)return!1;const{controlImage:s,processorType:l,shouldAutoConfig:u}=a;return S6.match(e)&&!u?!1:l!=="none"&&!!s},WMe=()=>{pe({predicate:qMe,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=se("session"),{id:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(IE({id:o}))}})},TG=e=>(e==null?void 0:e.type)==="image_output",KMe=()=>{pe({actionCreator:IE,effect:async(e,{dispatch:t,getState:n,take:r})=>{var u;const i=se("session"),{id:o}=e.payload,a=di(n().controlAdapters,o);if(!(a!=null&&a.controlImage)||!gi(a)){i.error("Unable to process ControlNet image");return}if(a.processorType==="none"||a.processorNode.type==="none")return;const s=a.processorNode.id,l={prepend:!0,batch:{graph:{nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,use_cache:!1,image:{image_name:a.controlImage}}}},runs:1}};try{const c=t(un.endpoints.enqueueBatch.initiate(l,{fixedCacheKey:"enqueueBatch"})),d=await c.unwrap();c.reset(),i.debug({enqueueResult:pt(d)},X("queue.graphQueued"));const[f]=await r(h=>TE.match(h)&&h.payload.data.queue_batch_id===d.batch.batch_id&&h.payload.data.source_node_id===s);if(TG(f.payload.data.result)){const{image_name:h}=f.payload.data.result.image,[{payload:p}]=await r(_=>ce.endpoints.getImageDTO.matchFulfilled(_)&&_.payload.image_name===h),g=p;i.debug({controlNetId:e.payload,processedControlImage:g},"ControlNet image processed"),t(RE({id:o,processedControlImage:g.image_name}))}}catch(c){if(i.error({enqueueBatchArg:pt(l)},X("queue.graphFailedToQueue")),c instanceof Object&&"data"in c&&"status"in c&&c.status===403){const d=((u=c.data)==null?void 0:u.detail)||"Unknown Error";t(it({title:X("queue.graphFailedToQueue"),status:"error",description:d,duration:15e3})),t(Vie()),t(Hl({id:o,controlImage:null}));return}t(it({title:X("queue.graphFailedToQueue"),status:"error"}))}}})},CA=ge("app/enqueueRequested");ge("app/batchEnqueued");const XMe=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("

")})},xR=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),QMe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=QMe(e.data),i=YMe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},_e="positive_conditioning",Ce="negative_conditioning",ue="denoise_latents",Kc="denoise_latents_hrf",xe="latents_to_image",tl="latents_to_image_hrf_hr",_u="latents_to_image_hrf_lr",Ph="image_to_latents_hrf",Us="resize_hrf",Zh="esrgan_hrf",Wu="linear_ui_output",xl="nsfw_checker",Nu="invisible_watermark",ve="noise",kh="noise_hrf",Ro="main_model_loader",b2="onnx_model_loader",fi="vae_loader",AG="lora_loader",ct="clip_skip",Bt="image_to_latents",aa="resize_image",Ku="img2img_resize",le="canvas_output",It="inpaint_image",JMe="scaled_inpaint_image",Gn="inpaint_image_resize_up",or="inpaint_image_resize_down",at="inpaint_infill",ts="inpaint_infill_resize_down",eRe="inpaint_final_image",Pt="inpaint_create_mask",tRe="inpaint_mask",$e="canvas_coherence_denoise_latents",rt="canvas_coherence_noise",Dl="canvas_coherence_noise_increment",ln="canvas_coherence_mask_edge",et="canvas_coherence_inpaint_create_mask",Hd="tomask",gr="mask_blur",rr="mask_combine",kt="mask_resize_up",vr="mask_resize_down",nRe="img_paste",Ih="control_net_collect",vy="ip_adapter_collect",Mh="t2i_adapter_collect",vi="core_metadata",Jh="esrgan",rRe="scale_image",mr="sdxl_model_loader",ae="sdxl_denoise_latents",fu="sdxl_refiner_model_loader",by="sdxl_refiner_positive_conditioning",_y="sdxl_refiner_negative_conditioning",Wo="sdxl_refiner_denoise_latents",zi="refiner_inpaint_create_mask",In="seamless",Co="refiner_seamless",iRe=[le,xe,tl,xl,Nu,Jh,Zh,Us,_u,Ku,It,JMe,Gn,or,at,ts,eRe,Pt,tRe,nRe,rRe],PG="text_to_image_graph",D3="image_to_image_graph",kG="canvas_text_to_image_graph",L3="canvas_image_to_image_graph",_2="canvas_inpaint_graph",S2="canvas_outpaint_graph",EA="sdxl_text_to_image_graph",db="sxdl_image_to_image_graph",x2="sdxl_canvas_text_to_image_graph",Hg="sdxl_canvas_image_to_image_graph",Ll="sdxl_canvas_inpaint_graph",Fl="sdxl_canvas_outpaint_graph",ks=(e,t,n)=>{e.nodes[vi]={id:vi,type:"core_metadata",...t},e.edges.push({source:{node_id:vi,field:"metadata"},destination:{node_id:n,field:"metadata"}})},Lo=(e,t)=>{const n=e.nodes[vi];n&&Object.assign(n,t)},Rh=(e,t)=>{const n=e.nodes[vi];n&&delete n[t]},Oh=e=>!!e.nodes[vi],oRe=(e,t)=>{e.edges=e.edges.filter(n=>n.source.node_id!==vi),e.edges.push({source:{node_id:vi,field:"metadata"},destination:{node_id:t,field:"metadata"}})},no=(e,t,n)=>{const r=Iie(e.controlAdapters).filter(o=>{var a,s;return((a=o.model)==null?void 0:a.base_model)===((s=e.generation.model)==null?void 0:s.base_model)}),i=[];if(r.length){const o={id:Ih,type:"collect",is_intermediate:!0};t.nodes[Ih]=o,t.edges.push({source:{node_id:Ih,field:"collection"},destination:{node_id:n,field:"control"}}),$e in t.nodes&&t.edges.push({source:{node_id:Ih,field:"collection"},destination:{node_id:$e,field:"control"}}),r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,controlMode:f,resizeMode:h,model:p,processorType:g,weight:_}=a,b={id:`control_net_${s}`,type:"controlnet",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,control_mode:f,resize_mode:h,control_model:p,control_weight:_};if(u&&g!=="none")b.image={image_name:u};else if(l)b.image={image_name:l};else return;t.nodes[b.id]=b,i.push($f(b,["id","type","is_intermediate"])),t.edges.push({source:{node_id:b.id,field:"control"},destination:{node_id:Ih,field:"item"}})}),Lo(t,{controlnets:i})}},ro=(e,t,n)=>{const r=Rie(e.controlAdapters).filter(i=>{var o,a;return((o=i.model)==null?void 0:o.base_model)===((a=e.generation.model)==null?void 0:a.base_model)});if(r.length){const i={id:vy,type:"collect",is_intermediate:!0};t.nodes[vy]=i,t.edges.push({source:{node_id:vy,field:"collection"},destination:{node_id:n,field:"ip_adapter"}}),$e in t.nodes&&t.edges.push({source:{node_id:vy,field:"collection"},destination:{node_id:$e,field:"ip_adapter"}});const o=[];r.forEach(a=>{if(!a.model)return;const{id:s,weight:l,model:u,beginStepPct:c,endStepPct:d}=a,f={id:`ip_adapter_${s}`,type:"ip_adapter",is_intermediate:!0,weight:l,ip_adapter_model:u,begin_step_percent:c,end_step_percent:d};if(a.controlImage)f.image={image_name:a.controlImage};else return;t.nodes[f.id]=f,o.push($f(f,["id","type","is_intermediate"])),t.edges.push({source:{node_id:f.id,field:"ip_adapter"},destination:{node_id:i.id,field:"item"}})}),Lo(t,{ipAdapters:o})}},Gf=(e,t,n,r=Ro)=>{const{loras:i}=e.lora,o=r_(i);if(o===0)return;t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===ct&&["clip"].includes(u.source.field)));let a="",s=0;const l=[];ps(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${AG}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};l.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,s===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:ct,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:h,field:"clip"}})),s===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[_2,S2].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:$e,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:_e,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Ce,field:"clip"}})),a=h,s+=1}),Lo(t,{loras:l})},io=(e,t,n=xe)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:xl,type:"img_nsfw",is_intermediate:!0};t.nodes[xl]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:xl,field:"image"}})},aRe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],TA=qn(e=>e,({ui:e})=>_E(e.activeTab)?e.activeTab:"txt2img"),DUe=qn(e=>e,({ui:e,config:t})=>{const r=aRe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),LUe=qn(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:SE}}),oo=(e,t)=>{const r=TA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Wu,type:"linear_ui_output",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Wu]=o;const a={node_id:Wu,field:"image"};Nu in t.nodes?t.edges.push({source:{node_id:Nu,field:"image"},destination:a}):xl in t.nodes?t.edges.push({source:{node_id:xl,field:"image"},destination:a}):le in t.nodes?t.edges.push({source:{node_id:le,field:"image"},destination:a}):tl in t.nodes?t.edges.push({source:{node_id:tl,field:"image"},destination:a}):xe in t.nodes&&t.edges.push({source:{node_id:xe,field:"image"},destination:a})},ao=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[In]={id:In,type:"seamless",seamless_x:r,seamless_y:i},r&&Lo(t,{seamless_x:r}),i&&Lo(t,{seamless_y:i});let o=ue;(t.id===EA||t.id===db||t.id===x2||t.id===Hg||t.id===Ll||t.id===Fl)&&(o=ae),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:In,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:In,field:"vae"}},{source:{node_id:In,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==_2||t.id===S2||t.id===Ll||t.id===Fl)&&t.edges.push({source:{node_id:In,field:"unet"},destination:{node_id:$e,field:"unet"}})},so=(e,t,n)=>{const r=$ie(e.controlAdapters).filter(i=>{var o,a;return((o=i.model)==null?void 0:o.base_model)===((a=e.generation.model)==null?void 0:a.base_model)});if(r.length){const i={id:Mh,type:"collect",is_intermediate:!0};t.nodes[Mh]=i,t.edges.push({source:{node_id:Mh,field:"collection"},destination:{node_id:n,field:"t2i_adapter"}}),$e in t.nodes&&t.edges.push({source:{node_id:Mh,field:"collection"},destination:{node_id:$e,field:"t2i_adapter"}});const o=[];r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,resizeMode:f,model:h,processorType:p,weight:g}=a,_={id:`t2i_adapter_${s}`,type:"t2i_adapter",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,resize_mode:f,t2i_adapter_model:h,weight:g};if(u&&p!=="none")_.image={image_name:u};else if(l)_.image={image_name:l};else return;t.nodes[_.id]=_,o.push($f(_,["id","type","is_intermediate"])),t.edges.push({source:{node_id:_.id,field:"t2i_adapter"},destination:{node_id:Mh,field:"item"}})}),Lo(t,{t2iAdapters:o})}},lo=(e,t,n=Ro)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r;l||(t.nodes[fi]={type:"vae_loader",id:fi,is_intermediate:!0,vae_model:r});const u=n==b2;(t.id===PG||t.id===D3||t.id===EA||t.id===db)&&t.edges.push({source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:xe,field:"vae"}}),(t.id===kG||t.id===L3||t.id===x2||t.id==Hg)&&t.edges.push({source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:s?xe:le,field:"vae"}}),(t.id===D3||t.id===db||t.id===L3||t.id===Hg)&&t.edges.push({source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Bt,field:"vae"}}),(t.id===_2||t.id===S2||t.id===Ll||t.id===Fl)&&(t.edges.push({source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:It,field:"vae"}},{source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Pt,field:"vae"}},{source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:xe,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:et,field:"vae"}})),a&&(t.id===Ll||t.id===Fl)&&t.edges.push({source:{node_id:l?n:fi,field:l&&u?"vae_decoder":"vae"},destination:{node_id:zi,field:"vae"}}),r&&Lo(t,{vae:r})},uo=(e,t,n=xe)=>{const i=TA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[xl];if(!o)return;const s={id:Nu,type:"img_watermark",is_intermediate:i};t.nodes[Nu]=s,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:xl,field:"image"},destination:{node_id:Nu,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Nu,field:"image"}})},sRe=(e,t)=>{const n=se("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:g}=e.generation,{width:_,height:b}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:y,boundingBoxScaleMethod:m}=e.canvas,v=d==="fp32",S=!0,w=["auto","manual"].includes(m);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=Ro;const x=h,P={id:L3,nodes:{[C]:{type:"main_model_loader",id:C,is_intermediate:S,model:o},[ct]:{type:"clip_skip",id:ct,is_intermediate:S,skipped_layers:f},[_e]:{type:"compel",id:_e,is_intermediate:S,prompt:r},[Ce]:{type:"compel",id:Ce,is_intermediate:S,prompt:i},[ve]:{type:"noise",id:ve,is_intermediate:S,use_cpu:x,seed:l,width:w?y.width:_,height:w?y.height:b},[Bt]:{type:"i2l",id:Bt,is_intermediate:S},[ue]:{type:"denoise_latents",id:ue,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[le]:{type:"l2i",id:le,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ue,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:ct,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ue,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ue,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ue,field:"noise"}},{source:{node_id:Bt,field:"latents"},destination:{node_id:ue,field:"latents"}}]};return w?(P.nodes[Ku]={id:Ku,type:"img_resize",is_intermediate:S,image:t,width:y.width,height:y.height},P.nodes[xe]={id:xe,type:"l2i",is_intermediate:S,fp32:v},P.nodes[le]={id:le,type:"img_resize",is_intermediate:S,width:_,height:b},P.edges.push({source:{node_id:Ku,field:"image"},destination:{node_id:Bt,field:"image"}},{source:{node_id:ue,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}})):(P.nodes[le]={type:"l2i",id:le,is_intermediate:S,fp32:v},P.nodes[Bt].image=t,P.edges.push({source:{node_id:ue,field:"latents"},destination:{node_id:le,field:"latents"}})),ks(P,{generation_mode:"img2img",cfg_scale:a,width:w?y.width:_,height:w?y.height:b,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:x?"cpu":"cuda",scheduler:s,clip_skip:f,strength:c,init_image:t.image_name},le),(p||g)&&(ao(e,P,C),C=In),Gf(e,P,ue),lo(e,P,C),no(e,P,ue),ro(e,P,ue),so(e,P,ue),e.system.shouldUseNSFWChecker&&io(e,P,le),e.system.shouldUseWatermarker&&uo(e,P,le),oo(e,P),P},lRe=(e,t,n)=>{const r=se("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:g,canvasCoherenceMode:_,canvasCoherenceSteps:b,canvasCoherenceStrength:y,clipSkip:m,seamlessXAxis:v,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:w,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:x,boundingBoxScaleMethod:P}=e.canvas,E=!0,I=f==="fp32",N=["auto","manual"].includes(P);let M=Ro;const T=h,A={id:_2,nodes:{[M]:{type:"main_model_loader",id:M,is_intermediate:E,model:a},[ct]:{type:"clip_skip",id:ct,is_intermediate:E,skipped_layers:m},[_e]:{type:"compel",id:_e,is_intermediate:E,prompt:i},[Ce]:{type:"compel",id:Ce,is_intermediate:E,prompt:o},[gr]:{type:"img_blur",id:gr,is_intermediate:E,radius:p,blur_type:g},[It]:{type:"i2l",id:It,is_intermediate:E,fp32:I},[ve]:{type:"noise",id:ve,use_cpu:T,seed:d,is_intermediate:E},[Pt]:{type:"create_denoise_mask",id:Pt,is_intermediate:E,fp32:I},[ue]:{type:"denoise_latents",id:ue,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[rt]:{type:"noise",id:rt,use_cpu:T,seed:d+1,is_intermediate:E},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:E},[$e]:{type:"denoise_latents",id:$e,is_intermediate:E,steps:b,cfg_scale:s,scheduler:l,denoising_start:1-y,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:E,fp32:I},[le]:{type:"color_correct",id:le,is_intermediate:E,reference:t}},edges:[{source:{node_id:M,field:"unet"},destination:{node_id:ue,field:"unet"}},{source:{node_id:M,field:"clip"},destination:{node_id:ct,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ue,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ue,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ue,field:"noise"}},{source:{node_id:It,field:"latents"},destination:{node_id:ue,field:"latents"}},{source:{node_id:gr,field:"image"},destination:{node_id:Pt,field:"mask"}},{source:{node_id:Pt,field:"denoise_mask"},destination:{node_id:ue,field:"denoise_mask"}},{source:{node_id:M,field:"unet"},destination:{node_id:$e,field:"unet"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:$e,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:$e,field:"negative_conditioning"}},{source:{node_id:rt,field:"noise"},destination:{node_id:$e,field:"noise"}},{source:{node_id:ue,field:"latents"},destination:{node_id:$e,field:"latents"}},{source:{node_id:$e,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(N){const R=x.width,D=x.height;A.nodes[Gn]={type:"img_resize",id:Gn,is_intermediate:E,width:R,height:D,image:t},A.nodes[kt]={type:"img_resize",id:kt,is_intermediate:E,width:R,height:D,image:n},A.nodes[or]={type:"img_resize",id:or,is_intermediate:E,width:w,height:C},A.nodes[vr]={type:"img_resize",id:vr,is_intermediate:E,width:w,height:C},A.nodes[ve].width=R,A.nodes[ve].height=D,A.nodes[rt].width=R,A.nodes[rt].height=D,A.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:It,field:"image"}},{source:{node_id:kt,field:"image"},destination:{node_id:gr,field:"image"}},{source:{node_id:Gn,field:"image"},destination:{node_id:Pt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:or,field:"image"}},{source:{node_id:or,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:le,field:"mask"}})}else A.nodes[ve].width=w,A.nodes[ve].height=C,A.nodes[rt].width=w,A.nodes[rt].height=C,A.nodes[It]={...A.nodes[It],image:t},A.nodes[gr]={...A.nodes[gr],image:n},A.nodes[Pt]={...A.nodes[Pt],image:t},A.edges.push({source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:le,field:"mask"}});return _!=="unmasked"&&(A.nodes[et]={type:"create_denoise_mask",id:et,is_intermediate:E,fp32:I},N?A.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:et,field:"image"}}):A.nodes[et]={...A.nodes[et],image:t},_==="mask"&&(N?A.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:et,field:"mask"}}):A.nodes[et]={...A.nodes[et],mask:n}),_==="edge"&&(A.nodes[ln]={type:"mask_edge",id:ln,is_intermediate:E,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},N?A.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:ln,field:"image"}}):A.nodes[ln]={...A.nodes[ln],image:n},A.edges.push({source:{node_id:ln,field:"image"},destination:{node_id:et,field:"mask"}})),A.edges.push({source:{node_id:et,field:"denoise_mask"},destination:{node_id:$e,field:"denoise_mask"}})),(v||S)&&(ao(e,A,M),M=In),lo(e,A,M),Gf(e,A,ue,M),no(e,A,ue),ro(e,A,ue),so(e,A,ue),e.system.shouldUseNSFWChecker&&io(e,A,le),e.system.shouldUseWatermarker&&uo(e,A,le),oo(e,A),A},uRe=(e,t,n)=>{const r=se("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:g,canvasCoherenceSteps:_,canvasCoherenceStrength:b,infillTileSize:y,infillPatchmatchDownscaleSize:m,infillMethod:v,clipSkip:S,seamlessXAxis:w,seamlessYAxis:C}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:x,height:P}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:E,boundingBoxScaleMethod:I}=e.canvas,N=f==="fp32",M=!0,T=["auto","manual"].includes(I);let A=Ro;const R=h,D={id:S2,nodes:{[A]:{type:"main_model_loader",id:A,is_intermediate:M,model:a},[ct]:{type:"clip_skip",id:ct,is_intermediate:M,skipped_layers:S},[_e]:{type:"compel",id:_e,is_intermediate:M,prompt:i},[Ce]:{type:"compel",id:Ce,is_intermediate:M,prompt:o},[Hd]:{type:"tomask",id:Hd,is_intermediate:M,image:t},[rr]:{type:"mask_combine",id:rr,is_intermediate:M,mask2:n},[It]:{type:"i2l",id:It,is_intermediate:M,fp32:N},[ve]:{type:"noise",id:ve,use_cpu:R,seed:d,is_intermediate:M},[Pt]:{type:"create_denoise_mask",id:Pt,is_intermediate:M,fp32:N},[ue]:{type:"denoise_latents",id:ue,is_intermediate:M,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[rt]:{type:"noise",id:rt,use_cpu:R,seed:d+1,is_intermediate:M},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:M},[$e]:{type:"denoise_latents",id:$e,is_intermediate:M,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:M,fp32:N},[le]:{type:"color_correct",id:le,is_intermediate:M}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:ue,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:ct,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:at,field:"image"},destination:{node_id:It,field:"image"}},{source:{node_id:Hd,field:"image"},destination:{node_id:rr,field:"mask1"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ue,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ue,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ue,field:"noise"}},{source:{node_id:It,field:"latents"},destination:{node_id:ue,field:"latents"}},{source:{node_id:T?kt:rr,field:"image"},destination:{node_id:Pt,field:"mask"}},{source:{node_id:Pt,field:"denoise_mask"},destination:{node_id:ue,field:"denoise_mask"}},{source:{node_id:A,field:"unet"},destination:{node_id:$e,field:"unet"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:$e,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:$e,field:"negative_conditioning"}},{source:{node_id:rt,field:"noise"},destination:{node_id:$e,field:"noise"}},{source:{node_id:ue,field:"latents"},destination:{node_id:$e,field:"latents"}},{source:{node_id:at,field:"image"},destination:{node_id:Pt,field:"image"}},{source:{node_id:$e,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(v==="patchmatch"&&(D.nodes[at]={type:"infill_patchmatch",id:at,is_intermediate:M,downscale:m}),v==="lama"&&(D.nodes[at]={type:"infill_lama",id:at,is_intermediate:M}),v==="cv2"&&(D.nodes[at]={type:"infill_cv2",id:at,is_intermediate:M}),v==="tile"&&(D.nodes[at]={type:"infill_tile",id:at,is_intermediate:M,tile_size:y}),T){const $=E.width,L=E.height;D.nodes[Gn]={type:"img_resize",id:Gn,is_intermediate:M,width:$,height:L,image:t},D.nodes[kt]={type:"img_resize",id:kt,is_intermediate:M,width:$,height:L},D.nodes[or]={type:"img_resize",id:or,is_intermediate:M,width:x,height:P},D.nodes[ts]={type:"img_resize",id:ts,is_intermediate:M,width:x,height:P},D.nodes[vr]={type:"img_resize",id:vr,is_intermediate:M,width:x,height:P},D.nodes[ve].width=$,D.nodes[ve].height=L,D.nodes[rt].width=$,D.nodes[rt].height=L,D.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:at,field:"image"}},{source:{node_id:rr,field:"image"},destination:{node_id:kt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:or,field:"image"}},{source:{node_id:kt,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:at,field:"image"},destination:{node_id:ts,field:"image"}},{source:{node_id:ts,field:"image"},destination:{node_id:le,field:"reference"}},{source:{node_id:or,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:le,field:"mask"}})}else D.nodes[at]={...D.nodes[at],image:t},D.nodes[ve].width=x,D.nodes[ve].height=P,D.nodes[rt].width=x,D.nodes[rt].height=P,D.nodes[It]={...D.nodes[It],image:t},D.edges.push({source:{node_id:at,field:"image"},destination:{node_id:le,field:"reference"}},{source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:rr,field:"image"},destination:{node_id:le,field:"mask"}});return g!=="unmasked"&&(D.nodes[et]={type:"create_denoise_mask",id:et,is_intermediate:M,fp32:N},D.edges.push({source:{node_id:at,field:"image"},destination:{node_id:et,field:"image"}}),g==="mask"&&(T?D.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:et,field:"mask"}}):D.edges.push({source:{node_id:rr,field:"image"},destination:{node_id:et,field:"mask"}})),g==="edge"&&(D.nodes[ln]={type:"mask_edge",id:ln,is_intermediate:M,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},T?D.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:ln,field:"image"}}):D.edges.push({source:{node_id:rr,field:"image"},destination:{node_id:ln,field:"image"}}),D.edges.push({source:{node_id:ln,field:"image"},destination:{node_id:et,field:"mask"}})),D.edges.push({source:{node_id:et,field:"denoise_mask"},destination:{node_id:$e,field:"denoise_mask"}})),(w||C)&&(ao(e,D,A),A=In),lo(e,D,A),Gf(e,D,ue,A),no(e,D,ue),ro(e,D,ue),so(e,D,ue),e.system.shouldUseNSFWChecker&&io(e,D,le),e.system.shouldUseWatermarker&&uo(e,D,le),oo(e,D),D},Hf=(e,t,n,r=mr)=>{const{loras:i}=e.lora,o=r_(i);if(o===0)return;const a=[],s=r;let l=r;[In,zi].includes(r)&&(l=mr),t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field)));let u="",c=0;ps(i,d=>{const{model_name:f,base_model:h,weight:p}=d,g=`${AG}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:g,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a.push(qF.parse({lora:{model_name:f,base_model:h},weight:p})),t.nodes[g]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:g,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:g,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:g,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:g,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:g,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:g,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:g,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Ll,Fl].includes(t.id)&&t.edges.push({source:{node_id:g,field:"unet"},destination:{node_id:$e,field:"unet"}}),t.edges.push({source:{node_id:g,field:"clip"},destination:{node_id:_e,field:"clip"}}),t.edges.push({source:{node_id:g,field:"clip"},destination:{node_id:Ce,field:"clip"}}),t.edges.push({source:{node_id:g,field:"clip2"},destination:{node_id:_e,field:"clip2"}}),t.edges.push({source:{node_id:g,field:"clip2"},destination:{node_id:Ce,field:"clip2"}})),u=g,c+=1}),Lo(t,{loras:a})},wc=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},qf=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:g}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,b=g==="fp32",y=["auto","manual"].includes(_);if(!a)return;Lo(t,{refiner_model:a,refiner_positive_aesthetic_score:s,refiner_negative_aesthetic_score:l,refiner_cfg_scale:d,refiner_scheduler:c,refiner_start:f,refiner_steps:u});const m=r||mr,{joinedPositiveStylePrompt:v,joinedNegativeStylePrompt:S}=wc(e,!0);t.edges=t.edges.filter(w=>!(w.source.node_id===n&&["latents"].includes(w.source.field))),t.edges=t.edges.filter(w=>!(w.source.node_id===m&&["vae"].includes(w.source.field))),t.nodes[fu]={type:"sdxl_refiner_model_loader",id:fu,model:a},t.nodes[by]={type:"sdxl_refiner_compel_prompt",id:by,style:v,aesthetic_score:s},t.nodes[_y]={type:"sdxl_refiner_compel_prompt",id:_y,style:S,aesthetic_score:l},t.nodes[Wo]={type:"denoise_latents",id:Wo,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[Co]={id:Co,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:fu,field:"unet"},destination:{node_id:Co,field:"unet"}},{source:{node_id:fu,field:"vae"},destination:{node_id:Co,field:"vae"}},{source:{node_id:Co,field:"unet"},destination:{node_id:Wo,field:"unet"}})):t.edges.push({source:{node_id:fu,field:"unet"},destination:{node_id:Wo,field:"unet"}}),t.edges.push({source:{node_id:fu,field:"clip2"},destination:{node_id:by,field:"clip2"}},{source:{node_id:fu,field:"clip2"},destination:{node_id:_y,field:"clip2"}},{source:{node_id:by,field:"conditioning"},destination:{node_id:Wo,field:"positive_conditioning"}},{source:{node_id:_y,field:"conditioning"},destination:{node_id:Wo,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:Wo,field:"latents"}}),(t.id===Ll||t.id===Fl)&&(t.nodes[zi]={type:"create_denoise_mask",id:zi,is_intermediate:!0,fp32:b},y?t.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:zi,field:"image"}}):t.nodes[zi]={...t.nodes[zi],image:i},t.id===Ll&&(y?t.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:zi,field:"mask"}}):t.nodes[zi]={...t.nodes[zi],mask:o}),t.id===Fl&&t.edges.push({source:{node_id:y?kt:rr,field:"image"},destination:{node_id:zi,field:"mask"}}),t.edges.push({source:{node_id:zi,field:"denoise_mask"},destination:{node_id:Wo,field:"denoise_mask"}})),t.id===x2||t.id===Hg?t.edges.push({source:{node_id:Wo,field:"latents"},destination:{node_id:y?xe:le,field:"latents"}}):t.edges.push({source:{node_id:Wo,field:"latents"},destination:{node_id:xe,field:"latents"}})},cRe=(e,t)=>{const n=se("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:g,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:b,height:y}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:v}=e.canvas,S=c==="fp32",w=!0,C=["auto","manual"].includes(v);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let x=mr;const P=d,{joinedPositiveStylePrompt:E,joinedNegativeStylePrompt:I}=wc(e),N={id:Hg,nodes:{[x]:{type:"sdxl_model_loader",id:x,model:o},[_e]:{type:"sdxl_compel_prompt",id:_e,prompt:r,style:E},[Ce]:{type:"sdxl_compel_prompt",id:Ce,prompt:i,style:I},[ve]:{type:"noise",id:ve,is_intermediate:w,use_cpu:P,seed:l,width:C?m.width:b,height:C?m.height:y},[Bt]:{type:"i2l",id:Bt,is_intermediate:w,fp32:S},[ae]:{type:"denoise_latents",id:ae,is_intermediate:w,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(g,1-_):1-_,denoising_end:p?g:1}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:_e,field:"clip2"}},{source:{node_id:x,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:Ce,field:"clip2"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:Bt,field:"latents"},destination:{node_id:ae,field:"latents"}}]};return C?(N.nodes[Ku]={id:Ku,type:"img_resize",is_intermediate:w,image:t,width:m.width,height:m.height},N.nodes[xe]={id:xe,type:"l2i",is_intermediate:w,fp32:S},N.nodes[le]={id:le,type:"img_resize",is_intermediate:w,width:b,height:y},N.edges.push({source:{node_id:Ku,field:"image"},destination:{node_id:Bt,field:"image"}},{source:{node_id:ae,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}})):(N.nodes[le]={type:"l2i",id:le,is_intermediate:w,fp32:S},N.nodes[Bt].image=t,N.edges.push({source:{node_id:ae,field:"latents"},destination:{node_id:le,field:"latents"}})),ks(N,{generation_mode:"img2img",cfg_scale:a,width:C?m.width:b,height:C?m.height:y,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:P?"cpu":"cuda",scheduler:s,strength:_,init_image:t.image_name},le),(f||h)&&(ao(e,N,x),x=In),p&&(qf(e,N,ae,x),(f||h)&&(x=Co)),lo(e,N,x),Hf(e,N,ae,x),no(e,N,ae),ro(e,N,ae),so(e,N,ae),e.system.shouldUseNSFWChecker&&io(e,N,le),e.system.shouldUseWatermarker&&uo(e,N,le),oo(e,N),N},dRe=(e,t,n)=>{const r=se("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:g,canvasCoherenceSteps:_,canvasCoherenceStrength:b,seamlessXAxis:y,seamlessYAxis:m}=e.generation,{sdxlImg2ImgDenoisingStrength:v,shouldUseSDXLRefiner:S,refinerStart:w}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:E}=e.canvas,I=d==="fp32",N=!0,M=["auto","manual"].includes(E);let T=mr;const A=f,{joinedPositiveStylePrompt:R,joinedNegativeStylePrompt:D}=wc(e),$={id:Ll,nodes:{[T]:{type:"sdxl_model_loader",id:T,model:a},[_e]:{type:"sdxl_compel_prompt",id:_e,prompt:i,style:R},[Ce]:{type:"sdxl_compel_prompt",id:Ce,prompt:o,style:D},[gr]:{type:"img_blur",id:gr,is_intermediate:N,radius:h,blur_type:p},[It]:{type:"i2l",id:It,is_intermediate:N,fp32:I},[ve]:{type:"noise",id:ve,use_cpu:A,seed:c,is_intermediate:N},[Pt]:{type:"create_denoise_mask",id:Pt,is_intermediate:N,fp32:I},[ae]:{type:"denoise_latents",id:ae,is_intermediate:N,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(w,1-v):1-v,denoising_end:S?w:1},[rt]:{type:"noise",id:rt,use_cpu:A,seed:c+1,is_intermediate:N},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:N},[$e]:{type:"denoise_latents",id:$e,is_intermediate:N,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:N,fp32:I},[le]:{type:"color_correct",id:le,is_intermediate:N,reference:t}},edges:[{source:{node_id:T,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:T,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:T,field:"clip2"},destination:{node_id:_e,field:"clip2"}},{source:{node_id:T,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:T,field:"clip2"},destination:{node_id:Ce,field:"clip2"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:It,field:"latents"},destination:{node_id:ae,field:"latents"}},{source:{node_id:gr,field:"image"},destination:{node_id:Pt,field:"mask"}},{source:{node_id:Pt,field:"denoise_mask"},destination:{node_id:ae,field:"denoise_mask"}},{source:{node_id:T,field:"unet"},destination:{node_id:$e,field:"unet"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:$e,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:$e,field:"negative_conditioning"}},{source:{node_id:rt,field:"noise"},destination:{node_id:$e,field:"noise"}},{source:{node_id:ae,field:"latents"},destination:{node_id:$e,field:"latents"}},{source:{node_id:$e,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(M){const L=P.width,O=P.height;$.nodes[Gn]={type:"img_resize",id:Gn,is_intermediate:N,width:L,height:O,image:t},$.nodes[kt]={type:"img_resize",id:kt,is_intermediate:N,width:L,height:O,image:n},$.nodes[or]={type:"img_resize",id:or,is_intermediate:N,width:C,height:x},$.nodes[vr]={type:"img_resize",id:vr,is_intermediate:N,width:C,height:x},$.nodes[ve].width=L,$.nodes[ve].height=O,$.nodes[rt].width=L,$.nodes[rt].height=O,$.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:It,field:"image"}},{source:{node_id:kt,field:"image"},destination:{node_id:gr,field:"image"}},{source:{node_id:Gn,field:"image"},destination:{node_id:Pt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:or,field:"image"}},{source:{node_id:or,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:le,field:"mask"}})}else $.nodes[ve].width=C,$.nodes[ve].height=x,$.nodes[rt].width=C,$.nodes[rt].height=x,$.nodes[It]={...$.nodes[It],image:t},$.nodes[gr]={...$.nodes[gr],image:n},$.nodes[Pt]={...$.nodes[Pt],image:t},$.edges.push({source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:gr,field:"image"},destination:{node_id:le,field:"mask"}});return g!=="unmasked"&&($.nodes[et]={type:"create_denoise_mask",id:et,is_intermediate:N,fp32:I},M?$.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:et,field:"image"}}):$.nodes[et]={...$.nodes[et],image:t},g==="mask"&&(M?$.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:et,field:"mask"}}):$.nodes[et]={...$.nodes[et],mask:n}),g==="edge"&&($.nodes[ln]={type:"mask_edge",id:ln,is_intermediate:N,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},M?$.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:ln,field:"image"}}):$.nodes[ln]={...$.nodes[ln],image:n},$.edges.push({source:{node_id:ln,field:"image"},destination:{node_id:et,field:"mask"}})),$.edges.push({source:{node_id:et,field:"denoise_mask"},destination:{node_id:$e,field:"denoise_mask"}})),(y||m)&&(ao(e,$,T),T=In),S&&(qf(e,$,$e,T,t,n),(y||m)&&(T=Co)),lo(e,$,T),Hf(e,$,ae,T),no(e,$,ae),ro(e,$,ae),so(e,$,ae),e.system.shouldUseNSFWChecker&&io(e,$,le),e.system.shouldUseWatermarker&&uo(e,$,le),oo(e,$),$},fRe=(e,t,n)=>{const r=se("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:g,canvasCoherenceStrength:_,infillTileSize:b,infillPatchmatchDownscaleSize:y,infillMethod:m,seamlessXAxis:v,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:w,shouldUseSDXLRefiner:C,refinerStart:x}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:P,height:E}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:I,boundingBoxScaleMethod:N}=e.canvas,M=d==="fp32",T=!0,A=["auto","manual"].includes(N);let R=mr;const D=f,{joinedPositiveStylePrompt:$,joinedNegativeStylePrompt:L}=wc(e),O={id:Fl,nodes:{[mr]:{type:"sdxl_model_loader",id:mr,model:a},[_e]:{type:"sdxl_compel_prompt",id:_e,prompt:i,style:$},[Ce]:{type:"sdxl_compel_prompt",id:Ce,prompt:o,style:L},[Hd]:{type:"tomask",id:Hd,is_intermediate:T,image:t},[rr]:{type:"mask_combine",id:rr,is_intermediate:T,mask2:n},[It]:{type:"i2l",id:It,is_intermediate:T,fp32:M},[ve]:{type:"noise",id:ve,use_cpu:D,seed:c,is_intermediate:T},[Pt]:{type:"create_denoise_mask",id:Pt,is_intermediate:T,fp32:M},[ae]:{type:"denoise_latents",id:ae,is_intermediate:T,steps:u,cfg_scale:s,scheduler:l,denoising_start:C?Math.min(x,1-w):1-w,denoising_end:C?x:1},[rt]:{type:"noise",id:rt,use_cpu:D,seed:c+1,is_intermediate:T},[Dl]:{type:"add",id:Dl,b:1,is_intermediate:T},[$e]:{type:"denoise_latents",id:$e,is_intermediate:T,steps:g,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[xe]:{type:"l2i",id:xe,is_intermediate:T,fp32:M},[le]:{type:"color_correct",id:le,is_intermediate:T}},edges:[{source:{node_id:mr,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:mr,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:mr,field:"clip2"},destination:{node_id:_e,field:"clip2"}},{source:{node_id:mr,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:mr,field:"clip2"},destination:{node_id:Ce,field:"clip2"}},{source:{node_id:at,field:"image"},destination:{node_id:It,field:"image"}},{source:{node_id:Hd,field:"image"},destination:{node_id:rr,field:"mask1"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:It,field:"latents"},destination:{node_id:ae,field:"latents"}},{source:{node_id:A?kt:rr,field:"image"},destination:{node_id:Pt,field:"mask"}},{source:{node_id:Pt,field:"denoise_mask"},destination:{node_id:ae,field:"denoise_mask"}},{source:{node_id:R,field:"unet"},destination:{node_id:$e,field:"unet"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:$e,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:$e,field:"negative_conditioning"}},{source:{node_id:rt,field:"noise"},destination:{node_id:$e,field:"noise"}},{source:{node_id:ae,field:"latents"},destination:{node_id:$e,field:"latents"}},{source:{node_id:at,field:"image"},destination:{node_id:Pt,field:"image"}},{source:{node_id:$e,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(m==="patchmatch"&&(O.nodes[at]={type:"infill_patchmatch",id:at,is_intermediate:T,downscale:y}),m==="lama"&&(O.nodes[at]={type:"infill_lama",id:at,is_intermediate:T}),m==="cv2"&&(O.nodes[at]={type:"infill_cv2",id:at,is_intermediate:T}),m==="tile"&&(O.nodes[at]={type:"infill_tile",id:at,is_intermediate:T,tile_size:b}),A){const B=I.width,U=I.height;O.nodes[Gn]={type:"img_resize",id:Gn,is_intermediate:T,width:B,height:U,image:t},O.nodes[kt]={type:"img_resize",id:kt,is_intermediate:T,width:B,height:U},O.nodes[or]={type:"img_resize",id:or,is_intermediate:T,width:P,height:E},O.nodes[ts]={type:"img_resize",id:ts,is_intermediate:T,width:P,height:E},O.nodes[vr]={type:"img_resize",id:vr,is_intermediate:T,width:P,height:E},O.nodes[ve].width=B,O.nodes[ve].height=U,O.nodes[rt].width=B,O.nodes[rt].height=U,O.edges.push({source:{node_id:Gn,field:"image"},destination:{node_id:at,field:"image"}},{source:{node_id:rr,field:"image"},destination:{node_id:kt,field:"image"}},{source:{node_id:xe,field:"image"},destination:{node_id:or,field:"image"}},{source:{node_id:kt,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:at,field:"image"},destination:{node_id:ts,field:"image"}},{source:{node_id:ts,field:"image"},destination:{node_id:le,field:"reference"}},{source:{node_id:or,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:le,field:"mask"}})}else O.nodes[at]={...O.nodes[at],image:t},O.nodes[ve].width=P,O.nodes[ve].height=E,O.nodes[rt].width=P,O.nodes[rt].height=E,O.nodes[It]={...O.nodes[It],image:t},O.edges.push({source:{node_id:at,field:"image"},destination:{node_id:le,field:"reference"}},{source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}},{source:{node_id:rr,field:"image"},destination:{node_id:le,field:"mask"}});return p!=="unmasked"&&(O.nodes[et]={type:"create_denoise_mask",id:et,is_intermediate:T,fp32:M},O.edges.push({source:{node_id:at,field:"image"},destination:{node_id:et,field:"image"}}),p==="mask"&&(A?O.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:et,field:"mask"}}):O.edges.push({source:{node_id:rr,field:"image"},destination:{node_id:et,field:"mask"}})),p==="edge"&&(O.nodes[ln]={type:"mask_edge",id:ln,is_intermediate:T,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},A?O.edges.push({source:{node_id:kt,field:"image"},destination:{node_id:ln,field:"image"}}):O.edges.push({source:{node_id:rr,field:"image"},destination:{node_id:ln,field:"image"}}),O.edges.push({source:{node_id:ln,field:"image"},destination:{node_id:et,field:"mask"}})),O.edges.push({source:{node_id:et,field:"denoise_mask"},destination:{node_id:$e,field:"denoise_mask"}})),(v||S)&&(ao(e,O,R),R=In),C&&(qf(e,O,$e,R,t),(v||S)&&(R=Co)),lo(e,O,R),Hf(e,O,ae,R),no(e,O,ae),ro(e,O,ae),so(e,O,ae),e.system.shouldUseNSFWChecker&&io(e,O,le),e.system.shouldUseWatermarker&&uo(e,O,le),oo(e,O),O},hRe=e=>{const t=se("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:_}=e.canvas,b=u==="fp32",y=!0,m=["auto","manual"].includes(_),{shouldUseSDXLRefiner:v,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=c,C=i.model_type==="onnx";let x=C?b2:mr;const P=C?"onnx_model_loader":"sdxl_model_loader",E=C?{type:"t2l_onnx",id:ae,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ae,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:v?S:1},{joinedPositiveStylePrompt:I,joinedNegativeStylePrompt:N}=wc(e),M={id:x2,nodes:{[x]:{type:P,id:x,is_intermediate:y,model:i},[_e]:{type:C?"prompt_onnx":"sdxl_compel_prompt",id:_e,is_intermediate:y,prompt:n,style:I},[Ce]:{type:C?"prompt_onnx":"sdxl_compel_prompt",id:Ce,is_intermediate:y,prompt:r,style:N},[ve]:{type:"noise",id:ve,is_intermediate:y,seed:s,width:m?g.width:h,height:m?g.height:p,use_cpu:w},[E.id]:E},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:_e,field:"clip2"}},{source:{node_id:x,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:Ce,field:"clip2"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ae,field:"noise"}}]};return m?(M.nodes[xe]={id:xe,type:C?"l2i_onnx":"l2i",is_intermediate:y,fp32:b},M.nodes[le]={id:le,type:"img_resize",is_intermediate:y,width:h,height:p},M.edges.push({source:{node_id:ae,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}})):(M.nodes[le]={type:C?"l2i_onnx":"l2i",id:le,is_intermediate:y,fp32:b},M.edges.push({source:{node_id:ae,field:"latents"},destination:{node_id:le,field:"latents"}})),ks(M,{generation_mode:"txt2img",cfg_scale:o,width:m?g.width:h,height:m?g.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a},le),(d||f)&&(ao(e,M,x),x=In),v&&(qf(e,M,ae,x),(d||f)&&(x=Co)),Hf(e,M,ae,x),lo(e,M,x),no(e,M,ae),ro(e,M,ae),so(e,M,ae),e.system.shouldUseNSFWChecker&&io(e,M,le),e.system.shouldUseWatermarker&&uo(e,M,le),oo(e,M),M},pRe=e=>{const t=se("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:g}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:b}=e.canvas,y=u==="fp32",m=!0,v=["auto","manual"].includes(b);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,w=i.model_type==="onnx";let C=w?b2:Ro;const x=w?"onnx_model_loader":"main_model_loader",P=w?{type:"t2l_onnx",id:ue,is_intermediate:m,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ue,is_intermediate:m,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},E={id:kG,nodes:{[C]:{type:x,id:C,is_intermediate:m,model:i},[ct]:{type:"clip_skip",id:ct,is_intermediate:m,skipped_layers:c},[_e]:{type:w?"prompt_onnx":"compel",id:_e,is_intermediate:m,prompt:n},[Ce]:{type:w?"prompt_onnx":"compel",id:Ce,is_intermediate:m,prompt:r},[ve]:{type:"noise",id:ve,is_intermediate:m,seed:s,width:v?_.width:p,height:v?_.height:g,use_cpu:S},[P.id]:P},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ue,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:ct,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ue,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ue,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ue,field:"noise"}}]};return v?(E.nodes[xe]={id:xe,type:w?"l2i_onnx":"l2i",is_intermediate:m,fp32:y},E.nodes[le]={id:le,type:"img_resize",is_intermediate:m,width:p,height:g},E.edges.push({source:{node_id:ue,field:"latents"},destination:{node_id:xe,field:"latents"}},{source:{node_id:xe,field:"image"},destination:{node_id:le,field:"image"}})):(E.nodes[le]={type:w?"l2i_onnx":"l2i",id:le,is_intermediate:m,fp32:y},E.edges.push({source:{node_id:ue,field:"latents"},destination:{node_id:le,field:"latents"}})),ks(E,{generation_mode:"txt2img",cfg_scale:o,width:v?_.width:p,height:v?_.height:g,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,clip_skip:c},le),(f||h)&&(ao(e,E,C),C=In),lo(e,E,C),Gf(e,E,ue,C),no(e,E,ue),ro(e,E,ue),so(e,E,ue),e.system.shouldUseNSFWChecker&&io(e,E,le),e.system.shouldUseWatermarker&&uo(e,E,le),oo(e,E),E},gRe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=hRe(e):i=pRe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=cRe(e,n):i=sRe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=dRe(e,n,r):i=lRe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=fRe(e,n,r):i=uRe(e,n,r)}return i},Yw=({count:e,start:t,min:n=Hie,max:r=hp})=>{const i=t??Ire(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){const h=Yw({count:r,start:o?void 0:a}),p=[];t.nodes[ve]&&p.push({node_path:ve,field_name:"seed",items:h}),Oh(t)&&(Rh(t,"seed"),p.push({node_path:vi,field_name:"seed",items:h})),t.nodes[rt]&&p.push({node_path:rt,field_name:"seed",items:h.map(g=>(g+1)%hp)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=Yw({count:u.length*r,start:o?void 0:a});t.nodes[ve]&&h.push({node_path:ve,field_name:"seed",items:_}),Oh(t)&&(Rh(t,"seed"),h.push({node_path:vi,field_name:"seed",items:_})),t.nodes[rt]&&h.push({node_path:rt,field_name:"seed",items:_.map(b=>(b+1)%hp)})}else{const _=Yw({count:r,start:o?void 0:a});t.nodes[ve]&&p.push({node_path:ve,field_name:"seed",items:_}),Oh(t)&&(Rh(t,"seed"),p.push({node_path:vi,field_name:"seed",items:_})),t.nodes[rt]&&p.push({node_path:rt,field_name:"seed",items:_.map(b=>(b+1)%hp)}),d.push(p)}const g=c==="PER_PROMPT"?Dre(r).flatMap(()=>u):u;if(t.nodes[_e]&&h.push({node_path:_e,field_name:"prompt",items:g}),Oh(t)&&(Rh(t,"positive_prompt"),h.push({node_path:vi,field_name:"positive_prompt",items:g})),s&&(i==null?void 0:i.base_model)==="sdxl"){const _=g.map(b=>[b,l].join(" "));t.nodes[_e]&&h.push({node_path:_e,field_name:"style",items:_}),Oh(t)&&(Rh(t,"positive_style_prompt"),h.push({node_path:vi,field_name:"positive_style_prompt",items:g}))}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},mRe=()=>{pe({predicate:e=>CA.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=se("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await wA(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:g}=d,_=ZMe(h,g);if(o.system.enableImageDebugging){const S=await xR(f),w=await xR(p);XMe([{base64:w,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let b,y;["img2img","inpaint","outpaint"].includes(_)&&(b=await n(ce.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(y=await n(ce.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const m=gRe(o,_,b,y);r.debug({graph:pt(m)},"Canvas graph built"),n(Yz(m));const v=IG(o,m,i);try{const S=n(un.endpoints.enqueueBatch.initiate(v,{fixedCacheKey:"enqueueBatch"})),w=await S.unwrap();S.reset();const C=w.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(Rle({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(Ole(C))}catch{}}})},yRe=e=>{const t=se("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:g,vaePrecision:_,seamlessXAxis:b,seamlessYAxis:y}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const m=_==="fp32",v=!0;let S=Ro;const w=g,C={id:D3,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:v},[ct]:{type:"clip_skip",id:ct,skipped_layers:p,is_intermediate:v},[_e]:{type:"compel",id:_e,prompt:n,is_intermediate:v},[Ce]:{type:"compel",id:Ce,prompt:r,is_intermediate:v},[ve]:{type:"noise",id:ve,use_cpu:w,seed:s,is_intermediate:v},[xe]:{type:"l2i",id:xe,fp32:m,is_intermediate:v},[ue]:{type:"denoise_latents",id:ue,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:v},[Bt]:{type:"i2l",id:Bt,fp32:m,is_intermediate:v}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:ue,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:ct,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ue,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ue,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ue,field:"noise"}},{source:{node_id:Bt,field:"latents"},destination:{node_id:ue,field:"latents"}},{source:{node_id:ue,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const x={id:aa,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};C.nodes[aa]=x,C.edges.push({source:{node_id:aa,field:"image"},destination:{node_id:Bt,field:"image"}}),C.edges.push({source:{node_id:aa,field:"width"},destination:{node_id:ve,field:"width"}}),C.edges.push({source:{node_id:aa,field:"height"},destination:{node_id:ve,field:"height"}})}else C.nodes[Bt].image={image_name:u.imageName},C.edges.push({source:{node_id:Bt,field:"width"},destination:{node_id:ve,field:"width"}}),C.edges.push({source:{node_id:Bt,field:"height"},destination:{node_id:ve,field:"height"}});return ks(C,{generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,clip_skip:p,strength:c,init_image:u.imageName},xe),(b||y)&&(ao(e,C,S),S=In),lo(e,C,S),Gf(e,C,ue,S),no(e,C,ue),ro(e,C,ue),so(e,C,ue),e.system.shouldUseNSFWChecker&&io(e,C),e.system.shouldUseWatermarker&&uo(e,C),oo(e,C),C},vRe=e=>{const t=se("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:g,seamlessYAxis:_}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:y,shouldUseSDXLRefiner:m,refinerStart:v,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=p==="fp32",C=!0;let x=mr;const P=h,{joinedPositiveStylePrompt:E,joinedNegativeStylePrompt:I}=wc(e),N={id:db,nodes:{[x]:{type:"sdxl_model_loader",id:x,model:i,is_intermediate:C},[_e]:{type:"sdxl_compel_prompt",id:_e,prompt:n,style:E,is_intermediate:C},[Ce]:{type:"sdxl_compel_prompt",id:Ce,prompt:r,style:I,is_intermediate:C},[ve]:{type:"noise",id:ve,use_cpu:P,seed:s,is_intermediate:C},[xe]:{type:"l2i",id:xe,fp32:w,is_intermediate:C},[ae]:{type:"denoise_latents",id:ae,cfg_scale:o,scheduler:a,steps:l,denoising_start:m?Math.min(v,1-S):1-S,denoising_end:m?v:1,is_intermediate:C},[Bt]:{type:"i2l",id:Bt,fp32:w,is_intermediate:C}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:_e,field:"clip2"}},{source:{node_id:x,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:Ce,field:"clip2"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:Bt,field:"latents"},destination:{node_id:ae,field:"latents"}},{source:{node_id:ae,field:"latents"},destination:{node_id:xe,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const M={id:aa,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};N.nodes[aa]=M,N.edges.push({source:{node_id:aa,field:"image"},destination:{node_id:Bt,field:"image"}}),N.edges.push({source:{node_id:aa,field:"width"},destination:{node_id:ve,field:"width"}}),N.edges.push({source:{node_id:aa,field:"height"},destination:{node_id:ve,field:"height"}})}else N.nodes[Bt].image={image_name:u.imageName},N.edges.push({source:{node_id:Bt,field:"width"},destination:{node_id:ve,field:"width"}}),N.edges.push({source:{node_id:Bt,field:"height"},destination:{node_id:ve,field:"height"}});return ks(N,{generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:P?"cpu":"cuda",scheduler:a,strength:S,init_image:u.imageName,positive_style_prompt:b,negative_style_prompt:y},xe),(g||_)&&(ao(e,N,x),x=In),m&&(qf(e,N,ae),(g||_)&&(x=Co)),lo(e,N,x),Hf(e,N,ae,x),no(e,N,ae),ro(e,N,ae),so(e,N,ae),e.system.shouldUseNSFWChecker&&io(e,N),e.system.shouldUseWatermarker&&uo(e,N),oo(e,N),N},bRe=e=>{const t=se("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:g,negativeStylePrompt:_,shouldUseSDXLRefiner:b,refinerStart:y}=e.sdxl,m=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const v=f==="fp32",S=!0,{joinedPositiveStylePrompt:w,joinedNegativeStylePrompt:C}=wc(e);let x=mr;const P={id:EA,nodes:{[x]:{type:"sdxl_model_loader",id:x,model:i,is_intermediate:S},[_e]:{type:"sdxl_compel_prompt",id:_e,prompt:n,style:w,is_intermediate:S},[Ce]:{type:"sdxl_compel_prompt",id:Ce,prompt:r,style:C,is_intermediate:S},[ve]:{type:"noise",id:ve,seed:s,width:u,height:c,use_cpu:m,is_intermediate:S},[ae]:{type:"denoise_latents",id:ae,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?y:1,is_intermediate:S},[xe]:{type:"l2i",id:xe,fp32:v,is_intermediate:S}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:_e,field:"clip2"}},{source:{node_id:x,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:x,field:"clip2"},destination:{node_id:Ce,field:"clip2"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:ae,field:"latents"},destination:{node_id:xe,field:"latents"}}]};return ks(P,{generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:m?"cpu":"cuda",scheduler:a,positive_style_prompt:g,negative_style_prompt:_},xe),(h||p)&&(ao(e,P,x),x=In),b&&(qf(e,P,ae),(h||p)&&(x=Co)),lo(e,P,x),Hf(e,P,ae,x),no(e,P,ae),ro(e,P,ae),so(e,P,ae),e.system.shouldUseNSFWChecker&&io(e,P),e.system.shouldUseWatermarker&&uo(e,P),oo(e,P),P};function _Re(e){const t=["vae","control","ip_adapter","metadata","unet","positive_conditioning","negative_conditioning"],n=[];e.edges.forEach(r=>{r.destination.node_id===ue&&t.includes(r.destination.field)&&n.push({source:{node_id:r.source.node_id,field:r.source.field},destination:{node_id:Kc,field:r.destination.field}})}),e.edges=e.edges.concat(n)}function SRe(e,t,n){const r=t/n;let i;e=="sdxl"?i=1024:i=512;const o=Math.floor(i*.5),a=i*i;let s,l;r>1?(l=Math.max(o,Math.sqrt(a/r)),s=l*r):(s=Math.max(o,Math.sqrt(a*r)),l=s/r),s=Math.min(t,s),l=Math.min(n,l);const u=Rr(Math.floor(s),8),c=Rr(Math.floor(l),8);return{newWidth:u,newHeight:c}}const xRe=(e,t)=>{var _;if(!e.generation.hrfEnabled||e.config.disabledSDFeatures.includes("hrf")||((_=e.generation.model)==null?void 0:_.model_type)==="onnx")return;const n=se("txt2img"),{vae:r,hrfStrength:i,hrfEnabled:o,hrfMethod:a}=e.generation,s=!r,l=e.generation.width,u=e.generation.height,c=e.generation.model?e.generation.model.base_model:"sd1",{newWidth:d,newHeight:f}=SRe(c,l,u),h=t.nodes[ue],p=t.nodes[ve],g=t.nodes[xe];if(!h){n.error("originalDenoiseLatentsNode is undefined");return}if(!p){n.error("originalNoiseNode is undefined");return}if(!g){n.error("originalLatentsToImageNode is undefined");return}if(p&&(p.width=d,p.height=f),t.nodes[_u]={type:"l2i",id:_u,fp32:g==null?void 0:g.fp32,is_intermediate:!0},t.edges.push({source:{node_id:ue,field:"latents"},destination:{node_id:_u,field:"latents"}},{source:{node_id:s?Ro:fi,field:"vae"},destination:{node_id:_u,field:"vae"}}),t.nodes[Us]={id:Us,type:"img_resize",is_intermediate:!0,width:l,height:u},a=="ESRGAN"){let b="RealESRGAN_x2plus.pth";l*u/(d*f)>2&&(b="RealESRGAN_x4plus.pth"),t.nodes[Zh]={id:Zh,type:"esrgan",model_name:b,is_intermediate:!0},t.edges.push({source:{node_id:_u,field:"image"},destination:{node_id:Zh,field:"image"}},{source:{node_id:Zh,field:"image"},destination:{node_id:Us,field:"image"}})}else t.edges.push({source:{node_id:_u,field:"image"},destination:{node_id:Us,field:"image"}});t.nodes[kh]={type:"noise",id:kh,seed:p==null?void 0:p.seed,use_cpu:p==null?void 0:p.use_cpu,is_intermediate:!0},t.edges.push({source:{node_id:Us,field:"height"},destination:{node_id:kh,field:"height"}},{source:{node_id:Us,field:"width"},destination:{node_id:kh,field:"width"}}),t.nodes[Ph]={type:"i2l",id:Ph,is_intermediate:!0},t.edges.push({source:{node_id:s?Ro:fi,field:"vae"},destination:{node_id:Ph,field:"vae"}},{source:{node_id:Us,field:"image"},destination:{node_id:Ph,field:"image"}}),t.nodes[Kc]={type:"denoise_latents",id:Kc,is_intermediate:!0,cfg_scale:h==null?void 0:h.cfg_scale,scheduler:h==null?void 0:h.scheduler,steps:h==null?void 0:h.steps,denoising_start:1-e.generation.hrfStrength,denoising_end:1},t.edges.push({source:{node_id:Ph,field:"latents"},destination:{node_id:Kc,field:"latents"}},{source:{node_id:kh,field:"noise"},destination:{node_id:Kc,field:"noise"}}),_Re(t),t.nodes[tl]={type:"l2i",id:tl,fp32:g==null?void 0:g.fp32,is_intermediate:!0},t.edges.push({source:{node_id:s?Ro:fi,field:"vae"},destination:{node_id:tl,field:"vae"}},{source:{node_id:Kc,field:"latents"},destination:{node_id:tl,field:"latents"}}),Lo(t,{hrf_strength:i,hrf_enabled:o,hrf_method:a}),oRe(t,tl)},wRe=e=>{const t=se("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:g}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",y=!0,m=i.model_type==="onnx";let v=m?b2:Ro;const S=m?"onnx_model_loader":"main_model_loader",w=m?{type:"t2l_onnx",id:ue,is_intermediate:y,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:ue,is_intermediate:y,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},C={id:PG,nodes:{[v]:{type:S,id:v,is_intermediate:y,model:i},[ct]:{type:"clip_skip",id:ct,skipped_layers:c,is_intermediate:y},[_e]:{type:m?"prompt_onnx":"compel",id:_e,prompt:n,is_intermediate:y},[Ce]:{type:m?"prompt_onnx":"compel",id:Ce,prompt:r,is_intermediate:y},[ve]:{type:"noise",id:ve,seed:g,width:l,height:u,use_cpu:_,is_intermediate:y},[w.id]:w,[xe]:{type:m?"l2i_onnx":"l2i",id:xe,fp32:b,is_intermediate:y}},edges:[{source:{node_id:v,field:"unet"},destination:{node_id:ue,field:"unet"}},{source:{node_id:v,field:"clip"},destination:{node_id:ct,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:_e,field:"clip"}},{source:{node_id:ct,field:"clip"},destination:{node_id:Ce,field:"clip"}},{source:{node_id:_e,field:"conditioning"},destination:{node_id:ue,field:"positive_conditioning"}},{source:{node_id:Ce,field:"conditioning"},destination:{node_id:ue,field:"negative_conditioning"}},{source:{node_id:ve,field:"noise"},destination:{node_id:ue,field:"noise"}},{source:{node_id:ue,field:"latents"},destination:{node_id:xe,field:"latents"}}]};return ks(C,{generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:g,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,clip_skip:c},xe),(h||p)&&(ao(e,C,v),v=In),lo(e,C,v),Gf(e,C,ue,v),no(e,C,ue),ro(e,C,ue),so(e,C,ue),e.generation.hrfEnabled&&!m&&xRe(e,C),e.system.shouldUseNSFWChecker&&io(e,C),e.system.shouldUseWatermarker&&uo(e,C),oo(e,C),C},CRe=()=>{pe({predicate:e=>CA.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=bRe(r):a=vRe(r):e.payload.tabName==="txt2img"?a=wRe(r):a=yRe(r);const s=IG(r,a,o);n(un.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},ERe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function TRe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+ARe(n)+'"]';if(!ERe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function ARe(e){return e.replace(/"/g,'\\"')}function PRe(e){return e.length!==0}const kRe=99,MG="; ",RG=", or ",AA="Validation error",OG=": ";class $G extends Error{constructor(n,r=[]){super(n);Q2(this,"details");Q2(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function PA(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:i}=e;if(t.code==="invalid_union")return t.unionErrors.reduce((o,a)=>{const s=a.issues.map(l=>PA({issue:l,issueSeparator:n,unionSeparator:r,includePath:i})).join(n);return o.includes(s)||o.push(s),o},[]).join(r);if(i&&PRe(t.path)){if(t.path.length===1){const o=t.path[0];if(typeof o=="number")return`${t.message} at index ${o}`}return`${t.message} at "${TRe(t.path)}"`}return t.message}function NG(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:AA}function FUe(e,t={}){const{issueSeparator:n=MG,unionSeparator:r=RG,prefixSeparator:i=OG,prefix:o=AA,includePath:a=!0}=t,s=PA({issue:e,issueSeparator:n,unionSeparator:r,includePath:a}),l=NG(s,o,i);return new $G(l,[e])}function wR(e,t={}){const{maxIssuesInMessage:n=kRe,issueSeparator:r=MG,unionSeparator:i=RG,prefixSeparator:o=OG,prefix:a=AA,includePath:s=!0}=t,l=e.errors.slice(0,n).map(c=>PA({issue:c,issueSeparator:r,unionSeparator:i,includePath:s})).join(r),u=NG(l,a,o);return new $G(u,e.errors)}const IRe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=XF.safeParse(o);if(!a.success){const{message:s}=wR(a.error,{prefix:de.t("nodes.unableToParseNode")});se("nodes").warn({node:pt(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=QF.safeParse(o);if(!a.success){const{message:s}=wR(a.error,{prefix:de.t("nodes.unableToParseEdge")});se("nodes").warn({edge:pt(o)},s);return}i.edges.push(a.data)}),i},MRe=e=>{if(e.type==="ColorField"&&e.value){const t=Ye(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},RRe=e=>{const{nodes:t,edges:n}=e,i=t.filter(on).reduce((l,u)=>{const{id:c,data:d}=u,{type:f,inputs:h,isIntermediate:p,embedWorkflow:g}=d,_=tg(h,(y,m,v)=>{const S=MRe(m);return y[v]=S,y},{});_.use_cache=u.data.useCache;const b={type:f,id:c,..._,is_intermediate:p};return g&&Object.assign(b,{workflow:IRe(e)}),Object.assign(l,{[c]:b}),l},{}),a=n.filter(l=>l.type!=="collapsed").reduce((l,u)=>{const{source:c,target:d,sourceHandle:f,targetHandle:h}=u;return l.push({source:{node_id:c,field:f},destination:{node_id:d,field:h}}),l},[]);return a.forEach(l=>{const u=i[l.destination.node_id],c=l.destination.field;i[l.destination.node_id]=$f(u,c)}),{id:yl(),nodes:i,edges:a}},ORe=()=>{pe({predicate:e=>CA.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:RRe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(un.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},$Re=()=>{pe({matcher:ce.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=se("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},NRe=()=>{pe({matcher:ce.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=se("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},kA=ge("deleteImageModal/imageDeletionConfirmed"),BUe=qn(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],Vm),DG=qn([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?Fn:Pr,offset:0,limit:Kle,is_intermediate:!1}},Vm),DRe=()=>{pe({actionCreator:kA,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(XE(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=DG(l),{data:g}=ce.endpoints.listImages.select(p)(l),_=g?Lt.getSelectors().selectAll(g):[],b=_.findIndex(S=>S.image_name===h),y=_.filter(S=>S.image_name!==h),m=al(b,0,y.length-1),v=y[m];t(pa(v||null))}s.isCanvasImage&&t(KE()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(DE()),ps(Aa(n().controlAdapters),g=>{(g.controlImage===h.image_name||gi(g)&&g.processedControlImage===h.image_name)&&(t(Hl({id:g.id,controlImage:null})),t(RE({id:g.id,processedControlImage:null})))}),n().nodes.nodes.forEach(g=>{on(g)&&ps(g.data.inputs,_=>{var b;_.type==="ImageField"&&((b=_.value)==null?void 0:b.image_name)===h.image_name&&t(aS({nodeId:g.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(ce.endpoints.deleteImage.initiate(a));await r(h=>ce.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(Do.util.invalidateTags([{type:"Board",id:a.board_id??"none"}]))}})},LRe=()=>{pe({actionCreator:kA,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(ce.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=DG(o),{data:s}=ce.endpoints.listImages.select(a)(o),l=s?Lt.getSelectors().selectAll(s)[0]:void 0;t(pa(l||null)),t(XE(!1)),i.some(u=>u.isCanvasImage)&&t(KE()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(DE()),ps(Aa(n().controlAdapters),d=>{(d.controlImage===u.image_name||gi(d)&&d.processedControlImage===u.image_name)&&(t(Hl({id:d.id,controlImage:null})),t(RE({id:d.id,processedControlImage:null})))}),n().nodes.nodes.forEach(d=>{on(d)&&ps(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(aS({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},FRe=()=>{pe({matcher:ce.endpoints.deleteImage.matchPending,effect:()=>{}})},BRe=()=>{pe({matcher:ce.endpoints.deleteImage.matchFulfilled,effect:e=>{se("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},zRe=()=>{pe({matcher:ce.endpoints.deleteImage.matchRejected,effect:e=>{se("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},LG=ge("dnd/dndDropped"),VRe=()=>{pe({actionCreator:LG,effect:async(e,{dispatch:t})=>{const n=se("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:pt(r),overData:pt(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(dve({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(pa(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(c_(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROL_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{id:o}=i.context;t(Hl({id:o,controlImage:r.payload.imageDTO.image_name})),t(OE({id:o,isEnabled:!0}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(lF(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(aS({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(ce.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(ce.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(ce.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(ce.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},jRe=()=>{pe({matcher:ce.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=se("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},URe=()=>{pe({matcher:ce.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=se("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},GRe=()=>{pe({actionCreator:Ble,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=w6e(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlImage)||a.some(l=>l.isNodesImage);if(o||s){t(XE(!0));return}t(kA({imageDTOs:r,imagesUsage:a}))}})},HRe=()=>{pe({matcher:ce.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=se("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:X("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(it({...l,...u}));else{t(ce.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=Qe.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${X("toast.addedToBoard")} ${d.board_name}`:`${X("toast.addedToBoard")} ${a}`;t(it({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(lF(i)),t(it({...l,description:X("toast.setAsCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROL_ADAPTER_IMAGE"){const{id:u}=s;t(OE({id:u,isEnabled:!0})),t(Hl({id:u,controlImage:i.image_name})),t(it({...l,description:X("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(c_(i)),t(it({...l,description:X("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(aS({nodeId:u,fieldName:c,value:i})),t(it({...l,description:`${X("toast.setNodeField")} ${c}`}));return}}})},qRe=()=>{pe({matcher:ce.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=se("images"),r={arg:{...$f(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(it({title:X("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},WRe=()=>{pe({matcher:ce.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(JF(a))}})},KRe=()=>{pe({matcher:ce.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(JF(a))}})},XRe=ge("generation/initialImageSelected"),QRe=ge("generation/modelSelected"),YRe=()=>{pe({actionCreator:XRe,effect:(e,{dispatch:t})=>{if(!e.payload){t(it(vs({title:X("toast.imageNotLoadedDesc"),status:"error"})));return}t(c_(e.payload)),t(it(vs(X("toast.sentToImageToImage"))))}})},ZRe=()=>{pe({actionCreator:QRe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=se("models"),i=t(),o=Sm.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;ps(i.lora.loras,(f,h)=>{f.base_model!==s&&(n(tB(h)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(xL(null)),c+=1),Aa(i.controlAdapters).forEach(f=>{var h;((h=f.model)==null?void 0:h.base_model)!==s&&(n(OE({id:f.id,isEnabled:!1})),c+=1)}),c>0&&n(it(vs({title:X("toast.baseModelChangedCleared",{count:c}),status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(E6(1024)),n(T6(1024)),n(Z6({width:1024,height:1024}))):(n(E6(512)),n(T6(512)),n(Z6({width:512,height:512})))),n(sl(a))}})},qg=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),CR=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),ER=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),TR=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),AR=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),PR=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),kR=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),F3=Ji({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),JRe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Bs=e=>{const t=[];return e.forEach(n=>{const r={...Ye(n),id:JRe(n)};t.push(r)}),t},Qo=Do.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${pp.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return CR.setAll(CR.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${pp.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return qg.setAll(qg.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:["Model"]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:["Model"]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:["Model"]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:["Model"]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:["Model"]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:["Model"]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:["Model"]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return ER.setAll(ER.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:kr}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:kr}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return TR.setAll(TR.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return AR.setAll(AR.getInitialState(),n)}}),getT2IAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"t2i_adapter"}}),providesTags:t=>{const n=[{type:"T2IAdapterModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"T2IAdapterModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return PR.setAll(PR.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return F3.setAll(F3.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Bs(t.models);return kR.setAll(kR.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${pp.stringify(t,{})}`})}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:zUe,useGetOnnxModelsQuery:VUe,useGetControlNetModelsQuery:jUe,useGetIPAdapterModelsQuery:UUe,useGetT2IAdapterModelsQuery:GUe,useGetLoRAModelsQuery:HUe,useGetTextualInversionModelsQuery:qUe,useGetVaeModelsQuery:WUe,useUpdateMainModelsMutation:KUe,useDeleteMainModelsMutation:XUe,useImportMainModelsMutation:QUe,useAddMainModelsMutation:YUe,useConvertMainModelsMutation:ZUe,useMergeMainModelsMutation:JUe,useDeleteLoRAModelsMutation:eGe,useUpdateLoRAModelsMutation:tGe,useSyncModelsMutation:nGe,useGetModelsInFolderQuery:rGe,useGetCheckpointConfigsQuery:iGe}=Qo,eOe=()=>{pe({predicate:e=>Qo.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=se("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=qg.getSelectors().selectAll(e.payload);if(o.length===0){n(sl(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=Sm.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(sl(s.data))}}),pe({predicate:e=>Qo.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=se("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=qg.getSelectors().selectAll(e.payload);if(o.length===0){n(_8(null)),n(gve(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=$E.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(_8(s.data))}}),pe({matcher:Qo.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=se("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Gc(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=F3.getSelectors().selectAll(e.payload)[0];if(!a){n(sl(null));return}const s=_L.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(xL(s.data))}}),pe({matcher:Qo.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{se("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;ps(i,(o,a)=>{Gc(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(tB(a))})}}),pe({matcher:Qo.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{se("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),kie(t().controlAdapters).forEach(i=>{Gc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(Nx({id:i.id}))})}}),pe({matcher:Qo.endpoints.getT2IAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{se("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),Oie(t().controlAdapters).forEach(i=>{Gc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(Nx({id:i.id}))})}}),pe({matcher:Qo.endpoints.getIPAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{se("models").info({models:e.payload.entities},`IP Adapter models loaded (${e.payload.ids.length})`),Mie(t().controlAdapters).forEach(i=>{Gc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(Nx({id:i.id}))})}}),pe({matcher:Qo.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{se("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},tOe=Do.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),nOe=si(uae,Gle,jle,Ule,CE),rOe=()=>{pe({matcher:nOe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(Ux(!0));try{const l=t(tOe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(Hle(u.prompts)),t(qle(u.error)),t(J6(!1)),t(Ux(!1))}catch{t(J6(!0)),t(Ux(!1))}}})},zs=e=>e.$ref.split("/").slice(-1)[0],iOe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},oOe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},aOe=({schemaObject:e,baseField:t})=>{const n=_a(e.item_default)&&Qne(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},sOe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},lOe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},uOe=({schemaObject:e,baseField:t})=>{const n=_a(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},cOe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},dOe=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},fOe=({schemaObject:e,baseField:t})=>{const n=_E(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},hOe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),pOe=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),gOe=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Xne(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},mOe=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),yOe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),vOe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),bOe=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),_Oe=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),SOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),xOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),wOe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterModelField",default:e.default??void 0}),COe=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),EOe=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),TOe=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),AOe=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),POe=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),kOe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),IOe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),MOe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),ROe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),OOe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),$Oe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),NOe=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),DOe=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),LOe=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),FOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),BOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),zOe=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),VOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),jOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterPolymorphic",default:e.default??void 0}),UOe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),GOe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterField",default:e.default??void 0}),HOe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterPolymorphic",default:e.default??void 0}),qOe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),WOe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},KOe=({baseField:e})=>({...e,type:"Collection",default:[]}),XOe=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),QOe=({baseField:e})=>({...e,type:"Any",default:void 0}),YOe=({baseField:e})=>({...e,type:"MetadataItemField",default:void 0}),ZOe=({baseField:e})=>({...e,type:"MetadataItemCollection",default:void 0}),JOe=({baseField:e})=>({...e,type:"MetadataItemPolymorphic",default:void 0}),e7e=({baseField:e})=>({...e,type:"MetadataField",default:void 0}),t7e=({baseField:e})=>({...e,type:"MetadataCollection",default:void 0}),n7e=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),r7e=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),i7e=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),o7e=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),B3=e=>{if(N0(e)){if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=N0(e.items)?e.items.type:zs(e.items);return Tn(t)?void 0:hye(t)?vT[t]:void 0}else if(!Tn(e.type))return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&au(t[0]))return zs(t[0])}else if(e.anyOf){const t=e.anyOf.filter(i=>!(N0(i)&&i.type==="null"));if(t.length===1){if(au(t[0]))return zs(t[0]);if(N0(t[0]))return B3(t[0])}let n,r;if(mI(t[0])){const i=t[0].items,o=t[1];au(i)&&au(o)?(n=zs(i),r=zs(o)):D0(i)&&D0(o)&&(n=i.type,r=o.type)}else if(mI(t[1])){const i=t[0],o=t[1].items;au(i)&&au(o)?(n=zs(i),r=zs(o)):D0(i)&&D0(o)&&(n=i.type,r=o.type)}if(n===r&&gye(n))return wz[n]}}else if(au(e))return zs(e)},FG={BoardField:COe,Any:QOe,boolean:hOe,BooleanCollection:gOe,BooleanPolymorphic:pOe,ClipField:DOe,Collection:KOe,CollectionItem:XOe,ColorCollection:i7e,ColorField:n7e,ColorPolymorphic:r7e,ConditioningCollection:$Oe,ConditioningField:ROe,ConditioningPolymorphic:OOe,ControlCollection:zOe,ControlField:FOe,ControlNetModelField:SOe,ControlPolymorphic:BOe,DenoiseMaskField:POe,enum:WOe,float:sOe,FloatCollection:uOe,FloatPolymorphic:lOe,ImageCollection:AOe,ImageField:EOe,ImagePolymorphic:TOe,integer:iOe,IntegerCollection:aOe,IntegerPolymorphic:oOe,IPAdapterCollection:UOe,IPAdapterField:VOe,IPAdapterModelField:xOe,IPAdapterPolymorphic:jOe,LatentsCollection:MOe,LatentsField:kOe,LatentsPolymorphic:IOe,LoRAModelField:_Oe,MetadataItemField:YOe,MetadataItemCollection:ZOe,MetadataItemPolymorphic:JOe,MetadataField:e7e,MetadataCollection:t7e,MainModelField:mOe,Scheduler:o7e,SDXLMainModelField:yOe,SDXLRefinerModelField:vOe,string:cOe,StringCollection:fOe,StringPolymorphic:dOe,T2IAdapterCollection:qOe,T2IAdapterField:GOe,T2IAdapterModelField:wOe,T2IAdapterPolymorphic:HOe,UNetField:NOe,VaeField:LOe,VaeModelField:bOe},a7e=e=>!!(e&&e in FG),s7e=(e,t,n,r)=>{var p;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l,ui_choice_labels:u,item_default:c}=t,d={input:Gh.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((p=e.required)==null?void 0:p.includes(n))??!1,ui_order:l,ui_choice_labels:u,item_default:c},f={name:n,title:t.title??(n?wE(n):""),description:t.description??"",fieldKind:"input",...d};if(!a7e(r))return;const h=FG[r];if(h)return h({schemaObject:t,baseField:f})},l7e=["id","type","use_cache"],u7e=["type"],c7e=["IsIntermediate"],d7e=["graph","linear_ui_output"],f7e=(e,t)=>!!(l7e.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),h7e=e=>!!c7e.includes(e),p7e=(e,t)=>!u7e.includes(t),g7e=e=>!d7e.includes(e.properties.type.default),m7e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(xfe).filter(g7e).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var S,w;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version;let h=!1;const p=tg(s.properties,(C,x,P)=>{if(f7e(l,P))return se("nodes").trace({node:l,fieldName:P,field:pt(x)},"Skipped reserved input field"),C;if(!yI(x))return se("nodes").warn({node:l,propertyName:P,property:pt(x)},"Unhandled input property"),C;const E=x.ui_type??B3(x);if(!E)return se("nodes").warn({node:l,fieldName:P,fieldType:E,field:pt(x)},"Missing input field type"),C;if(E==="WorkflowField")return h=!0,C;if(h7e(E))return se("nodes").trace({node:l,fieldName:P,fieldType:E,field:pt(x)},`Skipping reserved input field type: ${E}`),C;if(!gI(E))return se("nodes").warn({node:l,fieldName:P,fieldType:E,field:pt(x)},`Skipping unknown input field type: ${E}`),C;const I=s7e(s,x,P,E);return I?(C[P]=I,C):(se("nodes").warn({node:l,fieldName:P,fieldType:E,field:pt(x)},"Skipping input field with no template"),C)},{}),g=s.output.$ref.split("/").pop();if(!g)return se("nodes").warn({outputRefObject:pt(s.output)},"No output schema name found in ref object"),a;const _=(w=(S=e.components)==null?void 0:S.schemas)==null?void 0:w[g];if(!_)return se("nodes").warn({outputSchemaName:g},"Output schema not found"),a;if(!wfe(_))return se("nodes").error({outputSchema:pt(_)},"Invalid output schema"),a;const b=_.properties.type.default,y=tg(_.properties,(C,x,P)=>{if(!p7e(l,P))return se("nodes").trace({type:l,propertyName:P,property:pt(x)},"Skipped reserved output field"),C;if(!yI(x))return se("nodes").warn({type:l,propertyName:P,property:pt(x)},"Unhandled output property"),C;const E=x.ui_type??B3(x);return gI(E)?(C[P]={fieldKind:"output",name:P,title:x.title??(P?wE(P):""),description:x.description??"",type:E,ui_hidden:x.ui_hidden??!1,ui_type:x.ui_type,ui_order:x.ui_order},C):(se("nodes").warn({fieldName:P,fieldType:E,field:pt(x)},"Skipping unknown output field type"),C)},{}),m=s.properties.use_cache.default,v={title:u,type:l,version:f,tags:c,description:d,outputType:b,inputs:p,outputs:y,useCache:m,withWorkflow:h};return Object.assign(a,{[l]:v}),a},{})},y7e=()=>{pe({actionCreator:Ig.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=se("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=m7e(i,o,a);r.debug({nodeTemplates:pt(s)},`Built ${r_(s)} node templates`),t($z(s))}}),pe({actionCreator:Ig.rejected,effect:e=>{se("system").error({error:pt(e.error)},"Problem retrieving OpenAPI Schema")}})},v7e=()=>{pe({actionCreator:VD,effect:(e,{dispatch:t,getState:n})=>{se("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!r_(i.nodeTemplates)&&!s.includes("nodes")&&t(Ig()),a.isInitialized?t(Do.util.resetApiState()):t(Sve(!0)),t(CE(e.payload))}})},b7e=()=>{pe({actionCreator:jD,effect:(e,{dispatch:t})=>{se("socketio").debug("Disconnected"),t(UD(e.payload))}})},_7e=()=>{pe({actionCreator:KD,effect:(e,{dispatch:t})=>{se("socketio").trace(e.payload,"Generator progress"),t(PE(e.payload))}})},S7e=()=>{pe({actionCreator:qD,effect:(e,{dispatch:t})=>{se("socketio").debug(e.payload,"Session complete"),t(WD(e.payload))}})},x7e=["load_image","image"],w7e=()=>{pe({actionCreator:TE,effect:async(e,{dispatch:t,getState:n})=>{const r=se("socketio"),{data:i}=e.payload;r.debug({data:pt(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s,source_node_id:l}=i;if(TG(o)&&!x7e.includes(a.type)&&!iRe.includes(l)){const{image_name:u}=o.image,{canvas:c,gallery:d}=n(),f=t(ce.endpoints.getImageDTO.initiate(u,{forceRefetch:!0})),h=await f.unwrap();if(f.unsubscribe(),c.batchIds.includes(s)&&[Wu].includes(i.source_node_id)&&t(Ple(h)),!h.is_intermediate){t(ce.util.updateQueryData("listImages",{board_id:h.board_id??"none",categories:Fn},g=>{Lt.addOne(g,h)})),t(Qe.util.updateQueryData("getBoardImagesTotal",h.board_id??"none",g=>{g.total+=1})),t(ce.util.invalidateTags([{type:"Board",id:h.board_id??"none"}]));const{shouldAutoSwitch:p}=d;p&&(d.galleryView!=="images"&&t(M5("images")),h.board_id&&h.board_id!==d.selectedBoardId&&t(M1({boardId:h.board_id,selectedImageName:h.image_name})),!h.board_id&&d.selectedBoardId!=="none"&&t(M1({boardId:"none",selectedImageName:h.image_name})),t(pa(h)))}}t(AE(e.payload))}})},C7e=()=>{pe({actionCreator:HD,effect:(e,{dispatch:t})=>{se("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(i_(e.payload))}})},E7e=()=>{pe({actionCreator:tL,effect:(e,{dispatch:t})=>{se("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(nL(e.payload))}})},T7e=()=>{pe({actionCreator:GD,effect:(e,{dispatch:t})=>{se("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(EE(e.payload))}})},A7e=()=>{pe({actionCreator:XD,effect:(e,{dispatch:t})=>{const n=se("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(QD(e.payload))}}),pe({actionCreator:YD,effect:(e,{dispatch:t})=>{const n=se("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(ZD(e.payload))}})},P7e=()=>{pe({actionCreator:rL,effect:async(e,{dispatch:t})=>{const n=se("socketio"),{queue_item:r,batch_status:i,queue_status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r.item_id} status updated: ${r.status}`),t(un.util.updateQueryData("listQueueItems",void 0,a=>{xu.updateOne(a,{id:r.item_id,changes:r})})),t(un.util.updateQueryData("getQueueStatus",void 0,a=>{a&&Object.assign(a.queue,o)})),t(un.util.updateQueryData("getBatchStatus",{batch_id:i.batch_id},()=>i)),t(un.util.updateQueryData("getQueueItem",r.item_id,a=>{a&&Object.assign(a,r)})),t(un.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus"])),t(o_(e.payload))}})},k7e=()=>{pe({actionCreator:JD,effect:(e,{dispatch:t})=>{se("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(eL(e.payload))}})},I7e=()=>{pe({actionCreator:Zre,effect:(e,{dispatch:t})=>{se("socketio").debug(e.payload,"Subscribed"),t(Jre(e.payload))}})},M7e=()=>{pe({actionCreator:eie,effect:(e,{dispatch:t})=>{se("socketio").debug(e.payload,"Unsubscribed"),t(tie(e.payload))}})},R7e=()=>{pe({actionCreator:M6e,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(ce.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(ce.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(it({title:X("toast.imageSaved"),status:"success"}))}catch(i){t(it({title:X("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},oGe=["sd-1","sd-2","sdxl","sdxl-refiner"],O7e=["sd-1","sd-2","sdxl"],aGe=["sdxl"],sGe=["sd-1","sd-2"],lGe=["sdxl-refiner"],$7e=()=>{pe({actionCreator:qz,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(Qo.endpoints.getMainModels.initiate(O7e)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(sl(null));return}const u=qg.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(sl(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(sl({base_model:c,model_name:d,model_type:f}))}catch{n(sl(null))}}}})},N7e=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:Jh,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Wu,type:"linear_ui_output",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}},o={id:"adhoc-esrgan-graph",nodes:{[Jh]:r,[Wu]:i},edges:[{source:{node_id:Jh,field:"image"},destination:{node_id:Wu,field:"image"}}]};return ks(o,{},Jh),Lo(o,{esrgan_model:t}),o},w2=()=>oF(),C2=YL;function D7e(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function MR(e,t,n){e.loadNamespaces(t,BG(e,n))}function RR(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,BG(e,r))}function L7e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===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 F7e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(z3("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):L7e(e,t,n)}const B7e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,z7e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},V7e=e=>z7e[e],j7e=e=>e.replace(B7e,V7e);let V3={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:j7e};function U7e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};V3={...V3,...e}}function G7e(){return V3}let zG;function H7e(e){zG=e}function q7e(){return zG}const W7e={type:"3rdParty",init(e){U7e(e.options.react),H7e(e)}},K7e=k.createContext();class X7e{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Q7e=(e,t)=>{const n=k.useRef();return k.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function VG(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=k.useContext(K7e)||{},o=n||r||q7e();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new X7e),!o){z3("You will need to pass in an i18next instance by using initReactI18next");const m=(S,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(S)?S[S.length-1]:S,v=[m,{},!1];return v.t=m,v.i18n={},v.ready=!1,v}o.options.react&&o.options.react.wait!==void 0&&z3("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...G7e(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(m=>F7e(m,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=k.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const g=Q7e(p),_=k.useRef(!0);k.useEffect(()=>{const{bindI18n:m,bindI18nStore:v}=a;_.current=!0,!c&&!s&&(t.lng?RR(o,t.lng,u,()=>{_.current&&h(d)}):MR(o,u,()=>{_.current&&h(d)})),c&&g&&g!==p&&_.current&&h(d);function S(){_.current&&h(d)}return m&&o&&o.on(m,S),v&&o&&o.store.on(v,S),()=>{_.current=!1,m&&o&&m.split(" ").forEach(w=>o.off(w,S)),v&&o&&v.split(" ").forEach(w=>o.store.off(w,S))}},[o,p]);const b=k.useRef(!0);k.useEffect(()=>{_.current&&!b.current&&h(d),b.current=!1},[o,l]);const y=[f,o,c];if(y.t=f,y.i18n=o,y.ready=c,c||!c&&!s)return y;throw new Promise(m=>{t.lng?RR(o,t.lng,u,()=>m()):MR(o,u,()=>m())})}const Y7e=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},Z7e=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},J7e=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},jG=e=>qn(IA,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=Y7e(e,i),a=Z7e(o,i),s=r.includes("x2")?2:4,l=J7e(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},Vm),uGe=e=>{const{t}=VG(),n=k.useMemo(()=>jG(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=C2(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},e$e=ge("upscale/upscaleRequested"),t$e=()=>{pe({actionCreator:e$e,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=se("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=jG(i)(a);if(!s){r.error({imageDTO:i},X(l??"parameters.isAllowedToUpscale.tooLarge")),t(it({title:X(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d={prepend:!0,batch:{graph:N7e({image_name:o,esrganModelName:u,autoAddBoardId:c}),runs:1}};try{const h=t(un.endpoints.enqueueBatch.initiate(d,{fixedCacheKey:"enqueueBatch"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:pt(p)},X("queue.graphQueued"))}catch(h){if(r.error({enqueueBatchArg:pt(d)},X("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(it({title:X("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(it({title:X("queue.graphFailedToQueue"),status:"error"}))}}})},n$e=Pa(null),r$e=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,fb=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(r$e);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},OR=e=>e==="*"||e==="x"||e==="X",$R=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},i$e=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],o$e=(e,t)=>{if(OR(e)||OR(t))return 0;const[n,r]=i$e($R(e),$R(t));return n>r?1:n{for(let n=0;n{const n=fb(e),r=fb(t),i=n.pop(),o=r.pop(),a=bd(n,r);return a!==0?a:i&&o?bd(i.split("."),o.split(".")):i||o?i?-1:1:0},a$e=(e,t,n)=>{s$e(n);const r=UG(e,t);return GG[n].includes(r)},GG={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},NR=Object.keys(GG),s$e=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(NR.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${NR.join("|")}`)},pv=(e,t)=>{if(t=t.replace(/([><=]+)\s+/g,"$1"),t.includes("||"))return t.split("||").some(_=>pv(e,_));if(t.includes(" - ")){const[_,b]=t.split(" - ",2);return pv(e,`>=${_} <=${b}`)}else if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every(_=>pv(e,_));const n=t.match(/^([<>=~^]+)/),r=n?n[1]:"=";if(r!=="^"&&r!=="~")return a$e(e,t,r);const[i,o,a,,s]=fb(e),[l,u,c,,d]=fb(t),f=[i,o,a],h=[l,u??"x",c??"x"];if(d&&(!s||bd(f,h)!==0||bd(s.split("."),d.split("."))===-1))return!1;const p=h.findIndex(_=>_!=="0")+1,g=r==="~"?2:p>1?p:1;return!(bd(f.slice(0,g),h.slice(0,g))!==0||bd(f.slice(g),h.slice(g))===-1)},l$e=(e,t)=>{const n=Ye(e),{nodes:r,edges:i}=n,o=[],a=r.filter(I5),s=xE(a,"id");return r.forEach(l=>{if(!I5(l))return;const u=t[l.data.type];if(!u){o.push({message:`${de.t("nodes.node")} "${l.data.type}" ${de.t("nodes.skipped")}`,issues:[`${de.t("nodes.nodeType")}"${l.data.type}" ${de.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&UG(u.version,l.data.version)!==0){o.push({message:`${de.t("nodes.node")} "${l.data.type}" ${de.t("nodes.mismatchedVersion")}`,issues:[`${de.t("nodes.node")} "${l.data.type}" v${l.data.version} ${de.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:pt(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${de.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${de.t("nodes.doesNotExist")}`):f.push(`${de.t("nodes.outputNode")} ${l.source} ${de.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${de.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${de.t("nodes.doesNotExist")}`):f.push(`${de.t("nodes.inputNode")} ${l.target} ${de.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${de.t("nodes.sourceNode")} "${l.source}" ${de.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${de.t("nodes.sourceNode")}"${l.target}" ${de.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},u$e=()=>{pe({actionCreator:v1e,effect:(e,{dispatch:t,getState:n})=>{const r=se("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=l$e(i,o);t(fve(a)),s.length?(t(it(vs({title:X("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(it(vs({title:X("toast.workflowLoaded"),status:"success"}))),t(qz("nodes")),requestAnimationFrame(()=>{var l;(l=n$e.get())==null||l.fitView()})}})},c$e={Any:void 0,enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterCollection:[],IPAdapterField:void 0,IPAdapterModelField:void 0,IPAdapterPolymorphic:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,MetadataItemField:void 0,MetadataItemCollection:[],MetadataItemPolymorphic:void 0,MetadataField:void 0,MetadataCollection:[],LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",T2IAdapterCollection:[],T2IAdapterField:void 0,T2IAdapterModelField:void 0,T2IAdapterPolymorphic:void 0,UNetField:void 0,VaeField:void 0,VaeModelField:void 0},d$e=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??c$e[t.type],n},Zw={dragHandle:`.${xz}`},f$e=(e,t,n)=>{const r=yl();if(e==="current_image")return{...Zw,id:r,type:"current_image",position:t,data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(e==="notes")return{...Zw,id:r,type:"notes",position:t,data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};if(n===void 0){console.error(`Unable to find template ${e}.`);return}const i=tg(n.inputs,(s,l,u)=>{const c=yl(),d=d$e(c,l);return s[u]=d,s},{}),o=tg(n.outputs,(s,l,u)=>{const d={id:yl(),name:u,type:l.type,fieldKind:"output"};return s[u]=d,s},{});return{...Zw,id:r,type:"invocation",position:t,data:{id:r,type:e,version:n.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:e!=="save_image",inputs:i,outputs:o,useCache:n.useCache}}},h$e=()=>{const e=w2(),t=C2(r=>r.system.toastQueue),n=gPe();return k.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(vve())},[e,n,t]),null},p$e=()=>{const e=w2();return k.useCallback(n=>e(it(vs(n))),[e])},cGe=k.memo(h$e),hb=(e,t)=>!on(e)||!t?!1:e.data.version!==t.version,HG=(e,t)=>{if(!hb(e,t)||!on(e)||!t||!e.data.version)return!1;const r=Pfe.parse(t.version).major;return pv(e.data.version,`^${r}`)},qG=(e,t)=>{if(!HG(e,t)||!on(e)||!t||!e.data.version)return;const r=f$e(e.data.type,e.position,t),i=Ye(e);return i.data.version=t.version,ID(i,r),i},dGe=e=>{const t=w2(),n=p$e(),{t:r}=VG(),i=k.useMemo(()=>qn(IA,({nodes:c})=>{const d=c.nodes.find(h=>h.id===e),f=c.nodeTemplates[(d==null?void 0:d.data.type)??""];return{node:d,nodeTemplate:f}},Vm),[e]),{node:o,nodeTemplate:a}=C2(i),s=k.useMemo(()=>hb(o,a),[o,a]),l=k.useMemo(()=>HG(o,a),[o,a]),u=k.useCallback(()=>{const c=hb(o,a),d=qG(o,a);if(!d){c&&n({title:r("nodes.unableToUpdateNodes",{count:1})});return}t(Oz({nodeId:d.id,node:d}))},[t,o,a,r,n]);return{needsUpdate:s,mayUpdate:l,updateNode:u}},g$e=()=>{pe({actionCreator:b1e,effect:(e,{dispatch:t,getState:n})=>{const r=se("nodes"),i=n().nodes.nodes,o=n().nodes.nodeTemplates;let a=0;i.forEach(s=>{const l=o[s.data.type],u=hb(s,l),c=qG(s,l);if(!c){u&&a++;return}t(Oz({nodeId:c.id,node:c}))}),a&&(r.warn(`Unable to update ${a} nodes. Please report this issue.`),t(it(vs({title:X("nodes.unableToUpdateNodes",{count:a})}))))}})},WG=mN(),pe=WG.startListening;HRe();qRe();YRe();DRe();LRe();FRe();BRe();zRe();C6e();GRe();WRe();KRe();mRe();ORe();CRe();T1e();x6e();HMe();VMe();z6e();jMe();B6e();L6e();GMe();R7e();C1e();_7e();S7e();w7e();C7e();T7e();v7e();b7e();I7e();M7e();A7e();k7e();E7e();P7e();KMe();WMe();$Re();NRe();jRe();URe();E6e();y7e();u$e();g$e();VRe();ZRe();k1e();eOe();A1e();E1e();t$e();$7e();rOe();const m$e={canvas:Nle,gallery:Lfe,generation:dae,nodes:hve,postprocessing:pve,system:xve,config:Yre,ui:Ave,hotkeys:Tve,controlAdapters:jie,dynamicPrompts:Wle,deleteImageModal:zle,changeBoardModal:Lle,lora:zfe,modelmanager:Eve,sdxl:mve,queue:Cae,[Do.reducerPath]:Do.reducer},y$e=Mf(m$e),v$e=Zve(y$e),b$e=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlAdapters","dynamicPrompts","lora","modelmanager"],KG=Y$({reducer:v$e,enhancers:e=>e.concat(Jve(window.localStorage,b$e,{persistDebounce:300,serialize:d1e,unserialize:h1e,prefix:e1e})).concat(vN()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(Do.middleware).concat(Mve).prepend(WG.middleware),devTools:{actionSanitizer:_1e,stateSanitizer:x1e,trace:!0,predicate:(e,t)=>!S1e.includes(t.type)}}),IA=e=>e;BF.set(KG);const _$e=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{se("socketio").debug("Connected"),r(VD());const o=Dn.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(it(vs({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(jD())}),t.on("invocation_started",i=>{r(GD({data:i}))}),t.on("generator_progress",i=>{r(KD({data:i}))}),t.on("invocation_error",i=>{r(HD({data:i}))}),t.on("invocation_complete",i=>{r(TE({data:i}))}),t.on("graph_execution_state_complete",i=>{r(qD({data:i}))}),t.on("model_load_started",i=>{r(XD({data:i}))}),t.on("model_load_completed",i=>{r(YD({data:i}))}),t.on("session_retrieval_error",i=>{r(JD({data:i}))}),t.on("invocation_retrieval_error",i=>{r(tL({data:i}))}),t.on("queue_item_status_changed",i=>{r(rL({data:i}))})},Ca=Object.create(null);Ca.open="0";Ca.close="1";Ca.ping="2";Ca.pong="3";Ca.message="4";Ca.upgrade="5";Ca.noop="6";const gv=Object.create(null);Object.keys(Ca).forEach(e=>{gv[Ca[e]]=e});const j3={type:"error",data:"parser error"},XG=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",QG=typeof ArrayBuffer=="function",YG=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,MA=({type:e,data:t},n,r)=>XG&&t instanceof Blob?n?r(t):DR(t,r):QG&&(t instanceof ArrayBuffer||YG(t))?n?r(t):DR(new Blob([t]),r):r(Ca[e]+(t||"")),DR=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function LR(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Jw;function S$e(e,t){if(XG&&e.data instanceof Blob)return e.data.arrayBuffer().then(LR).then(t);if(QG&&(e.data instanceof ArrayBuffer||YG(e.data)))return t(LR(e.data));MA(e,!1,n=>{Jw||(Jw=new TextEncoder),t(Jw.encode(n))})}const FR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ep=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),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},w$e=typeof ArrayBuffer=="function",RA=(e,t)=>{if(typeof e!="string")return{type:"message",data:ZG(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:C$e(e.substring(1),t)}:gv[n]?e.length>1?{type:gv[n],data:e.substring(1)}:{type:gv[n]}:j3},C$e=(e,t)=>{if(w$e){const n=x$e(e);return ZG(n,t)}else return{base64:!0,data:e}},ZG=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},JG=String.fromCharCode(30),E$e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{MA(o,!1,s=>{r[a]=s,++i===n&&t(r.join(JG))})})},T$e=(e,t)=>{const n=e.split(JG),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let eC;function Sy(e){return e.reduce((t,n)=>t+n.length,0)}function xy(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(j3);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Sy(n)e){s.enqueue(j3);break}}}})}const eH=4;function En(e){if(e)return k$e(e)}function k$e(e){for(var t in En.prototype)e[t]=En.prototype[t];return e}En.prototype.on=En.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};En.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};En.prototype.off=En.prototype.removeListener=En.prototype.removeAllListeners=En.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function tH(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const I$e=qi.setTimeout,M$e=qi.clearTimeout;function E2(e,t){t.useNativeTimers?(e.setTimeoutFn=I$e.bind(qi),e.clearTimeoutFn=M$e.bind(qi)):(e.setTimeoutFn=qi.setTimeout.bind(qi),e.clearTimeoutFn=qi.clearTimeout.bind(qi))}const R$e=1.33;function O$e(e){return typeof e=="string"?$$e(e):Math.ceil((e.byteLength||e.size)*R$e)}function $$e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function N$e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function D$e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function rH(){const e=VR(+new Date);return e!==zR?(BR=0,zR=e):e+"."+VR(BR++)}for(;wy{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)};T$e(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,E$e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=rH()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new qd(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}}let qd=class mv extends En{constructor(t,n){super(),E2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=tH(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new oH(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=mv.requestsCount++,mv.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=z$e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete mv.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()}};qd.requestsCount=0;qd.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",jR);else if(typeof addEventListener=="function"){const e="onpagehide"in qi?"pagehide":"unload";addEventListener(e,jR,!1)}}function jR(){for(let e in qd.requests)qd.requests.hasOwnProperty(e)&&qd.requests[e].abort()}const $A=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),Cy=qi.WebSocket||qi.MozWebSocket,UR=!0,U$e="arraybuffer",GR=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class G$e extends OA{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=GR?{}:tH(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=UR&&!GR?n?new Cy(t,n):new Cy(t):new Cy(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,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{UR&&this.ws.send(o)}catch{}i&&$A(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=rH()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!Cy}}class H$e extends OA{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=P$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=A$e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&$A(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const q$e={websocket:G$e,webtransport:H$e,polling:j$e},W$e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,K$e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function G3(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=W$e.exec(e||""),o={},a=14;for(;a--;)o[K$e[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=X$e(o,o.path),o.queryKey=Q$e(o,o.query),o}function X$e(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 Q$e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let aH=class Xc extends En{constructor(t,n={}){super(),this.binaryType=U$e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=G3(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=G3(n.host).host),E2(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","webtransport"],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:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=D$e(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=eH,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new q$e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Xc.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;Xc.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Xc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{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),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Xc.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){Xc.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,sH=Object.prototype.toString,eNe=typeof Blob=="function"||typeof Blob<"u"&&sH.call(Blob)==="[object BlobConstructor]",tNe=typeof File=="function"||typeof File<"u"&&sH.call(File)==="[object FileConstructor]";function NA(e){return Z$e&&(e instanceof ArrayBuffer||J$e(e))||eNe&&e instanceof Blob||tNe&&e instanceof File}function yv(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{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._queueSeq++,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(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}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:Ze.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 Ze.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 Ze.EVENT:case Ze.BINARY_EVENT:this.onevent(t);break;case Ze.ACK:case Ze.BINARY_ACK:this.onack(t);break;case Ze.DISCONNECT:this.ondisconnect();break;case Ze.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:Ze.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"),this._drainQueue(!0)}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:Ze.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}Wf.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};Wf.prototype.reset=function(){this.attempts=0};Wf.prototype.setMin=function(e){this.ms=e};Wf.prototype.setMax=function(e){this.max=e};Wf.prototype.setJitter=function(e){this.jitter=e};class W3 extends En{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,E2(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 Wf({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||lNe;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 aH(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=bo(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=bo(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(bo(t,"ping",this.onping.bind(this)),bo(t,"data",this.ondata.bind(this)),bo(t,"error",this.onerror.bind(this)),bo(t,"close",this.onclose.bind(this)),bo(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){$A(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new lH(this,t,n),this.nsps[t]=r),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(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const $h={};function vv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Y$e(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=$h[i]&&o in $h[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new W3(r,t):($h[i]||($h[i]=new W3(r,t)),l=$h[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(vv,{Manager:W3,Socket:lH,io:vv,connect:vv});const qR=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=vg.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=yg.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=vv(n,r);return a=>s=>l=>{e||(_$e({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},cNe=""+new URL("logo-13003d72.png",import.meta.url).href,dNe=()=>oe.jsxs(sA,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[oe.jsx(aA,{src:cNe,w:"8rem",h:"8rem"}),oe.jsx(rA,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),fNe=k.memo(dNe);function K3(e){"@babel/helpers - typeof";return K3=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},K3(e)}var uH=[],hNe=uH.forEach,pNe=uH.slice;function X3(e){return hNe.call(pNe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function cH(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":K3(XMLHttpRequest))==="object"}function gNe(e){return!!e&&typeof e.then=="function"}function mNe(e){return gNe(e)?e:Promise.resolve(e)}function yNe(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 Q3={exports:{}},Ey={exports:{}},WR;function vNe(){return WR||(WR=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof He<"u"&&He,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s=typeof o<"u"&&o||typeof self<"u"&&self||typeof s<"u"&&s,l={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function u(A){return A&&DataView.prototype.isPrototypeOf(A)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(A){return A&&c.indexOf(Object.prototype.toString.call(A))>-1};function f(A){if(typeof A!="string"&&(A=String(A)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(A)||A==="")throw new TypeError('Invalid character in header field name: "'+A+'"');return A.toLowerCase()}function h(A){return typeof A!="string"&&(A=String(A)),A}function p(A){var R={next:function(){var D=A.shift();return{done:D===void 0,value:D}}};return l.iterable&&(R[Symbol.iterator]=function(){return R}),R}function g(A){this.map={},A instanceof g?A.forEach(function(R,D){this.append(D,R)},this):Array.isArray(A)?A.forEach(function(R){this.append(R[0],R[1])},this):A&&Object.getOwnPropertyNames(A).forEach(function(R){this.append(R,A[R])},this)}g.prototype.append=function(A,R){A=f(A),R=h(R);var D=this.map[A];this.map[A]=D?D+", "+R:R},g.prototype.delete=function(A){delete this.map[f(A)]},g.prototype.get=function(A){return A=f(A),this.has(A)?this.map[A]:null},g.prototype.has=function(A){return this.map.hasOwnProperty(f(A))},g.prototype.set=function(A,R){this.map[f(A)]=h(R)},g.prototype.forEach=function(A,R){for(var D in this.map)this.map.hasOwnProperty(D)&&A.call(R,this.map[D],D,this)},g.prototype.keys=function(){var A=[];return this.forEach(function(R,D){A.push(D)}),p(A)},g.prototype.values=function(){var A=[];return this.forEach(function(R){A.push(R)}),p(A)},g.prototype.entries=function(){var A=[];return this.forEach(function(R,D){A.push([D,R])}),p(A)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function _(A){if(A.bodyUsed)return Promise.reject(new TypeError("Already read"));A.bodyUsed=!0}function b(A){return new Promise(function(R,D){A.onload=function(){R(A.result)},A.onerror=function(){D(A.error)}})}function y(A){var R=new FileReader,D=b(R);return R.readAsArrayBuffer(A),D}function m(A){var R=new FileReader,D=b(R);return R.readAsText(A),D}function v(A){for(var R=new Uint8Array(A),D=new Array(R.length),$=0;$-1?R:A}function P(A,R){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var D=R.body;if(A instanceof P){if(A.bodyUsed)throw new TypeError("Already read");this.url=A.url,this.credentials=A.credentials,R.headers||(this.headers=new g(A.headers)),this.method=A.method,this.mode=A.mode,this.signal=A.signal,!D&&A._bodyInit!=null&&(D=A._bodyInit,A.bodyUsed=!0)}else this.url=String(A);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new g(R.headers)),this.method=x(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(D),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var $=/([?&])_=[^&]*/;if($.test(this.url))this.url=this.url.replace($,"$1_="+new Date().getTime());else{var L=/\?/;this.url+=(L.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function E(A){var R=new FormData;return A.trim().split("&").forEach(function(D){if(D){var $=D.split("="),L=$.shift().replace(/\+/g," "),O=$.join("=").replace(/\+/g," ");R.append(decodeURIComponent(L),decodeURIComponent(O))}}),R}function I(A){var R=new g,D=A.replace(/\r?\n[\t ]+/g," ");return D.split("\r").map(function($){return $.indexOf(` +`)===0?$.substr(1,$.length):$}).forEach(function($){var L=$.split(":"),O=L.shift().trim();if(O){var B=L.join(":").trim();R.append(O,B)}}),R}w.call(P.prototype);function N(A,R){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new g(R.headers),this.url=R.url||"",this._initBody(A)}w.call(N.prototype),N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},N.error=function(){var A=new N(null,{status:0,statusText:""});return A.type="error",A};var M=[301,302,303,307,308];N.redirect=function(A,R){if(M.indexOf(R)===-1)throw new RangeError("Invalid status code");return new N(null,{status:R,headers:{location:A}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(R,D){this.message=R,this.name=D;var $=Error(R);this.stack=$.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function T(A,R){return new Promise(function(D,$){var L=new P(A,R);if(L.signal&&L.signal.aborted)return $(new a.DOMException("Aborted","AbortError"));var O=new XMLHttpRequest;function B(){O.abort()}O.onload=function(){var j={status:O.status,statusText:O.statusText,headers:I(O.getAllResponseHeaders()||"")};j.url="responseURL"in O?O.responseURL:j.headers.get("X-Request-URL");var q="response"in O?O.response:O.responseText;setTimeout(function(){D(new N(q,j))},0)},O.onerror=function(){setTimeout(function(){$(new TypeError("Network request failed"))},0)},O.ontimeout=function(){setTimeout(function(){$(new TypeError("Network request failed"))},0)},O.onabort=function(){setTimeout(function(){$(new a.DOMException("Aborted","AbortError"))},0)};function U(j){try{return j===""&&s.location.href?s.location.href:j}catch{return j}}O.open(L.method,U(L.url),!0),L.credentials==="include"?O.withCredentials=!0:L.credentials==="omit"&&(O.withCredentials=!1),"responseType"in O&&(l.blob?O.responseType="blob":l.arrayBuffer&&L.headers.get("Content-Type")&&L.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(O.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof g)?Object.getOwnPropertyNames(R.headers).forEach(function(j){O.setRequestHeader(j,h(R.headers[j]))}):L.headers.forEach(function(j,q){O.setRequestHeader(q,j)}),L.signal&&(L.signal.addEventListener("abort",B),O.onreadystatechange=function(){O.readyState===4&&L.signal.removeEventListener("abort",B)}),O.send(typeof L._bodyInit>"u"?null:L._bodyInit)})}return T.polyfill=!0,s.fetch||(s.fetch=T,s.Headers=g,s.Request=P,s.Response=N),a.Headers=g,a.Request=P,a.Response=N,a.fetch=T,a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n: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}(Ey,Ey.exports)),Ey.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof He<"u"&&He.fetch?n=He.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof yNe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||vNe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Q3,Q3.exports);var dH=Q3.exports;const fH=Bl(dH),KR=gO({__proto__:null,default:fH},[dH]);function pb(e){"@babel/helpers - typeof";return pb=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},pb(e)}var ls;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?ls=global.fetch:typeof window<"u"&&window.fetch?ls=window.fetch:ls=fetch);var Wg;cH()&&(typeof global<"u"&&global.XMLHttpRequest?Wg=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Wg=window.XMLHttpRequest));var gb;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?gb=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(gb=window.ActiveXObject));!ls&&KR&&!Wg&&!gb&&(ls=fH||KR);typeof ls!="function"&&(ls=void 0);var Y3=function(t,n){if(n&&pb(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},XR=function(t,n,r){var i=function(a){if(!a.ok)return r(a.statusText||"Error",{status:a.status});a.text().then(function(s){r(null,{status:a.status,data:s})}).catch(r)};typeof fetch=="function"?fetch(t,n).then(i).catch(r):ls(t,n).then(i).catch(r)},QR=!1,bNe=function(t,n,r,i){t.queryStringParams&&(n=Y3(n,t.queryStringParams));var o=X3({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(o["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=X3({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},QR?{}:a);try{XR(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]}),XR(n,s,i),QR=!0}catch(u){i(u)}}},_Ne=function(t,n,r,i){r&&pb(r)==="object"&&(r=Y3("",r).slice(1)),t.queryStringParams&&(n=Y3(n,t.queryStringParams));try{var o;Wg?o=new Wg:o=new gb("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)}},SNe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},ls&&n.indexOf("file:")!==0)return bNe(t,n,r,i);if(cH()||typeof ActiveXObject=="function")return _Ne(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Kg(e){"@babel/helpers - typeof";return Kg=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},Kg(e)}function xNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YR(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};xNe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return wNe(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=X3(i,this.options||{},TNe()),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=mNe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{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,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(g,_){u+=1,c.push(g),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{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(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();pH.type="backend";de.use(pH).use(W7e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const T2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Kf(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function LA(e){return"nodeType"in e}function zr(e){var t,n;return e?Kf(e)?e:LA(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function FA(e){const{Document:t}=zr(e);return e instanceof t}function Wm(e){return Kf(e)?!1:e instanceof zr(e).HTMLElement}function gH(e){return e instanceof zr(e).SVGElement}function Xf(e){return e?Kf(e)?e.document:LA(e)?FA(e)?e:Wm(e)||gH(e)?e.ownerDocument:document:document:document}const Ea=T2?k.useLayoutEffect:k.useEffect;function A2(e){const t=k.useRef(e);return Ea(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Xg(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return Ea(()=>{n.current!==e&&(n.current=e)},t),n}function Km(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function mb(e){const t=A2(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function yb(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let tC={};function P2(e,t){return k.useMemo(()=>{if(t)return t;const n=tC[e]==null?0:tC[e]+1;return tC[e]=n,e+"-"+n},[e,t])}function mH(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const Wd=mH(1),vb=mH(-1);function PNe(e){return"clientX"in e&&"clientY"in e}function BA(e){if(!e)return!1;const{KeyboardEvent:t}=zr(e.target);return t&&e instanceof t}function kNe(e){if(!e)return!1;const{TouchEvent:t}=zr(e.target);return t&&e instanceof t}function Qg(e){if(kNe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return PNe(e)?{x:e.clientX,y:e.clientY}:null}const Yg=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Yg.Translate.toString(e),Yg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ZR="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function INe(e){return e.matches(ZR)?e:e.querySelector(ZR)}const MNe={display:"none"};function RNe(e){let{id:t,value:n}=e;return J.createElement("div",{id:t,style:MNe},n)}function ONe(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return J.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function $Ne(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const yH=k.createContext(null);function NNe(e){const t=k.useContext(yH);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function DNe(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const LNe={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},FNe={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function BNe(e){let{announcements:t=FNe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=LNe}=e;const{announce:o,announcement:a}=$Ne(),s=P2("DndLiveRegion"),[l,u]=k.useState(!1);if(k.useEffect(()=>{u(!0)},[]),NNe(k.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=J.createElement(J.Fragment,null,J.createElement(RNe,{id:r,value:i.draggable}),J.createElement(ONe,{id:s,announcement:a}));return n?mi.createPortal(c,n):c}var kn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(kn||(kn={}));function bb(){}function JR(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function zNe(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Fo=Object.freeze({x:0,y:0});function VNe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jNe(e,t){const n=Qg(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function UNe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function GNe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function HNe(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function qNe(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function WNe(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=WNe(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(GNe)};function XNe(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const QNe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&XNe(r,s)){const u=HNe(s).reduce((d,f)=>d+VNe(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(UNe)};function YNe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function vH(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fo}function ZNe(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const JNe=ZNe(1);function bH(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function eDe(e,t,n){const r=bH(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const tDe={ignoreTransform:!1};function Xm(e,t){t===void 0&&(t=tDe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=zr(e).getComputedStyle(e);u&&(n=eDe(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function eO(e){return Xm(e,{ignoreTransform:!0})}function nDe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rDe(e,t){return t===void 0&&(t=zr(e).getComputedStyle(e)),t.position==="fixed"}function iDe(e,t){t===void 0&&(t=zr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function zA(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(FA(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Wm(i)||gH(i)||n.includes(i))return n;const o=zr(e).getComputedStyle(i);return i!==e&&iDe(i,o)&&n.push(i),rDe(i,o)?n:r(i.parentNode)}return e?r(e):n}function _H(e){const[t]=zA(e,1);return t??null}function nC(e){return!T2||!e?null:Kf(e)?e:LA(e)?FA(e)||e===Xf(e).scrollingElement?window:Wm(e)?e:null:null}function SH(e){return Kf(e)?e.scrollX:e.scrollLeft}function xH(e){return Kf(e)?e.scrollY:e.scrollTop}function Z3(e){return{x:SH(e),y:xH(e)}}var jn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(jn||(jn={}));function wH(e){return!T2||!e?!1:e===document.scrollingElement}function CH(e){const t={x:0,y:0},n=wH(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const oDe={x:.2,y:.2};function aDe(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=oDe);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=CH(e),h={x:0,y:0},p={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+g.height?(h.y=jn.Backward,p.y=r*Math.abs((t.top+g.height-o)/g.height)):!c&&l>=t.bottom-g.height&&(h.y=jn.Forward,p.y=r*Math.abs((t.bottom-g.height-l)/g.height)),!f&&s>=t.right-g.width?(h.x=jn.Forward,p.x=r*Math.abs((t.right-g.width-s)/g.width)):!d&&a<=t.left+g.width&&(h.x=jn.Backward,p.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:h,speed:p}}function sDe(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function EH(e){return e.reduce((t,n)=>Wd(t,Z3(n)),Fo)}function lDe(e){return e.reduce((t,n)=>t+SH(n),0)}function uDe(e){return e.reduce((t,n)=>t+xH(n),0)}function TH(e,t){if(t===void 0&&(t=Xm),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);_H(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const cDe=[["x",["left","right"],lDe],["y",["top","bottom"],uDe]];class VA{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=zA(n),i=EH(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of cDe)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ep{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function dDe(e){const{EventTarget:t}=zr(e);return e instanceof t?e:Xf(e)}function rC(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Ui;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ui||(Ui={}));function tO(e){e.preventDefault()}function fDe(e){e.stopPropagation()}var At;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(At||(At={}));const AH={start:[At.Space,At.Enter],cancel:[At.Esc],end:[At.Space,At.Enter]},hDe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case At.Right:return{...n,x:n.x+25};case At.Left:return{...n,x:n.x-25};case At.Down:return{...n,y:n.y+25};case At.Up:return{...n,y:n.y-25}}};class PH{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ep(Xf(n)),this.windowListeners=new Ep(zr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ui.Resize,this.handleCancel),this.windowListeners.add(Ui.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ui.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&TH(r),n(Fo)}handleKeyDown(t){if(BA(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=AH,coordinateGetter:a=hDe,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Fo;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=vb(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const g of p){const _=t.code,{isTop:b,isRight:y,isLeft:m,isBottom:v,maxScroll:S,minScroll:w}=CH(g),C=sDe(g),x={x:Math.min(_===At.Right?C.right-C.width/2:C.right,Math.max(_===At.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(_===At.Down?C.bottom-C.height/2:C.bottom,Math.max(_===At.Down?C.top:C.top+C.height/2,d.y))},P=_===At.Right&&!y||_===At.Left&&!m,E=_===At.Down&&!v||_===At.Up&&!b;if(P&&x.x!==d.x){const I=g.scrollLeft+f.x,N=_===At.Right&&I<=S.x||_===At.Left&&I>=w.x;if(N&&!f.y){g.scrollTo({left:I,behavior:s});return}N?h.x=g.scrollLeft-I:h.x=_===At.Right?g.scrollLeft-S.x:g.scrollLeft-w.x,h.x&&g.scrollBy({left:-h.x,behavior:s});break}else if(E&&x.y!==d.y){const I=g.scrollTop+f.y,N=_===At.Down&&I<=S.y||_===At.Up&&I>=w.y;if(N&&!f.x){g.scrollTo({top:I,behavior:s});return}N?h.y=g.scrollTop-I:h.y=_===At.Down?g.scrollTop-S.y:g.scrollTop-w.y,h.y&&g.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,Wd(vb(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}PH.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=AH,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function nO(e){return!!(e&&"distance"in e)}function rO(e){return!!(e&&"delay"in e)}class jA{constructor(t,n,r){var i;r===void 0&&(r=dDe(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Xf(a),this.documentListeners=new Ep(this.document),this.listeners=new Ep(r),this.windowListeners=new Ep(zr(a)),this.initialCoordinates=(i=Qg(o))!=null?i:Fo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Ui.Resize,this.handleCancel),this.windowListeners.add(Ui.DragStart,tO),this.windowListeners.add(Ui.VisibilityChange,this.handleCancel),this.windowListeners.add(Ui.ContextMenu,tO),this.documentListeners.add(Ui.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rO(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(nO(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ui.Click,fDe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ui.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=Qg(t))!=null?n:Fo,u=vb(i,l);if(!r&&s){if(nO(s)){if(s.tolerance!=null&&rC(u,s.tolerance))return this.handleCancel();if(rC(u,s.distance))return this.handleStart()}return rO(s)&&rC(u,s.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===At.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const pDe={move:{name:"pointermove"},end:{name:"pointerup"}};class kH extends jA{constructor(t){const{event:n}=t,r=Xf(n.target);super(t,pDe,r)}}kH.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const gDe={move:{name:"mousemove"},end:{name:"mouseup"}};var J3;(function(e){e[e.RightClick=2]="RightClick"})(J3||(J3={}));class IH extends jA{constructor(t){super(t,gDe,Xf(t.event.target))}}IH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===J3.RightClick?!1:(r==null||r({event:n}),!0)}}];const iC={move:{name:"touchmove"},end:{name:"touchend"}};class MH extends jA{constructor(t){super(t,iC)}static setup(){return window.addEventListener(iC.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(iC.move.name,t)};function t(){}}}MH.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Tp;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tp||(Tp={}));var _b;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(_b||(_b={}));function mDe(e){let{acceleration:t,activator:n=Tp.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=_b.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=vDe({delta:d,disabled:!o}),[p,g]=ANe(),_=k.useRef({x:0,y:0}),b=k.useRef({x:0,y:0}),y=k.useMemo(()=>{switch(n){case Tp.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Tp.DraggableRect:return i}},[n,i,l]),m=k.useRef(null),v=k.useCallback(()=>{const w=m.current;if(!w)return;const C=_.current.x*b.current.x,x=_.current.y*b.current.y;w.scrollBy(C,x)},[]),S=k.useMemo(()=>s===_b.TreeOrder?[...u].reverse():u,[s,u]);k.useEffect(()=>{if(!o||!u.length||!y){g();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const C=u.indexOf(w),x=c[C];if(!x)continue;const{direction:P,speed:E}=aDe(w,x,y,t,f);for(const I of["x","y"])h[I][P[I]]||(E[I]=0,P[I]=0);if(E.x>0||E.y>0){g(),m.current=w,p(v,a),_.current=E,b.current=P;return}}_.current={x:0,y:0},b.current={x:0,y:0},g()},[t,v,r,g,o,a,JSON.stringify(y),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const yDe={x:{[jn.Backward]:!1,[jn.Forward]:!1},y:{[jn.Backward]:!1,[jn.Forward]:!1}};function vDe(e){let{delta:t,disabled:n}=e;const r=yb(t);return Km(i=>{if(n||!r||!i)return yDe;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[jn.Backward]:i.x[jn.Backward]||o.x===-1,[jn.Forward]:i.x[jn.Forward]||o.x===1},y:{[jn.Backward]:i.y[jn.Backward]||o.y===-1,[jn.Forward]:i.y[jn.Forward]||o.y===1}}},[n,t,r])}function bDe(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Km(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function _De(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var Zg;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Zg||(Zg={}));var e4;(function(e){e.Optimized="optimized"})(e4||(e4={}));const iO=new Map;function SDe(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=k.useState(null),{frequency:s,measure:l,strategy:u}=i,c=k.useRef(e),d=_(),f=Xg(d),h=k.useCallback(function(b){b===void 0&&(b=[]),!f.current&&a(y=>y===null?b:y.concat(b.filter(m=>!y.includes(m))))},[f]),p=k.useRef(null),g=Km(b=>{if(d&&!n)return iO;if(!b||b===iO||c.current!==e||o!=null){const y=new Map;for(let m of e){if(!m)continue;if(o&&o.length>0&&!o.includes(m.id)&&m.rect.current){y.set(m.id,m.rect.current);continue}const v=m.node.current,S=v?new VA(l(v),v):null;m.rect.current=S,S&&y.set(m.id,S)}return y}return b},[e,o,n,d,l]);return k.useEffect(()=>{c.current=e},[e]),k.useEffect(()=>{d||h()},[n,d]),k.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Zg.Always:return!1;case Zg.BeforeDragging:return n;default:return!n}}}function UA(e,t){return Km(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function xDe(e,t){return UA(e,t)}function wDe(e){let{callback:t,disabled:n}=e;const r=A2(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function k2(e){let{callback:t,disabled:n}=e;const r=A2(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function CDe(e){return new VA(Xm(e),e)}function oO(e,t,n){t===void 0&&(t=CDe);const[r,i]=k.useReducer(s,null),o=wDe({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=k2({callback:i});return Ea(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function EDe(e){const t=UA(e);return vH(e,t)}const aO=[];function TDe(e){const t=k.useRef(e),n=Km(r=>e?r&&r!==aO&&e&&t.current&&e.parentNode===t.current.parentNode?r:zA(e):aO,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function ADe(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const a=nC(o.target);a&&n(s=>s?(s.set(a,Z3(a)),new Map(s)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=nC(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,Z3(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=nC(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>Wd(o,a),Fo):EH(e):Fo,[e,t])}function sO(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==Fo;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?vb(e,n.current):Fo}function PDe(e){k.useEffect(()=>{if(!T2)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function kDe(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function RH(e){return k.useMemo(()=>e?nDe(e):null,[e])}const oC=[];function IDe(e,t){t===void 0&&(t=Xm);const[n]=e,r=RH(n?zr(n):null),[i,o]=k.useReducer(s,oC),a=k2({callback:o});return e.length>0&&i===oC&&o(),Ea(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>wH(l)?r:new VA(t(l),l)):oC}}function OH(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Wm(t)?t:e}function MDe(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(u=>{for(const{target:c}of u)if(Wm(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=k2({callback:i}),a=k.useCallback(u=>{const c=OH(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=mb(a);return k.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const RDe=[{sensor:kH,options:{}},{sensor:PH,options:{}}],ODe={current:{}},bv={draggable:{measure:eO},droppable:{measure:eO,strategy:Zg.WhileDragging,frequency:e4.Optimized},dragOverlay:{measure:Xm}};class Ap extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $De={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ap,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:bb},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bv,measureDroppableContainers:bb,windowRect:null,measuringScheduled:!1},$H={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:bb,draggableNodes:new Map,over:null,measureDroppableContainers:bb},Qm=k.createContext($H),NH=k.createContext($De);function NDe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ap}}}function DDe(e,t){switch(t.type){case kn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case kn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case kn.DragEnd:case kn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case kn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Ap(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case kn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Ap(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case kn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Ap(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function LDe(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(Qm),o=yb(r),a=yb(n==null?void 0:n.id);return k.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!BA(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=INe(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function DH(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function FDe(e){return k.useMemo(()=>({draggable:{...bv.draggable,...e==null?void 0:e.draggable},droppable:{...bv.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bv.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function BDe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Ea(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=vH(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=_H(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const I2=k.createContext({...Fo,scaleX:1,scaleY:1});var Xs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Xs||(Xs={}));const zDe=k.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=RDe,collisionDetection:d=KNe,measuring:f,modifiers:h,...p}=t;const g=k.useReducer(DDe,void 0,NDe),[_,b]=g,[y,m]=DNe(),[v,S]=k.useState(Xs.Uninitialized),w=v===Xs.Initialized,{draggable:{active:C,nodes:x,translate:P},droppable:{containers:E}}=_,I=C?x.get(C):null,N=k.useRef({initial:null,translated:null}),M=k.useMemo(()=>{var Xt;return C!=null?{id:C,data:(Xt=I==null?void 0:I.data)!=null?Xt:ODe,rect:N}:null},[C,I]),T=k.useRef(null),[A,R]=k.useState(null),[D,$]=k.useState(null),L=Xg(p,Object.values(p)),O=P2("DndDescribedBy",a),B=k.useMemo(()=>E.getEnabled(),[E]),U=FDe(f),{droppableRects:j,measureDroppableContainers:q,measuringScheduled:Y}=SDe(B,{dragging:w,dependencies:[P.x,P.y],config:U.droppable}),Z=bDe(x,C),V=k.useMemo(()=>D?Qg(D):null,[D]),K=nu(),ee=xDe(Z,U.draggable.measure);BDe({activeNode:C?x.get(C):null,config:K.layoutShiftCompensation,initialRect:ee,measure:U.draggable.measure});const re=oO(Z,U.draggable.measure,ee),fe=oO(Z?Z.parentElement:null),Se=k.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Me=E.getNodeFor((n=Se.current.over)==null?void 0:n.id),De=MDe({measure:U.dragOverlay.measure}),Ee=(r=De.nodeRef.current)!=null?r:Z,tt=w?(i=De.rect)!=null?i:re:null,ot=!!(De.nodeRef.current&&De.rect),we=EDe(ot?null:re),Xn=RH(Ee?zr(Ee):null),Vt=TDe(w?Me??Z:null),Ot=IDe(Vt),xt=DH(h,{transform:{x:P.x-we.x,y:P.y-we.y,scaleX:1,scaleY:1},activatorEvent:D,active:M,activeNodeRect:re,containerNodeRect:fe,draggingNodeRect:tt,over:Se.current.over,overlayNodeRect:De.rect,scrollableAncestors:Vt,scrollableAncestorRects:Ot,windowRect:Xn}),bn=V?Wd(V,P):null,Vr=ADe(Vt),co=sO(Vr),Mi=sO(Vr,[re]),ur=Wd(xt,co),Qn=tt?JNe(tt,xt):null,xr=M&&Qn?d({active:M,collisionRect:Qn,droppableRects:j,droppableContainers:B,pointerCoordinates:bn}):null,rn=qNe(xr,"id"),[$t,li]=k.useState(null),Ri=ot?xt:Wd(xt,Mi),fo=YNe(Ri,(o=$t==null?void 0:$t.rect)!=null?o:null,re),jr=k.useCallback((Xt,wt)=>{let{sensor:Yn,options:Nn}=wt;if(T.current==null)return;const cr=x.get(T.current);if(!cr)return;const wr=Xt.nativeEvent,Ur=new Yn({active:T.current,activeNode:cr,event:wr,options:Nn,context:Se,onStart(Cr){const Zn=T.current;if(Zn==null)return;const Ra=x.get(Zn);if(!Ra)return;const{onDragStart:Is}=L.current,Ms={active:{id:Zn,data:Ra.data,rect:N}};mi.unstable_batchedUpdates(()=>{Is==null||Is(Ms),S(Xs.Initializing),b({type:kn.DragStart,initialCoordinates:Cr,active:Zn}),y({type:"onDragStart",event:Ms})})},onMove(Cr){b({type:kn.DragMove,coordinates:Cr})},onEnd:Uo(kn.DragEnd),onCancel:Uo(kn.DragCancel)});mi.unstable_batchedUpdates(()=>{R(Ur),$(Xt.nativeEvent)});function Uo(Cr){return async function(){const{active:Ra,collisions:Is,over:Ms,scrollAdjustedTranslate:Cc}=Se.current;let Oa=null;if(Ra&&Cc){const{cancelDrop:Er}=L.current;Oa={activatorEvent:wr,active:Ra,collisions:Is,delta:Cc,over:Ms},Cr===kn.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Oa))&&(Cr=kn.DragCancel)}T.current=null,mi.unstable_batchedUpdates(()=>{b({type:Cr}),S(Xs.Uninitialized),li(null),R(null),$(null);const Er=Cr===kn.DragEnd?"onDragEnd":"onDragCancel";if(Oa){const ru=L.current[Er];ru==null||ru(Oa),y({type:Er,event:Oa})}})}}},[x]),_n=k.useCallback((Xt,wt)=>(Yn,Nn)=>{const cr=Yn.nativeEvent,wr=x.get(Nn);if(T.current!==null||!wr||cr.dndKit||cr.defaultPrevented)return;const Ur={active:wr};Xt(Yn,wt.options,Ur)===!0&&(cr.dndKit={capturedBy:wt.sensor},T.current=Nn,jr(Yn,wt))},[x,jr]),ui=_De(c,_n);PDe(c),Ea(()=>{re&&v===Xs.Initializing&&S(Xs.Initialized)},[re,v]),k.useEffect(()=>{const{onDragMove:Xt}=L.current,{active:wt,activatorEvent:Yn,collisions:Nn,over:cr}=Se.current;if(!wt||!Yn)return;const wr={active:wt,activatorEvent:Yn,collisions:Nn,delta:{x:ur.x,y:ur.y},over:cr};mi.unstable_batchedUpdates(()=>{Xt==null||Xt(wr),y({type:"onDragMove",event:wr})})},[ur.x,ur.y]),k.useEffect(()=>{const{active:Xt,activatorEvent:wt,collisions:Yn,droppableContainers:Nn,scrollAdjustedTranslate:cr}=Se.current;if(!Xt||T.current==null||!wt||!cr)return;const{onDragOver:wr}=L.current,Ur=Nn.get(rn),Uo=Ur&&Ur.rect.current?{id:Ur.id,rect:Ur.rect.current,data:Ur.data,disabled:Ur.disabled}:null,Cr={active:Xt,activatorEvent:wt,collisions:Yn,delta:{x:cr.x,y:cr.y},over:Uo};mi.unstable_batchedUpdates(()=>{li(Uo),wr==null||wr(Cr),y({type:"onDragOver",event:Cr})})},[rn]),Ea(()=>{Se.current={activatorEvent:D,active:M,activeNode:Z,collisionRect:Qn,collisions:xr,droppableRects:j,draggableNodes:x,draggingNode:Ee,draggingNodeRect:tt,droppableContainers:E,over:$t,scrollableAncestors:Vt,scrollAdjustedTranslate:ur},N.current={initial:tt,translated:Qn}},[M,Z,xr,Qn,x,Ee,tt,j,E,$t,Vt,ur]),mDe({...K,delta:P,draggingRect:Qn,pointerCoordinates:bn,scrollableAncestors:Vt,scrollableAncestorRects:Ot});const tu=k.useMemo(()=>({active:M,activeNode:Z,activeNodeRect:re,activatorEvent:D,collisions:xr,containerNodeRect:fe,dragOverlay:De,draggableNodes:x,droppableContainers:E,droppableRects:j,over:$t,measureDroppableContainers:q,scrollableAncestors:Vt,scrollableAncestorRects:Ot,measuringConfiguration:U,measuringScheduled:Y,windowRect:Xn}),[M,Z,re,D,xr,fe,De,x,E,j,$t,q,Vt,Ot,U,Y,Xn]),jo=k.useMemo(()=>({activatorEvent:D,activators:ui,active:M,activeNodeRect:re,ariaDescribedById:{draggable:O},dispatch:b,draggableNodes:x,over:$t,measureDroppableContainers:q}),[D,ui,M,re,b,O,x,$t,q]);return J.createElement(yH.Provider,{value:m},J.createElement(Qm.Provider,{value:jo},J.createElement(NH.Provider,{value:tu},J.createElement(I2.Provider,{value:fo},u)),J.createElement(LDe,{disabled:(s==null?void 0:s.restoreFocus)===!1})),J.createElement(BNe,{...s,hiddenTextDescribedById:O}));function nu(){const Xt=(A==null?void 0:A.autoScrollEnabled)===!1,wt=typeof l=="object"?l.enabled===!1:l===!1,Yn=w&&!Xt&&!wt;return typeof l=="object"?{...l,enabled:Yn}:{enabled:Yn}}}),VDe=k.createContext(null),lO="button",jDe="Droppable";function fGe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=P2(jDe),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=k.useContext(Qm),{role:h=lO,roleDescription:p="draggable",tabIndex:g=0}=i??{},_=(l==null?void 0:l.id)===t,b=k.useContext(_?I2:VDe),[y,m]=mb(),[v,S]=mb(),w=kDe(a,t),C=Xg(n);Ea(()=>(d.set(t,{id:t,key:o,node:y,activatorNode:v,data:C}),()=>{const P=d.get(t);P&&P.key===o&&d.delete(t)}),[d,t]);const x=k.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&h===lO?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,g,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:x,isDragging:_,listeners:r?void 0:w,node:y,over:f,setNodeRef:m,setActivatorNodeRef:S,transform:b}}function UDe(){return k.useContext(NH)}const GDe="Droppable",HDe={timeout:25};function hGe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=P2(GDe),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=k.useContext(Qm),c=k.useRef({disabled:n}),d=k.useRef(!1),f=k.useRef(null),h=k.useRef(null),{disabled:p,updateMeasurementsFor:g,timeout:_}={...HDe,...i},b=Xg(g??r),y=k.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},_)},[_]),m=k2({callback:y,disabled:p||!a}),v=k.useCallback((x,P)=>{m&&(P&&(m.unobserve(P),d.current=!1),x&&m.observe(x))},[m]),[S,w]=mb(v),C=Xg(t);return k.useEffect(()=>{!m||!S.current||(m.disconnect(),d.current=!1,m.observe(S.current))},[S,m]),Ea(()=>(s({type:kn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:C}}),()=>s({type:kn.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==c.current.disabled&&(s({type:kn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function qDe(e){let{animation:t,children:n}=e;const[r,i]=k.useState(null),[o,a]=k.useState(null),s=yb(n);return!n&&!r&&s&&i(s),Ea(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),J.createElement(J.Fragment,null,n,r?k.cloneElement(r,{ref:a}):null)}const WDe={x:0,y:0,scaleX:1,scaleY:1};function KDe(e){let{children:t}=e;return J.createElement(Qm.Provider,{value:$H},J.createElement(I2.Provider,{value:WDe},t))}const XDe={position:"fixed",touchAction:"none"},QDe=e=>BA(e)?"transform 250ms ease":void 0,YDe=k.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=QDe}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...XDe,width:s.width,height:s.height,top:s.top,left:s.left,transform:Yg.Transform.toString(d),transformOrigin:i&&r?jNe(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return J.createElement(n,{className:a,style:f,ref:t},o)}),ZDe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},JDe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Yg.Transform.toString(t)},{transform:Yg.Transform.toString(n)}]},eLe={duration:250,easing:"ease",keyframes:JDe,sideEffects:ZDe({styles:{active:{opacity:"0"}}})};function tLe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return A2((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=OH(a);if(!u)return;const{transform:c}=zr(a).getComputedStyle(a),d=bH(c);if(!d)return;const f=typeof t=="function"?t:nLe(t);return TH(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function nLe(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...eLe,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,g=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(g))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{b.onfinish=()=>{_==null||_(),y()}})}}let uO=0;function rLe(e){return k.useMemo(()=>{if(e!=null)return uO++,uO},[e])}const iLe=J.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:g,dragOverlay:_,over:b,measuringConfiguration:y,scrollableAncestors:m,scrollableAncestorRects:v,windowRect:S}=UDe(),w=k.useContext(I2),C=rLe(d==null?void 0:d.id),x=DH(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:b,overlayNodeRect:_.rect,scrollableAncestors:m,scrollableAncestorRects:v,transform:w,windowRect:S}),P=UA(f),E=tLe({config:r,draggableNodes:p,droppableContainers:g,measuringConfiguration:y}),I=P?_.setRef:void 0;return J.createElement(KDe,null,J.createElement(qDe,{animation:E},d&&C?J.createElement(YDe,{key:C,id:d.id,ref:I,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:P,style:{zIndex:u,...i},transform:x},n):null))}),oLe=qn([IA,TA],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),aLe=()=>{const e=C2(oLe);return k.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=Qg(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},sLe=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return QNe({...e,droppableContainers:n})};function lLe(e){return oe.jsx(zDe,{...e})}const Ty=28,cO={w:Ty,h:Ty,maxW:Ty,maxH:Ty,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},uLe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return oe.jsx(ob,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:oe.jsx($U,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return oe.jsx(ob,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:oe.jsx(aA,{sx:{...cO},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?oe.jsxs(sA,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...cO},children:[oe.jsx(A3,{children:e.dragData.payload.imageDTOs.length}),oe.jsx(A3,{size:"sm",children:"Images"})]}):null},cLe=k.memo(uLe),dLe=e=>{const[t,n]=k.useState(null),r=se("images"),i=w2(),o=k.useCallback(d=>{r.trace({dragData:pt(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=k.useCallback(d=>{var h;r.trace({dragData:pt(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(LG({overData:f,activeData:t})),n(null))},[t,i,r]),s=JR(IH,{activationConstraint:{distance:10}}),l=JR(MH,{activationConstraint:{distance:10}}),u=zNe(s,l),c=aLe();return oe.jsxs(lLe,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:sLe,autoScroll:!1,children:[e.children,oe.jsx(iLe,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:oe.jsx(CU,{children:t&&oe.jsx(xU.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:oe.jsx(cLe,{dragData:t})},"overlay-drag-image")})})]})},fLe=k.memo(dLe),dO=Pa(void 0),fO=Pa(void 0),hLe=k.lazy(()=>k$(()=>import("./App-6440ab3b.js"),["./App-6440ab3b.js","./MantineProvider-a6a1d85c.js","./App-6125620a.css"],import.meta.url)),pLe=k.lazy(()=>k$(()=>import("./ThemeLocaleProvider-9d17ef9a.js"),["./ThemeLocaleProvider-9d17ef9a.js","./MantineProvider-a6a1d85c.js","./ThemeLocaleProvider-f5f9aabf.css"],import.meta.url)),gLe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(k.useEffect(()=>(t&&yg.set(t),e&&vg.set(e),o&&x1.set(o),a&&Dn.set(a),Wz(),i&&i.length>0?Z5(qR(),...i):Z5(qR()),()=>{vg.set(void 0),yg.set(void 0),x1.set(void 0),Dn.set(CL)}),[e,t,i,o,a]),k.useEffect(()=>(l&&dO.set(l),()=>{dO.set(void 0)}),[l]),k.useEffect(()=>(r&&fO.set(r),()=>{fO.set(void 0)}),[r]),oe.jsx(J.StrictMode,{children:oe.jsx(tle,{store:KG,children:oe.jsx(J.Suspense,{fallback:oe.jsx(fNe,{}),children:oe.jsx(pLe,{children:oe.jsx(fLe,{children:oe.jsx(hLe,{config:n,selectedImage:s})})})})})})),mLe=k.memo(gLe);aC.createRoot(document.getElementById("root")).render(oe.jsx(mLe,{}));export{G1 as $,So as A,Sme as B,ii as C,vl as D,Yo as E,dVe as F,hT as G,Ii as H,oe as I,zm as J,Mm as K,lr as L,Kl as M,N3e as N,CUe as O,Cme as P,SUe as Q,J as R,eg as S,CU as T,xU as U,h3e as V,Rm as W,rA as X,$m as Y,xUe as Z,wUe as _,SN as a,Nze as a$,k9 as a0,vbe as a1,EUe as a2,ua as a3,Bl as a4,b1 as a5,tX as a6,JV as a7,PUe as a8,v3e as a9,jze as aA,ibe as aB,ET as aC,lV as aD,abe as aE,mi as aF,nP as aG,fS as aH,w2 as aI,Zje as aJ,Cze as aK,Gze as aL,Hze as aM,_ze as aN,vze as aO,$U as aP,Gc as aQ,w6e as aR,VU as aS,Uje as aT,Sze as aU,XE as aV,kA as aW,hUe as aX,aA as aY,cNe as aZ,de as a_,ya as aa,gV as ab,dS as ac,FTe as ad,MU as ae,TUe as af,ke as ag,_Ue as ah,AUe as ai,qn as aj,IA as ak,SE as al,C2 as am,Mze as an,Tm as ao,fF as ap,FF as aq,J_ as ar,se as as,ob as at,sA as au,A3 as av,TA as aw,Vm as ax,p$e as ay,VG as az,Kb as b,QRe as b$,Uze as b0,uBe as b1,zie as b2,KE as b3,it as b4,jLe as b5,sUe as b6,qje as b7,pUe as b8,fUe as b9,X as bA,eVe as bB,iVe as bC,Eze as bD,Tze as bE,Fze as bF,M1 as bG,Pze as bH,al as bI,b0 as bJ,rVe as bK,tVe as bL,nVe as bM,vLe as bN,NLe as bO,DLe as bP,LLe as bQ,FLe as bR,uae as bS,hFe as bT,Oje as bU,$je as bV,ULe as bW,_Fe as bX,zLe as bY,lFe as bZ,qLe as b_,e1e as ba,Hje as bb,Kje as bc,bve as bd,_ve as be,iUe as bf,aUe as bg,Wje as bh,uUe as bi,Xje as bj,Gje as bk,Ize as bl,RUe as bm,pq as bn,SLe as bo,bLe as bp,_Le as bq,He as br,kze as bs,Yze as bt,Qze as bu,Aze as bv,oVe as bw,hGe as bx,fGe as by,yl as bz,JQ as c,Dze as c$,VLe as c0,pFe as c1,KLe as c2,xL as c3,BLe as c4,EFe as c5,GLe as c6,E6 as c7,HLe as c8,T6 as c9,_8 as cA,Lje as cB,Fje as cC,Bje as cD,tFe as cE,zje as cF,nFe as cG,Vje as cH,rFe as cI,jje as cJ,uVe as cK,yg as cL,D6e as cM,Bze as cN,Iu as cO,Do as cP,Dfe as cQ,ge as cR,dO as cS,Zze as cT,Jze as cU,Ble as cV,v1e as cW,qz as cX,lF as cY,bze as cZ,DG as c_,JLe as ca,cFe as cb,iFe as cc,DFe as cd,LFe as ce,eFe as cf,FFe as cg,HUe as ch,XLe as ci,ER as cj,cVe as ck,jUe as cl,QLe as cm,TR as cn,Su as co,Tie as cp,Die as cq,GUe as cr,PR as cs,Aie as ct,UUe as cu,ZLe as cv,AR as cw,Pie as cx,XRe as cy,WLe as cz,Bne as d,qVe as d$,bg as d0,JF as d1,bUe as d2,Lze as d3,$0 as d4,M5 as d5,hBe as d6,aBe as d7,ZFe as d8,JFe as d9,yVe as dA,Oze as dB,Rze as dC,_Ve as dD,wE as dE,VVe as dF,pVe as dG,NVe as dH,DVe as dI,Zoe as dJ,LVe as dK,RLe as dL,FVe as dM,aS as dN,Yoe as dO,jVe as dP,Sm as dQ,nGe as dR,vs as dS,VUe as dT,sGe as dU,zUe as dV,UVe as dW,GVe as dX,lGe as dY,HVe as dZ,aGe as d_,iBe as da,on as db,pT as dc,ps as dd,Aa as de,gi as df,rBe as dg,oFe as dh,CA as di,oBe as dj,dUe as dk,_E as dl,ije as dm,$ze as dn,rje as dp,dGe as dq,Aje as dr,wje as ds,Cje as dt,Ije as du,Eje as dv,kje as dw,Pje as dx,IRe as dy,YVe as dz,xD as e,zFe as e$,WVe as e0,_L as e1,WUe as e2,KVe as e3,Joe as e4,BVe as e5,eae as e6,zVe as e7,$Ve as e8,Tje as e9,O6e as eA,R6e as eB,PLe as eC,kLe as eD,s_ as eE,ILe as eF,Bie as eG,MLe as eH,TLe as eI,ELe as eJ,OE as eK,Nie as eL,Mie as eM,Rie as eN,kie as eO,Iie as eP,Oie as eQ,$ie as eR,wLe as eS,qUe as eT,Nje as eU,$E as eV,gve as eW,O7e as eX,LUe as eY,VFe as eZ,cae as e_,Od as ea,$f as eb,dFe as ec,jle as ed,Ule as ee,xze as ef,sVe as eg,lVe as eh,tB as ei,aVe as ej,r_ as ek,BFe as el,OFe as em,$Fe as en,NFe as eo,Gie as ep,di as eq,S6 as er,ALe as es,Kze as et,qze as eu,Wze as ev,Hl as ew,Z6 as ex,Fie as ey,x6 as ez,kN as f,xz as f$,Rr as f0,uFe as f1,xFe as f2,Hie as f3,hp as f4,CFe as f5,Dje as f6,yFe as f7,vFe as f8,bFe as f9,Yje as fA,QUe as fB,oGe as fC,rGe as fD,Qje as fE,JUe as fF,ZUe as fG,KUe as fH,tGe as fI,$Le as fJ,XUe as fK,eGe as fL,OLe as fM,sz as fN,gVe as fO,f$e as fP,ZVe as fQ,wVe as fR,CVe as fS,mye as fT,y8 as fU,zB as fV,km as fW,fVe as fX,wu as fY,eje as fZ,cUe as f_,gFe as fa,mFe as fb,lae as fc,PFe as fd,AFe as fe,MBe as ff,KFe as fg,pze as fh,RBe as fi,MFe as fj,RFe as fk,IFe as fl,DE as fm,sBe as fn,Rje as fo,uGe as fp,e$e as fq,tUe as fr,ce as fs,Qe as ft,Lt as fu,pa as fv,YLe as fw,BUe as fx,iGe as fy,YUe as fz,LN as g,lze as g$,YL as g0,Gh as g1,bVe as g2,mVe as g3,JVe as g4,tje as g5,lje as g6,hVe as g7,nje as g8,V1 as g9,FUe as gA,wR as gB,pt as gC,cve as gD,Ig as gE,Rl as gF,Sje as gG,mje as gH,_je as gI,yje as gJ,pje as gK,oje as gL,bje as gM,_z as gN,vUe as gO,gUe as gP,mUe as gQ,yUe as gR,pBe as gS,nBe as gT,cBe as gU,fBe as gV,xu as gW,GU as gX,Dq as gY,Ge as gZ,UBe as g_,Pe as ga,a$e as gb,dve as gc,q0 as gd,vVe as ge,uje as gf,aje as gg,MVe as gh,PVe as gi,AVe as gj,TVe as gk,RVe as gl,sje as gm,fje as gn,dje as go,xje as gp,n$e as gq,kVe as gr,IVe as gs,Mje as gt,hje as gu,cje as gv,gje as gw,cye as gx,hb as gy,b1e as gz,t_ as h,hze as h$,sze as h0,ABe as h1,ZBe as h2,cze as h3,$6e as h4,_Be as h5,FBe as h6,Ah as h7,NBe as h8,SBe as h9,kBe as hA,GBe as hB,jBe as hC,BBe as hD,HFe as hE,qFe as hF,yze as hG,$Ue as hH,OUe as hI,HBe as hJ,A6e as hK,YBe as hL,qBe as hM,TBe as hN,bBe as hO,ize as hP,rze as hQ,XBe as hR,WBe as hS,KBe as hT,gze as hU,tze as hV,mze as hW,mBe as hX,gBe as hY,$Be as hZ,OBe as h_,ES as ha,LBe as hb,yBe as hc,DBe as hd,vBe as he,wBe as hf,GFe as hg,UFe as hh,jFe as hi,uze as hj,Dre as hk,_a as hl,wL as hm,pae as hn,XFe as ho,QFe as hp,YFe as hq,aze as hr,EBe as hs,CBe as ht,kle as hu,oze as hv,M6e as hw,Ile as hx,wA as hy,ZMe as hz,One as i,I6e as i0,T6e as i1,P6e as i2,k6e as i3,WFe as i4,PBe as i5,DUe as i6,gPe as i7,Jje as i8,eUe as i9,Qre as ia,P1e as ib,cGe as ic,fO as id,hV as ie,AT as ig,ca as ih,n3e as ii,I3e as ij,kUe as ik,xbe as il,MUe as im,pPe as io,_6e as ip,S6e as iq,mbe as ir,Tn as j,hee as k,e_ as l,Of as m,ym as n,ri as o,Yb as p,lE as q,AN as r,pE as s,bm as t,gD as u,k as v,to as w,fn as x,Fd as y,Kn as z}; diff --git a/invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-1c3007b8.woff2 b/invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-1c3007b8.woff2 new file mode 100644 index 0000000000..a61a0be57f Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-1c3007b8.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-848492d3.woff2 b/invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-848492d3.woff2 deleted file mode 100644 index f6aa99881c..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-cyrillic-ext-wght-normal-848492d3.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-262a1054.woff2 b/invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-262a1054.woff2 deleted file mode 100644 index 8744543787..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-262a1054.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-eba94878.woff2 b/invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-eba94878.woff2 new file mode 100644 index 0000000000..b655a43884 Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-cyrillic-wght-normal-eba94878.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-81f77e51.woff2 b/invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-81f77e51.woff2 new file mode 100644 index 0000000000..9117b5b040 Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-81f77e51.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-fe977ddb.woff2 b/invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-fe977ddb.woff2 deleted file mode 100644 index 28a2d3a4c9..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-greek-ext-wght-normal-fe977ddb.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/assets/inter-greek-wght-normal-89b4a3fe.woff2 b/invokeai/frontend/web/dist/assets/inter-greek-wght-normal-89b4a3fe.woff2 deleted file mode 100644 index 53f099f8ca..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-greek-wght-normal-89b4a3fe.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/assets/inter-greek-wght-normal-d92c6cbc.woff2 b/invokeai/frontend/web/dist/assets/inter-greek-wght-normal-d92c6cbc.woff2 new file mode 100644 index 0000000000..eb38b38ea0 Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-greek-wght-normal-d92c6cbc.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-latin-ext-wght-normal-45606f83.woff2 b/invokeai/frontend/web/dist/assets/inter-latin-ext-wght-normal-45606f83.woff2 deleted file mode 100644 index 80b17cbf1d..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-latin-ext-wght-normal-45606f83.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/assets/inter-latin-ext-wght-normal-a2bfd9fe.woff2 b/invokeai/frontend/web/dist/assets/inter-latin-ext-wght-normal-a2bfd9fe.woff2 new file mode 100644 index 0000000000..3df865d7f0 Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-latin-ext-wght-normal-a2bfd9fe.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-latin-wght-normal-450f3ba4.woff2 b/invokeai/frontend/web/dist/assets/inter-latin-wght-normal-450f3ba4.woff2 deleted file mode 100644 index fff3df969e..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-latin-wght-normal-450f3ba4.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/assets/inter-latin-wght-normal-88df0b5a.woff2 b/invokeai/frontend/web/dist/assets/inter-latin-wght-normal-88df0b5a.woff2 new file mode 100644 index 0000000000..40255432a3 Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-latin-wght-normal-88df0b5a.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-vietnamese-wght-normal-15df7612.woff2 b/invokeai/frontend/web/dist/assets/inter-vietnamese-wght-normal-15df7612.woff2 new file mode 100644 index 0000000000..ce21ca172e Binary files /dev/null and b/invokeai/frontend/web/dist/assets/inter-vietnamese-wght-normal-15df7612.woff2 differ diff --git a/invokeai/frontend/web/dist/assets/inter-vietnamese-wght-normal-ac4e131c.woff2 b/invokeai/frontend/web/dist/assets/inter-vietnamese-wght-normal-ac4e131c.woff2 deleted file mode 100644 index 7ee67fb2b3..0000000000 Binary files a/invokeai/frontend/web/dist/assets/inter-vietnamese-wght-normal-ac4e131c.woff2 and /dev/null differ diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index 12d7e00489..e1ee3e4716 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -15,7 +15,7 @@ margin: 0; } - + diff --git a/invokeai/frontend/web/dist/locales/de.json b/invokeai/frontend/web/dist/locales/de.json index 4f91f84b35..ee5b4f10d3 100644 --- a/invokeai/frontend/web/dist/locales/de.json +++ b/invokeai/frontend/web/dist/locales/de.json @@ -113,7 +113,14 @@ "images": "Bilder", "copy": "Kopieren", "download": "Runterladen", - "setCurrentImage": "Setze aktuelle Bild" + "setCurrentImage": "Setze aktuelle Bild", + "featuresWillReset": "Wenn Sie dieses Bild löschen, werden diese Funktionen sofort zurückgesetzt.", + "deleteImageBin": "Gelöschte Bilder werden an den Papierkorb Ihres Betriebssystems gesendet.", + "unableToLoad": "Galerie kann nicht geladen werden", + "downloadSelection": "Auswahl herunterladen", + "currentlyInUse": "Dieses Bild wird derzeit in den folgenden Funktionen verwendet:", + "deleteImagePermanent": "Gelöschte Bilder können nicht wiederhergestellt werden.", + "autoAssignBoardOnClick": "Board per Klick automatisch zuweisen" }, "hotkeys": { "keyboardShortcuts": "Tastenkürzel", @@ -323,7 +330,8 @@ }, "nodesHotkeys": "Knoten Tastenkürzel", "addNodes": { - "title": "Knotenpunkt hinzufügen" + "title": "Knotenpunkt hinzufügen", + "desc": "Öffnet das Menü zum Hinzufügen von Knoten" } }, "modelManager": { @@ -429,7 +437,43 @@ "customConfigFileLocation": "Benutzerdefinierte Konfiguration Datei Speicherort", "baseModel": "Basis Modell", "convertToDiffusers": "Konvertiere zu Diffusers", - "diffusersModels": "Diffusers" + "diffusersModels": "Diffusers", + "noCustomLocationProvided": "Kein benutzerdefinierter Standort angegeben", + "onnxModels": "Onnx", + "vaeRepoID": "VAE-Repo-ID", + "weightedSum": "Gewichtete Summe", + "syncModelsDesc": "Wenn Ihre Modelle nicht mit dem Backend synchronisiert sind, können Sie sie mit dieser Option aktualisieren. Dies ist im Allgemeinen praktisch, wenn Sie Ihre models.yaml-Datei manuell aktualisieren oder Modelle zum InvokeAI-Stammordner hinzufügen, nachdem die Anwendung gestartet wurde.", + "vae": "VAE", + "noModels": "Keine Modelle gefunden", + "statusConverting": "Konvertieren", + "sigmoid": "Sigmoid", + "predictionType": "Vorhersagetyp (für Stable Diffusion 2.x-Modelle und gelegentliche Stable Diffusion 1.x-Modelle)", + "selectModel": "Wählen Sie Modell aus", + "repo_id": "Repo-ID", + "modelSyncFailed": "Modellsynchronisierung fehlgeschlagen", + "quickAdd": "Schnell hinzufügen", + "simpleModelDesc": "Geben Sie einen Pfad zu einem lokalen Diffusers-Modell, einem lokalen Checkpoint-/Safetensors-Modell, einer HuggingFace-Repo-ID oder einer Checkpoint-/Diffusers-Modell-URL an.", + "modelDeleted": "Modell gelöscht", + "inpainting": "v1 Ausmalen", + "modelUpdateFailed": "Modellaktualisierung fehlgeschlagen", + "useCustomConfig": "Benutzerdefinierte Konfiguration verwenden", + "settings": "Einstellungen", + "modelConversionFailed": "Modellkonvertierung fehlgeschlagen", + "syncModels": "Modelle synchronisieren", + "mergedModelSaveLocation": "Speicherort", + "modelType": "Modelltyp", + "modelsMerged": "Modelle zusammengeführt", + "modelsMergeFailed": "Modellzusammenführung fehlgeschlagen", + "convertToDiffusersHelpText1": "Dieses Modell wird in das 🧨 Diffusers-Format konvertiert.", + "modelsSynced": "Modelle synchronisiert", + "vaePrecision": "VAE-Präzision", + "mergeModels": "Modelle zusammenführen", + "interpolationType": "Interpolationstyp", + "oliveModels": "Olives", + "variant": "Variante", + "loraModels": "LoRAs", + "modelDeleteFailed": "Modell konnte nicht gelöscht werden", + "mergedModelName": "Zusammengeführter Modellname" }, "parameters": { "images": "Bilder", @@ -716,7 +760,33 @@ "saveControlImage": "Speichere Referenz Bild", "safe": "Speichern", "ipAdapterImageFallback": "Kein IP Adapter Bild ausgewählt", - "resetIPAdapterImage": "Zurücksetzen vom IP Adapter Bild" + "resetIPAdapterImage": "Zurücksetzen vom IP Adapter Bild", + "pidi": "PIDI", + "normalBae": "Normales BAE", + "mlsdDescription": "Minimalistischer Liniensegmentdetektor", + "openPoseDescription": "Schätzung der menschlichen Pose mit Openpose", + "control": "Kontrolle", + "coarse": "Coarse", + "crop": "Zuschneiden", + "pidiDescription": "PIDI-Bildverarbeitung", + "mediapipeFace": "Mediapipe Gesichter", + "mlsd": "M-LSD", + "controlMode": "Steuermodus", + "cannyDescription": "Canny Ecken Erkennung", + "lineart": "Lineart", + "lineartAnimeDescription": "Lineart-Verarbeitung im Anime-Stil", + "minConfidence": "Minimales Vertrauen", + "megaControl": "Mega-Kontrolle", + "autoConfigure": "Prozessor automatisch konfigurieren", + "normalBaeDescription": "Normale BAE-Verarbeitung", + "noneDescription": "Es wurde keine Verarbeitung angewendet", + "openPose": "Openpose", + "lineartAnime": "Lineart Anime", + "mediapipeFaceDescription": "Gesichtserkennung mit Mediapipe", + "canny": "Canny", + "hedDescription": "Ganzheitlich verschachtelte Kantenerkennung", + "scribble": "Scribble", + "maxFaces": "Maximal Anzahl Gesichter" }, "queue": { "status": "Status", @@ -758,7 +828,19 @@ "enqueueing": "Stapel in der Warteschlange", "queueMaxExceeded": "Maximum von {{max_queue_size}} Elementen erreicht, würde {{skip}} Elemente überspringen", "cancelBatchFailed": "Problem beim Abbruch vom Stapel", - "clearQueueAlertDialog2": "bist du sicher die Warteschlange zu leeren?" + "clearQueueAlertDialog2": "bist du sicher die Warteschlange zu leeren?", + "pruneSucceeded": "{{item_count}} abgeschlossene Elemente aus der Warteschlange entfernt", + "pauseSucceeded": "Prozessor angehalten", + "cancelFailed": "Problem beim Stornieren des Auftrags", + "pauseFailed": "Problem beim Anhalten des Prozessors", + "front": "Vorne", + "pruneTooltip": "Bereinigen Sie {{item_count}} abgeschlossene Aufträge", + "resumeFailed": "Problem beim wieder aufnehmen von Prozessor", + "pruneFailed": "Problem beim leeren der Warteschlange", + "pauseTooltip": "Pause von Prozessor", + "back": "Hinten", + "resumeSucceeded": "Prozessor wieder aufgenommen", + "resumeTooltip": "Prozessor wieder aufnehmen" }, "metadata": { "negativePrompt": "Negativ Beschreibung", @@ -773,7 +855,20 @@ "noMetaData": "Keine Meta-Data gefunden", "width": "Breite", "createdBy": "Erstellt von", - "steps": "Schritte" + "steps": "Schritte", + "seamless": "Nahtlos", + "positivePrompt": "Positiver Prompt", + "generationMode": "Generierungsmodus", + "Threshold": "Noise Schwelle", + "seed": "Samen", + "perlin": "Perlin Noise", + "hiresFix": "Optimierung für hohe Auflösungen", + "initImage": "Erstes Bild", + "variations": "Samengewichtspaare", + "vae": "VAE", + "workflow": "Arbeitsablauf", + "scheduler": "Scheduler", + "noRecallParameters": "Es wurden keine Parameter zum Abrufen gefunden" }, "popovers": { "noiseUseCPU": { @@ -811,11 +906,68 @@ "misses": "Cache Nötig", "hits": "Cache Treffer", "enable": "Aktivieren", - "clear": "Leeren" + "clear": "Leeren", + "maxCacheSize": "Maximale Cache Größe", + "cacheSize": "Cache Größe" }, "embedding": { "noMatchingEmbedding": "Keine passenden Embeddings", "addEmbedding": "Embedding hinzufügen", "incompatibleModel": "Inkompatibles Basismodell:" + }, + "nodes": { + "booleanPolymorphicDescription": "Eine Sammlung boolescher Werte.", + "colorFieldDescription": "Eine RGBA-Farbe.", + "conditioningCollection": "Konditionierungssammlung", + "addNode": "Knoten hinzufügen", + "conditioningCollectionDescription": "Konditionierung kann zwischen Knoten weitergegeben werden.", + "colorPolymorphic": "Farbpolymorph", + "colorCodeEdgesHelp": "Farbkodieren Sie Kanten entsprechend ihren verbundenen Feldern", + "animatedEdges": "Animierte Kanten", + "booleanCollectionDescription": "Eine Sammlung boolescher Werte.", + "colorField": "Farbe", + "collectionItem": "Objekt in Sammlung", + "animatedEdgesHelp": "Animieren Sie ausgewählte Kanten und Kanten, die mit ausgewählten Knoten verbunden sind", + "cannotDuplicateConnection": "Es können keine doppelten Verbindungen erstellt werden", + "booleanPolymorphic": "Boolesche Polymorphie", + "colorPolymorphicDescription": "Eine Sammlung von Farben.", + "clipFieldDescription": "Tokenizer- und text_encoder-Untermodelle.", + "clipField": "Clip", + "colorCollection": "Eine Sammlung von Farben.", + "boolean": "Boolesche Werte", + "currentImage": "Aktuelles Bild", + "booleanDescription": "Boolesche Werte sind wahr oder falsch.", + "collection": "Sammlung", + "cannotConnectInputToInput": "Eingang kann nicht mit Eingang verbunden werden", + "conditioningField": "Konditionierung", + "cannotConnectOutputToOutput": "Ausgang kann nicht mit Ausgang verbunden werden", + "booleanCollection": "Boolesche Werte Sammlung", + "cannotConnectToSelf": "Es kann keine Verbindung zu sich selbst hergestellt werden", + "colorCodeEdges": "Farbkodierte Kanten", + "addNodeToolTip": "Knoten hinzufügen (Umschalt+A, Leertaste)" + }, + "hrf": { + "enableHrf": "Aktivieren Sie die Korrektur für hohe Auflösungen", + "upscaleMethod": "Vergrößerungsmethoden", + "enableHrfTooltip": "Generieren Sie mit einer niedrigeren Anfangsauflösung, skalieren Sie auf die Basisauflösung hoch und führen Sie dann Image-to-Image aus.", + "metadata": { + "strength": "Hochauflösender Fix Stärke", + "enabled": "Hochauflösender Fix aktiviert", + "method": "Hochauflösender Fix Methode" + }, + "hrf": "Hochauflösender Fix", + "hrfStrength": "Hochauflösende Fix Stärke", + "strengthTooltip": "Niedrigere Werte führen zu weniger Details, wodurch potenzielle Artefakte reduziert werden können." + }, + "models": { + "noMatchingModels": "Keine passenden Modelle", + "loading": "lade", + "noMatchingLoRAs": "Keine passenden LoRAs", + "noLoRAsAvailable": "Keine LoRAs verfügbar", + "noModelsAvailable": "Keine Modelle verfügbar", + "selectModel": "Wählen ein Modell aus", + "noRefinerModelsInstalled": "Keine SDXL Refiner-Modelle installiert", + "noLoRAsInstalled": "Keine LoRAs installiert", + "selectLoRA": "Wählen ein LoRA aus" } } diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index 561b577a46..e3dd84bf5c 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -6,6 +6,7 @@ "flipVertically": "Flip Vertically", "invokeProgressBar": "Invoke progress bar", "menu": "Menu", + "mode": "Mode", "modelSelect": "Model Select", "modifyConfig": "Modify Config", "nextImage": "Next Image", @@ -30,6 +31,10 @@ "cancel": "Cancel", "changeBoard": "Change Board", "clearSearch": "Clear Search", + "deleteBoard": "Delete Board", + "deleteBoardAndImages": "Delete Board and Images", + "deleteBoardOnly": "Delete Board Only", + "deletedBoardsCannotbeRestored": "Deleted boards cannot be restored", "loading": "Loading...", "menuItemAutoAdd": "Auto-add to this Board", "move": "Move", @@ -51,9 +56,12 @@ "cancel": "Cancel", "close": "Close", "on": "On", + "checkpoint": "Checkpoint", "communityLabel": "Community", "controlNet": "ControlNet", "controlAdapter": "Control Adapter", + "data": "Data", + "details": "Details", "ipAdapter": "IP Adapter", "t2iAdapter": "T2I Adapter", "darkMode": "Dark Mode", @@ -65,6 +73,7 @@ "imagePrompt": "Image Prompt", "imageFailedToLoad": "Unable to Load Image", "img2img": "Image To Image", + "inpaint": "inpaint", "langArabic": "العربية", "langBrPortuguese": "Português do Brasil", "langDutch": "Nederlands", @@ -93,6 +102,8 @@ "nodes": "Workflow Editor", "nodesDesc": "A node based system for the generation of images is under development currently. Stay tuned for updates about this amazing feature.", "openInNewTab": "Open in New Tab", + "outpaint": "outpaint", + "outputs": "Outputs", "postProcessDesc1": "Invoke AI offers a wide variety of post processing features. Image Upscaling and Face Restoration are already available in the WebUI. You can access them from the Advanced Options menu of the Text To Image and Image To Image tabs. You can also process images directly, using the image action buttons above the current image display or in the viewer.", "postProcessDesc2": "A dedicated UI will be released soon to facilitate more advanced post processing workflows.", "postProcessDesc3": "The Invoke AI Command Line Interface offers various other features including Embiggen.", @@ -100,7 +111,9 @@ "postProcessing": "Post Processing", "random": "Random", "reportBugLabel": "Report Bug", + "safetensors": "Safetensors", "settingsLabel": "Settings", + "simple": "Simple", "statusConnected": "Connected", "statusConvertingModel": "Converting Model", "statusDisconnected": "Disconnected", @@ -127,6 +140,7 @@ "statusSavingImage": "Saving Image", "statusUpscaling": "Upscaling", "statusUpscalingESRGAN": "Upscaling (ESRGAN)", + "template": "Template", "training": "Training", "trainingDesc1": "A dedicated workflow for training your own embeddings and checkpoints using Textual Inversion and Dreambooth from the web interface.", "trainingDesc2": "InvokeAI already supports training custom embeddourings using Textual Inversion using the main script.", @@ -214,6 +228,7 @@ "setControlImageDimensions": "Set Control Image Dimensions To W/H", "showAdvanced": "Show Advanced", "toggleControlNet": "Toggle this ControlNet", + "unstarImage": "Unstar Image", "w": "W", "weight": "Weight", "enableIPAdapter": "Enable IP Adapter", @@ -279,6 +294,7 @@ "next": "Next", "status": "Status", "total": "Total", + "time": "Time", "pending": "Pending", "in_progress": "In Progress", "completed": "Completed", @@ -286,6 +302,7 @@ "canceled": "Canceled", "completedIn": "Completed in", "batch": "Batch", + "batchFieldValues": "Batch Field Values", "item": "Item", "session": "Session", "batchValues": "Batch Values", @@ -335,6 +352,7 @@ "loading": "Loading", "loadMore": "Load More", "maintainAspectRatio": "Maintain Aspect Ratio", + "noImageSelected": "No Image Selected", "noImagesInGallery": "No Images to Display", "setCurrentImage": "Set as Current Image", "showGenerations": "Show Generations", @@ -583,7 +601,7 @@ "strength": "Image to image strength", "Threshold": "Noise Threshold", "variations": "Seed-weight pairs", - "vae": "VAE", + "vae": "VAE", "width": "Width", "workflow": "Workflow" }, @@ -606,6 +624,7 @@ "cannotUseSpaces": "Cannot Use Spaces", "checkpointFolder": "Checkpoint Folder", "checkpointModels": "Checkpoints", + "checkpointOrSafetensors": "$t(common.checkpoint) / $t(common.safetensors)", "clearCheckpointFolder": "Clear Checkpoint Folder", "closeAdvanced": "Close Advanced", "config": "Config", @@ -685,6 +704,7 @@ "nameValidationMsg": "Enter a name for your model", "noCustomLocationProvided": "No Custom Location Provided", "noModels": "No Models Found", + "noModelSelected": "No Model Selected", "noModelsFound": "No Models Found", "none": "none", "notLoaded": "not loaded", @@ -730,6 +750,8 @@ "widthValidationMsg": "Default width of your model." }, "models": { + "addLora": "Add LoRA", + "esrganModel": "ESRGAN Model", "loading": "loading", "noLoRAsAvailable": "No LoRAs available", "noMatchingLoRAs": "No matching LoRAs", @@ -1010,6 +1032,7 @@ "maskAdjustmentsHeader": "Mask Adjustments", "maskBlur": "Blur", "maskBlurMethod": "Blur Method", + "maskEdge": "Mask Edge", "negativePromptPlaceholder": "Negative Prompt", "noiseSettings": "Noise", "noiseThreshold": "Noise Threshold", @@ -1057,6 +1080,7 @@ "upscale": "Upscale (Shift + U)", "upscaleImage": "Upscale Image", "upscaling": "Upscaling", + "unmasked": "Unmasked", "useAll": "Use All", "useCpuNoise": "Use CPU Noise", "cpuNoise": "CPU Noise", @@ -1078,6 +1102,7 @@ "dynamicPrompts": "Dynamic Prompts", "enableDynamicPrompts": "Enable Dynamic Prompts", "maxPrompts": "Max Prompts", + "promptsPreview": "Prompts Preview", "promptsWithCount_one": "{{count}} Prompt", "promptsWithCount_other": "{{count}} Prompts", "seedBehaviour": { @@ -1117,7 +1142,10 @@ "displayHelpIcons": "Display Help Icons", "displayInProgress": "Display Progress Images", "enableImageDebugging": "Enable Image Debugging", + "enableInformationalPopovers": "Enable Informational Popovers", + "enableInvisibleWatermark": "Enable Invisible Watermark", "enableNodesEditor": "Enable Nodes Editor", + "enableNSFWChecker": "Enable NSFW Checker", "experimental": "Experimental", "favoriteSchedulers": "Favorite Schedulers", "favoriteSchedulersPlaceholder": "No schedulers favorited", @@ -1217,7 +1245,8 @@ "sentToImageToImage": "Sent To Image To Image", "sentToUnifiedCanvas": "Sent to Unified Canvas", "serverError": "Server Error", - "setCanvasInitialImage": "Set as canvas initial image", + "setAsCanvasInitialImage": "Set as canvas initial image", + "setCanvasInitialImage": "Set canvas initial image", "setControlImage": "Set as control image", "setIPAdapterImage": "Set as IP Adapter Image", "setInitialImage": "Set as initial image", @@ -1275,11 +1304,15 @@ }, "compositingBlur": { "heading": "Blur", - "paragraphs": ["The blur radius of the mask."] + "paragraphs": [ + "The blur radius of the mask." + ] }, "compositingBlurMethod": { "heading": "Blur Method", - "paragraphs": ["The method of blur applied to the masked area."] + "paragraphs": [ + "The method of blur applied to the masked area." + ] }, "compositingCoherencePass": { "heading": "Coherence Pass", @@ -1289,7 +1322,9 @@ }, "compositingCoherenceMode": { "heading": "Mode", - "paragraphs": ["The mode of the Coherence Pass."] + "paragraphs": [ + "The mode of the Coherence Pass." + ] }, "compositingCoherenceSteps": { "heading": "Steps", @@ -1307,7 +1342,9 @@ }, "compositingMaskAdjustments": { "heading": "Mask Adjustments", - "paragraphs": ["Adjust the mask."] + "paragraphs": [ + "Adjust the mask." + ] }, "controlNetBeginEnd": { "heading": "Begin / End Step Percentage", @@ -1365,7 +1402,9 @@ }, "infillMethod": { "heading": "Infill Method", - "paragraphs": ["Method to infill the selected area."] + "paragraphs": [ + "Method to infill the selected area." + ] }, "lora": { "heading": "LoRA Weight", diff --git a/invokeai/version/invokeai_version.py b/invokeai/version/invokeai_version.py index 3174d39f08..76fe57287d 100644 --- a/invokeai/version/invokeai_version.py +++ b/invokeai/version/invokeai_version.py @@ -1 +1 @@ -__version__ = "3.4.0post1" +__version__ = "3.4.0post2"