InvokeAI/invokeai/frontend/web/dist/assets/App-fe9505fe.js
2023-12-29 13:16:23 +11:00

170 lines
989 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{a as Vc,b as uI,S as dI,c as fI,d as pI,e as R1,f as mI,i as A1,g as fR,h as hI,j as gI,k as pR,l as mx,m as mR,n as hx,o as hR,p as gR,r as i,R as B,q as gx,u as xm,s as vR,t as bR,v as xR,z as yR,P as CR,w as vx,x as wR,y as SR,A as kR,B as jR,C as _e,D as a,I as An,E as _R,F as IR,G as PR,H as Kt,J as je,K as et,L as gn,M as ze,N as zd,O as hr,Q as Mn,T as Xn,U as cn,V as va,W as ml,X as ut,Y as wo,Z as dc,_ as ba,$ as xa,a0 as Uh,a1 as bx,a2 as Bd,a3 as bn,a4 as Rw,a5 as ER,a6 as vI,a7 as T1,a8 as Hd,a9 as Uc,aa as MR,ab as bI,ac as xI,ad as yI,ae as Zo,af as OR,ag as fe,ah as pe,ai as H,aj as DR,ak as Aw,al as RR,am as AR,an as TR,ao as hl,ap as te,aq as NR,ar as lt,as as rn,at as W,au as Ie,av as $,aw as or,ax as tr,ay as CI,az as $R,aA as LR,aB as FR,aC as zR,aD as Jr,aE as xx,aF as ya,aG as zr,aH as Wd,aI as BR,aJ as HR,aK as Tw,aL as yx,aM as be,aN as Jo,aO as WR,aP as wI,aQ as SI,aR as Nw,aS as VR,aT as UR,aU as GR,aV as Ca,aW as Cx,aX as KR,aY as qR,aZ as wt,a_ as XR,a$ as QR,b0 as Ls,b1 as kI,b2 as jI,b3 as Gh,b4 as YR,b5 as $w,b6 as _I,b7 as ZR,b8 as JR,b9 as eA,ba as tA,bb as nA,bc as II,bd as rA,be as oA,bf as sA,bg as aA,bh as lA,bi as Yl,bj as iA,bk as Br,bl as cA,bm as uA,bn as dA,bo as Lw,bp as fA,bq as pA,br as Ya,bs as PI,bt as EI,bu as Kh,bv as wx,bw as Sx,bx as jo,by as MI,bz as mA,bA as Zl,bB as Ku,bC as Fw,bD as hA,bE as gA,bF as kx,bG as vA,bH as zw,bI as OI,bJ as bA,bK as xA,bL as Bw,bM as DI,bN as yA,bO as qh,bP as jx,bQ as _x,bR as Ix,bS as RI,bT as Xh,bU as AI,bV as CA,bW as Px,bX as bp,bY as xp,bZ as Tu,b_ as _v,b$ as nd,c0 as rd,c1 as od,c2 as sd,c3 as Hw,c4 as ym,c5 as Iv,c6 as Cm,c7 as Ww,c8 as wm,c9 as Vw,ca as N1,cb as Pv,cc as $1,cd as Uw,ce as nc,cf as Ev,cg as Sm,ch as Mv,ci as Za,cj as Ov,ck as Ja,cl as yp,cm as km,cn as Gw,co as L1,cp as jm,cq as Kw,cr as F1,cs as Vd,ct as TI,cu as wA,cv as qw,cw as Ex,cx as _m,cy as NI,cz as jr,cA as Nu,cB as Ti,cC as Mx,cD as $I,cE as Cp,cF as Ox,cG as SA,cH as LI,cI as Dv,cJ as Qh,cK as kA,cL as FI,cM as z1,cN as B1,cO as zI,cP as jA,cQ as H1,cR as _A,cS as W1,cT as IA,cU as V1,cV as PA,cW as EA,cX as Dx,cY as BI,cZ as Js,c_ as HI,c$ as ia,d0 as WI,d1 as MA,d2 as $u,d3 as Xw,d4 as OA,d5 as DA,d6 as Qw,d7 as Rx,d8 as VI,d9 as Ax,da as Tx,db as UI,dc as Jt,dd as RA,de as qn,df as AA,dg as Gc,dh as Yh,di as Nx,dj as GI,dk as KI,dl as TA,dm as NA,dn as $A,dp as Im,dq as qI,dr as $x,ds as XI,dt as LA,du as FA,dv as zA,dw as BA,dx as HA,dy as WA,dz as VA,dA as Yw,dB as Lx,dC as UA,dD as GA,dE as KA,dF as qA,dG as Zh,dH as XA,dI as QA,dJ as YA,dK as ZA,dL as JA,dM as xn,dN as eT,dO as tT,dP as nT,dQ as rT,dR as oT,dS as sT,dT as aT,dU as lT,dV as vd,dW as Zw,dX as as,dY as QI,dZ as iT,d_ as Fx,d$ as cT,e0 as Jw,e1 as uT,e2 as dT,e3 as fT,e4 as pT,e5 as mT,e6 as YI,e7 as hT,e8 as gT,e9 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 DT,ep as RT,eq as AT,er as TT,es as NT,et as $T,eu as LT,ev as FT,ew as zT,ex as BT,ey as HT,ez as WT,eA as VT,eB as UT,eC as GT,eD as KT,eE as qT,eF as XT,eG as ZI,eH as QT,eI as YT,eJ as ZT,eK as JT,eL as e9,eM as t9,eN as n9,eO as JI,eP as r9,eQ as o9,eR as s9,eS,eT as wp,eU as Ao,eV as a9,eW as l9,eX as i9,eY as c9,eZ as u9,e_ as d9,e$ as es,f0 as f9,f1 as p9,f2 as m9,f3 as h9,f4 as g9,f5 as v9,f6 as b9,f7 as x9,f8 as y9,f9 as C9,fa as w9,fb as S9,fc as k9,fd as j9,fe as _9,ff as I9,fg as P9,fh as E9,fi as M9,fj as O9,fk as D9,fl as R9,fm as A9,fn as T9,fo as N9,fp as tS,fq as $9,fr as Xo,fs as bd,ft as kr,fu as L9,fv as F9,fw as e3,fx as t3,fy as z9,fz as nS,fA as B9,fB as rS,fC as oS,fD as sS,fE as H9,fF as W9,fG as aS,fH as lS,fI as V9,fJ as U9,fK as Pm,fL as G9,fM as iS,fN as K9,fO as cS,fP as n3,fQ as r3,fR as q9,fS as X9,fT as o3,fU as Q9,fV as Y9,fW as Z9,fX as J9,fY as s3,fZ as a3,f_ as Ud,f$ as l3,g0 as Bl,g1 as i3,g2 as uS,g3 as eN,g4 as tN,g5 as c3,g6 as nN,g7 as rN,g8 as oN,g9 as sN,ga as aN,gb as u3,gc as zx,gd as U1,ge as lN,gf as iN,gg as cN,gh as d3,gi as Bx,gj as f3,gk as uN,gl as Hx,gm as p3,gn as dN,go as ta,gp as fN,gq as m3,gr as Kc,gs as pN,gt as h3,gu as mN,gv as hN,gw as gN,gx as vN,gy as qu,gz as rc,gA as dS,gB as bN,gC as xN,gD as yN,gE as CN,gF as wN,gG as SN,gH as fS,gI as kN,gJ as jN,gK as _N,gL as IN,gM as PN,gN as EN,gO as pS,gP as MN,gQ as ON,gR as DN,gS as RN,gT as AN,gU as TN,gV as NN,gW as $N,gX as LN,gY as FN,gZ as zN,g_ as Fa,g$ as BN,h0 as g3,h1 as v3,h2 as HN,h3 as WN,h4 as VN,h5 as UN,h6 as GN,h7 as KN,h8 as qN,h9 as XN,ha as Gd,hb as QN,hc as YN,hd as ZN,he as JN,hf as e$,hg as t$,hh as n$,hi as r$,hj as Em,hk as b3,hl as Mm,hm as o$,hn as s$,ho as fc,hp as x3,hq as y3,hr as Wx,hs as a$,ht as l$,hu as i$,hv as G1,hw as C3,hx as c$,hy as u$,hz as w3,hA as d$,hB as f$,hC as p$,hD as m$,hE as h$,hF as mS,hG as sm,hH as g$,hI as hS,hJ as v$,hK as Ni,hL as b$,hM as x$,hN as y$,hO as C$,hP as w$,hQ as gS,hR as S$,hS as k$,hT as j$,hU as _$,hV as I$,hW as P$,hX as E$,hY as M$,hZ as Rv,h_ as Av,h$ as Tv,i0 as Sp,i1 as vS,i2 as K1,i3 as bS,i4 as O$,i5 as D$,i6 as S3,i7 as R$,i8 as A$,i9 as T$,ia as N$,ib as $$,ic as L$,id as F$,ie as z$,ig as B$,ih as H$,ii as W$,ij as V$,ik as U$,il as G$,im as K$,io as kp,ip as Nv,iq as q$,ir as X$,is as Q$,it as Y$,iu as Z$,iv as J$,iw as eL,ix as tL,iy as xS,iz as yS,iA as nL,iB as rL,iC as oL,iD as sL}from"./index-fbe0e055.js";import{u as k3,a as wa,b as aL,r as Ae,f as lL,g as CS,c as pt,d as Nn}from"./MantineProvider-44862fff.js";var iL=200;function cL(e,t,n,r){var o=-1,s=fI,l=!0,c=e.length,d=[],f=t.length;if(!c)return d;n&&(t=Vc(t,uI(n))),r?(s=pI,l=!1):t.length>=iL&&(s=R1,l=!1,t=new dI(t));e:for(;++o<c;){var m=e[o],h=n==null?m:n(m);if(m=r||m!==0?m:0,l&&h===h){for(var g=f;g--;)if(t[g]===h)continue e;d.push(m)}else s(t,h,r)||d.push(m)}return d}var uL=mI(function(e,t){return A1(e)?cL(e,fR(t,1,A1,!0)):[]});const dL=uL;function fL(e,t){var n=[];return hI(e,function(r,o,s){t(r,o,s)&&n.push(r)}),n}function pL(e,t){var n=gI(e)?pR:fL;return n(e,mx(t))}function mL(e,t){var n=-1,r=mR(e)?Array(e.length):[];return hI(e,function(o,s,l){r[++n]=t(o,s,l)}),r}function Hr(e,t){var n=gI(e)?Vc:mL;return n(e,mx(t))}function hL(e,t){return Vc(t,function(n){return e[n]})}function gL(e){return e==null?[]:hL(e,hx(e))}var vL=Math.min;function bL(e,t,n){for(var r=n?pI:fI,o=e[0].length,s=e.length,l=s,c=Array(s),d=1/0,f=[];l--;){var m=e[l];l&&t&&(m=Vc(m,uI(t))),d=vL(m.length,d),c[l]=!n&&(t||o>=120&&m.length>=120)?new dI(l&&m):void 0}m=e[0];var h=-1,g=c[0];e:for(;++h<o&&f.length<d;){var b=m[h],y=t?t(b):b;if(b=n||b!==0?b:0,!(g?R1(g,y):r(f,y,n))){for(l=s;--l;){var x=c[l];if(!(x?R1(x,y):r(e[l],y,n)))continue e}g&&g.push(y),f.push(b)}}return f}function xL(e){return A1(e)?e:[]}var yL=mI(function(e){var t=Vc(e,xL);return t.length&&t[0]===e[0]?bL(t):[]});const CL=yL;function na(e){return e==null}function wS(e,t){if(e==null)return{};var n=Vc(hR(e),function(r){return[r]});return t=mx(t),gR(e,n,function(r,o){return t(r,o[0])})}const j3=({id:e,x:t,y:n,width:r,height:o,style:s,color:l,strokeColor:c,strokeWidth:d,className:f,borderRadius:m,shapeRendering:h,onClick:g,selected:b})=>{const{background:y,backgroundColor:x}=s||{},w=l||y||x;return B.createElement("rect",{className:gx(["react-flow__minimap-node",{selected:b},f]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:w,stroke:c,strokeWidth:d,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};j3.displayName="MiniMapNode";var wL=i.memo(j3);const SL=e=>e.nodeOrigin,kL=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),$v=e=>e instanceof Function?e:()=>e;function jL({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=wL,onClick:l}){const c=xm(kL,vx),d=xm(SL),f=$v(t),m=$v(e),h=$v(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return B.createElement(B.Fragment,null,c.map(b=>{const{x:y,y:x}=vR(b,d).positionAbsolute;return B.createElement(s,{key:b.id,x:y,y:x,width:b.width,height:b.height,style:b.style,selected:b.selected,className:h(b),color:f(b),borderRadius:r,strokeColor:m(b),strokeWidth:o,shapeRendering:g,onClick:l,id:b.id})}))}var _L=i.memo(jL);const IL=200,PL=150,EL=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?kR(jR(t,e.nodeOrigin),n):n,rfId:e.rfId}},ML="react-flow__minimap-desc";function _3({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:l=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:f="none",maskStrokeWidth:m=1,position:h="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:_=5}){const I=bR(),E=i.useRef(null),{boundingRect:M,viewBB:D,rfId:R}=xm(EL,vx),N=(e==null?void 0:e.width)??IL,O=(e==null?void 0:e.height)??PL,T=M.width/N,U=M.height/O,G=Math.max(T,U),q=G*N,Y=G*O,Q=_*G,V=M.x-(q-M.width)/2-Q,se=M.y-(Y-M.height)/2-Q,ee=q+Q*2,le=Y+Q*2,ae=`${ML}-${R}`,ce=i.useRef(0);ce.current=G,i.useEffect(()=>{if(E.current){const A=xR(E.current),L=z=>{const{transform:oe,d3Selection:X,d3Zoom:Z}=I.getState();if(z.sourceEvent.type!=="wheel"||!X||!Z)return;const me=-z.sourceEvent.deltaY*(z.sourceEvent.deltaMode===1?.05:z.sourceEvent.deltaMode?1:.002)*j,ve=oe[2]*Math.pow(2,me);Z.scaleTo(X,ve)},K=z=>{const{transform:oe,d3Selection:X,d3Zoom:Z,translateExtent:me,width:ve,height:de}=I.getState();if(z.sourceEvent.type!=="mousemove"||!X||!Z)return;const ke=ce.current*Math.max(1,oe[2])*(S?-1:1),we={x:oe[0]-z.sourceEvent.movementX*ke,y:oe[1]-z.sourceEvent.movementY*ke},Re=[[0,0],[ve,de]],Qe=wR.translate(we.x,we.y).scale(oe[2]),$e=Z.constrain()(Qe,Re,me);Z.transform(X,$e)},ne=yR().on("zoom",y?K:null).on("zoom.wheel",x?L:null);return A.call(ne),()=>{A.on("zoom",null)}}},[y,x,S,j]);const J=g?A=>{const L=SR(A);g(A,{x:L[0],y:L[1]})}:void 0,re=b?(A,L)=>{const K=I.getState().nodeInternals.get(L);b(A,K)}:void 0;return B.createElement(CR,{position:h,style:e,className:gx(["react-flow__minimap",t]),"data-testid":"rf__minimap"},B.createElement("svg",{width:N,height:O,viewBox:`${V} ${se} ${ee} ${le}`,role:"img","aria-labelledby":ae,ref:E,onClick:J},w&&B.createElement("title",{id:ae},w),B.createElement(_L,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:c}),B.createElement("path",{className:"react-flow__minimap-mask",d:`M${V-Q},${se-Q}h${ee+Q*2}v${le+Q*2}h${-ee-Q*2}z
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fill:d,fillRule:"evenodd",stroke:f,strokeWidth:m,pointerEvents:"none"})))}_3.displayName="MiniMap";var OL=i.memo(_3),ns;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ns||(ns={}));function DL({color:e,dimensions:t,lineWidth:n}){return B.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function RL({color:e,radius:t}){return B.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const AL={[ns.Dots]:"#91919a",[ns.Lines]:"#eee",[ns.Cross]:"#e2e2e2"},TL={[ns.Dots]:1,[ns.Lines]:1,[ns.Cross]:6},NL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function I3({id:e,variant:t=ns.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:l,style:c,className:d}){const f=i.useRef(null),{transform:m,patternId:h}=xm(NL,vx),g=l||AL[t],b=r||TL[t],y=t===ns.Dots,x=t===ns.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*m[2]||1,w[1]*m[2]||1],j=b*m[2],_=x?[j,j]:S,I=y?[j/s,j/s]:[_[0]/s,_[1]/s];return B.createElement("svg",{className:gx(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:f,"data-testid":"rf__background"},B.createElement("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`},y?B.createElement(RL,{color:g,radius:j/s}):B.createElement(DL,{dimensions:_,color:g,lineWidth:o})),B.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`}))}I3.displayName="Background";var $L=i.memo(I3);function LL(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var FL=LL();const P3=1/60*1e3,zL=typeof performance<"u"?()=>performance.now():()=>Date.now(),E3=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(zL()),P3);function BL(e){let t=[],n=[],r=0,o=!1,s=!1;const l=new WeakSet,c={schedule:(d,f=!1,m=!1)=>{const h=m&&o,g=h?t:n;return f&&l.add(d),g.indexOf(d)===-1&&(g.push(d),h&&o&&(r=t.length)),d},cancel:d=>{const f=n.indexOf(d);f!==-1&&n.splice(f,1),l.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 f=0;f<r;f++){const m=t[f];m(d),l.has(m)&&(c.schedule(m),e())}o=!1,s&&(s=!1,c.process(d))}};return c}const HL=40;let q1=!0,xd=!1,X1=!1;const pc={delta:0,timestamp:0},Kd=["read","update","preRender","render","postRender"],Jh=Kd.reduce((e,t)=>(e[t]=BL(()=>xd=!0),e),{}),WL=Kd.reduce((e,t)=>{const n=Jh[t];return e[t]=(r,o=!1,s=!1)=>(xd||GL(),n.schedule(r,o,s)),e},{}),VL=Kd.reduce((e,t)=>(e[t]=Jh[t].cancel,e),{});Kd.reduce((e,t)=>(e[t]=()=>Jh[t].process(pc),e),{});const UL=e=>Jh[e].process(pc),M3=e=>{xd=!1,pc.delta=q1?P3:Math.max(Math.min(e-pc.timestamp,HL),1),pc.timestamp=e,X1=!0,Kd.forEach(UL),X1=!1,xd&&(q1=!1,E3(M3))},GL=()=>{xd=!0,q1=!0,X1||E3(M3)},SS=()=>pc;function eg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=i.Children.toArray(e.path),l=_e((c,d)=>a.jsx(An,{ref:d,viewBox:t,...o,...c,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return l.displayName=r,l}function tg(e){const{theme:t}=_R(),n=IR();return i.useMemo(()=>PR(t.direction,{...n,...e}),[e,t.direction,n])}var KL=Object.defineProperty,qL=(e,t,n)=>t in e?KL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,In=(e,t,n)=>(qL(e,typeof t!="symbol"?t+"":t,n),n);function kS(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 XL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function jS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function _S(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var Q1=typeof window<"u"?i.useLayoutEffect:i.useEffect,Om=e=>e,QL=class{constructor(){In(this,"descendants",new Map),In(this,"register",e=>{if(e!=null)return XL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),In(this,"unregister",e=>{this.descendants.delete(e);const t=kS(Array.from(this.descendants.keys()));this.assignIndex(t)}),In(this,"destroy",()=>{this.descendants.clear()}),In(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),In(this,"count",()=>this.descendants.size),In(this,"enabledCount",()=>this.enabledValues().length),In(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),In(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),In(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),In(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),In(this,"first",()=>this.item(0)),In(this,"firstEnabled",()=>this.enabledItem(0)),In(this,"last",()=>this.item(this.descendants.size-1)),In(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),In(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),In(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),In(this,"next",(e,t=!0)=>{const n=jS(e,this.count(),t);return this.item(n)}),In(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=jS(r,this.enabledCount(),t);return this.enabledItem(o)}),In(this,"prev",(e,t=!0)=>{const n=_S(e,this.count()-1,t);return this.item(n)}),In(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=_S(r,this.enabledCount()-1,t);return this.enabledItem(o)}),In(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=kS(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 YL(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 Et(...e){return t=>{e.forEach(n=>{YL(n,t)})}}function ZL(...e){return i.useMemo(()=>Et(...e),e)}function JL(){const e=i.useRef(new QL);return Q1(()=>()=>e.current.destroy()),e.current}var[eF,O3]=Kt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function tF(e){const t=O3(),[n,r]=i.useState(-1),o=i.useRef(null);Q1(()=>()=>{o.current&&t.unregister(o.current)},[]),Q1(()=>{if(!o.current)return;const l=Number(o.current.dataset.index);n!=l&&!Number.isNaN(l)&&r(l)});const s=Om(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:Et(s,o)}}function Vx(){return[Om(eF),()=>Om(O3()),()=>JL(),o=>tF(o)]}var[nF,ng]=Kt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:"<Accordion />"}),[rF,Ux]=Kt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:"<AccordionItem />"}),[oF,Sye,sF,aF]=Vx(),qi=_e(function(t,n){const{getButtonProps:r}=Ux(),o=r(t,n),l={display:"flex",alignItems:"center",width:"100%",outline:0,...ng().button};return a.jsx(je.button,{...o,className:et("chakra-accordion__button",t.className),__css:l})});qi.displayName="AccordionButton";function qd(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,b)=>g!==b}=e,s=gn(r),l=gn(o),[c,d]=i.useState(n),f=t!==void 0,m=f?t:c,h=gn(g=>{const y=typeof g=="function"?g(m):g;l(m,y)&&(f||d(y),s(y))},[f,s,m,l]);return[m,h]}function lF(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...l}=e;uF(e),dF(e);const c=sF(),[d,f]=i.useState(-1);i.useEffect(()=>()=>{f(-1)},[]);const[m,h]=qd({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:l,getAccordionItemProps:b=>{let y=!1;return b!==null&&(y=Array.isArray(m)?m.includes(b):m===b),{isOpen:y,onChange:w=>{if(b!==null)if(o&&Array.isArray(m)){const S=w?m.concat(b):m.filter(j=>j!==b);h(S)}else w?h(b):s&&h(-1)}}},focusedIndex:d,setFocusedIndex:f,descendants:c}}var[iF,Gx]=Kt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function cF(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:l}=Gx(),c=i.useRef(null),d=i.useId(),f=r??d,m=`accordion-button-${f}`,h=`accordion-panel-${f}`;fF(e);const{register:g,index:b,descendants:y}=aF({disabled:t&&!n}),{isOpen:x,onChange:w}=s(b===-1?null:b);pF({isOpen:x,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},_=i.useCallback(()=>{w==null||w(!x),l(b)},[b,l,x,w]),I=i.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]),E=i.useCallback(()=>{l(b)},[l,b]),M=i.useCallback(function(N={},O=null){return{...N,type:"button",ref:Et(g,c,O),id:m,disabled:!!t,"aria-expanded":!!x,"aria-controls":h,onClick:ze(N.onClick,_),onFocus:ze(N.onFocus,E),onKeyDown:ze(N.onKeyDown,I)}},[m,t,x,_,E,I,h,g]),D=i.useCallback(function(N={},O=null){return{...N,ref:O,role:"region",id:h,"aria-labelledby":m,hidden:!x}},[m,x,h]);return{isOpen:x,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:D,htmlProps:o}}function uF(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;zd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function dF(e){zd({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 fF(e){zd({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 pF(e){zd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Xi(e){const{isOpen:t,isDisabled:n}=Ux(),{reduceMotion:r}=Gx(),o=et("chakra-accordion__icon",e.className),s=ng(),l={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(An,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:l,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Xi.displayName="AccordionIcon";var Qi=_e(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...l}=cF(t),d={...ng().container,overflowAnchor:"none"},f=i.useMemo(()=>l,[l]);return a.jsx(rF,{value:f,children:a.jsx(je.div,{ref:n,...s,className:et("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!l.isOpen,isDisabled:!!l.isDisabled}):r})})});Qi.displayName="AccordionItem";var oc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Vl={enter:{duration:.2,ease:oc.easeOut},exit:{duration:.1,ease:oc.easeIn}},oa={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})},mF=e=>e!=null&&parseInt(e.toString(),10)>0,IS={exit:{height:{duration:.2,ease:oc.ease},opacity:{duration:.3,ease:oc.ease}},enter:{height:{duration:.3,ease:oc.ease},opacity:{duration:.4,ease:oc.ease}}},hF={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:mF(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:oa.exit(IS.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:oa.enter(IS.enter,o)}}},Xd=i.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:l="auto",style:c,className:d,transition:f,transitionEnd:m,...h}=e,[g,b]=i.useState(!1);i.useEffect(()=>{const j=setTimeout(()=>{b(!0)});return()=>clearTimeout(j)},[]),zd({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:l,animateOpacity:o,transition:g?f:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(hr,{initial:!1,custom:x,children:w&&a.jsx(Mn.div,{ref:t,...h,className:et("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:x,variants:hF,initial:r?"exit":!1,animate:S,exit:"exit"})})});Xd.displayName="Collapse";var gF={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:oa.enter(Vl.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:oa.exit(Vl.exit,n),transitionEnd:t==null?void 0:t.exit}}},D3={initial:"exit",animate:"enter",exit:"exit",variants:gF},vF=i.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:l,transitionEnd:c,delay:d,...f}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:l,transitionEnd:c,delay:d};return a.jsx(hr,{custom:g,children:h&&a.jsx(Mn.div,{ref:n,className:et("chakra-fade",s),custom:g,...D3,animate:m,...f})})});vF.displayName="Fade";var bF={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:oa.exit(Vl.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:oa.enter(Vl.enter,n),transitionEnd:e==null?void 0:e.enter}}},R3={initial:"exit",animate:"enter",exit:"exit",variants:bF},xF=i.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:l=.95,className:c,transition:d,transitionEnd:f,delay:m,...h}=t,g=r?o&&r:!0,b=o||r?"enter":"exit",y={initialScale:l,reverse:s,transition:d,transitionEnd:f,delay:m};return a.jsx(hr,{custom:y,children:g&&a.jsx(Mn.div,{ref:n,className:et("chakra-offset-slide",c),...R3,animate:b,custom:y,...h})})});xF.displayName="ScaleFade";var yF={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:oa.exit(Vl.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:oa.enter(Vl.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var l;const c={x:t,y:e};return{opacity:0,transition:(l=n==null?void 0:n.exit)!=null?l:oa.exit(Vl.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},Xu={initial:"initial",animate:"enter",exit:"exit",variants:yF},CF=i.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:l,offsetX:c=0,offsetY:d=8,transition:f,transitionEnd:m,delay:h,...g}=t,b=r?o&&r:!0,y=o||r?"enter":"exit",x={offsetX:c,offsetY:d,reverse:s,transition:f,transitionEnd:m,delay:h};return a.jsx(hr,{custom:x,children:b&&a.jsx(Mn.div,{ref:n,className:et("chakra-offset-slide",l),custom:x,...Xu,animate:y,...g})})});CF.displayName="SlideFade";var Yi=_e(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:l}=Gx(),{getPanelProps:c,isOpen:d}=Ux(),f=c(s,n),m=et("chakra-accordion__panel",r),h=ng();l||delete f.hidden;const g=a.jsx(je.div,{...f,__css:h.panel,className:m});return l?g:a.jsx(Xd,{in:d,...o,children:g})});Yi.displayName="AccordionPanel";var A3=_e(function({children:t,reduceMotion:n,...r},o){const s=Xn("Accordion",r),l=cn(r),{htmlProps:c,descendants:d,...f}=lF(l),m=i.useMemo(()=>({...f,reduceMotion:!!n}),[f,n]);return a.jsx(oF,{value:d,children:a.jsx(iF,{value:m,children:a.jsx(nF,{value:s,children:a.jsx(je.div,{ref:o,...c,className:et("chakra-accordion",r.className),__css:s.root,children:t})})})})});A3.displayName="Accordion";function rg(e){return i.Children.toArray(e).filter(t=>i.isValidElement(t))}var[wF,SF]=Kt({strict:!1,name:"ButtonGroupContext"}),kF={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}}},jF={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},$t=_e(function(t,n){const{size:r,colorScheme:o,variant:s,className:l,spacing:c="0.5rem",isAttached:d,isDisabled:f,orientation:m="horizontal",...h}=t,g=et("chakra-button__group",l),b=i.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:f}),[r,o,s,f]);let y={display:"inline-flex",...d?kF[m]:jF[m](c)};const x=m==="vertical";return a.jsx(wF,{value:b,children:a.jsx(je.div,{ref:n,role:"group",__css:y,className:g,"data-attached":d?"":void 0,"data-orientation":m,flexDir:x?"column":void 0,...h})})});$t.displayName="ButtonGroup";function _F(e){const[t,n]=i.useState(!e);return{ref:i.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function Y1(e){const{children:t,className:n,...r}=e,o=i.isValidElement(t)?i.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=et("chakra-button__icon",n);return a.jsx(je.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}Y1.displayName="ButtonIcon";function Z1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(va,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:l,...c}=e,d=et("chakra-button__spinner",s),f=n==="start"?"marginEnd":"marginStart",m=i.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[f]:t?r:0,fontSize:"1em",lineHeight:"normal",...l}),[l,t,f,r]);return a.jsx(je.div,{className:d,...c,__css:m,children:o})}Z1.displayName="ButtonSpinner";var ol=_e((e,t)=>{const n=SF(),r=ml("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:l,children:c,leftIcon:d,rightIcon:f,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:b,spinnerPlacement:y="start",className:x,as:w,...S}=cn(e),j=i.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}=_F(w),E={rightIcon:f,leftIcon:d,iconSpacing:h,children:c};return a.jsxs(je.button,{ref:ZL(t,_),as:w,type:g??I,"data-active":ut(l),"data-loading":ut(s),__css:j,className:et("chakra-button",x),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(Z1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:b}),s?m||a.jsx(je.span,{opacity:0,children:a.jsx(PS,{...E})}):a.jsx(PS,{...E}),s&&y==="end"&&a.jsx(Z1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:b})]})});ol.displayName="Button";function PS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(Y1,{marginEnd:o,children:t}),r,n&&a.jsx(Y1,{marginStart:o,children:n})]})}var rs=_e((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...l}=e,c=n||r,d=i.isValidElement(c)?i.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(ol,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...l,children:d})});rs.displayName="IconButton";var[kye,IF]=Kt({name:"CheckboxGroupContext",strict:!1});function PF(e){const[t,n]=i.useState(e),[r,o]=i.useState(!1);return e!==t&&(o(!0),n(e)),r}function EF(e){return a.jsx(je.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 MF(e){return a.jsx(je.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 OF(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?MF:EF;return n||t?a.jsx(je.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[DF,T3]=Kt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "<FormControl />" `}),[RF,Qd]=Kt({strict:!1,name:"FormControlContext"});function AF(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...l}=e,c=i.useId(),d=t||`field-${c}`,f=`${d}-label`,m=`${d}-feedback`,h=`${d}-helptext`,[g,b]=i.useState(!1),[y,x]=i.useState(!1),[w,S]=i.useState(!1),j=i.useCallback((D={},R=null)=>({id:h,...D,ref:Et(R,N=>{N&&x(!0)})}),[h]),_=i.useCallback((D={},R=null)=>({...D,ref:R,"data-focus":ut(w),"data-disabled":ut(o),"data-invalid":ut(r),"data-readonly":ut(s),id:D.id!==void 0?D.id:f,htmlFor:D.htmlFor!==void 0?D.htmlFor:d}),[d,o,w,r,s,f]),I=i.useCallback((D={},R=null)=>({id:m,...D,ref:Et(R,N=>{N&&b(!0)}),"aria-live":"polite"}),[m]),E=i.useCallback((D={},R=null)=>({...D,...l,ref:R,role:"group","data-focus":ut(w),"data-disabled":ut(o),"data-invalid":ut(r),"data-readonly":ut(s)}),[l,o,w,r,s]),M=i.useCallback((D={},R=null)=>({...D,ref:R,role:"presentation","aria-hidden":!0,children:D.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:f,feedbackId:m,helpTextId:h,htmlProps:l,getHelpTextProps:j,getErrorMessageProps:I,getRootProps:E,getLabelProps:_,getRequiredIndicatorProps:M}}var Gt=_e(function(t,n){const r=Xn("Form",t),o=cn(t),{getRootProps:s,htmlProps:l,...c}=AF(o),d=et("chakra-form-control",t.className);return a.jsx(RF,{value:c,children:a.jsx(DF,{value:r,children:a.jsx(je.div,{...s({},n),className:d,__css:r.container})})})});Gt.displayName="FormControl";var N3=_e(function(t,n){const r=Qd(),o=T3(),s=et("chakra-form__helper-text",t.className);return a.jsx(je.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});N3.displayName="FormHelperText";var ln=_e(function(t,n){var r;const o=ml("FormLabel",t),s=cn(t),{className:l,children:c,requiredIndicator:d=a.jsx($3,{}),optionalIndicator:f=null,...m}=s,h=Qd(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(je.label,{...g,className:et("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,h!=null&&h.isRequired?d:f]})});ln.displayName="FormLabel";var $3=_e(function(t,n){const r=Qd(),o=T3();if(!(r!=null&&r.isRequired))return null;const s=et("chakra-form__required-indicator",t.className);return a.jsx(je.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});$3.displayName="RequiredIndicator";function Kx(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=qx(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":wo(n),"aria-required":wo(o),"aria-readonly":wo(r)}}function qx(e){var t,n,r;const o=Qd(),{id:s,disabled:l,readOnly:c,required:d,isRequired:f,isInvalid:m,isReadOnly:h,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=l??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=c??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=d??f)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:ze(o==null?void 0:o.onFocus,b),onBlur:ze(o==null?void 0:o.onBlur,y)}}var Xx={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},L3=je("span",{baseStyle:Xx});L3.displayName="VisuallyHidden";var TF=je("input",{baseStyle:Xx});TF.displayName="VisuallyHiddenInput";var NF=()=>typeof document<"u",ES=!1,Yd=null,Jl=!1,J1=!1,eb=new Set;function Qx(e,t){eb.forEach(n=>n(e,t))}var $F=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function LF(e){return!(e.metaKey||!$F&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function MS(e){Jl=!0,LF(e)&&(Yd="keyboard",Qx("keyboard",e))}function $i(e){if(Yd="pointer",e.type==="mousedown"||e.type==="pointerdown"){Jl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;Qx("pointer",e)}}function FF(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function zF(e){FF(e)&&(Jl=!0,Yd="virtual")}function BF(e){e.target===window||e.target===document||(!Jl&&!J1&&(Yd="virtual",Qx("virtual",e)),Jl=!1,J1=!1)}function HF(){Jl=!1,J1=!0}function OS(){return Yd!=="pointer"}function WF(){if(!NF()||ES)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Jl=!0,e.apply(this,n)},document.addEventListener("keydown",MS,!0),document.addEventListener("keyup",MS,!0),document.addEventListener("click",zF,!0),window.addEventListener("focus",BF,!0),window.addEventListener("blur",HF,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",$i,!0),document.addEventListener("pointermove",$i,!0),document.addEventListener("pointerup",$i,!0)):(document.addEventListener("mousedown",$i,!0),document.addEventListener("mousemove",$i,!0),document.addEventListener("mouseup",$i,!0)),ES=!0}function F3(e){WF(),e(OS());const t=()=>e(OS());return eb.add(t),()=>{eb.delete(t)}}function VF(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function z3(e={}){const t=qx(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:l,onBlur:c,onFocus:d,"aria-describedby":f}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:b,isIndeterminate:y,name:x,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":I,...E}=e,M=VF(E,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),D=gn(b),R=gn(c),N=gn(d),[O,T]=i.useState(!1),[U,G]=i.useState(!1),[q,Y]=i.useState(!1),[Q,V]=i.useState(!1);i.useEffect(()=>F3(T),[]);const se=i.useRef(null),[ee,le]=i.useState(!0),[ae,ce]=i.useState(!!m),J=h!==void 0,re=J?h:ae,A=i.useCallback(de=>{if(r||n){de.preventDefault();return}J||ce(re?de.target.checked:y?!0:de.target.checked),D==null||D(de)},[r,n,re,J,y,D]);dc(()=>{se.current&&(se.current.indeterminate=!!y)},[y]),ba(()=>{n&&G(!1)},[n,G]),dc(()=>{const de=se.current;if(!(de!=null&&de.form))return;const ke=()=>{ce(!!m)};return de.form.addEventListener("reset",ke),()=>{var we;return(we=de.form)==null?void 0:we.removeEventListener("reset",ke)}},[]);const L=n&&!g,K=i.useCallback(de=>{de.key===" "&&V(!0)},[V]),ne=i.useCallback(de=>{de.key===" "&&V(!1)},[V]);dc(()=>{if(!se.current)return;se.current.checked!==re&&ce(se.current.checked)},[se.current]);const z=i.useCallback((de={},ke=null)=>{const we=Re=>{U&&Re.preventDefault(),V(!0)};return{...de,ref:ke,"data-active":ut(Q),"data-hover":ut(q),"data-checked":ut(re),"data-focus":ut(U),"data-focus-visible":ut(U&&O),"data-indeterminate":ut(y),"data-disabled":ut(n),"data-invalid":ut(s),"data-readonly":ut(r),"aria-hidden":!0,onMouseDown:ze(de.onMouseDown,we),onMouseUp:ze(de.onMouseUp,()=>V(!1)),onMouseEnter:ze(de.onMouseEnter,()=>Y(!0)),onMouseLeave:ze(de.onMouseLeave,()=>Y(!1))}},[Q,re,n,U,O,q,y,s,r]),oe=i.useCallback((de={},ke=null)=>({...de,ref:ke,"data-active":ut(Q),"data-hover":ut(q),"data-checked":ut(re),"data-focus":ut(U),"data-focus-visible":ut(U&&O),"data-indeterminate":ut(y),"data-disabled":ut(n),"data-invalid":ut(s),"data-readonly":ut(r)}),[Q,re,n,U,O,q,y,s,r]),X=i.useCallback((de={},ke=null)=>({...M,...de,ref:Et(ke,we=>{we&&le(we.tagName==="LABEL")}),onClick:ze(de.onClick,()=>{var we;ee||((we=se.current)==null||we.click(),requestAnimationFrame(()=>{var Re;(Re=se.current)==null||Re.focus({preventScroll:!0})}))}),"data-disabled":ut(n),"data-checked":ut(re),"data-invalid":ut(s)}),[M,n,re,s,ee]),Z=i.useCallback((de={},ke=null)=>({...de,ref:Et(se,ke),type:"checkbox",name:x,value:w,id:l,tabIndex:S,onChange:ze(de.onChange,A),onBlur:ze(de.onBlur,R,()=>G(!1)),onFocus:ze(de.onFocus,N,()=>G(!0)),onKeyDown:ze(de.onKeyDown,K),onKeyUp:ze(de.onKeyUp,ne),required:o,checked:re,disabled:L,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":I?!!I:s,"aria-describedby":f,"aria-disabled":n,style:Xx}),[x,w,l,A,R,N,K,ne,o,re,L,r,j,_,I,s,f,n,S]),me=i.useCallback((de={},ke=null)=>({...de,ref:ke,onMouseDown:ze(de.onMouseDown,UF),"data-disabled":ut(n),"data-checked":ut(re),"data-invalid":ut(s)}),[re,n,s]);return{state:{isInvalid:s,isFocused:U,isChecked:re,isActive:Q,isHovered:q,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:X,getCheckboxProps:z,getIndicatorProps:oe,getInputProps:Z,getLabelProps:me,htmlProps:M}}function UF(e){e.preventDefault(),e.stopPropagation()}var GF={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},KF={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},qF=xa({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),XF=xa({from:{opacity:0},to:{opacity:1}}),QF=xa({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),og=_e(function(t,n){const r=IF(),o={...r,...t},s=Xn("Checkbox",o),l=cn(t),{spacing:c="0.5rem",className:d,children:f,iconColor:m,iconSize:h,icon:g=a.jsx(OF,{}),isChecked:b,isDisabled:y=r==null?void 0:r.isDisabled,onChange:x,inputProps:w,...S}=l;let j=b;r!=null&&r.value&&l.value&&(j=r.value.includes(l.value));let _=x;r!=null&&r.onChange&&l.value&&(_=Uh(r.onChange,x));const{state:I,getInputProps:E,getCheckboxProps:M,getLabelProps:D,getRootProps:R}=z3({...S,isDisabled:y,isChecked:j,onChange:_}),N=PF(I.isChecked),O=i.useMemo(()=>({animation:N?I.isIndeterminate?`${XF} 20ms linear, ${QF} 200ms linear`:`${qF} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,N,I.isIndeterminate,s.icon]),T=i.cloneElement(g,{__css:O,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return a.jsxs(je.label,{__css:{...KF,...s.container},className:et("chakra-checkbox",d),...R(),children:[a.jsx("input",{className:"chakra-checkbox__input",...E(w,n)}),a.jsx(je.span,{__css:{...GF,...s.control},className:"chakra-checkbox__control",...M(),children:T}),f&&a.jsx(je.span,{className:"chakra-checkbox__label",...D(),__css:{marginStart:c,...s.label},children:f})]})});og.displayName="Checkbox";function YF(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function Yx(e,t){let n=YF(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function tb(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 Dm(e,t,n){return(e-t)*100/(n-t)}function B3(e,t,n){return(n-t)*e+t}function nb(e,t,n){const r=Math.round((e-t)/n)*n+t,o=tb(n);return Yx(r,o)}function mc(e,t,n){return e==null?e:(n<t&&console.warn("clamp: max cannot be less than min"),Math.min(Math.max(e,t),n))}function ZF(e={}){const{onChange:t,precision:n,defaultValue:r,value:o,step:s=1,min:l=Number.MIN_SAFE_INTEGER,max:c=Number.MAX_SAFE_INTEGER,keepWithinRange:d=!0}=e,f=gn(t),[m,h]=i.useState(()=>{var O;return r==null?"":(O=Lv(r,s,n))!=null?O:""}),g=typeof o<"u",b=g?o:m,y=H3(Wa(b),s),x=n??y,w=i.useCallback(O=>{O!==b&&(g||h(O.toString()),f==null||f(O.toString(),Wa(O)))},[f,g,b]),S=i.useCallback(O=>{let T=O;return d&&(T=mc(T,l,c)),Yx(T,x)},[x,d,c,l]),j=i.useCallback((O=s)=>{let T;b===""?T=Wa(O):T=Wa(b)+O,T=S(T),w(T)},[S,s,w,b]),_=i.useCallback((O=s)=>{let T;b===""?T=Wa(-O):T=Wa(b)-O,T=S(T),w(T)},[S,s,w,b]),I=i.useCallback(()=>{var O;let T;r==null?T="":T=(O=Lv(r,s,n))!=null?O:l,w(T)},[r,n,s,w,l]),E=i.useCallback(O=>{var T;const U=(T=Lv(O,s,x))!=null?T:l;w(U)},[x,s,w,l]),M=Wa(b);return{isOutOfRange:M>c||M<l,isAtMax:M===c,isAtMin:M===l,precision:x,value:b,valueAsNumber:M,update:w,reset:I,increment:j,decrement:_,clamp:S,cast:E,setValue:h}}function Wa(e){return parseFloat(e.toString().replace(/[^\w.-]+/g,""))}function H3(e,t){return Math.max(tb(t),tb(e))}function Lv(e,t,n){const r=Wa(e);if(Number.isNaN(r))return;const o=H3(r,t);return Yx(r,n??o)}var[JF,W3]=Kt({name:"EditableStylesContext",errorMessage:`useEditableStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Editable />" `}),[ez,Zx]=Kt({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in `<Editable />`"}),V3={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},Zd=_e(function(t,n){const{getInputProps:r}=Zx(),o=W3(),s=r(t,n),l=et("chakra-editable__input",t.className);return a.jsx(je.input,{...s,__css:{outline:0,...V3,...o.input},className:l})});Zd.displayName="EditableInput";var Jd=_e(function(t,n){const{getPreviewProps:r}=Zx(),o=W3(),s=r(t,n),l=et("chakra-editable__preview",t.className);return a.jsx(je.span,{...s,__css:{cursor:"text",display:"inline-block",...V3,...o.preview},className:l})});Jd.displayName="EditablePreview";function Ul(e,t,n,r){const o=gn(n);return i.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 tz(e){return"current"in e}var U3=()=>typeof window<"u";function nz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var rz=e=>U3()&&e.test(navigator.vendor),oz=e=>U3()&&e.test(nz()),sz=()=>oz(/mac|iphone|ipad|ipod/i),az=()=>sz()&&rz(/apple/i);function G3(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,l;return(l=(s=t.current)==null?void 0:s.ownerDocument)!=null?l:document};Ul(o,"pointerdown",s=>{if(!az()||!r)return;const l=s.target,d=(n??[t]).some(f=>{const m=tz(f)?f.current:f;return(m==null?void 0:m.contains(l))||m===l});o().activeElement!==l&&d&&(s.preventDefault(),l.focus())})}function DS(e,t){return e?e===t||e.contains(t):!1}function lz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:l,defaultValue:c,startWithEditView:d,isPreviewFocusable:f=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:b,finalFocusRef:y,...x}=e,w=gn(b),S=!!(d&&!l),[j,_]=i.useState(S),[I,E]=qd({defaultValue:c||"",value:s,onChange:t}),[M,D]=i.useState(I),R=i.useRef(null),N=i.useRef(null),O=i.useRef(null),T=i.useRef(null),U=i.useRef(null);G3({ref:R,enabled:j,elements:[T,U]});const G=!j&&!l;dc(()=>{var z,oe;j&&((z=R.current)==null||z.focus(),h&&((oe=R.current)==null||oe.select()))},[]),ba(()=>{var z,oe,X,Z;if(!j){y?(z=y.current)==null||z.focus():(oe=O.current)==null||oe.focus();return}(X=R.current)==null||X.focus(),h&&((Z=R.current)==null||Z.select()),w==null||w()},[j,w,h]);const q=i.useCallback(()=>{G&&_(!0)},[G]),Y=i.useCallback(()=>{D(I)},[I]),Q=i.useCallback(()=>{_(!1),E(M),n==null||n(M),o==null||o(M)},[n,o,E,M]),V=i.useCallback(()=>{_(!1),D(I),r==null||r(I),o==null||o(M)},[I,r,o,M]);i.useEffect(()=>{if(j)return;const z=R.current;(z==null?void 0:z.ownerDocument.activeElement)===z&&(z==null||z.blur())},[j]);const se=i.useCallback(z=>{E(z.currentTarget.value)},[E]),ee=i.useCallback(z=>{const oe=z.key,Z={Escape:Q,Enter:me=>{!me.shiftKey&&!me.metaKey&&V()}}[oe];Z&&(z.preventDefault(),Z(z))},[Q,V]),le=i.useCallback(z=>{const oe=z.key,Z={Escape:Q}[oe];Z&&(z.preventDefault(),Z(z))},[Q]),ae=I.length===0,ce=i.useCallback(z=>{var oe;if(!j)return;const X=z.currentTarget.ownerDocument,Z=(oe=z.relatedTarget)!=null?oe:X.activeElement,me=DS(T.current,Z),ve=DS(U.current,Z);!me&&!ve&&(m?V():Q())},[m,V,Q,j]),J=i.useCallback((z={},oe=null)=>{const X=G&&f?0:void 0;return{...z,ref:Et(oe,N),children:ae?g:I,hidden:j,"aria-disabled":wo(l),tabIndex:X,onFocus:ze(z.onFocus,q,Y)}},[l,j,G,f,ae,q,Y,g,I]),re=i.useCallback((z={},oe=null)=>({...z,hidden:!j,placeholder:g,ref:Et(oe,R),disabled:l,"aria-disabled":wo(l),value:I,onBlur:ze(z.onBlur,ce),onChange:ze(z.onChange,se),onKeyDown:ze(z.onKeyDown,ee),onFocus:ze(z.onFocus,Y)}),[l,j,ce,se,ee,Y,g,I]),A=i.useCallback((z={},oe=null)=>({...z,hidden:!j,placeholder:g,ref:Et(oe,R),disabled:l,"aria-disabled":wo(l),value:I,onBlur:ze(z.onBlur,ce),onChange:ze(z.onChange,se),onKeyDown:ze(z.onKeyDown,le),onFocus:ze(z.onFocus,Y)}),[l,j,ce,se,le,Y,g,I]),L=i.useCallback((z={},oe=null)=>({"aria-label":"Edit",...z,type:"button",onClick:ze(z.onClick,q),ref:Et(oe,O),disabled:l}),[q,l]),K=i.useCallback((z={},oe=null)=>({...z,"aria-label":"Submit",ref:Et(U,oe),type:"button",onClick:ze(z.onClick,V),disabled:l}),[V,l]),ne=i.useCallback((z={},oe=null)=>({"aria-label":"Cancel",id:"cancel",...z,ref:Et(T,oe),type:"button",onClick:ze(z.onClick,Q),disabled:l}),[Q,l]);return{isEditing:j,isDisabled:l,isValueEmpty:ae,value:I,onEdit:q,onCancel:Q,onSubmit:V,getPreviewProps:J,getInputProps:re,getTextareaProps:A,getEditButtonProps:L,getSubmitButtonProps:K,getCancelButtonProps:ne,htmlProps:x}}var ef=_e(function(t,n){const r=Xn("Editable",t),o=cn(t),{htmlProps:s,...l}=lz(o),{isEditing:c,onSubmit:d,onCancel:f,onEdit:m}=l,h=et("chakra-editable",t.className),g=bx(t.children,{isEditing:c,onSubmit:d,onCancel:f,onEdit:m});return a.jsx(ez,{value:l,children:a.jsx(JF,{value:r,children:a.jsx(je.div,{ref:n,...s,className:h,children:g})})})});ef.displayName="Editable";function K3(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=Zx();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}function iz(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var q3={exports:{}},cz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",uz=cz,dz=uz;function X3(){}function Q3(){}Q3.resetWarningCache=X3;var fz=function(){function e(r,o,s,l,c,d){if(d!==dz){var f=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 f.name="Invariant Violation",f}}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:Q3,resetWarningCache:X3};return n.PropTypes=n,n};q3.exports=fz();var pz=q3.exports;const nn=Bd(pz);var rb="data-focus-lock",Y3="data-focus-lock-disabled",mz="data-no-focus-lock",hz="data-autofocus-inside",gz="data-no-autofocus";function vz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function bz(e,t){var n=i.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 Z3(e,t){return bz(t||null,function(n){return e.forEach(function(r){return vz(r,n)})})}var Fv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},ws=function(){return ws=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ws.apply(this,arguments)};function J3(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function qc(e,t,n,r){function o(s){return s instanceof n?s:new n(function(l){l(s)})}return new(n||(n=Promise))(function(s,l){function c(m){try{f(r.next(m))}catch(h){l(h)}}function d(m){try{f(r.throw(m))}catch(h){l(h)}}function f(m){m.done?s(m.value):o(m.value).then(c,d)}f((r=r.apply(e,t||[])).next())})}function Xc(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,l;return l={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function c(f){return function(m){return d([f,m])}}function d(f){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,f[0]&&(n=0)),n;)try{if(r=1,o&&(s=f[0]&2?o.return:f[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,f[1])).done)return s;switch(o=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,o=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){n.label=f[1];break}if(f[0]===6&&n.label<s[1]){n.label=s[1],s=f;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(f);break}s[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(m){f=[6,m],o=0}finally{r=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function RS(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],l;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){l={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(l)throw l.error}}return s}function ob(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function e5(e){return e}function t5(e,t){t===void 0&&(t=e5);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var l=t(s,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(s){for(r=!0;n.length;){var l=n;n=[],l.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(s),l=n}var d=function(){var m=l;l=[],m.forEach(s)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(m){l.push(m),f()},filter:function(m){return l=l.filter(m),n}}}};return o}function Jx(e,t){return t===void 0&&(t=e5),t5(e,t)}function n5(e){e===void 0&&(e={});var t=t5(null);return t.options=ws({async:!0,ssr:!1},e),t}var r5=function(e){var t=e.sideCar,n=J3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,ws({},n))};r5.isSideCarExport=!0;function xz(e,t){return e.useMedium(t),r5}var o5=Jx({},function(e){var t=e.target,n=e.currentTarget;return{target:t,currentTarget:n}}),s5=Jx(),yz=Jx(),Cz=n5({async:!0}),wz=[],ey=i.forwardRef(function(t,n){var r,o=i.useState(),s=o[0],l=o[1],c=i.useRef(),d=i.useRef(!1),f=i.useRef(null),m=t.children,h=t.disabled,g=t.noFocusGuards,b=t.persistentFocus,y=t.crossFrame,x=t.autoFocus;t.allowTextSelection;var w=t.group,S=t.className,j=t.whiteList,_=t.hasPositiveIndices,I=t.shards,E=I===void 0?wz:I,M=t.as,D=M===void 0?"div":M,R=t.lockProps,N=R===void 0?{}:R,O=t.sideCar,T=t.returnFocus,U=t.focusOptions,G=t.onActivation,q=t.onDeactivation,Y=i.useState({}),Q=Y[0],V=i.useCallback(function(){f.current=f.current||document&&document.activeElement,c.current&&G&&G(c.current),d.current=!0},[G]),se=i.useCallback(function(){d.current=!1,q&&q(c.current)},[q]);i.useEffect(function(){h||(f.current=null)},[]);var ee=i.useCallback(function(K){var ne=f.current;if(ne&&ne.focus){var z=typeof T=="function"?T(ne):T;if(z){var oe=typeof z=="object"?z:void 0;f.current=null,K?Promise.resolve().then(function(){return ne.focus(oe)}):ne.focus(oe)}}},[T]),le=i.useCallback(function(K){d.current&&o5.useMedium(K)},[]),ae=s5.useMedium,ce=i.useCallback(function(K){c.current!==K&&(c.current=K,l(K))},[]),J=bn((r={},r[Y3]=h&&"disabled",r[rb]=w,r),N),re=g!==!0,A=re&&g!=="tail",L=Z3([n,ce]);return i.createElement(i.Fragment,null,re&&[i.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:h?-1:0,style:Fv}),_?i.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:h?-1:1,style:Fv}):null],!h&&i.createElement(O,{id:Q,sideCar:Cz,observed:s,disabled:h,persistentFocus:b,crossFrame:y,autoFocus:x,whiteList:j,shards:E,onActivation:V,onDeactivation:se,returnFocus:ee,focusOptions:U}),i.createElement(D,bn({ref:L},J,{className:S,onBlur:ae,onFocus:le}),m),A&&i.createElement("div",{"data-focus-guard":!0,tabIndex:h?-1:0,style:Fv}))});ey.propTypes={};ey.defaultProps={children:void 0,disabled:!1,returnFocus:!1,focusOptions:void 0,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,hasPositiveIndices:void 0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};const a5=ey;function sb(e,t){return sb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},sb(e,t)}function Sz(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,sb(e,t)}function yd(e){"@babel/helpers - typeof";return yd=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},yd(e)}function kz(e,t){if(yd(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(yd(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jz(e){var t=kz(e,"string");return yd(t)==="symbol"?t:String(t)}function _z(e,t,n){return t=jz(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Iz(e,t){function n(r){return r.displayName||r.name||"Component"}return function(o){var s=[],l;function c(){l=e(s.map(function(f){return f.props})),t(l)}var d=function(f){Sz(m,f);function m(){return f.apply(this,arguments)||this}m.peek=function(){return l};var h=m.prototype;return h.componentDidMount=function(){s.push(this),c()},h.componentDidUpdate=function(){c()},h.componentWillUnmount=function(){var b=s.indexOf(this);s.splice(b,1),c()},h.render=function(){return B.createElement(o,this.props)},m}(i.PureComponent);return _z(d,"displayName","SideEffect("+n(o)+")"),d}}var Fs=function(e){for(var t=Array(e.length),n=0;n<e.length;++n)t[n]=e[n];return t},Rm=function(e){return Array.isArray(e)?e:[e]},l5=function(e){return Array.isArray(e)?e[0]:e},Pz=function(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;var t=window.getComputedStyle(e,null);return!t||!t.getPropertyValue?!1:t.getPropertyValue("display")==="none"||t.getPropertyValue("visibility")==="hidden"},i5=function(e){return e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode},c5=function(e){return e===document||e&&e.nodeType===Node.DOCUMENT_NODE},Ez=function(e,t){return!e||c5(e)||!Pz(e)&&t(i5(e))},u5=function(e,t){var n=e.get(t);if(n!==void 0)return n;var r=Ez(t,u5.bind(void 0,e));return e.set(t,r),r},Mz=function(e,t){return e&&!c5(e)?Rz(e)?t(i5(e)):!1:!0},d5=function(e,t){var n=e.get(t);if(n!==void 0)return n;var r=Mz(t,d5.bind(void 0,e));return e.set(t,r),r},f5=function(e){return e.dataset},Oz=function(e){return e.tagName==="BUTTON"},p5=function(e){return e.tagName==="INPUT"},m5=function(e){return p5(e)&&e.type==="radio"},Dz=function(e){return!((p5(e)||Oz(e))&&(e.type==="hidden"||e.disabled))},Rz=function(e){var t=e.getAttribute(gz);return![!0,"true",""].includes(t)},ty=function(e){var t;return!!(e&&(!((t=f5(e))===null||t===void 0)&&t.focusGuard))},Am=function(e){return!ty(e)},Az=function(e){return!!e},Tz=function(e,t){var n=e.tabIndex-t.tabIndex,r=e.index-t.index;if(n){if(!e.tabIndex)return 1;if(!t.tabIndex)return-1}return n||r},h5=function(e,t,n){return Fs(e).map(function(r,o){return{node:r,index:o,tabIndex:n&&r.tabIndex===-1?(r.dataset||{}).focusGuard?0:-1:r.tabIndex}}).filter(function(r){return!t||r.tabIndex>=0}).sort(Tz)},Nz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],ny=Nz.join(","),$z="".concat(ny,", [data-focus-guard]"),g5=function(e,t){return Fs((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?$z:ny)?[r]:[],g5(r))},[])},Lz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?sg([e.contentDocument.body],t):[e]},sg=function(e,t){return e.reduce(function(n,r){var o,s=g5(r,t),l=(o=[]).concat.apply(o,s.map(function(c){return Lz(c,t)}));return n.concat(l,r.parentNode?Fs(r.parentNode.querySelectorAll(ny)).filter(function(c){return c===r}):[])},[])},Fz=function(e){var t=e.querySelectorAll("[".concat(hz,"]"));return Fs(t).map(function(n){return sg([n])}).reduce(function(n,r){return n.concat(r)},[])},ry=function(e,t){return Fs(e).filter(function(n){return u5(t,n)}).filter(function(n){return Dz(n)})},AS=function(e,t){return t===void 0&&(t=new Map),Fs(e).filter(function(n){return d5(t,n)})},ab=function(e,t,n){return h5(ry(sg(e,n),t),!0,n)},TS=function(e,t){return h5(ry(sg(e),t),!1)},zz=function(e,t){return ry(Fz(e),t)},hc=function(e,t){return e.shadowRoot?hc(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Fs(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?hc(o,t):!1}return hc(n,t)})},Bz=function(e){for(var t=new Set,n=e.length,r=0;r<n;r+=1)for(var o=r+1;o<n;o+=1){var s=e[r].compareDocumentPosition(e[o]);(s&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(l,c){return!t.has(c)})},v5=function(e){return e.parentNode?v5(e.parentNode):e},oy=function(e){var t=Rm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(rb);return n.push.apply(n,o?Bz(Fs(v5(r).querySelectorAll("[".concat(rb,'="').concat(o,'"]:not([').concat(Y3,'="disabled"])')))):[r]),n},[])},Hz=function(e){try{return e()}catch{return}},Cd=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Cd(t.shadowRoot):t instanceof HTMLIFrameElement&&Hz(function(){return t.contentWindow.document})?Cd(t.contentWindow.document):t}},Wz=function(e,t){return e===t},Vz=function(e,t){return!!Fs(e.querySelectorAll("iframe")).some(function(n){return Wz(n,t)})},b5=function(e,t){return t===void 0&&(t=Cd(l5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:oy(e).some(function(n){return hc(n,t)||Vz(n,t)})},Uz=function(e){e===void 0&&(e=document);var t=Cd(e);return t?Fs(e.querySelectorAll("[".concat(mz,"]"))).some(function(n){return hc(n,t)}):!1},Gz=function(e,t){return t.filter(m5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},sy=function(e,t){return m5(e)&&e.name?Gz(e,t):e},Kz=function(e){var t=new Set;return e.forEach(function(n){return t.add(sy(n,e))}),e.filter(function(n){return t.has(n)})},NS=function(e){return e[0]&&e.length>1?sy(e[0],e):e[0]},$S=function(e,t){return e.length>1?e.indexOf(sy(e[t],e)):t},x5="NEW_FOCUS",qz=function(e,t,n,r){var o=e.length,s=e[0],l=e[o-1],c=ty(n);if(!(n&&e.indexOf(n)>=0)){var d=n!==void 0?t.indexOf(n):-1,f=r?t.indexOf(r):d,m=r?e.indexOf(r):-1,h=d-f,g=t.indexOf(s),b=t.indexOf(l),y=Kz(t),x=n!==void 0?y.indexOf(n):-1,w=x-(r?y.indexOf(r):d),S=$S(e,0),j=$S(e,o-1);if(d===-1||m===-1)return x5;if(!h&&m>=0)return m;if(d<=g&&c&&Math.abs(h)>1)return j;if(d>=b&&c&&Math.abs(h)>1)return S;if(h&&Math.abs(w)>1)return m;if(d<=g)return j;if(d>b)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},Xz=function(e){return function(t){var n,r=(n=f5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Qz=function(e,t,n){var r=e.map(function(s){var l=s.node;return l}),o=AS(r.filter(Xz(n)));return o&&o.length?NS(o):NS(AS(t))},lb=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&lb(e.parentNode.host||e.parentNode,t),t},zv=function(e,t){for(var n=lb(e),r=lb(t),o=0;o<n.length;o+=1){var s=n[o];if(r.indexOf(s)>=0)return s}return!1},y5=function(e,t,n){var r=Rm(e),o=Rm(t),s=r[0],l=!1;return o.filter(Boolean).forEach(function(c){l=zv(l||c,c)||l,n.filter(Boolean).forEach(function(d){var f=zv(s,d);f&&(!l||hc(f,l)?l=f:l=zv(f,l))})}),l},Yz=function(e,t){return e.reduce(function(n,r){return n.concat(zz(r,t))},[])},Zz=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(Az)},Jz=function(e,t){var n=Cd(Rm(e).length>0?document:l5(e).ownerDocument),r=oy(e).filter(Am),o=y5(n||e,e,r),s=new Map,l=TS(r,s),c=ab(r,s).filter(function(b){var y=b.node;return Am(y)});if(!(!c[0]&&(c=l,!c[0]))){var d=TS([o],s).map(function(b){var y=b.node;return y}),f=Zz(d,c),m=f.map(function(b){var y=b.node;return y}),h=qz(m,d,n,t);if(h===x5){var g=Qz(l,m,Yz(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:f[h]}},eB=function(e){var t=oy(e).filter(Am),n=y5(e,e,t),r=new Map,o=ab([n],r,!0),s=ab(t,r).filter(function(l){var c=l.node;return Am(c)}).map(function(l){var c=l.node;return c});return o.map(function(l){var c=l.node,d=l.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:ty(c)}})},tB=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},Bv=0,Hv=!1,C5=function(e,t,n){n===void 0&&(n={});var r=Jz(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++,tB(r.node,n.focusOptions),Bv--}};function ay(e){setTimeout(e,1)}var nB=function(){return document&&document.activeElement===document.body},rB=function(){return nB()||Uz()},gc=null,sc=null,vc=null,wd=!1,oB=function(){return!0},sB=function(t){return(gc.whiteList||oB)(t)},aB=function(t,n){vc={observerNode:t,portaledElement:n}},lB=function(t){return vc&&vc.portaledElement===t};function LS(e,t,n,r){var o=null,s=e;do{var l=r[s];if(l.guard)l.node.dataset.focusAutoGuard&&(o=l);else if(l.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var iB=function(t){return t&&"current"in t?t.current:t},cB=function(t){return t?!!wd:wd==="meanwhile"},uB=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},dB=function(t,n){return n.some(function(r){return uB(t,r,r)})},Tm=function(){var t=!1;if(gc){var n=gc,r=n.observed,o=n.persistentFocus,s=n.autoFocus,l=n.shards,c=n.crossFrame,d=n.focusOptions,f=r||vc&&vc.portaledElement,m=document&&document.activeElement;if(f){var h=[f].concat(l.map(iB).filter(Boolean));if((!m||sB(m))&&(o||cB(c)||!rB()||!sc&&s)&&(f&&!(b5(h)||m&&dB(m,h)||lB(m))&&(document&&!sc&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=C5(h,sc,{focusOptions:d}),vc={})),wd=!1,sc=document&&document.activeElement),document){var g=document&&document.activeElement,b=eB(h),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")}),LS(y,b.length,1,b),LS(y,-1,-1,b))}}}return t},w5=function(t){Tm()&&t&&(t.stopPropagation(),t.preventDefault())},ly=function(){return ay(Tm)},fB=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||aB(r,n)},pB=function(){return null},S5=function(){wd="just",ay(function(){wd="meanwhile"})},mB=function(){document.addEventListener("focusin",w5),document.addEventListener("focusout",ly),window.addEventListener("blur",S5)},hB=function(){document.removeEventListener("focusin",w5),document.removeEventListener("focusout",ly),window.removeEventListener("blur",S5)};function gB(e){return e.filter(function(t){var n=t.disabled;return!n})}function vB(e){var t=e.slice(-1)[0];t&&!gc&&mB();var n=gc,r=n&&t&&t.id===n.id;gc=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(sc=null,(!r||n.observed!==t.observed)&&t.onActivation(),Tm(),ay(Tm)):(hB(),sc=null)}o5.assignSyncMedium(fB);s5.assignMedium(ly);yz.assignMedium(function(e){return e({moveFocusInside:C5,focusInside:b5})});const bB=Iz(gB,vB)(pB);var k5=i.forwardRef(function(t,n){return i.createElement(a5,bn({sideCar:bB,ref:n},t))}),j5=a5.propTypes||{};j5.sideCar;iz(j5,["sideCar"]);k5.propTypes={};const FS=k5;function _5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function iy(e){var t;if(!_5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function xB(e){var t,n;return(n=(t=I5(e))==null?void 0:t.defaultView)!=null?n:window}function I5(e){return _5(e)?e.ownerDocument:document}function yB(e){return I5(e).activeElement}function CB(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 wB(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function P5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:iy(e)&&CB(e)?e:P5(wB(e))}var E5=e=>e.hasAttribute("tabindex"),SB=e=>E5(e)&&e.tabIndex===-1;function kB(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function M5(e){return e.parentElement&&M5(e.parentElement)?!0:e.hidden}function jB(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function O5(e){if(!iy(e)||M5(e)||kB(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]():jB(e)?!0:E5(e)}function _B(e){return e?iy(e)&&O5(e)&&!SB(e):!1}var IB=["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]"],PB=IB.join(),EB=e=>e.offsetWidth>0&&e.offsetHeight>0;function D5(e){const t=Array.from(e.querySelectorAll(PB));return t.unshift(e),t.filter(n=>O5(n)&&EB(n))}var zS,MB=(zS=FS.default)!=null?zS:FS,R5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:l,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:f}=e,m=i.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&D5(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=i.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),g=o&&!n;return a.jsx(MB,{crossFrame:f,persistentFocus:d,autoFocus:c,disabled:l,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};R5.displayName="FocusLock";var OB=FL?i.useLayoutEffect:i.useEffect;function ib(e,t=[]){const n=i.useRef(e);return OB(()=>{n.current=e}),i.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function DB(e,t,n,r){const o=ib(t);return i.useEffect(()=>{var s;const l=(s=Rw(n))!=null?s:document;if(t)return l.addEventListener(e,o,r),()=>{l.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Rw(n))!=null?s:document).removeEventListener(e,o,r)}}function RB(e,t){const n=i.useId();return i.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function AB(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function sr(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ib(n),l=ib(t),[c,d]=i.useState(e.defaultIsOpen||!1),[f,m]=AB(r,c),h=RB(o,"disclosure"),g=i.useCallback(()=>{f||d(!1),l==null||l()},[f,l]),b=i.useCallback(()=>{f||d(!0),s==null||s()},[f,s]),y=i.useCallback(()=>{(m?g:b)()},[m,b,g]);return{isOpen:!!m,onOpen:b,onClose:g,onToggle:y,isControlled:f,getButtonProps:(x={})=>({...x,"aria-expanded":m,"aria-controls":h,onClick:ER(x.onClick,y)}),getDisclosureProps:(x={})=>({...x,hidden:!m,id:h})}}var[TB,NB]=Kt({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "<InputGroup />" `}),cy=_e(function(t,n){const r=Xn("Input",t),{children:o,className:s,...l}=cn(t),c=et("chakra-input__group",s),d={},f=rg(o),m=r.field;f.forEach(g=>{var b,y;r&&(m&&g.type.id==="InputLeftElement"&&(d.paddingStart=(b=m.height)!=null?b:m.h),m&&g.type.id==="InputRightElement"&&(d.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(d.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const h=f.map(g=>{var b,y;const x=vI({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"?i.cloneElement(g,x):i.cloneElement(g,Object.assign(x,d,g.props))});return a.jsx(je.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...l,children:a.jsx(TB,{value:r,children:h})})});cy.displayName="InputGroup";var $B=je("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),ag=_e(function(t,n){var r,o;const{placement:s="left",...l}=t,c=NB(),d=c.field,m={[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($B,{ref:n,__css:m,...l})});ag.id="InputElement";ag.displayName="InputElement";var A5=_e(function(t,n){const{className:r,...o}=t,s=et("chakra-input__left-element",r);return a.jsx(ag,{ref:n,placement:"left",className:s,...o})});A5.id="InputLeftElement";A5.displayName="InputLeftElement";var lg=_e(function(t,n){const{className:r,...o}=t,s=et("chakra-input__right-element",r);return a.jsx(ag,{ref:n,placement:"right",className:s,...o})});lg.id="InputRightElement";lg.displayName="InputRightElement";var Qc=_e(function(t,n){const{htmlSize:r,...o}=t,s=Xn("Input",o),l=cn(o),c=Kx(l),d=et("chakra-input",t.className);return a.jsx(je.input,{size:r,...c,__css:s.field,ref:n,className:d})});Qc.displayName="Input";Qc.id="Input";var ig=_e(function(t,n){const r=ml("Link",t),{className:o,isExternal:s,...l}=cn(t);return a.jsx(je.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:et("chakra-link",o),...l,__css:r})});ig.displayName="Link";var[LB,T5]=Kt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "<List />" `}),uy=_e(function(t,n){const r=Xn("List",t),{children:o,styleType:s="none",stylePosition:l,spacing:c,...d}=cn(t),f=rg(o),h=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return a.jsx(LB,{value:r,children:a.jsx(je.ul,{ref:n,listStyleType:s,listStylePosition:l,role:"list",__css:{...r.container,...h},...d,children:f})})});uy.displayName="List";var N5=_e((e,t)=>{const{as:n,...r}=e;return a.jsx(uy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});N5.displayName="OrderedList";var cg=_e(function(t,n){const{as:r,...o}=t;return a.jsx(uy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});cg.displayName="UnorderedList";var ts=_e(function(t,n){const r=T5();return a.jsx(je.li,{ref:n,...t,__css:r.item})});ts.displayName="ListItem";var FB=_e(function(t,n){const r=T5();return a.jsx(An,{ref:n,role:"presentation",...t,__css:r.icon})});FB.displayName="ListIcon";var sl=_e(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:l,column:c,row:d,autoFlow:f,autoRows:m,templateRows:h,autoColumns:g,templateColumns:b,...y}=t,x={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:l,gridAutoColumns:g,gridColumn:c,gridRow:d,gridAutoFlow:f,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:b};return a.jsx(je.div,{ref:n,__css:x,...y})});sl.displayName="Grid";function $5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):T1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var Wr=je("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});Wr.displayName="Spacer";var L5=e=>a.jsx(je.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});L5.displayName="StackItem";function zB(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{"&":$5(n,o=>r[o])}}var dy=_e((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:l="0.5rem",wrap:c,children:d,divider:f,className:m,shouldWrapChildren:h,...g}=e,b=n?"row":r??"column",y=i.useMemo(()=>zB({spacing:l,direction:b}),[l,b]),x=!!f,w=!h&&!x,S=i.useMemo(()=>{const _=rg(d);return w?_:_.map((I,E)=>{const M=typeof I.key<"u"?I.key:E,D=E+1===_.length,N=h?a.jsx(L5,{children:I},M):I;if(!x)return N;const O=i.cloneElement(f,{__css:y}),T=D?null:O;return a.jsxs(i.Fragment,{children:[N,T]},M)})},[f,y,x,w,h,d]),j=et("chakra-stack",m);return a.jsx(je.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:x?void 0:l,className:j,...g,children:S})});dy.displayName="Stack";var F5=_e((e,t)=>a.jsx(dy,{align:"center",...e,direction:"column",ref:t}));F5.displayName="VStack";var ug=_e((e,t)=>a.jsx(dy,{align:"center",...e,direction:"row",ref:t}));ug.displayName="HStack";function BS(e){return $5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Sd=_e(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:l,rowEnd:c,rowSpan:d,rowStart:f,...m}=t,h=vI({gridArea:r,gridColumn:BS(o),gridRow:BS(d),gridColumnStart:s,gridColumnEnd:l,gridRowStart:f,gridRowEnd:c});return a.jsx(je.div,{ref:n,__css:h,...m})});Sd.displayName="GridItem";var Sa=_e(function(t,n){const r=ml("Badge",t),{className:o,...s}=cn(t);return a.jsx(je.span,{ref:n,className:et("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Sa.displayName="Badge";var On=_e(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:l,borderWidth:c,borderStyle:d,borderColor:f,...m}=ml("Divider",t),{className:h,orientation:g="horizontal",__css:b,...y}=cn(t),x={vertical:{borderLeftWidth:r||l||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return a.jsx(je.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:f,borderStyle:d,...x[g],...b},className:et("chakra-divider",h)})});On.displayName="Divider";function BB(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function HB(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=i.useState([]),s=i.useRef(),l=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{l(),s.current=setTimeout(()=>{o([]),s.current=null},t)};i.useEffect(()=>l,[]);function d(f){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(BB(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),f(h.join("")),c()}}}return d}function WB(e,t,n,r){if(t==null)return r;if(!r)return e.find(l=>n(l).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 VB(){const e=i.useRef(new Map),t=e.current,n=i.useCallback((o,s,l,c)=>{e.current.set(l,{type:s,el:o,options:c}),o.addEventListener(s,l,c)},[]),r=i.useCallback((o,s,l,c)=>{o.removeEventListener(s,l,c),e.current.delete(l)},[]);return i.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 z5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:l,onMouseUp:c,onClick:d,onKeyDown:f,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:b,...y}=e,[x,w]=i.useState(!0),[S,j]=i.useState(!1),_=VB(),I=V=>{V&&V.tagName!=="BUTTON"&&w(!1)},E=x?h:h||0,M=n&&!r,D=i.useCallback(V=>{if(n){V.stopPropagation(),V.preventDefault();return}V.currentTarget.focus(),d==null||d(V)},[n,d]),R=i.useCallback(V=>{S&&Wv(V)&&(V.preventDefault(),V.stopPropagation(),j(!1),_.remove(document,"keyup",R,!1))},[S,_]),N=i.useCallback(V=>{if(f==null||f(V),n||V.defaultPrevented||V.metaKey||!Wv(V.nativeEvent)||x)return;const se=o&&V.key==="Enter";s&&V.key===" "&&(V.preventDefault(),j(!0)),se&&(V.preventDefault(),V.currentTarget.click()),_.add(document,"keyup",R,!1)},[n,x,f,o,s,_,R]),O=i.useCallback(V=>{if(m==null||m(V),n||V.defaultPrevented||V.metaKey||!Wv(V.nativeEvent)||x)return;s&&V.key===" "&&(V.preventDefault(),j(!1),V.currentTarget.click())},[s,x,n,m]),T=i.useCallback(V=>{V.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),U=i.useCallback(V=>{if(V.button!==0)return;if(n){V.stopPropagation(),V.preventDefault();return}x||j(!0),V.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),l==null||l(V)},[n,x,l,_,T]),G=i.useCallback(V=>{V.button===0&&(x||j(!1),c==null||c(V))},[c,x]),q=i.useCallback(V=>{if(n){V.preventDefault();return}g==null||g(V)},[n,g]),Y=i.useCallback(V=>{S&&(V.preventDefault(),j(!1)),b==null||b(V)},[S,b]),Q=Et(t,I);return x?{...y,ref:Q,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:D,onMouseDown:l,onMouseUp:c,onKeyUp:m,onKeyDown:f,onMouseOver:g,onMouseLeave:b}:{...y,ref:Q,role:"button","data-active":ut(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:E,onClick:D,onMouseDown:U,onMouseUp:G,onKeyUp:O,onKeyDown:N,onMouseOver:q,onMouseLeave:Y}}function UB(e){const t=e.current;if(!t)return!1;const n=yB(t);return!n||t.contains(n)?!1:!!_B(n)}function B5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;ba(()=>{if(!s||UB(e))return;const l=(o==null?void 0:o.current)||e.current;let c;if(l)return c=requestAnimationFrame(()=>{l.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var GB={preventScroll:!0,shouldFocus:!1};function KB(e,t=GB){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,l=qB(e)?e.current:e,c=o&&s,d=i.useRef(c),f=i.useRef(s);dc(()=>{!f.current&&s&&(d.current=c),f.current=s},[s,c]);const m=i.useCallback(()=>{if(!(!s||!l||!d.current)&&(d.current=!1,!l.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=D5(l);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,l,n]);ba(()=>{m()},[m]),Ul(l,"transitionend",m)}function qB(e){return"current"in e}var Li=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Fn={arrowShadowColor:Li("--popper-arrow-shadow-color"),arrowSize:Li("--popper-arrow-size","8px"),arrowSizeHalf:Li("--popper-arrow-size-half"),arrowBg:Li("--popper-arrow-bg"),transformOrigin:Li("--popper-transform-origin"),arrowOffset:Li("--popper-arrow-offset")};function XB(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 QB={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"},YB=e=>QB[e],HS={scroll:!0,resize:!0};function ZB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...HS,...e}}:t={enabled:e,options:HS},t}var JB={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`}},eH={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{WS(e)},effect:({state:e})=>()=>{WS(e)}},WS=e=>{e.elements.popper.style.setProperty(Fn.transformOrigin.var,YB(e.placement))},tH={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{nH(e)}},nH=e=>{var t;if(!e.placement)return;const n=rH(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Fn.arrowSize.varRef,height:Fn.arrowSize.varRef,zIndex:-1});const r={[Fn.arrowSizeHalf.var]:`calc(${Fn.arrowSize.varRef} / 2 - 1px)`,[Fn.arrowOffset.var]:`calc(${Fn.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},rH=e=>{if(e.startsWith("top"))return{property:"bottom",value:Fn.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Fn.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Fn.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Fn.arrowOffset.varRef}},oH={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{VS(e)},effect:({state:e})=>()=>{VS(e)}},VS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=XB(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Fn.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},sH={"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"}},aH={"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 lH(e,t="ltr"){var n,r;const o=((n=sH[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=aH[e])!=null?r:o}var Lr="top",_o="bottom",Io="right",Fr="left",fy="auto",tf=[Lr,_o,Io,Fr],Ic="start",kd="end",iH="clippingParents",H5="viewport",Lu="popper",cH="reference",US=tf.reduce(function(e,t){return e.concat([t+"-"+Ic,t+"-"+kd])},[]),W5=[].concat(tf,[fy]).reduce(function(e,t){return e.concat([t,t+"-"+Ic,t+"-"+kd])},[]),uH="beforeRead",dH="read",fH="afterRead",pH="beforeMain",mH="main",hH="afterMain",gH="beforeWrite",vH="write",bH="afterWrite",xH=[uH,dH,fH,pH,mH,hH,gH,vH,bH];function Es(e){return e?(e.nodeName||"").toLowerCase():null}function so(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ei(e){var t=so(e).Element;return e instanceof t||e instanceof Element}function So(e){var t=so(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function py(e){if(typeof ShadowRoot>"u")return!1;var t=so(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function yH(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];!So(s)||!Es(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(l){var c=o[l];c===!1?s.removeAttribute(l):s.setAttribute(l,c===!0?"":c)}))})}function CH(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]||{},l=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=l.reduce(function(d,f){return d[f]="",d},{});!So(o)||!Es(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const wH={name:"applyStyles",enabled:!0,phase:"write",fn:yH,effect:CH,requires:["computeStyles"]};function Is(e){return e.split("-")[0]}var Gl=Math.max,Nm=Math.min,Pc=Math.round;function cb(){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 V5(){return!/^((?!chrome|android).)*safari/i.test(cb())}function Ec(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&So(e)&&(o=e.offsetWidth>0&&Pc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Pc(r.height)/e.offsetHeight||1);var l=ei(e)?so(e):window,c=l.visualViewport,d=!V5()&&n,f=(r.left+(d&&c?c.offsetLeft:0))/o,m=(r.top+(d&&c?c.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:f+h,bottom:m+g,left:f,x:f,y:m}}function my(e){var t=Ec(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 U5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&py(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ca(e){return so(e).getComputedStyle(e)}function SH(e){return["table","td","th"].indexOf(Es(e))>=0}function gl(e){return((ei(e)?e.ownerDocument:e.document)||window.document).documentElement}function dg(e){return Es(e)==="html"?e:e.assignedSlot||e.parentNode||(py(e)?e.host:null)||gl(e)}function GS(e){return!So(e)||ca(e).position==="fixed"?null:e.offsetParent}function kH(e){var t=/firefox/i.test(cb()),n=/Trident/i.test(cb());if(n&&So(e)){var r=ca(e);if(r.position==="fixed")return null}var o=dg(e);for(py(o)&&(o=o.host);So(o)&&["html","body"].indexOf(Es(o))<0;){var s=ca(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 nf(e){for(var t=so(e),n=GS(e);n&&SH(n)&&ca(n).position==="static";)n=GS(n);return n&&(Es(n)==="html"||Es(n)==="body"&&ca(n).position==="static")?t:n||kH(e)||t}function hy(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function ad(e,t,n){return Gl(e,Nm(t,n))}function jH(e,t,n){var r=ad(e,t,n);return r>n?n:r}function G5(){return{top:0,right:0,bottom:0,left:0}}function K5(e){return Object.assign({},G5(),e)}function q5(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var _H=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,K5(typeof t!="number"?t:q5(t,tf))};function IH(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,l=n.modifiersData.popperOffsets,c=Is(n.placement),d=hy(c),f=[Fr,Io].indexOf(c)>=0,m=f?"height":"width";if(!(!s||!l)){var h=_H(o.padding,n),g=my(s),b=d==="y"?Lr:Fr,y=d==="y"?_o:Io,x=n.rects.reference[m]+n.rects.reference[d]-l[d]-n.rects.popper[m],w=l[d]-n.rects.reference[d],S=nf(s),j=S?d==="y"?S.clientHeight||0:S.clientWidth||0:0,_=x/2-w/2,I=h[b],E=j-g[m]-h[y],M=j/2-g[m]/2+_,D=ad(I,M,E),R=d;n.modifiersData[r]=(t={},t[R]=D,t.centerOffset=D-M,t)}}function PH(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)||U5(t.elements.popper,o)&&(t.elements.arrow=o))}const EH={name:"arrow",enabled:!0,phase:"main",fn:IH,effect:PH,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Mc(e){return e.split("-")[1]}var MH={top:"auto",right:"auto",bottom:"auto",left:"auto"};function OH(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:Pc(n*o)/o||0,y:Pc(r*o)/o||0}}function KS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,l=e.offsets,c=e.position,d=e.gpuAcceleration,f=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=l.x,b=g===void 0?0:g,y=l.y,x=y===void 0?0:y,w=typeof m=="function"?m({x:b,y:x}):{x:b,y:x};b=w.x,x=w.y;var S=l.hasOwnProperty("x"),j=l.hasOwnProperty("y"),_=Fr,I=Lr,E=window;if(f){var M=nf(n),D="clientHeight",R="clientWidth";if(M===so(n)&&(M=gl(n),ca(M).position!=="static"&&c==="absolute"&&(D="scrollHeight",R="scrollWidth")),M=M,o===Lr||(o===Fr||o===Io)&&s===kd){I=_o;var N=h&&M===E&&E.visualViewport?E.visualViewport.height:M[D];x-=N-r.height,x*=d?1:-1}if(o===Fr||(o===Lr||o===_o)&&s===kd){_=Io;var O=h&&M===E&&E.visualViewport?E.visualViewport.width:M[R];b-=O-r.width,b*=d?1:-1}}var T=Object.assign({position:c},f&&MH),U=m===!0?OH({x:b,y:x},so(n)):{x:b,y:x};if(b=U.x,x=U.y,d){var G;return Object.assign({},T,(G={},G[I]=j?"0":"",G[_]=S?"0":"",G.transform=(E.devicePixelRatio||1)<=1?"translate("+b+"px, "+x+"px)":"translate3d("+b+"px, "+x+"px, 0)",G))}return Object.assign({},T,(t={},t[I]=j?x+"px":"",t[_]=S?b+"px":"",t.transform="",t))}function DH(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,l=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,f={placement:Is(t.placement),variation:Mc(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,KS(Object.assign({},f,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:l,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,KS(Object.assign({},f,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const RH={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:DH,data:{}};var jp={passive:!0};function AH(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,l=r.resize,c=l===void 0?!0:l,d=so(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&f.forEach(function(m){m.addEventListener("scroll",n.update,jp)}),c&&d.addEventListener("resize",n.update,jp),function(){s&&f.forEach(function(m){m.removeEventListener("scroll",n.update,jp)}),c&&d.removeEventListener("resize",n.update,jp)}}const TH={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:AH,data:{}};var NH={left:"right",right:"left",bottom:"top",top:"bottom"};function am(e){return e.replace(/left|right|bottom|top/g,function(t){return NH[t]})}var $H={start:"end",end:"start"};function qS(e){return e.replace(/start|end/g,function(t){return $H[t]})}function gy(e){var t=so(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function vy(e){return Ec(gl(e)).left+gy(e).scrollLeft}function LH(e,t){var n=so(e),r=gl(e),o=n.visualViewport,s=r.clientWidth,l=r.clientHeight,c=0,d=0;if(o){s=o.width,l=o.height;var f=V5();(f||!f&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:l,x:c+vy(e),y:d}}function FH(e){var t,n=gl(e),r=gy(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Gl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),l=Gl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+vy(e),d=-r.scrollTop;return ca(o||n).direction==="rtl"&&(c+=Gl(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:l,x:c,y:d}}function by(e){var t=ca(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function X5(e){return["html","body","#document"].indexOf(Es(e))>=0?e.ownerDocument.body:So(e)&&by(e)?e:X5(dg(e))}function ld(e,t){var n;t===void 0&&(t=[]);var r=X5(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=so(r),l=o?[s].concat(s.visualViewport||[],by(r)?r:[]):r,c=t.concat(l);return o?c:c.concat(ld(dg(l)))}function ub(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function zH(e,t){var n=Ec(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 XS(e,t,n){return t===H5?ub(LH(e,n)):ei(t)?zH(t,n):ub(FH(gl(e)))}function BH(e){var t=ld(dg(e)),n=["absolute","fixed"].indexOf(ca(e).position)>=0,r=n&&So(e)?nf(e):e;return ei(r)?t.filter(function(o){return ei(o)&&U5(o,r)&&Es(o)!=="body"}):[]}function HH(e,t,n,r){var o=t==="clippingParents"?BH(e):[].concat(t),s=[].concat(o,[n]),l=s[0],c=s.reduce(function(d,f){var m=XS(e,f,r);return d.top=Gl(m.top,d.top),d.right=Nm(m.right,d.right),d.bottom=Nm(m.bottom,d.bottom),d.left=Gl(m.left,d.left),d},XS(e,l,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function Q5(e){var t=e.reference,n=e.element,r=e.placement,o=r?Is(r):null,s=r?Mc(r):null,l=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case Lr:d={x:l,y:t.y-n.height};break;case _o:d={x:l,y:t.y+t.height};break;case Io:d={x:t.x+t.width,y:c};break;case Fr:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var f=o?hy(o):null;if(f!=null){var m=f==="y"?"height":"width";switch(s){case Ic:d[f]=d[f]-(t[m]/2-n[m]/2);break;case kd:d[f]=d[f]+(t[m]/2-n[m]/2);break}}return d}function jd(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,l=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?iH:c,f=n.rootBoundary,m=f===void 0?H5:f,h=n.elementContext,g=h===void 0?Lu:h,b=n.altBoundary,y=b===void 0?!1:b,x=n.padding,w=x===void 0?0:x,S=K5(typeof w!="number"?w:q5(w,tf)),j=g===Lu?cH:Lu,_=e.rects.popper,I=e.elements[y?j:g],E=HH(ei(I)?I:I.contextElement||gl(e.elements.popper),d,m,l),M=Ec(e.elements.reference),D=Q5({reference:M,element:_,strategy:"absolute",placement:o}),R=ub(Object.assign({},_,D)),N=g===Lu?R:M,O={top:E.top-N.top+S.top,bottom:N.bottom-E.bottom+S.bottom,left:E.left-N.left+S.left,right:N.right-E.right+S.right},T=e.modifiersData.offset;if(g===Lu&&T){var U=T[o];Object.keys(O).forEach(function(G){var q=[Io,_o].indexOf(G)>=0?1:-1,Y=[Lr,_o].indexOf(G)>=0?"y":"x";O[G]+=U[Y]*q})}return O}function WH(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,l=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,f=d===void 0?W5:d,m=Mc(r),h=m?c?US:US.filter(function(y){return Mc(y)===m}):tf,g=h.filter(function(y){return f.indexOf(y)>=0});g.length===0&&(g=h);var b=g.reduce(function(y,x){return y[x]=jd(e,{placement:x,boundary:o,rootBoundary:s,padding:l})[Is(x)],y},{});return Object.keys(b).sort(function(y,x){return b[y]-b[x]})}function VH(e){if(Is(e)===fy)return[];var t=am(e);return[qS(e),t,qS(t)]}function UH(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,l=n.altAxis,c=l===void 0?!0:l,d=n.fallbackPlacements,f=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,x=n.allowedAutoPlacements,w=t.options.placement,S=Is(w),j=S===w,_=d||(j||!y?[am(w)]:VH(w)),I=[w].concat(_).reduce(function(re,A){return re.concat(Is(A)===fy?WH(t,{placement:A,boundary:m,rootBoundary:h,padding:f,flipVariations:y,allowedAutoPlacements:x}):A)},[]),E=t.rects.reference,M=t.rects.popper,D=new Map,R=!0,N=I[0],O=0;O<I.length;O++){var T=I[O],U=Is(T),G=Mc(T)===Ic,q=[Lr,_o].indexOf(U)>=0,Y=q?"width":"height",Q=jd(t,{placement:T,boundary:m,rootBoundary:h,altBoundary:g,padding:f}),V=q?G?Io:Fr:G?_o:Lr;E[Y]>M[Y]&&(V=am(V));var se=am(V),ee=[];if(s&&ee.push(Q[U]<=0),c&&ee.push(Q[V]<=0,Q[se]<=0),ee.every(function(re){return re})){N=T,R=!1;break}D.set(T,ee)}if(R)for(var le=y?3:1,ae=function(A){var L=I.find(function(K){var ne=D.get(K);if(ne)return ne.slice(0,A).every(function(z){return z})});if(L)return N=L,"break"},ce=le;ce>0;ce--){var J=ae(ce);if(J==="break")break}t.placement!==N&&(t.modifiersData[r]._skip=!0,t.placement=N,t.reset=!0)}}const GH={name:"flip",enabled:!0,phase:"main",fn:UH,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 YS(e){return[Lr,Io,_o,Fr].some(function(t){return e[t]>=0})}function KH(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,l=jd(t,{elementContext:"reference"}),c=jd(t,{altBoundary:!0}),d=QS(l,r),f=QS(c,o,s),m=YS(d),h=YS(f);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:f,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const qH={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:KH};function XH(e,t,n){var r=Is(e),o=[Fr,Lr].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,l=s[0],c=s[1];return l=l||0,c=(c||0)*o,[Fr,Io].indexOf(r)>=0?{x:c,y:l}:{x:l,y:c}}function QH(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,l=W5.reduce(function(m,h){return m[h]=XH(h,t.rects,s),m},{}),c=l[t.placement],d=c.x,f=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=f),t.modifiersData[r]=l}const YH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:QH};function ZH(e){var t=e.state,n=e.name;t.modifiersData[n]=Q5({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const JH={name:"popperOffsets",enabled:!0,phase:"read",fn:ZH,data:{}};function eW(e){return e==="x"?"y":"x"}function tW(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,l=n.altAxis,c=l===void 0?!1:l,d=n.boundary,f=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,b=g===void 0?!0:g,y=n.tetherOffset,x=y===void 0?0:y,w=jd(t,{boundary:d,rootBoundary:f,padding:h,altBoundary:m}),S=Is(t.placement),j=Mc(t.placement),_=!j,I=hy(S),E=eW(I),M=t.modifiersData.popperOffsets,D=t.rects.reference,R=t.rects.popper,N=typeof x=="function"?x(Object.assign({},t.rects,{placement:t.placement})):x,O=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,U={x:0,y:0};if(M){if(s){var G,q=I==="y"?Lr:Fr,Y=I==="y"?_o:Io,Q=I==="y"?"height":"width",V=M[I],se=V+w[q],ee=V-w[Y],le=b?-R[Q]/2:0,ae=j===Ic?D[Q]:R[Q],ce=j===Ic?-R[Q]:-D[Q],J=t.elements.arrow,re=b&&J?my(J):{width:0,height:0},A=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:G5(),L=A[q],K=A[Y],ne=ad(0,D[Q],re[Q]),z=_?D[Q]/2-le-ne-L-O.mainAxis:ae-ne-L-O.mainAxis,oe=_?-D[Q]/2+le+ne+K+O.mainAxis:ce+ne+K+O.mainAxis,X=t.elements.arrow&&nf(t.elements.arrow),Z=X?I==="y"?X.clientTop||0:X.clientLeft||0:0,me=(G=T==null?void 0:T[I])!=null?G:0,ve=V+z-me-Z,de=V+oe-me,ke=ad(b?Nm(se,ve):se,V,b?Gl(ee,de):ee);M[I]=ke,U[I]=ke-V}if(c){var we,Re=I==="x"?Lr:Fr,Qe=I==="x"?_o:Io,$e=M[E],vt=E==="y"?"height":"width",it=$e+w[Re],ot=$e-w[Qe],Ce=[Lr,Fr].indexOf(S)!==-1,Me=(we=T==null?void 0:T[E])!=null?we:0,qe=Ce?it:$e-D[vt]-R[vt]-Me+O.altAxis,dt=Ce?$e+D[vt]+R[vt]-Me-O.altAxis:ot,ye=b&&Ce?jH(qe,$e,dt):ad(b?qe:it,$e,b?dt:ot);M[E]=ye,U[E]=ye-$e}t.modifiersData[r]=U}}const nW={name:"preventOverflow",enabled:!0,phase:"main",fn:tW,requiresIfExists:["offset"]};function rW(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function oW(e){return e===so(e)||!So(e)?gy(e):rW(e)}function sW(e){var t=e.getBoundingClientRect(),n=Pc(t.width)/e.offsetWidth||1,r=Pc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function aW(e,t,n){n===void 0&&(n=!1);var r=So(t),o=So(t)&&sW(t),s=gl(t),l=Ec(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((Es(t)!=="body"||by(s))&&(c=oW(t)),So(t)?(d=Ec(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=vy(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function lW(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 l=[].concat(s.requires||[],s.requiresIfExists||[]);l.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 iW(e){var t=lW(e);return xH.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function cW(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function uW(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 ZS={placement:"bottom",modifiers:[],strategy:"absolute"};function JS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function dW(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?ZS:o;return function(c,d,f){f===void 0&&(f=s);var m={placement:"bottom",orderedModifiers:[],options:Object.assign({},ZS,s),modifiersData:{},elements:{reference:c,popper:d},attributes:{},styles:{}},h=[],g=!1,b={state:m,setOptions:function(S){var j=typeof S=="function"?S(m.options):S;x(),m.options=Object.assign({},s,m.options,j),m.scrollParents={reference:ei(c)?ld(c):c.contextElement?ld(c.contextElement):[],popper:ld(d)};var _=iW(uW([].concat(r,m.options.modifiers)));return m.orderedModifiers=_.filter(function(I){return I.enabled}),y(),b.update()},forceUpdate:function(){if(!g){var S=m.elements,j=S.reference,_=S.popper;if(JS(j,_)){m.rects={reference:aW(j,nf(_),m.options.strategy==="fixed"),popper:my(_)},m.reset=!1,m.placement=m.options.placement,m.orderedModifiers.forEach(function(O){return m.modifiersData[O.name]=Object.assign({},O.data)});for(var I=0;I<m.orderedModifiers.length;I++){if(m.reset===!0){m.reset=!1,I=-1;continue}var E=m.orderedModifiers[I],M=E.fn,D=E.options,R=D===void 0?{}:D,N=E.name;typeof M=="function"&&(m=M({state:m,options:R,name:N,instance:b})||m)}}}},update:cW(function(){return new Promise(function(w){b.forceUpdate(),w(m)})}),destroy:function(){x(),g=!0}};if(!JS(c,d))return b;b.setOptions(f).then(function(w){!g&&f.onFirstUpdate&&f.onFirstUpdate(w)});function y(){m.orderedModifiers.forEach(function(w){var S=w.name,j=w.options,_=j===void 0?{}:j,I=w.effect;if(typeof I=="function"){var E=I({state:m,name:S,instance:b,options:_}),M=function(){};h.push(E||M)}})}function x(){h.forEach(function(w){return w()}),h=[]}return b}}var fW=[TH,JH,RH,wH,YH,GH,nW,EH,qH],pW=dW({defaultModifiers:fW});function xy(e={}){const{enabled:t=!0,modifiers:n,placement:r="bottom",strategy:o="absolute",arrowPadding:s=8,eventListeners:l=!0,offset:c,gutter:d=8,flip:f=!0,boundary:m="clippingParents",preventOverflow:h=!0,matchWidth:g,direction:b="ltr"}=e,y=i.useRef(null),x=i.useRef(null),w=i.useRef(null),S=lH(r,b),j=i.useRef(()=>{}),_=i.useCallback(()=>{var O;!t||!y.current||!x.current||((O=j.current)==null||O.call(j),w.current=pW(y.current,x.current,{placement:S,modifiers:[oH,tH,eH,{...JB,enabled:!!g},{name:"eventListeners",...ZB(l)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:c??[0,d]}},{name:"flip",enabled:!!f,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,l,s,c,d,f,h,m,o]);i.useEffect(()=>()=>{var O;!y.current&&!x.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const I=i.useCallback(O=>{y.current=O,_()},[_]),E=i.useCallback((O={},T=null)=>({...O,ref:Et(I,T)}),[I]),M=i.useCallback(O=>{x.current=O,_()},[_]),D=i.useCallback((O={},T=null)=>({...O,ref:Et(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),R=i.useCallback((O={},T=null)=>{const{size:U,shadowColor:G,bg:q,style:Y,...Q}=O;return{...Q,ref:T,"data-popper-arrow":"",style:mW(O)}},[]),N=i.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:Fn.transformOrigin.varRef,referenceRef:I,popperRef:M,getPopperProps:D,getArrowProps:R,getArrowInnerProps:N,getReferenceProps:E}}function mW(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 yy(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=gn(n),l=gn(t),[c,d]=i.useState(e.defaultIsOpen||!1),f=r!==void 0?r:c,m=r!==void 0,h=i.useId(),g=o??`disclosure-${h}`,b=i.useCallback(()=>{m||d(!1),l==null||l()},[m,l]),y=i.useCallback(()=>{m||d(!0),s==null||s()},[m,s]),x=i.useCallback(()=>{f?b():y()},[f,y,b]);function w(j={}){return{...j,"aria-expanded":f,"aria-controls":g,onClick(_){var I;(I=j.onClick)==null||I.call(j,_),x()}}}function S(j={}){return{...j,hidden:!f,id:g}}return{isOpen:f,onOpen:y,onClose:b,onToggle:x,isControlled:m,getButtonProps:w,getDisclosureProps:S}}function hW(e){const{ref:t,handler:n,enabled:r=!0}=e,o=gn(n),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;i.useEffect(()=>{if(!r)return;const c=h=>{Vv(h,t)&&(l.isPointerDown=!0)},d=h=>{if(l.ignoreEmulatedMouseEvents){l.ignoreEmulatedMouseEvents=!1;return}l.isPointerDown&&n&&Vv(h,t)&&(l.isPointerDown=!1,o(h))},f=h=>{l.ignoreEmulatedMouseEvents=!0,n&&l.isPointerDown&&Vv(h,t)&&(l.isPointerDown=!1,o(h))},m=Y5(t.current);return m.addEventListener("mousedown",c,!0),m.addEventListener("mouseup",d,!0),m.addEventListener("touchstart",c,!0),m.addEventListener("touchend",f,!0),()=>{m.removeEventListener("mousedown",c,!0),m.removeEventListener("mouseup",d,!0),m.removeEventListener("touchstart",c,!0),m.removeEventListener("touchend",f,!0)}},[n,t,o,l,r])}function Vv(e,t){var n;const r=e.target;return r&&!Y5(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function Y5(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Z5(e){const{isOpen:t,ref:n}=e,[r,o]=i.useState(t),[s,l]=i.useState(!1);return i.useEffect(()=>{s||(o(t),l(!0))},[t,s,r]),Ul(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const f=xB(n.current),m=new f.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(m)}}}function Cy(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[gW,vW,bW,xW]=Vx(),[yW,rf]=Kt({strict:!1,name:"MenuContext"});function CW(e,...t){const n=i.useId(),r=e||n;return i.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function J5(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function e4(e){return J5(e).activeElement===e}function wW(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:l,isOpen:c,defaultIsOpen:d,onClose:f,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:b,computePositionOnMount:y=!1,...x}=e,w=i.useRef(null),S=i.useRef(null),j=bW(),_=i.useCallback(()=>{requestAnimationFrame(()=>{var J;(J=w.current)==null||J.focus({preventScroll:!1})})},[]),I=i.useCallback(()=>{const J=setTimeout(()=>{var re;if(o)(re=o.current)==null||re.focus();else{const A=j.firstEnabled();A&&G(A.index)}});se.current.add(J)},[j,o]),E=i.useCallback(()=>{const J=setTimeout(()=>{const re=j.lastEnabled();re&&G(re.index)});se.current.add(J)},[j]),M=i.useCallback(()=>{m==null||m(),s?I():_()},[s,I,_,m]),{isOpen:D,onOpen:R,onClose:N,onToggle:O}=yy({isOpen:c,defaultIsOpen:d,onClose:f,onOpen:M});hW({enabled:D&&r,ref:w,handler:J=>{var re;(re=S.current)!=null&&re.contains(J.target)||N()}});const T=xy({...x,enabled:D||y,placement:h,direction:b}),[U,G]=i.useState(-1);ba(()=>{D||G(-1)},[D]),B5(w,{focusRef:S,visible:D,shouldFocus:!0});const q=Z5({isOpen:D,ref:w}),[Y,Q]=CW(t,"menu-button","menu-list"),V=i.useCallback(()=>{R(),_()},[R,_]),se=i.useRef(new Set([]));i.useEffect(()=>{const J=se.current;return()=>{J.forEach(re=>clearTimeout(re)),J.clear()}},[]);const ee=i.useCallback(()=>{R(),I()},[I,R]),le=i.useCallback(()=>{R(),E()},[R,E]),ae=i.useCallback(()=>{var J,re;const A=J5(w.current),L=(J=w.current)==null?void 0:J.contains(A.activeElement);if(!(D&&!L))return;const ne=(re=j.item(U))==null?void 0:re.node;ne==null||ne.focus({preventScroll:!0})},[D,U,j]),ce=i.useRef(null);return{openAndFocusMenu:V,openAndFocusFirstItem:ee,openAndFocusLastItem:le,onTransitionEnd:ae,unstable__animationState:q,descendants:j,popper:T,buttonId:Y,menuId:Q,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:D,onToggle:O,onOpen:R,onClose:N,menuRef:w,buttonRef:S,focusedIndex:U,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:G,isLazy:l,lazyBehavior:g,initialFocusRef:o,rafId:ce}}function SW(e={},t=null){const n=rf(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:l}=n,c=i.useCallback(d=>{const f=d.key,h={Enter:s,ArrowDown:s,ArrowUp:l}[f];h&&(d.preventDefault(),d.stopPropagation(),h(d))},[s,l]);return{...e,ref:Et(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":ut(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:ze(e.onClick,r),onKeyDown:ze(e.onKeyDown,c)}}function db(e){var t;return IW(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function kW(e={},t=null){const n=rf();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within <Menu>");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:l,onClose:c,menuId:d,isLazy:f,lazyBehavior:m,unstable__animationState:h}=n,g=vW(),b=HB({preventDefault:S=>S.key!==" "&&db(S.target)}),y=i.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 E=b(M=>{const D=WB(g.values(),M,R=>{var N,O;return(O=(N=R==null?void 0:R.node)==null?void 0:N.textContent)!=null?O:""},g.item(r));if(D){const R=g.indexOf(D.node);o(R)}});db(S.target)&&E(S)},[g,r,b,c,o]),x=i.useRef(!1);l&&(x.current=!0);const w=Cy({wasSelected:x.current,enabled:f,mode:m,isSelected:h.present});return{...e,ref:Et(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:ze(e.onKeyDown,y)}}function jW(e={}){const{popper:t,isOpen:n}=rf();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function _W(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:l,isDisabled:c,isFocusable:d,closeOnSelect:f,type:m,...h}=e,g=rf(),{setFocusedIndex:b,focusedIndex:y,closeOnSelect:x,onClose:w,menuRef:S,isOpen:j,menuId:_,rafId:I}=g,E=i.useRef(null),M=`${_}-menuitem-${i.useId()}`,{index:D,register:R}=xW({disabled:c&&!d}),N=i.useCallback(V=>{n==null||n(V),!c&&b(D)},[b,D,c,n]),O=i.useCallback(V=>{r==null||r(V),E.current&&!e4(E.current)&&N(V)},[N,r]),T=i.useCallback(V=>{o==null||o(V),!c&&b(-1)},[b,c,o]),U=i.useCallback(V=>{s==null||s(V),db(V.currentTarget)&&(f??x)&&w()},[w,s,x,f]),G=i.useCallback(V=>{l==null||l(V),b(D)},[b,l,D]),q=D===y,Y=c&&!d;ba(()=>{if(j)return q&&!Y&&E.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var V;(V=E.current)==null||V.focus({preventScroll:!0}),I.current=null})):S.current&&!e4(S.current)&&S.current.focus({preventScroll:!0}),()=>{I.current&&cancelAnimationFrame(I.current)}},[q,Y,S,j]);const Q=z5({onClick:U,onFocus:G,onMouseEnter:N,onMouseMove:O,onMouseLeave:T,ref:Et(R,E,t),isDisabled:c,isFocusable:d});return{...h,...Q,type:m??Q.type,id:M,role:"menuitem",tabIndex:q?0:-1}}function IW(e){var t;if(!PW(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function PW(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}var[EW,li]=Kt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />" `}),of=e=>{const{children:t}=e,n=Xn("Menu",e),r=cn(e),{direction:o}=Hd(),{descendants:s,...l}=wW({...r,direction:o}),c=i.useMemo(()=>l,[l]),{isOpen:d,onClose:f,forceUpdate:m}=c;return a.jsx(gW,{value:s,children:a.jsx(yW,{value:c,children:a.jsx(EW,{value:n,children:bx(t,{isOpen:d,onClose:f,forceUpdate:m})})})})};of.displayName="Menu";var e6=_e((e,t)=>{const n=li();return a.jsx(je.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});e6.displayName="MenuCommand";var MW=_e((e,t)=>{const{type:n,...r}=e,o=li(),s=r.as||n?n??void 0:"button",l=i.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(je.button,{ref:t,type:s,...r,__css:l})}),t6=e=>{const{className:t,children:n,...r}=e,o=li(),s=i.Children.only(n),l=i.isValidElement(s)?i.cloneElement(s,{focusable:"false","aria-hidden":!0,className:et("chakra-menu__icon",s.props.className)}):null,c=et("chakra-menu__icon-wrapper",t);return a.jsx(je.span,{className:c,...r,__css:o.icon,children:l})};t6.displayName="MenuIcon";var At=_e((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:l,...c}=e,d=_W(c,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:l}):l;return a.jsxs(MW,{...d,className:et("chakra-menu__menuitem",d.className),children:[n&&a.jsx(t6,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(e6,{marginStart:s,children:o})]})});At.displayName="MenuItem";var OW={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"}}},DW=je(Mn.div),al=_e(function(t,n){var r,o;const{rootProps:s,motionProps:l,...c}=t,{isOpen:d,onTransitionEnd:f,unstable__animationState:m}=rf(),h=kW(c,n),g=jW(s),b=li();return a.jsx(je.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:a.jsx(DW,{variants:OW,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...l,className:et("chakra-menu__menu-list",h.className),...h,onUpdate:f,onAnimationComplete:Uh(m.onComplete,h.onAnimationComplete)})})});al.displayName="MenuList";var _d=_e((e,t)=>{const{title:n,children:r,className:o,...s}=e,l=et("chakra-menu__group__title",o),c=li();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(je.p,{className:l,...s,__css:c.groupTitle,children:n}),r]})});_d.displayName="MenuGroup";var RW=_e((e,t)=>{const n=li();return a.jsx(je.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),sf=_e((e,t)=>{const{children:n,as:r,...o}=e,s=SW(o,t),l=r||RW;return a.jsx(l,{...s,className:et("chakra-menu__menu-button",e.className),children:a.jsx(je.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});sf.displayName="MenuButton";var n6=e=>{const{className:t,...n}=e,r=li();return a.jsx(je.hr,{"aria-orientation":"horizontal",className:et("chakra-menu__divider",t),...n,__css:r.divider})};n6.displayName="MenuDivider";var AW={slideInBottom:{...Xu,custom:{offsetY:16,reverse:!0}},slideInRight:{...Xu,custom:{offsetX:16,reverse:!0}},slideInTop:{...Xu,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...Xu,custom:{offsetX:-16,reverse:!0}},scale:{...R3,custom:{initialScale:.95,reverse:!0}},none:{}},TW=je(Mn.section),NW=e=>AW[e||"none"],r6=i.forwardRef((e,t)=>{const{preset:n,motionProps:r=NW(n),...o}=e;return a.jsx(TW,{ref:t,...r,...o})});r6.displayName="ModalTransition";var $W=Object.defineProperty,LW=(e,t,n)=>t in e?$W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FW=(e,t,n)=>(LW(e,typeof t!="symbol"?t+"":t,n),n),zW=class{constructor(){FW(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}},fb=new zW;function o6(e,t){const[n,r]=i.useState(0);return i.useEffect(()=>{const o=e.current;if(o){if(t){const s=fb.add(o);r(s)}return()=>{fb.remove(o),r(0)}}},[t,e]),n}var BW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fi=new WeakMap,_p=new WeakMap,Ip={},Uv=0,s6=function(e){return e&&(e.host||s6(e.parentNode))},HW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=s6(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})},WW=function(e,t,n,r){var o=HW(t,Array.isArray(e)?e:[e]);Ip[n]||(Ip[n]=new WeakMap);var s=Ip[n],l=[],c=new Set,d=new Set(o),f=function(h){!h||c.has(h)||(c.add(h),f(h.parentNode))};o.forEach(f);var m=function(h){!h||d.has(h)||Array.prototype.forEach.call(h.children,function(g){if(c.has(g))m(g);else{var b=g.getAttribute(r),y=b!==null&&b!=="false",x=(Fi.get(g)||0)+1,w=(s.get(g)||0)+1;Fi.set(g,x),s.set(g,w),l.push(g),x===1&&y&&_p.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),c.clear(),Uv++,function(){l.forEach(function(h){var g=Fi.get(h)-1,b=s.get(h)-1;Fi.set(h,g),s.set(h,b),g||(_p.has(h)||h.removeAttribute(r),_p.delete(h)),b||h.removeAttribute(n)}),Uv--,Uv||(Fi=new WeakMap,Fi=new WeakMap,_p=new WeakMap,Ip={})}},VW=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||BW(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),WW(r,o,n,"aria-hidden")):function(){return null}};function UW(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:l=!0,onOverlayClick:c,onEsc:d}=e,f=i.useRef(null),m=i.useRef(null),[h,g,b]=KW(r,"chakra-modal","chakra-modal--header","chakra-modal--body");GW(f,t&&l);const y=o6(f,t),x=i.useRef(null),w=i.useCallback(N=>{x.current=N.target},[]),S=i.useCallback(N=>{N.key==="Escape"&&(N.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[j,_]=i.useState(!1),[I,E]=i.useState(!1),M=i.useCallback((N={},O=null)=>({role:"dialog",...N,ref:Et(O,f),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":I?b:void 0,onClick:ze(N.onClick,T=>T.stopPropagation())}),[b,I,h,g,j]),D=i.useCallback(N=>{N.stopPropagation(),x.current===N.target&&fb.isTopModal(f.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),R=i.useCallback((N={},O=null)=>({...N,ref:Et(O,m),onClick:ze(N.onClick,D),onKeyDown:ze(N.onKeyDown,S),onMouseDown:ze(N.onMouseDown,w)}),[S,w,D]);return{isOpen:t,onClose:n,headerId:g,bodyId:b,setBodyMounted:E,setHeaderMounted:_,dialogRef:f,overlayRef:m,getDialogProps:M,getDialogContainerProps:R,index:y}}function GW(e,t){const n=e.current;i.useEffect(()=>{if(!(!e.current||!t))return VW(e.current)},[t,e,n])}function KW(e,...t){const n=i.useId(),r=e||n;return i.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[qW,Yc]=Kt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `}),[XW,ti]=Kt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in `<Modal />`"}),ni=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:l,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:f,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:b,onCloseComplete:y}=t,x=Xn("Modal",t),S={...UW(t),autoFocus:o,trapFocus:s,initialFocusRef:l,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:f,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:b};return a.jsx(XW,{value:S,children:a.jsx(qW,{value:x,children:a.jsx(hr,{onExitComplete:y,children:S.isOpen&&a.jsx(Uc,{...n,children:r})})})})};ni.displayName="Modal";var lm="right-scroll-bar-position",im="width-before-scroll-bar",QW="with-scroll-bars-hidden",YW="--removed-body-scroll-bar-size",a6=n5(),Gv=function(){},fg=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:Gv,onWheelCapture:Gv,onTouchMoveCapture:Gv}),o=r[0],s=r[1],l=e.forwardProps,c=e.children,d=e.className,f=e.removeScrollBar,m=e.enabled,h=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,_=J3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=g,E=Z3([n,t]),M=ws(ws({},_),o);return i.createElement(i.Fragment,null,m&&i.createElement(I,{sideCar:a6,removeScrollBar:f,shards:h,noIsolation:b,inert:y,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:j}),l?i.cloneElement(i.Children.only(c),ws(ws({},M),{ref:E})):i.createElement(S,ws({},M,{className:d,ref:E}),c))});fg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fg.classNames={fullWidth:im,zeroRight:lm};var t4,ZW=function(){if(t4)return t4;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ZW();return t&&e.setAttribute("nonce",t),e}function eV(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function tV(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nV=function(){var e=0,t=null;return{add:function(n){e==0&&(t=JW())&&(eV(t,n),tV(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},rV=function(){var e=nV();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},l6=function(){var e=rV(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},oV={left:0,top:0,right:0,gap:0},Kv=function(e){return parseInt(e||"",10)||0},sV=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[Kv(n),Kv(r),Kv(o)]},aV=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return oV;var t=sV(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])}},lV=l6(),iV=function(e,t,n,r){var o=e.left,s=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
.`.concat(QW,` {
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(l,`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(lm,` {
right: `).concat(c,"px ").concat(r,`;
}
.`).concat(im,` {
margin-right: `).concat(c,"px ").concat(r,`;
}
.`).concat(lm," .").concat(lm,` {
right: 0 `).concat(r,`;
}
.`).concat(im," .").concat(im,` {
margin-right: 0 `).concat(r,`;
}
body {
`).concat(YW,": ").concat(c,`px;
}
`)},cV=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=i.useMemo(function(){return aV(o)},[o]);return i.createElement(lV,{styles:iV(s,!t,o,n?"":"!important")})},pb=!1;if(typeof window<"u")try{var Pp=Object.defineProperty({},"passive",{get:function(){return pb=!0,!0}});window.addEventListener("test",Pp,Pp),window.removeEventListener("test",Pp,Pp)}catch{pb=!1}var zi=pb?{passive:!1}:!1,uV=function(e){return e.tagName==="TEXTAREA"},i6=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!uV(e)&&n[t]==="visible")},dV=function(e){return i6(e,"overflowY")},fV=function(e){return i6(e,"overflowX")},n4=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=c6(e,r);if(o){var s=u6(e,r),l=s[1],c=s[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},pV=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},mV=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},c6=function(e,t){return e==="v"?dV(t):fV(t)},u6=function(e,t){return e==="v"?pV(t):mV(t)},hV=function(e,t){return e==="h"&&t==="rtl"?-1:1},gV=function(e,t,n,r,o){var s=hV(e,window.getComputedStyle(t).direction),l=s*r,c=n.target,d=t.contains(c),f=!1,m=l>0,h=0,g=0;do{var b=u6(e,c),y=b[0],x=b[1],w=b[2],S=x-w-s*y;(y||S)&&c6(e,c)&&(h+=S,g+=y),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(m&&(o&&Math.abs(h)<1||!o&&l>h)||!m&&(o&&Math.abs(g)<1||!o&&-l>g))&&(f=!0),f},Ep=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},r4=function(e){return[e.deltaX,e.deltaY]},o4=function(e){return e&&"current"in e?e.current:e},vV=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bV=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},xV=0,Bi=[];function yV(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),o=i.useState(xV++)[0],s=i.useState(l6)[0],l=i.useRef(e);i.useEffect(function(){l.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var x=ob([e.lockRef.current],(e.shards||[]).map(o4),!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=i.useCallback(function(x,w){if("touches"in x&&x.touches.length===2)return!l.current.allowPinchZoom;var S=Ep(x),j=n.current,_="deltaX"in x?x.deltaX:j[0]-S[0],I="deltaY"in x?x.deltaY:j[1]-S[1],E,M=x.target,D=Math.abs(_)>Math.abs(I)?"h":"v";if("touches"in x&&D==="h"&&M.type==="range")return!1;var R=n4(D,M);if(!R)return!0;if(R?E=D:(E=D==="v"?"h":"v",R=n4(D,M)),!R)return!1;if(!r.current&&"changedTouches"in x&&(_||I)&&(r.current=E),!E)return!0;var N=r.current||E;return gV(N,w,x,N==="h"?_:I,!0)},[]),d=i.useCallback(function(x){var w=x;if(!(!Bi.length||Bi[Bi.length-1]!==s)){var S="deltaY"in w?r4(w):Ep(w),j=t.current.filter(function(E){return E.name===w.type&&(E.target===w.target||w.target===E.shadowParent)&&vV(E.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var _=(l.current.shards||[]).map(o4).filter(Boolean).filter(function(E){return E.contains(w.target)}),I=_.length>0?c(w,_[0]):!l.current.noIsolation;I&&w.cancelable&&w.preventDefault()}}},[]),f=i.useCallback(function(x,w,S,j){var _={name:x,delta:w,target:S,should:j,shadowParent:CV(S)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(I){return I!==_})},1)},[]),m=i.useCallback(function(x){n.current=Ep(x),r.current=void 0},[]),h=i.useCallback(function(x){f(x.type,r4(x),x.target,c(x,e.lockRef.current))},[]),g=i.useCallback(function(x){f(x.type,Ep(x),x.target,c(x,e.lockRef.current))},[]);i.useEffect(function(){return Bi.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",d,zi),document.addEventListener("touchmove",d,zi),document.addEventListener("touchstart",m,zi),function(){Bi=Bi.filter(function(x){return x!==s}),document.removeEventListener("wheel",d,zi),document.removeEventListener("touchmove",d,zi),document.removeEventListener("touchstart",m,zi)}},[]);var b=e.removeScrollBar,y=e.inert;return i.createElement(i.Fragment,null,y?i.createElement(s,{styles:bV(o)}):null,b?i.createElement(cV,{gapMode:e.gapMode}):null)}function CV(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wV=xz(a6,yV);var d6=i.forwardRef(function(e,t){return i.createElement(fg,ws({},e,{ref:t,sideCar:wV}))});d6.classNames=fg.classNames;const SV=d6;function kV(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:l,finalFocusRef:c,returnFocusOnClose:d,preserveScrollBarGap:f,lockFocusAcrossFrames:m,isOpen:h}=ti(),[g,b]=MR();i.useEffect(()=>{!g&&b&&setTimeout(b)},[g,b]);const y=o6(r,h);return a.jsx(R5,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:c,restoreFocus:d,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(SV,{removeScrollBar:!f,allowPinchZoom:l,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var ri=_e((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...l}=e,{getDialogProps:c,getDialogContainerProps:d}=ti(),f=c(l,t),m=d(o),h=et("chakra-modal__content",n),g=Yc(),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}=ti();return a.jsx(kV,{children:a.jsx(je.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(r6,{preset:x,motionProps:s,className:h,...f,__css:b,children:r})})})});ri.displayName="ModalContent";function Zc(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(ni,{...n,initialFocusRef:t})}var Jc=_e((e,t)=>a.jsx(ri,{ref:t,role:"alertdialog",...e})),ls=_e((e,t)=>{const{className:n,...r}=e,o=et("chakra-modal__footer",n),l={display:"flex",alignItems:"center",justifyContent:"flex-end",...Yc().footer};return a.jsx(je.footer,{ref:t,...r,__css:l,className:o})});ls.displayName="ModalFooter";var Po=_e((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=ti();i.useEffect(()=>(s(!0),()=>s(!1)),[s]);const l=et("chakra-modal__header",n),d={flex:0,...Yc().header};return a.jsx(je.header,{ref:t,className:l,id:o,...r,__css:d})});Po.displayName="ModalHeader";var jV=je(Mn.div),Eo=_e((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,l=et("chakra-modal__overlay",n),d={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Yc().overlay},{motionPreset:f}=ti(),h=o||(f==="none"?{}:D3);return a.jsx(jV,{...h,__css:d,ref:t,className:l,...s})});Eo.displayName="ModalOverlay";var Mo=_e((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=ti();i.useEffect(()=>(s(!0),()=>s(!1)),[s]);const l=et("chakra-modal__body",n),c=Yc();return a.jsx(je.div,{ref:t,className:l,id:o,...r,__css:c.body})});Mo.displayName="ModalBody";var af=_e((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=ti(),l=et("chakra-modal__close-btn",r),c=Yc();return a.jsx(bI,{ref:t,__css:c.closeButton,className:l,onClick:ze(n,d=>{d.stopPropagation(),s()}),...o})});af.displayName="ModalCloseButton";var _V=e=>a.jsx(An,{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"})}),IV=e=>a.jsx(An,{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 s4(e,t,n,r){i.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,l=Array.isArray(t)?t:[t],c=new s.MutationObserver(d=>{for(const f of d)f.type==="attributes"&&f.attributeName&&l.includes(f.attributeName)&&n(f)});return c.observe(e.current,{attributes:!0,attributeFilter:l}),()=>c.disconnect()})}function PV(e,t){const n=gn(e);i.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var EV=50,a4=300;function MV(e,t){const[n,r]=i.useState(!1),[o,s]=i.useState(null),[l,c]=i.useState(!0),d=i.useRef(null),f=()=>clearTimeout(d.current);PV(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?EV:null);const m=i.useCallback(()=>{l&&e(),d.current=setTimeout(()=>{c(!1),r(!0),s("increment")},a4)},[e,l]),h=i.useCallback(()=>{l&&t(),d.current=setTimeout(()=>{c(!1),r(!0),s("decrement")},a4)},[t,l]),g=i.useCallback(()=>{c(!0),r(!1),f()},[]);return i.useEffect(()=>()=>f(),[]),{up:m,down:h,stop:g,isSpinning:n}}var OV=/^[Ee0-9+\-.]$/;function DV(e){return OV.test(e)}function RV(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 AV(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:l=1,isReadOnly:c,isDisabled:d,isRequired:f,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:b,id:y,onChange:x,precision:w,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":I,onFocus:E,onBlur:M,onInvalid:D,getAriaValueText:R,isValidCharacter:N,format:O,parse:T,...U}=e,G=gn(E),q=gn(M),Y=gn(D),Q=gn(N??DV),V=gn(R),se=ZF(e),{update:ee,increment:le,decrement:ae}=se,[ce,J]=i.useState(!1),re=!(c||d),A=i.useRef(null),L=i.useRef(null),K=i.useRef(null),ne=i.useRef(null),z=i.useCallback(ye=>ye.split("").filter(Q).join(""),[Q]),oe=i.useCallback(ye=>{var Ue;return(Ue=T==null?void 0:T(ye))!=null?Ue:ye},[T]),X=i.useCallback(ye=>{var Ue;return((Ue=O==null?void 0:O(ye))!=null?Ue:ye).toString()},[O]);ba(()=>{(se.valueAsNumber>s||se.valueAsNumber<o)&&(Y==null||Y("rangeOverflow",X(se.value),se.valueAsNumber))},[se.valueAsNumber,se.value,X,Y]),dc(()=>{if(!A.current)return;if(A.current.value!=se.value){const Ue=oe(A.current.value);se.setValue(z(Ue))}},[oe,z]);const Z=i.useCallback((ye=l)=>{re&&le(ye)},[le,re,l]),me=i.useCallback((ye=l)=>{re&&ae(ye)},[ae,re,l]),ve=MV(Z,me);s4(K,"disabled",ve.stop,ve.isSpinning),s4(ne,"disabled",ve.stop,ve.isSpinning);const de=i.useCallback(ye=>{if(ye.nativeEvent.isComposing)return;const st=oe(ye.currentTarget.value);ee(z(st)),L.current={start:ye.currentTarget.selectionStart,end:ye.currentTarget.selectionEnd}},[ee,z,oe]),ke=i.useCallback(ye=>{var Ue,st,mt;G==null||G(ye),L.current&&(ye.target.selectionStart=(st=L.current.start)!=null?st:(Ue=ye.currentTarget.value)==null?void 0:Ue.length,ye.currentTarget.selectionEnd=(mt=L.current.end)!=null?mt:ye.currentTarget.selectionStart)},[G]),we=i.useCallback(ye=>{if(ye.nativeEvent.isComposing)return;RV(ye,Q)||ye.preventDefault();const Ue=Re(ye)*l,st=ye.key,Pe={ArrowUp:()=>Z(Ue),ArrowDown:()=>me(Ue),Home:()=>ee(o),End:()=>ee(s)}[st];Pe&&(ye.preventDefault(),Pe(ye))},[Q,l,Z,me,ee,o,s]),Re=ye=>{let Ue=1;return(ye.metaKey||ye.ctrlKey)&&(Ue=.1),ye.shiftKey&&(Ue=10),Ue},Qe=i.useMemo(()=>{const ye=V==null?void 0:V(se.value);if(ye!=null)return ye;const Ue=se.value.toString();return Ue||void 0},[se.value,V]),$e=i.useCallback(()=>{let ye=se.value;if(se.value==="")return;/^[eE]/.test(se.value.toString())?se.setValue(""):(se.valueAsNumber<o&&(ye=o),se.valueAsNumber>s&&(ye=s),se.cast(ye))},[se,s,o]),vt=i.useCallback(()=>{J(!1),n&&$e()},[n,J,$e]),it=i.useCallback(()=>{t&&requestAnimationFrame(()=>{var ye;(ye=A.current)==null||ye.focus()})},[t]),ot=i.useCallback(ye=>{ye.preventDefault(),ve.up(),it()},[it,ve]),Ce=i.useCallback(ye=>{ye.preventDefault(),ve.down(),it()},[it,ve]);Ul(()=>A.current,"wheel",ye=>{var Ue,st;const Pe=((st=(Ue=A.current)==null?void 0:Ue.ownerDocument)!=null?st:document).activeElement===A.current;if(!b||!Pe)return;ye.preventDefault();const Ne=Re(ye)*l,kt=Math.sign(ye.deltaY);kt===-1?Z(Ne):kt===1&&me(Ne)},{passive:!1});const Me=i.useCallback((ye={},Ue=null)=>{const st=d||r&&se.isAtMax;return{...ye,ref:Et(Ue,K),role:"button",tabIndex:-1,onPointerDown:ze(ye.onPointerDown,mt=>{mt.button!==0||st||ot(mt)}),onPointerLeave:ze(ye.onPointerLeave,ve.stop),onPointerUp:ze(ye.onPointerUp,ve.stop),disabled:st,"aria-disabled":wo(st)}},[se.isAtMax,r,ot,ve.stop,d]),qe=i.useCallback((ye={},Ue=null)=>{const st=d||r&&se.isAtMin;return{...ye,ref:Et(Ue,ne),role:"button",tabIndex:-1,onPointerDown:ze(ye.onPointerDown,mt=>{mt.button!==0||st||Ce(mt)}),onPointerLeave:ze(ye.onPointerLeave,ve.stop),onPointerUp:ze(ye.onPointerUp,ve.stop),disabled:st,"aria-disabled":wo(st)}},[se.isAtMin,r,Ce,ve.stop,d]),dt=i.useCallback((ye={},Ue=null)=>{var st,mt,Pe,Ne;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":I,"aria-label":_,"aria-describedby":j,id:y,disabled:d,...ye,readOnly:(st=ye.readOnly)!=null?st:c,"aria-readonly":(mt=ye.readOnly)!=null?mt:c,"aria-required":(Pe=ye.required)!=null?Pe:f,required:(Ne=ye.required)!=null?Ne:f,ref:Et(A,Ue),value:X(se.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(se.valueAsNumber)?void 0:se.valueAsNumber,"aria-invalid":wo(m??se.isOutOfRange),"aria-valuetext":Qe,autoComplete:"off",autoCorrect:"off",onChange:ze(ye.onChange,de),onKeyDown:ze(ye.onKeyDown,we),onFocus:ze(ye.onFocus,ke,()=>J(!0)),onBlur:ze(ye.onBlur,q,vt)}},[S,g,h,I,_,X,j,y,d,f,c,m,se.value,se.valueAsNumber,se.isOutOfRange,o,s,Qe,de,we,ke,q,vt]);return{value:X(se.value),valueAsNumber:se.valueAsNumber,isFocused:ce,isDisabled:d,isReadOnly:c,getIncrementButtonProps:Me,getDecrementButtonProps:qe,getInputProps:dt,htmlProps:U}}var[TV,pg]=Kt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "<NumberInput />" `}),[NV,wy]=Kt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within <NumberInput />"}),mg=_e(function(t,n){const r=Xn("NumberInput",t),o=cn(t),s=qx(o),{htmlProps:l,...c}=AV(s),d=i.useMemo(()=>c,[c]);return a.jsx(NV,{value:d,children:a.jsx(TV,{value:r,children:a.jsx(je.div,{...l,ref:n,className:et("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});mg.displayName="NumberInput";var hg=_e(function(t,n){const r=pg();return a.jsx(je.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}})});hg.displayName="NumberInputStepper";var gg=_e(function(t,n){const{getInputProps:r}=wy(),o=r(t,n),s=pg();return a.jsx(je.input,{...o,className:et("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});gg.displayName="NumberInputField";var f6=je("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),vg=_e(function(t,n){var r;const o=pg(),{getDecrementButtonProps:s}=wy(),l=s(t,n);return a.jsx(f6,{...l,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(_V,{})})});vg.displayName="NumberDecrementStepper";var bg=_e(function(t,n){var r;const{getIncrementButtonProps:o}=wy(),s=o(t,n),l=pg();return a.jsx(f6,{...s,__css:l.stepper,children:(r=t.children)!=null?r:a.jsx(IV,{})})});bg.displayName="NumberIncrementStepper";var[$V,ii]=Kt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"}),[LV,xg]=Kt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Popover />" `});function yg(e){const t=i.Children.only(e.children),{getTriggerProps:n}=ii();return i.cloneElement(t,n(t.props,t.ref))}yg.displayName="PopoverTrigger";var Hi={click:"click",hover:"hover"};function FV(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:l=!0,arrowSize:c,arrowShadowColor:d,trigger:f=Hi.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:b="unmount",computePositionOnMount:y,...x}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:_}=yy(e),I=i.useRef(null),E=i.useRef(null),M=i.useRef(null),D=i.useRef(!1),R=i.useRef(!1);w&&(R.current=!0);const[N,O]=i.useState(!1),[T,U]=i.useState(!1),G=i.useId(),q=o??G,[Y,Q,V,se]=["popover-trigger","popover-content","popover-header","popover-body"].map(de=>`${de}-${q}`),{referenceRef:ee,getArrowProps:le,getPopperProps:ae,getArrowInnerProps:ce,forceUpdate:J}=xy({...x,enabled:w||!!y}),re=Z5({isOpen:w,ref:M});G3({enabled:w,ref:E}),B5(M,{focusRef:E,visible:w,shouldFocus:s&&f===Hi.click}),KB(M,{focusRef:r,visible:w,shouldFocus:l&&f===Hi.click});const A=Cy({wasSelected:R.current,enabled:g,mode:b,isSelected:re.present}),L=i.useCallback((de={},ke=null)=>{const we={...de,style:{...de.style,transformOrigin:Fn.transformOrigin.varRef,[Fn.arrowSize.var]:c?`${c}px`:void 0,[Fn.arrowShadowColor.var]:d},ref:Et(M,ke),children:A?de.children:null,id:Q,tabIndex:-1,role:"dialog",onKeyDown:ze(de.onKeyDown,Re=>{n&&Re.key==="Escape"&&S()}),onBlur:ze(de.onBlur,Re=>{const Qe=l4(Re),$e=qv(M.current,Qe),vt=qv(E.current,Qe);w&&t&&(!$e&&!vt)&&S()}),"aria-labelledby":N?V:void 0,"aria-describedby":T?se:void 0};return f===Hi.hover&&(we.role="tooltip",we.onMouseEnter=ze(de.onMouseEnter,()=>{D.current=!0}),we.onMouseLeave=ze(de.onMouseLeave,Re=>{Re.nativeEvent.relatedTarget!==null&&(D.current=!1,setTimeout(()=>S(),h))})),we},[A,Q,N,V,T,se,f,n,S,w,t,h,d,c]),K=i.useCallback((de={},ke=null)=>ae({...de,style:{visibility:w?"visible":"hidden",...de.style}},ke),[w,ae]),ne=i.useCallback((de,ke=null)=>({...de,ref:Et(ke,I,ee)}),[I,ee]),z=i.useRef(),oe=i.useRef(),X=i.useCallback(de=>{I.current==null&&ee(de)},[ee]),Z=i.useCallback((de={},ke=null)=>{const we={...de,ref:Et(E,ke,X),id:Y,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":Q};return f===Hi.click&&(we.onClick=ze(de.onClick,_)),f===Hi.hover&&(we.onFocus=ze(de.onFocus,()=>{z.current===void 0&&j()}),we.onBlur=ze(de.onBlur,Re=>{const Qe=l4(Re),$e=!qv(M.current,Qe);w&&t&&$e&&S()}),we.onKeyDown=ze(de.onKeyDown,Re=>{Re.key==="Escape"&&S()}),we.onMouseEnter=ze(de.onMouseEnter,()=>{D.current=!0,z.current=window.setTimeout(()=>j(),m)}),we.onMouseLeave=ze(de.onMouseLeave,()=>{D.current=!1,z.current&&(clearTimeout(z.current),z.current=void 0),oe.current=window.setTimeout(()=>{D.current===!1&&S()},h)})),we},[Y,w,Q,f,X,_,j,t,S,m,h]);i.useEffect(()=>()=>{z.current&&clearTimeout(z.current),oe.current&&clearTimeout(oe.current)},[]);const me=i.useCallback((de={},ke=null)=>({...de,id:V,ref:Et(ke,we=>{O(!!we)})}),[V]),ve=i.useCallback((de={},ke=null)=>({...de,id:se,ref:Et(ke,we=>{U(!!we)})}),[se]);return{forceUpdate:J,isOpen:w,onAnimationComplete:re.onComplete,onClose:S,getAnchorProps:ne,getArrowProps:le,getArrowInnerProps:ce,getPopoverPositionerProps:K,getPopoverProps:L,getTriggerProps:Z,getHeaderProps:me,getBodyProps:ve}}function qv(e,t){return e===t||(e==null?void 0:e.contains(t))}function l4(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function lf(e){const t=Xn("Popover",e),{children:n,...r}=cn(e),o=Hd(),s=FV({...r,direction:o.direction});return a.jsx($V,{value:s,children:a.jsx(LV,{value:t,children:bx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}lf.displayName="Popover";function p6(e){const t=i.Children.only(e.children),{getAnchorProps:n}=ii();return i.cloneElement(t,n(t.props,t.ref))}p6.displayName="PopoverAnchor";var Xv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function m6(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:l,shadowColor:c}=e,{getArrowProps:d,getArrowInnerProps:f}=ii(),m=xg(),h=(t=n??r)!=null?t:o,g=s??l;return a.jsx(je.div,{...d(),className:"chakra-popover__arrow-positioner",children:a.jsx(je.div,{className:et("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-shadow-color":Xv("colors",c),"--popper-arrow-bg":Xv("colors",h),"--popper-arrow-shadow":Xv("shadows",g),...m.arrow}})})}m6.displayName="PopoverArrow";var Cg=_e(function(t,n){const{getBodyProps:r}=ii(),o=xg();return a.jsx(je.div,{...r(t,n),className:et("chakra-popover__body",t.className),__css:o.body})});Cg.displayName="PopoverBody";var h6=_e(function(t,n){const{onClose:r}=ii(),o=xg();return a.jsx(bI,{size:"sm",onClick:r,className:et("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});h6.displayName="PopoverCloseButton";function zV(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var BV={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]}}},HV=je(Mn.section),g6=_e(function(t,n){const{variants:r=BV,...o}=t,{isOpen:s}=ii();return a.jsx(HV,{ref:n,variants:zV(r),initial:!1,animate:s?"enter":"exit",...o})});g6.displayName="PopoverTransition";var cf=_e(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:l,getPopoverPositionerProps:c,onAnimationComplete:d}=ii(),f=xg(),m={position:"relative",display:"flex",flexDirection:"column",...f.content};return a.jsx(je.div,{...c(r),__css:f.popper,className:"chakra-popover__popper",children:a.jsx(g6,{...o,...l(s,n),onAnimationComplete:Uh(d,s.onAnimationComplete),className:et("chakra-popover__content",t.className),__css:m})})});cf.displayName="PopoverContent";var mb=e=>a.jsx(je.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});mb.displayName="Circle";function WV(e,t,n){return(e-t)*100/(n-t)}var VV=xa({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),UV=xa({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),GV=xa({"0%":{left:"-40%"},"100%":{left:"100%"}}),KV=xa({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function v6(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:l,role:c="progressbar"}=e,d=WV(t,n,r);return{bind:{"data-indeterminate":l?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":l?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,d):o})(),role:c},percent:d,value:t}}var b6=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(je.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${UV} 2s linear infinite`:void 0},...r})};b6.displayName="Shape";var hb=_e((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:l,getValueText:c,value:d,capIsRound:f,children:m,thickness:h="10px",color:g="#0078d4",trackColor:b="#edebe9",isIndeterminate:y,...x}=e,w=v6({min:s,max:o,value:d,valueText:l,getValueText:c,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${VV} 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(je.div,{ref:t,className:"chakra-progress",...w.bind,...x,__css:I,children:[a.jsxs(b6,{size:r,isIndeterminate:y,children:[a.jsx(mb,{stroke:b,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(mb,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:f?"round":void 0,opacity:w.value===0&&!y?0:void 0,..._})]}),m]})});hb.displayName="CircularProgress";var[qV,XV]=Kt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Progress />" `}),QV=_e((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:l,...c}=e,d=v6({value:o,min:n,max:r,isIndeterminate:s,role:l}),m={height:"100%",...XV().filledTrack};return a.jsx(je.div,{ref:t,style:{width:`${d.percent}%`,...c.style},...d.bind,...c,__css:m})}),x6=_e((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:l,isAnimated:c,children:d,borderRadius:f,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":b,title:y,role:x,...w}=cn(e),S=Xn("Progress",e),j=f??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${KV} 1s linear infinite`},M={...!m&&l&&c&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${GV} 1s ease infinite normal none running`}},D={overflow:"hidden",position:"relative",...S.track};return a.jsx(je.div,{ref:t,borderRadius:j,__css:D,...w,children:a.jsxs(qV,{value:S,children:[a.jsx(QV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":b,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:x}),d]})})});x6.displayName="Progress";function YV(e){return e&&T1(e)&&T1(e.target)}function ZV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:l,isNative:c,...d}=e,[f,m]=i.useState(r||""),h=typeof n<"u",g=h?n:f,b=i.useRef(null),y=i.useCallback(()=>{const E=b.current;if(!E)return;let M="input:not(:disabled):checked";const D=E.querySelector(M);if(D){D.focus();return}M="input:not(:disabled)";const R=E.querySelector(M);R==null||R.focus()},[]),w=`radio-${i.useId()}`,S=o||w,j=i.useCallback(E=>{const M=YV(E)?E.target.value:E;h||m(M),t==null||t(String(M))},[t,h]),_=i.useCallback((E={},M=null)=>({...E,ref:Et(M,b),role:"radiogroup"}),[]),I=i.useCallback((E={},M=null)=>({...E,ref:M,name:S,[c?"checked":"isChecked"]:g!=null?E.value===g:void 0,onChange(R){j(R)},"data-radiogroup":!0}),[c,S,j,g]);return{getRootProps:_,getRadioProps:I,name:S,ref:b,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:l,htmlProps:d}}var[JV,y6]=Kt({name:"RadioGroupContext",strict:!1}),$m=_e((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:l,isDisabled:c,isFocusable:d,...f}=e,{value:m,onChange:h,getRootProps:g,name:b,htmlProps:y}=ZV(f),x=i.useMemo(()=>({name:b,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:c,isFocusable:d}),[b,r,h,n,m,o,c,d]);return a.jsx(JV,{value:x,children:a.jsx(je.div,{...g(y,t),className:et("chakra-radio-group",l),children:s})})});$m.displayName="RadioGroup";var eU={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function tU(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:l,onChange:c,isInvalid:d,name:f,value:m,id:h,"data-radiogroup":g,"aria-describedby":b,...y}=e,x=`radio-${i.useId()}`,w=Qd(),j=!!y6()||!!g;let I=!!w&&!j?w.id:x;I=h??I;const E=o??(w==null?void 0:w.isDisabled),M=s??(w==null?void 0:w.isReadOnly),D=l??(w==null?void 0:w.isRequired),R=d??(w==null?void 0:w.isInvalid),[N,O]=i.useState(!1),[T,U]=i.useState(!1),[G,q]=i.useState(!1),[Y,Q]=i.useState(!1),[V,se]=i.useState(!!t),ee=typeof n<"u",le=ee?n:V;i.useEffect(()=>F3(O),[]);const ae=i.useCallback(X=>{if(M||E){X.preventDefault();return}ee||se(X.target.checked),c==null||c(X)},[ee,E,M,c]),ce=i.useCallback(X=>{X.key===" "&&Q(!0)},[Q]),J=i.useCallback(X=>{X.key===" "&&Q(!1)},[Q]),re=i.useCallback((X={},Z=null)=>({...X,ref:Z,"data-active":ut(Y),"data-hover":ut(G),"data-disabled":ut(E),"data-invalid":ut(R),"data-checked":ut(le),"data-focus":ut(T),"data-focus-visible":ut(T&&N),"data-readonly":ut(M),"aria-hidden":!0,onMouseDown:ze(X.onMouseDown,()=>Q(!0)),onMouseUp:ze(X.onMouseUp,()=>Q(!1)),onMouseEnter:ze(X.onMouseEnter,()=>q(!0)),onMouseLeave:ze(X.onMouseLeave,()=>q(!1))}),[Y,G,E,R,le,T,M,N]),{onFocus:A,onBlur:L}=w??{},K=i.useCallback((X={},Z=null)=>{const me=E&&!r;return{...X,id:I,ref:Z,type:"radio",name:f,value:m,onChange:ze(X.onChange,ae),onBlur:ze(L,X.onBlur,()=>U(!1)),onFocus:ze(A,X.onFocus,()=>U(!0)),onKeyDown:ze(X.onKeyDown,ce),onKeyUp:ze(X.onKeyUp,J),checked:le,disabled:me,readOnly:M,required:D,"aria-invalid":wo(R),"aria-disabled":wo(me),"aria-required":wo(D),"data-readonly":ut(M),"aria-describedby":b,style:eU}},[E,r,I,f,m,ae,L,A,ce,J,le,M,D,R,b]);return{state:{isInvalid:R,isFocused:T,isChecked:le,isActive:Y,isHovered:G,isDisabled:E,isReadOnly:M,isRequired:D},getCheckboxProps:re,getRadioProps:re,getInputProps:K,getLabelProps:(X={},Z=null)=>({...X,ref:Z,onMouseDown:ze(X.onMouseDown,nU),"data-disabled":ut(E),"data-checked":ut(le),"data-invalid":ut(R)}),getRootProps:(X,Z=null)=>({...X,ref:Z,"data-disabled":ut(E),"data-checked":ut(le),"data-invalid":ut(R)}),htmlProps:y}}function nU(e){e.preventDefault(),e.stopPropagation()}function rU(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 Ys=_e((e,t)=>{var n;const r=y6(),{onChange:o,value:s}=e,l=Xn("Radio",{...r,...e}),c=cn(e),{spacing:d="0.5rem",children:f,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=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=Uh(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:_,getRootProps:I,htmlProps:E}=tU({...b,isChecked:y,isFocusable:h,isDisabled:m,onChange:x,name:w}),[M,D]=rU(E,xI),R=j(D),N=S(g,t),O=_(),T=Object.assign({},M,I()),U={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...l.container},G={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...l.control},q={userSelect:"none",marginStart:d,...l.label};return a.jsxs(je.label,{className:"chakra-radio",...T,__css:U,children:[a.jsx("input",{className:"chakra-radio__input",...N}),a.jsx(je.span,{className:"chakra-radio__control",...R,__css:G}),f&&a.jsx(je.span,{className:"chakra-radio__label",...O,__css:q,children:f})]})});Ys.displayName="Radio";var C6=_e(function(t,n){const{children:r,placeholder:o,className:s,...l}=t;return a.jsxs(je.select,{...l,ref:n,className:et("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});C6.displayName="SelectField";function oU(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 w6=_e((e,t)=>{var n;const r=Xn("Select",e),{rootProps:o,placeholder:s,icon:l,color:c,height:d,h:f,minH:m,minHeight:h,iconColor:g,iconSize:b,...y}=cn(e),[x,w]=oU(y,xI),S=Kx(w),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(je.div,{className:"chakra-select__wrapper",__css:j,...x,...o,children:[a.jsx(C6,{ref:t,height:f??d,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(S6,{"data-disabled":ut(S.disabled),...(g||c)&&{color:g||c},__css:r.icon,...b&&{fontSize:b},children:l})]})});w6.displayName="Select";var sU=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"})}),aU=je("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),S6=e=>{const{children:t=a.jsx(sU,{}),...n}=e,r=i.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(aU,{...n,className:"chakra-select__icon-wrapper",children:i.isValidElement(t)?r:null})};S6.displayName="SelectIcon";function lU(){const e=i.useRef(!0);return i.useEffect(()=>{e.current=!1},[]),e.current}function iU(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}var cU=je("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),gb=yI("skeleton-start-color"),vb=yI("skeleton-end-color"),uU=xa({from:{opacity:0},to:{opacity:1}}),dU=xa({from:{borderColor:gb.reference,background:gb.reference},to:{borderColor:vb.reference,background:vb.reference}}),wg=_e((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=ml("Skeleton",n),o=lU(),{startColor:s="",endColor:l="",isLoaded:c,fadeDuration:d,speed:f,className:m,fitContent:h,...g}=cn(n),[b,y]=Zo("colors",[s,l]),x=iU(c),w=et("chakra-skeleton",m),S={...b&&{[gb.variable]:b},...y&&{[vb.variable]:y}};if(c){const j=o||x?"none":`${uU} ${d}s`;return a.jsx(je.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(cU,{ref:t,className:w,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${f}s linear infinite alternate ${dU}`}})});wg.displayName="Skeleton";var bo=e=>e?"":void 0,bc=e=>e?!0:void 0,vl=(...e)=>e.filter(Boolean).join(" ");function xc(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function fU(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 Qu(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var cm={width:0,height:0},Mp=e=>e||cm;function k6(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=x=>{var w;const S=(w=r[x])!=null?w:cm;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Qu({orientation:t,vertical:{bottom:`calc(${n[x]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[x]}% - ${S.width/2}px)`}})}},l=t==="vertical"?r.reduce((x,w)=>Mp(x).height>Mp(w).height?x:w,cm):r.reduce((x,w)=>Mp(x).width>Mp(w).width?x:w,cm),c={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Qu({orientation:t,vertical:l?{paddingLeft:l.width/2,paddingRight:l.width/2}:{},horizontal:l?{paddingTop:l.height/2,paddingBottom:l.height/2}:{}})},d={position:"absolute",...Qu({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},f=n.length===1,m=[0,o?100-n[0]:n[0]],h=f?m:n;let g=h[0];!f&&o&&(g=100-g);const b=Math.abs(h[h.length-1]-h[0]),y={...d,...Qu({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 j6(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function pU(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function mU(e){const t=gU(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function _6(e){return!!e.touches}function hU(e){return _6(e)&&e.touches.length>1}function gU(e){var t;return(t=e.view)!=null?t:window}function vU(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function bU(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function I6(e,t="page"){return _6(e)?vU(e,t):bU(e,t)}function xU(e){return t=>{const n=mU(t);(!n||n&&t.button===0)&&e(t)}}function yU(e,t=!1){function n(o){e(o,{point:I6(o)})}return t?xU(n):n}function um(e,t,n,r){return pU(e,t,yU(n,t==="pointerdown"),r)}var CU=Object.defineProperty,wU=(e,t,n)=>t in e?CU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ko=(e,t,n)=>(wU(e,typeof t!="symbol"?t+"":t,n),n),SU=class{constructor(e,t,n){Ko(this,"history",[]),Ko(this,"startEvent",null),Ko(this,"lastEvent",null),Ko(this,"lastEventInfo",null),Ko(this,"handlers",{}),Ko(this,"removeListeners",()=>{}),Ko(this,"threshold",3),Ko(this,"win"),Ko(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const c=Qv(this.lastEventInfo,this.history),d=this.startEvent!==null,f=IU(c.offset,{x:0,y:0})>=this.threshold;if(!d&&!f)return;const{timestamp:m}=SS();this.history.push({...c.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;d||(h==null||h(this.lastEvent,c),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,c)}),Ko(this,"onPointerMove",(c,d)=>{this.lastEvent=c,this.lastEventInfo=d,WL.update(this.updatePoint,!0)}),Ko(this,"onPointerUp",(c,d)=>{const f=Qv(d,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(c,f),this.end(),!(!m||!this.startEvent)&&(m==null||m(c,f))});var r;if(this.win=(r=e.view)!=null?r:window,hU(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:I6(e)},{timestamp:s}=SS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:l}=t;l==null||l(e,Qv(o,this.history)),this.removeListeners=_U(um(this.win,"pointermove",this.onPointerMove),um(this.win,"pointerup",this.onPointerUp),um(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),VL.update(this.updatePoint)}};function i4(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Qv(e,t){return{point:e.point,delta:i4(e.point,t[t.length-1]),offset:i4(e.point,t[0]),velocity:jU(t,.1)}}var kU=e=>e*1e3;function jU(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>kU(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 l={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function _U(...e){return t=>e.reduce((n,r)=>r(n),t)}function Yv(e,t){return Math.abs(e-t)}function c4(e){return"x"in e&&"y"in e}function IU(e,t){if(typeof e=="number"&&typeof t=="number")return Yv(e,t);if(c4(e)&&c4(t)){const n=Yv(e.x,t.x),r=Yv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function P6(e){const t=i.useRef(null);return t.current=e,t}function E6(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:l,threshold:c}=t,d=!!(n||r||o||s||l),f=i.useRef(null),m=P6({onSessionStart:s,onSessionEnd:l,onStart:r,onMove:n,onEnd(h,g){f.current=null,o==null||o(h,g)}});i.useEffect(()=>{var h;(h=f.current)==null||h.updateHandlers(m.current)}),i.useEffect(()=>{const h=e.current;if(!h||!d)return;function g(b){f.current=new SU(b,m.current,c)}return um(h,"pointerdown",g)},[e,d,m,c]),i.useEffect(()=>()=>{var h;(h=f.current)==null||h.end(),f.current=null},[])}function PU(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 l,c;if("borderBoxSize"in s){const d=s.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,c=f.blockSize}else l=e.offsetWidth,c=e.offsetHeight;t({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var EU=globalThis!=null&&globalThis.document?i.useLayoutEffect:i.useEffect;function MU(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 M6({getNodes:e,observeMutation:t=!0}){const[n,r]=i.useState([]),[o,s]=i.useState(0);return EU(()=>{const l=e(),c=l.map((d,f)=>PU(d,m=>{r(h=>[...h.slice(0,f),m,...h.slice(f+1)])}));if(t){const d=l[0];c.push(MU(d,()=>{s(f=>f+1)}))}return()=>{c.forEach(d=>{d==null||d()})}},[o]),n}function OU(e){return typeof e=="object"&&e!==null&&"current"in e}function DU(e){const[t]=M6({observeMutation:!1,getNodes(){return[OU(e)?e.current:e]}});return t}function RU(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:l,direction:c="ltr",orientation:d="horizontal",id:f,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:b,step:y=1,getAriaValueText:x,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:I=!0,minStepsBetweenThumbs:E=0,...M}=e,D=gn(g),R=gn(b),N=gn(x),O=j6({isReversed:l,direction:c,orientation:d}),[T,U]=qd({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,q]=i.useState(!1),[Y,Q]=i.useState(!1),[V,se]=i.useState(-1),ee=!(m||h),le=i.useRef(T),ae=T.map(Se=>mc(Se,t,n)),ce=E*y,J=AU(ae,t,n,ce),re=i.useRef({eventSource:null,value:[],valueBounds:[]});re.current.value=ae,re.current.valueBounds=J;const A=ae.map(Se=>n-Se+t),K=(O?A:ae).map(Se=>Dm(Se,t,n)),ne=d==="vertical",z=i.useRef(null),oe=i.useRef(null),X=M6({getNodes(){const Se=oe.current,Ve=Se==null?void 0:Se.querySelectorAll("[role=slider]");return Ve?Array.from(Ve):[]}}),Z=i.useId(),ve=fU(f??Z),de=i.useCallback(Se=>{var Ve,Ge;if(!z.current)return;re.current.eventSource="pointer";const Le=z.current.getBoundingClientRect(),{clientX:bt,clientY:fn}=(Ge=(Ve=Se.touches)==null?void 0:Ve[0])!=null?Ge:Se,Bt=ne?Le.bottom-fn:bt-Le.left,Ht=ne?Le.height:Le.width;let zn=Bt/Ht;return O&&(zn=1-zn),B3(zn,t,n)},[ne,O,n,t]),ke=(n-t)/10,we=y||(n-t)/100,Re=i.useMemo(()=>({setValueAtIndex(Se,Ve){if(!ee)return;const Ge=re.current.valueBounds[Se];Ve=parseFloat(nb(Ve,Ge.min,we)),Ve=mc(Ve,Ge.min,Ge.max);const Le=[...re.current.value];Le[Se]=Ve,U(Le)},setActiveIndex:se,stepUp(Se,Ve=we){const Ge=re.current.value[Se],Le=O?Ge-Ve:Ge+Ve;Re.setValueAtIndex(Se,Le)},stepDown(Se,Ve=we){const Ge=re.current.value[Se],Le=O?Ge+Ve:Ge-Ve;Re.setValueAtIndex(Se,Le)},reset(){U(le.current)}}),[we,O,U,ee]),Qe=i.useCallback(Se=>{const Ve=Se.key,Le={ArrowRight:()=>Re.stepUp(V),ArrowUp:()=>Re.stepUp(V),ArrowLeft:()=>Re.stepDown(V),ArrowDown:()=>Re.stepDown(V),PageUp:()=>Re.stepUp(V,ke),PageDown:()=>Re.stepDown(V,ke),Home:()=>{const{min:bt}=J[V];Re.setValueAtIndex(V,bt)},End:()=>{const{max:bt}=J[V];Re.setValueAtIndex(V,bt)}}[Ve];Le&&(Se.preventDefault(),Se.stopPropagation(),Le(Se),re.current.eventSource="keyboard")},[Re,V,ke,J]),{getThumbStyle:$e,rootStyle:vt,trackStyle:it,innerTrackStyle:ot}=i.useMemo(()=>k6({isReversed:O,orientation:d,thumbRects:X,thumbPercents:K}),[O,d,K,X]),Ce=i.useCallback(Se=>{var Ve;const Ge=Se??V;if(Ge!==-1&&I){const Le=ve.getThumb(Ge),bt=(Ve=oe.current)==null?void 0:Ve.ownerDocument.getElementById(Le);bt&&setTimeout(()=>bt.focus())}},[I,V,ve]);ba(()=>{re.current.eventSource==="keyboard"&&(R==null||R(re.current.value))},[ae,R]);const Me=Se=>{const Ve=de(Se)||0,Ge=re.current.value.map(Ht=>Math.abs(Ht-Ve)),Le=Math.min(...Ge);let bt=Ge.indexOf(Le);const fn=Ge.filter(Ht=>Ht===Le);fn.length>1&&Ve>re.current.value[bt]&&(bt=bt+fn.length-1),se(bt),Re.setValueAtIndex(bt,Ve),Ce(bt)},qe=Se=>{if(V==-1)return;const Ve=de(Se)||0;se(V),Re.setValueAtIndex(V,Ve),Ce(V)};E6(oe,{onPanSessionStart(Se){ee&&(q(!0),Me(Se),D==null||D(re.current.value))},onPanSessionEnd(){ee&&(q(!1),R==null||R(re.current.value))},onPan(Se){ee&&qe(Se)}});const dt=i.useCallback((Se={},Ve=null)=>({...Se,...M,id:ve.root,ref:Et(Ve,oe),tabIndex:-1,"aria-disabled":bc(m),"data-focused":bo(Y),style:{...Se.style,...vt}}),[M,m,Y,vt,ve]),ye=i.useCallback((Se={},Ve=null)=>({...Se,ref:Et(Ve,z),id:ve.track,"data-disabled":bo(m),style:{...Se.style,...it}}),[m,it,ve]),Ue=i.useCallback((Se={},Ve=null)=>({...Se,ref:Ve,id:ve.innerTrack,style:{...Se.style,...ot}}),[ot,ve]),st=i.useCallback((Se,Ve=null)=>{var Ge;const{index:Le,...bt}=Se,fn=ae[Le];if(fn==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${Le}\`. The \`value\` or \`defaultValue\` length is : ${ae.length}`);const Bt=J[Le];return{...bt,ref:Ve,role:"slider",tabIndex:ee?0:void 0,id:ve.getThumb(Le),"data-active":bo(G&&V===Le),"aria-valuetext":(Ge=N==null?void 0:N(fn))!=null?Ge:w==null?void 0:w[Le],"aria-valuemin":Bt.min,"aria-valuemax":Bt.max,"aria-valuenow":fn,"aria-orientation":d,"aria-disabled":bc(m),"aria-readonly":bc(h),"aria-label":S==null?void 0:S[Le],"aria-labelledby":S!=null&&S[Le]||j==null?void 0:j[Le],style:{...Se.style,...$e(Le)},onKeyDown:xc(Se.onKeyDown,Qe),onFocus:xc(Se.onFocus,()=>{Q(!0),se(Le)}),onBlur:xc(Se.onBlur,()=>{Q(!1),se(-1)})}},[ve,ae,J,ee,G,V,N,w,d,m,h,S,j,$e,Qe,Q]),mt=i.useCallback((Se={},Ve=null)=>({...Se,ref:Ve,id:ve.output,htmlFor:ae.map((Ge,Le)=>ve.getThumb(Le)).join(" "),"aria-live":"off"}),[ve,ae]),Pe=i.useCallback((Se,Ve=null)=>{const{value:Ge,...Le}=Se,bt=!(Ge<t||Ge>n),fn=Ge>=ae[0]&&Ge<=ae[ae.length-1];let Bt=Dm(Ge,t,n);Bt=O?100-Bt:Bt;const Ht={position:"absolute",pointerEvents:"none",...Qu({orientation:d,vertical:{bottom:`${Bt}%`},horizontal:{left:`${Bt}%`}})};return{...Le,ref:Ve,id:ve.getMarker(Se.value),role:"presentation","aria-hidden":!0,"data-disabled":bo(m),"data-invalid":bo(!bt),"data-highlighted":bo(fn),style:{...Se.style,...Ht}}},[m,O,n,t,d,ae,ve]),Ne=i.useCallback((Se,Ve=null)=>{const{index:Ge,...Le}=Se;return{...Le,ref:Ve,id:ve.getInput(Ge),type:"hidden",value:ae[Ge],name:Array.isArray(_)?_[Ge]:`${_}-${Ge}`}},[_,ae,ve]);return{state:{value:ae,isFocused:Y,isDragging:G,getThumbPercent:Se=>K[Se],getThumbMinValue:Se=>J[Se].min,getThumbMaxValue:Se=>J[Se].max},actions:Re,getRootProps:dt,getTrackProps:ye,getInnerTrackProps:Ue,getThumbProps:st,getMarkerProps:Pe,getInputProps:Ne,getOutputProps:mt}}function AU(e,t,n,r){return e.map((o,s)=>{const l=s===0?t:e[s-1]+r,c=s===e.length-1?n:e[s+1]-r;return{min:l,max:c}})}var[TU,Sg]=Kt({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within <RangeSlider />"}),[NU,kg]=Kt({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "<RangeSlider />" `}),O6=_e(function(t,n){const r={orientation:"horizontal",...t},o=Xn("Slider",r),s=cn(r),{direction:l}=Hd();s.direction=l;const{getRootProps:c,...d}=RU(s),f=i.useMemo(()=>({...d,name:r.name}),[d,r.name]);return a.jsx(TU,{value:f,children:a.jsx(NU,{value:o,children:a.jsx(je.div,{...c({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});O6.displayName="RangeSlider";var bb=_e(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Sg(),l=kg(),c=r(t,n);return a.jsxs(je.div,{...c,className:vl("chakra-slider__thumb",t.className),__css:l.thumb,children:[c.children,s&&a.jsx("input",{...o({index:t.index})})]})});bb.displayName="RangeSliderThumb";var D6=_e(function(t,n){const{getTrackProps:r}=Sg(),o=kg(),s=r(t,n);return a.jsx(je.div,{...s,className:vl("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});D6.displayName="RangeSliderTrack";var R6=_e(function(t,n){const{getInnerTrackProps:r}=Sg(),o=kg(),s=r(t,n);return a.jsx(je.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});R6.displayName="RangeSliderFilledTrack";var dm=_e(function(t,n){const{getMarkerProps:r}=Sg(),o=kg(),s=r(t,n);return a.jsx(je.div,{...s,className:vl("chakra-slider__marker",t.className),__css:o.mark})});dm.displayName="RangeSliderMark";function $U(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:l,isReversed:c,direction:d="ltr",orientation:f="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:b,onChangeEnd:y,step:x=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:I,focusThumbOnChange:E=!0,...M}=e,D=gn(b),R=gn(y),N=gn(w),O=j6({isReversed:c,direction:d,orientation:f}),[T,U]=qd({value:s,defaultValue:l??FU(n,r),onChange:o}),[G,q]=i.useState(!1),[Y,Q]=i.useState(!1),V=!(h||g),se=(r-n)/10,ee=x||(r-n)/100,le=mc(T,n,r),ae=r-le+n,J=Dm(O?ae:le,n,r),re=f==="vertical",A=P6({min:n,max:r,step:x,isDisabled:h,value:le,isInteractive:V,isReversed:O,isVertical:re,eventSource:null,focusThumbOnChange:E,orientation:f}),L=i.useRef(null),K=i.useRef(null),ne=i.useRef(null),z=i.useId(),oe=m??z,[X,Z]=[`slider-thumb-${oe}`,`slider-track-${oe}`],me=i.useCallback(Pe=>{var Ne,kt;if(!L.current)return;const Se=A.current;Se.eventSource="pointer";const Ve=L.current.getBoundingClientRect(),{clientX:Ge,clientY:Le}=(kt=(Ne=Pe.touches)==null?void 0:Ne[0])!=null?kt:Pe,bt=re?Ve.bottom-Le:Ge-Ve.left,fn=re?Ve.height:Ve.width;let Bt=bt/fn;O&&(Bt=1-Bt);let Ht=B3(Bt,Se.min,Se.max);return Se.step&&(Ht=parseFloat(nb(Ht,Se.min,Se.step))),Ht=mc(Ht,Se.min,Se.max),Ht},[re,O,A]),ve=i.useCallback(Pe=>{const Ne=A.current;Ne.isInteractive&&(Pe=parseFloat(nb(Pe,Ne.min,ee)),Pe=mc(Pe,Ne.min,Ne.max),U(Pe))},[ee,U,A]),de=i.useMemo(()=>({stepUp(Pe=ee){const Ne=O?le-Pe:le+Pe;ve(Ne)},stepDown(Pe=ee){const Ne=O?le+Pe:le-Pe;ve(Ne)},reset(){ve(l||0)},stepTo(Pe){ve(Pe)}}),[ve,O,le,ee,l]),ke=i.useCallback(Pe=>{const Ne=A.current,Se={ArrowRight:()=>de.stepUp(),ArrowUp:()=>de.stepUp(),ArrowLeft:()=>de.stepDown(),ArrowDown:()=>de.stepDown(),PageUp:()=>de.stepUp(se),PageDown:()=>de.stepDown(se),Home:()=>ve(Ne.min),End:()=>ve(Ne.max)}[Pe.key];Se&&(Pe.preventDefault(),Pe.stopPropagation(),Se(Pe),Ne.eventSource="keyboard")},[de,ve,se,A]),we=(t=N==null?void 0:N(le))!=null?t:S,Re=DU(K),{getThumbStyle:Qe,rootStyle:$e,trackStyle:vt,innerTrackStyle:it}=i.useMemo(()=>{const Pe=A.current,Ne=Re??{width:0,height:0};return k6({isReversed:O,orientation:Pe.orientation,thumbRects:[Ne],thumbPercents:[J]})},[O,Re,J,A]),ot=i.useCallback(()=>{A.current.focusThumbOnChange&&setTimeout(()=>{var Ne;return(Ne=K.current)==null?void 0:Ne.focus()})},[A]);ba(()=>{const Pe=A.current;ot(),Pe.eventSource==="keyboard"&&(R==null||R(Pe.value))},[le,R]);function Ce(Pe){const Ne=me(Pe);Ne!=null&&Ne!==A.current.value&&U(Ne)}E6(ne,{onPanSessionStart(Pe){const Ne=A.current;Ne.isInteractive&&(q(!0),ot(),Ce(Pe),D==null||D(Ne.value))},onPanSessionEnd(){const Pe=A.current;Pe.isInteractive&&(q(!1),R==null||R(Pe.value))},onPan(Pe){A.current.isInteractive&&Ce(Pe)}});const Me=i.useCallback((Pe={},Ne=null)=>({...Pe,...M,ref:Et(Ne,ne),tabIndex:-1,"aria-disabled":bc(h),"data-focused":bo(Y),style:{...Pe.style,...$e}}),[M,h,Y,$e]),qe=i.useCallback((Pe={},Ne=null)=>({...Pe,ref:Et(Ne,L),id:Z,"data-disabled":bo(h),style:{...Pe.style,...vt}}),[h,Z,vt]),dt=i.useCallback((Pe={},Ne=null)=>({...Pe,ref:Ne,style:{...Pe.style,...it}}),[it]),ye=i.useCallback((Pe={},Ne=null)=>({...Pe,ref:Et(Ne,K),role:"slider",tabIndex:V?0:void 0,id:X,"data-active":bo(G),"aria-valuetext":we,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":le,"aria-orientation":f,"aria-disabled":bc(h),"aria-readonly":bc(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Pe.style,...Qe(0)},onKeyDown:xc(Pe.onKeyDown,ke),onFocus:xc(Pe.onFocus,()=>Q(!0)),onBlur:xc(Pe.onBlur,()=>Q(!1))}),[V,X,G,we,n,r,le,f,h,g,j,_,Qe,ke]),Ue=i.useCallback((Pe,Ne=null)=>{const kt=!(Pe.value<n||Pe.value>r),Se=le>=Pe.value,Ve=Dm(Pe.value,n,r),Ge={position:"absolute",pointerEvents:"none",...LU({orientation:f,vertical:{bottom:O?`${100-Ve}%`:`${Ve}%`},horizontal:{left:O?`${100-Ve}%`:`${Ve}%`}})};return{...Pe,ref:Ne,role:"presentation","aria-hidden":!0,"data-disabled":bo(h),"data-invalid":bo(!kt),"data-highlighted":bo(Se),style:{...Pe.style,...Ge}}},[h,O,r,n,f,le]),st=i.useCallback((Pe={},Ne=null)=>({...Pe,ref:Ne,type:"hidden",value:le,name:I}),[I,le]);return{state:{value:le,isFocused:Y,isDragging:G},actions:de,getRootProps:Me,getTrackProps:qe,getInnerTrackProps:dt,getThumbProps:ye,getMarkerProps:Ue,getInputProps:st}}function LU(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function FU(e,t){return t<e?e:e+(t-e)/2}var[zU,jg]=Kt({name:"SliderContext",hookName:"useSliderContext",providerName:"<Slider />"}),[BU,_g]=Kt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:"<Slider />"}),Sy=_e((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Xn("Slider",r),s=cn(r),{direction:l}=Hd();s.direction=l;const{getInputProps:c,getRootProps:d,...f}=$U(s),m=d(),h=c({},t);return a.jsx(zU,{value:f,children:a.jsx(BU,{value:o,children:a.jsxs(je.div,{...m,className:vl("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Sy.displayName="Slider";var ky=_e((e,t)=>{const{getThumbProps:n}=jg(),r=_g(),o=n(e,t);return a.jsx(je.div,{...o,className:vl("chakra-slider__thumb",e.className),__css:r.thumb})});ky.displayName="SliderThumb";var jy=_e((e,t)=>{const{getTrackProps:n}=jg(),r=_g(),o=n(e,t);return a.jsx(je.div,{...o,className:vl("chakra-slider__track",e.className),__css:r.track})});jy.displayName="SliderTrack";var _y=_e((e,t)=>{const{getInnerTrackProps:n}=jg(),r=_g(),o=n(e,t);return a.jsx(je.div,{...o,className:vl("chakra-slider__filled-track",e.className),__css:r.filledTrack})});_y.displayName="SliderFilledTrack";var Zi=_e((e,t)=>{const{getMarkerProps:n}=jg(),r=_g(),o=n(e,t);return a.jsx(je.div,{...o,className:vl("chakra-slider__marker",e.className),__css:r.mark})});Zi.displayName="SliderMark";var[HU,A6]=Kt({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Stat />" `}),T6=_e(function(t,n){const r=Xn("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:l,...c}=cn(t);return a.jsx(HU,{value:r,children:a.jsx(je.div,{ref:n,...c,className:et("chakra-stat",s),__css:o,children:a.jsx("dl",{children:l})})})});T6.displayName="Stat";var N6=_e(function(t,n){return a.jsx(je.div,{...t,ref:n,role:"group",className:et("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});N6.displayName="StatGroup";var $6=_e(function(t,n){const r=A6();return a.jsx(je.dt,{ref:n,...t,className:et("chakra-stat__label",t.className),__css:r.label})});$6.displayName="StatLabel";var L6=_e(function(t,n){const r=A6();return a.jsx(je.dd,{ref:n,...t,className:et("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});L6.displayName="StatNumber";var Iy=_e(function(t,n){const r=Xn("Switch",t),{spacing:o="0.5rem",children:s,...l}=cn(t),{getIndicatorProps:c,getInputProps:d,getCheckboxProps:f,getRootProps:m,getLabelProps:h}=z3(l),g=i.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),b=i.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=i.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(je.label,{...m(),className:et("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...d({},n)}),a.jsx(je.span,{...f(),className:"chakra-switch__track",__css:b,children:a.jsx(je.span,{__css:r.thumb,className:"chakra-switch__thumb",...c()})}),s&&a.jsx(je.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});Iy.displayName="Switch";var[WU,VU,UU,GU]=Vx();function KU(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:l,lazyBehavior:c="unmount",orientation:d="horizontal",direction:f="ltr",...m}=e,[h,g]=i.useState(n??0),[b,y]=qd({defaultValue:n??0,value:o,onChange:r});i.useEffect(()=>{o!=null&&g(o)},[o]);const x=UU(),w=i.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:b,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:l,lazyBehavior:c,orientation:d,descendants:x,direction:f,htmlProps:m}}var[qU,Ig]=Kt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within <Tabs />"});function XU(e){const{focusedIndex:t,orientation:n,direction:r}=Ig(),o=VU(),s=i.useCallback(l=>{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())},f=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",b=l.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",x=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&d(),[x]:()=>h&&c(),ArrowDown:()=>g&&c(),ArrowUp:()=>g&&d(),Home:f,End:m}[b];S&&(l.preventDefault(),S(l))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:ze(e.onKeyDown,s)}}function QU(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:l,setFocusedIndex:c,selectedIndex:d}=Ig(),{index:f,register:m}=GU({disabled:t&&!n}),h=f===d,g=()=>{o(f)},b=()=>{c(f),!s&&!(t&&n)&&o(f)},y=z5({...r,ref:Et(m,e.ref),isDisabled:t,isFocusable:n,onClick:ze(e.onClick,g)}),x="button";return{...y,id:F6(l,f),role:"tab",tabIndex:h?0:-1,type:x,"aria-selected":h,"aria-controls":z6(l,f),onFocus:t?void 0:ze(e.onFocus,b)}}var[YU,ZU]=Kt({});function JU(e){const t=Ig(),{id:n,selectedIndex:r}=t,s=rg(e.children).map((l,c)=>i.createElement(YU,{key:c,value:{isSelected:c===r,id:z6(n,c),tabId:F6(n,c),selectedIndex:r}},l));return{...e,children:s}}function eG(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Ig(),{isSelected:s,id:l,tabId:c}=ZU(),d=i.useRef(!1);s&&(d.current=!0);const f=Cy({wasSelected:d.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:f?t:null,role:"tabpanel","aria-labelledby":c,hidden:!s,id:l}}function F6(e,t){return`${e}--tab-${t}`}function z6(e,t){return`${e}--tabpanel-${t}`}var[tG,Pg]=Kt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Tabs />" `}),ci=_e(function(t,n){const r=Xn("Tabs",t),{children:o,className:s,...l}=cn(t),{htmlProps:c,descendants:d,...f}=KU(l),m=i.useMemo(()=>f,[f]),{isFitted:h,...g}=c,b={position:"relative",...r.root};return a.jsx(WU,{value:d,children:a.jsx(qU,{value:m,children:a.jsx(tG,{value:r,children:a.jsx(je.div,{className:et("chakra-tabs",s),ref:n,...g,__css:b,children:o})})})})});ci.displayName="Tabs";var ui=_e(function(t,n){const r=XU({...t,ref:n}),s={display:"flex",...Pg().tablist};return a.jsx(je.div,{...r,className:et("chakra-tabs__tablist",t.className),__css:s})});ui.displayName="TabList";var $r=_e(function(t,n){const r=eG({...t,ref:n}),o=Pg();return a.jsx(je.div,{outline:"0",...r,className:et("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});$r.displayName="TabPanel";var eu=_e(function(t,n){const r=JU(t),o=Pg();return a.jsx(je.div,{...r,width:"100%",ref:n,className:et("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});eu.displayName="TabPanels";var mr=_e(function(t,n){const r=Pg(),o=QU({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(je.button,{...o,className:et("chakra-tabs__tab",t.className),__css:s})});mr.displayName="Tab";function nG(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var rG=["h","minH","height","minHeight"],B6=_e((e,t)=>{const n=ml("Textarea",e),{className:r,rows:o,...s}=cn(e),l=Kx(s),c=o?nG(n,rG):n;return a.jsx(je.textarea,{ref:t,rows:o,...l,className:et("chakra-textarea",r),__css:c})});B6.displayName="Textarea";var oG={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]}}}},xb=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},fm=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function sG(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:l=o,closeOnEsc:c=!0,onOpen:d,onClose:f,placement:m,id:h,isOpen:g,defaultIsOpen:b,arrowSize:y=10,arrowShadowColor:x,arrowPadding:w,modifiers:S,isDisabled:j,gutter:_,offset:I,direction:E,...M}=e,{isOpen:D,onOpen:R,onClose:N}=yy({isOpen:g,defaultIsOpen:b,onOpen:d,onClose:f}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:U,getArrowProps:G}=xy({enabled:D,placement:m,arrowPadding:w,modifiers:S,gutter:_,offset:I,direction:E}),q=i.useId(),Q=`tooltip-${h??q}`,V=i.useRef(null),se=i.useRef(),ee=i.useCallback(()=>{se.current&&(clearTimeout(se.current),se.current=void 0)},[]),le=i.useRef(),ae=i.useCallback(()=>{le.current&&(clearTimeout(le.current),le.current=void 0)},[]),ce=i.useCallback(()=>{ae(),N()},[N,ae]),J=aG(V,ce),re=i.useCallback(()=>{if(!j&&!se.current){D&&J();const Z=fm(V);se.current=Z.setTimeout(R,t)}},[J,j,D,R,t]),A=i.useCallback(()=>{ee();const Z=fm(V);le.current=Z.setTimeout(ce,n)},[n,ce,ee]),L=i.useCallback(()=>{D&&r&&A()},[r,A,D]),K=i.useCallback(()=>{D&&l&&A()},[l,A,D]),ne=i.useCallback(Z=>{D&&Z.key==="Escape"&&A()},[D,A]);Ul(()=>xb(V),"keydown",c?ne:void 0),Ul(()=>{if(!s)return null;const Z=V.current;if(!Z)return null;const me=P5(Z);return me.localName==="body"?fm(V):me},"scroll",()=>{D&&s&&ce()},{passive:!0,capture:!0}),i.useEffect(()=>{j&&(ee(),D&&N())},[j,D,N,ee]),i.useEffect(()=>()=>{ee(),ae()},[ee,ae]),Ul(()=>V.current,"pointerleave",A);const z=i.useCallback((Z={},me=null)=>({...Z,ref:Et(V,me,O),onPointerEnter:ze(Z.onPointerEnter,de=>{de.pointerType!=="touch"&&re()}),onClick:ze(Z.onClick,L),onPointerDown:ze(Z.onPointerDown,K),onFocus:ze(Z.onFocus,re),onBlur:ze(Z.onBlur,A),"aria-describedby":D?Q:void 0}),[re,A,K,D,Q,L,O]),oe=i.useCallback((Z={},me=null)=>T({...Z,style:{...Z.style,[Fn.arrowSize.var]:y?`${y}px`:void 0,[Fn.arrowShadowColor.var]:x}},me),[T,y,x]),X=i.useCallback((Z={},me=null)=>{const ve={...Z.style,position:"relative",transformOrigin:Fn.transformOrigin.varRef};return{ref:me,...M,...Z,id:Q,role:"tooltip",style:ve}},[M,Q]);return{isOpen:D,show:re,hide:A,getTriggerProps:z,getTooltipProps:X,getTooltipPositionerProps:oe,getArrowProps:G,getArrowInnerProps:U}}var Zv="chakra-ui:close-tooltip";function aG(e,t){return i.useEffect(()=>{const n=xb(e);return n.addEventListener(Zv,t),()=>n.removeEventListener(Zv,t)},[t,e]),()=>{const n=xb(e),r=fm(e);n.dispatchEvent(new r.CustomEvent(Zv))}}function lG(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function iG(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var cG=je(Mn.div),Ut=_e((e,t)=>{var n,r;const o=ml("Tooltip",e),s=cn(e),l=Hd(),{children:c,label:d,shouldWrapChildren:f,"aria-label":m,hasArrow:h,bg:g,portalProps:b,background:y,backgroundColor:x,bgColor:w,motionProps:S,...j}=s,_=(r=(n=y??x)!=null?n:g)!=null?r:w;if(_){o.bg=_;const T=OR(l,"colors",_);o[Fn.arrowBg.var]=T}const I=sG({...j,direction:l.direction}),E=typeof c=="string"||f;let M;if(E)M=a.jsx(je.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:c});else{const T=i.Children.only(c);M=i.cloneElement(T,I.getTriggerProps(T.props,T.ref))}const D=!!m,R=I.getTooltipProps({},t),N=D?lG(R,["role","id"]):R,O=iG(R,["role","id"]);return d?a.jsxs(a.Fragment,{children:[M,a.jsx(hr,{children:I.isOpen&&a.jsx(Uc,{...b,children:a.jsx(je.div,{...I.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(cG,{variants:oG,initial:"exit",animate:"enter",exit:"exit",...S,...N,__css:o,children:[d,D&&a.jsx(je.span,{srOnly:!0,...O,children:m}),h&&a.jsx(je.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(je.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:c})});Ut.displayName="Tooltip";const uG=fe(pe,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}}),H6=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=H(uG);return i.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${DR[t]}`)):localStorage.setItem("ROARR_LOG","false"),Aw.ROARR.write=RR.createLogWriter()},[t,n]),i.useEffect(()=>{const o={...AR};TR.set(Aw.Roarr.child(o))},[]),i.useMemo(()=>hl(e),[e])},dG=()=>{const e=te(),t=H(r=>r.system.toastQueue),n=tg();return i.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(NR())},[e,n,t]),null},zs=()=>{const e=te();return i.useCallback(n=>e(lt(rn(n))),[e])},fG=i.memo(dG);var pG=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 uf(e,t){var n=mG(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 mG(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=pG.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var hG=[".DS_Store","Thumbs.db"];function gG(e){return qc(this,void 0,void 0,function(){return Xc(this,function(t){return Lm(e)&&vG(e.dataTransfer)?[2,CG(e.dataTransfer,e.type)]:bG(e)?[2,xG(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,yG(e)]:[2,[]]})})}function vG(e){return Lm(e)}function bG(e){return Lm(e)&&Lm(e.target)}function Lm(e){return typeof e=="object"&&e!==null}function xG(e){return yb(e.target.files).map(function(t){return uf(t)})}function yG(e){return qc(this,void 0,void 0,function(){var t;return Xc(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 uf(r)})]}})})}function CG(e,t){return qc(this,void 0,void 0,function(){var n,r;return Xc(this,function(o){switch(o.label){case 0:return e.items?(n=yb(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(wG))]):[3,2];case 1:return r=o.sent(),[2,u4(W6(r))];case 2:return[2,u4(yb(e.files).map(function(s){return uf(s)}))]}})})}function u4(e){return e.filter(function(t){return hG.indexOf(t.name)===-1})}function yb(e){if(e===null)return[];for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r)}return t}function wG(e){if(typeof e.webkitGetAsEntry!="function")return d4(e);var t=e.webkitGetAsEntry();return t&&t.isDirectory?V6(t):d4(e)}function W6(e){return e.reduce(function(t,n){return ob(ob([],RS(t),!1),RS(Array.isArray(n)?W6(n):[n]),!1)},[])}function d4(e){var t=e.getAsFile();if(!t)return Promise.reject("".concat(e," is not a File"));var n=uf(t);return Promise.resolve(n)}function SG(e){return qc(this,void 0,void 0,function(){return Xc(this,function(t){return[2,e.isDirectory?V6(e):kG(e)]})})}function V6(e){var t=e.createReader();return new Promise(function(n,r){var o=[];function s(){var l=this;t.readEntries(function(c){return qc(l,void 0,void 0,function(){var d,f,m;return Xc(this,function(h){switch(h.label){case 0:if(c.length)return[3,5];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,Promise.all(o)];case 2:return d=h.sent(),n(d),[3,4];case 3:return f=h.sent(),r(f),[3,4];case 4:return[3,6];case 5:m=Promise.all(c.map(SG)),o.push(m),s(),h.label=6;case 6:return[2]}})})},function(c){r(c)})}s()})}function kG(e){return qc(this,void 0,void 0,function(){return Xc(this,function(t){return[2,new Promise(function(n,r){e.file(function(o){var s=uf(o,e.fullPath);n(s)},function(o){r(o)})})]})})}var jG=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(","),r=e.name||"",o=(e.type||"").toLowerCase(),s=o.replace(/\/.*$/,"");return n.some(function(l){var c=l.trim().toLowerCase();return c.charAt(0)==="."?r.toLowerCase().endsWith(c):c.endsWith("/*")?s===c.replace(/\/.*$/,""):o===c})}return!0};function f4(e){return PG(e)||IG(e)||G6(e)||_G()}function _G(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function PG(e){if(Array.isArray(e))return Cb(e)}function p4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function m4(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p4(Object(n),!0).forEach(function(r){U6(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p4(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function U6(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Id(e,t){return OG(e)||MG(e,t)||G6(e,t)||EG()}function EG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G6(e,t){if(e){if(typeof e=="string")return Cb(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 Cb(e,t)}}function Cb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function MG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,s=!1,l,c;try{for(n=n.call(e);!(o=(l=n.next()).done)&&(r.push(l.value),!(t&&r.length===t));o=!0);}catch(d){s=!0,c=d}finally{try{!o&&n.return!=null&&n.return()}finally{if(s)throw c}}return r}}function OG(e){if(Array.isArray(e))return e}var DG="file-invalid-type",RG="file-too-large",AG="file-too-small",TG="too-many-files",NG=function(t){t=Array.isArray(t)&&t.length===1?t[0]:t;var n=Array.isArray(t)?"one of ".concat(t.join(", ")):t;return{code:DG,message:"File type must be ".concat(n)}},h4=function(t){return{code:RG,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},g4=function(t){return{code:AG,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},$G={code:TG,message:"Too many files"};function K6(e,t){var n=e.type==="application/x-moz-file"||jG(e,t);return[n,n?null:NG(t)]}function q6(e,t,n){if(Fl(e.size))if(Fl(t)&&Fl(n)){if(e.size>n)return[!1,h4(n)];if(e.size<t)return[!1,g4(t)]}else{if(Fl(t)&&e.size<t)return[!1,g4(t)];if(Fl(n)&&e.size>n)return[!1,h4(n)]}return[!0,null]}function Fl(e){return e!=null}function LG(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,l=e.maxFiles,c=e.validator;return!s&&t.length>1||s&&l>=1&&t.length>l?!1:t.every(function(d){var f=K6(d,n),m=Id(f,1),h=m[0],g=q6(d,r,o),b=Id(g,1),y=b[0],x=c?c(d):null;return h&&y&&!x})}function Fm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Op(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 v4(e){e.preventDefault()}function FG(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function zG(e){return e.indexOf("Edge/")!==-1}function BG(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return FG(e)||zG(e)}function ys(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,s=new Array(o>1?o-1:0),l=1;l<o;l++)s[l-1]=arguments[l];return t.some(function(c){return!Fm(r)&&c&&c.apply(void 0,[r].concat(s)),Fm(r)})}}function HG(){return"showOpenFilePicker"in window}function WG(e){if(Fl(e)){var t=Object.entries(e).filter(function(n){var r=Id(n,2),o=r[0],s=r[1],l=!0;return X6(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),l=!1),(!Array.isArray(s)||!s.every(Q6))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),l=!1),l}).reduce(function(n,r){var o=Id(r,2),s=o[0],l=o[1];return m4(m4({},n),{},U6({},s,l))},{});return[{description:"Files",accept:t}]}return e}function VG(e){if(Fl(e))return Object.entries(e).reduce(function(t,n){var r=Id(n,2),o=r[0],s=r[1];return[].concat(f4(t),[o],f4(s))},[]).filter(function(t){return X6(t)||Q6(t)}).join(",")}function UG(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function GG(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function X6(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function Q6(e){return/^.*\.[\w]+$/.test(e)}var KG=["children"],qG=["open"],XG=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],QG=["refKey","onChange","onClick"];function YG(e){return eK(e)||JG(e)||Y6(e)||ZG()}function ZG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function eK(e){if(Array.isArray(e))return wb(e)}function Jv(e,t){return rK(e)||nK(e,t)||Y6(e,t)||tK()}function tK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y6(e,t){if(e){if(typeof e=="string")return wb(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 wb(e,t)}}function wb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function nK(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,s=!1,l,c;try{for(n=n.call(e);!(o=(l=n.next()).done)&&(r.push(l.value),!(t&&r.length===t));o=!0);}catch(d){s=!0,c=d}finally{try{!o&&n.return!=null&&n.return()}finally{if(s)throw c}}return r}}function rK(e){if(Array.isArray(e))return e}function b4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?b4(Object(n),!0).forEach(function(r){Sb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b4(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zm(e,t){if(e==null)return{};var n=oK(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oK(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var Py=i.forwardRef(function(e,t){var n=e.children,r=zm(e,KG),o=Ey(r),s=o.open,l=zm(o,qG);return i.useImperativeHandle(t,function(){return{open:s}},[s]),B.createElement(i.Fragment,null,n(kn(kn({},l),{},{open:s})))});Py.displayName="Dropzone";var Z6={disabled:!1,getFilesFromEvent:gG,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};Py.defaultProps=Z6;Py.propTypes={children:nn.func,accept:nn.objectOf(nn.arrayOf(nn.string)),multiple:nn.bool,preventDropOnDocument:nn.bool,noClick:nn.bool,noKeyboard:nn.bool,noDrag:nn.bool,noDragEventsBubbling:nn.bool,minSize:nn.number,maxSize:nn.number,maxFiles:nn.number,disabled:nn.bool,getFilesFromEvent:nn.func,onFileDialogCancel:nn.func,onFileDialogOpen:nn.func,useFsAccessApi:nn.bool,autoFocus:nn.bool,onDragEnter:nn.func,onDragLeave:nn.func,onDragOver:nn.func,onDrop:nn.func,onDropAccepted:nn.func,onDropRejected:nn.func,onError:nn.func,validator:nn.func};var kb={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Ey(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=kn(kn({},Z6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,l=t.minSize,c=t.multiple,d=t.maxFiles,f=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,b=t.onDropAccepted,y=t.onDropRejected,x=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,I=t.noClick,E=t.noKeyboard,M=t.noDrag,D=t.noDragEventsBubbling,R=t.onError,N=t.validator,O=i.useMemo(function(){return VG(n)},[n]),T=i.useMemo(function(){return WG(n)},[n]),U=i.useMemo(function(){return typeof w=="function"?w:x4},[w]),G=i.useMemo(function(){return typeof x=="function"?x:x4},[x]),q=i.useRef(null),Y=i.useRef(null),Q=i.useReducer(sK,kb),V=Jv(Q,2),se=V[0],ee=V[1],le=se.isFocused,ae=se.isFileDialogActive,ce=i.useRef(typeof window<"u"&&window.isSecureContext&&S&&HG()),J=function(){!ce.current&&ae&&setTimeout(function(){if(Y.current){var Me=Y.current.files;Me.length||(ee({type:"closeDialog"}),G())}},300)};i.useEffect(function(){return window.addEventListener("focus",J,!1),function(){window.removeEventListener("focus",J,!1)}},[Y,ae,G,ce]);var re=i.useRef([]),A=function(Me){q.current&&q.current.contains(Me.target)||(Me.preventDefault(),re.current=[])};i.useEffect(function(){return _&&(document.addEventListener("dragover",v4,!1),document.addEventListener("drop",A,!1)),function(){_&&(document.removeEventListener("dragover",v4),document.removeEventListener("drop",A))}},[q,_]),i.useEffect(function(){return!r&&j&&q.current&&q.current.focus(),function(){}},[q,j,r]);var L=i.useCallback(function(Ce){R?R(Ce):console.error(Ce)},[R]),K=i.useCallback(function(Ce){Ce.preventDefault(),Ce.persist(),$e(Ce),re.current=[].concat(YG(re.current),[Ce.target]),Op(Ce)&&Promise.resolve(o(Ce)).then(function(Me){if(!(Fm(Ce)&&!D)){var qe=Me.length,dt=qe>0&&LG({files:Me,accept:O,minSize:l,maxSize:s,multiple:c,maxFiles:d,validator:N}),ye=qe>0&&!dt;ee({isDragAccept:dt,isDragReject:ye,isDragActive:!0,type:"setDraggedFiles"}),f&&f(Ce)}}).catch(function(Me){return L(Me)})},[o,f,L,D,O,l,s,c,d,N]),ne=i.useCallback(function(Ce){Ce.preventDefault(),Ce.persist(),$e(Ce);var Me=Op(Ce);if(Me&&Ce.dataTransfer)try{Ce.dataTransfer.dropEffect="copy"}catch{}return Me&&h&&h(Ce),!1},[h,D]),z=i.useCallback(function(Ce){Ce.preventDefault(),Ce.persist(),$e(Ce);var Me=re.current.filter(function(dt){return q.current&&q.current.contains(dt)}),qe=Me.indexOf(Ce.target);qe!==-1&&Me.splice(qe,1),re.current=Me,!(Me.length>0)&&(ee({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Op(Ce)&&m&&m(Ce))},[q,m,D]),oe=i.useCallback(function(Ce,Me){var qe=[],dt=[];Ce.forEach(function(ye){var Ue=K6(ye,O),st=Jv(Ue,2),mt=st[0],Pe=st[1],Ne=q6(ye,l,s),kt=Jv(Ne,2),Se=kt[0],Ve=kt[1],Ge=N?N(ye):null;if(mt&&Se&&!Ge)qe.push(ye);else{var Le=[Pe,Ve];Ge&&(Le=Le.concat(Ge)),dt.push({file:ye,errors:Le.filter(function(bt){return bt})})}}),(!c&&qe.length>1||c&&d>=1&&qe.length>d)&&(qe.forEach(function(ye){dt.push({file:ye,errors:[$G]})}),qe.splice(0)),ee({acceptedFiles:qe,fileRejections:dt,type:"setFiles"}),g&&g(qe,dt,Me),dt.length>0&&y&&y(dt,Me),qe.length>0&&b&&b(qe,Me)},[ee,c,O,l,s,d,g,b,y,N]),X=i.useCallback(function(Ce){Ce.preventDefault(),Ce.persist(),$e(Ce),re.current=[],Op(Ce)&&Promise.resolve(o(Ce)).then(function(Me){Fm(Ce)&&!D||oe(Me,Ce)}).catch(function(Me){return L(Me)}),ee({type:"reset"})},[o,oe,L,D]),Z=i.useCallback(function(){if(ce.current){ee({type:"openDialog"}),U();var Ce={multiple:c,types:T};window.showOpenFilePicker(Ce).then(function(Me){return o(Me)}).then(function(Me){oe(Me,null),ee({type:"closeDialog"})}).catch(function(Me){UG(Me)?(G(Me),ee({type:"closeDialog"})):GG(Me)?(ce.current=!1,Y.current?(Y.current.value=null,Y.current.click()):L(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 <input> was provided."))):L(Me)});return}Y.current&&(ee({type:"openDialog"}),U(),Y.current.value=null,Y.current.click())},[ee,U,G,S,oe,L,T,c]),me=i.useCallback(function(Ce){!q.current||!q.current.isEqualNode(Ce.target)||(Ce.key===" "||Ce.key==="Enter"||Ce.keyCode===32||Ce.keyCode===13)&&(Ce.preventDefault(),Z())},[q,Z]),ve=i.useCallback(function(){ee({type:"focus"})},[]),de=i.useCallback(function(){ee({type:"blur"})},[]),ke=i.useCallback(function(){I||(BG()?setTimeout(Z,0):Z())},[I,Z]),we=function(Me){return r?null:Me},Re=function(Me){return E?null:we(Me)},Qe=function(Me){return M?null:we(Me)},$e=function(Me){D&&Me.stopPropagation()},vt=i.useMemo(function(){return function(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Me=Ce.refKey,qe=Me===void 0?"ref":Me,dt=Ce.role,ye=Ce.onKeyDown,Ue=Ce.onFocus,st=Ce.onBlur,mt=Ce.onClick,Pe=Ce.onDragEnter,Ne=Ce.onDragOver,kt=Ce.onDragLeave,Se=Ce.onDrop,Ve=zm(Ce,XG);return kn(kn(Sb({onKeyDown:Re(ys(ye,me)),onFocus:Re(ys(Ue,ve)),onBlur:Re(ys(st,de)),onClick:we(ys(mt,ke)),onDragEnter:Qe(ys(Pe,K)),onDragOver:Qe(ys(Ne,ne)),onDragLeave:Qe(ys(kt,z)),onDrop:Qe(ys(Se,X)),role:typeof dt=="string"&&dt!==""?dt:"presentation"},qe,q),!r&&!E?{tabIndex:0}:{}),Ve)}},[q,me,ve,de,ke,K,ne,z,X,E,M,r]),it=i.useCallback(function(Ce){Ce.stopPropagation()},[]),ot=i.useMemo(function(){return function(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Me=Ce.refKey,qe=Me===void 0?"ref":Me,dt=Ce.onChange,ye=Ce.onClick,Ue=zm(Ce,QG),st=Sb({accept:O,multiple:c,type:"file",style:{display:"none"},onChange:we(ys(dt,X)),onClick:we(ys(ye,it)),tabIndex:-1},qe,Y);return kn(kn({},st),Ue)}},[Y,n,c,X,r]);return kn(kn({},se),{},{isFocused:le&&!r,getRootProps:vt,getInputProps:ot,rootRef:q,inputRef:Y,open:we(Z)})}function sK(e,t){switch(t.type){case"focus":return kn(kn({},e),{},{isFocused:!0});case"blur":return kn(kn({},e),{},{isFocused:!1});case"openDialog":return kn(kn({},kb),{},{isFileDialogActive:!0});case"closeDialog":return kn(kn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return kn(kn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return kn(kn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return kn({},kb);default:return e}}function x4(){}function jb(){return jb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jb.apply(this,arguments)}var J6=["shift","alt","meta","mod","ctrl"],aK={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Ka(e){return(aK[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function lK(e){return J6.includes(e)}function e1(e,t){return t===void 0&&(t=","),e.split(t)}function t1(e,t,n){t===void 0&&(t="+");var r=e.toLocaleLowerCase().split(t).map(function(l){return Ka(l)}),o={alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},s=r.filter(function(l){return!J6.includes(l)});return jb({},o,{keys:s,description:n})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(e){e.key!==void 0&&eP([Ka(e.key),Ka(e.code)])}),document.addEventListener("keyup",function(e){e.key!==void 0&&tP([Ka(e.key),Ka(e.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){qa.clear()})})();var qa=new Set;function My(e){return Array.isArray(e)}function pm(e,t){t===void 0&&(t=",");var n=My(e)?e:e.split(t);return n.every(function(r){return qa.has(r.trim().toLowerCase())})}function eP(e){var t=Array.isArray(e)?e:[e];qa.has("meta")&&qa.forEach(function(n){return!lK(n)&&qa.delete(n.toLowerCase())}),t.forEach(function(n){return qa.add(n.toLowerCase())})}function tP(e){var t=Array.isArray(e)?e:[e];e==="meta"?qa.clear():t.forEach(function(n){return qa.delete(n.toLowerCase())})}function iK(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function cK(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function uK(e){return nP(e,["input","textarea","select"])}function nP(e,t){var n=e.target;t===void 0&&(t=!1);var r=n&&n.tagName;return My(t)?!!(r&&t&&t.some(function(o){return o.toLowerCase()===r.toLowerCase()})):!!(r&&t&&t===!0)}function dK(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var fK=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,l=n.mod,c=n.shift,d=n.ctrl,f=n.keys,m=t.key,h=t.code,g=t.ctrlKey,b=t.metaKey,y=t.shiftKey,x=t.altKey,w=Ka(h),S=m.toLowerCase();if(!r){if(o===!x&&S!=="alt"||c===!y&&S!=="shift")return!1;if(l){if(!b&&!g)return!1}else if(s===!b&&S!=="meta"&&S!=="os"||d===!g&&S!=="ctrl"&&S!=="control")return!1}return f&&f.length===1&&(f.includes(S)||f.includes(w))?!0:f?pm(f):!f},pK=i.createContext(void 0),mK=function(){return i.useContext(pK)};function rP(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&&rP(e[r],t[r])},!0):e===t}var hK=i.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),gK=function(){return i.useContext(hK)};function vK(e){var t=i.useRef(void 0);return rP(t.current,e)||(t.current=e),t.current}var y4=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},bK=typeof window<"u"?i.useLayoutEffect:i.useEffect;function tt(e,t,n,r){var o=i.useRef(null),s=i.useRef(!1),l=n instanceof Array?r instanceof Array?void 0:r:n,c=My(e)?e.join(l==null?void 0:l.splitKey):e,d=n instanceof Array?n:r instanceof Array?r:void 0,f=i.useCallback(t,d??[]),m=i.useRef(f);d?m.current=f:m.current=t;var h=vK(l),g=gK(),b=g.enabledScopes,y=mK();return bK(function(){if(!((h==null?void 0:h.enabled)===!1||!dK(b,h==null?void 0:h.scopes))){var x=function(I,E){var M;if(E===void 0&&(E=!1),!(uK(I)&&!nP(I,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(I))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){y4(I);return}(M=I.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||e1(c,h==null?void 0:h.splitKey).forEach(function(D){var R,N=t1(D,h==null?void 0:h.combinationKey);if(fK(I,N,h==null?void 0:h.ignoreModifiers)||(R=N.keys)!=null&&R.includes("*")){if(E&&s.current)return;if(iK(I,N,h==null?void 0:h.preventDefault),!cK(I,N,h==null?void 0:h.enabled)){y4(I);return}m.current(I,N),E||(s.current=!0)}})}},w=function(I){I.key!==void 0&&(eP(Ka(I.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&x(I))},S=function(I){I.key!==void 0&&(tP(Ka(I.code)),s.current=!1,h!=null&&h.keyup&&x(I,!0))},j=o.current||(l==null?void 0:l.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&e1(c,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(t1(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&e1(c,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(t1(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[c,h,b]),o}const xK=e=>{const{t}=W(),{isDragAccept:n,isDragReject:r,setIsHandlingUpload:o}=e;return tt("esc",()=>{o(!1)}),a.jsxs(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx($,{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($,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx($,{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:n?a.jsx(or,{size:"lg",children:t("gallery.dropToUpload")}):a.jsxs(a.Fragment,{children:[a.jsx(or,{size:"lg",children:t("toast.invalidUpload")}),a.jsx(or,{size:"md",children:t("toast.uploadFailedInvalidUploadDesc")})]})})})]})},yK=i.memo(xK),CK=fe([pe,tr],({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}}),wK=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=H(CK),o=zs(),{t:s}=W(),[l,c]=i.useState(!1),[d]=CI(),f=i.useCallback(I=>{c(!0),o({title:s("toast.uploadFailed"),description:I.errors.map(E=>E.message).join(`
`),status:"error"})},[s,o]),m=i.useCallback(async I=>{d({file:I,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,d]),h=i.useCallback((I,E)=>{if(E.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}E.forEach(M=>{f(M)}),I.forEach(M=>{m(M)})},[s,o,m,f]),g=i.useCallback(()=>{c(!0)},[]),{getRootProps:b,getInputProps:y,isDragAccept:x,isDragReject:w,isDragActive:S,inputRef:j}=Ey({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});i.useEffect(()=>{const I=async E=>{var M,D;j.current&&(M=E.clipboardData)!=null&&M.files&&(j.current.files=E.clipboardData.files,(D=j.current)==null||D.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",I),()=>{document.removeEventListener("paste",I)}},[j]);const _=i.useCallback(I=>{I.key},[]);return a.jsxs(Ie,{...b({style:{}}),onKeyDown:_,children:[a.jsx("input",{...y()}),t,a.jsx(hr,{children:S&&l&&a.jsx(Mn.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(yK,{isDragAccept:x,isDragReject:w,setIsHandlingUpload:c})},"image-upload-overlay")})]})},SK=i.memo(wK),kK=_e((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...l}={},isChecked:c,...d}=e;return a.jsx(Ut,{label:r,placement:o,hasArrow:s,...l,children:a.jsx(ol,{ref:t,colorScheme:c?"accent":"base",...d,children:n})})}),Xe=i.memo(kK);function jK(e){const t=i.createContext(null);return[({children:o,value:s})=>B.createElement(t.Provider,{value:s},o),()=>{const o=i.useContext(t);if(o===null)throw new Error(e);return o}]}function oP(e){return Array.isArray(e)?e:[e]}const _K=()=>{};function IK(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||_K:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function sP({data:e}){const t=[],n=[],r=e.reduce((o,s,l)=>(s.group?o[s.group]?o[s.group].push(l):o[s.group]=[l]:n.push(l),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function aP(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==B.Fragment:!1}function lP(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;t<e.length;t++)e[t]&&(n=lP(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function iP(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=lP(t))&&(r&&(r+=" "),r+=n);return r}const PK={app:100,modal:200,popover:300,overlay:400,max:9999};function Oy(e){return PK[e]}function EK(e,t){const n=i.useRef();return(!n.current||t.length!==n.current.prevDeps.length||n.current.prevDeps.map((r,o)=>r===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const MK=$R({key:"mantine",prepend:!0});function OK(){return k3()||MK}var DK=Object.defineProperty,C4=Object.getOwnPropertySymbols,RK=Object.prototype.hasOwnProperty,AK=Object.prototype.propertyIsEnumerable,w4=(e,t,n)=>t in e?DK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TK=(e,t)=>{for(var n in t||(t={}))RK.call(t,n)&&w4(e,n,t[n]);if(C4)for(var n of C4(t))AK.call(t,n)&&w4(e,n,t[n]);return e};const n1="ref";function NK(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=TK({},n);return delete r[n1],{args:[r],ref:t}}const{cssFactory:$K}=(()=>{function e(n,r,o){const s=[],l=zR(n,s,o);return s.length<2?o:l+r(s)}function t(n){const{cache:r}=n,o=(...l)=>{const{ref:c,args:d}=NK(l),f=LR(d,r.registered);return FR(r,f,!1),`${r.key}-${f.name}${c===void 0?"":` ${c}`}`};return{css:o,cx:(...l)=>e(r.registered,o,iP(l))}}return{cssFactory:t}})();function cP(){const e=OK();return EK(()=>$K({cache:e}),[e])}function LK({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const l=n.reduce((c,d)=>(Object.keys(d.classNames).forEach(f=>{typeof c[f]!="string"?c[f]=`${d.classNames[f]}`:c[f]=`${c[f]} ${d.classNames[f]}`}),c),{});return Object.keys(t).reduce((c,d)=>(c[d]=e(t[d],l[d],r!=null&&r[d],Array.isArray(o)?o.filter(Boolean).map(f=>`${(s==null?void 0:s.key)||"mantine"}-${f}-${d}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${d}`:null),c),{})}var FK=Object.defineProperty,S4=Object.getOwnPropertySymbols,zK=Object.prototype.hasOwnProperty,BK=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?FK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))zK.call(t,n)&&k4(e,n,t[n]);if(S4)for(var n of S4(t))BK.call(t,n)&&k4(e,n,t[n]);return e};function _b(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 j4(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,l)=>_b(s,l),{}):o(e)}function HK({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,l)=>(l.variants&&r in l.variants&&_b(s,l.variants[r](t,n,{variant:r,size:o})),l.sizes&&o in l.sizes&&_b(s,l.sizes[o](t,n,{variant:r,size:o})),s),{})}function gr(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=wa(),l=aL(o==null?void 0:o.name),c=k3(),d={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:f,cx:m}=cP(),h=t(s,r,d),g=j4(o==null?void 0:o.styles,s,r,d),b=j4(l,s,r,d),y=HK({ctx:l,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),x=Object.fromEntries(Object.keys(h).map(w=>{const S=m({[f(h[w])]:!(o!=null&&o.unstyled)},f(y[w]),f(b[w]),f(g[w]));return[w,S]}));return{classes:LK({cx:m,classes:x,context:l,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:c}),cx:m,theme:s}}return n}function _4(e){return`___ref-${e||""}`}var WK=Object.defineProperty,VK=Object.defineProperties,UK=Object.getOwnPropertyDescriptors,I4=Object.getOwnPropertySymbols,GK=Object.prototype.hasOwnProperty,KK=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?WK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fu=(e,t)=>{for(var n in t||(t={}))GK.call(t,n)&&P4(e,n,t[n]);if(I4)for(var n of I4(t))KK.call(t,n)&&P4(e,n,t[n]);return e},zu=(e,t)=>VK(e,UK(t));const Bu={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Ae(10)})`},transitionProperty:"transform, opacity"},Dp={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(-${Ae(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(${Ae(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(${Ae(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ae(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:zu(Fu({},Bu),{common:{transformOrigin:"center center"}}),"pop-bottom-left":zu(Fu({},Bu),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":zu(Fu({},Bu),{common:{transformOrigin:"bottom right"}}),"pop-top-left":zu(Fu({},Bu),{common:{transformOrigin:"top left"}}),"pop-top-right":zu(Fu({},Bu),{common:{transformOrigin:"top right"}})},E4=["mousedown","touchstart"];function qK(e,t,n){const r=i.useRef();return i.useEffect(()=>{const o=s=>{const{target:l}=s??{};if(Array.isArray(n)){const c=(l==null?void 0:l.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(l)&&l.tagName!=="HTML";n.every(f=>!!f&&!s.composedPath().includes(f))&&!c&&e()}else r.current&&!r.current.contains(l)&&e()};return(t||E4).forEach(s=>document.addEventListener(s,o)),()=>{(t||E4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function XK(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function QK(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function YK(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=i.useState(n?t:QK(e,t)),s=i.useRef();return i.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),XK(s.current,l=>o(l.matches))},[e]),r}const uP=typeof document<"u"?i.useLayoutEffect:i.useEffect;function os(e,t){const n=i.useRef(!1);i.useEffect(()=>()=>{n.current=!1},[]),i.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function ZK({opened:e,shouldReturnFocus:t=!0}){const n=i.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return os(()=>{let o=-1;const s=l=>{l.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 JK=/input|select|textarea|button|object/,dP="a, input, select, textarea, button, object, [tabindex]";function eq(e){return e.style.display==="none"}function tq(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(eq(n))return!1;n=n.parentNode}return!0}function fP(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Ib(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(fP(e));return(JK.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&tq(e)}function pP(e){const t=fP(e);return(Number.isNaN(t)||t>=0)&&Ib(e)}function nq(e){return Array.from(e.querySelectorAll(dP)).filter(pP)}function rq(e,t){const n=nq(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 l=n[t.shiftKey?n.length-1:0];l&&l.focus()}function Dy(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function oq(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 l=o.getAttribute("aria-hidden"),c=o.getAttribute("data-hidden"),d=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),l===null||l==="false"?o.setAttribute("aria-hidden","true"):!c&&!d&&o.setAttribute("data-hidden",l),{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 sq(e=!0){const t=i.useRef(),n=i.useRef(null),r=s=>{let l=s.querySelector("[data-autofocus]");if(!l){const c=Array.from(s.querySelectorAll(dP));l=c.find(pP)||c.find(Ib)||null,!l&&Ib(s)&&(l=s)}l&&l.focus({preventScroll:!0})},o=i.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=oq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return i.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=l=>{l.key==="Tab"&&t.current&&rq(t.current,l)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const aq=B["useId".toString()]||(()=>{});function lq(){const e=aq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Ry(e){const t=lq(),[n,r]=i.useState(t);return uP(()=>{r(Dy())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function M4(e,t,n){i.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function mP(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function iq(...e){return t=>{e.forEach(n=>mP(n,t))}}function df(...e){return i.useCallback(iq(...e),e)}function Pd({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=i.useState(t!==void 0?t:n),l=c=>{s(c),r==null||r(c)};return e!==void 0?[e,r,!0]:[o,l,!1]}function hP(e,t){return YK("(prefers-reduced-motion: reduce)",e,t)}const cq=e=>e<.5?2*e*e:-1+(4-2*e)*e,uq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const l=!!n,d=(n||document.body).getBoundingClientRect(),f=t.getBoundingClientRect(),m=h=>f[h]-d[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const b=h-o;return b<=f.height*(s?0:1)||!s?b:0}const g=l?d.height:window.innerHeight;if(r==="end"){const b=h+o-g+f.height;return b>=-f.height*(s?0:1)||!s?b:0}return r==="center"?h-g/2+f.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const b=h-o;return b<=f.width||!s?b:0}const g=l?d.width:window.innerWidth;if(r==="end"){const b=h+o-g+f.width;return b>=-f.width||!s?b:0}return r==="center"?h-g/2+f.width/2:0}return 0},dq=({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]},fq=({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 gP({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=cq,offset:o=0,cancelable:s=!0,isList:l=!1}={}){const c=i.useRef(0),d=i.useRef(0),f=i.useRef(!1),m=i.useRef(null),h=i.useRef(null),g=hP(),b=()=>{c.current&&cancelAnimationFrame(c.current)},y=i.useCallback(({alignment:w="start"}={})=>{var S;f.current=!1,c.current&&b();const j=(S=dq({parent:m.current,axis:t}))!=null?S:0,_=uq({parent:m.current,target:h.current,axis:t,alignment:w,offset:o,isList:l})-(m.current?0:j);function I(){d.current===0&&(d.current=performance.now());const M=performance.now()-d.current,D=g||e===0?1:M/e,R=j+_*r(D);fq({parent:m.current,axis:t,distance:R}),!f.current&&D<1?c.current=requestAnimationFrame(I):(typeof n=="function"&&n(),d.current=0,c.current=0,b())}I()},[t,e,r,l,o,n,g]),x=()=>{s&&(f.current=!0)};return M4("wheel",x,{passive:!0}),M4("touchmove",x,{passive:!0}),i.useEffect(()=>b,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:b}}var O4=Object.getOwnPropertySymbols,pq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,hq=(e,t)=>{var n={};for(var r in e)pq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&O4)for(var r of O4(e))t.indexOf(r)<0&&mq.call(e,r)&&(n[r]=e[r]);return n};function Eg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:l,ml:c,mr:d,p:f,px:m,py:h,pt:g,pb:b,pl:y,pr:x,bg:w,c:S,opacity:j,ff:_,fz:I,fw:E,lts:M,ta:D,lh:R,fs:N,tt:O,td:T,w:U,miw:G,maw:q,h:Y,mih:Q,mah:V,bgsz:se,bgp:ee,bgr:le,bga:ae,pos:ce,top:J,left:re,bottom:A,right:L,inset:K,display:ne}=t,z=hq(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:lL({m:n,mx:r,my:o,mt:s,mb:l,ml:c,mr:d,p:f,px:m,py:h,pt:g,pb:b,pl:y,pr:x,bg:w,c:S,opacity:j,ff:_,fz:I,fw:E,lts:M,ta:D,lh:R,fs:N,tt:O,td:T,w:U,miw:G,maw:q,h:Y,mih:Q,mah:V,bgsz:se,bgp:ee,bgr:le,bga:ae,pos:ce,top:J,left:re,bottom:A,right:L,inset:K,display:ne}),rest:z}}function gq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>CS(pt({size:r,sizes:t.breakpoints}))-CS(pt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function vq({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return gq(e,t).reduce((l,c)=>{if(c==="base"&&e.base!==void 0){const f=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{l[m]=f}),l):(l[r]=f,l)}const d=n(e[c],t);return Array.isArray(r)?(l[t.fn.largerThan(c)]={},r.forEach(f=>{l[t.fn.largerThan(c)][f]=d}),l):(l[t.fn.largerThan(c)]={[r]:d},l)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,l)=>(s[l]=o,s),{}):{[r]:o}}function bq(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 xq(e){return Ae(e)}function yq(e){return e}function Cq(e,t){return pt({size:e,sizes:t.fontSizes})}const wq=["-xs","-sm","-md","-lg","-xl"];function Sq(e,t){return wq.includes(e)?`calc(${pt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:pt({size:e,sizes:t.spacing})}const kq={identity:yq,color:bq,size:xq,fontSize:Cq,spacing:Sq},jq={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 _q=Object.defineProperty,D4=Object.getOwnPropertySymbols,Iq=Object.prototype.hasOwnProperty,Pq=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?_q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A4=(e,t)=>{for(var n in t||(t={}))Iq.call(t,n)&&R4(e,n,t[n]);if(D4)for(var n of D4(t))Pq.call(t,n)&&R4(e,n,t[n]);return e};function T4(e,t,n=jq){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(vq({value:e[s],getValue:kq[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(l=>{typeof s[l]=="object"&&s[l]!==null&&l in o?o[l]=A4(A4({},o[l]),s[l]):o[l]=s[l]}),o),{})}function N4(e,t){return typeof e=="function"?e(t):e}function Eq(e,t,n){const r=wa(),{css:o,cx:s}=cP();return Array.isArray(e)?s(n,o(T4(t,r)),e.map(l=>o(N4(l,r)))):s(n,o(N4(e,r)),o(T4(t,r)))}var Mq=Object.defineProperty,Bm=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,bP=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?Mq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oq=(e,t)=>{for(var n in t||(t={}))vP.call(t,n)&&$4(e,n,t[n]);if(Bm)for(var n of Bm(t))bP.call(t,n)&&$4(e,n,t[n]);return e},Dq=(e,t)=>{var n={};for(var r in e)vP.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&&bP.call(e,r)&&(n[r]=e[r]);return n};const xP=i.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:l}=n,c=Dq(n,["className","component","style","sx"]);const{systemStyles:d,rest:f}=Eg(c),m=o||"div";return B.createElement(m,Oq({ref:t,className:Eq(l,d,r),style:s},f))});xP.displayName="@mantine/core/Box";const Vr=xP;var Rq=Object.defineProperty,Aq=Object.defineProperties,Tq=Object.getOwnPropertyDescriptors,L4=Object.getOwnPropertySymbols,Nq=Object.prototype.hasOwnProperty,$q=Object.prototype.propertyIsEnumerable,F4=(e,t,n)=>t in e?Rq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||(t={}))Nq.call(t,n)&&F4(e,n,t[n]);if(L4)for(var n of L4(t))$q.call(t,n)&&F4(e,n,t[n]);return e},Lq=(e,t)=>Aq(e,Tq(t)),Fq=gr(e=>({root:Lq(z4(z4({},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 zq=Fq;var Bq=Object.defineProperty,Hm=Object.getOwnPropertySymbols,yP=Object.prototype.hasOwnProperty,CP=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?Bq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hq=(e,t)=>{for(var n in t||(t={}))yP.call(t,n)&&B4(e,n,t[n]);if(Hm)for(var n of Hm(t))CP.call(t,n)&&B4(e,n,t[n]);return e},Wq=(e,t)=>{var n={};for(var r in e)yP.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&&CP.call(e,r)&&(n[r]=e[r]);return n};const wP=i.forwardRef((e,t)=>{const n=Nn("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:l}=n,c=Wq(n,["className","component","unstyled","variant"]),{classes:d,cx:f}=zq(null,{name:"UnstyledButton",unstyled:s,variant:l});return B.createElement(Vr,Hq({component:o,ref:t,className:f(d.root,r),type:o==="button"?"button":void 0},c))});wP.displayName="@mantine/core/UnstyledButton";const Vq=wP;var Uq=Object.defineProperty,Gq=Object.defineProperties,Kq=Object.getOwnPropertyDescriptors,H4=Object.getOwnPropertySymbols,qq=Object.prototype.hasOwnProperty,Xq=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?Uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pb=(e,t)=>{for(var n in t||(t={}))qq.call(t,n)&&W4(e,n,t[n]);if(H4)for(var n of H4(t))Xq.call(t,n)&&W4(e,n,t[n]);return e},V4=(e,t)=>Gq(e,Kq(t));const Qq=["subtle","filled","outline","light","default","transparent","gradient"],Rp={xs:Ae(18),sm:Ae(22),md:Ae(28),lg:Ae(34),xl:Ae(44)};function Yq({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%"})}:Qq.includes(e)?Pb({border:`${Ae(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var Zq=gr((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:V4(Pb({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:pt({size:s,sizes:Rp}),minHeight:pt({size:s,sizes:Rp}),width:pt({size:s,sizes:Rp}),minWidth:pt({size:s,sizes:Rp})},Yq({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":V4(Pb({content:'""'},e.fn.cover(Ae(-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 Jq=Zq;var eX=Object.defineProperty,Wm=Object.getOwnPropertySymbols,SP=Object.prototype.hasOwnProperty,kP=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?eX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G4=(e,t)=>{for(var n in t||(t={}))SP.call(t,n)&&U4(e,n,t[n]);if(Wm)for(var n of Wm(t))kP.call(t,n)&&U4(e,n,t[n]);return e},K4=(e,t)=>{var n={};for(var r in e)SP.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&&kP.call(e,r)&&(n[r]=e[r]);return n};function tX(e){var t=e,{size:n,color:r}=t,o=K4(t,["size","color"]);const s=o,{style:l}=s,c=K4(s,["style"]);return B.createElement("svg",G4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:G4({width:n},l)},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 nX=Object.defineProperty,Vm=Object.getOwnPropertySymbols,jP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,q4=(e,t,n)=>t in e?nX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X4=(e,t)=>{for(var n in t||(t={}))jP.call(t,n)&&q4(e,n,t[n]);if(Vm)for(var n of Vm(t))_P.call(t,n)&&q4(e,n,t[n]);return e},Q4=(e,t)=>{var n={};for(var r in e)jP.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&&_P.call(e,r)&&(n[r]=e[r]);return n};function rX(e){var t=e,{size:n,color:r}=t,o=Q4(t,["size","color"]);const s=o,{style:l}=s,c=Q4(s,["style"]);return B.createElement("svg",X4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:X4({width:n,height:n},l)},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 oX=Object.defineProperty,Um=Object.getOwnPropertySymbols,IP=Object.prototype.hasOwnProperty,PP=Object.prototype.propertyIsEnumerable,Y4=(e,t,n)=>t in e?oX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Z4=(e,t)=>{for(var n in t||(t={}))IP.call(t,n)&&Y4(e,n,t[n]);if(Um)for(var n of Um(t))PP.call(t,n)&&Y4(e,n,t[n]);return e},J4=(e,t)=>{var n={};for(var r in e)IP.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&&PP.call(e,r)&&(n[r]=e[r]);return n};function sX(e){var t=e,{size:n,color:r}=t,o=J4(t,["size","color"]);const s=o,{style:l}=s,c=J4(s,["style"]);return B.createElement("svg",Z4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Z4({width:n},l)},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 aX=Object.defineProperty,Gm=Object.getOwnPropertySymbols,EP=Object.prototype.hasOwnProperty,MP=Object.prototype.propertyIsEnumerable,ek=(e,t,n)=>t in e?aX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lX=(e,t)=>{for(var n in t||(t={}))EP.call(t,n)&&ek(e,n,t[n]);if(Gm)for(var n of Gm(t))MP.call(t,n)&&ek(e,n,t[n]);return e},iX=(e,t)=>{var n={};for(var r in e)EP.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&&MP.call(e,r)&&(n[r]=e[r]);return n};const o1={bars:tX,oval:rX,dots:sX},cX={xs:Ae(18),sm:Ae(22),md:Ae(36),lg:Ae(44),xl:Ae(58)},uX={size:"md"};function OP(e){const t=Nn("Loader",uX,e),{size:n,color:r,variant:o}=t,s=iX(t,["size","color","variant"]),l=wa(),c=o in o1?o:l.loader;return B.createElement(Vr,lX({role:"presentation",component:o1[c]||o1.bars,size:pt({size:n,sizes:cX}),color:l.fn.variant({variant:"filled",primaryFallback:!1,color:r||l.primaryColor}).background},s))}OP.displayName="@mantine/core/Loader";var dX=Object.defineProperty,Km=Object.getOwnPropertySymbols,DP=Object.prototype.hasOwnProperty,RP=Object.prototype.propertyIsEnumerable,tk=(e,t,n)=>t in e?dX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nk=(e,t)=>{for(var n in t||(t={}))DP.call(t,n)&&tk(e,n,t[n]);if(Km)for(var n of Km(t))RP.call(t,n)&&tk(e,n,t[n]);return e},fX=(e,t)=>{var n={};for(var r in e)DP.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&&RP.call(e,r)&&(n[r]=e[r]);return n};const pX={color:"gray",size:"md",variant:"subtle"},AP=i.forwardRef((e,t)=>{const n=Nn("ActionIcon",pX,e),{className:r,color:o,children:s,radius:l,size:c,variant:d,gradient:f,disabled:m,loaderProps:h,loading:g,unstyled:b,__staticSelector:y}=n,x=fX(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=Jq({radius:l,color:o,gradient:f},{name:["ActionIcon",y],unstyled:b,size:c,variant:d}),_=B.createElement(OP,nk({color:j.fn.variant({color:o,variant:d}).color,size:"100%","data-action-icon-loader":!0},h));return B.createElement(Vq,nk({className:S(w.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:b},x),g?_:s)});AP.displayName="@mantine/core/ActionIcon";const mX=AP;var hX=Object.defineProperty,gX=Object.defineProperties,vX=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,TP=Object.prototype.hasOwnProperty,NP=Object.prototype.propertyIsEnumerable,rk=(e,t,n)=>t in e?hX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bX=(e,t)=>{for(var n in t||(t={}))TP.call(t,n)&&rk(e,n,t[n]);if(qm)for(var n of qm(t))NP.call(t,n)&&rk(e,n,t[n]);return e},xX=(e,t)=>gX(e,vX(t)),yX=(e,t)=>{var n={};for(var r in e)TP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qm)for(var r of qm(e))t.indexOf(r)<0&&NP.call(e,r)&&(n[r]=e[r]);return n};function $P(e){const t=Nn("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,l=yX(t,["children","target","className","innerRef"]),c=wa(),[d,f]=i.useState(!1),m=i.useRef();return uP(()=>(f(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),d?Jr.createPortal(B.createElement("div",xX(bX({className:o,dir:c.dir},l),{ref:s}),n),m.current):null}$P.displayName="@mantine/core/Portal";var CX=Object.defineProperty,Xm=Object.getOwnPropertySymbols,LP=Object.prototype.hasOwnProperty,FP=Object.prototype.propertyIsEnumerable,ok=(e,t,n)=>t in e?CX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wX=(e,t)=>{for(var n in t||(t={}))LP.call(t,n)&&ok(e,n,t[n]);if(Xm)for(var n of Xm(t))FP.call(t,n)&&ok(e,n,t[n]);return e},SX=(e,t)=>{var n={};for(var r in e)LP.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&&FP.call(e,r)&&(n[r]=e[r]);return n};function zP(e){var t=e,{withinPortal:n=!0,children:r}=t,o=SX(t,["withinPortal","children"]);return n?B.createElement($P,wX({},o),r):B.createElement(B.Fragment,null,r)}zP.displayName="@mantine/core/OptionalPortal";var kX=Object.defineProperty,Qm=Object.getOwnPropertySymbols,BP=Object.prototype.hasOwnProperty,HP=Object.prototype.propertyIsEnumerable,sk=(e,t,n)=>t in e?kX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ak=(e,t)=>{for(var n in t||(t={}))BP.call(t,n)&&sk(e,n,t[n]);if(Qm)for(var n of Qm(t))HP.call(t,n)&&sk(e,n,t[n]);return e},jX=(e,t)=>{var n={};for(var r in e)BP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Qm)for(var r of Qm(e))t.indexOf(r)<0&&HP.call(e,r)&&(n[r]=e[r]);return n};function WP(e){const t=e,{width:n,height:r,style:o}=t,s=jX(t,["width","height","style"]);return B.createElement("svg",ak({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:ak({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"}))}WP.displayName="@mantine/core/CloseIcon";var _X=Object.defineProperty,Ym=Object.getOwnPropertySymbols,VP=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?_X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IX=(e,t)=>{for(var n in t||(t={}))VP.call(t,n)&&lk(e,n,t[n]);if(Ym)for(var n of Ym(t))UP.call(t,n)&&lk(e,n,t[n]);return e},PX=(e,t)=>{var n={};for(var r in e)VP.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&&UP.call(e,r)&&(n[r]=e[r]);return n};const EX={xs:Ae(12),sm:Ae(16),md:Ae(20),lg:Ae(28),xl:Ae(34)},MX={size:"sm"},GP=i.forwardRef((e,t)=>{const n=Nn("CloseButton",MX,e),{iconSize:r,size:o,children:s}=n,l=PX(n,["iconSize","size","children"]),c=Ae(r||EX[o]);return B.createElement(mX,IX({ref:t,__staticSelector:"CloseButton",size:o},l),s||B.createElement(WP,{width:c,height:c}))});GP.displayName="@mantine/core/CloseButton";const KP=GP;var OX=Object.defineProperty,DX=Object.defineProperties,RX=Object.getOwnPropertyDescriptors,ik=Object.getOwnPropertySymbols,AX=Object.prototype.hasOwnProperty,TX=Object.prototype.propertyIsEnumerable,ck=(e,t,n)=>t in e?OX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ap=(e,t)=>{for(var n in t||(t={}))AX.call(t,n)&&ck(e,n,t[n]);if(ik)for(var n of ik(t))TX.call(t,n)&&ck(e,n,t[n]);return e},NX=(e,t)=>DX(e,RX(t));function $X({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function LX({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 FX(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function zX({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 BX=gr((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:l,gradient:c,weight:d,transform:f,align:m,strikethrough:h,italic:g},{size:b})=>{const y=e.fn.variant({variant:"gradient",gradient:c});return{root:NX(Ap(Ap(Ap(Ap({},e.fn.fontStyles()),e.fn.focusStyles()),FX(n)),zX({theme:e,truncate:r})),{color:LX({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||b===void 0?"inherit":pt({size:b,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:$X({underline:l,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":d,textTransform:f,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const HX=BX;var WX=Object.defineProperty,Zm=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,XP=Object.prototype.propertyIsEnumerable,uk=(e,t,n)=>t in e?WX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VX=(e,t)=>{for(var n in t||(t={}))qP.call(t,n)&&uk(e,n,t[n]);if(Zm)for(var n of Zm(t))XP.call(t,n)&&uk(e,n,t[n]);return e},UX=(e,t)=>{var n={};for(var r in e)qP.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&&XP.call(e,r)&&(n[r]=e[r]);return n};const GX={variant:"text"},QP=i.forwardRef((e,t)=>{const n=Nn("Text",GX,e),{className:r,size:o,weight:s,transform:l,color:c,align:d,variant:f,lineClamp:m,truncate:h,gradient:g,inline:b,inherit:y,underline:x,strikethrough:w,italic:S,classNames:j,styles:_,unstyled:I,span:E,__staticSelector:M}=n,D=UX(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:R,cx:N}=HX({color:c,lineClamp:m,truncate:h,inline:b,inherit:y,underline:x,strikethrough:w,italic:S,weight:s,transform:l,align:d,gradient:g},{unstyled:I,name:M||"Text",variant:f,size:o});return B.createElement(Vr,VX({ref:t,className:N(R.root,{[R.gradient]:f==="gradient"},r),component:E?"span":"div"},D))});QP.displayName="@mantine/core/Text";const Oc=QP,Tp={xs:Ae(1),sm:Ae(2),md:Ae(3),lg:Ae(4),xl:Ae(5)};function Np(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 KX=gr((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:Ae(1),borderTop:`${pt({size:n,sizes:Tp})} ${r} ${Np(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${pt({size:n,sizes:Tp})} ${r} ${Np(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:Ae(pt({size:n,sizes:Tp})),borderTopColor:Np(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Ae(pt({size:n,sizes:Tp})),borderLeftColor:Np(e,t),borderLeftStyle:r}}));const qX=KX;var XX=Object.defineProperty,QX=Object.defineProperties,YX=Object.getOwnPropertyDescriptors,Jm=Object.getOwnPropertySymbols,YP=Object.prototype.hasOwnProperty,ZP=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?XX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fk=(e,t)=>{for(var n in t||(t={}))YP.call(t,n)&&dk(e,n,t[n]);if(Jm)for(var n of Jm(t))ZP.call(t,n)&&dk(e,n,t[n]);return e},ZX=(e,t)=>QX(e,YX(t)),JX=(e,t)=>{var n={};for(var r in e)YP.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&&ZP.call(e,r)&&(n[r]=e[r]);return n};const eQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Eb=i.forwardRef((e,t)=>{const n=Nn("Divider",eQ,e),{className:r,color:o,orientation:s,size:l,label:c,labelPosition:d,labelProps:f,variant:m,styles:h,classNames:g,unstyled:b}=n,y=JX(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:x,cx:w}=qX({color:o},{classNames:g,styles:h,unstyled:b,name:"Divider",variant:m,size:l}),S=s==="vertical",j=s==="horizontal",_=!!c&&j,I=!(f!=null&&f.color);return B.createElement(Vr,fk({ref:t,className:w(x.root,{[x.vertical]:S,[x.horizontal]:j,[x.withLabel]:_},r),role:"separator"},y),_&&B.createElement(Oc,ZX(fk({},f),{size:(f==null?void 0:f.size)||"xs",mt:Ae(2),className:w(x.label,x[d],{[x.labelDefaultStyles]:I})}),c))});Eb.displayName="@mantine/core/Divider";var tQ=Object.defineProperty,nQ=Object.defineProperties,rQ=Object.getOwnPropertyDescriptors,pk=Object.getOwnPropertySymbols,oQ=Object.prototype.hasOwnProperty,sQ=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?tQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hk=(e,t)=>{for(var n in t||(t={}))oQ.call(t,n)&&mk(e,n,t[n]);if(pk)for(var n of pk(t))sQ.call(t,n)&&mk(e,n,t[n]);return e},aQ=(e,t)=>nQ(e,rQ(t)),lQ=gr((e,t,{size:n})=>({item:aQ(hk({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${pt({size:n,sizes:e.spacing})} / 1.5) ${pt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:pt({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]":hk({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(${pt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${pt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${pt({size:n,sizes:e.spacing})} / 1.5) ${pt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const iQ=lQ;var cQ=Object.defineProperty,gk=Object.getOwnPropertySymbols,uQ=Object.prototype.hasOwnProperty,dQ=Object.prototype.propertyIsEnumerable,vk=(e,t,n)=>t in e?cQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fQ=(e,t)=>{for(var n in t||(t={}))uQ.call(t,n)&&vk(e,n,t[n]);if(gk)for(var n of gk(t))dQ.call(t,n)&&vk(e,n,t[n]);return e};function Ay({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:l,onItemHover:c,onItemSelect:d,itemsRefs:f,itemComponent:m,size:h,nothingFound:g,creatable:b,createLabel:y,unstyled:x,variant:w}){const{classes:S}=iQ(null,{classNames:n,styles:r,unstyled:x,name:l,variant:w,size:h}),j=[],_=[];let I=null;const E=(D,R)=>{const N=typeof o=="function"?o(D.value):!1;return B.createElement(m,fQ({key:D.value,className:S.item,"data-disabled":D.disabled||void 0,"data-hovered":!D.disabled&&t===R||void 0,"data-selected":!D.disabled&&N||void 0,selected:N,onMouseEnter:()=>c(R),id:`${s}-${R}`,role:"option",tabIndex:-1,"aria-selected":t===R,ref:O=>{f&&f.current&&(f.current[D.value]=O)},onMouseDown:D.disabled?null:O=>{O.preventDefault(),d(D)},disabled:D.disabled,variant:w},D))};let M=null;if(e.forEach((D,R)=>{D.creatable?I=R:D.group?(M!==D.group&&(M=D.group,_.push(B.createElement("div",{className:S.separator,key:`__mantine-divider-${R}`},B.createElement(Eb,{classNames:{label:S.separatorLabel},label:D.group})))),_.push(E(D,R))):j.push(E(D,R))}),b){const D=e[I];j.push(B.createElement("div",{key:Dy(),className:S.item,"data-hovered":t===I||void 0,onMouseEnter:()=>c(I),onMouseDown:R=>{R.preventDefault(),d(D)},tabIndex:-1,ref:R=>{f&&f.current&&(f.current[D.value]=R)}},y))}return _.length>0&&j.length>0&&j.unshift(B.createElement("div",{className:S.separator,key:"empty-group-separator"},B.createElement(Eb,null))),_.length>0||j.length>0?B.createElement(B.Fragment,null,_,j):B.createElement(Oc,{size:h,unstyled:x,className:S.nothingFound},g)}Ay.displayName="@mantine/core/SelectItems";var pQ=Object.defineProperty,eh=Object.getOwnPropertySymbols,JP=Object.prototype.hasOwnProperty,eE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?pQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mQ=(e,t)=>{for(var n in t||(t={}))JP.call(t,n)&&bk(e,n,t[n]);if(eh)for(var n of eh(t))eE.call(t,n)&&bk(e,n,t[n]);return e},hQ=(e,t)=>{var n={};for(var r in e)JP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&eh)for(var r of eh(e))t.indexOf(r)<0&&eE.call(e,r)&&(n[r]=e[r]);return n};const Ty=i.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=hQ(n,["label","value"]);return B.createElement("div",mQ({ref:t},s),r||o)});Ty.displayName="@mantine/core/DefaultItem";function gQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function tE(...e){return t=>e.forEach(n=>gQ(n,t))}function di(...e){return i.useCallback(tE(...e),e)}const nE=i.forwardRef((e,t)=>{const{children:n,...r}=e,o=i.Children.toArray(n),s=o.find(bQ);if(s){const l=s.props.children,c=o.map(d=>d===s?i.Children.count(l)>1?i.Children.only(null):i.isValidElement(l)?l.props.children:null:d);return i.createElement(Mb,bn({},r,{ref:t}),i.isValidElement(l)?i.cloneElement(l,void 0,c):null)}return i.createElement(Mb,bn({},r,{ref:t}),n)});nE.displayName="Slot";const Mb=i.forwardRef((e,t)=>{const{children:n,...r}=e;return i.isValidElement(n)?i.cloneElement(n,{...xQ(r,n.props),ref:tE(t,n.ref)}):i.Children.count(n)>1?i.Children.only(null):null});Mb.displayName="SlotClone";const vQ=({children:e})=>i.createElement(i.Fragment,null,e);function bQ(e){return i.isValidElement(e)&&e.type===vQ}function xQ(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 yQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],ff=yQ.reduce((e,t)=>{const n=i.forwardRef((r,o)=>{const{asChild:s,...l}=r,c=s?nE:t;return i.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),i.createElement(c,bn({},l,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ob=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{};function CQ(e,t){return i.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const pf=e=>{const{present:t,children:n}=e,r=wQ(t),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),s=di(r.ref,o.ref);return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:s}):null};pf.displayName="Presence";function wQ(e){const[t,n]=i.useState(),r=i.useRef({}),o=i.useRef(e),s=i.useRef("none"),l=e?"mounted":"unmounted",[c,d]=CQ(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const f=$p(r.current);s.current=c==="mounted"?f:"none"},[c]),Ob(()=>{const f=r.current,m=o.current;if(m!==e){const g=s.current,b=$p(f);e?d("MOUNT"):b==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(m&&g!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Ob(()=>{if(t){const f=h=>{const b=$p(r.current).includes(h.animationName);h.target===t&&b&&Jr.flushSync(()=>d("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=$p(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(f=>{f&&(r.current=getComputedStyle(f)),n(f)},[])}}function $p(e){return(e==null?void 0:e.animationName)||"none"}function SQ(e,t=[]){let n=[];function r(s,l){const c=i.createContext(l),d=n.length;n=[...n,l];function f(h){const{scope:g,children:b,...y}=h,x=(g==null?void 0:g[e][d])||c,w=i.useMemo(()=>y,Object.values(y));return i.createElement(x.Provider,{value:w},b)}function m(h,g){const b=(g==null?void 0:g[e][d])||c,y=i.useContext(b);if(y)return y;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${s}\``)}return f.displayName=s+"Provider",[f,m]}const o=()=>{const s=n.map(l=>i.createContext(l));return function(c){const d=(c==null?void 0:c[e])||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,kQ(o,...t)]}function kQ(...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 l=r.reduce((c,{useScope:d,scopeName:f})=>{const h=d(s)[`__scope${f}`];return{...c,...h}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function zl(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const jQ=i.createContext(void 0);function _Q(e){const t=i.useContext(jQ);return e||t||"ltr"}function IQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function Kl(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 PQ(e,t){return i.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const rE="ScrollArea",[oE,jye]=SQ(rE),[EQ,To]=oE(rE),MQ=i.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...l}=e,[c,d]=i.useState(null),[f,m]=i.useState(null),[h,g]=i.useState(null),[b,y]=i.useState(null),[x,w]=i.useState(null),[S,j]=i.useState(0),[_,I]=i.useState(0),[E,M]=i.useState(!1),[D,R]=i.useState(!1),N=di(t,T=>d(T)),O=_Q(o);return i.createElement(EQ,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:c,viewport:f,onViewportChange:m,content:h,onContentChange:g,scrollbarX:b,onScrollbarXChange:y,scrollbarXEnabled:E,onScrollbarXEnabledChange:M,scrollbarY:x,onScrollbarYChange:w,scrollbarYEnabled:D,onScrollbarYEnabledChange:R,onCornerWidthChange:j,onCornerHeightChange:I},i.createElement(ff.div,bn({dir:O},l,{ref:N,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),OQ="ScrollAreaViewport",DQ=i.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=To(OQ,n),l=i.useRef(null),c=di(t,l,s.onViewportChange);return i.createElement(i.Fragment,null,i.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}"}}),i.createElement(ff.div,bn({"data-radix-scroll-area-viewport":""},o,{ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),i.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ka="ScrollAreaScrollbar",RQ=i.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=To(ka,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=o,c=e.orientation==="horizontal";return i.useEffect(()=>(c?s(!0):l(!0),()=>{c?s(!1):l(!1)}),[c,s,l]),o.type==="hover"?i.createElement(AQ,bn({},r,{ref:t,forceMount:n})):o.type==="scroll"?i.createElement(TQ,bn({},r,{ref:t,forceMount:n})):o.type==="auto"?i.createElement(sE,bn({},r,{ref:t,forceMount:n})):o.type==="always"?i.createElement(Ny,bn({},r,{ref:t})):null}),AQ=i.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=To(ka,e.__scopeScrollArea),[s,l]=i.useState(!1);return i.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const f=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",f),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",f),c.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),i.createElement(pf,{present:n||s},i.createElement(sE,bn({"data-state":s?"visible":"hidden"},r,{ref:t})))}),TQ=i.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=To(ka,e.__scopeScrollArea),s=e.orientation==="horizontal",l=Og(()=>d("SCROLL_END"),100),[c,d]=PQ("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 i.useEffect(()=>{if(c==="idle"){const f=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(f)}},[c,o.scrollHideDelay,d]),i.useEffect(()=>{const f=o.viewport,m=s?"scrollLeft":"scrollTop";if(f){let h=f[m];const g=()=>{const b=f[m];h!==b&&(d("SCROLL"),l()),h=b};return f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[o.viewport,s,d,l]),i.createElement(pf,{present:n||c!=="hidden"},i.createElement(Ny,bn({"data-state":c==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Kl(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Kl(e.onPointerLeave,()=>d("POINTER_LEAVE"))})))}),sE=i.forwardRef((e,t)=>{const n=To(ka,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,l]=i.useState(!1),c=e.orientation==="horizontal",d=Og(()=>{if(n.viewport){const f=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?f:m)}},10);return Dc(n.viewport,d),Dc(n.content,d),i.createElement(pf,{present:r||s},i.createElement(Ny,bn({"data-state":s?"visible":"hidden"},o,{ref:t})))}),Ny=i.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=To(ka,e.__scopeScrollArea),s=i.useRef(null),l=i.useRef(0),[c,d]=i.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=cE(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:g=>l.current=g};function h(g,b){return WQ(g,l.current,c,b)}return n==="horizontal"?i.createElement(NQ,bn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,b=xk(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=h(g,o.dir))}})):n==="vertical"?i.createElement($Q,bn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,b=xk(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=h(g))}})):null}),NQ=i.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=To(ka,e.__scopeScrollArea),[l,c]=i.useState(),d=i.useRef(null),f=di(t,d,s.onScrollbarXChange);return i.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),i.createElement(lE,bn({"data-orientation":"horizontal"},o,{ref:f,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":Mg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),dE(g,h)&&m.preventDefault()}},onResize:()=>{d.current&&s.viewport&&l&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:th(l.paddingLeft),paddingEnd:th(l.paddingRight)}})}}))}),$Q=i.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=To(ka,e.__scopeScrollArea),[l,c]=i.useState(),d=i.useRef(null),f=di(t,d,s.onScrollbarYChange);return i.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),i.createElement(lE,bn({"data-orientation":"vertical"},o,{ref:f,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":Mg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),dE(g,h)&&m.preventDefault()}},onResize:()=>{d.current&&s.viewport&&l&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:th(l.paddingTop),paddingEnd:th(l.paddingBottom)}})}}))}),[LQ,aE]=oE(ka),lE=i.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:m,onResize:h,...g}=e,b=To(ka,n),[y,x]=i.useState(null),w=di(t,N=>x(N)),S=i.useRef(null),j=i.useRef(""),_=b.viewport,I=r.content-r.viewport,E=zl(m),M=zl(d),D=Og(h,10);function R(N){if(S.current){const O=N.clientX-S.current.left,T=N.clientY-S.current.top;f({x:O,y:T})}}return i.useEffect(()=>{const N=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&E(O,I)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[_,y,I,E]),i.useEffect(M,[r,M]),Dc(y,D),Dc(b.content,D),i.createElement(LQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:zl(s),onThumbPointerUp:zl(l),onThumbPositionChange:M,onThumbPointerDown:zl(c)},i.createElement(ff.div,bn({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Kl(e.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",R(N))}),onPointerMove:Kl(e.onPointerMove,R),onPointerUp:Kl(e.onPointerUp,N=>{const O=N.target;O.hasPointerCapture(N.pointerId)&&O.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Db="ScrollAreaThumb",FQ=i.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=aE(Db,e.__scopeScrollArea);return i.createElement(pf,{present:n||o.hasThumb},i.createElement(zQ,bn({ref:t},r)))}),zQ=i.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=To(Db,n),l=aE(Db,n),{onThumbPositionChange:c}=l,d=di(t,h=>l.onThumbChange(h)),f=i.useRef(),m=Og(()=>{f.current&&(f.current(),f.current=void 0)},100);return i.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!f.current){const b=VQ(h,c);f.current=b,c()}};return c(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,c]),i.createElement(ff.div,bn({"data-state":l.hasThumb?"visible":"hidden"},o,{ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Kl(e.onPointerDownCapture,h=>{const b=h.target.getBoundingClientRect(),y=h.clientX-b.left,x=h.clientY-b.top;l.onThumbPointerDown({x:y,y:x})}),onPointerUp:Kl(e.onPointerUp,l.onThumbPointerUp)}))}),iE="ScrollAreaCorner",BQ=i.forwardRef((e,t)=>{const n=To(iE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?i.createElement(HQ,bn({},e,{ref:t})):null}),HQ=i.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=To(iE,n),[s,l]=i.useState(0),[c,d]=i.useState(0),f=!!(s&&c);return Dc(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),d(h)}),Dc(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),l(h)}),f?i.createElement(ff.div,bn({},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 th(e){return e?parseInt(e,10):0}function cE(e,t){const n=e/t;return isNaN(n)?0:n}function Mg(e){const t=cE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function WQ(e,t,n,r="ltr"){const o=Mg(n),s=o/2,l=t||s,c=o-l,d=n.scrollbar.paddingStart+l,f=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return uE([d,f],h)(e)}function xk(e,t,n="ltr"){const r=Mg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,l=t.content-t.viewport,c=s-r,d=n==="ltr"?[0,l]:[l*-1,0],f=IQ(e,d);return uE([0,l],[0,c])(f)}function uE(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 dE(e,t){return e>0&&e<t}const VQ=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},l=n.left!==s.left,c=n.top!==s.top;(l||c)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Og(e,t){const n=zl(e),r=i.useRef(0);return i.useEffect(()=>()=>window.clearTimeout(r.current),[]),i.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Dc(e,t){const n=zl(t);Ob(()=>{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 UQ=MQ,GQ=DQ,yk=RQ,Ck=FQ,KQ=BQ;var qQ=gr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Ae(t):void 0,paddingBottom:n?Ae(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Ae(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${_4("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Ae(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Ae(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:_4("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Ae(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:Ae(44),minHeight:Ae(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 QQ=Object.defineProperty,YQ=Object.defineProperties,ZQ=Object.getOwnPropertyDescriptors,nh=Object.getOwnPropertySymbols,fE=Object.prototype.hasOwnProperty,pE=Object.prototype.propertyIsEnumerable,wk=(e,t,n)=>t in e?QQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rb=(e,t)=>{for(var n in t||(t={}))fE.call(t,n)&&wk(e,n,t[n]);if(nh)for(var n of nh(t))pE.call(t,n)&&wk(e,n,t[n]);return e},mE=(e,t)=>YQ(e,ZQ(t)),hE=(e,t)=>{var n={};for(var r in e)fE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&nh)for(var r of nh(e))t.indexOf(r)<0&&pE.call(e,r)&&(n[r]=e[r]);return n};const gE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},Dg=i.forwardRef((e,t)=>{const n=Nn("ScrollArea",gE,e),{children:r,className:o,classNames:s,styles:l,scrollbarSize:c,scrollHideDelay:d,type:f,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:b,unstyled:y,variant:x,viewportProps:w}=n,S=hE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=i.useState(!1),I=wa(),{classes:E,cx:M}=XQ({scrollbarSize:c,offsetScrollbars:h,scrollbarHovered:j,hidden:f==="never"},{name:"ScrollArea",classNames:s,styles:l,unstyled:y,variant:x});return B.createElement(UQ,{type:f==="never"?"always":f,scrollHideDelay:d,dir:m||I.dir,ref:t,asChild:!0},B.createElement(Vr,Rb({className:M(E.root,o)},S),B.createElement(GQ,mE(Rb({},w),{className:E.viewport,ref:g,onScroll:typeof b=="function"?({currentTarget:D})=>b({x:D.scrollLeft,y:D.scrollTop}):void 0}),r),B.createElement(yk,{orientation:"horizontal",className:E.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},B.createElement(Ck,{className:E.thumb})),B.createElement(yk,{orientation:"vertical",className:E.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},B.createElement(Ck,{className:E.thumb})),B.createElement(KQ,{className:E.corner})))}),vE=i.forwardRef((e,t)=>{const n=Nn("ScrollAreaAutosize",gE,e),{children:r,classNames:o,styles:s,scrollbarSize:l,scrollHideDelay:c,type:d,dir:f,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:b,sx:y,variant:x,viewportProps:w}=n,S=hE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return B.createElement(Vr,mE(Rb({},S),{ref:t,sx:[{display:"flex"},...oP(y)]}),B.createElement(Vr,{sx:{display:"flex",flexDirection:"column",flex:1}},B.createElement(Dg,{classNames:o,styles:s,scrollHideDelay:c,scrollbarSize:l,type:d,dir:f,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:b,variant:x,viewportProps:w},r)))});vE.displayName="@mantine/core/ScrollAreaAutosize";Dg.displayName="@mantine/core/ScrollArea";Dg.Autosize=vE;const bE=Dg;var JQ=Object.defineProperty,eY=Object.defineProperties,tY=Object.getOwnPropertyDescriptors,rh=Object.getOwnPropertySymbols,xE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?JQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kk=(e,t)=>{for(var n in t||(t={}))xE.call(t,n)&&Sk(e,n,t[n]);if(rh)for(var n of rh(t))yE.call(t,n)&&Sk(e,n,t[n]);return e},nY=(e,t)=>eY(e,tY(t)),rY=(e,t)=>{var n={};for(var r in e)xE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rh)for(var r of rh(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const Rg=i.forwardRef((e,t)=>{var n=e,{style:r}=n,o=rY(n,["style"]);return B.createElement(bE,nY(kk({},o),{style:kk({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Rg.displayName="@mantine/core/SelectScrollArea";var oY=gr(()=>({dropdown:{},itemsWrapper:{padding:Ae(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const sY=oY,is=Math.min,fr=Math.max,oh=Math.round,Lp=Math.floor,ll=e=>({x:e,y:e}),aY={left:"right",right:"left",bottom:"top",top:"bottom"},lY={start:"end",end:"start"};function Ab(e,t,n){return fr(e,is(t,n))}function ua(e,t){return typeof e=="function"?e(t):e}function cs(e){return e.split("-")[0]}function tu(e){return e.split("-")[1]}function $y(e){return e==="x"?"y":"x"}function Ly(e){return e==="y"?"height":"width"}function fi(e){return["top","bottom"].includes(cs(e))?"y":"x"}function Fy(e){return $y(fi(e))}function iY(e,t,n){n===void 0&&(n=!1);const r=tu(e),o=Fy(e),s=Ly(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=sh(l)),[l,sh(l)]}function cY(e){const t=sh(e);return[Tb(e),t,Tb(t)]}function Tb(e){return e.replace(/start|end/g,t=>lY[t])}function uY(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:l;default:return[]}}function dY(e,t,n,r){const o=tu(e);let s=uY(cs(e),n==="start",r);return o&&(s=s.map(l=>l+"-"+o),t&&(s=s.concat(s.map(Tb)))),s}function sh(e){return e.replace(/left|right|bottom|top/g,t=>aY[t])}function fY(e){return{top:0,right:0,bottom:0,left:0,...e}}function zy(e){return typeof e!="number"?fY(e):{top:e,right:e,bottom:e,left:e}}function Rc(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function jk(e,t,n){let{reference:r,floating:o}=e;const s=fi(t),l=Fy(t),c=Ly(l),d=cs(t),f=s==="y",m=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let b;switch(d){case"top":b={x:m,y:r.y-o.height};break;case"bottom":b={x:m,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-o.width,y:h};break;default:b={x:r.x,y:r.y}}switch(tu(t)){case"start":b[l]-=g*(n&&f?-1:1);break;case"end":b[l]+=g*(n&&f?-1:1);break}return b}const pY=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:l}=n,c=s.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=jk(f,r,d),g=r,b={},y=0;for(let x=0;x<c.length;x++){const{name:w,fn:S}=c[x],{x:j,y:_,data:I,reset:E}=await S({x:m,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:b,rects:f,platform:l,elements:{reference:e,floating:t}});if(m=j??m,h=_??h,b={...b,[w]:{...b[w],...I}},E&&y<=50){y++,typeof E=="object"&&(E.placement&&(g=E.placement),E.rects&&(f=E.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:m,y:h}=jk(f,g,d)),x=-1;continue}}return{x:m,y:h,placement:g,strategy:o,middlewareData:b}};async function By(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:l,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:g=!1,padding:b=0}=ua(t,e),y=zy(b),w=c[g?h==="floating"?"reference":"floating":h],S=Rc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:d})),j=h==="floating"?{...l.floating,x:r,y:o}:l.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),I=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},E=Rc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:j,offsetParent:_,strategy:d}):j);return{top:(S.top-E.top+y.top)/I.y,bottom:(E.bottom-S.bottom+y.bottom)/I.y,left:(S.left-E.left+y.left)/I.x,right:(E.right-S.right+y.right)/I.x}}const _k=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:l,elements:c,middlewareData:d}=t,{element:f,padding:m=0}=ua(e,t)||{};if(f==null)return{};const h=zy(m),g={x:n,y:r},b=Fy(o),y=Ly(b),x=await l.getDimensions(f),w=b==="y",S=w?"top":"left",j=w?"bottom":"right",_=w?"clientHeight":"clientWidth",I=s.reference[y]+s.reference[b]-g[b]-s.floating[y],E=g[b]-s.reference[b],M=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let D=M?M[_]:0;(!D||!await(l.isElement==null?void 0:l.isElement(M)))&&(D=c.floating[_]||s.floating[y]);const R=I/2-E/2,N=D/2-x[y]/2-1,O=is(h[S],N),T=is(h[j],N),U=O,G=D-x[y]-T,q=D/2-x[y]/2+R,Y=Ab(U,q,G),Q=!d.arrow&&tu(o)!=null&&q!=Y&&s.reference[y]/2-(q<U?O:T)-x[y]/2<0,V=Q?q<U?q-U:q-G:0;return{[b]:g[b]+V,data:{[b]:Y,centerOffset:q-Y-V,...Q&&{alignmentOffset:V}},reset:Q}}}),mY=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:l,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=ua(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const S=cs(o),j=cs(c)===c,_=await(d.isRTL==null?void 0:d.isRTL(f.floating)),I=g||(j||!x?[sh(c)]:cY(c));!g&&y!=="none"&&I.push(...dY(c,x,y,_));const E=[c,...I],M=await By(t,w),D=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(m&&D.push(M[S]),h){const U=iY(o,l,_);D.push(M[U[0]],M[U[1]])}if(R=[...R,{placement:o,overflows:D}],!D.every(U=>U<=0)){var N,O;const U=(((N=s.flip)==null?void 0:N.index)||0)+1,G=E[U];if(G)return{data:{index:U,overflows:R},reset:{placement:G}};let q=(O=R.filter(Y=>Y.overflows[0]<=0).sort((Y,Q)=>Y.overflows[1]-Q.overflows[1])[0])==null?void 0:O.placement;if(!q)switch(b){case"bestFit":{var T;const Y=(T=R.map(Q=>[Q.placement,Q.overflows.filter(V=>V>0).reduce((V,se)=>V+se,0)]).sort((Q,V)=>Q[1]-V[1])[0])==null?void 0:T[0];Y&&(q=Y);break}case"initialPlacement":q=c;break}if(o!==q)return{reset:{placement:q}}}return{}}}};function CE(e){const t=is(...e.map(s=>s.left)),n=is(...e.map(s=>s.top)),r=fr(...e.map(s=>s.right)),o=fr(...e.map(s=>s.bottom));return{x:t,y:n,width:r-t,height:o-n}}function hY(e){const t=e.slice().sort((o,s)=>o.y-s.y),n=[];let r=null;for(let o=0;o<t.length;o++){const s=t[o];!r||s.y-r.y>r.height/2?n.push([s]):n[n.length-1].push(s),r=s}return n.map(o=>Rc(CE(o)))}const gY=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:l}=t,{padding:c=2,x:d,y:f}=ua(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=hY(m),g=Rc(CE(m)),b=zy(c);function y(){if(h.length===2&&h[0].left>h[1].right&&d!=null&&f!=null)return h.find(w=>d>w.left-b.left&&d<w.right+b.right&&f>w.top-b.top&&f<w.bottom+b.bottom)||g;if(h.length>=2){if(fi(n)==="y"){const O=h[0],T=h[h.length-1],U=cs(n)==="top",G=O.top,q=T.bottom,Y=U?O.left:T.left,Q=U?O.right:T.right,V=Q-Y,se=q-G;return{top:G,bottom:q,left:Y,right:Q,width:V,height:se,x:Y,y:G}}const w=cs(n)==="left",S=fr(...h.map(O=>O.right)),j=is(...h.map(O=>O.left)),_=h.filter(O=>w?O.left===j:O.right===S),I=_[0].top,E=_[_.length-1].bottom,M=j,D=S,R=D-M,N=E-I;return{top:I,bottom:E,left:M,right:D,width:R,height:N,x:M,y:I}}return g}const x=await s.getElementRects({reference:{getBoundingClientRect:y},floating:r.floating,strategy:l});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 vY(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=cs(n),c=tu(n),d=fi(n)==="y",f=["left","top"].includes(l)?-1:1,m=s&&d?-1:1,h=ua(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return c&&typeof y=="number"&&(b=c==="end"?y*-1:y),d?{x:b*m,y:g*f}:{x:g*f,y:b*m}}const bY=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await vY(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},xY=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:l=!1,limiter:c={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...d}=ua(e,t),f={x:n,y:r},m=await By(t,d),h=fi(cs(o)),g=$y(h);let b=f[g],y=f[h];if(s){const w=g==="y"?"top":"left",S=g==="y"?"bottom":"right",j=b+m[w],_=b-m[S];b=Ab(j,b,_)}if(l){const w=h==="y"?"top":"left",S=h==="y"?"bottom":"right",j=y+m[w],_=y-m[S];y=Ab(j,y,_)}const x=c.fn({...t,[g]:b,[h]:y});return{...x,data:{x:x.x-n,y:x.y-r}}}}},yY=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=ua(e,t),m={x:n,y:r},h=fi(o),g=$y(h);let b=m[g],y=m[h];const x=ua(c,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const _=g==="y"?"height":"width",I=s.reference[g]-s.floating[_]+w.mainAxis,E=s.reference[g]+s.reference[_]-w.mainAxis;b<I?b=I:b>E&&(b=E)}if(f){var S,j;const _=g==="y"?"width":"height",I=["top","left"].includes(cs(o)),E=s.reference[h]-s.floating[_]+(I&&((S=l.offset)==null?void 0:S[h])||0)+(I?0:w.crossAxis),M=s.reference[h]+s.reference[_]+(I?0:((j=l.offset)==null?void 0:j[h])||0)-(I?w.crossAxis:0);y<E?y=E:y>M&&(y=M)}return{[g]:b,[h]:y}}}},CY=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:l=()=>{},...c}=ua(e,t),d=await By(t,c),f=cs(n),m=tu(n),h=fi(n)==="y",{width:g,height:b}=r.floating;let y,x;f==="top"||f==="bottom"?(y=f,x=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=f,y=m==="end"?"top":"bottom");const w=b-d[y],S=g-d[x],j=!t.middlewareData.shift;let _=w,I=S;if(h){const M=g-d.left-d.right;I=m||j?is(S,M):M}else{const M=b-d.top-d.bottom;_=m||j?is(w,M):M}if(j&&!m){const M=fr(d.left,0),D=fr(d.right,0),R=fr(d.top,0),N=fr(d.bottom,0);h?I=g-2*(M!==0||D!==0?M+D:fr(d.left,d.right)):_=b-2*(R!==0||N!==0?R+N:fr(d.top,d.bottom))}await l({...t,availableWidth:I,availableHeight:_});const E=await o.getDimensions(s.floating);return g!==E.width||b!==E.height?{reset:{rects:!0}}:{}}}};function il(e){return wE(e)?(e.nodeName||"").toLowerCase():"#document"}function no(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ja(e){var t;return(t=(wE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function wE(e){return e instanceof Node||e instanceof no(e).Node}function da(e){return e instanceof Element||e instanceof no(e).Element}function Ms(e){return e instanceof HTMLElement||e instanceof no(e).HTMLElement}function Ik(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof no(e).ShadowRoot}function mf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Oo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function wY(e){return["table","td","th"].includes(il(e))}function Hy(e){const t=Wy(),n=Oo(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 SY(e){let t=Ac(e);for(;Ms(t)&&!Ag(t);){if(Hy(t))return t;t=Ac(t)}return null}function Wy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ag(e){return["html","body","#document"].includes(il(e))}function Oo(e){return no(e).getComputedStyle(e)}function Tg(e){return da(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ac(e){if(il(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ik(e)&&e.host||ja(e);return Ik(t)?t.host:t}function SE(e){const t=Ac(e);return Ag(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ms(t)&&mf(t)?t:SE(t)}function Ed(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=SE(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),l=no(o);return s?t.concat(l,l.visualViewport||[],mf(o)?o:[],l.frameElement&&n?Ed(l.frameElement):[]):t.concat(o,Ed(o,[],n))}function kE(e){const t=Oo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ms(e),s=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=oh(n)!==s||oh(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function Vy(e){return da(e)?e:e.contextElement}function yc(e){const t=Vy(e);if(!Ms(t))return ll(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=kE(t);let l=(s?oh(n.width):n.width)/r,c=(s?oh(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const kY=ll(0);function jE(e){const t=no(e);return!Wy()||!t.visualViewport?kY:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jY(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==no(e)?!1:t}function oi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Vy(e);let l=ll(1);t&&(r?da(r)&&(l=yc(r)):l=yc(e));const c=jY(s,n,r)?jE(s):ll(0);let d=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,m=o.width/l.x,h=o.height/l.y;if(s){const g=no(s),b=r&&da(r)?no(r):r;let y=g.frameElement;for(;y&&r&&b!==g;){const x=yc(y),w=y.getBoundingClientRect(),S=Oo(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*x.x,_=w.top+(y.clientTop+parseFloat(S.paddingTop))*x.y;d*=x.x,f*=x.y,m*=x.x,h*=x.y,d+=j,f+=_,y=no(y).frameElement}}return Rc({width:m,height:h,x:d,y:f})}function _Y(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Ms(n),s=ja(n);if(n===s)return t;let l={scrollLeft:0,scrollTop:0},c=ll(1);const d=ll(0);if((o||!o&&r!=="fixed")&&((il(n)!=="body"||mf(s))&&(l=Tg(n)),Ms(n))){const f=oi(n);c=yc(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x,y:t.y*c.y-l.scrollTop*c.y+d.y}}function IY(e){return Array.from(e.getClientRects())}function _E(e){return oi(ja(e)).left+Tg(e).scrollLeft}function PY(e){const t=ja(e),n=Tg(e),r=e.ownerDocument.body,o=fr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=fr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+_E(e);const c=-n.scrollTop;return Oo(r).direction==="rtl"&&(l+=fr(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:l,y:c}}function EY(e,t){const n=no(e),r=ja(e),o=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,d=0;if(o){s=o.width,l=o.height;const f=Wy();(!f||f&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:l,x:c,y:d}}function MY(e,t){const n=oi(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ms(e)?yc(e):ll(1),l=e.clientWidth*s.x,c=e.clientHeight*s.y,d=o*s.x,f=r*s.y;return{width:l,height:c,x:d,y:f}}function Pk(e,t,n){let r;if(t==="viewport")r=EY(e,n);else if(t==="document")r=PY(ja(e));else if(da(t))r=MY(t,n);else{const o=jE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Rc(r)}function IE(e,t){const n=Ac(e);return n===t||!da(n)||Ag(n)?!1:Oo(n).position==="fixed"||IE(n,t)}function OY(e,t){const n=t.get(e);if(n)return n;let r=Ed(e,[],!1).filter(c=>da(c)&&il(c)!=="body"),o=null;const s=Oo(e).position==="fixed";let l=s?Ac(e):e;for(;da(l)&&!Ag(l);){const c=Oo(l),d=Hy(l);!d&&c.position==="fixed"&&(o=null),(s?!d&&!o:!d&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||mf(l)&&!d&&IE(e,l))?r=r.filter(m=>m!==l):o=c,l=Ac(l)}return t.set(e,r),r}function DY(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?OY(t,this._c):[].concat(n),r],c=l[0],d=l.reduce((f,m)=>{const h=Pk(t,m,o);return f.top=fr(h.top,f.top),f.right=is(h.right,f.right),f.bottom=is(h.bottom,f.bottom),f.left=fr(h.left,f.left),f},Pk(t,c,o));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function RY(e){return kE(e)}function AY(e,t,n){const r=Ms(t),o=ja(t),s=n==="fixed",l=oi(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=ll(0);if(r||!r&&!s)if((il(t)!=="body"||mf(o))&&(c=Tg(t)),r){const f=oi(t,!0,s,t);d.x=f.x+t.clientLeft,d.y=f.y+t.clientTop}else o&&(d.x=_E(o));return{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Ek(e,t){return!Ms(e)||Oo(e).position==="fixed"?null:t?t(e):e.offsetParent}function PE(e,t){const n=no(e);if(!Ms(e))return n;let r=Ek(e,t);for(;r&&wY(r)&&Oo(r).position==="static";)r=Ek(r,t);return r&&(il(r)==="html"||il(r)==="body"&&Oo(r).position==="static"&&!Hy(r))?n:r||SY(e)||n}const TY=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||PE,s=this.getDimensions;return{reference:AY(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}};function NY(e){return Oo(e).direction==="rtl"}const $Y={convertOffsetParentRelativeRectToViewportRelativeRect:_Y,getDocumentElement:ja,getClippingRect:DY,getOffsetParent:PE,getElementRects:TY,getClientRects:IY,getDimensions:RY,getScale:yc,isElement:da,isRTL:NY};function LY(e,t){let n=null,r;const o=ja(e);function s(){clearTimeout(r),n&&n.disconnect(),n=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const{left:f,top:m,width:h,height:g}=e.getBoundingClientRect();if(c||t(),!h||!g)return;const b=Lp(m),y=Lp(o.clientWidth-(f+h)),x=Lp(o.clientHeight-(m+g)),w=Lp(f),j={rootMargin:-b+"px "+-y+"px "+-x+"px "+-w+"px",threshold:fr(0,is(1,d))||1};let _=!0;function I(E){const M=E[0].intersectionRatio;if(M!==d){if(!_)return l();M?l(!1,M):r=setTimeout(()=>{l(!1,1e-7)},100)}_=!1}try{n=new IntersectionObserver(I,{...j,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,j)}n.observe(e)}return l(!0),s}function FY(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=Vy(e),m=o||s?[...f?Ed(f):[],...Ed(t)]:[];m.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const h=f&&c?LY(f,n):null;let g=-1,b=null;l&&(b=new ResizeObserver(S=>{let[j]=S;j&&j.target===f&&b&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{b&&b.observe(t)})),n()}),f&&!d&&b.observe(f),b.observe(t));let y,x=d?oi(e):null;d&&w();function w(){const S=oi(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(),()=>{m.forEach(S=>{o&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),h&&h(),b&&b.disconnect(),b=null,d&&cancelAnimationFrame(y)}}const zY=(e,t,n)=>{const r=new Map,o={platform:$Y,...n},s={...o.platform,_c:r};return pY(e,t,{...o,platform:s})},BY=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?_k({element:t.current,padding:n}).fn(o):{}:t?_k({element:t,padding:n}).fn(o):{}}}};var mm=typeof document<"u"?i.useLayoutEffect:i.useEffect;function ah(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(!ah(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)&&!ah(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Mk(e){const t=i.useRef(e);return mm(()=>{t.current=e}),t}function HY(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:l}=e,[c,d]=i.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=i.useState(r);ah(f,r)||m(r);const h=i.useRef(null),g=i.useRef(null),b=i.useRef(c),y=Mk(s),x=Mk(o),[w,S]=i.useState(null),[j,_]=i.useState(null),I=i.useCallback(O=>{h.current!==O&&(h.current=O,S(O))},[]),E=i.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=i.useCallback(()=>{if(!h.current||!g.current)return;const O={placement:t,strategy:n,middleware:f};x.current&&(O.platform=x.current),zY(h.current,g.current,O).then(T=>{const U={...T,isPositioned:!0};D.current&&!ah(b.current,U)&&(b.current=U,Jr.flushSync(()=>{d(U)}))})},[f,t,n,x]);mm(()=>{l===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[l]);const D=i.useRef(!1);mm(()=>(D.current=!0,()=>{D.current=!1}),[]),mm(()=>{if(w&&j){if(y.current)return y.current(w,j,M);M()}},[w,j,M,y]);const R=i.useMemo(()=>({reference:h,floating:g,setReference:I,setFloating:E}),[I,E]),N=i.useMemo(()=>({reference:w,floating:j}),[w,j]);return i.useMemo(()=>({...c,update:M,refs:R,elements:N,reference:I,floating:E}),[c,M,R,N,I,E])}var WY=typeof document<"u"?i.useLayoutEffect:i.useEffect;function VY(){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 UY=i.createContext(null),GY=()=>i.useContext(UY);function KY(e){return(e==null?void 0:e.ownerDocument)||document}function qY(e){return KY(e).defaultView||window}function Fp(e){return e?e instanceof qY(e).Element:!1}const XY=xx["useInsertionEffect".toString()],QY=XY||(e=>e());function YY(e){const t=i.useRef(()=>{});return QY(()=>{t.current=e}),i.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function ZY(e){e===void 0&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,o=HY(e),s=GY(),l=i.useRef(null),c=i.useRef({}),d=i.useState(()=>VY())[0],[f,m]=i.useState(null),h=i.useCallback(S=>{const j=Fp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=i.useCallback(S=>{(Fp(S)||S===null)&&(l.current=S,m(S)),(Fp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!Fp(S))&&o.refs.setReference(S)},[o.refs]),b=i.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:l}),[o.refs,g,h]),y=i.useMemo(()=>({...o.elements,domReference:f}),[o.elements,f]),x=YY(n),w=i.useMemo(()=>({...o,refs:b,elements:y,dataRef:c,nodeId:r,events:d,open:t,onOpenChange:x}),[o,r,d,t,x,b,y]);return WY(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),i.useMemo(()=>({...o,context:w,refs:b,reference:g,positionReference:h}),[o,b,w,g,h])}function JY({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=i.useState(0);i.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return FY(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),os(()=>{t.update()},r),os(()=>{s(l=>l+1)},[e])}function eZ(e){const t=[bY(e.offset)];return e.middlewares.shift&&t.push(xY({limiter:yY()})),e.middlewares.flip&&t.push(mY()),e.middlewares.inline&&t.push(gY()),t.push(BY({element:e.arrowRef,padding:e.arrowOffset})),t}function tZ(e){const[t,n]=Pd({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var l;(l=e.onClose)==null||l.call(e),n(!1)},o=()=>{var l,c;t?((l=e.onClose)==null||l.call(e),n(!1)):((c=e.onOpen)==null||c.call(e),n(!0))},s=ZY({placement:e.position,middleware:[...eZ(e),...e.width==="target"?[CY({apply({rects:l}){var c,d;Object.assign((d=(c=s.refs.floating.current)==null?void 0:c.style)!=null?d:{},{width:`${l.reference.width}px`})}})]:[]]});return JY({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),os(()=>{var l;(l=e.onPositionChange)==null||l.call(e,s.placement)},[s.placement]),os(()=>{var l,c;e.opened?(c=e.onOpen)==null||c.call(e):(l=e.onClose)==null||l.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const EE={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"},[nZ,ME]=jK(EE.context);var rZ=Object.defineProperty,oZ=Object.defineProperties,sZ=Object.getOwnPropertyDescriptors,lh=Object.getOwnPropertySymbols,OE=Object.prototype.hasOwnProperty,DE=Object.prototype.propertyIsEnumerable,Ok=(e,t,n)=>t in e?rZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zp=(e,t)=>{for(var n in t||(t={}))OE.call(t,n)&&Ok(e,n,t[n]);if(lh)for(var n of lh(t))DE.call(t,n)&&Ok(e,n,t[n]);return e},aZ=(e,t)=>oZ(e,sZ(t)),lZ=(e,t)=>{var n={};for(var r in e)OE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lh)for(var r of lh(e))t.indexOf(r)<0&&DE.call(e,r)&&(n[r]=e[r]);return n};const iZ={refProp:"ref",popupType:"dialog",shouldOverrideDefaultTargetId:!0},RE=i.forwardRef((e,t)=>{const n=Nn("PopoverTarget",iZ,e),{children:r,refProp:o,popupType:s,shouldOverrideDefaultTargetId:l}=n,c=lZ(n,["children","refProp","popupType","shouldOverrideDefaultTargetId"]);if(!aP(r))throw new Error(EE.children);const d=c,f=ME(),m=df(f.reference,r.ref,t),h=f.withRoles?{"aria-haspopup":s,"aria-expanded":f.opened,"aria-controls":f.getDropdownId(),id:l?f.getTargetId():r.props.id}:{};return i.cloneElement(r,zp(aZ(zp(zp(zp({},d),h),f.targetProps),{className:iP(f.targetProps.className,d.className,r.props.className),[o]:m}),f.controlled?null:{onClick:f.onToggle}))});RE.displayName="@mantine/core/PopoverTarget";var cZ=gr((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Ae(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:`${Ae(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const uZ=cZ;var dZ=Object.defineProperty,Dk=Object.getOwnPropertySymbols,fZ=Object.prototype.hasOwnProperty,pZ=Object.prototype.propertyIsEnumerable,Rk=(e,t,n)=>t in e?dZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wi=(e,t)=>{for(var n in t||(t={}))fZ.call(t,n)&&Rk(e,n,t[n]);if(Dk)for(var n of Dk(t))pZ.call(t,n)&&Rk(e,n,t[n]);return e};const Ak={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function mZ({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in Dp?Wi(Wi(Wi({transitionProperty:Dp[e].transitionProperty},o),Dp[e].common),Dp[e][Ak[t]]):null:Wi(Wi(Wi({transitionProperty:e.transitionProperty},o),e.common),e[Ak[t]])}function hZ({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:l,onExited:c}){const d=wa(),f=hP(),m=d.respectReducedMotion?f:!1,[h,g]=i.useState(m?0:e),[b,y]=i.useState(r?"entered":"exited"),x=i.useRef(-1),w=S=>{const j=S?o:s,_=S?l:c;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(x.current);const I=m?0:S?e:t;if(g(I),I===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const E=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);x.current=window.setTimeout(()=>{window.clearTimeout(E),typeof _=="function"&&_(),y(S?"entered":"exited")},I)}};return os(()=>{w(r)},[r]),i.useEffect(()=>()=>window.clearTimeout(x.current),[]),{transitionDuration:h,transitionStatus:b,transitionTimingFunction:n||d.transitionTimingFunction}}function AE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:l,onExit:c,onEntered:d,onEnter:f,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:b}=hZ({mounted:o,exitDuration:r,duration:n,timingFunction:l,onExit:c,onEntered:d,onEnter:f,onExited:m});return h===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(mZ({transition:t,duration:h,state:g,timingFunction:b})))}AE.displayName="@mantine/core/Transition";function TE({children:e,active:t=!0,refProp:n="ref"}){const r=sq(t),o=df(r,e==null?void 0:e.ref);return aP(e)?i.cloneElement(e,{[n]:o}):e}TE.displayName="@mantine/core/FocusTrap";var gZ=Object.defineProperty,vZ=Object.defineProperties,bZ=Object.getOwnPropertyDescriptors,Tk=Object.getOwnPropertySymbols,xZ=Object.prototype.hasOwnProperty,yZ=Object.prototype.propertyIsEnumerable,Nk=(e,t,n)=>t in e?gZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,za=(e,t)=>{for(var n in t||(t={}))xZ.call(t,n)&&Nk(e,n,t[n]);if(Tk)for(var n of Tk(t))yZ.call(t,n)&&Nk(e,n,t[n]);return e},Bp=(e,t)=>vZ(e,bZ(t));function $k(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function Lk(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 CZ={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function wZ({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:l,dir:c}){const[d,f="center"]=e.split("-"),m={width:Ae(t),height:Ae(t),transform:"rotate(45deg)",position:"absolute",[CZ[d]]:Ae(r)},h=Ae(-t/2);return d==="left"?Bp(za(za({},m),$k(f,l,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):d==="right"?Bp(za(za({},m),$k(f,l,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):d==="top"?Bp(za(za({},m),Lk(f,s,n,o,c)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):d==="bottom"?Bp(za(za({},m),Lk(f,s,n,o,c)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var SZ=Object.defineProperty,kZ=Object.defineProperties,jZ=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,$E=Object.prototype.propertyIsEnumerable,Fk=(e,t,n)=>t in e?SZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_Z=(e,t)=>{for(var n in t||(t={}))NE.call(t,n)&&Fk(e,n,t[n]);if(ih)for(var n of ih(t))$E.call(t,n)&&Fk(e,n,t[n]);return e},IZ=(e,t)=>kZ(e,jZ(t)),PZ=(e,t)=>{var n={};for(var r in e)NE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ih)for(var r of ih(e))t.indexOf(r)<0&&$E.call(e,r)&&(n[r]=e[r]);return n};const LE=i.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:l,arrowPosition:c,visible:d,arrowX:f,arrowY:m}=n,h=PZ(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=wa();return d?B.createElement("div",IZ(_Z({},h),{ref:t,style:wZ({position:r,arrowSize:o,arrowOffset:s,arrowRadius:l,arrowPosition:c,dir:g.dir,arrowX:f,arrowY:m})})):null});LE.displayName="@mantine/core/FloatingArrow";var EZ=Object.defineProperty,MZ=Object.defineProperties,OZ=Object.getOwnPropertyDescriptors,ch=Object.getOwnPropertySymbols,FE=Object.prototype.hasOwnProperty,zE=Object.prototype.propertyIsEnumerable,zk=(e,t,n)=>t in e?EZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vi=(e,t)=>{for(var n in t||(t={}))FE.call(t,n)&&zk(e,n,t[n]);if(ch)for(var n of ch(t))zE.call(t,n)&&zk(e,n,t[n]);return e},Hp=(e,t)=>MZ(e,OZ(t)),DZ=(e,t)=>{var n={};for(var r in e)FE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ch)for(var r of ch(e))t.indexOf(r)<0&&zE.call(e,r)&&(n[r]=e[r]);return n};const RZ={};function BE(e){var t;const n=Nn("PopoverDropdown",RZ,e),{style:r,className:o,children:s,onKeyDownCapture:l}=n,c=DZ(n,["style","className","children","onKeyDownCapture"]),d=ME(),{classes:f,cx:m}=uZ({radius:d.radius,shadow:d.shadow},{name:d.__staticSelector,classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),h=ZK({opened:d.opened,shouldReturnFocus:d.returnFocus}),g=d.withRoles?{"aria-labelledby":d.getTargetId(),id:d.getDropdownId(),role:"dialog"}:{};return d.disabled?null:B.createElement(zP,Hp(Vi({},d.portalProps),{withinPortal:d.withinPortal}),B.createElement(AE,Hp(Vi({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(TE,{active:d.trapFocus},B.createElement(Vr,Vi(Hp(Vi({},g),{tabIndex:-1,ref:d.floating,style:Hp(Vi(Vi({},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:Ae(d.width)}),className:m(f.dropdown,o),onKeyDownCapture:IK(d.onClose,{active:d.closeOnEscape,onTrigger:h,onKeyDown:l}),"data-position":d.placement}),c),s,B.createElement(LE,{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:f.arrow})))}))}BE.displayName="@mantine/core/PopoverDropdown";function AZ(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 Bk=Object.getOwnPropertySymbols,TZ=Object.prototype.hasOwnProperty,NZ=Object.prototype.propertyIsEnumerable,$Z=(e,t)=>{var n={};for(var r in e)TZ.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&&NZ.call(e,r)&&(n[r]=e[r]);return n};const LZ={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:Oy("popover"),__staticSelector:"Popover",width:"max-content"};function nu(e){var t,n,r,o,s,l;const c=i.useRef(null),d=Nn("Popover",LZ,e),{children:f,position:m,offset:h,onPositionChange:g,positionDependencies:b,opened:y,transitionProps:x,width:w,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:I,arrowRadius:E,arrowPosition:M,unstyled:D,classNames:R,styles:N,closeOnClickOutside:O,withinPortal:T,portalProps:U,closeOnEscape:G,clickOutsideEvents:q,trapFocus:Y,onClose:Q,onOpen:V,onChange:se,zIndex:ee,radius:le,shadow:ae,id:ce,defaultOpened:J,__staticSelector:re,withRoles:A,disabled:L,returnFocus:K,variant:ne,keepMounted:z}=d,oe=$Z(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"]),[X,Z]=i.useState(null),[me,ve]=i.useState(null),de=Ry(ce),ke=wa(),we=tZ({middlewares:S,width:w,position:AZ(ke.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:c,arrowOffset:I,onPositionChange:g,positionDependencies:b,opened:y,defaultOpened:J,onChange:se,onOpen:V,onClose:Q});qK(()=>we.opened&&O&&we.onClose(),q,[X,me]);const Re=i.useCallback($e=>{Z($e),we.floating.reference($e)},[we.floating.reference]),Qe=i.useCallback($e=>{ve($e),we.floating.floating($e)},[we.floating.floating]);return B.createElement(nZ,{value:{returnFocus:K,disabled:L,controlled:we.controlled,reference:Re,floating:Qe,x:we.floating.x,y:we.floating.y,arrowX:(r=(n=(t=we.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(l=(s=(o=we.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:l.y,opened:we.opened,arrowRef:c,transitionProps:x,width:w,withArrow:j,arrowSize:_,arrowOffset:I,arrowRadius:E,arrowPosition:M,placement:we.floating.placement,trapFocus:Y,withinPortal:T,portalProps:U,zIndex:ee,radius:le,shadow:ae,closeOnEscape:G,onClose:we.onClose,onToggle:we.onToggle,getTargetId:()=>`${de}-target`,getDropdownId:()=>`${de}-dropdown`,withRoles:A,targetProps:oe,__staticSelector:re,classNames:R,styles:N,unstyled:D,variant:ne,keepMounted:z}},f)}nu.Target=RE;nu.Dropdown=BE;nu.displayName="@mantine/core/Popover";var FZ=Object.defineProperty,uh=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,WE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?FZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zZ=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&Hk(e,n,t[n]);if(uh)for(var n of uh(t))WE.call(t,n)&&Hk(e,n,t[n]);return e},BZ=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&uh)for(var r of uh(e))t.indexOf(r)<0&&WE.call(e,r)&&(n[r]=e[r]);return n};function HZ(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:l,innerRef:c,__staticSelector:d,styles:f,classNames:m,unstyled:h}=t,g=BZ(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:b}=sY(null,{name:d,styles:f,classNames:m,unstyled:h});return B.createElement(nu.Dropdown,zZ({p:0,onMouseDown:y=>y.preventDefault()},g),B.createElement("div",{style:{maxHeight:Ae(o),display:"flex"}},B.createElement(Vr,{component:r||"div",id:`${l}-items`,"aria-labelledby":`${l}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==Rg?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:c},B.createElement("div",{className:b.itemsWrapper,style:{flexDirection:s}},n))))}function el({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:l,onDirectionChange:c,switchDirectionOnFlip:d,zIndex:f,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:b,unstyled:y,readOnly:x,variant:w}){return B.createElement(nu,{unstyled:y,classNames:g,styles:b,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:f,__staticSelector:l,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)}el.Target=nu.Target;el.Dropdown=HZ;var WZ=Object.defineProperty,VZ=Object.defineProperties,UZ=Object.getOwnPropertyDescriptors,dh=Object.getOwnPropertySymbols,VE=Object.prototype.hasOwnProperty,UE=Object.prototype.propertyIsEnumerable,Wk=(e,t,n)=>t in e?WZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wp=(e,t)=>{for(var n in t||(t={}))VE.call(t,n)&&Wk(e,n,t[n]);if(dh)for(var n of dh(t))UE.call(t,n)&&Wk(e,n,t[n]);return e},GZ=(e,t)=>VZ(e,UZ(t)),KZ=(e,t)=>{var n={};for(var r in e)VE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dh)for(var r of dh(e))t.indexOf(r)<0&&UE.call(e,r)&&(n[r]=e[r]);return n};function GE(e,t,n){const r=Nn(e,t,n),{label:o,description:s,error:l,required:c,classNames:d,styles:f,className:m,unstyled:h,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:w,wrapperProps:S,id:j,size:_,style:I,inputContainer:E,inputWrapperOrder:M,withAsterisk:D,variant:R}=r,N=KZ(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=Ry(j),{systemStyles:T,rest:U}=Eg(N),G=Wp({label:o,description:s,error:l,required:c,classNames:d,className:m,__staticSelector:g,sx:b,errorProps:y,labelProps:x,descriptionProps:w,unstyled:h,styles:f,id:O,size:_,style:I,inputContainer:E,inputWrapperOrder:M,withAsterisk:D,variant:R},S);return GZ(Wp({},U),{classNames:d,styles:f,unstyled:h,wrapperProps:Wp(Wp({},G),T),inputProps:{required:c,classNames:d,styles:f,unstyled:h,id:O,size:_,__staticSelector:g,error:l,variant:R}})}var qZ=gr((e,t,{size:n})=>({label:{display:"inline-block",fontSize:pt({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 XZ=qZ;var QZ=Object.defineProperty,fh=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,Vk=(e,t,n)=>t in e?QZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YZ=(e,t)=>{for(var n in t||(t={}))KE.call(t,n)&&Vk(e,n,t[n]);if(fh)for(var n of fh(t))qE.call(t,n)&&Vk(e,n,t[n]);return e},ZZ=(e,t)=>{var n={};for(var r in e)KE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fh)for(var r of fh(e))t.indexOf(r)<0&&qE.call(e,r)&&(n[r]=e[r]);return n};const JZ={labelElement:"label",size:"sm"},Uy=i.forwardRef((e,t)=>{const n=Nn("InputLabel",JZ,e),{labelElement:r,children:o,required:s,size:l,classNames:c,styles:d,unstyled:f,className:m,htmlFor:h,__staticSelector:g,variant:b,onMouseDown:y}=n,x=ZZ(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=XZ(null,{name:["InputWrapper",g],classNames:c,styles:d,unstyled:f,variant:b,size:l});return B.createElement(Vr,YZ({component:r,ref:t,className:S(w.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},x),o,s&&B.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});Uy.displayName="@mantine/core/InputLabel";var eJ=gr((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${pt({size:n,sizes:e.fontSizes})} - ${Ae(2)})`,lineHeight:1.2,display:"block"}}));const tJ=eJ;var nJ=Object.defineProperty,ph=Object.getOwnPropertySymbols,XE=Object.prototype.hasOwnProperty,QE=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?nJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rJ=(e,t)=>{for(var n in t||(t={}))XE.call(t,n)&&Uk(e,n,t[n]);if(ph)for(var n of ph(t))QE.call(t,n)&&Uk(e,n,t[n]);return e},oJ=(e,t)=>{var n={};for(var r in e)XE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ph)for(var r of ph(e))t.indexOf(r)<0&&QE.call(e,r)&&(n[r]=e[r]);return n};const sJ={size:"sm"},Gy=i.forwardRef((e,t)=>{const n=Nn("InputError",sJ,e),{children:r,className:o,classNames:s,styles:l,unstyled:c,size:d,__staticSelector:f,variant:m}=n,h=oJ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=tJ(null,{name:["InputWrapper",f],classNames:s,styles:l,unstyled:c,variant:m,size:d});return B.createElement(Oc,rJ({className:b(g.error,o),ref:t},h),r)});Gy.displayName="@mantine/core/InputError";var aJ=gr((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${pt({size:n,sizes:e.fontSizes})} - ${Ae(2)})`,lineHeight:1.2,display:"block"}}));const lJ=aJ;var iJ=Object.defineProperty,mh=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Gk=(e,t,n)=>t in e?iJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cJ=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Gk(e,n,t[n]);if(mh)for(var n of mh(t))ZE.call(t,n)&&Gk(e,n,t[n]);return e},uJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mh)for(var r of mh(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};const dJ={size:"sm"},Ky=i.forwardRef((e,t)=>{const n=Nn("InputDescription",dJ,e),{children:r,className:o,classNames:s,styles:l,unstyled:c,size:d,__staticSelector:f,variant:m}=n,h=uJ(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:b}=lJ(null,{name:["InputWrapper",f],classNames:s,styles:l,unstyled:c,variant:m,size:d});return B.createElement(Oc,cJ({color:"dimmed",className:b(g.description,o),ref:t,unstyled:c},h),r)});Ky.displayName="@mantine/core/InputDescription";const JE=i.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),fJ=JE.Provider,pJ=()=>i.useContext(JE);function mJ(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 hJ=Object.defineProperty,gJ=Object.defineProperties,vJ=Object.getOwnPropertyDescriptors,Kk=Object.getOwnPropertySymbols,bJ=Object.prototype.hasOwnProperty,xJ=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?hJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yJ=(e,t)=>{for(var n in t||(t={}))bJ.call(t,n)&&qk(e,n,t[n]);if(Kk)for(var n of Kk(t))xJ.call(t,n)&&qk(e,n,t[n]);return e},CJ=(e,t)=>gJ(e,vJ(t)),wJ=gr(e=>({root:CJ(yJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const SJ=wJ;var kJ=Object.defineProperty,jJ=Object.defineProperties,_J=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertySymbols,eM=Object.prototype.hasOwnProperty,tM=Object.prototype.propertyIsEnumerable,Xk=(e,t,n)=>t in e?kJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ba=(e,t)=>{for(var n in t||(t={}))eM.call(t,n)&&Xk(e,n,t[n]);if(hh)for(var n of hh(t))tM.call(t,n)&&Xk(e,n,t[n]);return e},Qk=(e,t)=>jJ(e,_J(t)),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&&hh)for(var r of hh(e))t.indexOf(r)<0&&tM.call(e,r)&&(n[r]=e[r]);return n};const PJ={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},nM=i.forwardRef((e,t)=>{const n=Nn("InputWrapper",PJ,e),{className:r,label:o,children:s,required:l,id:c,error:d,description:f,labelElement:m,labelProps:h,descriptionProps:g,errorProps:b,classNames:y,styles:x,size:w,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:I,withAsterisk:E,variant:M}=n,D=IJ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:R,cx:N}=SJ(null,{classNames:y,styles:x,name:["InputWrapper",j],unstyled:_,variant:M,size:w}),O={classNames:y,styles:x,unstyled:_,size:w,variant:M,__staticSelector:j},T=typeof E=="boolean"?E:l,U=c?`${c}-error`:b==null?void 0:b.id,G=c?`${c}-description`:g==null?void 0:g.id,Y=`${!!d&&typeof d!="boolean"?U:""} ${f?G:""}`,Q=Y.trim().length>0?Y.trim():void 0,V=o&&B.createElement(Uy,Ba(Ba({key:"label",labelElement:m,id:c?`${c}-label`:void 0,htmlFor:c,required:T},O),h),o),se=f&&B.createElement(Ky,Qk(Ba(Ba({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||G}),f),ee=B.createElement(i.Fragment,{key:"input"},S(s)),le=typeof d!="boolean"&&d&&B.createElement(Gy,Qk(Ba(Ba({},b),O),{size:(b==null?void 0:b.size)||O.size,key:"error",id:(b==null?void 0:b.id)||U}),d),ae=I.map(ce=>{switch(ce){case"label":return V;case"input":return ee;case"description":return se;case"error":return le;default:return null}});return B.createElement(fJ,{value:Ba({describedBy:Q},mJ(I,{hasDescription:!!se,hasError:!!le}))},B.createElement(Vr,Ba({className:N(R.root,r),ref:t},D),ae))});nM.displayName="@mantine/core/InputWrapper";var EJ=Object.defineProperty,gh=Object.getOwnPropertySymbols,rM=Object.prototype.hasOwnProperty,oM=Object.prototype.propertyIsEnumerable,Yk=(e,t,n)=>t in e?EJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,MJ=(e,t)=>{for(var n in t||(t={}))rM.call(t,n)&&Yk(e,n,t[n]);if(gh)for(var n of gh(t))oM.call(t,n)&&Yk(e,n,t[n]);return e},OJ=(e,t)=>{var n={};for(var r in e)rM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gh)for(var r of gh(e))t.indexOf(r)<0&&oM.call(e,r)&&(n[r]=e[r]);return n};const DJ={},sM=i.forwardRef((e,t)=>{const n=Nn("InputPlaceholder",DJ,e),{sx:r}=n,o=OJ(n,["sx"]);return B.createElement(Vr,MJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...oP(r)],ref:t},o))});sM.displayName="@mantine/core/InputPlaceholder";var RJ=Object.defineProperty,AJ=Object.defineProperties,TJ=Object.getOwnPropertyDescriptors,Zk=Object.getOwnPropertySymbols,NJ=Object.prototype.hasOwnProperty,$J=Object.prototype.propertyIsEnumerable,Jk=(e,t,n)=>t in e?RJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vp=(e,t)=>{for(var n in t||(t={}))NJ.call(t,n)&&Jk(e,n,t[n]);if(Zk)for(var n of Zk(t))$J.call(t,n)&&Jk(e,n,t[n]);return e},s1=(e,t)=>AJ(e,TJ(t));const vo={xs:Ae(30),sm:Ae(36),md:Ae(42),lg:Ae(50),xl:Ae(60)},LJ=["default","filled","unstyled"];function FJ({theme:e,variant:t}){return LJ.includes(t)?t==="default"?{border:`${Ae(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:`${Ae(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:Ae(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var zJ=gr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:l,offsetBottom:c,offsetTop:d,pointer:f},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,b=m==="default"||m==="filled"?{minHeight:pt({size:h,sizes:vo}),paddingLeft:`calc(${pt({size:h,sizes:vo})} / 3)`,paddingRight:s?o||pt({size:h,sizes:vo}):`calc(${pt({size:h,sizes:vo})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||pt({size:h,sizes:vo})}: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:s1(Vp(Vp(s1(Vp({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":pt({size:h,sizes:vo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${pt({size:h,sizes:vo})} - ${Ae(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:pt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:f?"pointer":void 0}),FJ({theme:e,variant:m})),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 l=="number"?Ae(l):pt({size:h,sizes:vo})},"&::placeholder":s1(Vp({},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:l?Ae(l):pt({size:h,sizes:vo}),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||pt({size:h,sizes:vo})}}});const BJ=zJ;var HJ=Object.defineProperty,WJ=Object.defineProperties,VJ=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,aM=Object.prototype.hasOwnProperty,lM=Object.prototype.propertyIsEnumerable,ej=(e,t,n)=>t in e?HJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Up=(e,t)=>{for(var n in t||(t={}))aM.call(t,n)&&ej(e,n,t[n]);if(vh)for(var n of vh(t))lM.call(t,n)&&ej(e,n,t[n]);return e},tj=(e,t)=>WJ(e,VJ(t)),UJ=(e,t)=>{var n={};for(var r in e)aM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vh)for(var r of vh(e))t.indexOf(r)<0&&lM.call(e,r)&&(n[r]=e[r]);return n};const GJ={size:"sm",variant:"default"},pi=i.forwardRef((e,t)=>{const n=Nn("Input",GJ,e),{className:r,error:o,required:s,disabled:l,variant:c,icon:d,style:f,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:b,radius:y,size:x,wrapperProps:w,classNames:S,styles:j,__staticSelector:_,multiline:I,sx:E,unstyled:M,pointer:D}=n,R=UJ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:N,offsetTop:O,describedBy:T}=pJ(),{classes:U,cx:G}=BJ({radius:y,multiline:I,invalid:!!o,rightSectionWidth:m?Ae(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:N,offsetTop:O,pointer:D},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:c,size:x}),{systemStyles:q,rest:Y}=Eg(R);return B.createElement(Vr,Up(Up({className:G(U.wrapper,r),sx:E,style:f},q),w),d&&B.createElement("div",{className:U.icon},d),B.createElement(Vr,tj(Up({component:"input"},Y),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:l,"data-disabled":l||void 0,"data-with-icon":!!d||void 0,"data-invalid":!!o||void 0,className:U.input})),g&&B.createElement("div",tj(Up({},b),{className:U.rightSection}),g))});pi.displayName="@mantine/core/Input";pi.Wrapper=nM;pi.Label=Uy;pi.Description=Ky;pi.Error=Gy;pi.Placeholder=sM;const Tc=pi;var KJ=Object.defineProperty,bh=Object.getOwnPropertySymbols,iM=Object.prototype.hasOwnProperty,cM=Object.prototype.propertyIsEnumerable,nj=(e,t,n)=>t in e?KJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rj=(e,t)=>{for(var n in t||(t={}))iM.call(t,n)&&nj(e,n,t[n]);if(bh)for(var n of bh(t))cM.call(t,n)&&nj(e,n,t[n]);return e},qJ=(e,t)=>{var n={};for(var r in e)iM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bh)for(var r of bh(e))t.indexOf(r)<0&&cM.call(e,r)&&(n[r]=e[r]);return n};const XJ={multiple:!1},uM=i.forwardRef((e,t)=>{const n=Nn("FileButton",XJ,e),{onChange:r,children:o,multiple:s,accept:l,name:c,form:d,resetRef:f,disabled:m,capture:h,inputProps:g}=n,b=qJ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=i.useRef(),x=()=>{!m&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return mP(f,()=>{y.current.value=""}),B.createElement(B.Fragment,null,o(rj({onClick:x},b)),B.createElement("input",rj({style:{display:"none"},type:"file",accept:l,multiple:s,onChange:w,ref:df(t,y),name:c,form:d,capture:h},g)))});uM.displayName="@mantine/core/FileButton";const dM={xs:Ae(16),sm:Ae(22),md:Ae(26),lg:Ae(30),xl:Ae(36)},QJ={xs:Ae(10),sm:Ae(12),md:Ae(14),lg:Ae(16),xl:Ae(18)};var YJ=gr((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:pt({size:o,sizes:dM}),paddingLeft:`calc(${pt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?pt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:pt({size:o,sizes:QJ}),borderRadius:pt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Ae(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${pt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const ZJ=YJ;var JJ=Object.defineProperty,xh=Object.getOwnPropertySymbols,fM=Object.prototype.hasOwnProperty,pM=Object.prototype.propertyIsEnumerable,oj=(e,t,n)=>t in e?JJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eee=(e,t)=>{for(var n in t||(t={}))fM.call(t,n)&&oj(e,n,t[n]);if(xh)for(var n of xh(t))pM.call(t,n)&&oj(e,n,t[n]);return e},tee=(e,t)=>{var n={};for(var r in e)fM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xh)for(var r of xh(e))t.indexOf(r)<0&&pM.call(e,r)&&(n[r]=e[r]);return n};const nee={xs:16,sm:22,md:24,lg:26,xl:30};function mM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:l,disabled:c,readOnly:d,size:f,radius:m="sm",variant:h,unstyled:g}=t,b=tee(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:x}=ZJ({disabled:c,readOnly:d,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:f,variant:h});return B.createElement("div",eee({className:x(y.defaultValue,s)},b),B.createElement("span",{className:y.defaultValueLabel},n),!c&&!d&&B.createElement(KP,{"aria-hidden":!0,onMouseDown:l,size:nee[f],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}mM.displayName="@mantine/core/MultiSelect/DefaultValue";function ree({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:l}){if(!t&&s.length===0)return e;if(!t){const d=[];for(let f=0;f<e.length;f+=1)(l||!s.some(m=>m===e[f].value&&!e[f].disabled))&&d.push(e[f]);return d}const c=[];for(let d=0;d<e.length&&(o(r,!l&&s.some(f=>f===e[d].value&&!e[d].disabled),e[d])&&c.push(e[d]),!(c.length>=n));d+=1);return c}var oee=Object.defineProperty,yh=Object.getOwnPropertySymbols,hM=Object.prototype.hasOwnProperty,gM=Object.prototype.propertyIsEnumerable,sj=(e,t,n)=>t in e?oee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aj=(e,t)=>{for(var n in t||(t={}))hM.call(t,n)&&sj(e,n,t[n]);if(yh)for(var n of yh(t))gM.call(t,n)&&sj(e,n,t[n]);return e},see=(e,t)=>{var n={};for(var r in e)hM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yh)for(var r of yh(e))t.indexOf(r)<0&&gM.call(e,r)&&(n[r]=e[r]);return n};const aee={xs:Ae(14),sm:Ae(18),md:Ae(20),lg:Ae(24),xl:Ae(28)};function lee(e){var t=e,{size:n,error:r,style:o}=t,s=see(t,["size","error","style"]);const l=wa(),c=pt({size:n,sizes:aee});return B.createElement("svg",aj({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:aj({color:r?l.colors.red[6]:l.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 iee=Object.defineProperty,cee=Object.defineProperties,uee=Object.getOwnPropertyDescriptors,lj=Object.getOwnPropertySymbols,dee=Object.prototype.hasOwnProperty,fee=Object.prototype.propertyIsEnumerable,ij=(e,t,n)=>t in e?iee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pee=(e,t)=>{for(var n in t||(t={}))dee.call(t,n)&&ij(e,n,t[n]);if(lj)for(var n of lj(t))fee.call(t,n)&&ij(e,n,t[n]);return e},mee=(e,t)=>cee(e,uee(t));function vM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?B.createElement(KP,mee(pee({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):B.createElement(lee,{error:o,size:r})}vM.displayName="@mantine/core/SelectRightSection";var hee=Object.defineProperty,gee=Object.defineProperties,vee=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertySymbols,bM=Object.prototype.hasOwnProperty,xM=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?hee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,a1=(e,t)=>{for(var n in t||(t={}))bM.call(t,n)&&cj(e,n,t[n]);if(Ch)for(var n of Ch(t))xM.call(t,n)&&cj(e,n,t[n]);return e},uj=(e,t)=>gee(e,vee(t)),bee=(e,t)=>{var n={};for(var r in e)bM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ch)for(var r of Ch(e))t.indexOf(r)<0&&xM.call(e,r)&&(n[r]=e[r]);return n};function yM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,l=bee(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const c=typeof n=="function"?n(s):n;return{rightSection:!l.readOnly&&!(l.disabled&&l.shouldClear)&&B.createElement(vM,a1({},l)),styles:uj(a1({},c),{rightSection:uj(a1({},c==null?void 0:c.rightSection),{pointerEvents:l.shouldClear?void 0:"none"})})}}var xee=Object.defineProperty,yee=Object.defineProperties,Cee=Object.getOwnPropertyDescriptors,dj=Object.getOwnPropertySymbols,wee=Object.prototype.hasOwnProperty,See=Object.prototype.propertyIsEnumerable,fj=(e,t,n)=>t in e?xee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kee=(e,t)=>{for(var n in t||(t={}))wee.call(t,n)&&fj(e,n,t[n]);if(dj)for(var n of dj(t))See.call(t,n)&&fj(e,n,t[n]);return e},jee=(e,t)=>yee(e,Cee(t)),_ee=gr((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(${pt({size:n,sizes:vo})} - ${Ae(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:pt({size:n,sizes:vo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Ae(2)}) calc(${e.spacing.xs} / 2)`},searchInput:jee(kee({},e.fn.fontStyles()),{flex:1,minWidth:Ae(60),backgroundColor:"transparent",border:0,outline:0,fontSize:pt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:pt({size:n,sizes:dM}),"&::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 Iee=_ee;var Pee=Object.defineProperty,Eee=Object.defineProperties,Mee=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,CM=Object.prototype.hasOwnProperty,wM=Object.prototype.propertyIsEnumerable,pj=(e,t,n)=>t in e?Pee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ui=(e,t)=>{for(var n in t||(t={}))CM.call(t,n)&&pj(e,n,t[n]);if(wh)for(var n of wh(t))wM.call(t,n)&&pj(e,n,t[n]);return e},mj=(e,t)=>Eee(e,Mee(t)),Oee=(e,t)=>{var n={};for(var r in e)CM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wh)for(var r of wh(e))t.indexOf(r)<0&&wM.call(e,r)&&(n[r]=e[r]);return n};function Dee(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function Ree(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function hj(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 Aee={size:"sm",valueComponent:mM,itemComponent:Ty,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:Dee,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:Ree,switchDirectionOnFlip:!1,zIndex:Oy("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},SM=i.forwardRef((e,t)=>{const n=Nn("MultiSelect",Aee,e),{className:r,style:o,required:s,label:l,description:c,size:d,error:f,classNames:m,styles:h,wrapperProps:g,value:b,defaultValue:y,data:x,onChange:w,valueComponent:S,itemComponent:j,id:_,transitionProps:I,maxDropdownHeight:E,shadow:M,nothingFound:D,onFocus:R,onBlur:N,searchable:O,placeholder:T,filter:U,limit:G,clearSearchOnChange:q,clearable:Y,clearSearchOnBlur:Q,variant:V,onSearchChange:se,searchValue:ee,disabled:le,initiallyOpened:ae,radius:ce,icon:J,rightSection:re,rightSectionWidth:A,creatable:L,getCreateLabel:K,shouldCreate:ne,onCreate:z,sx:oe,dropdownComponent:X,onDropdownClose:Z,onDropdownOpen:me,maxSelectedValues:ve,withinPortal:de,portalProps:ke,switchDirectionOnFlip:we,zIndex:Re,selectOnBlur:Qe,name:$e,dropdownPosition:vt,errorProps:it,labelProps:ot,descriptionProps:Ce,form:Me,positionDependencies:qe,onKeyDown:dt,unstyled:ye,inputContainer:Ue,inputWrapperOrder:st,readOnly:mt,withAsterisk:Pe,clearButtonProps:Ne,hoverOnSearchChange:kt,disableSelectedItemFiltering:Se}=n,Ve=Oee(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:Ge,cx:Le,theme:bt}=Iee({invalid:!!f},{name:"MultiSelect",classNames:m,styles:h,unstyled:ye,size:d,variant:V}),{systemStyles:fn,rest:Bt}=Eg(Ve),Ht=i.useRef(),zn=i.useRef({}),pn=Ry(_),[en,un]=i.useState(ae),[Wt,ar]=i.useState(-1),[vr,Bn]=i.useState("column"),[Hn,lo]=Pd({value:ee,defaultValue:"",finalValue:void 0,onChange:se}),[Fo,zo]=i.useState(!1),{scrollIntoView:Ia,targetRef:xi,scrollableRef:Pa}=gP({duration:0,offset:5,cancelable:!1,isList:!0}),yi=L&&typeof K=="function";let Je=null;const qt=x.map(rt=>typeof rt=="string"?{label:rt,value:rt}:rt),Wn=sP({data:qt}),[jt,Ea]=Pd({value:hj(b,x),defaultValue:hj(y,x),finalValue:[],onChange:w}),qr=i.useRef(!!ve&&ve<jt.length),jf=rt=>{if(!mt){const Dt=jt.filter(_t=>_t!==rt);Ea(Dt),ve&&Dt.length<ve&&(qr.current=!1)}},h0=rt=>{lo(rt.currentTarget.value),!le&&!qr.current&&O&&un(!0)},g0=rt=>{typeof R=="function"&&R(rt),!le&&!qr.current&&O&&un(!0)},Vn=ree({data:Wn,searchable:O,searchValue:Hn,limit:G,filter:U,value:jt,disableSelectedItemFiltering:Se});yi&&ne(Hn,Wn)&&(Je=K(Hn),Vn.push({label:Hn,value:Hn,creatable:!0}));const Hs=Math.min(Wt,Vn.length-1),_f=(rt,Dt,_t)=>{let Rt=rt;for(;_t(Rt);)if(Rt=Dt(Rt),!Vn[Rt].disabled)return Rt;return rt};os(()=>{ar(kt&&Hn?0:-1)},[Hn,kt]),os(()=>{!le&&jt.length>x.length&&un(!1),ve&&jt.length<ve&&(qr.current=!1),ve&&jt.length>=ve&&(qr.current=!0,un(!1))},[jt]);const Ci=rt=>{if(!mt)if(q&&lo(""),jt.includes(rt.value))jf(rt.value);else{if(rt.creatable&&typeof z=="function"){const Dt=z(rt.value);typeof Dt<"u"&&Dt!==null&&Ea(typeof Dt=="string"?[...jt,Dt]:[...jt,Dt.value])}else Ea([...jt,rt.value]);jt.length===ve-1&&(qr.current=!0,un(!1)),Vn.length===1&&un(!1)}},mu=rt=>{typeof N=="function"&&N(rt),Qe&&Vn[Hs]&&en&&Ci(Vn[Hs]),Q&&lo(""),un(!1)},_l=rt=>{if(Fo||(dt==null||dt(rt),mt)||rt.key!=="Backspace"&&ve&&qr.current)return;const Dt=vr==="column",_t=()=>{ar(lr=>{var an;const $n=_f(lr,br=>br+1,br=>br<Vn.length-1);return en&&(xi.current=zn.current[(an=Vn[$n])==null?void 0:an.value],Ia({alignment:Dt?"end":"start"})),$n})},Rt=()=>{ar(lr=>{var an;const $n=_f(lr,br=>br-1,br=>br>0);return en&&(xi.current=zn.current[(an=Vn[$n])==null?void 0:an.value],Ia({alignment:Dt?"start":"end"})),$n})};switch(rt.key){case"ArrowUp":{rt.preventDefault(),un(!0),Dt?Rt():_t();break}case"ArrowDown":{rt.preventDefault(),un(!0),Dt?_t():Rt();break}case"Enter":{rt.preventDefault(),Vn[Hs]&&en?Ci(Vn[Hs]):un(!0);break}case" ":{O||(rt.preventDefault(),Vn[Hs]&&en?Ci(Vn[Hs]):un(!0));break}case"Backspace":{jt.length>0&&Hn.length===0&&(Ea(jt.slice(0,-1)),un(!0),ve&&(qr.current=!1));break}case"Home":{if(!O){rt.preventDefault(),en||un(!0);const lr=Vn.findIndex(an=>!an.disabled);ar(lr),Ia({alignment:Dt?"end":"start"})}break}case"End":{if(!O){rt.preventDefault(),en||un(!0);const lr=Vn.map(an=>!!an.disabled).lastIndexOf(!1);ar(lr),Ia({alignment:Dt?"end":"start"})}break}case"Escape":un(!1)}},hu=jt.map(rt=>{let Dt=Wn.find(_t=>_t.value===rt&&!_t.disabled);return!Dt&&yi&&(Dt={value:rt,label:rt}),Dt}).filter(rt=>!!rt).map((rt,Dt)=>B.createElement(S,mj(Ui({},rt),{variant:V,disabled:le,className:Ge.value,readOnly:mt,onRemove:_t=>{_t.preventDefault(),_t.stopPropagation(),jf(rt.value)},key:rt.value,size:d,styles:h,classNames:m,radius:ce,index:Dt}))),gu=rt=>jt.includes(rt),v0=()=>{var rt;lo(""),Ea([]),(rt=Ht.current)==null||rt.focus(),ve&&(qr.current=!1)},Ma=!mt&&(Vn.length>0?en:en&&!!D);return os(()=>{const rt=Ma?me:Z;typeof rt=="function"&&rt()},[Ma]),B.createElement(Tc.Wrapper,Ui(Ui({required:s,id:pn,label:l,error:f,description:c,size:d,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:oe,errorProps:it,descriptionProps:Ce,labelProps:ot,inputContainer:Ue,inputWrapperOrder:st,unstyled:ye,withAsterisk:Pe,variant:V},fn),g),B.createElement(el,{opened:Ma,transitionProps:I,shadow:"sm",withinPortal:de,portalProps:ke,__staticSelector:"MultiSelect",onDirectionChange:Bn,switchDirectionOnFlip:we,zIndex:Re,dropdownPosition:vt,positionDependencies:[...qe,Hn],classNames:m,styles:h,unstyled:ye,variant:V},B.createElement(el.Target,null,B.createElement("div",{className:Ge.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":en&&Ma?`${pn}-items`:null,"aria-controls":pn,"aria-expanded":en,onMouseLeave:()=>ar(-1),tabIndex:-1},B.createElement("input",{type:"hidden",name:$e,value:jt.join(","),form:Me,disabled:le}),B.createElement(Tc,Ui({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:d,variant:V,disabled:le,error:f,required:s,radius:ce,icon:J,unstyled:ye,onMouseDown:rt=>{var Dt;rt.preventDefault(),!le&&!qr.current&&un(!en),(Dt=Ht.current)==null||Dt.focus()},classNames:mj(Ui({},m),{input:Le({[Ge.input]:!O},m==null?void 0:m.input)})},yM({theme:bt,rightSection:re,rightSectionWidth:A,styles:h,size:d,shouldClear:Y&&jt.length>0,onClear:v0,error:f,disabled:le,clearButtonProps:Ne,readOnly:mt})),B.createElement("div",{className:Ge.values,"data-clearable":Y||void 0},hu,B.createElement("input",Ui({ref:df(t,Ht),type:"search",id:pn,className:Le(Ge.searchInput,{[Ge.searchInputPointer]:!O,[Ge.searchInputInputHidden]:!en&&jt.length>0||!O&&jt.length>0,[Ge.searchInputEmpty]:jt.length===0}),onKeyDown:_l,value:Hn,onChange:h0,onFocus:g0,onBlur:mu,readOnly:!O||qr.current||mt,placeholder:jt.length===0?T:void 0,disabled:le,"data-mantine-stop-propagation":en,autoComplete:"off",onCompositionStart:()=>zo(!0),onCompositionEnd:()=>zo(!1)},Bt)))))),B.createElement(el.Dropdown,{component:X||Rg,maxHeight:E,direction:vr,id:pn,innerRef:Pa,__staticSelector:"MultiSelect",classNames:m,styles:h},B.createElement(Ay,{data:Vn,hovered:Hs,classNames:m,styles:h,uuid:pn,__staticSelector:"MultiSelect",onItemHover:ar,onItemSelect:Ci,itemsRefs:zn,itemComponent:j,size:d,nothingFound:D,isItemSelected:gu,creatable:L&&!!Je,createLabel:Je,unstyled:ye,variant:V}))))});SM.displayName="@mantine/core/MultiSelect";var Tee=Object.defineProperty,Nee=Object.defineProperties,$ee=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,kM=Object.prototype.hasOwnProperty,jM=Object.prototype.propertyIsEnumerable,gj=(e,t,n)=>t in e?Tee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l1=(e,t)=>{for(var n in t||(t={}))kM.call(t,n)&&gj(e,n,t[n]);if(Sh)for(var n of Sh(t))jM.call(t,n)&&gj(e,n,t[n]);return e},Lee=(e,t)=>Nee(e,$ee(t)),Fee=(e,t)=>{var n={};for(var r in e)kM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sh)for(var r of Sh(e))t.indexOf(r)<0&&jM.call(e,r)&&(n[r]=e[r]);return n};const zee={type:"text",size:"sm",__staticSelector:"TextInput"},_M=i.forwardRef((e,t)=>{const n=GE("TextInput",zee,e),{inputProps:r,wrapperProps:o}=n,s=Fee(n,["inputProps","wrapperProps"]);return B.createElement(Tc.Wrapper,l1({},o),B.createElement(Tc,Lee(l1(l1({},r),s),{ref:t})))});_M.displayName="@mantine/core/TextInput";function Bee({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:l}){if(!t)return e;const c=s!=null&&e.find(f=>f.value===s)||null;if(c&&!l&&(c==null?void 0:c.label)===r){if(n){if(n>=e.length)return e;const f=e.indexOf(c),m=f+n,h=m-e.length;return h>0?e.slice(f-h):e.slice(f,m)}return e}const d=[];for(let f=0;f<e.length&&(o(r,e[f])&&d.push(e[f]),!(d.length>=n));f+=1);return d}var Hee=gr(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const Wee=Hee;var Vee=Object.defineProperty,Uee=Object.defineProperties,Gee=Object.getOwnPropertyDescriptors,kh=Object.getOwnPropertySymbols,IM=Object.prototype.hasOwnProperty,PM=Object.prototype.propertyIsEnumerable,vj=(e,t,n)=>t in e?Vee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hu=(e,t)=>{for(var n in t||(t={}))IM.call(t,n)&&vj(e,n,t[n]);if(kh)for(var n of kh(t))PM.call(t,n)&&vj(e,n,t[n]);return e},i1=(e,t)=>Uee(e,Gee(t)),Kee=(e,t)=>{var n={};for(var r in e)IM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&kh)for(var r of kh(e))t.indexOf(r)<0&&PM.call(e,r)&&(n[r]=e[r]);return n};function qee(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function Xee(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const Qee={required:!1,size:"sm",shadow:"sm",itemComponent:Ty,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:qee,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:Xee,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Oy("popover"),positionDependencies:[],dropdownPosition:"flip"},qy=i.forwardRef((e,t)=>{const n=GE("Select",Qee,e),{inputProps:r,wrapperProps:o,shadow:s,data:l,value:c,defaultValue:d,onChange:f,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:b,transitionProps:y,initiallyOpened:x,unstyled:w,classNames:S,styles:j,filter:_,maxDropdownHeight:I,searchable:E,clearable:M,nothingFound:D,limit:R,disabled:N,onSearchChange:O,searchValue:T,rightSection:U,rightSectionWidth:G,creatable:q,getCreateLabel:Y,shouldCreate:Q,selectOnBlur:V,onCreate:se,dropdownComponent:ee,onDropdownClose:le,onDropdownOpen:ae,withinPortal:ce,portalProps:J,switchDirectionOnFlip:re,zIndex:A,name:L,dropdownPosition:K,allowDeselect:ne,placeholder:z,filterDataOnExactSearchMatch:oe,form:X,positionDependencies:Z,readOnly:me,clearButtonProps:ve,hoverOnSearchChange:de}=n,ke=Kee(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:we,cx:Re,theme:Qe}=Wee(),[$e,vt]=i.useState(x),[it,ot]=i.useState(-1),Ce=i.useRef(),Me=i.useRef({}),[qe,dt]=i.useState("column"),ye=qe==="column",{scrollIntoView:Ue,targetRef:st,scrollableRef:mt}=gP({duration:0,offset:5,cancelable:!1,isList:!0}),Pe=ne===void 0?M:ne,Ne=Je=>{if($e!==Je){vt(Je);const qt=Je?ae:le;typeof qt=="function"&&qt()}},kt=q&&typeof Y=="function";let Se=null;const Ve=l.map(Je=>typeof Je=="string"?{label:Je,value:Je}:Je),Ge=sP({data:Ve}),[Le,bt,fn]=Pd({value:c,defaultValue:d,finalValue:null,onChange:f}),Bt=Ge.find(Je=>Je.value===Le),[Ht,zn]=Pd({value:T,defaultValue:(Bt==null?void 0:Bt.label)||"",finalValue:void 0,onChange:O}),pn=Je=>{zn(Je),E&&typeof O=="function"&&O(Je)},en=()=>{var Je;me||(bt(null),fn||pn(""),(Je=Ce.current)==null||Je.focus())};i.useEffect(()=>{const Je=Ge.find(qt=>qt.value===Le);Je?pn(Je.label):(!kt||!Le)&&pn("")},[Le]),i.useEffect(()=>{Bt&&(!E||!$e)&&pn(Bt.label)},[Bt==null?void 0:Bt.label]);const un=Je=>{if(!me)if(Pe&&(Bt==null?void 0:Bt.value)===Je.value)bt(null),Ne(!1);else{if(Je.creatable&&typeof se=="function"){const qt=se(Je.value);typeof qt<"u"&&qt!==null&&bt(typeof qt=="string"?qt:qt.value)}else bt(Je.value);fn||pn(Je.label),ot(-1),Ne(!1),Ce.current.focus()}},Wt=Bee({data:Ge,searchable:E,limit:R,searchValue:Ht,filter:_,filterDataOnExactSearchMatch:oe,value:Le});kt&&Q(Ht,Wt)&&(Se=Y(Ht),Wt.push({label:Ht,value:Ht,creatable:!0}));const ar=(Je,qt,Wn)=>{let jt=Je;for(;Wn(jt);)if(jt=qt(jt),!Wt[jt].disabled)return jt;return Je};os(()=>{ot(de&&Ht?0:-1)},[Ht,de]);const vr=Le?Wt.findIndex(Je=>Je.value===Le):0,Bn=!me&&(Wt.length>0?$e:$e&&!!D),Hn=()=>{ot(Je=>{var qt;const Wn=ar(Je,jt=>jt-1,jt=>jt>0);return st.current=Me.current[(qt=Wt[Wn])==null?void 0:qt.value],Bn&&Ue({alignment:ye?"start":"end"}),Wn})},lo=()=>{ot(Je=>{var qt;const Wn=ar(Je,jt=>jt+1,jt=>jt<Wt.length-1);return st.current=Me.current[(qt=Wt[Wn])==null?void 0:qt.value],Bn&&Ue({alignment:ye?"end":"start"}),Wn})},Fo=()=>window.setTimeout(()=>{var Je;st.current=Me.current[(Je=Wt[vr])==null?void 0:Je.value],Ue({alignment:ye?"end":"start"})},50);os(()=>{Bn&&Fo()},[Bn]);const zo=Je=>{switch(typeof h=="function"&&h(Je),Je.key){case"ArrowUp":{Je.preventDefault(),$e?ye?Hn():lo():(ot(vr),Ne(!0),Fo());break}case"ArrowDown":{Je.preventDefault(),$e?ye?lo():Hn():(ot(vr),Ne(!0),Fo());break}case"Home":{if(!E){Je.preventDefault(),$e||Ne(!0);const qt=Wt.findIndex(Wn=>!Wn.disabled);ot(qt),Bn&&Ue({alignment:ye?"end":"start"})}break}case"End":{if(!E){Je.preventDefault(),$e||Ne(!0);const qt=Wt.map(Wn=>!!Wn.disabled).lastIndexOf(!1);ot(qt),Bn&&Ue({alignment:ye?"end":"start"})}break}case"Escape":{Je.preventDefault(),Ne(!1),ot(-1);break}case" ":{E||(Je.preventDefault(),Wt[it]&&$e?un(Wt[it]):(Ne(!0),ot(vr),Fo()));break}case"Enter":E||Je.preventDefault(),Wt[it]&&$e&&(Je.preventDefault(),un(Wt[it]))}},Ia=Je=>{typeof g=="function"&&g(Je);const qt=Ge.find(Wn=>Wn.value===Le);V&&Wt[it]&&$e&&un(Wt[it]),pn((qt==null?void 0:qt.label)||""),Ne(!1)},xi=Je=>{typeof b=="function"&&b(Je),E&&Ne(!0)},Pa=Je=>{me||(pn(Je.currentTarget.value),M&&Je.currentTarget.value===""&&bt(null),ot(-1),Ne(!0))},yi=()=>{me||(Ne(!$e),Le&&!$e&&ot(vr))};return B.createElement(Tc.Wrapper,i1(Hu({},o),{__staticSelector:"Select"}),B.createElement(el,{opened:Bn,transitionProps:y,shadow:s,withinPortal:ce,portalProps:J,__staticSelector:"Select",onDirectionChange:dt,switchDirectionOnFlip:re,zIndex:A,dropdownPosition:K,positionDependencies:[...Z,Ht],classNames:S,styles:j,unstyled:w,variant:r.variant},B.createElement(el.Target,null,B.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":Bn?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":Bn,onMouseLeave:()=>ot(-1),tabIndex:-1},B.createElement("input",{type:"hidden",name:L,value:Le||"",form:X,disabled:N}),B.createElement(Tc,Hu(i1(Hu(Hu({autoComplete:"off",type:"search"},r),ke),{ref:df(t,Ce),onKeyDown:zo,__staticSelector:"Select",value:Ht,placeholder:z,onChange:Pa,"aria-autocomplete":"list","aria-controls":Bn?`${r.id}-items`:null,"aria-activedescendant":it>=0?`${r.id}-${it}`:null,onMouseDown:yi,onBlur:Ia,onFocus:xi,readOnly:!E||me,disabled:N,"data-mantine-stop-propagation":Bn,name:null,classNames:i1(Hu({},S),{input:Re({[we.input]:!E},S==null?void 0:S.input)})}),yM({theme:Qe,rightSection:U,rightSectionWidth:G,styles:j,size:r.size,shouldClear:M&&!!Bt,onClear:en,error:o.error,clearButtonProps:ve,disabled:N,readOnly:me}))))),B.createElement(el.Dropdown,{component:ee||Rg,maxHeight:I,direction:qe,id:r.id,innerRef:mt,__staticSelector:"Select",classNames:S,styles:j},B.createElement(Ay,{data:Wt,hovered:it,classNames:S,styles:j,isItemSelected:Je=>Je===Le,uuid:r.id,__staticSelector:"Select",onItemHover:ot,onItemSelect:un,itemsRefs:Me,itemComponent:m,size:r.size,nothingFound:D,creatable:kt&&!!Se,createLabel:Se,"aria-label":o.label,unstyled:w,variant:r.variant}))))});qy.displayName="@mantine/core/Select";const hf=()=>{const[e,t,n,r,o,s,l,c,d,f,m,h,g,b,y,x,w,S,j,_,I,E,M,D,R,N,O,T,U,G,q,Y,Q,V,se,ee,le,ae,ce,J,re,A,L,K,ne,z,oe,X,Z,me,ve,de,ke,we,Re,Qe,$e,vt,it,ot,Ce,Me,qe,dt,ye,Ue,st,mt,Pe,Ne,kt,Se,Ve,Ge,Le,bt]=Zo("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:l,base400:c,base450:d,base500:f,base550:m,base600:h,base650:g,base700:b,base750:y,base800:x,base850:w,base900:S,base950:j,accent50:_,accent100:I,accent150:E,accent200:M,accent250:D,accent300:R,accent350:N,accent400:O,accent450:T,accent500:U,accent550:G,accent600:q,accent650:Y,accent700:Q,accent750:V,accent800:se,accent850:ee,accent900:le,accent950:ae,baseAlpha50:ce,baseAlpha100:J,baseAlpha150:re,baseAlpha200:A,baseAlpha250:L,baseAlpha300:K,baseAlpha350:ne,baseAlpha400:z,baseAlpha450:oe,baseAlpha500:X,baseAlpha550:Z,baseAlpha600:me,baseAlpha650:ve,baseAlpha700:de,baseAlpha750:ke,baseAlpha800:we,baseAlpha850:Re,baseAlpha900:Qe,baseAlpha950:$e,accentAlpha50:vt,accentAlpha100:it,accentAlpha150:ot,accentAlpha200:Ce,accentAlpha250:Me,accentAlpha300:qe,accentAlpha350:dt,accentAlpha400:ye,accentAlpha450:Ue,accentAlpha500:st,accentAlpha550:mt,accentAlpha600:Pe,accentAlpha650:Ne,accentAlpha700:kt,accentAlpha750:Se,accentAlpha800:Ve,accentAlpha850:Ge,accentAlpha900:Le,accentAlpha950:bt}},Te=(e,t)=>n=>n==="light"?e:t,EM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:l,base700:c,base800:d,base900:f,accent200:m,accent300:h,accent400:g,accent500:b,accent600:y}=hf(),{colorMode:x}=ya(),[w]=Zo("shadows",["dark-lg"]),[S,j,_]=Zo("space",[1,2,6]),[I]=Zo("radii",["base"]),[E]=Zo("lineHeights",["base"]);return i.useCallback(()=>({label:{color:Te(c,r)(x)},separatorLabel:{color:Te(s,s)(x),"::after":{borderTopColor:Te(r,c)(x)}},input:{border:"unset",backgroundColor:Te(e,f)(x),borderRadius:I,borderStyle:"solid",borderWidth:"2px",borderColor:Te(n,d)(x),color:Te(f,t)(x),minHeight:"unset",lineHeight:E,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Te(r,l)(x)},"&:focus":{borderColor:Te(h,y)(x)},"&:is(:focus, :hover)":{borderColor:Te(o,s)(x)},"&:focus-within":{borderColor:Te(m,y)(x)},"&[data-disabled]":{backgroundColor:Te(r,c)(x),color:Te(l,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Te(t,f)(x),color:Te(f,t)(x),button:{color:Te(f,t)(x)},"&:hover":{backgroundColor:Te(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Te(n,d)(x),borderColor:Te(n,d)(x),boxShadow:w},item:{backgroundColor:Te(n,d)(x),color:Te(d,n)(x),padding:6,"&[data-hovered]":{color:Te(f,t)(x),backgroundColor:Te(r,c)(x)},"&[data-active]":{backgroundColor:Te(r,c)(x),"&:hover":{color:Te(f,t)(x),backgroundColor:Te(r,c)(x)}},"&[data-selected]":{backgroundColor:Te(g,y)(x),color:Te(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Te(b,b)(x),color:Te("white",e)(x)}},"&[data-disabled]":{color:Te(s,l)(x),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Te(f,t)(x)}}}),[m,h,g,b,y,t,n,r,o,e,s,l,c,d,f,w,x,E,I,S,j,_])},MM=_e((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:l,disabled:c,...d}=e,f=te(),[m,h]=i.useState(""),g=i.useCallback(w=>{w.shiftKey&&f(zr(!0))},[f]),b=i.useCallback(w=>{w.shiftKey||f(zr(!1))},[f]),y=i.useCallback(w=>{s&&s(w)},[s]),x=EM();return a.jsx(Ut,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Gt,{ref:t,isDisabled:c,position:"static","data-testid":`select-${l||e.placeholder}`,children:[l&&a.jsx(ln,{children:l}),a.jsx(qy,{ref:o,disabled:c,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:b,searchable:n,maxDropdownHeight:300,styles:x,...d})]})})});MM.displayName="IAIMantineSearchableSelect";const sn=i.memo(MM),Yee=fe([pe],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}}),Zee=()=>{const e=te(),[t,n]=i.useState(),{data:r,isFetching:o}=Wd(),{imagesToChange:s,isModalOpen:l}=H(Yee),[c]=BR(),[d]=HR(),{t:f}=W(),m=i.useMemo(()=>{const x=[{label:f("boards.uncategorized"),value:"none"}];return(r??[]).forEach(w=>x.push({label:w.board_name,value:w.board_id})),x},[r,f]),h=i.useCallback(()=>{e(Tw()),e(yx(!1))},[e]),g=i.useCallback(()=>{!s.length||!t||(t==="none"?d({imageDTOs:s}):c({imageDTOs:s,board_id:t}),n(null),e(Tw()))},[c,e,s,d,t]),b=i.useCallback(x=>n(x),[]),y=i.useRef(null);return a.jsx(Zc,{isOpen:l,onClose:h,leastDestructiveRef:y,isCentered:!0,children:a.jsx(Eo,{children:a.jsxs(Jc,{children:[a.jsx(Po,{fontSize:"lg",fontWeight:"bold",children:f("boards.changeBoard")}),a.jsx(Mo,{children:a.jsxs($,{sx:{flexDir:"column",gap:4},children:[a.jsxs(be,{children:[f("boards.movingImagesToBoard",{count:s.length}),":"]}),a.jsx(sn,{placeholder:f(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:b,value:t,data:m})]})}),a.jsxs(ls,{children:[a.jsx(Xe,{ref:y,onClick:h,children:f("boards.cancel")}),a.jsx(Xe,{colorScheme:"accent",onClick:g,ml:3,children:f("boards.move")})]})]})})})},Jee=i.memo(Zee),OM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:l,helperText:c,...d}=e;return a.jsx(Ut,{label:l,hasArrow:!0,placement:"top",isDisabled:!l,children:a.jsx(Gt,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs($,{sx:{flexDir:"column",w:"full"},children:[a.jsxs($,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(ln,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(Iy,{...d})]}),c&&a.jsx(N3,{children:a.jsx(be,{variant:"subtext",children:c})})]})})})};OM.displayName="IAISwitch";const _n=i.memo(OM),ete=e=>{const{t}=W(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Jo(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(be,{children:r}),a.jsxs(cg,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(ts,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(ts,{children:t("common.unifiedCanvas")}),n.isControlImage&&a.jsx(ts,{children:t("common.controlNet")}),n.isNodesImage&&a.jsx(ts,{children:t("common.nodeEditor")})]}),a.jsx(be,{children:o})]})},DM=i.memo(ete),tte=fe([pe,WR],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:l}=r,{imagesToDelete:c,isModalOpen:d}=o,f=(c??[]).map(({image_name:h})=>wI(e,h)),m={isInitialImage:Jo(f,h=>h.isInitialImage),isCanvasImage:Jo(f,h=>h.isCanvasImage),isNodesImage:Jo(f,h=>h.isNodesImage),isControlImage:Jo(f,h=>h.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:l,imagesToDelete:c,imagesUsage:t,isModalOpen:d,imageUsageSummary:m}}),nte=()=>{const e=te(),{t}=W(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:l,imageUsageSummary:c}=H(tte),d=i.useCallback(g=>e(SI(!g.target.checked)),[e]),f=i.useCallback(()=>{e(Nw()),e(VR(!1))},[e]),m=i.useCallback(()=>{!o.length||!s.length||(e(Nw()),e(UR({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=i.useRef(null);return a.jsx(Zc,{isOpen:l,onClose:f,leastDestructiveRef:h,isCentered:!0,children:a.jsx(Eo,{children:a.jsxs(Jc,{children:[a.jsx(Po,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Mo,{children:a.jsxs($,{direction:"column",gap:3,children:[a.jsx(DM,{imageUsage:c}),a.jsx(On,{}),a.jsx(be,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(be,{children:t("common.areYouSure")}),a.jsx(_n,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:d})]})}),a.jsxs(ls,{children:[a.jsx(Xe,{ref:h,onClick:f,children:t("boards.cancel")}),a.jsx(Xe,{colorScheme:"error",onClick:m,ml:3,children:t("controlnet.delete")})]})]})})})},rte=i.memo(nte),RM=_e((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...l}=e;return a.jsx(Ut,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(rs,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...l})})});RM.displayName="IAIIconButton";const Fe=i.memo(RM);var AM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},bj=B.createContext&&B.createContext(AM),tl=globalThis&&globalThis.__assign||function(){return tl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},tl.apply(this,arguments)},ote=globalThis&&globalThis.__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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function TM(e){return e&&e.map(function(t,n){return B.createElement(t.tag,tl({key:n},t.attr),TM(t.child))})}function De(e){return function(t){return B.createElement(ste,tl({attr:tl({},e.attr)},t),TM(e.child))}}function ste(e){var t=function(n){var r=e.attr,o=e.size,s=e.title,l=ote(e,["attr","size","title"]),c=o||n.size||"1em",d;return n.className&&(d=n.className),e.className&&(d=(d?d+" ":"")+e.className),B.createElement("svg",tl({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,l,{className:d,style:tl(tl({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),s&&B.createElement("title",null,s),e.children)};return bj!==void 0?B.createElement(bj.Consumer,null,function(n){return t(n)}):t(AM)}function ate(e){return De({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function lte(e){return De({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function ite(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z"}}]})(e)}function cte(e){return De({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function ute(e){return De({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function dte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function fte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function pte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function NM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function mte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"}}]})(e)}function hte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function $M(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function gte(e){return De({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"}}]})(e)}function vte(e){return De({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"}}]})(e)}function bte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"}}]})(e)}function xte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z"}}]})(e)}function LM(e){return De({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function FM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"}}]})(e)}function ru(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function yte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function Cte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function ou(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function wte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"}}]})(e)}function Ste(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function kte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}}]})(e)}function jte(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}}]})(e)}function _te(e){return De({tag:"svg",attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M176 432c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80zM25.26 25.199l13.6 272C39.499 309.972 50.041 320 62.83 320h66.34c12.789 0 23.331-10.028 23.97-22.801l13.6-272C167.425 11.49 156.496 0 142.77 0H49.23C35.504 0 24.575 11.49 25.26 25.199z"}}]})(e)}function zM(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function Xy(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z"}}]})(e)}function Ite(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function Pte(e){return De({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function Ete(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function Mte(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function Ote(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M437.2 403.5L320 215V64h8c13.3 0 24-10.7 24-24V24c0-13.3-10.7-24-24-24H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h8v151L10.8 403.5C-18.5 450.6 15.3 512 70.9 512h306.2c55.7 0 89.4-61.5 60.1-108.5zM137.9 320l48.2-77.6c3.7-5.2 5.8-11.6 5.8-18.4V64h64v160c0 6.9 2.2 13.2 5.8 18.4l48.2 77.6h-172z"}}]})(e)}function Dte(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"}}]})(e)}function BM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"}}]})(e)}function Rte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 416h-23.41L277.88 53.69A32 32 0 0 0 247.58 32h-47.16a32 32 0 0 0-30.3 21.69L39.41 416H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-19.58l23.3-64h152.56l23.3 64H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM176.85 272L224 142.51 271.15 272z"}}]})(e)}function Ate(e){return De({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M360 0H24C10.745 0 0 10.745 0 24v16c0 13.255 10.745 24 24 24 0 90.965 51.016 167.734 120.842 192C75.016 280.266 24 357.035 24 448c-13.255 0-24 10.745-24 24v16c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24 0-90.965-51.016-167.734-120.842-192C308.984 231.734 360 154.965 360 64c13.255 0 24-10.745 24-24V24c0-13.255-10.745-24-24-24zm-75.078 384H99.08c17.059-46.797 52.096-80 92.92-80 40.821 0 75.862 33.196 92.922 80zm.019-256H99.078C91.988 108.548 88 86.748 88 64h208c0 22.805-3.987 44.587-11.059 64z"}}]})(e)}function si(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function Tte(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z"}}]})(e)}function HM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"}}]})(e)}function Nte(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function $te(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function WM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"}}]})(e)}function VM(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"}}]})(e)}function Lte(e){return De({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"}}]})(e)}function UM(e){return De({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function Fte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function zte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function Bte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function Hte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function nl(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function GM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function Wte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504.971 359.029c9.373 9.373 9.373 24.569 0 33.941l-80 79.984c-15.01 15.01-40.971 4.49-40.971-16.971V416h-58.785a12.004 12.004 0 0 1-8.773-3.812l-70.556-75.596 53.333-57.143L352 336h32v-39.981c0-21.438 25.943-31.998 40.971-16.971l80 79.981zM12 176h84l52.781 56.551 53.333-57.143-70.556-75.596A11.999 11.999 0 0 0 122.785 96H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12zm372 0v39.984c0 21.46 25.961 31.98 40.971 16.971l80-79.984c9.373-9.373 9.373-24.569 0-33.941l-80-79.981C409.943 24.021 384 34.582 384 56.019V96h-58.785a12.004 12.004 0 0 0-8.773 3.812L96 336H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h110.785c3.326 0 6.503-1.381 8.773-3.812L352 176h32z"}}]})(e)}function Vte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function Qy(e){return De({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M168 416c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h88v-64h-88c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h88v-64h-88c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h88v-64h-88c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h88V32c0-17.67-14.33-32-32-32H32C14.33 0 0 14.33 0 32v448c0 17.67 14.33 32 32 32h192c17.67 0 32-14.33 32-32v-64h-88z"}}]})(e)}function gf(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function Ute(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(e)}function KM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function Gte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"}}]})(e)}function xj(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function qM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function Kte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M16 128h416c8.84 0 16-7.16 16-16V48c0-8.84-7.16-16-16-16H16C7.16 32 0 39.16 0 48v64c0 8.84 7.16 16 16 16zm480 80H80c-8.84 0-16 7.16-16 16v64c0 8.84 7.16 16 16 16h416c8.84 0 16-7.16 16-16v-64c0-8.84-7.16-16-16-16zm-64 176H16c-8.84 0-16 7.16-16 16v64c0 8.84 7.16 16 16 16h416c8.84 0 16-7.16 16-16v-64c0-8.84-7.16-16-16-16z"}}]})(e)}function qte(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z"}}]})(e)}function XM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"}}]})(e)}function Nc(e){return De({tag:"svg",attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"}}]})(e)}function ao(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function Ng(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function $g(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Xte(e){return De({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"}}]})(e)}function QM(e){return De({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}const Mt=e=>{const t=H(l=>l.config.disabledTabs),n=H(l=>l.config.disabledFeatures),r=H(l=>l.config.disabledSDFeatures),o=i.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=i.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function Qte(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(sl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(sl,{children:[a.jsx(be,{fontWeight:600,children:t}),r&&a.jsx(be,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Ie,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function Yte({children:e}){const{isOpen:t,onOpen:n,onClose:r}=sr(),{t:o}=W(),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"}],l=[{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"}],f=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],m=h=>a.jsx($,{flexDir:"column",gap:4,children:h.map((g,b)=>a.jsxs($,{flexDir:"column",px:2,gap:4,children:[a.jsx(Qte,{title:g.title,description:g.desc,hotkey:g.hotkey}),b<h.length-1&&a.jsx(On,{})]},b))});return a.jsxs(a.Fragment,{children:[i.cloneElement(e,{onClick:n}),a.jsxs(ni,{isOpen:t,onClose:r,children:[a.jsx(Eo,{}),a.jsxs(ri,{children:[a.jsx(Po,{children:o("hotkeys.keyboardShortcuts")}),a.jsx(af,{}),a.jsx(Mo,{children:a.jsx(A3,{allowMultiple:!0,children:a.jsxs($,{flexDir:"column",gap:2,children:[a.jsxs(Qi,{children:[a.jsx(qi,{children:a.jsxs($,{width:"100%",justifyContent:"space-between",alignItems:"center",children:[a.jsx("h2",{children:o("hotkeys.appHotkeys")}),a.jsx(Xi,{})]})}),a.jsx(Yi,{children:m(s)})]}),a.jsxs(Qi,{children:[a.jsx(qi,{children:a.jsxs($,{width:"100%",justifyContent:"space-between",alignItems:"center",children:[a.jsx("h2",{children:o("hotkeys.generalHotkeys")}),a.jsx(Xi,{})]})}),a.jsx(Yi,{children:m(l)})]}),a.jsxs(Qi,{children:[a.jsx(qi,{children:a.jsxs($,{width:"100%",justifyContent:"space-between",alignItems:"center",children:[a.jsx("h2",{children:o("hotkeys.galleryHotkeys")}),a.jsx(Xi,{})]})}),a.jsx(Yi,{children:m(c)})]}),a.jsxs(Qi,{children:[a.jsx(qi,{children:a.jsxs($,{width:"100%",justifyContent:"space-between",alignItems:"center",children:[a.jsx("h2",{children:o("hotkeys.unifiedCanvasHotkeys")}),a.jsx(Xi,{})]})}),a.jsx(Yi,{children:m(d)})]}),a.jsxs(Qi,{children:[a.jsx(qi,{children:a.jsxs($,{width:"100%",justifyContent:"space-between",alignItems:"center",children:[a.jsx("h2",{children:o("hotkeys.nodesHotkeys")}),a.jsx(Xi,{})]})}),a.jsx(Yi,{children:m(f)})]})]})})}),a.jsx(ls,{})]})]})]})}function yj(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function Cj(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var Zte=function(e,t){return typeof t=="boolean"?t:!e},Jte=function(e){return i.useReducer(Zte,e)};const ene=Jte;function tne(e,t){t===void 0&&(t=0);var n=i.useRef(!1),r=i.useRef(),o=i.useRef(e),s=i.useCallback(function(){return n.current},[]),l=i.useCallback(function(){n.current=!1,r.current&&clearTimeout(r.current),r.current=setTimeout(function(){n.current=!0,o.current()},t)},[t]),c=i.useCallback(function(){n.current=null,r.current&&clearTimeout(r.current)},[]);return i.useEffect(function(){o.current=e},[e]),i.useEffect(function(){return l(),c},[t]),[s,c,l]}function nne(e,t,n){t===void 0&&(t=0),n===void 0&&(n=[]);var r=tne(e,t),o=r[0],s=r[1],l=r[2];return i.useEffect(l,n),[o,s]}var rne=function(e,t){t===void 0&&(t=!0);var n=i.useState(!1),r=n[0],o=n[1];return i.useEffect(function(){var s=function(){return o(!0)},l=function(){return o(!1)};t&&e&&e.current&&(yj(e.current,"mouseover",s),yj(e.current,"mouseout",l));var c=e.current;return function(){t&&c&&(Cj(c,"mouseover",s),Cj(c,"mouseout",l))}},[t,e]),r};const YM=rne,one=({showVersion:e=!0})=>{const{data:t}=GR(),n=i.useRef(null),r=YM(n);return a.jsxs($,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(Ca,{src:Cx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs($,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(be,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(hr,{children:e&&r&&t&&a.jsx(Mn.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(be,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},sne=i.memo(one),ZM=_e((e,t)=>{const{tooltip:n,formControlProps:r,inputRef:o,label:s,disabled:l,required:c,...d}=e,f=EM();return a.jsx(Ut,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Gt,{ref:t,isRequired:c,isDisabled:l,position:"static","data-testid":`select-${s||e.placeholder}`,...r,children:[a.jsx(ln,{children:s}),a.jsx(qy,{disabled:l,ref:o,styles:f,...d})]})})});ZM.displayName="IAIMantineSelect";const yn=i.memo(ZM),JM=()=>i.useCallback(()=>{KR(qR),localStorage.clear()},[]),e8=fe(pe,({system:e})=>e.language),ane={ar:wt.t("common.langArabic",{lng:"ar"}),nl:wt.t("common.langDutch",{lng:"nl"}),en:wt.t("common.langEnglish",{lng:"en"}),fr:wt.t("common.langFrench",{lng:"fr"}),de:wt.t("common.langGerman",{lng:"de"}),he:wt.t("common.langHebrew",{lng:"he"}),it:wt.t("common.langItalian",{lng:"it"}),ja:wt.t("common.langJapanese",{lng:"ja"}),ko:wt.t("common.langKorean",{lng:"ko"}),pl:wt.t("common.langPolish",{lng:"pl"}),pt_BR:wt.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:wt.t("common.langPortuguese",{lng:"pt"}),ru:wt.t("common.langRussian",{lng:"ru"}),zh_CN:wt.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:wt.t("common.langSpanish",{lng:"es"}),uk:wt.t("common.langUkranian",{lng:"ua"})},lne={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"};function qo(e){const{t}=W(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:l,...c}=e;return a.jsxs($,{justifyContent:"space-between",py:1,children:[a.jsxs($,{gap:2,alignItems:"center",children:[a.jsx(be,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Sa,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...l,children:s})]}),a.jsx(_n,{...c})]})}const ine=e=>a.jsx($,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Ji=i.memo(ine);function cne(){const{t:e}=W(),t=te(),{data:n}=XR(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=QR(),{data:s}=Ls(),l=s&&(s.queue.in_progress>0||s.queue.pending>0),c=i.useCallback(()=>{l||r().unwrap().then(d=>{t(kI()),t(jI()),t(lt({title:e("settings.intermediatesCleared",{count:d}),status:"info"}))}).catch(()=>{t(lt({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,l]);return a.jsxs(Ji,{children:[a.jsx(or,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Xe,{tooltip:l?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:c,isLoading:o,isDisabled:!n||l,children:e("settings.clearIntermediatesWithCount",{count:n??0})}),a.jsx(be,{fontWeight:"bold",children:e("settings.clearIntermediatesDesc1")}),a.jsx(be,{variant:"subtext",children:e("settings.clearIntermediatesDesc2")}),a.jsx(be,{variant:"subtext",children:e("settings.clearIntermediatesDesc3")})]})}const une=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:l,base700:c,base800:d,base900:f,accent200:m,accent300:h,accent400:g,accent500:b,accent600:y}=hf(),{colorMode:x}=ya(),[w]=Zo("shadows",["dark-lg"]);return i.useCallback(()=>({label:{color:Te(c,r)(x)},separatorLabel:{color:Te(s,s)(x),"::after":{borderTopColor:Te(r,c)(x)}},searchInput:{":placeholder":{color:Te(r,c)(x)}},input:{backgroundColor:Te(e,f)(x),borderWidth:"2px",borderColor:Te(n,d)(x),color:Te(f,t)(x),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Te(r,l)(x)},"&:focus":{borderColor:Te(h,y)(x)},"&:is(:focus, :hover)":{borderColor:Te(o,s)(x)},"&:focus-within":{borderColor:Te(m,y)(x)},"&[data-disabled]":{backgroundColor:Te(r,c)(x),color:Te(l,o)(x),cursor:"not-allowed"}},value:{backgroundColor:Te(n,d)(x),color:Te(f,t)(x),button:{color:Te(f,t)(x)},"&:hover":{backgroundColor:Te(r,c)(x),cursor:"pointer"}},dropdown:{backgroundColor:Te(n,d)(x),borderColor:Te(n,d)(x),boxShadow:w},item:{backgroundColor:Te(n,d)(x),color:Te(d,n)(x),padding:6,"&[data-hovered]":{color:Te(f,t)(x),backgroundColor:Te(r,c)(x)},"&[data-active]":{backgroundColor:Te(r,c)(x),"&:hover":{color:Te(f,t)(x),backgroundColor:Te(r,c)(x)}},"&[data-selected]":{backgroundColor:Te(g,y)(x),color:Te(e,t)(x),fontWeight:600,"&:hover":{backgroundColor:Te(b,b)(x),color:Te("white",e)(x)}},"&[data-disabled]":{color:Te(s,l)(x),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Te(f,t)(x)}}}),[m,h,g,b,y,t,n,r,o,e,s,l,c,d,f,w,x])},t8=_e((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:l,...c}=e,d=te(),f=i.useCallback(g=>{g.shiftKey&&d(zr(!0))},[d]),m=i.useCallback(g=>{g.shiftKey||d(zr(!1))},[d]),h=une();return a.jsx(Ut,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Gt,{ref:t,isDisabled:l,position:"static",children:[s&&a.jsx(ln,{children:s}),a.jsx(SM,{ref:o,disabled:l,onKeyDown:f,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...c})]})})});t8.displayName="IAIMantineMultiSelect";const dne=i.memo(t8),fne=Hr(Gh,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function pne(){const e=te(),{t}=W(),n=H(o=>o.ui.favoriteSchedulers),r=i.useCallback(o=>{e(YR(o))},[e]);return a.jsx(dne,{label:t("settings.favoriteSchedulers"),value:n,data:fne,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const mne=fe([pe],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:l,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldEnableInformationalPopovers:f}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:l,shouldUseNSFWChecker:c,shouldUseWatermarker:d,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:f}}),hne=({children:e,config:t})=>{const n=te(),{t:r}=W(),[o,s]=i.useState(3),l=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,c=(t==null?void 0:t.shouldShowResetWebUiText)??!0,d=(t==null?void 0:t.shouldShowClearIntermediates)??!0,f=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;i.useEffect(()=>{l||n($w(!1))},[l,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=_I(void 0,{selectFromResult:({data:X})=>({isNSFWCheckerAvailable:(X==null?void 0:X.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(X==null?void 0:X.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:b,onClose:y}=sr(),{isOpen:x,onOpen:w,onClose:S}=sr(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:I,shouldShowProgressInViewer:E,consoleLogLevel:M,shouldLogToConsole:D,shouldAntialiasProgressImage:R,shouldUseNSFWChecker:N,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:U}=H(mne),G=JM(),q=i.useCallback(()=>{G(),y(),w(),setInterval(()=>s(X=>X-1),1e3)},[G,y,w]);i.useEffect(()=>{o<=0&&window.location.reload()},[o]);const Y=i.useCallback(X=>{n(ZR(X))},[n]),Q=i.useCallback(X=>{n(JR(X))},[n]),V=i.useCallback(X=>{n($w(X.target.checked))},[n]),{colorMode:se,toggleColorMode:ee}=ya(),le=Mt("localization").isFeatureEnabled,ae=H(e8),ce=i.useCallback(X=>{n(SI(X.target.checked))},[n]),J=i.useCallback(X=>{n(eA(X.target.checked))},[n]),re=i.useCallback(X=>{n(tA(X.target.checked))},[n]),A=i.useCallback(X=>{n(nA(X.target.checked))},[n]),L=i.useCallback(X=>{n(II(X.target.checked))},[n]),K=i.useCallback(X=>{n(rA(X.target.checked))},[n]),ne=i.useCallback(X=>{n(oA(X.target.checked))},[n]),z=i.useCallback(X=>{n(sA(X.target.checked))},[n]),oe=i.useCallback(X=>{n(aA(X.target.checked))},[n]);return a.jsxs(a.Fragment,{children:[i.cloneElement(e,{onClick:b}),a.jsxs(ni,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Eo,{}),a.jsxs(ri,{children:[a.jsx(Po,{bg:"none",children:r("common.settingsLabel")}),a.jsx(af,{}),a.jsx(Mo,{children:a.jsxs($,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Ji,{children:[a.jsx(or,{size:"sm",children:r("settings.general")}),a.jsx(qo,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:ce})]}),a.jsxs(Ji,{children:[a.jsx(or,{size:"sm",children:r("settings.generation")}),a.jsx(pne,{}),a.jsx(qo,{label:r("settings.enableNSFWChecker"),isDisabled:!m,isChecked:N,onChange:J}),a.jsx(qo,{label:r("settings.enableInvisibleWatermark"),isDisabled:!h,isChecked:O,onChange:re})]}),a.jsxs(Ji,{children:[a.jsx(or,{size:"sm",children:r("settings.ui")}),a.jsx(qo,{label:r("common.darkMode"),isChecked:se==="dark",onChange:ee}),a.jsx(qo,{label:r("settings.useSlidersForAll"),isChecked:I,onChange:A}),a.jsx(qo,{label:r("settings.showProgressInViewer"),isChecked:E,onChange:L}),a.jsx(qo,{label:r("settings.antialiasProgressImages"),isChecked:R,onChange:K}),a.jsx(qo,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:ne}),f&&a.jsx(yn,{disabled:!le,label:r("common.languagePickerLabel"),value:ae,data:Object.entries(ane).map(([X,Z])=>({value:X,label:Z})),onChange:Q}),a.jsx(qo,{label:r("settings.enableInformationalPopovers"),isChecked:U,onChange:z})]}),l&&a.jsxs(Ji,{children:[a.jsx(or,{size:"sm",children:r("settings.developer")}),a.jsx(qo,{label:r("settings.shouldLogToConsole"),isChecked:D,onChange:V}),a.jsx(yn,{disabled:!D,label:r("settings.consoleLogLevel"),onChange:Y,value:M,data:lA.concat()}),a.jsx(qo,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:oe})]}),d&&a.jsx(cne,{}),a.jsxs(Ji,{children:[a.jsx(or,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Xe,{colorScheme:"error",onClick:q,children:r("settings.resetWebUI")}),c&&a.jsxs(a.Fragment,{children:[a.jsx(be,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(be,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(ls,{children:a.jsx(Xe,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(ni,{closeOnOverlayClick:!1,isOpen:x,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Eo,{backdropFilter:"blur(40px)"}),a.jsxs(ri,{children:[a.jsx(Po,{}),a.jsx(Mo,{children:a.jsx($,{justifyContent:"center",children:a.jsx(be,{fontSize:"lg",children:a.jsxs(be,{children:[r("settings.resetComplete")," ",r("settings.reloadingIn")," ",o,"..."]})})})}),a.jsx(ls,{})]})]})]})},gne=i.memo(hne),vne=fe(pe,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:lne[n]}}),wj={ok:"green.400",working:"yellow.400",error:"red.400"},Sj={ok:"green.600",working:"yellow.500",error:"red.500"},bne=()=>{const{isConnected:e,statusTranslationKey:t}=H(vne),{t:n}=W(),r=i.useRef(null),{data:o}=Ls(),s=i.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),l=YM(r);return a.jsxs($,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(hr,{children:l&&a.jsx(Mn.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(be,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Sj[s],_dark:{color:wj[s]}},children:n(t)})},"statusText")}),a.jsx(An,{as:bte,sx:{boxSize:"0.5rem",color:Sj[s],_dark:{color:wj[s]}}})]})},xne=i.memo(bne),Yy=e=>{const t=H(n=>n.ui.globalMenuCloseTrigger);i.useEffect(()=>{e()},[t,e])},yne=()=>{const{t:e}=W(),{isOpen:t,onOpen:n,onClose:r}=sr();Yy(r);const o=Mt("bugLink").isFeatureEnabled,s=Mt("discordLink").isFeatureEnabled,l=Mt("githubLink").isFeatureEnabled,c="http://github.com/invoke-ai/InvokeAI",d="https://discord.gg/ZmtBAhwWhy";return a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(sne,{}),a.jsx(Wr,{}),a.jsx(xne,{}),a.jsxs(of,{isOpen:t,onOpen:n,onClose:r,children:[a.jsx(sf,{as:Fe,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(mte,{}),sx:{boxSize:8}}),a.jsxs(al,{motionProps:Yl,children:[a.jsxs(_d,{title:e("common.communityLabel"),children:[l&&a.jsx(At,{as:"a",href:c,target:"_blank",icon:a.jsx(lte,{}),children:e("common.githubLabel")}),o&&a.jsx(At,{as:"a",href:`${c}/issues`,target:"_blank",icon:a.jsx(hte,{}),children:e("common.reportBugLabel")}),s&&a.jsx(At,{as:"a",href:d,target:"_blank",icon:a.jsx(ate,{}),children:e("common.discordLabel")})]}),a.jsxs(_d,{title:e("common.settingsLabel"),children:[a.jsx(Yte,{children:a.jsx(At,{as:"button",icon:a.jsx(Nte,{}),children:e("common.hotkeysLabel")})}),a.jsx(gne,{children:a.jsx(At,{as:"button",icon:a.jsx(FM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Cne=i.memo(yne),wne=e=>{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=W(),o=H(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:l}=iA((t==null?void 0:t.board_id)??Br),c=i.useMemo(()=>fe([pe],j=>{const _=(s??[]).map(E=>wI(j,E));return{imageUsageSummary:{isInitialImage:Jo(_,E=>E.isInitialImage),isCanvasImage:Jo(_,E=>E.isCanvasImage),isNodesImage:Jo(_,E=>E.isNodesImage),isControlImage:Jo(_,E=>E.isControlImage)}}}),[s]),[d,{isLoading:f}]=cA(),[m,{isLoading:h}]=uA(),{imageUsageSummary:g}=H(c),b=i.useCallback(()=>{t&&(d(t.board_id),n(void 0))},[t,d,n]),y=i.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),x=i.useCallback(()=>{n(void 0)},[n]),w=i.useRef(null),S=i.useMemo(()=>h||f||l,[h,f,l]);return t?a.jsx(Zc,{isOpen:!!t,onClose:x,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Eo,{children:a.jsxs(Jc,{children:[a.jsxs(Po,{fontSize:"lg",fontWeight:"bold",children:[r("controlnet.delete")," ",t.board_name]}),a.jsx(Mo,{children:a.jsxs($,{direction:"column",gap:3,children:[l?a.jsx(wg,{children:a.jsx($,{sx:{w:"full",h:32}})}):a.jsx(DM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(be,{children:r("boards.deletedBoardsCannotbeRestored")}),a.jsx(be,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(ls,{children:a.jsxs($,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Xe,{ref:w,onClick:x,children:r("boards.cancel")}),a.jsx(Xe,{colorScheme:"warning",isLoading:S,onClick:b,children:r("boards.deleteBoardOnly")}),a.jsx(Xe,{colorScheme:"error",isLoading:S,onClick:y,children:r("boards.deleteBoardAndImages")})]})})]})})}):null},Sne=i.memo(wne);/*!
* OverlayScrollbars
* Version: 2.4.5
*
* Copyright (c) Rene Haas | KingSora.
* https://github.com/KingSora
*
* Released under the MIT license.
*/const Qo=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,l;const c=(m,h)=>{const g=s,b=m,y=h||(r?!r(g,b):g!==b);return(y||o)&&(s=b,l=g),[s,y,l]};return[t?m=>c(t(s,l),m):c,m=>[s,!!m,l]]},Zy=typeof window<"u",n8=Zy&&Node.ELEMENT_NODE,{toString:kne,hasOwnProperty:c1}=Object.prototype,jne=/^\[object (.+)\]$/,bl=e=>e===void 0,Lg=e=>e===null,_ne=e=>bl(e)||Lg(e)?`${e}`:kne.call(e).replace(jne,"$1").toLowerCase(),Ps=e=>typeof e=="number",vf=e=>typeof e=="string",r8=e=>typeof e=="boolean",Os=e=>typeof e=="function",Do=e=>Array.isArray(e),Md=e=>typeof e=="object"&&!Do(e)&&!Lg(e),Fg=e=>{const t=!!e&&e.length,n=Ps(t)&&t>-1&&t%1==0;return Do(e)||!Os(e)&&n?t>0&&Md(e)?t-1 in e:!0:!1},jh=e=>{if(!e||!Md(e)||_ne(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=c1.call(e,n),l=o&&c1.call(o,"isPrototypeOf");if(r&&!s&&!l)return!1;for(t in e);return bl(t)||c1.call(e,t)},id=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===n8:!1},zg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===n8:!1};function Qt(e,t){if(Fg(e))for(let n=0;n<e.length&&t(e[n],n,e)!==!1;n++);else e&&Qt(Object.keys(e),n=>t(e[n],n,e));return e}const Bg=(e,t)=>e.indexOf(t)>=0,Xa=(e,t)=>e.concat(t),Xt=(e,t,n)=>(!n&&!vf(t)&&Fg(t)?Array.prototype.push.apply(e,t):e.push(t),e),su=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Xt(n,r)}):Qt(e,r=>{Xt(n,r)}),n)},_h=e=>!!e&&!e.length,kj=e=>su(new Set(e)),Ro=(e,t,n)=>{Qt(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},Hg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),fa=e=>e?Object.keys(e):[],Vt=(e,t,n,r,o,s,l)=>{const c=[t,n,r,o,s,l];return(typeof e!="object"||Lg(e))&&!Os(e)&&(e={}),Qt(c,d=>{Qt(d,(f,m)=>{const h=d[m];if(e===h)return!0;const g=Do(h);if(h&&jh(h)){const b=e[m];let y=b;g&&!Do(b)?y=[]:!g&&!jh(b)&&(y={}),e[m]=Vt(y,h)}else e[m]=g?h.slice():h})}),e},o8=(e,t)=>Qt(Vt({},e),(n,r,o)=>{n===void 0?delete o[r]:t&&n&&jh(n)&&(o[r]=o8(n,t))}),Jy=e=>{for(const t in e)return!1;return!0},Cr=(e,t,n)=>{if(bl(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},s8=(e,t)=>new Set((Cr(e,t)||"").split(" ")),Ar=(e,t)=>{e&&e.removeAttribute(t)},ql=(e,t,n,r)=>{if(n){const o=s8(e,t);o[r?"add":"delete"](n);const s=su(o).join(" ").trim();Cr(e,t,s)}},Ine=(e,t,n)=>s8(e,t).has(n),Nb=Zy&&Element.prototype,a8=(e,t)=>{const n=[],r=t?zg(t)&&t:document;return r?Xt(n,r.querySelectorAll(e)):n},Pne=(e,t)=>{const n=t?zg(t)&&t:document;return n?n.querySelector(e):null},Ih=(e,t)=>zg(e)?(Nb.matches||Nb.msMatchesSelector).call(e,t):!1,$b=e=>e?su(e.childNodes):[],sa=e=>e&&e.parentElement,ac=(e,t)=>{if(zg(e)){const n=Nb.closest;if(n)return n.call(e,t);do{if(Ih(e,t))return e;e=sa(e)}while(e)}},Ene=(e,t,n)=>{const r=ac(e,t),o=e&&Pne(n,r),s=ac(o,t)===r;return r&&o?r===e||o===e||s&&ac(ac(e,n),t)!==r:!1},ko=()=>{},aa=e=>{if(Fg(e))Qt(su(e),t=>aa(t));else if(e){const t=sa(e);t&&t.removeChild(e)}},e2=(e,t,n)=>{if(n&&e){let r=t,o;return Fg(n)?(o=document.createDocumentFragment(),Qt(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),()=>aa(n)}return ko},xo=(e,t)=>e2(e,null,t),Mne=(e,t)=>e2(sa(e),e,t),jj=(e,t)=>e2(sa(e),e&&e.nextSibling,t),Xl=e=>{const t=document.createElement("div");return Cr(t,"class",e),t},l8=e=>{const t=Xl();return t.innerHTML=e.trim(),Qt($b(t),n=>aa(n))},Ur=Zy?window:{},cd=Math.max,One=Math.min,Od=Math.round,i8=Ur.cancelAnimationFrame,c8=Ur.requestAnimationFrame,Ph=Ur.setTimeout,Lb=Ur.clearTimeout,Fb=e=>e.charAt(0).toUpperCase()+e.slice(1),Dne=()=>Xl().style,Rne=["-webkit-","-moz-","-o-","-ms-"],Ane=["WebKit","Moz","O","MS","webkit","moz","o","ms"],u1={},d1={},Tne=e=>{let t=d1[e];if(Hg(d1,e))return t;const n=Fb(e),r=Dne();return Qt(Rne,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Fb(s)+n].find(c=>r[c]!==void 0))}),d1[e]=t||""},Wg=e=>{let t=u1[e]||Ur[e];return Hg(u1,e)||(Qt(Ane,n=>(t=t||Ur[n+Fb(e)],!t)),u1[e]=t),t},Nne=Wg("MutationObserver"),_j=Wg("IntersectionObserver"),Eh=Wg("ResizeObserver"),zb=Wg("ScrollTimeline"),ft=(e,...t)=>e.bind(0,...t),Va=e=>{let t;const n=e?Ph:c8,r=e?Lb:i8;return[o=>{r(t),t=n(o,Os(e)?e():e)},()=>r(t)]},u8=(e,t)=>{let n,r,o,s=ko;const{v:l,p:c,g:d}=t||{},f=function(y){s(),Lb(n),n=r=void 0,s=ko,e.apply(this,y)},m=b=>d&&r?d(r,b):b,h=()=>{s!==ko&&f(m(o)||o)},g=function(){const y=su(arguments),x=Os(l)?l():l;if(Ps(x)&&x>=0){const S=Os(c)?c():c,j=Ps(S)&&S>=0,_=x>0?Ph:c8,I=x>0?Lb:i8,M=m(y)||y,D=f.bind(0,M);s();const R=_(D,x);s=()=>I(R),j&&!n&&(n=Ph(h,S)),r=o=M}else f(y)};return g.m=h,g},$ne=/[^\x20\t\r\n\f]+/g,d8=(e,t,n)=>{const r=e&&e.classList;let o,s=0,l=!1;if(r&&t&&vf(t)){const c=t.match($ne)||[];for(l=c.length>0;o=c[s++];)l=!!n(r,o)&&l}return l},t2=(e,t)=>{d8(e,t,(n,r)=>n.remove(r))},cl=(e,t)=>(d8(e,t,(n,r)=>n.add(r)),ft(t2,e,t)),Lne={opacity:1,zIndex:1},Gp=(e,t)=>{const n=e||"",r=t?parseFloat(n):parseInt(n,10);return r===r?r:0},Fne=(e,t)=>!Lne[e]&&Ps(t)?`${t}px`:t,Ij=(e,t,n)=>String((t!=null?t[n]||t.getPropertyValue(n):e.style[n])||""),zne=(e,t,n)=>{try{const{style:r}=e;bl(r[t])?r.setProperty(t,n):r[t]=Fne(t,n)}catch{}},f8=e=>{const t=e||0;return isFinite(t)?t:0};function pr(e,t){const n=vf(t);if(Do(t)||n){let o=n?"":{};if(e){const s=Ur.getComputedStyle(e,null);o=n?Ij(e,s,t):t.reduce((l,c)=>(l[c]=Ij(e,s,c),l),o)}return o}e&&Qt(t,(o,s)=>zne(e,s,t[s]))}const Dd=e=>pr(e,"direction")==="rtl",Pj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,l=`${r}right${o}`,c=`${r}bottom${o}`,d=`${r}left${o}`,f=pr(e,[s,l,c,d]);return{t:Gp(f[s],!0),r:Gp(f[l],!0),b:Gp(f[c],!0),l:Gp(f[d],!0)}},Gi=(e,t)=>`translate${Md(e)?`(${e.x},${e.y})`:`${t?"X":"Y"}(${e})`}`,Kp=e=>`${(f8(e)*100).toFixed(3)}%`,qp=e=>`${f8(e)}px`,p8="paddingTop",n2="paddingRight",r2="paddingLeft",Mh="paddingBottom",Oh="marginLeft",Dh="marginRight",ud="marginBottom",Yu="overflowX",Zu="overflowY",pa="width",ma="height",$c="hidden",Bne={w:0,h:0},Vg=(e,t)=>t?{w:t[`${e}Width`],h:t[`${e}Height`]}:Bne,Hne=e=>Vg("inner",e||Ur),dd=ft(Vg,"offset"),hm=ft(Vg,"client"),Rh=ft(Vg,"scroll"),Ah=e=>{const t=parseFloat(pr(e,pa))||0,n=parseFloat(pr(e,ma))||0;return{w:t-Od(t),h:n-Od(n)}},ks=e=>e.getBoundingClientRect(),Bb=e=>!!(e&&(e[ma]||e[pa])),m8=(e,t)=>{const n=Bb(e);return!Bb(t)&&n},Ug=(e,t,n,r)=>{if(e&&t){let o=!0;return Qt(n,s=>{const l=r?r(e[s]):e[s],c=r?r(t[s]):t[s];l!==c&&(o=!1)}),o}return!1},h8=(e,t)=>Ug(e,t,["w","h"]),g8=(e,t)=>Ug(e,t,["x","y"]),Wne=(e,t)=>Ug(e,t,["t","r","b","l"]),Ej=(e,t,n)=>Ug(e,t,[pa,ma],n&&(r=>Od(r)));let Xp;const Mj="passive",Vne=()=>{if(bl(Xp)){Xp=!1;try{Ur.addEventListener(Mj,ko,Object.defineProperty({},Mj,{get(){Xp=!0}}))}catch{}}return Xp},v8=e=>e.split(" "),Oj=(e,t,n,r)=>{Qt(v8(t),o=>{e.removeEventListener(o,n,r)})},Pn=(e,t,n,r)=>{var o;const s=Vne(),l=(o=s&&r&&r.S)!=null?o:s,c=r&&r.$||!1,d=r&&r.O||!1,f=s?{passive:l,capture:c}:c;return ft(Ro,v8(t).map(m=>{const h=d?g=>{Oj(e,m,h,c),n(g)}:n;return e.addEventListener(m,h,f),ft(Oj,e,m,h,c)}))},b8=e=>e.stopPropagation(),Dj=e=>e.preventDefault(),Une={x:0,y:0},f1=e=>{const t=e&&ks(e);return t?{x:t.left+Ur.pageYOffset,y:t.top+Ur.pageXOffset}:Une},x8=(e,t,n)=>n?n.n?-e:n.i?t-e:e:e,Gne=(e,t)=>[t&&t.i?e:0,x8(e,e,t)],ul=(e,t)=>{const{x:n,y:r}=Ps(t)?{x:t,y:t}:t||{};Ps(n)&&(e.scrollLeft=n),Ps(r)&&(e.scrollTop=r)},Lc=e=>({x:e.scrollLeft,y:e.scrollTop}),Rj=(e,t)=>{Qt(Do(t)?t:[t],e)},Hb=e=>{const t=new Map,n=(s,l)=>{if(s){const c=t.get(s);Rj(d=>{c&&c[d?"delete":"clear"](d)},l)}else t.forEach(c=>{c.clear()}),t.clear()},r=(s,l)=>{if(vf(s)){const f=t.get(s)||new Set;return t.set(s,f),Rj(m=>{Os(m)&&f.add(m)},l),ft(n,s,l)}r8(l)&&l&&n();const c=fa(s),d=[];return Qt(c,f=>{const m=s[f];m&&Xt(d,r(f,m))}),ft(Ro,d)},o=(s,l)=>{Qt(su(t.get(s)),c=>{l&&!_h(l)?c.apply(0,l):c()})};return r(e||{}),[r,n,o]},Aj=e=>JSON.stringify(e,(t,n)=>{if(Os(n))throw 0;return n}),Tj=(e,t)=>e?`${t}`.split(".").reduce((n,r)=>n&&Hg(n,r)?n[r]:void 0,e):void 0,Kne={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"]}},y8=(e,t)=>{const n={},r=Xa(fa(t),fa(e));return Qt(r,o=>{const s=e[o],l=t[o];if(Md(s)&&Md(l))Vt(n[o]={},y8(s,l)),Jy(n[o])&&delete n[o];else if(Hg(t,o)&&l!==s){let c=!0;if(Do(s)||Do(l))try{Aj(s)===Aj(l)&&(c=!1)}catch{}c&&(n[o]=l)}}),n},qne=(e,t,n)=>r=>[Tj(e,r),n||Tj(t,r)!==void 0],bf="data-overlayscrollbars",C8="os-environment",w8=`${C8}-flexbox-glue`,Xne=`${w8}-max`,S8="os-scrollbar-hidden",p1=`${bf}-initialize`,Yo=bf,k8=`${Yo}-overflow-x`,j8=`${Yo}-overflow-y`,Cc="overflowVisible",Qne="scrollbarHidden",Nj="scrollbarPressed",Th="updating",Ua=`${bf}-viewport`,m1="arrange",_8="scrollbarHidden",wc=Cc,Wb=`${bf}-padding`,Yne=wc,$j=`${bf}-content`,o2="os-size-observer",Zne=`${o2}-appear`,Jne=`${o2}-listener`,ere="os-trinsic-observer",tre="os-no-css-vars",nre="os-theme-none",Kr="os-scrollbar",rre=`${Kr}-rtl`,ore=`${Kr}-horizontal`,sre=`${Kr}-vertical`,I8=`${Kr}-track`,s2=`${Kr}-handle`,are=`${Kr}-visible`,lre=`${Kr}-cornerless`,Lj=`${Kr}-transitionless`,Fj=`${Kr}-interaction`,zj=`${Kr}-unusable`,Vb=`${Kr}-auto-hide`,Bj=`${Vb}-hidden`,Hj=`${Kr}-wheel`,ire=`${I8}-interactive`,cre=`${s2}-interactive`,P8={},E8={},ure=e=>{Qt(e,t=>Qt(t,(n,r)=>{P8[r]=t[r]}))},M8=(e,t,n)=>fa(e).map(r=>{const{static:o,instance:s}=e[r],[l,c,d]=n||[],f=n?s:o;if(f){const m=n?f(l,c,t):f(t);return(d||E8)[r]=m}}),au=e=>E8[e],dre="__osOptionsValidationPlugin",fre="__osSizeObserverPlugin",a2="__osScrollbarsHidingPlugin",pre="__osClickScrollPlugin";let h1;const Wj=(e,t,n,r)=>{xo(e,t);const o=hm(t),s=dd(t),l=Ah(n);return r&&aa(t),{x:s.h-o.h+l.h,y:s.w-o.w+l.w}},mre=e=>{let t=!1;const n=cl(e,S8);try{t=pr(e,Tne("scrollbar-width"))==="none"||Ur.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},hre=(e,t)=>{pr(e,{[Yu]:$c,[Zu]:$c,direction:"rtl"}),ul(e,{x:0});const n=f1(e),r=f1(t);ul(e,{x:-999});const o=f1(t);return{i:n.x===r.x,n:r.x!==o.x}},gre=(e,t)=>{const n=cl(e,w8),r=ks(e),o=ks(t),s=Ej(o,r,!0),l=cl(e,Xne),c=ks(e),d=ks(t),f=Ej(d,c,!0);return n(),l(),s&&f},vre=()=>{const{body:e}=document,n=l8(`<div class="${C8}"><div></div></div>`)[0],r=n.firstChild,[o,,s]=Hb(),[l,c]=Qo({o:Wj(e,n,r),u:g8},ft(Wj,e,n,r,!0)),[d]=c(),f=mre(n),m={x:d.x===0,y:d.y===0},h={elements:{host:null,padding:!f,viewport:w=>f&&w===w.ownerDocument.body&&w,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Vt({},Kne),b=ft(Vt,{},g),y=ft(Vt,{},h),x={P:d,I:m,H:f,A:pr(n,"zIndex")==="-1",L:!!zb,V:hre(n,r),U:gre(n,r),B:ft(o,"r"),j:y,N:w=>Vt(h,w)&&y(),G:b,q:w=>Vt(g,w)&&b(),F:Vt({},h),W:Vt({},g)};return Ar(n,"style"),aa(n),Ur.addEventListener("resize",()=>{let w;if(!f&&(!m.x||!m.y)){const S=au(a2);w=!!(S?S.R():ko)(x,l)}s("r",[w])}),x},Gr=()=>(h1||(h1=vre()),h1),l2=(e,t)=>Os(t)?t.apply(0,e):t,bre=(e,t,n,r)=>{const o=bl(r)?n:r;return l2(e,o)||t.apply(0,e)},O8=(e,t,n,r)=>{const o=bl(r)?n:r,s=l2(e,o);return!!s&&(id(s)?s:t.apply(0,e))},xre=(e,t)=>{const{nativeScrollbarsOverlaid:n,body:r}=t||{},{I:o,H:s,j:l}=Gr(),{nativeScrollbarsOverlaid:c,body:d}=l().cancel,f=n??c,m=bl(r)?d:r,h=(o.x||o.y)&&f,g=e&&(Lg(m)?!s:m);return!!h||!!g},i2=new WeakMap,yre=(e,t)=>{i2.set(e,t)},Cre=e=>{i2.delete(e)},D8=e=>i2.get(e),wre=(e,t,n)=>{let r=!1;const o=n?new WeakMap:!1,s=()=>{r=!0},l=c=>{if(o&&n){const d=n.map(f=>{const[m,h]=f||[];return[h&&m?(c||a8)(m,e):[],h]});Qt(d,f=>Qt(f[0],m=>{const h=f[1],g=o.get(m)||[];if(e.contains(m)&&h){const y=Pn(m,h.trim(),x=>{r?(y(),o.delete(m)):t(x)});o.set(m,Xt(g,y))}else Ro(g),o.delete(m)}))}};return l(),[s,l]},Vj=(e,t,n,r)=>{let o=!1;const{X:s,Y:l,J:c,K:d,Z:f,tt:m}=r||{},h=u8(()=>o&&n(!0),{v:33,p:99}),[g,b]=wre(e,h,c),y=s||[],x=l||[],w=Xa(y,x),S=(_,I)=>{if(!_h(I)){const E=f||ko,M=m||ko,D=[],R=[];let N=!1,O=!1;if(Qt(I,T=>{const{attributeName:U,target:G,type:q,oldValue:Y,addedNodes:Q,removedNodes:V}=T,se=q==="attributes",ee=q==="childList",le=e===G,ae=se&&U,ce=ae?Cr(G,U||""):null,J=ae&&Y!==ce,re=Bg(x,U)&&J;if(t&&(ee||!le)){const A=se&&J,L=A&&d&&Ih(G,d),ne=(L?!E(G,U,Y,ce):!se||A)&&!M(T,!!L,e,r);Qt(Q,z=>Xt(D,z)),Qt(V,z=>Xt(D,z)),O=O||ne}!t&&le&&J&&!E(G,U,Y,ce)&&(Xt(R,U),N=N||re)}),b(T=>kj(D).reduce((U,G)=>(Xt(U,a8(T,G)),Ih(G,T)?Xt(U,G):U),[])),t)return!_&&O&&n(!1),[!1];if(!_h(R)||N){const T=[kj(R),N];return!_&&n.apply(0,T),T}}},j=new Nne(ft(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 h.m(),S(!0,j.takeRecords())}]},R8=(e,t,n)=>{const{nt:o,ot:s}=n||{},l=au(fre),{V:c}=Gr(),d=ft(Dd,e),[f]=Qo({o:!1,_:!0});return()=>{const m=[],g=l8(`<div class="${o2}"><div class="${Jne}"></div></div>`)[0],b=g.firstChild,y=x=>{const w=x instanceof ResizeObserverEntry,S=!w&&Do(x);let j=!1,_=!1,I=!0;if(w){const[E,,M]=f(x.contentRect),D=Bb(E),R=m8(E,M);_=!M||R,j=!_&&!D,I=!j}else S?[,I]=x:_=x===!0;if(o&&I){const E=S?x[0]:Dd(g);ul(g,{x:x8(3333333,3333333,E&&c),y:3333333})}j||t({st:S?x:void 0,et:!S,ot:_})};if(Eh){const x=new Eh(w=>y(w.pop()));x.observe(b),Xt(m,()=>{x.disconnect()})}else if(l){const[x,w]=l(b,y,s);Xt(m,Xa([cl(g,Zne),Pn(g,"animationstart",x)],w))}else return ko;if(o){const[x]=Qo({o:void 0},d);Xt(m,Pn(g,"scroll",w=>{const S=x(),[j,_,I]=S;_&&(t2(b,"ltr rtl"),cl(b,j?"rtl":"ltr"),y([!!j,_,I])),b8(w)}))}return ft(Ro,Xt(m,xo(e,g)))}},Sre=(e,t)=>{let n;const r=d=>d.h===0||d.isIntersecting||d.intersectionRatio>0,o=Xl(ere),[s]=Qo({o:!1}),l=(d,f)=>{if(d){const m=s(r(d)),[,h]=m;return h&&!f&&t(m)&&[m]}},c=(d,f)=>l(f.pop(),d);return[()=>{const d=[];if(_j)n=new _j(ft(c,!1),{root:e}),n.observe(o),Xt(d,()=>{n.disconnect()});else{const f=()=>{const m=dd(o);l(m)};Xt(d,R8(o,f)()),f()}return ft(Ro,Xt(d,xo(e,o)))},()=>n&&c(!0,n.takeRecords())]},kre=(e,t)=>{let n,r,o,s,l;const{H:c}=Gr(),d=`[${Yo}]`,f=`[${Ua}]`,m=["tabindex"],h=["wrap","cols","rows"],g=["id","class","style","open"],b={ct:!1,rt:Dd(e.lt)},{lt:y,it:x,ut:w,ft:S,_t:j,dt:_,vt:I}=e,{U:E,B:M}=Gr(),[D]=Qo({u:h8,o:{w:0,h:0}},()=>{const ae=_(wc,Cc),ce=_(m1,""),J=ce&&Lc(x);I(wc,Cc),I(m1,""),I("",Th,!0);const re=Rh(w),A=Rh(x),L=Ah(x);return I(wc,Cc,ae),I(m1,"",ce),I("",Th),ul(x,J),{w:A.w+re.w+L.w,h:A.h+re.h+L.h}}),R=S?h:Xa(g,h),N=u8(t,{v:()=>n,p:()=>r,g(ae,ce){const[J]=ae,[re]=ce;return[Xa(fa(J),fa(re)).reduce((A,L)=>(A[L]=J[L]||re[L],A),{})]}}),O=ae=>{Qt(ae||m,ce=>{if(Bg(m,ce)){const J=Cr(y,ce);vf(J)?Cr(x,ce,J):Ar(x,ce)}})},T=(ae,ce)=>{const[J,re]=ae,A={ht:re};return Vt(b,{ct:J}),!ce&&t(A),A},U=({et:ae,st:ce,ot:J})=>{const A=!(ae&&!J&&!ce)&&c?N:t,[L,K]=ce||[];ce&&Vt(b,{rt:L}),A({et:ae||J,ot:J,gt:K})},G=(ae,ce)=>{const[,J]=D(),re={bt:J};return J&&!ce&&(ae?t:N)(re),re},q=(ae,ce,J)=>{const re={wt:ce};return ce&&!J?N(re):j||O(ae),re},[Y,Q]=w||!E?Sre(y,T):[],V=!j&&R8(y,U,{ot:!0,nt:!0}),[se,ee]=Vj(y,!1,q,{Y:g,X:Xa(g,m)}),le=j&&Eh&&new Eh(ae=>{const ce=ae[ae.length-1].contentRect;U({et:!0,ot:m8(ce,l)}),l=ce});return[()=>{O(),le&&le.observe(y);const ae=V&&V(),ce=Y&&Y(),J=se(),re=M(A=>{const[,L]=D();N({yt:A,bt:L})});return()=>{le&&le.disconnect(),ae&&ae(),ce&&ce(),s&&s(),J(),re()}},({St:ae,$t:ce,xt:J})=>{const re={},[A]=ae("update.ignoreMutation"),[L,K]=ae("update.attributes"),[ne,z]=ae("update.elementEvents"),[oe,X]=ae("update.debounce"),Z=z||K,me=ce||J,ve=de=>Os(A)&&A(de);if(Z){o&&o(),s&&s();const[de,ke]=Vj(w||x,!0,G,{X:Xa(R,L||[]),J:ne,K:d,tt:(we,Re)=>{const{target:Qe,attributeName:$e}=we;return(!Re&&$e&&!j?Ene(Qe,d,f):!1)||!!ac(Qe,`.${Kr}`)||!!ve(we)}});s=de(),o=ke}if(X)if(N.m(),Do(oe)){const de=oe[0],ke=oe[1];n=Ps(de)&&de,r=Ps(ke)&&ke}else Ps(oe)?(n=oe,r=!1):(n=!1,r=!1);if(me){const de=ee(),ke=Q&&Q(),we=o&&o();de&&Vt(re,q(de[0],de[1],me)),ke&&Vt(re,T(ke[0],me)),we&&Vt(re,G(we[0],me))}return re},b]},Ub=(e,t,n)=>cd(e,One(t,n)),jre=(e,t,n)=>{const r=Od(t),[o,s]=Gne(r,n),l=(s-e)/s,c=e/o,d=e/s,f=n?n.n?l:n.i?c:d:d;return Ub(0,1,f)},A8=(e,t,n)=>{if(n){const d=t?pa:ma,{Ot:f,Ct:m}=n,h=ks(m)[d],g=ks(f)[d];return Ub(0,1,h/g)}const r=t?"x":"y",{Ht:o,zt:s}=e,l=s[r],c=o[r];return Ub(0,1,l/(l+c))},Uj=(e,t,n,r)=>{const o=A8(e,r,t);return 1/o*(1-o)*n},_re=(e,t,n,r)=>{const{j:o,A:s}=Gr(),{scrollbars:l}=o(),{slot:c}=l,{It:d,lt:f,it:m,At:h,Et:g,Tt:b,_t:y}=t,{scrollbars:x}=h?{}:e,{slot:w}=x||{},S=new Map,j=L=>zb&&new zb({source:g,axis:L}),_=j("x"),I=j("y"),E=O8([d,f,m],()=>y&&b?d:f,c,w),M=L=>y&&!b&&sa(L)===m,D=L=>{S.forEach((K,ne)=>{(L?Bg(Do(L)?L:[L],ne):!0)&&((K||[]).forEach(oe=>{oe&&oe.cancel()}),S.delete(ne))})},R=(L,K,ne)=>{const z=ne?cl:t2;Qt(L,oe=>{z(oe.Dt,K)})},N=(L,K)=>{Qt(L,ne=>{const[z,oe]=K(ne);pr(z,oe)})},O=(L,K,ne,z)=>K&&L.animate(ne,{timeline:K,composite:z}),T=(L,K)=>{N(L,ne=>{const{Ct:z}=ne;return[z,{[K?pa:ma]:Kp(A8(n,K))}]})},U=(L,K)=>{_&&I?L.forEach(ne=>{const{Dt:z,Ct:oe}=ne,X=ft(Uj,n,ne),Z=K&&Dd(z),me=X(Z?1:0,K),ve=X(Z?0:1,K);D(oe),S.set(oe,[O(oe,K?_:I,Vt({transform:[Gi(Kp(me),K),Gi(Kp(ve),K)]},Z?{clear:["left"]}:{}))])}):N(L,ne=>{const{Ct:z,Dt:oe}=ne,{V:X}=Gr(),Z=K?"x":"y",{Ht:me}=n,ve=Dd(oe),de=Uj(n,ne,jre(Lc(g)[Z],me[Z],K&&ve&&X),K);return[z,{transform:Gi(Kp(de),K)}]})},G=L=>{const{Dt:K}=L,ne=M(K)&&K,{x:z,y:oe}=Lc(g);return[ne,{transform:ne?Gi({x:qp(z),y:qp(oe)}):""}]},q=(L,K,ne,z)=>O(L,K,{transform:[Gi(qp(0),z),Gi(qp(cd(0,ne-.5)),z)]},"add"),Y=[],Q=[],V=[],se=(L,K,ne)=>{const z=r8(ne),oe=z?ne:!0,X=z?!ne:!0;oe&&R(Q,L,K),X&&R(V,L,K)},ee=()=>{T(Q,!0),T(V)},le=()=>{U(Q,!0),U(V)},ae=()=>{if(y)if(I&&I){const{Ht:L}=n;Xa(V,Q).forEach(({Dt:K})=>{D(K),M(K)&&S.set(K,[q(K,_,L.x,!0),q(K,I,L.y)])})}else N(Q,G),N(V,G)},ce=L=>{const K=L?ore:sre,ne=L?Q:V,z=_h(ne)?Lj:"",oe=Xl(`${Kr} ${K} ${z}`),X=Xl(I8),Z=Xl(s2),me={Dt:oe,Ot:X,Ct:Z};return s||cl(oe,tre),Xt(ne,me),Xt(Y,[xo(oe,X),xo(X,Z),ft(aa,oe),D,r(me,se,U,L)]),me},J=ft(ce,!0),re=ft(ce,!1),A=()=>(xo(E,Q[0].Dt),xo(E,V[0].Dt),Ph(()=>{se(Lj)},300),ft(Ro,Y));return J(),re(),[{kt:ee,Mt:le,Rt:ae,Pt:se,Lt:{L:_,Vt:Q,Ut:J,Bt:ft(N,Q)},jt:{L:I,Vt:V,Ut:re,Bt:ft(N,V)}},A]},Ire=(e,t,n)=>{const{lt:r,Et:o,Nt:s}=t;return(l,c,d,f)=>{const{Dt:m,Ot:h,Ct:g}=l,[b,y]=Va(333),[x,w]=Va(),S=ft(d,[l],f),j=!!o.scrollBy,_=`client${f?"X":"Y"}`,I=f?pa:ma,E=f?"left":"top",M=f?"w":"h",D=f?"x":"y",R=T=>T.propertyName.indexOf(I)>-1,N=()=>{const T="pointerup pointerleave pointercancel lostpointercapture",U=(G,q)=>Y=>{const{Ht:Q}=n,V=dd(h)[M]-dd(g)[M],ee=q*Y/V*Q[D];ul(o,{[D]:G+ee})};return Pn(h,"pointerdown",G=>{const q=ac(G.target,`.${s2}`)===g,Y=q?g:h,Q=e.scrollbars,{button:V,isPrimary:se,pointerType:ee}=G,{pointers:le}=Q,ae=V===0&&se&&Q[q?"dragScroll":"clickScroll"]&&(le||[]).includes(ee);if(ql(r,Yo,Nj,!0),ae){const ce=!q&&G.shiftKey,J=ft(ks,g),re=ft(ks,h),A=(we,Re)=>(we||J())[E]-(Re||re())[E],L=Od(ks(o)[I])/dd(o)[M]||1,K=U(Lc(o)[D]||0,1/L),ne=G[_],z=J(),oe=re(),X=z[I],Z=A(z,oe)+X/2,me=ne-oe[E],ve=q?0:me-Z,de=we=>{Ro(ke),Y.releasePointerCapture(we.pointerId)},ke=[ft(ql,r,Yo,Nj),Pn(s,T,de),Pn(s,"selectstart",we=>Dj(we),{S:!1}),Pn(h,T,de),Pn(h,"pointermove",we=>{const Re=we[_]-ne;(q||ce)&&K(ve+Re)})];if(ce)K(ve);else if(!q){const we=au(pre);we&&Xt(ke,we(K,A,ve,X,me))}Y.setPointerCapture(G.pointerId)}})};let O=!0;return ft(Ro,[Pn(m,"pointerenter",()=>{c(Fj,!0)}),Pn(m,"pointerleave pointercancel",()=>{c(Fj,!1)}),Pn(m,"wheel",T=>{const{deltaX:U,deltaY:G,deltaMode:q}=T;j&&O&&q===0&&sa(m)===r&&o.scrollBy({left:U,top:G,behavior:"smooth"}),O=!1,c(Hj,!0),b(()=>{O=!0,c(Hj)}),Dj(T)},{S:!1,$:!0}),Pn(g,"transitionstart",T=>{if(R(T)){const U=()=>{S(),x(U)};U()}}),Pn(g,"transitionend transitioncancel",T=>{R(T)&&(w(),S())}),Pn(m,"mousedown",ft(Pn,s,"click",b8,{O:!0,$:!0}),{$:!0}),N(),y,w])}},Pre=(e,t,n,r,o,s)=>{let l,c,d,f,m,h=ko,g=0;const[b,y]=Va(),[x,w]=Va(),[S,j]=Va(100),[_,I]=Va(100),[E,M]=Va(100),[D,R]=Va(()=>g),[N,O]=_re(e,o,r,Ire(t,o,r)),{lt:T,Gt:U,Tt:G}=o,{Pt:q,kt:Y,Mt:Q,Rt:V}=N,se=J=>{q(Vb,J,!0),q(Vb,J,!1)},ee=(J,re)=>{if(R(),J)q(Bj);else{const A=ft(q,Bj,!0);g>0&&!re?D(A):A()}},le=J=>J.pointerType==="mouse",ae=J=>{le(J)&&(f=c,f&&ee(!0))},ce=[j,R,I,M,w,y,()=>h(),Pn(T,"pointerover",ae,{O:!0}),Pn(T,"pointerenter",ae),Pn(T,"pointerleave",J=>{le(J)&&(f=!1,c&&ee(!1))}),Pn(T,"pointermove",J=>{le(J)&&l&&b(()=>{j(),ee(!0),_(()=>{l&&ee(!1)})})}),Pn(U,"scroll",J=>{x(()=>{Q(),d&&ee(!0),S(()=>{d&&!f&&ee(!1)})}),s(J),V()})];return[()=>ft(Ro,Xt(ce,O())),({St:J,xt:re,qt:A,Ft:L})=>{const{Wt:K,Xt:ne,Yt:z}=L||{},{gt:oe,ot:X}=A||{},{rt:Z}=n,{I:me}=Gr(),{Ht:ve,Jt:de,Kt:ke}=r,[we,Re]=J("showNativeOverlaidScrollbars"),[Qe,$e]=J("scrollbars.theme"),[vt,it]=J("scrollbars.visibility"),[ot,Ce]=J("scrollbars.autoHide"),[Me,qe]=J("scrollbars.autoHideSuspend"),[dt]=J("scrollbars.autoHideDelay"),[ye,Ue]=J("scrollbars.dragScroll"),[st,mt]=J("scrollbars.clickScroll"),Pe=X&&!re,Ne=ke.x||ke.y,kt=K||ne||oe||re,Se=z||it,Ve=we&&me.x&&me.y,Ge=(Le,bt)=>{const fn=vt==="visible"||vt==="auto"&&Le==="scroll";return q(are,fn,bt),fn};if(g=dt,Pe&&(Me&&Ne?(se(!1),h(),E(()=>{h=Pn(U,"scroll",ft(se,!0),{O:!0})})):se(!0)),Re&&q(nre,Ve),$e&&(q(m),q(Qe,!0),m=Qe),qe&&!Me&&se(!0),Ce&&(l=ot==="move",c=ot==="leave",d=ot!=="never",ee(!d,!0)),Ue&&q(cre,ye),mt&&q(ire,st),Se){const Le=Ge(de.x,!0),bt=Ge(de.y,!1);q(lre,!(Le&&bt))}kt&&(Y(),Q(),V(),q(zj,!ve.x,!0),q(zj,!ve.y,!1),q(rre,Z&&!G))},{},N]},Ere=e=>{const t=Gr(),{j:n,H:r}=t,o=au(a2),s=o&&o.C,{elements:l}=n(),{host:c,padding:d,viewport:f,content:m}=l,h=id(e),g=h?{}:e,{elements:b}=g,{host:y,padding:x,viewport:w,content:S}=b||{},j=h?e:g.target,_=Ih(j,"textarea"),I=j.ownerDocument,E=I.documentElement,M=j===I.body,D=I.defaultView,R=ft(bre,[j]),N=ft(O8,[j]),O=ft(l2,[j]),T=ft(Xl,""),U=ft(R,T,f),G=ft(N,T,m),q=U(w),Y=q===j,Q=Y&&M,V=!Y&&G(S),se=!Y&&id(q)&&q===V,ee=se&&!!O(m),le=ee?U():q,ae=ee?V:G(),J=Q?E:se?le:q,re=_?R(T,c,y):j,A=Q?J:re,L=se?ae:V,K=I.activeElement,ne=!Y&&D.top===D&&K===j,z={It:j,lt:A,it:J,Zt:!Y&&N(T,d,x),ut:L,Qt:!Y&&!r&&s&&s(t),Et:Q?E:J,Gt:Q?I:J,tn:D,Nt:I,ft:_,Tt:M,At:h,_t:Y,nn:se,dt:(Ce,Me)=>Ine(J,Y?Yo:Ua,Y?Me:Ce),vt:(Ce,Me,qe)=>ql(J,Y?Yo:Ua,Y?Me:Ce,qe)},oe=fa(z).reduce((Ce,Me)=>{const qe=z[Me];return Xt(Ce,qe&&id(qe)&&!sa(qe)?qe:!1)},[]),X=Ce=>Ce?Bg(oe,Ce):null,{It:Z,lt:me,Zt:ve,it:de,ut:ke,Qt:we}=z,Re=[()=>{Ar(me,Yo),Ar(me,p1),Ar(Z,p1),M&&(Ar(E,Yo),Ar(E,p1))}],Qe=_&&X(me);let $e=_?Z:$b([ke,de,ve,me,Z].find(Ce=>X(Ce)===!1));const vt=Q?Z:ke||de,it=ft(Ro,Re);return[z,()=>{Cr(me,Yo,Y?"viewport":"host"),Cr(ve,Wb,""),Cr(ke,$j,""),Y||Cr(de,Ua,"");const Ce=M&&!Y?cl(sa(j),S8):ko,Me=qe=>{xo(sa(qe),$b(qe)),aa(qe)};if(Qe&&(jj(Z,me),Xt(Re,()=>{jj(me,Z),aa(me)})),xo(vt,$e),xo(me,ve),xo(ve||me,!Y&&de),xo(de,ke),Xt(Re,()=>{Ce(),Ar(ve,Wb),Ar(ke,$j),Ar(de,k8),Ar(de,j8),Ar(de,Ua),X(ke)&&Me(ke),X(de)&&Me(de),X(ve)&&Me(ve)}),r&&!Y&&(ql(de,Ua,_8,!0),Xt(Re,ft(Ar,de,Ua))),we&&(Mne(de,we),Xt(Re,ft(aa,we))),ne){const qe="tabindex",dt=Cr(de,qe);Cr(de,qe,"-1"),de.focus();const ye=()=>dt?Cr(de,qe,dt):Ar(de,qe),Ue=Pn(I,"pointerdown keydown",()=>{ye(),Ue()});Xt(Re,[ye,Ue])}else K&&K.focus&&K.focus();return $e=0,it},it]},Mre=({ut:e})=>({qt:t,sn:n,xt:r})=>{const{U:o}=Gr(),{ht:s}=t||{},{ct:l}=n;(e||!o)&&(s||r)&&pr(e,{[ma]:l?"":"100%"})},Ore=({lt:e,Zt:t,it:n,_t:r},o)=>{const[s,l]=Qo({u:Wne,o:Pj()},ft(Pj,e,"padding",""));return({St:c,qt:d,sn:f,xt:m})=>{let[h,g]=l(m);const{H:b,U:y}=Gr(),{et:x,bt:w,gt:S}=d||{},{rt:j}=f,[_,I]=c("paddingAbsolute");(x||g||(m||!y&&w))&&([h,g]=s(m));const M=!r&&(I||S||g);if(M){const D=!_||!t&&!b,R=h.r+h.l,N=h.t+h.b,O={[Dh]:D&&!j?-R:0,[ud]:D?-N:0,[Oh]:D&&j?-R:0,top:D?-h.t:0,right:D?j?-h.r:"auto":0,left:D?j?"auto":-h.l:0,[pa]:D?`calc(100% + ${R}px)`:""},T={[p8]:D?h.t:0,[n2]:D?h.r:0,[Mh]:D?h.b:0,[r2]:D?h.l:0};pr(t||n,O),pr(n,T),Vt(o,{Zt:h,en:!D,D:t?T:Vt({},O,T)})}return{cn:M}}},Dre=({lt:e,Zt:t,it:n,Qt:r,_t:o,vt:s,Tt:l,tn:c},d)=>{const f=ft(cd,0),m="visible",h=42,g={u:h8,o:{w:0,h:0}},b={u:g8,o:{x:$c,y:$c}},y=(ce,J)=>{const re=Ur.devicePixelRatio%1!==0?1:0,A={w:f(ce.w-J.w),h:f(ce.h-J.h)};return{w:A.w>re?A.w:0,h:A.h>re?A.h:0}},x=ce=>ce.indexOf(m)===0,{P:w,U:S,H:j,I:_}=Gr(),I=au(a2),E=!o&&!j&&(_.x||_.y),M=l&&o,[D,R]=Qo(g,ft(Ah,n)),[N,O]=Qo(g,ft(Rh,n)),[T,U]=Qo(g),[G,q]=Qo(g),[Y]=Qo(b),Q=(ce,J)=>{if(pr(n,{[ma]:""}),J){const{en:re,Zt:A}=d,{rn:L,k:K}=ce,ne=Ah(e),z=hm(e),oe=pr(n,"boxSizing")==="content-box",X=re||oe?A.b+A.t:0,Z=!(_.x&&oe);pr(n,{[ma]:z.h+ne.h+(L.x&&Z?K.x:0)-X})}},V=(ce,J)=>{const re=!j&&!ce?h:0,A=(ve,de,ke)=>{const we=pr(n,ve),Qe=(J?J[ve]:we)==="scroll";return[we,Qe,Qe&&!j?de?re:ke:0,de&&!!re]},[L,K,ne,z]=A(Yu,_.x,w.x),[oe,X,Z,me]=A(Zu,_.y,w.y);return{Jt:{x:L,y:oe},rn:{x:K,y:X},k:{x:ne,y:Z},M:{x:z,y:me}}},se=(ce,J,re,A)=>{const L=(X,Z)=>{const me=x(X),ve=Z&&me&&X.replace(`${m}-`,"")||"";return[Z&&!me?X:"",x(ve)?"hidden":ve]},[K,ne]=L(re.x,J.x),[z,oe]=L(re.y,J.y);return A[Yu]=ne&&z?ne:K,A[Zu]=oe&&K?oe:z,V(ce,A)},ee=(ce,J,re,A)=>{const{k:L,M:K}=ce,{x:ne,y:z}=K,{x:oe,y:X}=L,{D:Z}=d,me=J?Oh:Dh,ve=J?r2:n2,de=Z[me],ke=Z[ud],we=Z[ve],Re=Z[Mh];A[pa]=`calc(100% + ${X+de*-1}px)`,A[me]=-X+de,A[ud]=-oe+ke,re&&(A[ve]=we+(z?X:0),A[Mh]=Re+(ne?oe:0))},[le,ae]=I?I.T(E,S,n,r,d,V,ee):[()=>E,()=>[ko]];return({St:ce,qt:J,sn:re,xt:A},{cn:L})=>{const{et:K,wt:ne,bt:z,ht:oe,gt:X,yt:Z}=J||{},{ct:me,rt:ve}=re,[de,ke]=ce("showNativeOverlaidScrollbars"),[we,Re]=ce("overflow"),Qe=de&&_.x&&_.y,$e=!o&&!S&&(K||z||ne||ke||oe),vt=K||L||z||X||Z||ke,it=x(we.x),ot=x(we.y),Ce=it||ot;let Me=R(A),qe=O(A),dt=U(A),ye=q(A),Ue;if(ke&&j&&s(_8,Qne,!Qe),$e&&(Ue=V(Qe),Q(Ue,me)),vt){Ce&&s(wc,Cc,!1);const[zn,pn]=ae(Qe,ve,Ue),[en,un]=Me=D(A),[Wt,ar]=qe=N(A),vr=hm(n);let Bn=Wt,Hn=vr;zn(),(ar||un||ke)&&pn&&!Qe&&le(pn,Wt,en,ve)&&(Hn=hm(n),Bn=Rh(n));const lo=Hne(c),Fo={w:f(cd(Wt.w,Bn.w)+en.w),h:f(cd(Wt.h,Bn.h)+en.h)},zo={w:f((M?lo.w:Hn.w+f(vr.w-Wt.w))+en.w),h:f((M?lo.h:Hn.h+f(vr.h-Wt.h))+en.h)};ye=G(zo),dt=T(y(Fo,zo),A)}const[st,mt]=ye,[Pe,Ne]=dt,[kt,Se]=qe,[Ve,Ge]=Me,Le={x:Pe.w>0,y:Pe.h>0},bt=it&&ot&&(Le.x||Le.y)||it&&Le.x&&!Le.y||ot&&Le.y&&!Le.x;if(L||X||Z||Ge||Se||mt||Ne||Re||ke||$e||vt){const zn={[Dh]:0,[ud]:0,[Oh]:0,[pa]:"",[Yu]:"",[Zu]:""},pn=se(Qe,Le,we,zn),en=le(pn,kt,Ve,ve);o||ee(pn,ve,en,zn),$e&&Q(pn,me),o?(Cr(e,k8,zn[Yu]),Cr(e,j8,zn[Zu])):pr(n,zn)}ql(e,Yo,Cc,bt),ql(t,Wb,Yne,bt),o||ql(n,Ua,wc,Ce);const[Bt,Ht]=Y(V(Qe).Jt);return Vt(d,{Jt:Bt,zt:{x:st.w,y:st.h},Ht:{x:Pe.w,y:Pe.h},Kt:Le}),{Yt:Ht,Wt:mt,Xt:Ne}}},Rre=e=>{const[t,n,r]=Ere(e),o={Zt:{t:0,r:0,b:0,l:0},en:!1,D:{[Dh]:0,[ud]:0,[Oh]:0,[p8]:0,[n2]:0,[Mh]:0,[r2]:0},zt:{x:0,y:0},Ht:{x:0,y:0},Jt:{x:$c,y:$c},Kt:{x:!1,y:!1}},{It:s,it:l,vt:c,_t:d}=t,{H:f,I:m,U:h}=Gr(),g=!f&&(m.x||m.y),b=[Mre(t),Ore(t,o),Dre(t,o)];return[n,y=>{const x={},S=(g||!h)&&Lc(l);return c("",Th,!0),Qt(b,j=>{Vt(x,j(y,x)||{})}),c("",Th),ul(l,S),!d&&ul(s,0),x},o,t,r]},Are=(e,t,n,r)=>{const[o,s,l,c,d]=Rre(e),[f,m,h]=kre(c,S=>{w({},S)}),[g,b,,y]=Pre(e,t,h,l,c,r),x=S=>fa(S).some(j=>!!S[j]),w=(S,j)=>{const{ln:_,xt:I,$t:E,an:M}=S,D=_||{},R=!!I,N={St:qne(t,D,R),ln:D,xt:R};if(M)return b(N),!1;const O=j||m(Vt({},N,{$t:E})),T=s(Vt({},N,{sn:h,qt:O}));b(Vt({},N,{qt:O,Ft:T}));const U=x(O),G=x(T),q=U||G||!Jy(D)||R;return q&&n(S,{qt:O,Ft:T}),q};return[()=>{const{It:S,it:j,Nt:_,Tt:I}=c,E=I?_.documentElement:S,M=Lc(E),D=[f(),o(),g()];return ul(j,M),ft(Ro,D)},w,()=>({un:h,fn:l}),{_n:c,dn:y},d]},ra=(e,t,n)=>{const{G:r}=Gr(),o=id(e),s=o?e:e.target,l=D8(s);if(t&&!l){let c=!1;const d=[],f={},m=O=>{const T=o8(O,!0),U=au(dre);return U?U(T,!0):T},h=Vt({},r(),m(t)),[g,b,y]=Hb(),[x,w,S]=Hb(n),j=(O,T)=>{S(O,T),y(O,T)},[_,I,E,M,D]=Are(e,h,({ln:O,xt:T},{qt:U,Ft:G})=>{const{et:q,gt:Y,ht:Q,bt:V,wt:se,ot:ee}=U,{Wt:le,Xt:ae,Yt:ce}=G;j("updated",[N,{updateHints:{sizeChanged:!!q,directionChanged:!!Y,heightIntrinsicChanged:!!Q,overflowEdgeChanged:!!le,overflowAmountChanged:!!ae,overflowStyleChanged:!!ce,contentMutation:!!V,hostMutation:!!se,appear:!!ee},changedOptions:O||{},force:!!T}])},O=>j("scroll",[N,O])),R=O=>{Cre(s),Ro(d),c=!0,j("destroyed",[N,O]),b(),w()},N={options(O,T){if(O){const U=T?r():{},G=y8(h,Vt(U,m(O)));Jy(G)||(Vt(h,G),I({ln:G}))}return Vt({},h)},on:x,off:(O,T)=>{O&&T&&w(O,T)},state(){const{un:O,fn:T}=E(),{rt:U}=O,{zt:G,Ht:q,Jt:Y,Kt:Q,Zt:V,en:se}=T;return Vt({},{overflowEdge:G,overflowAmount:q,overflowStyle:Y,hasOverflow:Q,padding:V,paddingAbsolute:se,directionRTL:U,destroyed:c})},elements(){const{It:O,lt:T,Zt:U,it:G,ut:q,Et:Y,Gt:Q}=M._n,{Lt:V,jt:se}=M.dn,ee=ae=>{const{Ct:ce,Ot:J,Dt:re}=ae;return{scrollbar:re,track:J,handle:ce}},le=ae=>{const{Vt:ce,Ut:J}=ae,re=ee(ce[0]);return Vt({},re,{clone:()=>{const A=ee(J());return I({an:!0}),A}})};return Vt({},{target:O,host:T,padding:U||G,viewport:G,content:q||G,scrollOffsetElement:Y,scrollEventElement:Q,scrollbarHorizontal:le(V),scrollbarVertical:le(se)})},update:O=>I({xt:O,$t:!0}),destroy:ft(R,!1),plugin:O=>f[fa(O)[0]]};return Xt(d,[D]),yre(s,N),M8(P8,ra,[N,g,f]),xre(M._n.Tt,!o&&e.cancel)?(R(!0),N):(Xt(d,_()),j("initialized",[N]),N.update(!0),N)}return l};ra.plugin=e=>{const t=Do(e),n=t?e:[e],r=n.map(o=>M8(o,ra)[0]);return ure(n),t?r:r[0]};ra.valid=e=>{const t=e&&e.elements,n=Os(t)&&t();return jh(n)&&!!D8(n.target)};ra.env=()=>{const{P:e,I:t,H:n,V:r,U:o,A:s,L:l,F:c,W:d,j:f,N:m,G:h,q:g}=Gr();return Vt({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,scrollTimeline:l,staticDefaultInitialization:c,staticDefaultOptions:d,getDefaultInitialization:f,setDefaultInitialization:m,getDefaultOptions:h,setDefaultOptions:g})};const Tre=()=>{if(typeof window>"u"){const f=()=>{};return[f,f]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,l=r?n.requestIdleCallback:o,c=r?n.cancelIdleCallback:s,d=()=>{c(e),s(t)};return[(f,m)=>{d(),e=l(r?()=>{d(),t=o(f)}:f,typeof m=="object"?m:{timeout:2233})},d]},c2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=i.useMemo(Tre,[]),l=i.useRef(null),c=i.useRef(r),d=i.useRef(t),f=i.useRef(n);return i.useEffect(()=>{c.current=r},[r]),i.useEffect(()=>{const{current:m}=l;d.current=t,ra.valid(m)&&m.options(t||{},!0)},[t]),i.useEffect(()=>{const{current:m}=l;f.current=n,ra.valid(m)&&m.on(n||{},!0)},[n]),i.useEffect(()=>()=>{var m;s(),(m=l.current)==null||m.destroy()},[]),i.useMemo(()=>[m=>{const h=l.current;if(ra.valid(h))return;const g=c.current,b=d.current||{},y=f.current||{},x=()=>l.current=ra(m,b,y);g?o(x,g):x()},()=>l.current],[])},Nre=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:l,...c}=e,d=n,f=i.useRef(null),m=i.useRef(null),[h,g]=c2({options:r,events:o,defer:s});return i.useEffect(()=>{const{current:b}=f,{current:y}=m;return b&&y&&h({target:b,elements:{viewport:y,content:y}}),()=>{var x;return(x=g())==null?void 0:x.destroy()}},[h,n]),i.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>f.current}),[]),B.createElement(d,{"data-overlayscrollbars-initialize":"",ref:f,...c},B.createElement("div",{"data-overlayscrollbars-contents":"",ref:m},l))},Gg=i.forwardRef(Nre),$re=()=>{const{t:e}=W(),[t,{isLoading:n}]=dA(),r=e("boards.myBoard"),o=i.useCallback(()=>{t(r)},[t,r]);return a.jsx(Fe,{icon:a.jsx(nl,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},Lre=i.memo($re);var T8=eg({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"})]})}),Kg=eg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),N8=eg({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"}),Fre=eg({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 zre=fe([pe],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}}),Bre=()=>{const e=te(),{boardSearchText:t}=H(zre),n=i.useRef(null),{t:r}=W(),o=i.useCallback(d=>{e(Lw(d))},[e]),s=i.useCallback(()=>{e(Lw(""))},[e]),l=i.useCallback(d=>{d.key==="Escape"&&s()},[s]),c=i.useCallback(d=>{o(d.target.value)},[o]);return i.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(cy,{children:[a.jsx(Qc,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:l,onChange:c,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(lg,{children:a.jsx(rs,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(N8,{boxSize:2})})})]})},Hre=i.memo(Bre);function $8(e){return fA(e)}function Wre(e){return pA(e)}const L8=(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",f=e.context.boardId;return d!==f}if(r==="IMAGE_DTOS"){const{imageDTOs:c}=t.data.current.payload,d=((o=c[0])==null?void 0:o.board_id)??"none",f=e.context.boardId;return d!==f}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}},Vre=e=>{const{isOver:t,label:n="Drop"}=e,r=i.useRef(Ya()),{colorMode:o}=ya();return a.jsx(Mn.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Te("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx($,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Te("base.50","base.50")(o):Te("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Ie,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Te("base.50","base.50")(o):Te("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},F8=i.memo(Vre),Ure=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=i.useRef(Ya()),{isOver:s,setNodeRef:l,active:c}=$8({id:o.current,disabled:r,data:n});return a.jsx(Ie,{ref:l,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:c?"auto":"none",children:a.jsx(hr,{children:L8(n,c)&&a.jsx(F8,{isOver:s,label:t})})})},u2=i.memo(Ure),Gre=({isSelected:e,isHovered:t})=>a.jsx(Ie,{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}}}),d2=i.memo(Gre),Kre=()=>{const{t:e}=W();return a.jsx($,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Sa,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:e("common.auto")})})},z8=i.memo(Kre);function f2(e){const[t,n]=i.useState(!1),[r,o]=i.useState(!1),[s,l]=i.useState(!1),[c,d]=i.useState([0,0]),f=i.useRef(null);i.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{l(!0)})});else{l(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]);const m=i.useCallback(()=>{n(!1),l(!1),o(!1)},[]);Yy(m),DB("contextmenu",g=>{var b;(b=f.current)!=null&&b.contains(g.target)||g.target===f.current?(g.preventDefault(),n(!0),d([g.pageX,g.pageY])):n(!1)});const h=i.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(f),r&&a.jsx(Uc,{...e.portalProps,children:a.jsxs(of,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(sf,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:c[0],top:c[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const qg=e=>{const{boardName:t}=Wd(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)||PI("boards.uncategorized")}}});return t},qre=({board:e,setBoardToDelete:t})=>{const{t:n}=W(),r=i.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(At,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(ao,{}),onClick:r,children:n("boards.deleteBoard")})]})},Xre=i.memo(qre),Qre=()=>a.jsx(a.Fragment,{}),Yre=i.memo(Qre),Zre=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=W(),s=te(),l=i.useMemo(()=>fe(pe,({gallery:w})=>{const S=w.autoAddBoardId===t,j=w.autoAssignBoardOnClick;return{isAutoAdd:S,autoAssignBoardOnClick:j}}),[t]),{isAutoAdd:c,autoAssignBoardOnClick:d}=H(l),f=qg(t),m=Mt("bulkDownload").isFeatureEnabled,[h]=EI(),g=i.useCallback(()=>{s(Kh(t))},[t,s]),b=i.useCallback(async()=>{try{const w=await h({image_names:[],board_id:t}).unwrap();s(lt({title:o("gallery.preparingDownload"),status:"success",...w.response?{description:w.response,duration:null,isClosable:!0}:{}}))}catch{s(lt({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,h,s]),y=i.useCallback(w=>{w.preventDefault()},[]),x=i.useCallback(()=>a.jsx(al,{sx:{visibility:"visible !important"},motionProps:Yl,onContextMenu:y,children:a.jsxs(_d,{title:f,children:[a.jsx(At,{icon:a.jsx(nl,{}),isDisabled:c||d,onClick:g,children:o("boards.menuItemAutoAdd")}),m&&a.jsx(At,{icon:a.jsx(ou,{}),onClickCapture:b,children:o("boards.downloadBoard")}),!e&&a.jsx(Yre,{}),e&&a.jsx(Xre,{board:e,setBoardToDelete:n})]})}),[d,e,f,b,g,c,m,n,y,o]);return a.jsx(f2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:x,children:r})},B8=i.memo(Zre),Jre=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=i.useMemo(()=>fe(pe,({gallery:O})=>{const T=e.board_id===O.autoAddBoardId,U=O.autoAssignBoardOnClick;return{isSelectedForAutoAdd:T,autoAssignBoardOnClick:U}}),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:l}=H(o),[c,d]=i.useState(!1),f=i.useCallback(()=>{d(!0)},[]),m=i.useCallback(()=>{d(!1)},[]),{data:h}=wx(e.board_id),{data:g}=Sx(e.board_id),b=i.useMemo(()=>{if(!((h==null?void 0:h.total)===void 0||(g==null?void 0:g.total)===void 0))return`${h.total} image${h.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,h]),{currentData:y}=jo(e.cover_image_name??Br),{board_name:x,board_id:w}=e,[S,j]=i.useState(x),_=i.useCallback(()=>{r(MI({boardId:w})),l&&r(Kh(w))},[w,l,r]),[I,{isLoading:E}]=mA(),M=i.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),D=i.useCallback(async O=>{if(!O.trim()){j(x);return}if(O!==x)try{const{board_name:T}=await I({board_id:w,changes:{board_name:O}}).unwrap();j(T)}catch{j(x)}},[w,x,I]),R=i.useCallback(O=>{j(O)},[]),{t:N}=W();return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx($,{onMouseOver:f,onMouseOut:m,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(B8,{board:e,board_id:w,setBoardToDelete:n,children:O=>a.jsx(Ut,{label:b,openDelay:1e3,hasArrow:!0,children:a.jsxs($,{ref:O,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(Ca,{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($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(An,{boxSize:12,as:Xte,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(z8,{}),a.jsx(d2,{isSelected:t,isHovered:c}),a.jsx($,{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:E,submitOnBlur:!0,onChange:R,onSubmit:D,sx:{w:"full"},children:[a.jsx(Jd,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(Zd,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(u2,{data:M,dropLabel:a.jsx(be,{fontSize:"md",children:N("unifiedCanvas.move")})})]})})})})})},eoe=i.memo(Jre),toe=fe(pe,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}}),H8=i.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(toe),o=qg("none"),s=i.useCallback(()=>{t(MI({boardId:"none"})),r&&t(Kh("none"))},[t,r]),[l,c]=i.useState(!1),{data:d}=wx("none"),{data:f}=Sx("none"),m=i.useMemo(()=>{if(!((d==null?void 0:d.total)===void 0||(f==null?void 0:f.total)===void 0))return`${d.total} image${d.total===1?"":"s"}, ${f.total} asset${f.total===1?"":"s"}`},[f,d]),h=i.useCallback(()=>{c(!0)},[]),g=i.useCallback(()=>{c(!1)},[]),b=i.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]),{t:y}=W();return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx($,{onMouseOver:h,onMouseOut:g,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(B8,{board_id:"none",children:x=>a.jsx(Ut,{label:m,openDelay:1e3,hasArrow:!0,children:a.jsxs($,{ref:x,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($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Ca,{src:Cx,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(z8,{}),a.jsx($,{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(d2,{isSelected:e,isHovered:l}),a.jsx(u2,{data:b,dropLabel:a.jsx(be,{fontSize:"md",children:y("unifiedCanvas.move")})})]})})})})})});H8.displayName="HoverableBoard";const noe=i.memo(H8),roe=fe([pe],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}}),ooe=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=H(roe),{data:o}=Wd(),s=r?o==null?void 0:o.filter(d=>d.board_name.toLowerCase().includes(r.toLowerCase())):o,[l,c]=i.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Xd,{in:t,animateOpacity:!0,children:a.jsxs($,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Hre,{}),a.jsx(Lre,{})]}),a.jsx(Gg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(sl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Sd,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(noe,{isSelected:n==="none"})}),s&&s.map((d,f)=>a.jsx(Sd,{sx:{p:1.5},"data-testid":`board-${f}`,children:a.jsx(eoe,{board:d,isSelected:n===d.board_id,setBoardToDelete:c})},d.board_id))]})})]})}),a.jsx(Sne,{boardToDelete:l,setBoardToDelete:c})]})},soe=i.memo(ooe),aoe=fe([pe],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}}),loe=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=H(aoe),o=qg(r),s=i.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs($,{as:ol,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(be,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(Kg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},ioe=i.memo(loe),coe=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(lf,{isLazy:o,...s,children:[a.jsx(yg,{children:t}),a.jsxs(cf,{shadow:"dark-lg",children:[r&&a.jsx(m6,{}),n]})]})},xf=i.memo(coe),uoe=e=>{const{label:t,...n}=e,{colorMode:r}=ya();return a.jsx(og,{colorScheme:"accent",...n,children:a.jsx(be,{sx:{fontSize:"sm",color:Te("base.800","base.200")(r)},children:t})})},yr=i.memo(uoe);function doe(e){return De({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 W8=_e((e,t)=>{const[n,r]=i.useState(!1),{label:o,value:s,min:l=1,max:c=100,step:d=1,onChange:f,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:b=!1,inputWidth:y=16,withReset:x=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:I,sliderFormControlProps:E,sliderFormLabelProps:M,sliderMarkProps:D,sliderTrackProps:R,sliderThumbProps:N,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:U,sliderTooltipProps:G,sliderIAIIconButtonProps:q,...Y}=e,Q=te(),{t:V}=W(),[se,ee]=i.useState(String(s));i.useEffect(()=>{ee(s)},[s]);const le=i.useMemo(()=>O!=null&&O.min?O.min:l,[l,O==null?void 0:O.min]),ae=i.useMemo(()=>O!=null&&O.max?O.max:c,[c,O==null?void 0:O.max]),ce=i.useCallback(Z=>{f(Z)},[f]),J=i.useCallback(Z=>{Z.target.value===""&&(Z.target.value=String(le));const me=Zl(b?Math.floor(Number(Z.target.value)):Number(se),le,ae),ve=Ku(me,d);f(ve),ee(ve)},[b,se,le,ae,f,d]),re=i.useCallback(Z=>{ee(Z)},[]),A=i.useCallback(()=>{I&&I()},[I]),L=i.useCallback(Z=>{Z.target instanceof HTMLDivElement&&Z.target.focus()},[]),K=i.useCallback(Z=>{Z.shiftKey&&Q(zr(!0))},[Q]),ne=i.useCallback(Z=>{Z.shiftKey||Q(zr(!1))},[Q]),z=i.useCallback(()=>r(!0),[]),oe=i.useCallback(()=>r(!1),[]),X=i.useCallback(()=>f(Number(se)),[se,f]);return a.jsxs(Gt,{ref:t,onClick:L,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...E,children:[o&&a.jsx(ln,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(ug,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Sy,{"aria-label":o,value:s,min:l,max:c,step:d,onChange:ce,onMouseEnter:z,onMouseLeave:oe,focusThumbOnChange:!1,isDisabled:j,...Y,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Zi,{value:l,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...D,children:l}),a.jsx(Zi,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...D,children:c})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((Z,me)=>me===0?a.jsx(Zi,{value:Z,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...D,children:Z},Z):me===_.length-1?a.jsx(Zi,{value:Z,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...D,children:Z},Z):a.jsx(Zi,{value:Z,sx:{transform:"translateX(-50%)"},...D,children:Z},Z))}),a.jsx(jy,{...R,children:a.jsx(_y,{})}),a.jsx(Ut,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:w,...G,children:a.jsx(ky,{...N,zIndex:0})})]}),g&&a.jsxs(mg,{min:le,max:ae,step:d,value:se,onChange:re,onBlur:J,focusInputOnChange:!1,...O,children:[a.jsx(gg,{onKeyDown:K,onKeyUp:ne,minWidth:y,...T}),a.jsxs(hg,{...U,children:[a.jsx(bg,{onClick:X}),a.jsx(vg,{onClick:X})]})]}),x&&a.jsx(Fe,{size:"sm","aria-label":V("accessibility.reset"),tooltip:V("accessibility.reset"),icon:a.jsx(doe,{}),isDisabled:j,onClick:A,...q})]})]})});W8.displayName="IAISlider";const nt=i.memo(W8),V8=i.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Ut,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Ie,{ref:s,...o,children:a.jsxs(Ie,{children:[a.jsx(Oc,{children:e}),n&&a.jsx(Oc,{size:"xs",color:"base.600",children:n})]})})}));V8.displayName="IAIMantineSelectItemWithTooltip";const xl=i.memo(V8),foe=fe([pe],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}}),poe=()=>{const e=te(),{t}=W(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=H(foe),o=i.useRef(null),{boards:s,hasBoards:l}=Wd(void 0,{selectFromResult:({data:f})=>{const m=[{label:"None",value:"none"}];return f==null||f.forEach(({board_id:h,board_name:g})=>{m.push({label:g,value:h})}),{boards:m,hasBoards:m.length>1}}}),c=i.useCallback(f=>{f&&e(Kh(f))},[e]),d=i.useCallback((f,m)=>{var h;return((h=m.label)==null?void 0:h.toLowerCase().includes(f.toLowerCase().trim()))||m.value.toLowerCase().includes(f.toLowerCase().trim())},[]);return a.jsx(sn,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:xl,disabled:!l||r,filter:d,onChange:c})},moe=i.memo(poe),hoe=fe([pe],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}}),goe=()=>{const e=te(),{t}=W(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=H(hoe),s=i.useCallback(f=>{e(Fw(f))},[e]),l=i.useCallback(()=>{e(Fw(64))},[e]),c=i.useCallback(f=>{e(hA(f.target.checked))},[e]),d=i.useCallback(f=>e(gA(f.target.checked)),[e]);return a.jsx(xf,{triggerComponent:a.jsx(Fe,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(QM,{})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(nt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:l}),a.jsx(_n,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:c}),a.jsx(yr,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:d}),a.jsx(moe,{})]})})},voe=i.memo(goe),boe=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($,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(va,{size:"xl"})}),Tn=e=>{const{icon:t=si,boxSize:n=16,sx:r,...o}=e;return a.jsxs($,{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(An,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(be,{textAlign:"center",children:e.label})]})},U8=e=>{const{sx:t,...n}=e;return a.jsxs($,{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(va,{size:"xl"}),e.label&&a.jsx(be,{textAlign:"center",children:e.label})]})},Gb=(e,t)=>e>(t.endIndex-t.startIndex)/2+t.startIndex?"end":"start",lc=xA({virtuosoRef:void 0,virtuosoRangeRef:void 0}),xoe=fe([pe,kx],(e,t)=>{var j,_;const{data:n,status:r}=vA.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?zw.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):zw.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],l=r==="pending";if(!n||!s||(o==null?void 0:o.total)===0)return{isFetching:l,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const c={...t,offset:n.ids.length,limit:OI},d=bA.getSelectors(),f=d.selectAll(n),m=f.findIndex(I=>I.image_name===s.image_name),h=Zl(m+1,0,f.length-1),g=Zl(m-1,0,f.length-1),b=(j=f[h])==null?void 0:j.image_name,y=(_=f[g])==null?void 0:_.image_name,x=b?d.selectById(n,b):void 0,w=y?d.selectById(n,y):void 0,S=f.length;return{loadedImagesCount:f.length,currentImageIndex:m,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:x,prevImage:w,nextImageIndex:h,prevImageIndex:g,queryArgs:c}}),G8=()=>{const e=te(),{nextImage:t,nextImageIndex:n,prevImage:r,prevImageIndex:o,areMoreImagesAvailable:s,isFetching:l,queryArgs:c,loadedImagesCount:d,currentImageIndex:f}=H(xoe),m=i.useCallback(()=>{var w,S;r&&e(Bw(r));const y=(w=lc.get().virtuosoRangeRef)==null?void 0:w.current,x=(S=lc.get().virtuosoRef)==null?void 0:S.current;!y||!x||o!==void 0&&(o<y.startIndex||o>y.endIndex)&&x.scrollToIndex({index:o,behavior:"smooth",align:Gb(o,y)})},[e,r,o]),h=i.useCallback(()=>{var w,S;t&&e(Bw(t));const y=(w=lc.get().virtuosoRangeRef)==null?void 0:w.current,x=(S=lc.get().virtuosoRef)==null?void 0:S.current;!y||!x||n!==void 0&&(n<y.startIndex||n>y.endIndex)&&x.scrollToIndex({index:n,behavior:"smooth",align:Gb(n,y)})},[e,t,n]),[g]=DI(),b=i.useCallback(()=>{g(c)},[g,c]);return{handlePrevImage:m,handleNextImage:h,isOnFirstImage:f===0,isOnLastImage:f!==void 0&&f===d-1,nextImage:t,prevImage:r,areMoreImagesAvailable:s,handleLoadMoreImages:b,isFetching:l}},Xg=0,yl=1,lu=2,K8=4;function q8(e,t){return n=>e(t(n))}function yoe(e,t){return t(e)}function X8(e,t){return n=>e(t,n)}function Gj(e,t){return()=>e(t)}function Qg(e,t){return t(e),e}function Cn(...e){return e}function Coe(e){e()}function Kj(e){return()=>e}function woe(...e){return()=>{e.map(Coe)}}function p2(e){return e!==void 0}function iu(){}function Zt(e,t){return e(yl,t)}function St(e,t){e(Xg,t)}function m2(e){e(lu)}function to(e){return e(K8)}function at(e,t){return Zt(e,X8(t,Xg))}function ha(e,t){const n=e(yl,r=>{n(),t(r)});return n}function Nt(){const e=[];return(t,n)=>{switch(t){case lu:e.splice(0,e.length);return;case yl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Xg:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Be(e){let t=e;const n=Nt();return(r,o)=>{switch(r){case yl:o(t);break;case Xg:t=o;break;case K8:return t}return n(r,o)}}function Soe(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case yl:return s?n===s?void 0:(r(),n=s,t=Zt(e,s),t):(r(),iu);case lu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function ro(e){return Qg(Nt(),t=>at(e,t))}function wr(e,t){return Qg(Be(t),n=>at(e,n))}function koe(...e){return t=>e.reduceRight(yoe,t)}function Ee(e,...t){const n=koe(...t);return(r,o)=>{switch(r){case yl:return Zt(e,n(o));case lu:m2(e);return}}}function Q8(e,t){return e===t}function vn(e=Q8){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function gt(e){return t=>n=>{e(n)&&t(n)}}function Ze(e){return t=>q8(t,e)}function Zs(e){return t=>()=>t(e)}function js(e,t){return n=>r=>n(t=e(t,r))}function Fc(e){return t=>n=>{e>0?e--:t(n)}}function Qa(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function qj(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Pt(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,l)=>{const c=Math.pow(2,l);Zt(s,d=>{const f=n;n=n|c,t[l]=d,f!==o&&n===o&&r&&(r(),r=null)})}),s=>l=>{const c=()=>s([l].concat(t));n===o?c():r=c}}function Xj(...e){return function(t,n){switch(t){case yl:return woe(...e.map(r=>Zt(r,n)));case lu:return;default:throw new Error(`unrecognized action ${t}`)}}}function ht(e,t=Q8){return Ee(e,vn(t))}function er(...e){const t=Nt(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,l)=>{const c=Math.pow(2,l);Zt(s,d=>{n[l]=d,r=r|c,r===o&&St(t,n)})}),function(s,l){switch(s){case yl:return r===o&&l(n),Zt(t,l);case lu:return m2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Yt(e,t=[],{singleton:n}={singleton:!0}){return{id:joe(),constructor:e,dependencies:t,singleton:n}}const joe=()=>Symbol();function _oe(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:l})=>{if(l&&t.has(r))return t.get(r);const c=o(s.map(d=>n(d)));return l&&t.set(r,c),c};return n(e)}function Ioe(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const l in t)r.hasOwnProperty(l)||(n[l]=t[l]);return n}const Qp=typeof document<"u"?B.useLayoutEffect:B.useEffect;function Y8(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),c=B.createContext({});function d(x,w){x.propsReady&&St(x.propsReady,!1);for(const S of r){const j=x[t.required[S]];St(j,w[S])}for(const S of o)if(S in w){const j=x[t.optional[S]];St(j,w[S])}x.propsReady&&St(x.propsReady,!0)}function f(x){return s.reduce((w,S)=>(w[S]=j=>{const _=x[t.methods[S]];St(_,j)},w),{})}function m(x){return l.reduce((w,S)=>(w[S]=Soe(x[t.events[S]]),w),{})}return{Component:B.forwardRef((x,w)=>{const{children:S,...j}=x,[_]=B.useState(()=>Qg(_oe(e),E=>d(E,j))),[I]=B.useState(Gj(m,_));return Qp(()=>{for(const E of l)E in j&&Zt(I[E],j[E]);return()=>{Object.values(I).map(m2)}},[j,I,_]),Qp(()=>{d(_,j)}),B.useImperativeHandle(w,Kj(f(_))),B.createElement(c.Provider,{value:_},n?B.createElement(n,Ioe([...r,...o,...l],j),S):S)}),usePublisher:x=>B.useCallback(X8(St,B.useContext(c)[x]),[x]),useEmitterValue:x=>{const S=B.useContext(c)[x],[j,_]=B.useState(Gj(to,S));return Qp(()=>Zt(S,I=>{I!==j&&_(Kj(I))}),[S,j]),j},useEmitter:(x,w)=>{const j=B.useContext(c)[x];Qp(()=>Zt(j,w),[w,j])}}}const Poe=typeof document<"u"?B.useLayoutEffect:B.useEffect,Eoe=Poe;var oo=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(oo||{});const Moe={0:"debug",1:"log",2:"warn",3:"error"},Ooe=()=>typeof globalThis>"u"?window:globalThis,Cl=Yt(()=>{const e=Be(3);return{log:Be((n,r,o=1)=>{var s;const l=(s=Ooe().VIRTUOSO_LOG_LEVEL)!=null?s:to(e);o>=l&&console[Moe[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function h2(e,t=!0){const n=B.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=B.useMemo(()=>new ResizeObserver(s=>{const l=s[0].target;l.offsetParent!==null&&e(l)}),[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 mi(e,t=!0){return h2(e,t).callbackRef}function Doe(e,t,n,r,o,s,l){const c=B.useCallback(d=>{const f=Roe(d.children,t,"offsetHeight",o);let m=d.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=l?l.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,b=l?l.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=l?l.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:b,viewportHeight:y}),s==null||s(Aoe("row-gap",getComputedStyle(d).rowGap,o)),f!==null&&e(f)},[e,t,o,s,l,r]);return h2(c,n)}function Roe(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let l=0;l<o;l++){const c=e.item(l);if(!c||c.dataset.index===void 0)continue;const d=parseInt(c.dataset.index),f=parseFloat(c.dataset.knownSize),m=t(c,n);if(m===0&&r("Zero-sized element, this should not happen",{child:c},oo.ERROR),m===f)continue;const h=s[s.length-1];s.length===0||h.size!==m||h.endIndex!==d-1?s.push({startIndex:d,endIndex:d,size:m}):s[s.length-1].endIndex++}return s}function Aoe(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,oo.WARN),t==="normal"?0:parseInt(t??"0",10)}function dl(e,t){return Math.round(e.getBoundingClientRect()[t])}function Z8(e,t){return Math.abs(e-t)<1.01}function J8(e,t,n,r=iu,o){const s=B.useRef(null),l=B.useRef(null),c=B.useRef(null),d=B.useCallback(h=>{const g=h.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})};h.suppressFlushSync?S():yA.flushSync(S),l.current!==null&&(y===l.current||y<=0||y===x-w)&&(l.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);B.useEffect(()=>{const h=o||s.current;return r(o||s.current),d({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",d,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",d)}},[s,d,n,r,o]);function f(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const b=h.behavior==="smooth";let y,x,w;g===window?(x=Math.max(dl(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(x=g.scrollHeight,y=dl(g,"height"),w=g.scrollTop);const S=x-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),Z8(y,x)||h.top===w){e({scrollTop:w,scrollHeight:x,viewportHeight:y}),b&&t(!0);return}b?(l.current=h.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,t(!0)},1e3)):l.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:f}}const Ir=Yt(()=>{const e=Nt(),t=Nt(),n=Be(0),r=Nt(),o=Be(0),s=Nt(),l=Nt(),c=Be(0),d=Be(0),f=Be(0),m=Be(0),h=Nt(),g=Nt(),b=Be(!1);return at(Ee(e,Ze(({scrollTop:y})=>y)),t),at(Ee(e,Ze(({scrollHeight:y})=>y)),l),at(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:f,footerHeight:m,scrollHeight:l,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:b}},[],{singleton:!0}),Rd={lvl:0};function e7(e,t,n,r=Rd,o=Rd){return{k:e,v:t,lvl:n,l:r,r:o}}function on(e){return e===Rd}function Sc(){return Rd}function Kb(e,t){if(on(e))return Rd;const{k:n,l:r,r:o}=e;if(t===n){if(on(r))return o;if(on(o))return r;{const[s,l]=t7(r);return gm(Kn(e,{k:s,v:l,l:n7(r)}))}}else return t<n?gm(Kn(e,{l:Kb(r,t)})):gm(Kn(e,{r:Kb(o,t)}))}function Ad(e,t){if(!on(e))return t===e.k?e.v:t<e.k?Ad(e.l,t):Ad(e.r,t)}function us(e,t,n="k"){if(on(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=us(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return us(e.l,t,n)}function eo(e,t,n){return on(e)?e7(t,n,1):t===e.k?Kn(e,{k:t,v:n}):t<e.k?Qj(Kn(e,{l:eo(e.l,t,n)})):Qj(Kn(e,{r:eo(e.r,t,n)}))}function qb(e,t,n){if(on(e))return[];const{k:r,v:o,l:s,r:l}=e;let c=[];return r>t&&(c=c.concat(qb(s,t,n))),r>=t&&r<=n&&c.push({k:r,v:o}),r<=n&&(c=c.concat(qb(l,t,n))),c}function Hl(e){return on(e)?[]:[...Hl(e.l),{k:e.k,v:e.v},...Hl(e.r)]}function t7(e){return on(e.r)?[e.k,e.v]:t7(e.r)}function n7(e){return on(e.r)?e.l:gm(Kn(e,{r:n7(e.r)}))}function Kn(e,t){return e7(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 g1(e){return on(e)||e.lvl>e.r.lvl}function Qj(e){return Xb(o7(e))}function gm(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(g1(t))return o7(Kn(e,{lvl:r-1}));if(!on(t)&&!on(t.r))return Kn(t.r,{l:Kn(t,{r:t.r.l}),r:Kn(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(g1(e))return Xb(Kn(e,{lvl:r-1}));if(!on(n)&&!on(n.l)){const o=n.l,s=g1(o)?n.lvl-1:n.lvl;return Kn(o,{l:Kn(e,{r:o.l,lvl:r-1}),r:Xb(Kn(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Yg(e,t,n){if(on(e))return[];const r=us(e,t)[0];return Toe(qb(e,r,n))}function r7(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let l=1;l<n;l++){const{index:c,value:d}=t(e[l]);s.push({start:r,end:c-1,value:o}),r=c,o=d}return s.push({start:r,end:1/0,value:o}),s}function Toe(e){return r7(e,({k:t,v:n})=>({index:t,value:n}))}function Xb(e){const{r:t,lvl:n}=e;return!on(t)&&!on(t.r)&&t.lvl===n&&t.r.lvl===n?Kn(t,{l:Kn(e,{r:t.l}),lvl:n+1}):e}function o7(e){const{l:t}=e;return!on(t)&&t.lvl===e.lvl?Kn(t,{r:Kn(e,{l:t.r})}):e}function Nh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),l=e[s],c=n(l,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 s7(e,t,n){return e[Nh(e,t,n)]}function Noe(e,t,n,r){const o=Nh(e,t,r),s=Nh(e,n,r,o);return e.slice(o,s+1)}const g2=Yt(()=>({recalcInProgress:Be(!1)}),[],{singleton:!0});function $oe(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 Yj(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function Loe(e,t){let n=on(e)?0:1/0;for(const r of t){const{size:o,startIndex:s,endIndex:l}=r;if(n=Math.min(n,s),on(e)){e=eo(e,0,o);continue}const c=Yg(e,s-1,l+1);if(c.some($oe(r)))continue;let d=!1,f=!1;for(const{start:m,end:h,value:g}of c)d?(l>=m||o===g)&&(e=Kb(e,m)):(f=g!==o,d=!0),h>l&&l>=m&&g!==o&&(e=eo(e,l+1,g));f&&(e=eo(e,s,o))}return[e,n]}function Foe(){return{offsetTree:[],sizeTree:Sc(),groupOffsetTree:Sc(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function v2({index:e},t){return t===e?0:t<e?-1:1}function zoe({offset:e},t){return t===e?0:t<e?-1:1}function Boe(e){return{index:e.index,value:e}}function Hoe(e,t,n,r=0){return r>0&&(t=Math.max(t,s7(e,r,v2).offset)),r7(Noe(e,t,n,zoe),Boe)}function Qb(e,t,n,r){let o=e,s=0,l=0,c=0,d=0;if(t!==0){d=Nh(o,t-1,v2),c=o[d].offset;const m=us(n,t-1);s=m[0],l=m[1],o.length&&o[d].size===us(n,t)[1]&&(d-=1),o=o.slice(0,d+1)}else o=[];for(const{start:f,value:m}of Yg(n,t,1/0)){const h=f-s,g=h*l+c+h*r;o.push({offset:g,size:m,index:f}),s=f,c=g,l=m}return{offsetTree:o,lastIndex:s,lastOffset:c,lastSize:l}}function Woe(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,oo.DEBUG);const s=e.sizeTree;let l=s,c=0;if(n.length>0&&on(s)&&t.length===2){const g=t[0].size,b=t[1].size;l=n.reduce((y,x)=>eo(eo(y,x,g),x+1,b),l)}else[l,c]=Loe(l,t);if(l===s)return e;const{offsetTree:d,lastIndex:f,lastSize:m,lastOffset:h}=Qb(e.offsetTree,c,l,o);return{sizeTree:l,offsetTree:d,lastIndex:f,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,b)=>eo(g,b,Td(b,d,o)),Sc()),groupIndices:n}}function Td(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=s7(t,e,v2),l=e-o,c=s*l+(l-1)*n+r;return c>0?c+n:c}function Voe(e){return typeof e.groupIndex<"u"}function a7(e,t,n){if(Voe(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=l7(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function l7(e,t){if(!Zg(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Zg(e){return!on(e.groupOffsetTree)}function Uoe(e){return Hl(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],l=s?s.k-1:1/0;return{startIndex:t,endIndex:l,size:n}})}const Goe={offsetHeight:"height",offsetWidth:"width"},Bs=Yt(([{log:e},{recalcInProgress:t}])=>{const n=Nt(),r=Nt(),o=wr(r,0),s=Nt(),l=Nt(),c=Be(0),d=Be([]),f=Be(void 0),m=Be(void 0),h=Be((E,M)=>dl(E,Goe[M])),g=Be(void 0),b=Be(0),y=Foe(),x=wr(Ee(n,Pt(d,e,b),js(Woe,y),vn()),y),w=wr(Ee(d,vn(),js((E,M)=>({prev:E.current,current:M}),{prev:[],current:[]}),Ze(({prev:E})=>E)),[]);at(Ee(d,gt(E=>E.length>0),Pt(x,b),Ze(([E,M,D])=>{const R=E.reduce((N,O,T)=>eo(N,O,Td(O,M.offsetTree,D)||T),Sc());return{...M,groupIndices:E,groupOffsetTree:R}})),x),at(Ee(r,Pt(x),gt(([E,{lastIndex:M}])=>E<M),Ze(([E,{lastIndex:M,lastSize:D}])=>[{startIndex:E,endIndex:M,size:D}])),n),at(f,m);const S=wr(Ee(f,Ze(E=>E===void 0)),!0);at(Ee(m,gt(E=>E!==void 0&&on(to(x).sizeTree)),Ze(E=>[{startIndex:0,endIndex:0,size:E}])),n);const j=ro(Ee(n,Pt(x),js(({sizes:E},[M,D])=>({changed:D!==E,sizes:D}),{changed:!1,sizes:y}),Ze(E=>E.changed)));Zt(Ee(c,js((E,M)=>({diff:E.prev-M,prev:M}),{diff:0,prev:0}),Ze(E=>E.diff)),E=>{const{groupIndices:M}=to(x);if(E>0)St(t,!0),St(s,E+Yj(E,M));else if(E<0){const D=to(w);D.length>0&&(E-=Yj(-E,D)),St(l,E)}}),Zt(Ee(c,Pt(e)),([E,M])=>{E<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},oo.ERROR)});const _=ro(s);at(Ee(s,Pt(x),Ze(([E,M])=>{const D=M.groupIndices.length>0,R=[],N=M.lastSize;if(D){const O=Ad(M.sizeTree,0);let T=0,U=0;for(;T<E;){const Y=M.groupIndices[U],Q=M.groupIndices.length===U+1?1/0:M.groupIndices[U+1]-Y-1;R.push({startIndex:Y,endIndex:Y,size:O}),R.push({startIndex:Y+1,endIndex:Y+1+Q-1,size:N}),U++,T+=Q+1}const G=Hl(M.sizeTree);return T!==E&&G.shift(),G.reduce((Y,{k:Q,v:V})=>{let se=Y.ranges;return Y.prevSize!==0&&(se=[...Y.ranges,{startIndex:Y.prevIndex,endIndex:Q+E-1,size:Y.prevSize}]),{ranges:se,prevIndex:Q+E,prevSize:V}},{ranges:R,prevIndex:E,prevSize:0}).ranges}return Hl(M.sizeTree).reduce((O,{k:T,v:U})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+E-1,size:O.prevSize}],prevIndex:T+E,prevSize:U}),{ranges:[],prevIndex:0,prevSize:N}).ranges})),n);const I=ro(Ee(l,Pt(x,b),Ze(([E,{offsetTree:M},D])=>{const R=-E;return Td(R,M,D)})));return at(Ee(l,Pt(x,b),Ze(([E,M,D])=>{if(M.groupIndices.length>0){if(on(M.sizeTree))return M;let N=Sc();const O=to(w);let T=0,U=0,G=0;for(;T<-E;){G=O[U];const Y=O[U+1]-G-1;U++,T+=Y+1}if(N=Hl(M.sizeTree).reduce((Y,{k:Q,v:V})=>eo(Y,Math.max(0,Q+E),V),N),T!==-E){const Y=Ad(M.sizeTree,G);N=eo(N,0,Y);const Q=us(M.sizeTree,-E+1)[1];N=eo(N,1,Q)}return{...M,sizeTree:N,...Qb(M.offsetTree,0,N,D)}}else{const N=Hl(M.sizeTree).reduce((O,{k:T,v:U})=>eo(O,Math.max(0,T+E),U),Sc());return{...M,sizeTree:N,...Qb(M.offsetTree,0,N,D)}}})),x),{data:g,totalCount:r,sizeRanges:n,groupIndices:d,defaultItemSize:m,fixedItemSize:f,unshiftWith:s,shiftWith:l,shiftWithOffset:I,beforeUnshiftWith:_,firstItemIndex:c,gap:b,sizes:x,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},Cn(Cl,g2),{singleton:!0}),Koe=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function i7(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Koe)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const yf=Yt(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:l,smoothScrollTargetReached:c,headerHeight:d,footerHeight:f,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const b=Nt(),y=Be(0);let x=null,w=null,S=null;function j(){x&&(x(),x=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),St(o,!1)}return at(Ee(b,Pt(e,s,t,y,d,f,g),Pt(r,m,h),Ze(([[_,I,E,M,D,R,N,O],T,U,G])=>{const q=i7(_),{align:Y,behavior:Q,offset:V}=q,se=M-1,ee=a7(q,I,se);let le=Td(ee,I.offsetTree,T)+R;Y==="end"?(le+=U+us(I.sizeTree,ee)[1]-E+G,ee===se&&(le+=N)):Y==="center"?le+=(U+us(I.sizeTree,ee)[1]-E+G)/2:le-=D,V&&(le+=V);const ae=ce=>{j(),ce?(O("retrying to scroll to",{location:_},oo.DEBUG),St(b,_)):O("list did not change, scroll successful",{},oo.DEBUG)};if(j(),Q==="smooth"){let ce=!1;S=Zt(n,J=>{ce=ce||J}),x=ha(c,()=>{ae(ce)})}else x=ha(Ee(n,qoe(150)),ae);return w=setTimeout(()=>{j()},1200),St(o,!0),O("scrolling from index to",{index:ee,top:le,behavior:Q},oo.DEBUG),{top:le,behavior:Q}})),l),{scrollToIndex:b,topListHeight:y}},Cn(Bs,Ir,Cl),{singleton:!0});function qoe(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const Nd="up",fd="down",Xoe="none",Qoe={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Yoe=0,Cf=Yt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const l=Be(!1),c=Be(!0),d=Nt(),f=Nt(),m=Be(4),h=Be(Yoe),g=wr(Ee(Xj(Ee(ht(t),Fc(1),Zs(!0)),Ee(ht(t),Fc(1),Zs(!1),qj(100))),vn()),!1),b=wr(Ee(Xj(Ee(s,Zs(!0)),Ee(s,Zs(!1),qj(200))),vn()),!1);at(Ee(er(ht(t),ht(h)),Ze(([j,_])=>j<=_),vn()),c),at(Ee(c,Qa(50)),f);const y=ro(Ee(er(e,ht(n),ht(r),ht(o),ht(m)),js((j,[{scrollTop:_,scrollHeight:I},E,M,D,R])=>{const N=_+E-I>-R,O={viewportHeight:E,scrollTop:_,scrollHeight:I};if(N){let U,G;return _>j.state.scrollTop?(U="SCROLLED_DOWN",G=j.state.scrollTop-_):(U="SIZE_DECREASED",G=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:U,scrollTopDelta:G}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":E<j.state.viewportHeight?T="VIEWPORT_HEIGHT_DECREASING":_<j.state.scrollTop?T="SCROLLING_UPWARDS":T="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:T,state:O}},Qoe),vn((j,_)=>j&&j.atBottom===_.atBottom))),x=wr(Ee(e,js((j,{scrollTop:_,scrollHeight:I,viewportHeight:E})=>{if(Z8(j.scrollHeight,I))return{scrollTop:_,scrollHeight:I,jump:0,changed:!1};{const M=I-(_+E)<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}),gt(j=>j.changed),Ze(j=>j.jump)),0);at(Ee(y,Ze(j=>j.atBottom)),l),at(Ee(l,Qa(50)),d);const w=Be(fd);at(Ee(e,Ze(({scrollTop:j})=>j),vn(),js((j,_)=>to(b)?{direction:j.direction,prevScrollTop:_}:{direction:_<j.prevScrollTop?Nd:fd,prevScrollTop:_},{direction:fd,prevScrollTop:0}),Ze(j=>j.direction)),w),at(Ee(e,Qa(50),Zs(Xoe)),w);const S=Be(0);return at(Ee(g,gt(j=>!j),Zs(0)),S),at(Ee(t,Qa(100),Pt(g),gt(([j,_])=>!!_),js(([j,_],[I])=>[_,I],[0,0]),Ze(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:c,isAtBottom:l,atBottomState:y,atTopStateChange:f,atBottomStateChange:d,scrollDirection:w,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:x}},Cn(Ir)),wl=Yt(([{log:e}])=>{const t=Be(!1),n=ro(Ee(t,gt(r=>r),vn()));return Zt(t,r=>{r&&to(e)("props updated",{},oo.DEBUG)}),{propsReady:t,didMount:n}},Cn(Cl),{singleton:!0});function b2(e,t){e==0?t():requestAnimationFrame(()=>b2(e-1,t))}function x2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const wf=Yt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const l=Be(!0),c=Be(0),d=Be(!1);return at(Ee(s,Pt(c),gt(([f,m])=>!!m),Zs(!1)),l),Zt(Ee(er(t,s),Pt(l,e,n,d),gt(([[,f],m,{sizeTree:h},g,b])=>f&&(!on(h)||p2(g))&&!m&&!b),Pt(c)),([,f])=>{St(d,!0),b2(3,()=>{ha(r,()=>St(l,!0)),St(o,f)})}),{scrolledToInitialItem:l,initialTopMostItemIndex:c}},Cn(Bs,Ir,yf,wl),{singleton:!0});function Zj(e){return e?e==="smooth"?"smooth":"auto":!1}const Zoe=(e,t)=>typeof e=="function"?Zj(e(t)):t&&Zj(e),Joe=Yt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:l,didMount:c},{log:d},{scrollingInProgress:f}])=>{const m=Be(!1),h=Nt();let g=null;function b(x){St(o,{index:"LAST",align:"end",behavior:x})}Zt(Ee(er(Ee(ht(e),Fc(1)),c),Pt(ht(m),n,s,f),Ze(([[x,w],S,j,_,I])=>{let E=w&&_,M="auto";return E&&(M=Zoe(S,j||I),E=E&&!!M),{totalCount:x,shouldFollow:E,followOutputBehavior:M}}),gt(({shouldFollow:x})=>x)),({totalCount:x,followOutputBehavior:w})=>{g&&(g(),g=null),g=ha(t,()=>{to(d)("following output to ",{totalCount:x},oo.DEBUG),b(w),g=null})});function y(x){const w=ha(r,S=>{x&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(to(d)("scrolling to bottom due to increased size",{},oo.DEBUG),b("auto"))});setTimeout(w,100)}return Zt(Ee(er(ht(m),e,l),gt(([x,,w])=>x&&w),js(({value:x},[,w])=>({refreshed:x===w,value:w}),{refreshed:!1,value:0}),gt(({refreshed:x})=>x),Pt(m,e)),([,x])=>{y(x!==!1)}),Zt(h,()=>{y(to(m)!==!1)}),Zt(er(ht(m),r),([x,w])=>{x&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&b("auto")}),{followOutput:m,autoscrollToBottom:h}},Cn(Bs,Cf,yf,wf,wl,Cl,Ir));function ese(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const c7=Yt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Nt(),l=Nt(),c=ro(Ee(s,Ze(ese)));return at(Ee(c,Ze(d=>d.totalCount)),e),at(Ee(c,Ze(d=>d.groupIndices)),t),at(Ee(er(r,n,o),gt(([d,f])=>Zg(f)),Ze(([d,f,m])=>us(f.groupOffsetTree,Math.max(d-m,0),"v")[0]),vn(),Ze(d=>[d])),l),{groupCounts:s,topItemsIndexes:l}},Cn(Bs,Ir));function $d(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function u7(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const $h="top",Lh="bottom",Jj="none";function e_(e,t,n){return typeof e=="number"?n===Nd&&t===$h||n===fd&&t===Lh?e:0:n===Nd?t===$h?e.main:e.reverse:t===Lh?e.main:e.reverse}function t_(e,t){return typeof e=="number"?e:e[t]||0}const y2=Yt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Nt(),l=Be(0),c=Be(0),d=Be(0),f=wr(Ee(er(ht(e),ht(t),ht(r),ht(s,$d),ht(d),ht(l),ht(o),ht(n),ht(c)),Ze(([m,h,g,[b,y],x,w,S,j,_])=>{const I=m-j,E=w+S,M=Math.max(g-I,0);let D=Jj;const R=t_(_,$h),N=t_(_,Lh);return b-=j,b+=g+S,y+=g+S,y-=j,b>m+E-R&&(D=Nd),y<m-M+h+N&&(D=fd),D!==Jj?[Math.max(I-g-e_(x,$h,D)-R,0),I-M-S+h+e_(x,Lh,D)+N]:null}),gt(m=>m!=null),vn($d)),[0,0]);return{listBoundary:s,overscan:d,topListHeight:l,increaseViewportBy:c,visibleRange:f}},Cn(Ir),{singleton:!0});function tse(e,t,n){if(Zg(t)){const r=l7(e,t);return[{index:us(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 v1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function n_(e,t,n){if(e.length===0)return[];if(!Zg(t))return e.map(f=>({...f,index:f.index+n,originalIndex:f.index}));const r=e[0].index,o=e[e.length-1].index,s=[],l=Yg(t.groupOffsetTree,r,o);let c,d=0;for(const f of e){(!c||c.end<f.index)&&(c=l.shift(),d=t.groupIndices.indexOf(c.start));let m;f.index===c.start?m={type:"group",index:d}:m={index:f.index-(d+1)+n,groupIndex:d},s.push({...m,size:f.size,offset:f.offset,originalIndex:f.index,data:f.data})}return s}function vm(e,t,n,r,o,s){const{lastSize:l,lastOffset:c,lastIndex:d}=o;let f=0,m=0;if(e.length>0){f=e[0].offset;const x=e[e.length-1];m=x.offset+x.size}const h=n-d,g=c+h*l+(h-1)*r,b=f,y=g-m;return{items:n_(e,o,s),topItems:n_(t,o,s),topListHeight:t.reduce((x,w)=>w.size+x,0),offsetTop:f,offsetBottom:y,top:b,bottom:m,totalCount:n,firstItemIndex:s}}function d7(e,t,n,r,o,s){let l=0;if(n.groupIndices.length>0)for(const m of n.groupIndices){if(m-l>=e)break;l++}const c=e+l,d=x2(t,c),f=Array.from({length:c}).map((m,h)=>({index:h+d,size:0,offset:0,data:s[h+d]}));return vm(f,[],c,o,n,r)}const hi=Yt(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:l,listBoundary:c,topListHeight:d},{scrolledToInitialItem:f,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:b},{recalcInProgress:y}])=>{const x=Be([]),w=Be(0),S=Nt();at(s.topItemsIndexes,x);const j=wr(Ee(er(b,y,ht(l,$d),ht(t),ht(e),ht(m),f,ht(x),ht(r),ht(o),n),gt(([M,D,,R,,,,,,,N])=>{const O=N&&N.length!==R;return M&&!D&&!O}),Ze(([,,[M,D],R,N,O,T,U,G,q,Y])=>{const Q=N,{sizeTree:V,offsetTree:se}=Q,ee=to(w);if(R===0)return{...v1,totalCount:R};if(M===0&&D===0)return ee===0?{...v1,totalCount:R}:d7(ee,O,N,G,q,Y||[]);if(on(V))return ee>0?null:vm(tse(x2(O,R),Q,Y),[],R,q,Q,G);const le=[];if(U.length>0){const A=U[0],L=U[U.length-1];let K=0;for(const ne of Yg(V,A,L)){const z=ne.value,oe=Math.max(ne.start,A),X=Math.min(ne.end,L);for(let Z=oe;Z<=X;Z++)le.push({index:Z,size:z,offset:K,data:Y&&Y[Z]}),K+=z}}if(!T)return vm([],le,R,q,Q,G);const ae=U.length>0?U[U.length-1]+1:0,ce=Hoe(se,M,D,ae);if(ce.length===0)return null;const J=R-1,re=Qg([],A=>{for(const L of ce){const K=L.value;let ne=K.offset,z=L.start;const oe=K.size;if(K.offset<M){z+=Math.floor((M-K.offset+q)/(oe+q));const Z=z-L.start;ne+=Z*oe+Z*q}z<ae&&(ne+=(ae-z)*oe,z=ae);const X=Math.min(L.end,J);for(let Z=z;Z<=X&&!(ne>=D);Z++)A.push({index:Z,size:oe,offset:ne,data:Y&&Y[Z]}),ne+=oe+q}});return vm(re,le,R,q,Q,G)}),gt(M=>M!==null),vn()),v1);at(Ee(n,gt(p2),Ze(M=>M==null?void 0:M.length)),t),at(Ee(j,Ze(M=>M.topListHeight)),h),at(h,d),at(Ee(j,Ze(M=>[M.top,M.bottom])),c),at(Ee(j,Ze(M=>M.items)),S);const _=ro(Ee(j,gt(({items:M})=>M.length>0),Pt(t,n),gt(([{items:M},D])=>M[M.length-1].originalIndex===D-1),Ze(([,M,D])=>[M-1,D]),vn($d),Ze(([M])=>M))),I=ro(Ee(j,Qa(200),gt(({items:M,topItems:D})=>M.length>0&&M[0].originalIndex===D.length),Ze(({items:M})=>M[0].index),vn())),E=ro(Ee(j,gt(({items:M})=>M.length>0),Ze(({items:M})=>{let D=0,R=M.length-1;for(;M[D].type==="group"&&D<R;)D++;for(;M[R].type==="group"&&R>D;)R--;return{startIndex:M[D].index,endIndex:M[R].index}}),vn(u7)));return{listState:j,topItemsIndexes:x,endReached:_,startReached:I,rangeChanged:E,itemsRendered:S,initialItemCount:w,...g}},Cn(Bs,c7,y2,wf,yf,Cf,wl,g2),{singleton:!0}),nse=Yt(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:l},{didMount:c}])=>(at(Ee(c,Pt(s),gt(([,d])=>d!==0),Pt(o,e,t,r,n),Ze(([[,d],f,m,h,g,b=[]])=>d7(d,f,m,h,g,b))),l),{}),Cn(Bs,wf,hi,wl),{singleton:!0}),f7=Yt(([{scrollVelocity:e}])=>{const t=Be(!1),n=Nt(),r=Be(!1);return at(Ee(e,Pt(r,t,n),gt(([o,s])=>!!s),Ze(([o,s,l,c])=>{const{exit:d,enter:f}=s;if(l){if(d(o,c))return!1}else if(f(o,c))return!0;return l}),vn()),t),Zt(Ee(er(t,e,n),Pt(r)),([[o,s,l],c])=>o&&c&&c.change&&c.change(s,l)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Cn(Cf),{singleton:!0}),rse=Yt(([{topItemsIndexes:e}])=>{const t=Be(0);return at(Ee(t,gt(n=>n>0),Ze(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Cn(hi)),p7=Yt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Nt(),l=wr(Ee(er(e,r,t,n,o),Ze(([c,d,f,m,h])=>c+d+f+m+h.offsetBottom+h.bottom)),0);return at(ht(l),s),{totalListHeight:l,totalListHeightChanged:s}},Cn(Ir,hi),{singleton:!0});function m7(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const ose=m7(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),sse=Yt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:l,lastJumpDueToItemResize:c},{listState:d},{beforeUnshiftWith:f,shiftWithOffset:m,sizes:h,gap:g},{log:b},{recalcInProgress:y}])=>{const x=ro(Ee(d,Pt(c),js(([,S,j,_],[{items:I,totalCount:E,bottom:M,offsetBottom:D},R])=>{const N=M+D;let O=0;return j===E&&S.length>0&&I.length>0&&(I[0].originalIndex===0&&S[0].originalIndex===0||(O=N-_,O!==0&&(O+=R))),[O,I,E,N]},[0,[],0,0]),gt(([S])=>S!==0),Pt(t,l,r,s,b,y),gt(([,S,j,_,,,I])=>!I&&!_&&S!==0&&j===Nd),Ze(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},oo.DEBUG),S))));function w(S){S>0?(St(e,{top:-S,behavior:"auto"}),St(n,0)):(St(n,0),St(e,{top:-S,behavior:"auto"}))}return Zt(Ee(x,Pt(n,o)),([S,j,_])=>{_&&ose()?St(n,j-S):w(-S)}),Zt(Ee(er(wr(o,!1),n,y),gt(([S,j,_])=>!S&&!_&&j!==0),Ze(([S,j])=>j),Qa(1)),w),at(Ee(m,Ze(S=>({top:-S}))),e),Zt(Ee(f,Pt(h,g),Ze(([S,{lastSize:j,groupIndices:_,sizeTree:I},E])=>{function M(D){return D*(j+E)}if(_.length===0)return M(S);{let D=0;const R=Ad(I,0);let N=0,O=0;for(;N<S;){N++,D+=R;let T=_.length===O+1?1/0:_[O+1]-_[O]-1;N+T>S&&(D-=R,T=S-N+1),N+=T,D+=M(T),O++}return D}})),S=>{St(n,S),requestAnimationFrame(()=>{St(e,{top:S}),requestAnimationFrame(()=>{St(n,0),St(y,!1)})})}),{deviation:n}},Cn(Ir,Cf,hi,Bs,Cl,g2)),ase=Yt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Be(0);return Zt(Ee(e,Pt(r),gt(([,o])=>o!==0),Ze(([,o])=>({top:o}))),o=>{ha(Ee(n,Fc(1),gt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{St(t,o)})})}),{initialScrollTop:r}},Cn(wl,Ir,hi),{singleton:!0}),lse=Yt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Be(!1),r=wr(Ee(er(n,e,t),gt(([o])=>o),Ze(([,o,s])=>Math.max(0,o-s)),Qa(0),vn()),0);return{alignToBottom:n,paddingTopAddition:r}},Cn(Ir,p7),{singleton:!0}),C2=Yt(([{scrollTo:e,scrollContainerState:t}])=>{const n=Nt(),r=Nt(),o=Nt(),s=Be(!1),l=Be(void 0);return at(Ee(er(n,r),Ze(([{viewportHeight:c,scrollTop:d,scrollHeight:f},{offsetTop:m}])=>({scrollTop:Math.max(0,d-m),scrollHeight:f,viewportHeight:c}))),t),at(Ee(e,Pt(r),Ze(([c,{offsetTop:d}])=>({...c,top:c.top+d}))),o),{useWindowScroll:s,customScrollParent:l,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Cn(Ir)),ise=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...l}})=>e<n?{...l,behavior:o,align:s??"start"}:t>r?{...l,behavior:o,align:s??"end"}:null,cse=Yt(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:l,fixedFooterHeight:c,scrollingInProgress:d},{scrollToIndex:f}])=>{const m=Nt();return at(Ee(m,Pt(e,o,t,s,l,c,r),Pt(n),Ze(([[h,g,b,y,x,w,S,j],_])=>{const{done:I,behavior:E,align:M,calculateViewLocation:D=ise,...R}=h,N=a7(h,g,y-1),O=Td(N,g.offsetTree,_)+x+w,T=O+us(g.sizeTree,N)[1],U=j+w,G=j+b-S,q=D({itemTop:O,itemBottom:T,viewportTop:U,viewportBottom:G,locationParams:{behavior:E,align:M,...R}});return q?I&&ha(Ee(d,gt(Y=>Y===!1),Fc(to(d)?1:2)),I):I&&I(),q}),gt(h=>h!==null)),f),{scrollIntoView:m}},Cn(Bs,Ir,yf,hi,Cl),{singleton:!0}),use=Yt(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:l,windowViewportRect:c}])=>{const d=Nt(),f=Be(void 0),m=Be(null),h=Be(null);return at(l,m),at(c,h),Zt(Ee(d,Pt(e,n,s,m,h)),([g,b,y,x,w,S])=>{const j=Uoe(b.sizeTree);x&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),at(Ee(f,gt(p2),Ze(dse)),r),at(Ee(o,Pt(f),gt(([,g])=>g!==void 0),vn(),Ze(([,g])=>g.ranges)),t),{getState:d,restoreStateFrom:f}},Cn(Bs,Ir,wf,wl,C2));function dse(e){return{offset:e.scrollTop,index:0,align:"start"}}const fse=Yt(([e,t,n,r,o,s,l,c,d,f])=>({...e,...t,...n,...r,...o,...s,...l,...c,...d,...f}),Cn(y2,nse,wl,f7,p7,ase,lse,C2,cse,Cl)),pse=Yt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:l,firstItemIndex:c,groupIndices:d,statefulTotalCount:f,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:b},y,x,w,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:I},E,{topItemCount:M},{groupCounts:D},R])=>(at(_.rangeChanged,R.scrollSeekRangeChanged),at(Ee(R.windowViewportRect,Ze(N=>N.visibleHeight)),y.viewportHeight),{totalCount:e,data:l,firstItemIndex:c,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:b,topItemsIndexes:j,topItemCount:M,groupCounts:D,fixedItemHeight:n,defaultItemHeight:r,gap:m,...w,statefulTotalCount:f,listState:S,scrollToIndex:I,trackItemSizes:o,itemSize:s,groupIndices:d,..._,...R,...y,sizes:h,...x}),Cn(Bs,wf,Ir,use,Joe,hi,yf,sse,rse,c7,fse)),b1="-webkit-sticky",r_="sticky",h7=m7(()=>{if(typeof document>"u")return r_;const e=document.createElement("div");return e.style.position=b1,e.style.position===b1?b1:r_});function g7(e,t){const n=B.useRef(null),r=B.useCallback(c=>{if(c===null||!c.offsetParent)return;const d=c.getBoundingClientRect(),f=d.width;let m,h;if(t){const g=t.getBoundingClientRect(),b=d.top-g.top;m=g.height-Math.max(0,b),h=b+t.scrollTop}else m=window.innerHeight-Math.max(0,d.top),h=d.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:f},e(n.current)},[e,t]),{callbackRef:o,ref:s}=h2(r),l=B.useCallback(()=>{r(s.current)},[r,s]);return B.useEffect(()=>{if(t){t.addEventListener("scroll",l);const c=new ResizeObserver(l);return c.observe(t),()=>{t.removeEventListener("scroll",l),c.unobserve(t)}}else return window.addEventListener("scroll",l),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[l,t]),o}const v7=B.createContext(void 0),b7=B.createContext(void 0);function x7(e){return e}const mse=Yt(()=>{const e=Be(d=>`Item ${d}`),t=Be(null),n=Be(d=>`Group ${d}`),r=Be({}),o=Be(x7),s=Be("div"),l=Be(iu),c=(d,f=null)=>wr(Ee(r,Ze(m=>m[d]),vn()),f);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:l,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")}}),hse=Yt(([e,t])=>({...e,...t}),Cn(pse,mse)),gse=({height:e})=>B.createElement("div",{style:{height:e}}),vse={position:h7(),zIndex:1,overflowAnchor:"none"},bse={overflowAnchor:"none"},o_=B.memo(function({showTopList:t=!1}){const n=Tt("listState"),r=Co("sizeRanges"),o=Tt("useWindowScroll"),s=Tt("customScrollParent"),l=Co("windowScrollContainerState"),c=Co("scrollContainerState"),d=s||o?l:c,f=Tt("itemContent"),m=Tt("context"),h=Tt("groupContent"),g=Tt("trackItemSizes"),b=Tt("itemSize"),y=Tt("log"),x=Co("gap"),{callbackRef:w}=Doe(r,b,g,t?iu:d,y,x,s),[S,j]=B.useState(0);w2("deviation",q=>{S!==q&&j(q)});const _=Tt("EmptyPlaceholder"),I=Tt("ScrollSeekPlaceholder")||gse,E=Tt("ListComponent"),M=Tt("ItemComponent"),D=Tt("GroupComponent"),R=Tt("computeItemKey"),N=Tt("isSeeking"),O=Tt("groupIndices").length>0,T=Tt("paddingTopAddition"),U=Tt("scrolledToInitialItem"),G=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...U?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?B.createElement(_,Nr(_,m)):B.createElement(E,{...Nr(E,m),ref:w,style:G,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(q=>{const Y=q.originalIndex,Q=R(Y+n.firstItemIndex,q.data,m);return N?B.createElement(I,{...Nr(I,m),key:Q,index:q.index,height:q.size,type:q.type||"item",...q.type==="group"?{}:{groupIndex:q.groupIndex}}):q.type==="group"?B.createElement(D,{...Nr(D,m),key:Q,"data-index":Y,"data-known-size":q.size,"data-item-index":q.index,style:vse},h(q.index,m)):B.createElement(M,{...Nr(M,m),...Cse(M,q.data),key:Q,"data-index":Y,"data-known-size":q.size,"data-item-index":q.index,"data-item-group-index":q.groupIndex,style:bse},O?f(q.index,q.groupIndex,q.data,m):f(q.index,q.data,m))}))}),xse={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Jg={width:"100%",height:"100%",position:"absolute",top:0},yse={width:"100%",position:h7(),top:0,zIndex:1};function Nr(e,t){if(typeof e!="string")return{context:t}}function Cse(e,t){return{item:typeof e=="string"?void 0:t}}const wse=B.memo(function(){const t=Tt("HeaderComponent"),n=Co("headerHeight"),r=Tt("headerFooterTag"),o=mi(l=>n(dl(l,"height"))),s=Tt("context");return t?B.createElement(r,{ref:o},B.createElement(t,Nr(t,s))):null}),Sse=B.memo(function(){const t=Tt("FooterComponent"),n=Co("footerHeight"),r=Tt("headerFooterTag"),o=mi(l=>n(dl(l,"height"))),s=Tt("context");return t?B.createElement(r,{ref:o},B.createElement(t,Nr(t,s))):null});function y7({usePublisher:e,useEmitter:t,useEmitterValue:n}){return B.memo(function({style:s,children:l,...c}){const d=e("scrollContainerState"),f=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:b,scrollByCallback:y,scrollToCallback:x}=J8(d,m,f,h);return t("scrollTo",x),t("scrollBy",y),B.createElement(f,{ref:b,style:{...xse,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...c,...Nr(f,g)},l)})}function C7({usePublisher:e,useEmitter:t,useEmitterValue:n}){return B.memo(function({style:s,children:l,...c}){const d=e("windowScrollContainerState"),f=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),b=n("customScrollParent"),y=n("context"),{scrollerRef:x,scrollByCallback:w,scrollToCallback:S}=J8(d,m,f,iu,b);return Eoe(()=>(x.current=b||window,()=>{x.current=null}),[x,b]),t("windowScrollTo",S),t("scrollBy",w),B.createElement(f,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...c,...Nr(f,y)},l)})}const kse=({children:e})=>{const t=B.useContext(v7),n=Co("viewportHeight"),r=Co("fixedItemHeight"),o=mi(q8(n,s=>dl(s,"height")));return B.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),B.createElement("div",{style:Jg,ref:o,"data-viewport-type":"element"},e)},jse=({children:e})=>{const t=B.useContext(v7),n=Co("windowViewportRect"),r=Co("fixedItemHeight"),o=Tt("customScrollParent"),s=g7(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:Jg,"data-viewport-type":"window"},e)},_se=({children:e})=>{const t=Tt("TopItemListComponent"),n=Tt("headerHeight"),r={...yse,marginTop:`${n}px`},o=Tt("context");return B.createElement(t||"div",{style:r,context:o},e)},Ise=B.memo(function(t){const n=Tt("useWindowScroll"),r=Tt("topItemsIndexes").length>0,o=Tt("customScrollParent"),s=o||n?Mse:Ese,l=o||n?jse:kse;return B.createElement(s,{...t},r&&B.createElement(_se,null,B.createElement(o_,{showTopList:!0})),B.createElement(l,null,B.createElement(wse,null),B.createElement(o_,null),B.createElement(Sse,null)))}),{Component:Pse,usePublisher:Co,useEmitterValue:Tt,useEmitter:w2}=Y8(hse,{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"}},Ise),Ese=y7({usePublisher:Co,useEmitterValue:Tt,useEmitter:w2}),Mse=C7({usePublisher:Co,useEmitterValue:Tt,useEmitter:w2}),Ose=Pse,s_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Dse={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:a_,ceil:l_,floor:Fh,min:x1,max:pd}=Math;function Rse(e){return{...Dse,items:e}}function i_(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 Ase(e,t){return e&&e.column===t.column&&e.row===t.row}function Yp(e,t){return e&&e.width===t.width&&e.height===t.height}const Tse=Yt(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:l,smoothScrollTargetReached:c,scrollContainerState:d,footerHeight:f,headerHeight:m},h,g,{propsReady:b,didMount:y},{windowViewportRect:x,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},I])=>{const E=Be(0),M=Be(0),D=Be(s_),R=Be({height:0,width:0}),N=Be({height:0,width:0}),O=Nt(),T=Nt(),U=Be(0),G=Be(null),q=Be({row:0,column:0}),Y=Nt(),Q=Nt(),V=Be(!1),se=Be(0),ee=Be(!0),le=Be(!1);Zt(Ee(y,Pt(se),gt(([L,K])=>!!K)),()=>{St(ee,!1),St(M,0)}),Zt(Ee(er(y,ee,N,R,se,le),gt(([L,K,ne,z,,oe])=>L&&!K&&ne.height!==0&&z.height!==0&&!oe)),([,,,,L])=>{St(le,!0),b2(1,()=>{St(O,L)}),ha(Ee(r),()=>{St(n,[0,0]),St(ee,!0)})}),at(Ee(Q,gt(L=>L!=null&&L.scrollTop>0),Zs(0)),M),Zt(Ee(y,Pt(Q),gt(([,L])=>L!=null)),([,L])=>{L&&(St(R,L.viewport),St(N,L==null?void 0:L.item),St(q,L.gap),L.scrollTop>0&&(St(V,!0),ha(Ee(r,Fc(1)),K=>{St(V,!1)}),St(l,{top:L.scrollTop})))}),at(Ee(R,Ze(({height:L})=>L)),o),at(Ee(er(ht(R,Yp),ht(N,Yp),ht(q,(L,K)=>L&&L.column===K.column&&L.row===K.row),ht(r)),Ze(([L,K,ne,z])=>({viewport:L,item:K,gap:ne,scrollTop:z}))),Y),at(Ee(er(ht(E),t,ht(q,Ase),ht(N,Yp),ht(R,Yp),ht(G),ht(M),ht(V),ht(ee),ht(se)),gt(([,,,,,,,L])=>!L),Ze(([L,[K,ne],z,oe,X,Z,me,,ve,de])=>{const{row:ke,column:we}=z,{height:Re,width:Qe}=oe,{width:$e}=X;if(me===0&&(L===0||$e===0))return s_;if(Qe===0){const st=x2(de,L),mt=st===0?Math.max(me-1,0):st;return Rse(i_(st,mt,Z))}const vt=w7($e,Qe,we);let it,ot;ve?K===0&&ne===0&&me>0?(it=0,ot=me-1):(it=vt*Fh((K+ke)/(Re+ke)),ot=vt*l_((ne+ke)/(Re+ke))-1,ot=x1(L-1,pd(ot,vt-1)),it=x1(ot,pd(0,it))):(it=0,ot=-1);const Ce=i_(it,ot,Z),{top:Me,bottom:qe}=c_(X,z,oe,Ce),dt=l_(L/vt),Ue=dt*Re+(dt-1)*ke-qe;return{items:Ce,offsetTop:Me,offsetBottom:Ue,top:Me,bottom:qe,itemHeight:Re,itemWidth:Qe}})),D),at(Ee(G,gt(L=>L!==null),Ze(L=>L.length)),E),at(Ee(er(R,N,D,q),gt(([L,K,{items:ne}])=>ne.length>0&&K.height!==0&&L.height!==0),Ze(([L,K,{items:ne},z])=>{const{top:oe,bottom:X}=c_(L,z,K,ne);return[oe,X]}),vn($d)),n);const ae=Be(!1);at(Ee(r,Pt(ae),Ze(([L,K])=>K||L!==0)),ae);const ce=ro(Ee(ht(D),gt(({items:L})=>L.length>0),Pt(E,ae),gt(([{items:L},K,ne])=>ne&&L[L.length-1].index===K-1),Ze(([,L])=>L-1),vn())),J=ro(Ee(ht(D),gt(({items:L})=>L.length>0&&L[0].index===0),Zs(0),vn())),re=ro(Ee(ht(D),Pt(V),gt(([{items:L},K])=>L.length>0&&!K),Ze(([{items:L}])=>({startIndex:L[0].index,endIndex:L[L.length-1].index})),vn(u7),Qa(0)));at(re,g.scrollSeekRangeChanged),at(Ee(O,Pt(R,N,E,q),Ze(([L,K,ne,z,oe])=>{const X=i7(L),{align:Z,behavior:me,offset:ve}=X;let de=X.index;de==="LAST"&&(de=z-1),de=pd(0,de,x1(z-1,de));let ke=Yb(K,oe,ne,de);return Z==="end"?ke=a_(ke-K.height+ne.height):Z==="center"&&(ke=a_(ke-K.height/2+ne.height/2)),ve&&(ke+=ve),{top:ke,behavior:me}})),l);const A=wr(Ee(D,Ze(L=>L.offsetBottom+L.bottom)),0);return at(Ee(x,Ze(L=>({width:L.visibleWidth,height:L.visibleHeight}))),R),{data:G,totalCount:E,viewportDimensions:R,itemDimensions:N,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:l,scrollToIndex:O,smoothScrollTargetReached:c,windowViewportRect:x,windowScrollTo:_,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:U,scrollContainerState:d,footerHeight:f,headerHeight:m,initialItemCount:M,gap:q,restoreStateFrom:Q,...g,initialTopMostItemIndex:se,gridState:D,totalListHeight:A,...h,startReached:J,endReached:ce,rangeChanged:re,stateChanged:Y,propsReady:b,stateRestoreInProgress:V,...I}},Cn(y2,Ir,Cf,f7,wl,C2,Cl));function c_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Yb(e,t,n,r[0].index),l=Yb(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:l}}function Yb(e,t,n,r){const o=w7(e.width,n.width,t.column),s=Fh(r/o),l=s*n.height+pd(0,s-1)*t.row;return l>0?l+t.row:l}function w7(e,t,n){return pd(1,Fh((e+n)/(Fh(t)+n)))}const Nse=Yt(()=>{const e=Be(f=>`Item ${f}`),t=Be({}),n=Be(null),r=Be("virtuoso-grid-item"),o=Be("virtuoso-grid-list"),s=Be(x7),l=Be("div"),c=Be(iu),d=(f,m=null)=>wr(Ee(t,Ze(h=>h[f]),vn()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:l,scrollerRef:c,FooterComponent:d("Footer"),HeaderComponent:d("Header"),ListComponent:d("List","div"),ItemComponent:d("Item","div"),ScrollerComponent:d("Scroller","div"),ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),$se=Yt(([e,t])=>({...e,...t}),Cn(Tse,Nse)),Lse=B.memo(function(){const t=jn("gridState"),n=jn("listClassName"),r=jn("itemClassName"),o=jn("itemContent"),s=jn("computeItemKey"),l=jn("isSeeking"),c=ss("scrollHeight"),d=jn("ItemComponent"),f=jn("ListComponent"),m=jn("ScrollSeekPlaceholder"),h=jn("context"),g=ss("itemDimensions"),b=ss("gap"),y=jn("log"),x=jn("stateRestoreInProgress"),w=mi(S=>{const j=S.parentElement.parentElement.scrollHeight;c(j);const _=S.firstChild;if(_){const{width:I,height:E}=_.getBoundingClientRect();g({width:I,height:E})}b({row:u_("row-gap",getComputedStyle(S).rowGap,y),column:u_("column-gap",getComputedStyle(S).columnGap,y)})});return x?null:B.createElement(f,{ref:w,className:n,...Nr(f,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return l?B.createElement(m,{key:j,...Nr(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):B.createElement(d,{...Nr(d,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),Fse=B.memo(function(){const t=jn("HeaderComponent"),n=ss("headerHeight"),r=jn("headerFooterTag"),o=mi(l=>n(dl(l,"height"))),s=jn("context");return t?B.createElement(r,{ref:o},B.createElement(t,Nr(t,s))):null}),zse=B.memo(function(){const t=jn("FooterComponent"),n=ss("footerHeight"),r=jn("headerFooterTag"),o=mi(l=>n(dl(l,"height"))),s=jn("context");return t?B.createElement(r,{ref:o},B.createElement(t,Nr(t,s))):null}),Bse=({children:e})=>{const t=B.useContext(b7),n=ss("itemDimensions"),r=ss("viewportDimensions"),o=mi(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:Jg,ref:o},e)},Hse=({children:e})=>{const t=B.useContext(b7),n=ss("windowViewportRect"),r=ss("itemDimensions"),o=jn("customScrollParent"),s=g7(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:Jg},e)},Wse=B.memo(function({...t}){const n=jn("useWindowScroll"),r=jn("customScrollParent"),o=r||n?Gse:Use,s=r||n?Hse:Bse;return B.createElement(o,{...t},B.createElement(s,null,B.createElement(Fse,null),B.createElement(Lse,null),B.createElement(zse,null)))}),{Component:Vse,usePublisher:ss,useEmitterValue:jn,useEmitter:S7}=Y8($se,{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"}},Wse),Use=y7({usePublisher:ss,useEmitterValue:jn,useEmitter:S7}),Gse=C7({usePublisher:ss,useEmitterValue:jn,useEmitter:S7});function u_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,oo.WARN),t==="normal"?0:parseInt(t??"0",10)}const Kse=Vse,qse=e=>{const t=H(s=>s.gallery.galleryView),{data:n}=wx(e),{data:r}=Sx(e),o=i.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}},Xse=({imageDTO:e})=>a.jsx($,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Sa,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),Qse=i.memo(Xse),S2=({postUploadAction:e,isDisabled:t})=>{const n=H(d=>d.gallery.autoAddBoardId),[r]=CI(),o=i.useCallback(d=>{const f=d[0];f&&r({file:f,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:l,open:c}=Ey({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:l,openUploader:c}};function Yse(e){return De({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 Zse(e){return De({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 Jse(e){return De({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 k2(e){return De({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 j2(e){return De({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 k7(e){return De({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)}const eae=()=>{const{t:e}=W(),t=te(),n=H(x=>x.gallery.selection),r=qh(jx),o=Mt("bulkDownload").isFeatureEnabled,[s]=_x(),[l]=Ix(),[c]=EI(),d=i.useCallback(()=>{t(RI(n)),t(yx(!0))},[t,n]),f=i.useCallback(()=>{t(Xh(n))},[t,n]),m=i.useCallback(()=>{s({imageDTOs:n})},[s,n]),h=i.useCallback(()=>{l({imageDTOs:n})},[l,n]),g=i.useCallback(async()=>{try{const x=await c({image_names:n.map(w=>w.image_name)}).unwrap();t(lt({title:e("gallery.preparingDownload"),status:"success",...x.response?{description:x.response,duration:null,isClosable:!0}:{}}))}catch{t(lt({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,c,t]),b=i.useMemo(()=>n.every(x=>x.starred),[n]),y=i.useMemo(()=>n.every(x=>!x.starred),[n]);return a.jsxs(a.Fragment,{children:[b&&a.jsx(At,{icon:r?r.on.icon:a.jsx(k2,{}),onClickCapture:h,children:r?r.off.text:"Unstar All"}),(y||!b&&!y)&&a.jsx(At,{icon:r?r.on.icon:a.jsx(j2,{}),onClickCapture:m,children:r?r.on.text:"Star All"}),o&&a.jsx(At,{icon:a.jsx(ou,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(At,{icon:a.jsx(BM,{}),onClickCapture:d,children:e("boards.changeBoard")}),a.jsx(At,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(ao,{}),onClickCapture:f,children:e("gallery.deleteSelection")})]})},tae=i.memo(eae),nae=()=>i.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(l=>{o.toBlob(function(c){l(c)},"image/png")})))},r.crossOrigin=AI.get()?"use-credentials":"anonymous",r.src=t}),[]),j7=()=>{const e=zs(),{t}=W(),n=nae(),r=i.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=i.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 l=await n(s);if(!l)throw new Error("Unable to create Blob");CA(l),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(l){e({title:t("toast.problemCopyingImage"),description:String(l),status:"error",duration:2500,isClosable:!0})}},[n,r,t,e]);return{isClipboardAPIAvailable:r,copyImageToClipboard:o}};Px("gallery/requestedBoardImagesDeletion");const rae=Px("gallery/sentImageToCanvas"),_7=Px("gallery/sentImageToImg2Img"),oae=fe(pe,({generation:e})=>e.model),Sf=()=>{const e=te(),t=zs(),{t:n}=W(),r=H(oae),o=i.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=i.useCallback(A=>{t({title:n("toast.parameterNotSet"),description:A,status:"warning",duration:2500,isClosable:!0})},[n,t]),l=i.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),c=i.useCallback(A=>{t({title:n("toast.parametersNotSet"),status:"warning",description:A,duration:2500,isClosable:!0})},[n,t]),d=i.useCallback((A,L,K,ne)=>{if(bp(A)||xp(L)||Tu(K)||_v(ne)){bp(A)&&e(nd(A)),xp(L)&&e(rd(L)),Tu(K)&&e(od(K)),Tu(ne)&&e(sd(ne)),o();return}s()},[e,o,s]),f=i.useCallback(A=>{if(!bp(A)){s();return}e(nd(A)),o()},[e,o,s]),m=i.useCallback(A=>{if(!xp(A)){s();return}e(rd(A)),o()},[e,o,s]),h=i.useCallback(A=>{if(!Tu(A)){s();return}e(od(A)),o()},[e,o,s]),g=i.useCallback(A=>{if(!_v(A)){s();return}e(sd(A)),o()},[e,o,s]),b=i.useCallback(A=>{if(!Hw(A)){s();return}e(ym(A)),o()},[e,o,s]),y=i.useCallback(A=>{if(!Iv(A)){s();return}e(Cm(A)),o()},[e,o,s]),x=i.useCallback(A=>{if(!Ww(A)){s();return}e(wm(A)),o()},[e,o,s]),w=i.useCallback(A=>{if(!Vw(A)){s();return}e(N1(A)),o()},[e,o,s]),S=i.useCallback(A=>{if(!Pv(A)){s();return}e($1(A)),o()},[e,o,s]),j=i.useCallback(A=>{if(!Uw(A)&&!na(A)){s();return}na(A)?e(nc(null)):e(nc(A)),o()},[e,o,s]),_=i.useCallback(A=>{if(!Ev(A)){s();return}e(Sm(A)),o()},[e,o,s]),I=i.useCallback(A=>{if(!Mv(A)){s();return}e(Za(A)),o()},[e,o,s]),E=i.useCallback(A=>{if(!Ov(A)){s();return}e(Ja(A)),o()},[e,o,s]),M=i.useCallback((A,L)=>{if(!Mv(A)){c();return}if(!Ov(L)){c();return}e(Ja(L)),e(Za(A)),l()},[e,l,c]),D=i.useCallback(A=>{if(!yp(A)){s();return}e(km(A)),o()},[e,o,s]),R=i.useCallback(A=>{if(!Gw(A)){s();return}e(L1(A)),o()},[e,o,s]),N=i.useCallback(A=>{if(!yp(A)){s();return}e(jm(A)),o()},[e,o,s]),O=i.useCallback(A=>{if(!Kw(A)){s();return}e(F1(A)),o()},[e,o,s]),{data:T}=Vd(void 0),U=i.useCallback(A=>{if(!TI(A.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:L,model_name:K}=A.lora,ne=T?wA.getSelectors().selectById(T,`${L}/lora/${K}`):void 0;return ne?(ne==null?void 0:ne.base_model)===(r==null?void 0:r.base_model)?{lora:ne,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[T,r==null?void 0:r.base_model]),G=i.useCallback(A=>{const L=U(A);if(!L.lora){s(L.error);return}e(qw({...L.lora,weight:A.weight})),o()},[U,e,o,s]),{data:q}=Ex(void 0),Y=i.useCallback(A=>{if(!_m(A.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:L,control_model:K,control_weight:ne,begin_step_percent:z,end_step_percent:oe,control_mode:X,resize_mode:Z}=A,me=q?NI.getSelectors().selectById(q,`${K.base_model}/controlnet/${K.model_name}`):void 0;if(!me)return{controlnet:null,error:"ControlNet model is not installed"};if(!((me==null?void 0:me.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const de="none",ke=jr.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:me,weight:typeof ne=="number"?ne:Nu.weight,beginStepPct:z||Nu.beginStepPct,endStepPct:oe||Nu.endStepPct,controlMode:X||Nu.controlMode,resizeMode:Z||Nu.resizeMode,controlImage:(L==null?void 0:L.image_name)||null,processedControlImage:(L==null?void 0:L.image_name)||null,processorType:de,processorNode:ke,shouldAutoConfig:!0,id:Ya()},error:null}},[q,r==null?void 0:r.base_model]),Q=i.useCallback(A=>{const L=Y(A);if(!L.controlnet){s(L.error);return}e(Ti(L.controlnet)),o()},[Y,e,o,s]),{data:V}=Mx(void 0),se=i.useCallback(A=>{if(!_m(A.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:L,t2i_adapter_model:K,weight:ne,begin_step_percent:z,end_step_percent:oe,resize_mode:X}=A,Z=V?$I.getSelectors().selectById(V,`${K.base_model}/t2i_adapter/${K.model_name}`):void 0;if(!Z)return{controlnet:null,error:"ControlNet model is not installed"};if(!((Z==null?void 0:Z.base_model)===(r==null?void 0:r.base_model)))return{t2iAdapter:null,error:"ControlNet incompatible with currently-selected model"};const ve="none",de=jr.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:Z,weight:typeof ne=="number"?ne:Cp.weight,beginStepPct:z||Cp.beginStepPct,endStepPct:oe||Cp.endStepPct,resizeMode:X||Cp.resizeMode,controlImage:(L==null?void 0:L.image_name)||null,processedControlImage:(L==null?void 0:L.image_name)||null,processorType:ve,processorNode:de,shouldAutoConfig:!0,id:Ya()},error:null}},[r==null?void 0:r.base_model,V]),ee=i.useCallback(A=>{const L=se(A);if(!L.t2iAdapter){s(L.error);return}e(Ti(L.t2iAdapter)),o()},[se,e,o,s]),{data:le}=Ox(void 0),ae=i.useCallback(A=>{if(!SA(A==null?void 0:A.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:L,ip_adapter_model:K,weight:ne,begin_step_percent:z,end_step_percent:oe}=A,X=le?LI.getSelectors().selectById(le,`${K.base_model}/ip_adapter/${K.model_name}`):void 0;return X?(X==null?void 0:X.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:Ya(),type:"ip_adapter",isEnabled:!0,controlImage:(L==null?void 0:L.image_name)??null,model:X,weight:ne??Dv.weight,beginStepPct:z??Dv.beginStepPct,endStepPct:oe??Dv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[le,r==null?void 0:r.base_model]),ce=i.useCallback(A=>{const L=ae(A);if(!L.ipAdapter){s(L.error);return}e(Ti(L.ipAdapter)),o()},[ae,e,o,s]),J=i.useCallback(A=>{e(Qh(A))},[e]),re=i.useCallback(A=>{if(!A){c();return}const{cfg_scale:L,cfg_rescale_multiplier:K,height:ne,model:z,positive_prompt:oe,negative_prompt:X,scheduler:Z,vae:me,seed:ve,steps:de,width:ke,strength:we,hrf_enabled:Re,hrf_strength:Qe,hrf_method:$e,positive_style_prompt:vt,negative_style_prompt:it,refiner_model:ot,refiner_cfg_scale:Ce,refiner_steps:Me,refiner_scheduler:qe,refiner_positive_aesthetic_score:dt,refiner_negative_aesthetic_score:ye,refiner_start:Ue,loras:st,controlnets:mt,ipAdapters:Pe,t2iAdapters:Ne}=A;Iv(L)&&e(Cm(L)),Ww(K)&&e(wm(K)),Vw(z)&&e(N1(z)),bp(oe)&&e(nd(oe)),xp(X)&&e(rd(X)),Pv(Z)&&e($1(Z)),(Uw(me)||na(me))&&(na(me)?e(nc(null)):e(nc(me))),Hw(ve)&&e(ym(ve)),Ev(de)&&e(Sm(de)),Mv(ke)&&e(Za(ke)),Ov(ne)&&e(Ja(ne)),yp(we)&&e(km(we)),Gw(Re)&&e(L1(Re)),yp(Qe)&&e(jm(Qe)),Kw($e)&&e(F1($e)),Tu(vt)&&e(od(vt)),_v(it)&&e(sd(it)),kA(ot)&&e(FI(ot)),Ev(Me)&&e(z1(Me)),Iv(Ce)&&e(B1(Ce)),Pv(qe)&&e(zI(qe)),jA(dt)&&e(H1(dt)),_A(ye)&&e(W1(ye)),IA(Ue)&&e(V1(Ue)),e(PA()),st==null||st.forEach(kt=>{const Se=U(kt);Se.lora&&e(qw({...Se.lora,weight:kt.weight}))}),e(kI()),mt==null||mt.forEach(kt=>{const Se=Y(kt);Se.controlnet&&e(Ti(Se.controlnet))}),Pe==null||Pe.forEach(kt=>{const Se=ae(kt);Se.ipAdapter&&e(Ti(Se.ipAdapter))}),Ne==null||Ne.forEach(kt=>{const Se=se(kt);Se.t2iAdapter&&e(Ti(Se.t2iAdapter))}),l()},[e,l,c,U,Y,ae,se]);return{recallBothPrompts:d,recallPositivePrompt:f,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:b,recallCfgScale:y,recallCfgRescaleMultiplier:x,recallModel:w,recallScheduler:S,recallVaeModel:j,recallSteps:_,recallWidth:I,recallHeight:E,recallWidthAndHeight:M,recallStrength:D,recallHrfEnabled:R,recallHrfStrength:N,recallHrfMethod:O,recallLoRA:G,recallControlNet:Q,recallIPAdapter:ce,recallT2IAdapter:ee,recallAllParameters:re,sendToImageToImage:J}},I7=({onSuccess:e,onError:t})=>{const n=te(),r=zs(),{t:o}=W(),[s,l]=EA();return{getAndLoadEmbeddedWorkflow:i.useCallback(async d=>{try{const f=await s(d);n(Dx({workflow:f.data,asCopy:!0})),e&&e()}catch{r({title:o("toast.problemRetrievingWorkflow"),status:"error"}),t&&t()}},[s,n,e,r,o,t]),getAndLoadEmbeddedWorkflowResult:l}};function sae(e){return De({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 aae(e){return De({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 lae(e){return De({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 e0(e){return De({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 P7(e){return De({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 iae(e){return De({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M413.5 237.5c-28.2 4.8-58.2-3.6-80-25.4l-38.1-38.1C280.4 159 272 138.8 272 117.6V105.5L192.3 62c-5.3-2.9-8.6-8.6-8.3-14.7s3.9-11.5 9.5-14l47.2-21C259.1 4.2 279 0 299.2 0h18.1c36.7 0 72 14 98.7 39.1l44.6 42c24.2 22.8 33.2 55.7 26.6 86L503 183l8-8c9.4-9.4 24.6-9.4 33.9 0l24 24c9.4 9.4 9.4 24.6 0 33.9l-88 88c-9.4 9.4-24.6 9.4-33.9 0l-24-24c-9.4-9.4-9.4-24.6 0-33.9l8-8-17.5-17.5zM27.4 377.1L260.9 182.6c3.5 4.9 7.5 9.6 11.8 14l38.1 38.1c6 6 12.4 11.2 19.2 15.7L134.9 484.6c-14.5 17.4-36 27.4-58.6 27.4C34.1 512 0 477.8 0 435.7c0-22.6 10.1-44.1 27.4-58.6z"}}]})(e)}function cae(e){return De({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 uae(e){return De({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 dae(e,t,n){var r=this,o=i.useRef(null),s=i.useRef(0),l=i.useRef(null),c=i.useRef([]),d=i.useRef(),f=i.useRef(),m=i.useRef(e),h=i.useRef(!0);m.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;i.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var _=i.useMemo(function(){var I=function(O){var T=c.current,U=d.current;return c.current=d.current=null,s.current=O,f.current=m.current.apply(U,T)},E=function(O,T){b&&cancelAnimationFrame(l.current),l.current=b?requestAnimationFrame(O):setTimeout(O,T)},M=function(O){if(!h.current)return!1;var T=O-o.current;return!o.current||T>=t||T<0||w&&O-s.current>=j},D=function(O){return l.current=null,x&&c.current?I(O):(c.current=d.current=null,f.current)},R=function O(){var T=Date.now();if(M(T))return D(T);if(h.current){var U=t-(T-o.current),G=w?Math.min(U,j-(T-s.current)):U;E(O,G)}},N=function(){if(g||S){var O=Date.now(),T=M(O);if(c.current=[].slice.call(arguments),d.current=r,o.current=O,T){if(!l.current&&h.current)return s.current=o.current,E(R,t),y?I(o.current):f.current;if(w)return E(R,t),I(o.current)}return l.current||E(R,t),f.current}};return N.cancel=function(){l.current&&(b?cancelAnimationFrame(l.current):clearTimeout(l.current)),s.current=0,c.current=o.current=d.current=l.current=null},N.isPending=function(){return!!l.current},N.flush=function(){return l.current?D(Date.now()):f.current},N},[y,w,t,j,x,b,g,S]);return _}function fae(e,t){return e===t}function pae(e,t){return t}function kc(e,t,n){var r=n&&n.equalityFn||fae,o=i.useReducer(pae,e),s=o[0],l=o[1],c=dae(i.useCallback(function(f){return l(f)},[l]),t,n),d=i.useRef(e);return r(d.current,e)||(c(e),d.current=e),[s,c]}const _2=e=>{const t=H(s=>s.config.metadataFetchDebounce??300),[n]=kc(e,t),{data:r,isLoading:o}=BI(n??Br);return{metadata:r,isLoading:o}},mae=e=>{const{imageDTO:t}=e,n=te(),{t:r}=W(),o=zs(),s=Mt("unifiedCanvas").isFeatureEnabled,l=qh(jx),{metadata:c,isLoading:d}=_2(t==null?void 0:t.image_name),{getAndLoadEmbeddedWorkflow:f,getAndLoadEmbeddedWorkflowResult:m}=I7({}),h=i.useCallback(()=>{f(t.image_name)},[f,t.image_name]),[g]=_x(),[b]=Ix(),{isClipboardAPIAvailable:y,copyImageToClipboard:x}=j7(),w=i.useCallback(()=>{t&&n(Xh([t]))},[n,t]),{recallBothPrompts:S,recallSeed:j,recallAllParameters:_}=Sf(),I=i.useCallback(()=>{S(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,S]),E=i.useCallback(()=>{j(c==null?void 0:c.seed)},[c==null?void 0:c.seed,j]),M=i.useCallback(()=>{n(_7()),n(Qh(t))},[n,t]),D=i.useCallback(()=>{n(rae()),Jr.flushSync(()=>{n(Js("unifiedCanvas"))}),n(HI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),R=i.useCallback(()=>{_(c)},[c,_]),N=i.useCallback(()=>{n(RI([t])),n(yx(!0))},[n,t]),O=i.useCallback(()=>{x(t.image_url)},[x,t.image_url]),T=i.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]),U=i.useCallback(()=>{t&&b({imageDTOs:[t]})},[b,t]);return a.jsxs(a.Fragment,{children:[a.jsx(At,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(Xy,{}),children:r("common.openInNewTab")}),y&&a.jsx(At,{icon:a.jsx(ru,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(At,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(ou,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(At,{icon:m.isLoading?a.jsx(Zp,{}):a.jsx(e0,{}),onClickCapture:h,isDisabled:!t.has_workflow,children:r("nodes.loadWorkflow")}),a.jsx(At,{icon:d?a.jsx(Zp,{}):a.jsx(GM,{}),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(At,{icon:d?a.jsx(Zp,{}):a.jsx(KM,{}),onClickCapture:E,isDisabled:d||(c==null?void 0:c.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(At,{icon:d?a.jsx(Zp,{}):a.jsx(NM,{}),onClickCapture:R,isDisabled:d||!c,children:r("parameters.useAll")}),a.jsx(At,{icon:a.jsx(xj,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(At,{icon:a.jsx(xj,{}),onClickCapture:D,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(At,{icon:a.jsx(BM,{}),onClickCapture:N,children:r("boards.changeBoard")}),t.starred?a.jsx(At,{icon:l?l.off.icon:a.jsx(j2,{}),onClickCapture:U,children:l?l.off.text:r("gallery.unstarImage")}):a.jsx(At,{icon:l?l.on.icon:a.jsx(k2,{}),onClickCapture:T,children:l?l.on.text:r("gallery.starImage")}),a.jsx(At,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(ao,{}),onClickCapture:w,children:r("gallery.deleteImage")})]})},E7=i.memo(mae),Zp=()=>a.jsx($,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(va,{size:"xs"})}),hae=fe([pe],({gallery:e})=>({selectionCount:e.selection.length})),gae=({imageDTO:e,children:t})=>{const{selectionCount:n}=H(hae),r=i.useCallback(s=>{s.preventDefault()},[]),o=i.useCallback(()=>e?n>1?a.jsx(al,{sx:{visibility:"visible !important"},motionProps:Yl,onContextMenu:r,children:a.jsx(tae,{})}):a.jsx(al,{sx:{visibility:"visible !important"},motionProps:Yl,onContextMenu:r,children:a.jsx(E7,{imageDTO:e})}):null,[e,n,r]);return a.jsx(f2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:o,children:t})},vae=i.memo(gae),bae=e=>{const{data:t,disabled:n,...r}=e,o=i.useRef(Ya()),{attributes:s,listeners:l,setNodeRef:c}=Wre({id:o.current,disabled:n,data:t});return a.jsx(Ie,{ref:c,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...l,...r})},xae=i.memo(bae),yae=a.jsx(An,{as:$g,sx:{boxSize:16}}),Cae=a.jsx(Tn,{icon:si}),wae=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:l=!1,isUploadDisabled:c=!1,minSize:d=24,postUploadAction:f,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:b,dropLabel:y,isSelected:x=!1,thumbnail:w=!1,noContentFallback:S=Cae,uploadElement:j=yae,useThumbailFallback:_,withHoverOverlay:I=!1,children:E,onMouseOver:M,onMouseOut:D,dataTestId:R}=e,{colorMode:N}=ya(),[O,T]=i.useState(!1),U=i.useCallback(V=>{M&&M(V),T(!0)},[M]),G=i.useCallback(V=>{D&&D(V),T(!1)},[D]),{getUploadButtonProps:q,getUploadInputProps:Y}=S2({postUploadAction:f,isDisabled:c}),Q=c?{}:{cursor:"pointer",bg:Te("base.200","base.700")(N),_hover:{bg:Te("base.300","base.650")(N),color:Te("base.500","base.300")(N)}};return a.jsx(vae,{imageDTO:t,children:V=>a.jsxs($,{ref:V,onMouseOver:U,onMouseOut:G,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:d||void 0,minH:d||void 0,userSelect:"none",cursor:l||!t?"default":"pointer"},children:[t&&a.jsxs($,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(Ca,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(boe,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":R}),o&&a.jsx(Qse,{imageDTO:t}),a.jsx(d2,{isSelected:x,isHovered:I?O:!1})]}),!t&&!c&&a.jsx(a.Fragment,{children:a.jsxs($,{sx:{minH:d,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Te("base.500","base.500")(N),...Q},...q(),children:[a.jsx("input",{...Y()}),j]})}),!t&&c&&S,t&&!l&&a.jsx(xae,{data:b,disabled:l||!t,onClick:r}),E,!s&&a.jsx(u2,{data:g,disabled:s,dropLabel:y})]})})},fl=i.memo(wae),Sae=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=ia("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(Fe,{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})},jc=i.memo(Sae),kae=()=>a.jsx(wg,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),jae=i.memo(kae),_ae=fe([pe,kx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}}),Iae=e=>{const t=te(),{queryArgs:n,selection:r}=H(_ae),{imageDTOs:o}=WI(n,{selectFromResult:f=>({imageDTOs:f.data?MA.selectAll(f.data):[]})}),s=Mt("multiselect").isFeatureEnabled,l=i.useCallback(f=>{var m;if(e){if(!s){t($u([e]));return}if(f.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,b=o.findIndex(x=>x.image_name===g),y=o.findIndex(x=>x.image_name===h);if(b>-1&&y>-1){const x=Math.min(b,y),w=Math.max(b,y),S=o.slice(x,w+1);t($u(r.concat(S)))}}else f.ctrlKey||f.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t($u(r.filter(h=>h.image_name!==e.image_name))):t($u(r.concat(e))):t($u([e]))}},[t,e,o,r,s]),c=i.useMemo(()=>e?r.some(f=>f.image_name===e.image_name):!1,[e,r]),d=i.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:d,isSelected:c,handleClick:l}},Pae=(e,t,n,r)=>{const o=i.useRef(null);return i.useEffect(()=>{if(!e||n!==1||!r.rootRef.current||!r.virtuosoRef.current||!r.virtuosoRangeRef.current||!o.current)return;const s=o.current.getBoundingClientRect(),l=r.rootRef.current.getBoundingClientRect();s.top>=l.top&&s.bottom<=l.bottom&&s.left>=l.left&&s.right<=l.right||r.virtuosoRef.current.scrollToIndex({index:t,behavior:"smooth",align:Gb(t,r.virtuosoRangeRef.current)})},[e,t,n,r]),o},Eae=e=>{const t=te(),{imageName:n,virtuosoContext:r}=e,{currentData:o}=jo(n),s=H(R=>R.hotkeys.shift),{t:l}=W(),{handleClick:c,isSelected:d,selection:f,selectionCount:m}=Iae(o),h=qh(jx),g=Pae(d,e.index,m,r),b=i.useCallback(R=>{R.stopPropagation(),o&&t(Xh([o]))},[t,o]),y=i.useMemo(()=>{if(m>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:f}};if(o)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[o,f,m]),[x]=_x(),[w]=Ix(),S=i.useCallback(()=>{o&&(o.starred&&w({imageDTOs:[o]}),o.starred||x({imageDTOs:[o]}))},[x,w,o]),[j,_]=i.useState(!1),I=i.useCallback(()=>{_(!0)},[]),E=i.useCallback(()=>{_(!1)},[]),M=i.useMemo(()=>{if(o!=null&&o.starred)return h?h.on.icon:a.jsx(j2,{size:"20"});if(!(o!=null&&o.starred)&&j)return h?h.off.icon:a.jsx(k2,{size:"20"})},[o==null?void 0:o.starred,j,h]),D=i.useMemo(()=>o!=null&&o.starred?h?h.off.text:"Unstar":o!=null&&o.starred?"":h?h.on.text:"Star",[o==null?void 0:o.starred,h]);return o?a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${o.image_name}`,children:a.jsx($,{ref:g,userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(fl,{onClick:c,imageDTO:o,draggableData:y,isSelected:d,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:I,onMouseOut:E,children:a.jsxs(a.Fragment,{children:[a.jsx(jc,{onClick:S,icon:M,tooltip:D}),j&&s&&a.jsx(jc,{onClick:b,icon:a.jsx(ao,{}),tooltip:l("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(jae,{})},Mae=i.memo(Eae),Oae=_e((e,t)=>a.jsx(Ie,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),Dae=i.memo(Oae),Rae=_e((e,t)=>{const n=H(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(sl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Aae=i.memo(Rae),Tae={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Nae=()=>{const{t:e}=W(),t=i.useRef(null),[n,r]=i.useState(null),[o,s]=c2(Tae),l=H(E=>E.gallery.selectedBoardId),{currentViewTotal:c}=qse(l),d=H(kx),f=i.useRef(null),m=i.useRef(null),{currentData:h,isFetching:g,isSuccess:b,isError:y}=WI(d),[x]=DI(),w=i.useMemo(()=>!h||!c?!1:h.ids.length<c,[h,c]),S=i.useCallback(()=>{w&&x({...d,offset:(h==null?void 0:h.ids.length)??0,limit:OI})},[w,x,d,h==null?void 0:h.ids.length]),j=i.useMemo(()=>({virtuosoRef:m,rootRef:t,virtuosoRangeRef:f}),[]),_=i.useCallback((E,M,D)=>a.jsx(Mae,{index:E,imageName:M,virtuosoContext:D},M),[]);i.useEffect(()=>{const{current:E}=t;return n&&E&&o({target:E,elements:{viewport:n}}),()=>{var M;return(M=s())==null?void 0:M.destroy()}},[n,o,s]);const I=i.useCallback(E=>{f.current=E},[]);return i.useEffect(()=>{lc.setKey("virtuosoRef",m),lc.setKey("virtuosoRangeRef",f)},[]),h?b&&(h==null?void 0:h.ids.length)===0?a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Tn,{label:e("gallery.noImagesInGallery"),icon:si})}):b&&h?a.jsxs(a.Fragment,{children:[a.jsx(Ie,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(Kse,{style:{height:"100%"},data:h.ids,endReached:S,components:{Item:Dae,List:Aae},scrollerRef:r,itemContent:_,ref:m,rangeChanged:I,context:j,overscan:10})}),a.jsx(Xe,{onClick:S,isDisabled:!w,isLoading:g,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${h.ids.length} of ${c})`})]}):y?a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsx(Tn,{label:e("gallery.unableToLoad"),icon:kte})}):null:a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Tn,{label:e("gallery.loading"),icon:si})})},$ae=i.memo(Nae),Lae=fe([pe],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}}),Fae=()=>{const{t:e}=W(),t=i.useRef(null),n=i.useRef(null),{galleryView:r}=H(Lae),o=te(),{isOpen:s,onToggle:l}=sr({defaultIsOpen:!0}),c=i.useCallback(()=>{o(Xw("images"))},[o]),d=i.useCallback(()=>{o(Xw("assets"))},[o]);return a.jsxs(F5,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Ie,{sx:{w:"full"},children:[a.jsxs($,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(ioe,{isOpen:s,onToggle:l}),a.jsx(voe,{})]}),a.jsx(Ie,{children:a.jsx(soe,{isOpen:s})})]}),a.jsxs($,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx($,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(ci,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(ui,{children:a.jsxs($t,{isAttached:!0,sx:{w:"full"},children:[a.jsx(mr,{as:Xe,size:"sm",isChecked:r==="images",onClick:c,sx:{w:"full"},leftIcon:a.jsx(Tte,{}),"data-testid":"images-tab",children:e("parameters.images")}),a.jsx(mr,{as:Xe,size:"sm",isChecked:r==="assets",onClick:d,sx:{w:"full"},leftIcon:a.jsx(Gte,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx($ae,{})]})]})},zae=i.memo(Fae),Bae={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"}},Hae=1e3,Wae=[{name:"preventOverflow",options:{padding:10}}],M7=_e(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=W(),l=H(g=>g.system.shouldEnableInformationalPopovers),c=i.useMemo(()=>Bae[e],[e]),d=i.useMemo(()=>OA(DA(c,["image","href","buttonLabel"]),r),[c,r]),f=i.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=i.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=i.useCallback(()=>{c!=null&&c.href&&window.open(c.href)},[c==null?void 0:c.href]);return l?a.jsxs(lf,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:Hae,modifiers:Wae,placement:"top",...d,children:[a.jsx(yg,{children:a.jsx(Ie,{ref:o,w:"full",...n,children:t})}),a.jsx(Uc,{children:a.jsxs(cf,{w:96,children:[a.jsx(h6,{}),a.jsx(Cg,{children:a.jsxs($,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[f&&a.jsxs(a.Fragment,{children:[a.jsx(or,{size:"sm",children:f}),a.jsx(On,{})]}),(c==null?void 0:c.image)&&a.jsxs(a.Fragment,{children:[a.jsx(Ca,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:c.image,alt:"Optional Image"}),a.jsx(On,{})]}),m.map(g=>a.jsx(be,{children:g},g)),(c==null?void 0:c.href)&&a.jsxs(a.Fragment,{children:[a.jsx(On,{}),a.jsx(ol,{pt:1,onClick:h,leftIcon:a.jsx(Xy,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??f})]})]})})]})})]}):a.jsx(Ie,{ref:o,w:"full",...n,children:t})});M7.displayName="IAIInformationalPopover";const Ot=i.memo(M7),I2=e=>{e.stopPropagation()},zh=/^-?(0\.)?\.?$/,O7=_e((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:l,onChange:c,min:d,max:f,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:b,numberInputStepperProps:y,tooltipProps:x,...w}=e,S=te(),[j,_]=i.useState(String(l));i.useEffect(()=>{!j.match(zh)&&l!==Number(j)&&_(String(l))},[l,j]);const I=i.useCallback(R=>{_(R),R.match(zh)||c(m?Math.floor(Number(R)):Number(R))},[m,c]),E=i.useCallback(R=>{const N=Zl(m?Math.floor(Number(R.target.value)):Number(R.target.value),d,f);_(String(N)),c(N)},[m,f,d,c]),M=i.useCallback(R=>{R.shiftKey&&S(zr(!0))},[S]),D=i.useCallback(R=>{R.shiftKey||S(zr(!1))},[S]);return a.jsx(Ut,{...x,children:a.jsxs(Gt,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(ln,{...g,children:n}),a.jsxs(mg,{value:j,min:d,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:I,onBlur:E,...w,onPaste:I2,children:[a.jsx(gg,{...b,onKeyDown:M,onKeyUp:D}),o&&a.jsxs(hg,{children:[a.jsx(bg,{...y}),a.jsx(vg,{...y})]})]})]})})});O7.displayName="IAINumberInput";const _s=i.memo(O7),Vae=fe([pe],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:l}=e.config.sd.iterations,{iterations:c}=e.generation,{shouldUseSliders:d}=e.ui,f=e.hotkeys.shift?s:l;return{iterations:c,initial:t,min:n,sliderMax:r,inputMax:o,step:f,shouldUseSliders:d}}),Uae=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:l,shouldUseSliders:c}=H(Vae),d=te(),{t:f}=W(),m=i.useCallback(g=>{d(Qw(g))},[d]),h=i.useCallback(()=>{d(Qw(n))},[d,n]);return e||c?a.jsx(Ot,{feature:"paramIterations",children:a.jsx(nt,{label:f("parameters.iterations"),step:l,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(Ot,{feature:"paramIterations",children:a.jsx(_s,{label:f("parameters.iterations"),step:l,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},ds=i.memo(Uae),Gae=()=>{const e=H(f=>f.system.isConnected),{data:t}=Ls(),[n,{isLoading:r}]=Rx(),o=te(),{t:s}=W(),l=i.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),c=i.useCallback(async()=>{if(l)try{await n(l).unwrap(),o(lt({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(lt({title:s("queue.cancelFailed"),status:"error"}))}},[l,o,s,n]),d=i.useMemo(()=>!e||na(l),[e,l]);return{cancelQueueItem:c,isLoading:r,currentQueueItemId:l,isDisabled:d}},Kae=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:l,isLoading:c,loadingText:d,sx:f})=>l?a.jsx(Fe,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,sx:f,"data-testid":e}):a.jsx(Xe,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:c,loadingText:d??e,flexGrow:1,sx:f,"data-testid":e,children:e}),gi=i.memo(Kae),qae=({asIconButton:e,sx:t})=>{const{t:n}=W(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Gae();return a.jsx(gi,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(Nc,{}),onClick:r,colorScheme:"error",sx:t})},D7=i.memo(qae),Xae=()=>{const{t:e}=W(),t=te(),{data:n}=Ls(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=VI({fixedCacheKey:"clearQueue"}),l=i.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(lt({title:e("queue.clearSucceeded"),status:"success"})),t(Ax(void 0)),t(Tx(void 0))}catch{t(lt({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),c=i.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:l,isLoading:s,queueStatus:n,isDisabled:c}},Qae=_e((e,t)=>{const{t:n}=W(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:l,children:c,title:d,triggerComponent:f}=e,{isOpen:m,onOpen:h,onClose:g}=sr(),b=i.useRef(null),y=i.useCallback(()=>{o(),g()},[o,g]),x=i.useCallback(()=>{l&&l(),g()},[l,g]);return a.jsxs(a.Fragment,{children:[i.cloneElement(f,{onClick:h,ref:t}),a.jsx(Zc,{isOpen:m,leastDestructiveRef:b,onClose:g,isCentered:!0,children:a.jsx(Eo,{children:a.jsxs(Jc,{children:[a.jsx(Po,{fontSize:"lg",fontWeight:"bold",children:d}),a.jsx(Mo,{children:c}),a.jsxs(ls,{children:[a.jsx(Xe,{ref:b,onClick:x,children:s}),a.jsx(Xe,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),t0=i.memo(Qae),Yae=({asIconButton:e,sx:t})=>{const{t:n}=W(),{clearQueue:r,isLoading:o,isDisabled:s}=Xae();return a.jsxs(t0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(gi,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(ao,{}),colorScheme:"error",sx:t}),children:[a.jsx(be,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(be,{children:n("queue.clearQueueAlertDialog2")})]})},P2=i.memo(Yae),Zae=()=>{const e=te(),{t}=W(),n=H(f=>f.system.isConnected),{data:r}=Ls(),[o,{isLoading:s}]=UI({fixedCacheKey:"pauseProcessor"}),l=i.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),c=i.useCallback(async()=>{if(l)try{await o().unwrap(),e(lt({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(lt({title:t("queue.pauseFailed"),status:"error"}))}},[l,o,e,t]),d=i.useMemo(()=>!n||!l,[n,l]);return{pauseProcessor:c,isLoading:s,isStarted:l,isDisabled:d}},Jae=({asIconButton:e})=>{const{t}=W(),{pauseProcessor:n,isLoading:r,isDisabled:o}=Zae();return a.jsx(gi,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(Bte,{}),onClick:n,colorScheme:"gold"})},R7=i.memo(Jae),ele=fe([pe,tr],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:l,model:c}=t,{isConnected:d}=n,f=[];return d||f.push(wt.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!l&&f.push(wt.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||f.push(wt.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(m=>{if(!Jt(m))return;const h=r.nodeTemplates[m.data.type];if(!h){f.push(wt.t("parameters.invoke.missingNodeTemplate"));return}const g=RA([m],r.edges);qn(m.data.inputs,b=>{const y=h.inputs[b.name],x=g.some(w=>w.target===m.id&&w.targetHandle===b.name);if(!y){f.push(wt.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&b.value===void 0&&!x){f.push(wt.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:b.label||y.title}));return}})})):(o.prompts.length===0&&f.push(wt.t("parameters.invoke.noPrompts")),c||f.push(wt.t("parameters.invoke.noModelSelected")),AA(e).forEach((m,h)=>{m.isEnabled&&(m.model?m.model.base_model!==(c==null?void 0:c.base_model)&&f.push(wt.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:h+1})):f.push(wt.t("parameters.invoke.noModelForControlAdapter",{number:h+1})),(!m.controlImage||Gc(m)&&!m.processedControlImage&&m.processorType!=="none")&&f.push(wt.t("parameters.invoke.noControlImageForControlAdapter",{number:h+1})))})),{isReady:!f.length,reasons:f}}),E2=()=>{const{isReady:e,reasons:t}=H(ele);return{isReady:e,reasons:t}},A7=()=>{const e=te(),t=H(tr),{isReady:n}=E2(),[r,{isLoading:o}]=Yh({fixedCacheKey:"enqueueBatch"}),s=i.useMemo(()=>!n,[n]);return{queueBack:i.useCallback(()=>{s||(e(Nx()),e(GI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},tle=fe([pe],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}}),nle=({prepend:e=!1})=>{const{t}=W(),{isReady:n,reasons:r}=E2(),{autoAddBoardId:o}=H(tle),s=qg(o),[l,{isLoading:c}]=Yh({fixedCacheKey:"enqueueBatch"}),d=i.useMemo(()=>t(c?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[c,n,e,t]);return a.jsxs($,{flexDir:"column",gap:1,children:[a.jsx(be,{fontWeight:600,children:d}),r.length>0&&a.jsx(cg,{children:r.map((f,m)=>a.jsx(ts,{children:a.jsx(be,{fontWeight:400,children:f})},`${f}.${m}`))}),a.jsx(N7,{}),a.jsxs(be,{fontWeight:400,fontStyle:"oblique 10deg",children:[t("parameters.invoke.addingImagesTo")," ",a.jsx(be,{as:"span",fontWeight:600,children:s||t("boards.uncategorized")})]})]})},T7=i.memo(nle),N7=i.memo(()=>a.jsx(On,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));N7.displayName="StyledDivider";const rle=()=>a.jsx(Ie,{pos:"relative",w:4,h:4,children:a.jsx(Ca,{src:Cx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),ole=i.memo(rle),sle=({asIconButton:e,sx:t})=>{const{t:n}=W(),{queueBack:r,isLoading:o,isDisabled:s}=A7();return a.jsx(gi,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(T7,{}),sx:t,icon:e?a.jsx(ole,{}):void 0})},$7=i.memo(sle),L7=()=>{const e=te(),t=H(tr),{isReady:n}=E2(),[r,{isLoading:o}]=Yh({fixedCacheKey:"enqueueBatch"}),s=Mt("prependQueue").isFeatureEnabled,l=i.useMemo(()=>!n||!s,[n,s]);return{queueFront:i.useCallback(()=>{l||(e(Nx()),e(GI({tabName:t,prepend:!0})))},[e,l,t]),isLoading:o,isDisabled:l}},ale=({asIconButton:e,sx:t})=>{const{t:n}=W(),{queueFront:r,isLoading:o,isDisabled:s}=L7();return a.jsx(gi,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(T7,{prepend:!0}),icon:a.jsx(aae,{}),sx:t})},lle=i.memo(ale),ile=()=>{const e=te(),t=H(f=>f.system.isConnected),{data:n}=Ls(),{t:r}=W(),[o,{isLoading:s}]=KI({fixedCacheKey:"resumeProcessor"}),l=i.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),c=i.useCallback(async()=>{if(!l)try{await o().unwrap(),e(lt({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(lt({title:r("queue.resumeFailed"),status:"error"}))}},[l,o,e,r]),d=i.useMemo(()=>!t||l,[t,l]);return{resumeProcessor:c,isLoading:s,isStarted:l,isDisabled:d}},cle=({asIconButton:e})=>{const{t}=W(),{resumeProcessor:n,isLoading:r,isDisabled:o}=ile();return a.jsx(gi,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(Hte,{}),onClick:n,colorScheme:"green"})},F7=i.memo(cle),ule=fe(pe,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}}),dle=()=>{const{t:e}=W(),{data:t}=Ls(),{hasSteps:n,value:r,isConnected:o}=H(ule);return a.jsx(x6,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},fle=i.memo(dle),ple=()=>{const e=Mt("pauseQueue").isFeatureEnabled,t=Mt("resumeQueue").isFeatureEnabled,n=Mt("prependQueue").isFeatureEnabled;return a.jsxs($,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs($,{gap:2,w:"full",children:[a.jsxs($t,{isAttached:!0,flexGrow:2,children:[a.jsx($7,{}),n?a.jsx(lle,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(D7,{asIconButton:!0})]}),a.jsxs($t,{isAttached:!0,children:[t?a.jsx(F7,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(R7,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(P2,{asIconButton:!0})]}),a.jsx($,{h:3,w:"full",children:a.jsx(fle,{})}),a.jsx(B7,{})]})},z7=i.memo(ple),B7=i.memo(()=>{const{t:e}=W(),t=te(),{hasItems:n,pending:r}=Ls(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:l,in_progress:c}=s.queue;return{hasItems:l+c>0,pending:l}}}),o=i.useCallback(()=>{t(Js("queue"))},[t]);return a.jsxs($,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(Wr,{}),a.jsx(ol,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});B7.displayName="QueueCounts";const{createElement:zc,createContext:mle,forwardRef:H7,useCallback:Qs,useContext:W7,useEffect:la,useImperativeHandle:V7,useLayoutEffect:hle,useMemo:gle,useRef:Zr,useState:md}=xx,d_=xx["useId".toString()],hd=hle,vle=typeof d_=="function"?d_:()=>null;let ble=0;function M2(e=null){const t=vle(),n=Zr(e||t||null);return n.current===null&&(n.current=""+ble++),n.current}const n0=mle(null);n0.displayName="PanelGroupContext";function U7({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:l=null,maxSize:c=null,minSize:d,onCollapse:f=null,onResize:m=null,order:h=null,style:g={},tagName:b="div"}){const y=W7(n0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const x=M2(l),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:I,resizePanel:E,units:M,unregisterPanel:D}=y;d==null&&(M==="percentages"?d=10:d=0);const R=Zr({onCollapse:f,onResize:m});la(()=>{R.current.onCollapse=f,R.current.onResize=m});const N=_(x,o),O=Zr({size:f_(N)}),T=Zr({callbacksRef:R,collapsedSize:n,collapsible:r,defaultSize:o,id:x,idWasAutoGenerated:l==null,maxSize:c,minSize:d,order:h});return hd(()=>{O.current.size=f_(N),T.current.callbacksRef=R,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=x,T.current.idWasAutoGenerated=l==null,T.current.maxSize=c,T.current.minSize=d,T.current.order=h}),hd(()=>(I(x,T),()=>{D(x)}),[h,x,I,D]),V7(s,()=>({collapse:()=>w(x),expand:()=>S(x),getCollapsed(){return O.current.size===0},getId(){return x},getSize(U){return j(x,U)},resize:(U,G)=>E(x,U,G)}),[w,S,j,x,E]),zc(b,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":x,"data-panel-size":parseFloat(""+N.flexGrow).toFixed(1),id:`data-panel-id-${x}`,style:{...N,...g}})}const rl=H7((e,t)=>zc(U7,{...e,forwardedRef:t}));U7.displayName="Panel";rl.displayName="forwardRef(Panel)";function f_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const ai=10;function Ju(e,t,n,r,o,s,l,c){const{id:d,panels:f,units:m}=t,h=m==="pixels"?Ga(d):NaN,{sizes:g}=c||{},b=g||s,y=Tr(f),x=b.concat();let w=0;{const _=o<0?r:n,I=y.findIndex(R=>R.current.id===_),E=y[I],M=b[I],D=Zb(m,h,E,M,M+Math.abs(o),e);if(M===D)return b;D===0&&M>0&&l.set(_,M),o=o<0?M-D:D-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],I=b[j],E=Math.abs(o)-Math.abs(w),M=Zb(m,h,_,I,I-E,e);if(I!==M&&(M===0&&I>0&&l.set(_.current.id,I),w+=I-M,x[j]=M,w.toPrecision(ai).localeCompare(Math.abs(o).toPrecision(ai),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(_=>_.current.id===S),x[j]=b[j]+w,x)}function Ki(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:l,collapsedSize:c,collapsible:d,id:f}=s.current,m=n[f];if(m!==r){n[f]=r;const{onCollapse:h,onResize:g}=l.current;g&&g(r,m),d&&h&&((m==null||m===c)&&r!==c?h(!1):m!==c&&r===c&&h(!0))}})}function xle({groupId:e,panels:t,units:n}){const r=n==="pixels"?Ga(e):NaN,o=Tr(t),s=Array(o.length);let l=0,c=100;for(let d=0;d<o.length;d++){const f=o[d],{defaultSize:m}=f.current;m!=null&&(l++,s[d]=n==="pixels"?m/r*100:m,c-=s[d])}for(let d=0;d<o.length;d++){const f=o[d];let{defaultSize:m,id:h,maxSize:g,minSize:b}=f.current;if(m!=null)continue;n==="pixels"&&(b=b/r*100,g!=null&&(g=g/r*100));const y=o.length-l,x=Math.min(g??100,Math.max(b,c/y));s[d]=x,l++,c-=x}if(c!==0)for(let d=0;d<o.length;d++){const f=o[d];let{maxSize:m,minSize:h}=f.current;n==="pixels"&&(h=h/r*100,m!=null&&(m=m/r*100));const g=Math.min(m??100,Math.max(h,s[d]+c));if(g!==s[d]&&(c-=g-s[d],s[d]=g,Math.abs(c).toFixed(3)==="0.000"))break}return Math.abs(c).toFixed(3),s}function y1(e,t){if(t.length<2)return[null,null];const n=t.findIndex(l=>l.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 Ga(e){const t=Ld(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=O2(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 G7(e,t,n){if(e.size===1)return"100";const o=Tr(e).findIndex(l=>l.current.id===t),s=n[o];return s==null?"0":s.toPrecision(ai)}function yle(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function Ld(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function r0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Cle(e){return K7().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function K7(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function O2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function D2(e,t,n){var d,f,m,h;const r=r0(t),o=O2(e),s=r?o.indexOf(r):-1,l=((f=(d=n[s])==null?void 0:d.current)==null?void 0:f.id)??null,c=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[l,c]}function Tr(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 Zb(e,t,n,r,o,s=null){var m;let{collapsedSize:l,collapsible:c,maxSize:d,minSize:f}=n.current;if(e==="pixels"&&(l=l/t*100,d!=null&&(d=d/t*100),f=f/t*100),c){if(r>l){if(o<=f/2+l)return l}else if(!((m=s==null?void 0:s.type)==null?void 0:m.startsWith("key"))&&o<f)return l}return Math.min(d??100,Math.max(f,o))}function wle(e,t){const{collapsible:n,defaultSize:r,maxSize:o,minSize:s}=t.current;(s<0||e==="percentages"&&s>100)&&(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:r<s&&!n?t.current.defaultSize=s:o!=null&&r>o&&(t.current.defaultSize=o))}function C1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Tr(t),l=o==="pixels"?Ga(e):NaN;let c=0;for(let d=0;d<s.length;d++){const f=s[d],m=r[d],h=n[d],g=Zb(o,l,f,m,h);h!=g&&(c+=h-g,n[d]=g)}if(c.toFixed(3)!=="0.000")for(let d=0;d<s.length;d++){const f=s[d];let{maxSize:m,minSize:h}=f.current;o==="pixels"&&(h=h/l*100,m!=null&&(m=m/l*100));const g=Math.min(m??100,Math.max(h,n[d]+c));if(g!==n[d]&&(c-=g-n[d],n[d]=g,Math.abs(c).toFixed(3)==="0.000"))break}return c.toFixed(3),n}function q7(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}function Sle({committedValuesRef:e,groupId:t,panels:n,setSizes:r,sizes:o,panelSizeBeforeCollapse:s}){la(()=>{const{direction:l,panels:c}=e.current,d=Ld(t);q7(d!=null,`No group found for id "${t}"`);const{height:f,width:m}=d.getBoundingClientRect(),g=O2(t).map(b=>{const y=b.getAttribute("data-panel-resize-handle-id"),x=Tr(c),[w,S]=D2(t,y,x);if(w==null||S==null)return()=>{};let j=0,_=100,I=0,E=0;x.forEach(T=>{const{id:U,maxSize:G,minSize:q}=T.current;U===w?(j=q,_=G??100):(I+=q,E+=G??100)});const M=Math.min(_,100-I),D=Math.max(j,(x.length-1)*100-E),R=G7(c,w,o);b.setAttribute("aria-valuemax",""+Math.round(M)),b.setAttribute("aria-valuemin",""+Math.round(D)),b.setAttribute("aria-valuenow",""+Math.round(parseInt(R)));const N=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const U=x.findIndex(G=>G.current.id===w);if(U>=0){const G=x[U],q=o[U];if(q!=null){let Y=0;q.toPrecision(ai)<=G.current.minSize.toPrecision(ai)?Y=l==="horizontal"?m:f:Y=-(l==="horizontal"?m:f);const Q=Ju(T,e.current,w,S,Y,o,s.current,null);o!==Q&&r(Q)}}break}}};b.addEventListener("keydown",N);const O=yle(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",N),O!=null&&b.removeAttribute("aria-controls")}});return()=>{g.forEach(b=>b())}},[e,t,n,s,r,o])}function kle({disabled:e,handleId:t,resizeHandler:n}){la(()=>{if(e||n==null)return;const r=r0(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 l=K7(),c=Cle(t);q7(c!==null);const d=s.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[d].focus();break}}};return r.addEventListener("keydown",o),()=>{r.removeEventListener("keydown",o)}},[e,t,n])}function w1(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function X7(e,t,n,r=0,o=null){const s=n==="horizontal";let l=0;if(Jb(e))l=s?e.clientX:e.clientY;else if(ex(e)){const m=e.touches[0];l=s?m.screenX:m.screenY}else return 0;const c=r0(t),d=o||c.getBoundingClientRect(),f=s?d.left:d.top;return l-f-r}function jle(e,t,n,r,o,s,l){const{dragOffset:c=0,dragHandleRect:d,sizes:f}=l||{},m=f||s;if(_le(e)){const h=o==="horizontal",b=Ld(t).getBoundingClientRect(),y=h?b.width:b.height,x=e.shiftKey?10:100,w=y/x;let S=0;switch(e.key){case"ArrowDown":S=h?0:w;break;case"ArrowLeft":S=h?-w:0;break;case"ArrowRight":S=h?w:0;break;case"ArrowUp":S=h?0:-w;break;case"End":S=y;break;case"Home":S=-y;break}const[j,_]=D2(t,n,r),I=S<0?j:_,E=r.findIndex(D=>D.current.id===I),M=r[E];if(M.current.collapsible){const D=m[E];(D===0||D.toPrecision(ai)===M.current.minSize.toPrecision(ai))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return X7(e,n,o,c,d)}function _le(e){return e.type==="keydown"}function Jb(e){return e.type.startsWith("mouse")}function ex(e){return e.type.startsWith("touch")}let tx=null,Wl=null;function Q7(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 Ile(){Wl!==null&&(document.head.removeChild(Wl),tx=null,Wl=null)}function S1(e){if(tx===e)return;tx=e;const t=Q7(e);Wl===null&&(Wl=document.createElement("style"),document.head.appendChild(Wl)),Wl.innerHTML=`*{cursor: ${t}!important;}`}function Ple(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function Y7(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 Z7(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 Ele(e,t,n){const r=Z7(e,n);if(r){const o=Y7(t);return r[o]??null}return null}function Mle(e,t,n,r){const o=Y7(t),s=Z7(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(l){console.error(l)}}const k1={};function p_(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 ed={getItem:e=>(p_(ed),ed.getItem(e)),setItem:(e,t)=>{p_(ed),ed.setItem(e,t)}};function J7({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:l=null,onLayout:c,storage:d=ed,style:f={},tagName:m="div",units:h="percentages"}){const g=M2(l),[b,y]=md(null),[x,w]=md(new Map),S=Zr(null);Zr({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=Zr({onLayout:c});la(()=>{j.current.onLayout=c});const _=Zr({}),[I,E]=md([]),M=Zr(new Map),D=Zr(0),R=Zr({direction:r,id:g,panels:x,sizes:I,units:h});V7(s,()=>({getId:()=>g,getLayout:ee=>{const{sizes:le,units:ae}=R.current;if((ee??ae)==="pixels"){const J=Ga(g);return le.map(re=>re/100*J)}else return le},setLayout:(ee,le)=>{const{id:ae,panels:ce,sizes:J,units:re}=R.current;if((le||re)==="pixels"){const ne=Ga(ae);ee=ee.map(z=>z/ne*100)}const A=_.current,L=Tr(ce),K=C1({groupId:ae,panels:ce,nextSizes:ee,prevSizes:J,units:re});w1(J,K)||(E(K),Ki(L,K,A))}}),[g]),hd(()=>{R.current.direction=r,R.current.id=g,R.current.panels=x,R.current.sizes=I,R.current.units=h}),Sle({committedValuesRef:R,groupId:g,panels:x,setSizes:E,sizes:I,panelSizeBeforeCollapse:M}),la(()=>{const{onLayout:ee}=j.current,{panels:le,sizes:ae}=R.current;if(ae.length>0){ee&&ee(ae);const ce=_.current,J=Tr(le);Ki(J,ae,ce)}},[I]),hd(()=>{const{id:ee,sizes:le,units:ae}=R.current;if(le.length===x.size)return;let ce=null;if(e){const J=Tr(x);ce=Ele(e,J,d)}if(ce!=null){const J=C1({groupId:ee,panels:x,nextSizes:ce,prevSizes:ce,units:ae});E(J)}else{const J=xle({groupId:ee,panels:x,units:ae});E(J)}},[e,x,d]),la(()=>{if(e){if(I.length===0||I.length!==x.size)return;const ee=Tr(x);k1[e]||(k1[e]=Ple(Mle,100)),k1[e](e,ee,I,d)}},[e,x,I,d]),hd(()=>{if(h==="pixels"){const ee=new ResizeObserver(()=>{const{panels:le,sizes:ae}=R.current,ce=C1({groupId:g,panels:le,nextSizes:ae,prevSizes:ae,units:h});w1(ae,ce)||E(ce)});return ee.observe(Ld(g)),()=>{ee.disconnect()}}},[g,h]);const N=Qs((ee,le)=>{const{panels:ae,units:ce}=R.current,re=Tr(ae).findIndex(K=>K.current.id===ee),A=I[re];if((le??ce)==="pixels"){const K=Ga(g);return A/100*K}else return A},[g,I]),O=Qs((ee,le)=>{const{panels:ae}=R.current;return ae.size===0?{flexBasis:0,flexGrow:le??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:G7(ae,ee,I),flexShrink:1,overflow:"hidden",pointerEvents:o&&b!==null?"none":void 0}},[b,o,I]),T=Qs((ee,le)=>{const{units:ae}=R.current;wle(ae,le),w(ce=>{if(ce.has(ee))return ce;const J=new Map(ce);return J.set(ee,le),J})},[]),U=Qs(ee=>ae=>{ae.preventDefault();const{direction:ce,panels:J,sizes:re}=R.current,A=Tr(J),[L,K]=D2(g,ee,A);if(L==null||K==null)return;let ne=jle(ae,g,ee,A,ce,re,S.current);if(ne===0)return;const oe=Ld(g).getBoundingClientRect(),X=ce==="horizontal";document.dir==="rtl"&&X&&(ne=-ne);const Z=X?oe.width:oe.height,me=ne/Z*100,ve=Ju(ae,R.current,L,K,me,re,M.current,S.current),de=!w1(re,ve);if((Jb(ae)||ex(ae))&&D.current!=me&&S1(de?X?"horizontal":"vertical":X?ne<0?"horizontal-min":"horizontal-max":ne<0?"vertical-min":"vertical-max"),de){const ke=_.current;E(ve),Ki(A,ve,ke)}D.current=me},[g]),G=Qs(ee=>{w(le=>{if(!le.has(ee))return le;const ae=new Map(le);return ae.delete(ee),ae})},[]),q=Qs(ee=>{const{panels:le,sizes:ae}=R.current,ce=le.get(ee);if(ce==null)return;const{collapsedSize:J,collapsible:re}=ce.current;if(!re)return;const A=Tr(le),L=A.indexOf(ce);if(L<0)return;const K=ae[L];if(K===J)return;M.current.set(ee,K);const[ne,z]=y1(ee,A);if(ne==null||z==null)return;const X=L===A.length-1?K:J-K,Z=Ju(null,R.current,ne,z,X,ae,M.current,null);if(ae!==Z){const me=_.current;E(Z),Ki(A,Z,me)}},[]),Y=Qs(ee=>{const{panels:le,sizes:ae}=R.current,ce=le.get(ee);if(ce==null)return;const{collapsedSize:J,minSize:re}=ce.current,A=M.current.get(ee)||re;if(!A)return;const L=Tr(le),K=L.indexOf(ce);if(K<0||ae[K]!==J)return;const[z,oe]=y1(ee,L);if(z==null||oe==null)return;const Z=K===L.length-1?J-A:A,me=Ju(null,R.current,z,oe,Z,ae,M.current,null);if(ae!==me){const ve=_.current;E(me),Ki(L,me,ve)}},[]),Q=Qs((ee,le,ae)=>{const{id:ce,panels:J,sizes:re,units:A}=R.current;if((ae||A)==="pixels"){const Qe=Ga(ce);le=le/Qe*100}const L=J.get(ee);if(L==null)return;let{collapsedSize:K,collapsible:ne,maxSize:z,minSize:oe}=L.current;if(A==="pixels"){const Qe=Ga(ce);oe=oe/Qe*100,z!=null&&(z=z/Qe*100)}const X=Tr(J),Z=X.indexOf(L);if(Z<0)return;const me=re[Z];if(me===le)return;ne&&le===K||(le=Math.min(z??100,Math.max(oe,le)));const[ve,de]=y1(ee,X);if(ve==null||de==null)return;const we=Z===X.length-1?me-le:le-me,Re=Ju(null,R.current,ve,de,we,re,M.current,null);if(re!==Re){const Qe=_.current;E(Re),Ki(X,Re,Qe)}},[]),V=gle(()=>({activeHandleId:b,collapsePanel:q,direction:r,expandPanel:Y,getPanelSize:N,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:U,resizePanel:Q,startDragging:(ee,le)=>{if(y(ee),Jb(le)||ex(le)){const ae=r0(ee);S.current={dragHandleRect:ae.getBoundingClientRect(),dragOffset:X7(le,ee,r),sizes:R.current.sizes}}},stopDragging:()=>{Ile(),y(null),S.current=null},units:h,unregisterPanel:G}),[b,q,r,Y,N,O,g,T,U,Q,h,G]),se={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return zc(n0.Provider,{children:zc(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...se,...f}}),value:V})}const o0=H7((e,t)=>zc(J7,{...e,forwardedRef:t}));J7.displayName="PanelGroup";o0.displayName="forwardRef(PanelGroup)";function nx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:l="div"}){const c=Zr(null),d=Zr({onDragging:o});la(()=>{d.current.onDragging=o});const f=W7(n0);if(f===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:b,startDragging:y,stopDragging:x}=f,w=M2(r),S=m===w,[j,_]=md(!1),[I,E]=md(null),M=Qs(()=>{c.current.blur(),x();const{onDragging:N}=d.current;N&&N(!1)},[x]);la(()=>{if(n)E(null);else{const R=b(w);E(()=>R)}},[n,w,b]),la(()=>{if(n||I==null||!S)return;const R=U=>{I(U)},N=U=>{I(U)},T=c.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",R),T.body.addEventListener("touchmove",R),T.body.addEventListener("mouseleave",N),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",R),T.body.removeEventListener("touchmove",R),T.body.removeEventListener("mouseleave",N),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,I,M]),kle({disabled:n,handleId:w,resizeHandler:I});const D={cursor:Q7(h),touchAction:"none",userSelect:"none"};return zc(l,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:R=>{y(w,R.nativeEvent);const{onDragging:N}=d.current;N&&N(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:R=>{y(w,R.nativeEvent);const{onDragging:N}=d.current;N&&N(!0)},ref:c,role:"separator",style:{...D,...s},tabIndex:0})}nx.displayName="PanelResizeHandle";const Ole=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=ia("base.100","base.850"),l=ia("base.300","base.700");return t==="horizontal"?a.jsx(nx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx($,{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:l}}},...o,children:a.jsx(Ie,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(nx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx($,{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:l}}},...o,children:a.jsx(Ie,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},Bh=i.memo(Ole),R2=()=>{const e=te(),t=H(o=>o.ui.panels),n=i.useCallback(o=>t[o]??"",[t]),r=i.useCallback((o,s)=>{e(TA({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const Dle=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,l=i.useMemo(()=>NA(n)?n:JSON.stringify(n,null,2),[n]),c=i.useCallback(()=>{navigator.clipboard.writeText(l)},[l]),d=i.useCallback(()=>{const m=new Blob([l]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[l,t,r]),{t:f}=W();return a.jsxs($,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(Gg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:l})})}),a.jsxs($,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Ut,{label:`${f("gallery.download")} ${t} JSON`,children:a.jsx(rs,{"aria-label":`${f("gallery.download")} ${t} JSON`,icon:a.jsx(ou,{}),variant:"ghost",opacity:.7,onClick:d})}),s&&a.jsx(Ut,{label:`${f("gallery.copy")} ${t} JSON`,children:a.jsx(rs,{"aria-label":`${f("gallery.copy")} ${t} JSON`,icon:a.jsx(ru,{}),variant:"ghost",opacity:.7,onClick:c})})]})]})},pl=i.memo(Dle),Rle=fe(pe,({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}}),Ale=()=>{const{data:e}=H(Rle);return e?a.jsx(pl,{data:e,label:"Node Data"}):a.jsx(Tn,{label:"No node selected",icon:null})},Tle=i.memo(Ale),Nle=({children:e,maxHeight:t})=>a.jsx($,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(Gg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Sl=i.memo(Nle),$le=({output:e})=>{const{image:t}=e,{data:n}=jo(t.image_name);return a.jsx(fl,{imageDTO:n})},Lle=i.memo($le),Fle=fe(pe,({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}}),zle=()=>{const{node:e,template:t,nes:n}=H(Fle),{t:r}=W();return!e||!n||!Jt(e)?a.jsx(Tn,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(Tn,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Sl,{children:a.jsx($,{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(Lle,{output:o},Hle(o,s))):a.jsx(pl,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},Ble=i.memo(zle),Hle=(e,t)=>`${e.type}-${t}`,Wle=fe(pe,({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}}),Vle=()=>{const{template:e}=H(Wle),{t}=W();return e?a.jsx(pl,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(Tn,{label:t("nodes.noNodeSelected"),icon:null})},Ule=i.memo(Vle),Gle=_e((e,t)=>{const n=te(),r=i.useCallback(s=>{s.shiftKey&&n(zr(!0))},[n]),o=i.useCallback(s=>{s.shiftKey||n(zr(!1))},[n]);return a.jsx(B6,{ref:t,onPaste:I2,onKeyDown:r,onKeyUp:o,...e})}),ga=i.memo(Gle),A2=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data}),[e]);return H(t)},Kle=({nodeId:e})=>{const t=te(),n=A2(e),{t:r}=W(),o=i.useCallback(s=>{t($A({nodeId:e,notes:s.target.value}))},[t,e]);return Im(n)?a.jsxs(Gt,{children:[a.jsx(ln,{children:r("nodes.notes")}),a.jsx(ga,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},qle=i.memo(Kle),eO=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Jt(o)?o.data.label:!1}),[e]);return H(t)},tO=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Jt(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title}),[e]);return H(t)},Xle=({nodeId:e,title:t})=>{const n=te(),r=eO(e),o=tO(e),{t:s}=W(),[l,c]=i.useState(""),d=i.useCallback(async m=>{n(qI({nodeId:e,label:m})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),f=i.useCallback(m=>{c(m)},[]);return i.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsxs(ef,{as:$,value:l,onChange:f,onSubmit:d,w:"full",fontWeight:600,children:[a.jsx(Jd,{noOfLines:1}),a.jsx(Zd,{className:"nodrag",_focusVisible:{boxShadow:"none"}})]})})},Qle=i.memo(Xle),Yle=fe(pe,({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}}),Zle=()=>{const{node:e,template:t}=H(Yle),{t:n}=W();return!t||!Jt(e)?a.jsx(Tn,{label:n("nodes.noNodeSelected"),icon:null}):a.jsx(nO,{node:e,template:t})},Jle=i.memo(Zle),nO=i.memo(({node:e,template:t})=>{const{t:n}=W(),r=i.useMemo(()=>$x(e,t),[e,t]);return a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Sl,{children:a.jsxs($,{sx:{flexDir:"column",position:"relative",p:1,gap:2,w:"full"},children:[a.jsx(Qle,{nodeId:e.data.id}),a.jsxs(ug,{children:[a.jsxs(Gt,{children:[a.jsx(ln,{children:n("nodes.nodeType")}),a.jsx(be,{fontSize:"sm",fontWeight:600,children:t.title})]}),a.jsx($,{flexDir:"row",alignItems:"center",justifyContent:"space-between",w:"full",children:a.jsxs(Gt,{isInvalid:r,children:[a.jsx(ln,{children:n("nodes.nodeVersion")}),a.jsx(be,{fontSize:"sm",fontWeight:600,children:e.data.version})]})})]}),a.jsx(qle,{nodeId:e.data.id})]})})})});nO.displayName="Content";const eie=()=>{const{t:e}=W();return a.jsx($,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(ci,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ui,{children:[a.jsx(mr,{children:e("common.details")}),a.jsx(mr,{children:e("common.outputs")}),a.jsx(mr,{children:e("common.data")}),a.jsx(mr,{children:e("common.template")})]}),a.jsxs(eu,{children:[a.jsx($r,{children:a.jsx(Jle,{})}),a.jsx($r,{children:a.jsx(Ble,{})}),a.jsx($r,{children:a.jsx(Tle,{})}),a.jsx($r,{children:a.jsx(Ule,{})})]})]})})},tie=i.memo(eie),nie={display:"flex",flexDirection:"row",alignItems:"center",gap:10},rie=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...l}=e,c=te(),d=i.useCallback(m=>{m.shiftKey&&c(zr(!0))},[c]),f=i.useCallback(m=>{m.shiftKey||c(zr(!1))},[c]);return a.jsxs(Gt,{isInvalid:o,isDisabled:r,...s,style:n==="side"?nie:void 0,children:[t!==""&&a.jsx(ln,{children:t}),a.jsx(Qc,{...l,onPaste:I2,onKeyDown:d,onKeyUp:f})]})},yo=i.memo(rie),oie=fe(pe,({workflow:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:l,notes:c}=e;return{name:n,author:t,description:r,tags:o,version:s,contact:l,notes:c}}),sie=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:l}=H(oie),c=te(),d=i.useCallback(w=>{c(XI(w.target.value))},[c]),f=i.useCallback(w=>{c(LA(w.target.value))},[c]),m=i.useCallback(w=>{c(FA(w.target.value))},[c]),h=i.useCallback(w=>{c(zA(w.target.value))},[c]),g=i.useCallback(w=>{c(BA(w.target.value))},[c]),b=i.useCallback(w=>{c(HA(w.target.value))},[c]),y=i.useCallback(w=>{c(WA(w.target.value))},[c]),{t:x}=W();return a.jsx(Sl,{children:a.jsxs($,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs($,{sx:{gap:2,w:"full"},children:[a.jsx(yo,{label:x("nodes.workflowName"),value:t,onChange:d}),a.jsx(yo,{label:x("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs($,{sx:{gap:2,w:"full"},children:[a.jsx(yo,{label:x("nodes.workflowAuthor"),value:e,onChange:f}),a.jsx(yo,{label:x("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(yo,{label:x("nodes.workflowTags"),value:r,onChange:b}),a.jsxs(Gt,{as:$,sx:{flexDir:"column"},children:[a.jsx(ln,{children:x("nodes.workflowDescription")}),a.jsx(ga,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Gt,{as:$,sx:{flexDir:"column",h:"full"},children:[a.jsx(ln,{children:x("nodes.workflowNotes")}),a.jsx(ga,{onChange:y,value:l,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},aie=i.memo(sie),s0=()=>{const e=H(c=>c.nodes.nodes),t=H(c=>c.nodes.edges),n=H(c=>c.workflow),[r]=kc(e,300),[o]=kc(t,300),[s]=kc(n,300);return i.useMemo(()=>VA({nodes:r,edges:o,workflow:s}),[r,o,s])},lie=()=>{const e=s0(),{t}=W();return a.jsx($,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(pl,{data:e,label:t("nodes.workflow")})})},iie=i.memo(lie),cie=({isSelected:e,isHovered:t})=>{const n=i.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=i.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Ie,{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}}})},rO=i.memo(cie),oO=e=>{const t=te(),n=i.useMemo(()=>fe(pe,({nodes:l})=>l.mouseOverNode===e),[e]),r=H(n),o=i.useCallback(()=>{!r&&t(Yw(e))},[t,e,r]),s=i.useCallback(()=>{r&&t(Yw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},sO=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{var l;const s=o.nodes.find(c=>c.id===e);if(Jt(s))return(l=s==null?void 0:s.data.inputs[t])==null?void 0:l.label}),[t,e]);return H(n)},aO=(e,t,n)=>{const r=i.useMemo(()=>fe(pe,({nodes:s})=>{var d;const l=s.nodes.find(f=>f.id===e);if(!Jt(l))return;const c=s.nodeTemplates[(l==null?void 0:l.data.type)??""];return(d=c==null?void 0:c[Lx[n]][t])==null?void 0:d.title}),[t,n,e]);return H(r)},lO=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{const s=o.nodes.find(l=>l.id===e);if(Jt(s))return s==null?void 0:s.data.inputs[t]}),[t,e]);return H(n)},iO=(e,t,n)=>{const r=i.useMemo(()=>fe(pe,({nodes:s})=>{const l=s.nodes.find(d=>d.id===e);if(!Jt(l))return;const c=s.nodeTemplates[(l==null?void 0:l.data.type)??""];return c==null?void 0:c[Lx[n]][t]}),[t,n,e]);return H(r)},cO=e=>{const{t}=W();return i.useMemo(()=>{if(!e)return"";const{name:r}=e;return e.isCollection?t("nodes.collectionFieldType",{name:r}):e.isCollectionOrScalar?t("nodes.collectionOrScalarFieldType",{name:r}):r},[e,t])},uie=({nodeId:e,fieldName:t,kind:n})=>{const r=lO(e,t),o=iO(e,t,n),s=UA(o),l=cO(o==null?void 0:o.type),{t:c}=W(),d=i.useMemo(()=>GA(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:c("nodes.unknownField"):(o==null?void 0:o.title)||c("nodes.unknownField"),[r,o,c]);return a.jsxs($,{sx:{flexDir:"column"},children:[a.jsx(be,{sx:{fontWeight:600},children:d}),o&&a.jsx(be,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),l&&a.jsxs(be,{children:[c("parameters.type"),": ",l]}),s&&a.jsxs(be,{children:[c("common.input"),": ",KA(o.input)]})]})},T2=i.memo(uie),die=_e((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:l=!1}=e,c=sO(n,r),d=aO(n,r,o),{t:f}=W(),m=te(),[h,g]=i.useState(c||d||f("nodes.unknownField")),b=i.useCallback(async x=>{x&&(x===c||x===d)||(g(x||d||f("nodes.unknownField")),m(qA({nodeId:n,fieldName:r,label:x})))},[c,d,m,n,r,f]),y=i.useCallback(x=>{g(x)},[]);return i.useEffect(()=>{g(c||d||f("nodes.unknownField"))},[c,d,f]),a.jsx(Ut,{label:l?a.jsx(T2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:Zh,placement:"top",hasArrow:!0,children:a.jsx($,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(ef,{value:h,onChange:y,onSubmit:b,as:$,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(Jd,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(Zd,{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(dO,{})]})})})}),uO=i.memo(die),dO=i.memo(()=>{const{isEditing:e,getEditButtonProps:t}=K3(),n=i.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx($,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});dO.displayName="EditableControls";const fie=e=>{var c;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=Wd(void 0,{selectFromResult:({data:d})=>{const f=[{label:"None",value:"none"}];return d==null||d.forEach(({board_id:m,board_name:h})=>{f.push({label:h,value:m})}),{data:f,hasBoards:f.length>1}}}),l=i.useCallback(d=>{r(XA({nodeId:t,fieldName:n.name,value:d&&d!=="none"?{board_id:d}:void 0}))},[r,n.name,t]);return a.jsx(sn,{className:"nowheel nodrag",value:((c=n.value)==null?void 0:c.board_id)??"none",data:o,onChange:l,disabled:!s})},pie=i.memo(fie),mie=e=>{const{nodeId:t,field:n}=e,r=te(),o=i.useCallback(s=>{r(QA({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(Iy,{className:"nodrag",onChange:o,isChecked:n.value})},hie=i.memo(mie);function a0(){return(a0=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function fO(e,t){if(e==null)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}function rx(e){var t=i.useRef(e),n=i.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Bc=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},gd=function(e){return"touches"in e},ox=function(e){return e&&e.ownerDocument.defaultView||self},m_=function(e,t,n){var r=e.getBoundingClientRect(),o=gd(t)?function(s,l){for(var c=0;c<s.length;c++)if(s[c].identifier===l)return s[c];return s[0]}(t.touches,n):t;return{left:Bc((o.pageX-(r.left+ox(e).pageXOffset))/r.width),top:Bc((o.pageY-(r.top+ox(e).pageYOffset))/r.height)}},h_=function(e){!gd(e)&&e.preventDefault()},N2=B.memo(function(e){var t=e.onMove,n=e.onKey,r=fO(e,["onMove","onKey"]),o=i.useRef(null),s=rx(t),l=rx(n),c=i.useRef(null),d=i.useRef(!1),f=i.useMemo(function(){var b=function(w){h_(w),(gd(w)?w.touches.length>0:w.buttons>0)&&o.current?s(m_(o.current,w,c.current)):x(!1)},y=function(){return x(!1)};function x(w){var S=d.current,j=ox(o.current),_=w?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",b),_(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(h_(S),!function(I,E){return E&&!gd(I)}(S,d.current)&&j)){if(gd(S)){d.current=!0;var _=S.changedTouches||[];_.length&&(c.current=_[0].identifier)}j.focus(),s(m_(j,S,c.current)),x(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),l({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},x]},[l,s]),m=f[0],h=f[1],g=f[2];return i.useEffect(function(){return g},[g]),B.createElement("div",a0({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),l0=function(e){return e.filter(Boolean).join(" ")},$2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=l0(["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}}))},Sr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},pO=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Sr(e.h),s:Sr(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Sr(o/2),a:Sr(r,2)}},sx=function(e){var t=pO(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},j1=function(e){var t=pO(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},gie=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),l=r*(1-n),c=r*(1-(t-s)*n),d=r*(1-(1-t+s)*n),f=s%6;return{r:Sr(255*[r,c,l,l,d,r][f]),g:Sr(255*[d,r,r,c,l,l][f]),b:Sr(255*[l,l,d,r,r,c][f]),a:Sr(o,2)}},vie=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),l=s-Math.min(t,n,r),c=l?s===t?(n-r)/l:s===n?2+(r-t)/l:4+(t-n)/l:0;return{h:Sr(60*(c<0?c+6:c)),s:Sr(s?l/s*100:0),v:Sr(s/255*100),a:o}},bie=B.memo(function(e){var t=e.hue,n=e.onChange,r=l0(["react-colorful__hue",e.className]);return B.createElement("div",{className:r},B.createElement(N2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Bc(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Sr(t),"aria-valuemax":"360","aria-valuemin":"0"},B.createElement($2,{className:"react-colorful__hue-pointer",left:t/360,color:sx({h:t,s:100,v:100,a:1})})))}),xie=B.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:sx({h:t.h,s:100,v:100,a:1})};return B.createElement("div",{className:"react-colorful__saturation",style:r},B.createElement(N2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Bc(t.s+100*o.left,0,100),v:Bc(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Sr(t.s)+"%, Brightness "+Sr(t.v)+"%"},B.createElement($2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:sx(t)})))}),mO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function yie(e,t,n){var r=rx(n),o=i.useState(function(){return e.toHsva(t)}),s=o[0],l=o[1],c=i.useRef({color:t,hsva:s});i.useEffect(function(){if(!e.equal(t,c.current.color)){var f=e.toHsva(t);c.current={hsva:f,color:t},l(f)}},[t,e]),i.useEffect(function(){var f;mO(s,c.current.hsva)||e.equal(f=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:f},r(f))},[s,e,r]);var d=i.useCallback(function(f){l(function(m){return Object.assign({},m,f)})},[]);return[s,d]}var Cie=typeof window<"u"?i.useLayoutEffect:i.useEffect,wie=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},g_=new Map,Sie=function(e){Cie(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!g_.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,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,g_.set(t,n);var r=wie();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},kie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+j1(Object.assign({},n,{a:0}))+", "+j1(Object.assign({},n,{a:1}))+")"},s=l0(["react-colorful__alpha",t]),l=Sr(100*n.a);return B.createElement("div",{className:s},B.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),B.createElement(N2,{onMove:function(c){r({a:c.left})},onKey:function(c){r({a:Bc(n.a+c.left)})},"aria-label":"Alpha","aria-valuetext":l+"%","aria-valuenow":l,"aria-valuemin":"0","aria-valuemax":"100"},B.createElement($2,{className:"react-colorful__alpha-pointer",left:n.a,color:j1(n)})))},jie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,l=fO(e,["className","colorModel","color","onChange"]),c=i.useRef(null);Sie(c);var d=yie(n,o,s),f=d[0],m=d[1],h=l0(["react-colorful",t]);return B.createElement("div",a0({},l,{ref:c,className:h}),B.createElement(xie,{hsva:f,onChange:m}),B.createElement(bie,{hue:f.h,onChange:m}),B.createElement(kie,{hsva:f,onChange:m,className:"react-colorful__last-control"}))},_ie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:vie,fromHsva:gie,equal:mO},hO=function(e){return B.createElement(jie,a0({},e,{colorModel:_ie}))};const Iie=e=>{const{nodeId:t,field:n}=e,r=te(),o=i.useCallback(s=>{r(YA({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(hO,{className:"nodrag",color:n.value,onChange:o})},Pie=i.memo(Iie),gO=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=ZA.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},Eie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Ex(),l=i.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=i.useMemo(()=>{if(!s)return[];const f=[];return qn(s.entities,(m,h)=>{m&&f.push({value:h,label:m.model_name,group:xn[m.base_model]})}),f},[s]),d=i.useCallback(f=>{if(!f)return;const m=gO(f);m&&o(JA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(yn,{className:"nowheel nodrag",tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??null,placeholder:"Pick one",error:!l,data:c,onChange:d,sx:{width:"100%"}})},Mie=i.memo(Eie),Oie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=i.useCallback(l=>{o(eT({nodeId:t,fieldName:n.name,value:l.target.value}))},[o,n.name,t]);return a.jsx(w6,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(l=>a.jsx("option",{value:l,children:r.ui_choice_labels?r.ui_choice_labels[l]:l},l))})},Die=i.memo(Oie),Rie=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=tT.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},Aie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Ox(),l=i.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=i.useMemo(()=>{if(!s)return[];const f=[];return qn(s.entities,(m,h)=>{m&&f.push({value:h,label:m.model_name,group:xn[m.base_model]})}),f},[s]),d=i.useCallback(f=>{if(!f)return;const m=Rie(f);m&&o(nT({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(yn,{className:"nowheel nodrag",tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??null,placeholder:"Pick one",error:!l,data:c,onChange:d,sx:{width:"100%"}})},Tie=i.memo(Aie),Nie=e=>{var h;const{nodeId:t,field:n}=e,r=te(),o=H(g=>g.system.isConnected),{currentData:s,isError:l}=jo(((h=n.value)==null?void 0:h.image_name)??Br),c=i.useCallback(()=>{r(rT({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),d=i.useMemo(()=>{if(s)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:s}}},[n.name,s,t]),f=i.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),m=i.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return i.useEffect(()=>{o&&l&&c()},[c,o,l]),a.jsx($,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(fl,{imageDTO:s,droppableData:f,draggableData:d,postUploadAction:m,useThumbailFallback:!0,uploadElement:a.jsx(vO,{}),dropLabel:a.jsx(bO,{}),minSize:8,children:a.jsx(jc,{onClick:c,icon:s?a.jsx(Ng,{}):void 0,tooltip:"Reset Image"})})})},$ie=i.memo(Nie),vO=i.memo(()=>{const{t:e}=W();return a.jsx(be,{fontSize:16,fontWeight:600,children:e("gallery.dropOrUpload")})});vO.displayName="UploadElement";const bO=i.memo(()=>{const{t:e}=W();return a.jsx(be,{fontSize:16,fontWeight:600,children:e("gallery.drop")})});bO.displayName="DropLabel";const Lie=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=oT.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},Fie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Vd(),{t:l}=W(),c=i.useMemo(()=>{if(!s)return[];const h=[];return qn(s.entities,(g,b)=>{g&&h.push({value:b,label:g.model_name,group:xn[g.base_model]})}),h.sort((g,b)=>g.disabled&&!b.disabled?1:-1)},[s]),d=i.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]),f=i.useCallback(h=>{if(!h)return;const g=Lie(h);g&&o(sT({nodeId:t,fieldName:n.name,value:g}))},[o,n.name,t]),m=i.useCallback((h,g)=>{var b;return((b=g.label)==null?void 0:b.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},[]);return(s==null?void 0:s.ids.length)===0?a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(be,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:l("models.noLoRAsLoaded")})}):a.jsx(sn,{className:"nowheel nodrag",value:(d==null?void 0:d.id)??null,placeholder:c.length>0?l("models.selectLoRA"):l("models.noLoRAsAvailable"),data:c,nothingFound:l("models.noMatchingLoRAs"),itemComponent:xl,disabled:c.length===0,filter:m,error:!d,onChange:f,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},zie=i.memo(Fie),i0=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=aT.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 cu(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=W(),[s,{isLoading:l}]=lT(),c=i.useCallback(()=>{s().unwrap().then(d=>{r(lt(rn({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(d=>{d&&r(lt(rn({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})},[r,s,o]);return t?a.jsx(Fe,{icon:a.jsx(XM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:l,onClick:c,size:"sm",...n}):a.jsx(Xe,{isLoading:l,onClick:c,minW:"max-content",...n,children:o("modelManager.syncModels")})}const Bie=e=>{var y,x;const{nodeId:t,field:n}=e,r=te(),o=Mt("syncModels").isFeatureEnabled,{t:s}=W(),{data:l,isLoading:c}=vd(Zw),{data:d,isLoading:f}=as(Zw),m=i.useMemo(()=>c||f,[c,f]),h=i.useMemo(()=>{if(!d)return[];const w=[];return qn(d.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:xn[S.base_model]})}),l&&qn(l.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:xn[S.base_model]})}),w},[d,l]),g=i.useMemo(()=>{var w,S,j,_;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}`])||(l==null?void 0:l.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,l==null?void 0:l.entities]),b=i.useCallback(w=>{if(!w)return;const S=i0(w);S&&r(QI({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs($,{sx:{w:"full",alignItems:"center",gap:2},children:[m?a.jsx(be,{variant:"subtext",children:"Loading..."}):a.jsx(sn,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:b,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(cu,{className:"nodrag",iconMode:!0})]})},Hie=i.memo(Bie),Wie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,l]=i.useState(String(n.value)),c=i.useMemo(()=>r.type.name==="IntegerField",[r.type]),d=i.useCallback(f=>{l(f),f.match(zh)||o(iT({nodeId:t,fieldName:n.name,value:c?Math.floor(Number(f)):Number(f)}))},[o,n.name,c,t]);return i.useEffect(()=>{!s.match(zh)&&n.value!==Number(s)&&l(String(n.value))},[n.value,s]),a.jsxs(mg,{onChange:d,value:s,step:c?1:.1,precision:c?0:3,children:[a.jsx(gg,{className:"nodrag"}),a.jsxs(hg,{children:[a.jsx(bg,{}),a.jsx(vg,{})]})]})},Vie=i.memo(Wie),Uie=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=W(),s=Mt("syncModels").isFeatureEnabled,{data:l,isLoading:c}=as(Fx),d=i.useMemo(()=>{if(!l)return[];const b=[];return qn(l.entities,(y,x)=>{y&&b.push({value:x,label:y.model_name,group:xn[y.base_model]})}),b},[l]),f=i.useMemo(()=>{var b,y;return(l==null?void 0:l.entities[`${(b=n.value)==null?void 0:b.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,l==null?void 0:l.entities]),m=i.useCallback(b=>{if(!b)return;const y=i0(b);y&&r(cT({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return c?a.jsx(sn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sn,{className:"nowheel nodrag",tooltip:f==null?void 0:f.description,value:f==null?void 0:f.id,placeholder:d.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:d,error:!f,disabled:d.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(cu,{className:"nodrag",iconMode:!0})]})},Gie=i.memo(Uie),Kie=e=>{var g,b;const{nodeId:t,field:n}=e,r=te(),{t:o}=W(),s=Mt("syncModels").isFeatureEnabled,{data:l}=vd(Jw),{data:c,isLoading:d}=as(Jw),f=i.useMemo(()=>{if(!c)return[];const y=[];return qn(c.entities,(x,w)=>{!x||x.base_model!=="sdxl"||y.push({value:w,label:x.model_name,group:xn[x.base_model]})}),l&&qn(l.entities,(x,w)=>{!x||x.base_model!=="sdxl"||y.push({value:w,label:x.model_name,group:xn[x.base_model]})}),y},[c,l]),m=i.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}`])||(l==null?void 0:l.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,l==null?void 0:l.entities]),h=i.useCallback(y=>{if(!y)return;const x=i0(y);x&&r(QI({nodeId:t,fieldName:n.name,value:x}))},[r,n.name,t]);return d?a.jsx(sn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sn,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:f.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:f,error:!m,disabled:f.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(cu,{className:"nodrag",iconMode:!0})]})},qie=i.memo(Kie),Xie=fe([pe],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:Hr(Gh,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}}),Qie=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=H(Xie),s=i.useCallback(l=>{l&&r(uT({nodeId:t,fieldName:n.name,value:l}))},[r,n.name,t]);return a.jsx(sn,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Yie=i.memo(Qie),Zie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=i.useCallback(l=>{o(dT({nodeId:t,fieldName:n.name,value:l.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(ga,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(yo,{onChange:s,value:n.value})},Jie=i.memo(Zie),ece=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=fT.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},tce=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Mx(),l=i.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=i.useMemo(()=>{if(!s)return[];const f=[];return qn(s.entities,(m,h)=>{m&&f.push({value:h,label:m.model_name,group:xn[m.base_model]})}),f},[s]),d=i.useCallback(f=>{if(!f)return;const m=ece(f);m&&o(pT({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(yn,{className:"nowheel nodrag",tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??null,placeholder:"Pick one",error:!l,data:c,onChange:d,sx:{width:"100%"}})},nce=i.memo(tce),xO=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=mT.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},rce=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=YI(),l=i.useMemo(()=>{if(!s)return[];const f=[{value:"default",label:"Default",group:"Default"}];return qn(s.entities,(m,h)=>{m&&f.push({value:h,label:m.model_name,group:xn[m.base_model]})}),f.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),c=i.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=i.useCallback(f=>{if(!f)return;const m=xO(f);m&&o(hT({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(sn,{className:"nowheel nodrag",itemComponent:xl,tooltip:c==null?void 0:c.description,value:(c==null?void 0:c.id)??"default",placeholder:"Default",data:l,onChange:d,disabled:l.length===0,error:!c,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},oce=i.memo(rce),sce=({nodeId:e,fieldName:t})=>{const{t:n}=W(),r=lO(e,t),o=iO(e,t,"input");return(o==null?void 0:o.fieldKind)==="output"?a.jsxs(Ie,{p:2,children:[n("nodes.outputFieldInInput"),": ",r==null?void 0:r.type.name]}):gT(r)&&vT(o)?a.jsx(Jie,{nodeId:e,field:r,fieldTemplate:o}):bT(r)&&xT(o)?a.jsx(hie,{nodeId:e,field:r,fieldTemplate:o}):yT(r)&&CT(o)||wT(r)&&ST(o)?a.jsx(Vie,{nodeId:e,field:r,fieldTemplate:o}):kT(r)&&jT(o)?a.jsx(Die,{nodeId:e,field:r,fieldTemplate:o}):_T(r)&&IT(o)?a.jsx($ie,{nodeId:e,field:r,fieldTemplate:o}):PT(r)&&ET(o)?a.jsx(pie,{nodeId:e,field:r,fieldTemplate:o}):MT(r)&&OT(o)?a.jsx(Hie,{nodeId:e,field:r,fieldTemplate:o}):DT(r)&&RT(o)?a.jsx(Gie,{nodeId:e,field:r,fieldTemplate:o}):AT(r)&&TT(o)?a.jsx(oce,{nodeId:e,field:r,fieldTemplate:o}):NT(r)&&$T(o)?a.jsx(zie,{nodeId:e,field:r,fieldTemplate:o}):LT(r)&&FT(o)?a.jsx(Mie,{nodeId:e,field:r,fieldTemplate:o}):zT(r)&&BT(o)?a.jsx(Tie,{nodeId:e,field:r,fieldTemplate:o}):HT(r)&&WT(o)?a.jsx(nce,{nodeId:e,field:r,fieldTemplate:o}):VT(r)&&UT(o)?a.jsx(Pie,{nodeId:e,field:r,fieldTemplate:o}):GT(r)&&KT(o)?a.jsx(qie,{nodeId:e,field:r,fieldTemplate:o}):qT(r)&&XT(o)?a.jsx(Yie,{nodeId:e,field:r,fieldTemplate:o}):r&&o?null:a.jsx(Ie,{p:1,children:a.jsx(be,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:n("nodes.unknownFieldType",{type:r==null?void 0:r.type.name})})})},yO=i.memo(sce),ace=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=oO(e),{t:l}=W(),c=i.useCallback(()=>{n(ZI({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs($,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Gt,{as:$,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(ln,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(uO,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(Wr,{}),a.jsx(Ut,{label:a.jsx(T2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:Zh,placement:"top",hasArrow:!0,children:a.jsx($,{h:"full",alignItems:"center",children:a.jsx(An,{as:HM})})}),a.jsx(Fe,{"aria-label":l("nodes.removeLinearView"),tooltip:l("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:c,icon:a.jsx(ao,{})})]}),a.jsx(yO,{nodeId:e,fieldName:t})]}),a.jsx(rO,{isSelected:!1,isHovered:r})]})},lce=i.memo(ace),ice=fe(pe,({workflow:e})=>({fields:e.exposedFields})),cce=()=>{const{fields:e}=H(ice),{t}=W();return a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Sl,{children:a.jsx($,{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(lce,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(Tn,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},uce=i.memo(cce),dce=()=>{const{t:e}=W();return a.jsx($,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(ci,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ui,{children:[a.jsx(mr,{children:e("common.linear")}),a.jsx(mr,{children:e("common.details")}),a.jsx(mr,{children:"JSON"})]}),a.jsxs(eu,{children:[a.jsx($r,{children:a.jsx(uce,{})}),a.jsx($r,{children:a.jsx(aie,{})}),a.jsx($r,{children:a.jsx(iie,{})})]})]})})},fce=i.memo(dce),pce=()=>{const[e,t]=i.useState(!1),[n,r]=i.useState(!1),o=i.useRef(null),s=R2(),l=i.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs($,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(z7,{}),a.jsx($,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(ds,{asSlider:!0})}),a.jsxs(o0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(rl,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(fce,{})}),a.jsx(Bh,{direction:"vertical",onDoubleClick:l,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(rl,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(tie,{})})]})]})},mce=i.memo(pce),v_=(e,t)=>{const n=i.useRef(null),[r,o]=i.useState(()=>{var f;return!!((f=n.current)!=null&&f.getCollapsed())}),s=i.useCallback(()=>{var f;(f=n.current)!=null&&f.getCollapsed()?Jr.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):Jr.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),l=i.useCallback(()=>{Jr.flushSync(()=>{var f;(f=n.current)==null||f.expand()})},[]),c=i.useCallback(()=>{Jr.flushSync(()=>{var f;(f=n.current)==null||f.collapse()})},[]),d=i.useCallback(()=>{Jr.flushSync(()=>{var f;(f=n.current)==null||f.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:d,toggle:s,expand:l,collapse:c}},hce=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=W(),r=i.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Uc,{children:a.jsx($,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(Fe,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(Jse,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},gce=i.memo(hce),Jp={borderStartRadius:0,flexGrow:1},vce=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=W(),r=i.useCallback(()=>{var o;(o=t.current)==null||o.expand()},[t]);return e?a.jsx(Uc,{children:a.jsxs($,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs($t,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(Fe,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:Jp,icon:a.jsx(qM,{})}),a.jsx($7,{asIconButton:!0,sx:Jp}),a.jsx(D7,{asIconButton:!0,sx:Jp})]}),a.jsx(P2,{asIconButton:!0,sx:Jp})]})}):null},bce=i.memo(vce),xce=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:l}=sr({defaultIsOpen:o}),{colorMode:c}=ya();return a.jsxs(Ie,{children:[a.jsxs($,{onClick:l,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Te("base.250","base.750")(c),color:Te("base.900","base.100")(c),_hover:{bg:Te("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(hr,{children:n&&a.jsx(Mn.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(be,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(Wr,{}),a.jsx(Kg,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Xd,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Ie,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},_r=i.memo(xce),yce=fe(pe,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}}),Cce=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=H(yce),s=te(),{t:l}=W(),c=i.useCallback(f=>{s(QT(f))},[s]),d=i.useCallback(()=>{s(YT())},[s]);return a.jsx(Ot,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(nt,{label:l("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:c,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})})},wce=i.memo(Cce),Sce=fe(pe,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}}),kce={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},jce=()=>{const{t:e}=W(),{prompts:t,parsingError:n,isLoading:r,isError:o}=H(Sce);return o?a.jsx(Ot,{feature:"dynamicPrompts",children:a.jsx($,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(Tn,{icon:lae,label:"Problem generating prompts"})})}):a.jsx(Ot,{feature:"dynamicPrompts",children:a.jsxs(Gt,{isInvalid:!!n,children:[a.jsxs(ln,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[e("dynamicPrompts.promptsPreview")," (",t.length,")",n&&` - ${n}`]}),a.jsxs($,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Sl,{children:a.jsx(N5,{stylePosition:"inside",ms:0,children:t.map((s,l)=>a.jsx(ts,{fontSize:"sm",sx:kce,children:a.jsx(be,{as:"span",children:s})},`${s}.${l}`))})}),r&&a.jsx($,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(va,{})})]})]})})},_ce=i.memo(jce),CO=i.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Ie,{ref:r,...n,children:a.jsxs(Ie,{children:[a.jsx(be,{fontWeight:600,children:e}),t&&a.jsx(be,{size:"xs",variant:"subtext",children:t})]})}));CO.displayName="IAIMantineSelectItemWithDescription";const Ice=i.memo(CO),Pce=()=>{const e=te(),{t}=W(),n=H(s=>s.dynamicPrompts.seedBehaviour),r=i.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=i.useCallback(s=>{s&&e(ZT(s))},[e]);return a.jsx(Ot,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(yn,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:Ice,onChange:o})})},Ece=i.memo(Pce),Mce=()=>{const{t:e}=W(),t=i.useMemo(()=>fe(pe,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=H(t);return Mt("dynamicPrompting").isFeatureEnabled?a.jsx(_r,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(_ce,{}),a.jsx(Ece,{}),a.jsx(wce,{})]})}):null},uu=i.memo(Mce),Oce=e=>{const t=te(),{lora:n}=e,r=i.useCallback(l=>{t(JT({id:n.id,weight:l}))},[t,n.id]),o=i.useCallback(()=>{t(e9(n.id))},[t,n.id]),s=i.useCallback(()=>{t(t9(n.id))},[t,n.id]);return a.jsx(Ot,{feature:"lora",children:a.jsxs($,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(nt,{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(Fe,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(ao,{}),colorScheme:"error"})]})})},Dce=i.memo(Oce),Rce=fe(pe,({lora:e})=>({lorasArray:Hr(e.loras)})),Ace=()=>{const{lorasArray:e}=H(Rce);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(On,{pt:1}),a.jsx(Dce,{lora:t})]},t.model_name))})},Tce=i.memo(Ace),Nce=fe(pe,({lora:e})=>({loras:e.loras})),$ce=()=>{const e=te(),{loras:t}=H(Nce),{data:n}=Vd(),{t:r}=W(),o=H(d=>d.generation.model),s=i.useMemo(()=>{if(!n)return[];const d=[];return qn(n.entities,(f,m)=>{if(!f||m in t)return;const h=(o==null?void 0:o.base_model)!==f.base_model;d.push({value:m,label:f.model_name,disabled:h,group:xn[f.base_model],tooltip:h?`Incompatible base model: ${f.base_model}`:void 0})}),d.sort((f,m)=>f.label&&!m.label?1:-1),d.sort((f,m)=>f.disabled&&!m.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),l=i.useCallback(d=>{if(!d)return;const f=n==null?void 0:n.entities[d];f&&e(n9(f))},[e,n==null?void 0:n.entities]),c=i.useCallback((d,f)=>{var m;return((m=f.label)==null?void 0:m.toLowerCase().includes(d.toLowerCase().trim()))||f.value.toLowerCase().includes(d.toLowerCase().trim())},[]);return(n==null?void 0:n.ids.length)===0?a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(be,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:r("models.noLoRAsInstalled")})}):a.jsx(sn,{placeholder:s.length===0?"All LoRAs added":r("models.addLora"),value:null,data:s,nothingFound:"No matching LoRAs",itemComponent:xl,disabled:s.length===0,filter:c,onChange:l,"data-testid":"add-lora"})},Lce=i.memo($ce),Fce=fe(pe,e=>{const t=JI(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}}),zce=()=>{const{t:e}=W(),{activeLabel:t}=H(Fce);return Mt("lora").isFeatureEnabled?a.jsx(_r,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Lce,{}),a.jsx(Tce,{})]})}):null},du=i.memo(zce),Bce=()=>{const e=te(),t=H(o=>o.generation.shouldUseCpuNoise),{t:n}=W(),r=i.useCallback(o=>{e(r9(o.target.checked))},[e]);return a.jsx(Ot,{feature:"noiseUseCPU",children:a.jsx(_n,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},Hce=fe(pe,({generation:e})=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}}),Wce=()=>{const{t:e}=W(),{seamlessXAxis:t}=H(Hce),n=te(),r=i.useCallback(o=>{n(o9(o.target.checked))},[n]);return a.jsx(_n,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Vce=i.memo(Wce),Uce=fe(pe,({generation:e})=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}}),Gce=()=>{const{t:e}=W(),{seamlessYAxis:t}=H(Uce),n=te(),r=i.useCallback(o=>{n(s9(o.target.checked))},[n]);return a.jsx(_n,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Kce=i.memo(Gce),qce=()=>{const{t:e}=W();return Mt("seamless").isFeatureEnabled?a.jsxs(Gt,{children:[a.jsx(ln,{children:e("parameters.seamlessTiling")})," ",a.jsxs($,{sx:{gap:5},children:[a.jsx(Ie,{flexGrow:1,children:a.jsx(Vce,{})}),a.jsx(Ie,{flexGrow:1,children:a.jsx(Kce,{})})]})]}):null},Xce=i.memo(qce),Qce=fe([pe],({generation:e,hotkeys:t})=>{const{cfgRescaleMultiplier:n}=e,{shift:r}=t;return{cfgRescaleMultiplier:n,shift:r}}),Yce=()=>{const{cfgRescaleMultiplier:e,shift:t}=H(Qce),n=te(),{t:r}=W(),o=i.useCallback(l=>n(wm(l)),[n]),s=i.useCallback(()=>n(wm(0)),[n]);return a.jsx(Ot,{feature:"paramCFGRescaleMultiplier",children:a.jsx(nt,{label:r("parameters.cfgRescaleMultiplier"),step:t?.01:.05,min:0,max:.99,onChange:o,handleReset:s,value:e,sliderNumberInputProps:{max:.99},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})})},Zce=i.memo(Yce);function Jce(){const e=H(d=>d.generation.clipSkip),{model:t}=H(d=>d.generation),n=te(),{t:r}=W(),o=i.useCallback(d=>{n(eS(d))},[n]),s=i.useCallback(()=>{n(eS(0))},[n]),l=i.useMemo(()=>t?wp[t.base_model].maxClip:wp["sd-1"].maxClip,[t]),c=i.useMemo(()=>t?wp[t.base_model].markers:wp["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(Ot,{feature:"clipSkip",placement:"top",children:a.jsx(nt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:l,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:c,withInput:!0,withReset:!0,handleReset:s})})}const eue=fe(pe,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s,cfgRescaleMultiplier:l}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s,cfgRescaleMultiplier:l}});function fu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o,cfgRescaleMultiplier:s}=H(eue),{t:l}=W(),c=i.useMemo(()=>{const d=[];return o||d.push(l("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&d.push(l("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?d.push(l("parameters.seamlessX&Y")):n?d.push(l("parameters.seamlessX")):r&&d.push(l("parameters.seamlessY")),s&&d.push(l("parameters.cfgRescale")),d.join(", ")},[s,e,t,n,r,o,l]);return a.jsx(_r,{label:l("common.advanced"),activeLabel:c,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Xce,{}),a.jsx(On,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(Jce,{}),a.jsx(On,{pt:2})]}),a.jsx(Bce,{}),a.jsx(On,{}),a.jsx(Zce,{})]})})}const _a=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{var o;return((o=Ao(r,e))==null?void 0:o.isEnabled)??!1}),[e]);return H(t)},tue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{var o;return(o=Ao(r,e))==null?void 0:o.model}),[e]);return H(t)},wO=e=>{const{data:t}=Ex(),n=i.useMemo(()=>t?NI.getSelectors().selectAll(t):[],[t]),{data:r}=Mx(),o=i.useMemo(()=>r?$I.getSelectors().selectAll(r):[],[r]),{data:s}=Ox(),l=i.useMemo(()=>s?LI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?l:[]},SO=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{var o;return(o=Ao(r,e))==null?void 0:o.type}),[e]);return H(t)},nue=fe(pe,({generation:e})=>{const{model:t}=e;return{mainModel:t}}),rue=({id:e})=>{const t=_a(e),n=SO(e),r=tue(e),o=te(),{mainModel:s}=H(nue),{t:l}=W(),c=wO(n),d=i.useMemo(()=>{if(!c)return[];const h=[];return c.forEach(g=>{if(!g)return;const b=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:g.id,label:g.model_name,group:xn[g.base_model],disabled:b,tooltip:b?`${l("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h.sort((g,b)=>g.disabled?1:b.disabled?-1:g.label.localeCompare(b.label)),h},[s==null?void 0:s.base_model,c,l]),f=i.useMemo(()=>c.find(h=>(h==null?void 0:h.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]),m=i.useCallback(h=>{if(!h)return;const g=gO(h);g&&o(a9({id:e,model:g}))},[o,e]);return a.jsx(sn,{itemComponent:xl,data:d,error:!f||(s==null?void 0:s.base_model)!==f.base_model,placeholder:l("controlnet.selectModel"),value:(f==null?void 0:f.id)??null,onChange:m,disabled:!t,tooltip:f==null?void 0:f.description})},oue=i.memo(rue),sue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{var o;return(o=Ao(r,e))==null?void 0:o.weight}),[e]);return H(t)},aue=({id:e})=>{const t=_a(e),n=sue(e),r=te(),{t:o}=W(),s=i.useCallback(l=>{r(l9({id:e,weight:l}))},[r,e]);return na(n)?null:a.jsx(Ot,{feature:"controlNetWeight",children:a.jsx(nt,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},lue=i.memo(aue),iue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{var o;return(o=Ao(r,e))==null?void 0:o.controlImage}),[e]);return H(t)},cue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);return o&&Gc(o)?o.processedControlImage:void 0}),[e]);return H(t)},uue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);return o&&Gc(o)?o.processorType:void 0}),[e]);return H(t)},due=fe(pe,({controlAdapters:e,gallery:t,system:n})=>{const{pendingControlImages:r}=e,{autoAddBoardId:o}=t,{isConnected:s}=n;return{pendingControlImages:r,autoAddBoardId:o,isConnected:s}}),fue=({isSmall:e,id:t})=>{const n=iue(t),r=cue(t),o=uue(t),s=te(),{t:l}=W(),{pendingControlImages:c,autoAddBoardId:d,isConnected:f}=H(due),m=H(tr),[h,g]=i.useState(!1),{currentData:b,isError:y}=jo(n??Br),{currentData:x,isError:w}=jo(r??Br),[S]=i9(),[j]=c9(),[_]=u9(),I=i.useCallback(()=>{s(d9({id:t,controlImage:null}))},[t,s]),E=i.useCallback(async()=>{x&&(await S({imageDTO:x,is_intermediate:!1}).unwrap(),d!=="none"?j({imageDTO:x,board_id:d}):_({imageDTO:x}))},[x,S,d,j,_]),M=i.useCallback(()=>{b&&(m==="unifiedCanvas"?s(es({width:b.width,height:b.height})):(s(Za(b.width)),s(Ja(b.height))))},[b,m,s]),D=i.useCallback(()=>{g(!0)},[]),R=i.useCallback(()=>{g(!1)},[]),N=i.useMemo(()=>{if(b)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:b}}},[b,t]),O=i.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),T=i.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),U=b&&x&&!h&&!c.includes(t)&&o!=="none";return i.useEffect(()=>{f&&(y||w)&&I()},[I,f,y,w]),a.jsxs($,{onMouseEnter:D,onMouseLeave:R,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(fl,{draggableData:N,droppableData:O,imageDTO:b,isDropDisabled:U,postUploadAction:T}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:U?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(fl,{draggableData:N,droppableData:O,imageDTO:x,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(jc,{onClick:I,icon:b?a.jsx(Ng,{}):void 0,tooltip:l("controlnet.resetControlImage")}),a.jsx(jc,{onClick:E,icon:b?a.jsx(gf,{size:16}):void 0,tooltip:l("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(jc,{onClick:M,icon:b?a.jsx(Qy,{size:16}):void 0,tooltip:l("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),c.includes(t)&&a.jsx($,{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(va,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},b_=i.memo(fue),No=()=>{const e=te();return i.useCallback((n,r)=>{e(f9({id:n,params:r}))},[e])};function $o(e){return a.jsx($,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const x_=jr.canny_image_processor.default,pue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,l=No(),{t:c}=W(),d=i.useCallback(g=>{l(t,{low_threshold:g})},[t,l]),f=i.useCallback(()=>{l(t,{low_threshold:x_.low_threshold})},[t,l]),m=i.useCallback(g=>{l(t,{high_threshold:g})},[t,l]),h=i.useCallback(()=>{l(t,{high_threshold:x_.high_threshold})},[t,l]);return a.jsxs($o,{children:[a.jsx(nt,{isDisabled:!r,label:c("controlnet.lowThreshold"),value:o,onChange:d,handleReset:f,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(nt,{isDisabled:!r,label:c("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},mue=i.memo(pue),hue=jr.color_map_image_processor.default,gue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=No(),{t:l}=W(),c=i.useCallback(f=>{s(t,{color_map_tile_size:f})},[t,s]),d=i.useCallback(()=>{s(t,{color_map_tile_size:hue.color_map_tile_size})},[t,s]);return a.jsx($o,{children:a.jsx(nt,{isDisabled:!r,label:l("controlnet.colorMapTileSize"),value:o,onChange:c,handleReset:d,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},vue=i.memo(gue),Wu=jr.content_shuffle_image_processor.default,bue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:l,h:c,f:d}=n,f=No(),{t:m}=W(),h=i.useCallback(E=>{f(t,{detect_resolution:E})},[t,f]),g=i.useCallback(()=>{f(t,{detect_resolution:Wu.detect_resolution})},[t,f]),b=i.useCallback(E=>{f(t,{image_resolution:E})},[t,f]),y=i.useCallback(()=>{f(t,{image_resolution:Wu.image_resolution})},[t,f]),x=i.useCallback(E=>{f(t,{w:E})},[t,f]),w=i.useCallback(()=>{f(t,{w:Wu.w})},[t,f]),S=i.useCallback(E=>{f(t,{h:E})},[t,f]),j=i.useCallback(()=>{f(t,{h:Wu.h})},[t,f]),_=i.useCallback(E=>{f(t,{f:E})},[t,f]),I=i.useCallback(()=>{f(t,{f:Wu.f})},[t,f]);return a.jsxs($o,{children:[a.jsx(nt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:m("controlnet.imageResolution"),value:o,onChange:b,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:m("controlnet.w"),value:l,onChange:x,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:m("controlnet.h"),value:c,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:m("controlnet.f"),value:d,onChange:_,handleReset:I,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},xue=i.memo(bue),y_=jr.hed_image_processor.default,yue=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,l=No(),{t:c}=W(),d=i.useCallback(b=>{l(t,{detect_resolution:b})},[t,l]),f=i.useCallback(b=>{l(t,{image_resolution:b})},[t,l]),m=i.useCallback(b=>{l(t,{scribble:b.target.checked})},[t,l]),h=i.useCallback(()=>{l(t,{detect_resolution:y_.detect_resolution})},[t,l]),g=i.useCallback(()=>{l(t,{image_resolution:y_.image_resolution})},[t,l]);return a.jsxs($o,{children:[a.jsx(nt,{label:c("controlnet.detectResolution"),value:n,onChange:d,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(nt,{label:c("controlnet.imageResolution"),value:r,onChange:f,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(_n,{label:c("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},Cue=i.memo(yue),C_=jr.lineart_anime_image_processor.default,wue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,l=No(),{t:c}=W(),d=i.useCallback(g=>{l(t,{detect_resolution:g})},[t,l]),f=i.useCallback(g=>{l(t,{image_resolution:g})},[t,l]),m=i.useCallback(()=>{l(t,{detect_resolution:C_.detect_resolution})},[t,l]),h=i.useCallback(()=>{l(t,{image_resolution:C_.image_resolution})},[t,l]);return a.jsxs($o,{children:[a.jsx(nt,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:c("controlnet.imageResolution"),value:o,onChange:f,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Sue=i.memo(wue),w_=jr.lineart_image_processor.default,kue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:l}=n,c=No(),{t:d}=W(),f=i.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),m=i.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),h=i.useCallback(()=>{c(t,{detect_resolution:w_.detect_resolution})},[t,c]),g=i.useCallback(()=>{c(t,{image_resolution:w_.image_resolution})},[t,c]),b=i.useCallback(y=>{c(t,{coarse:y.target.checked})},[t,c]);return a.jsxs($o,{children:[a.jsx(nt,{label:d("controlnet.detectResolution"),value:s,onChange:f,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:d("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_n,{label:d("controlnet.coarse"),isChecked:l,onChange:b,isDisabled:!r})]})},jue=i.memo(kue),S_=jr.mediapipe_face_processor.default,_ue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,l=No(),{t:c}=W(),d=i.useCallback(g=>{l(t,{max_faces:g})},[t,l]),f=i.useCallback(g=>{l(t,{min_confidence:g})},[t,l]),m=i.useCallback(()=>{l(t,{max_faces:S_.max_faces})},[t,l]),h=i.useCallback(()=>{l(t,{min_confidence:S_.min_confidence})},[t,l]);return a.jsxs($o,{children:[a.jsx(nt,{label:c("controlnet.maxFaces"),value:o,onChange:d,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:c("controlnet.minConfidence"),value:s,onChange:f,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Iue=i.memo(_ue),k_=jr.midas_depth_image_processor.default,Pue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,l=No(),{t:c}=W(),d=i.useCallback(g=>{l(t,{a_mult:g})},[t,l]),f=i.useCallback(g=>{l(t,{bg_th:g})},[t,l]),m=i.useCallback(()=>{l(t,{a_mult:k_.a_mult})},[t,l]),h=i.useCallback(()=>{l(t,{bg_th:k_.bg_th})},[t,l]);return a.jsxs($o,{children:[a.jsx(nt,{label:c("controlnet.amult"),value:o,onChange:d,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:c("controlnet.bgth"),value:s,onChange:f,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Eue=i.memo(Pue),em=jr.mlsd_image_processor.default,Mue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:l,thr_v:c}=n,d=No(),{t:f}=W(),m=i.useCallback(j=>{d(t,{detect_resolution:j})},[t,d]),h=i.useCallback(j=>{d(t,{image_resolution:j})},[t,d]),g=i.useCallback(j=>{d(t,{thr_d:j})},[t,d]),b=i.useCallback(j=>{d(t,{thr_v:j})},[t,d]),y=i.useCallback(()=>{d(t,{detect_resolution:em.detect_resolution})},[t,d]),x=i.useCallback(()=>{d(t,{image_resolution:em.image_resolution})},[t,d]),w=i.useCallback(()=>{d(t,{thr_d:em.thr_d})},[t,d]),S=i.useCallback(()=>{d(t,{thr_v:em.thr_v})},[t,d]);return a.jsxs($o,{children:[a.jsx(nt,{label:f("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:f("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:f("controlnet.w"),value:l,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:f("controlnet.h"),value:c,onChange:b,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Oue=i.memo(Mue),j_=jr.normalbae_image_processor.default,Due=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,l=No(),{t:c}=W(),d=i.useCallback(g=>{l(t,{detect_resolution:g})},[t,l]),f=i.useCallback(g=>{l(t,{image_resolution:g})},[t,l]),m=i.useCallback(()=>{l(t,{detect_resolution:j_.detect_resolution})},[t,l]),h=i.useCallback(()=>{l(t,{image_resolution:j_.image_resolution})},[t,l]);return a.jsxs($o,{children:[a.jsx(nt,{label:c("controlnet.detectResolution"),value:s,onChange:d,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:c("controlnet.imageResolution"),value:o,onChange:f,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Rue=i.memo(Due),__=jr.openpose_image_processor.default,Aue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:l}=n,c=No(),{t:d}=W(),f=i.useCallback(y=>{c(t,{detect_resolution:y})},[t,c]),m=i.useCallback(y=>{c(t,{image_resolution:y})},[t,c]),h=i.useCallback(()=>{c(t,{detect_resolution:__.detect_resolution})},[t,c]),g=i.useCallback(()=>{c(t,{image_resolution:__.image_resolution})},[t,c]),b=i.useCallback(y=>{c(t,{hand_and_face:y.target.checked})},[t,c]);return a.jsxs($o,{children:[a.jsx(nt,{label:d("controlnet.detectResolution"),value:s,onChange:f,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:d("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_n,{label:d("controlnet.handAndFace"),isChecked:l,onChange:b,isDisabled:!r})]})},Tue=i.memo(Aue),I_=jr.pidi_image_processor.default,Nue=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:l,safe:c}=n,d=No(),{t:f}=W(),m=i.useCallback(w=>{d(t,{detect_resolution:w})},[t,d]),h=i.useCallback(w=>{d(t,{image_resolution:w})},[t,d]),g=i.useCallback(()=>{d(t,{detect_resolution:I_.detect_resolution})},[t,d]),b=i.useCallback(()=>{d(t,{image_resolution:I_.image_resolution})},[t,d]),y=i.useCallback(w=>{d(t,{scribble:w.target.checked})},[t,d]),x=i.useCallback(w=>{d(t,{safe:w.target.checked})},[t,d]);return a.jsxs($o,{children:[a.jsx(nt,{label:f("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(nt,{label:f("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(_n,{label:f("controlnet.scribble"),isChecked:l,onChange:y}),a.jsx(_n,{label:f("controlnet.safe"),isChecked:c,onChange:x,isDisabled:!r})]})},$ue=i.memo(Nue),Lue=e=>null,Fue=i.memo(Lue),kO=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);return o&&Gc(o)?o.processorNode:void 0}),[e]);return H(t)},zue=({id:e})=>{const t=_a(e),n=kO(e);return n?n.type==="canny_image_processor"?a.jsx(mue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(vue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(Cue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(jue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(xue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(Sue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(Iue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(Eue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(Oue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(Rue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(Tue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx($ue,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(Fue,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},Bue=i.memo(zue),Hue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);if(o&&Gc(o))return o.shouldAutoConfig}),[e]);return H(t)},Wue=({id:e})=>{const t=_a(e),n=Hue(e),r=te(),{t:o}=W(),s=i.useCallback(()=>{r(p9({id:e}))},[e,r]);return na(n)?null:a.jsx(_n,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},Vue=i.memo(Wue),Uue=e=>{const{id:t}=e,n=te(),{t:r}=W(),o=i.useCallback(()=>{n(m9({id:t}))},[t,n]),s=i.useCallback(()=>{n(h9({id:t}))},[t,n]);return a.jsxs($,{sx:{gap:2},children:[a.jsx(Fe,{size:"sm",icon:a.jsx(si,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(Fe,{size:"sm",icon:a.jsx(UM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Gue=i.memo(Uue),Kue=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0}),[e]);return H(t)},P_=e=>`${Math.round(e*100)}%`,que=({id:e})=>{const t=_a(e),n=Kue(e),r=te(),{t:o}=W(),s=i.useCallback(l=>{r(g9({id:e,beginStepPct:l[0]})),r(v9({id:e,endStepPct:l[1]}))},[r,e]);return n?a.jsx(Ot,{feature:"controlNetBeginEnd",children:a.jsxs(Gt,{isDisabled:!t,children:[a.jsx(ln,{children:o("controlnet.beginEndStepPercent")}),a.jsx(ug,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(O6,{"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(D6,{children:a.jsx(R6,{})}),a.jsx(Ut,{label:P_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(bb,{index:0})}),a.jsx(Ut,{label:P_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(bb,{index:1})}),a.jsx(dm,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(dm,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(dm,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},Xue=i.memo(que),Que=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);if(o&&b9(o))return o.controlMode}),[e]);return H(t)};function Yue({id:e}){const t=_a(e),n=Que(e),r=te(),{t:o}=W(),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"}],l=i.useCallback(c=>{r(x9({id:e,controlMode:c}))},[e,r]);return n?a.jsx(Ot,{feature:"controlNetControlMode",children:a.jsx(yn,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:l})}):null}const Zue=e=>e.config,Jue=fe(Zue,e=>Hr(jr,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))),ede=({id:e})=>{const t=_a(e),n=kO(e),r=te(),o=H(Jue),{t:s}=W(),l=i.useCallback(c=>{r(y9({id:e,processorType:c}))},[e,r]);return n?a.jsx(sn,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:l,disabled:!t}):null},tde=i.memo(ede),nde=e=>{const t=i.useMemo(()=>fe(pe,({controlAdapters:r})=>{const o=Ao(r,e);if(o&&Gc(o))return o.resizeMode}),[e]);return H(t)};function rde({id:e}){const t=_a(e),n=nde(e),r=te(),{t:o}=W(),s=[{label:o("controlnet.resize"),value:"just_resize"},{label:o("controlnet.crop"),value:"crop_resize"},{label:o("controlnet.fill"),value:"fill_resize"}],l=i.useCallback(c=>{r(C9({id:e,resizeMode:c}))},[e,r]);return n?a.jsx(Ot,{feature:"controlNetResizeMode",children:a.jsx(yn,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:l})}):null}const ode=e=>{const{id:t,number:n}=e,r=SO(t),o=te(),{t:s}=W(),l=H(tr),c=_a(t),[d,f]=ene(!1),m=i.useCallback(()=>{o(w9({id:t}))},[t,o]),h=i.useCallback(()=>{o(S9(t))},[t,o]),g=i.useCallback(b=>{o(k9({id:t,isEnabled:b.target.checked}))},[t,o]);return r?a.jsxs($,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx($,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(_n,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:c,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Ie,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(oue,{id:t})}),l==="unifiedCanvas"&&a.jsx(Gue,{id:t}),a.jsx(Fe,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:h,icon:a.jsx(ru,{})}),a.jsx(Fe,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:m,icon:a.jsx(ao,{})}),a.jsx(Fe,{size:"sm",tooltip:s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(d?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:f,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(Kg,{sx:{boxSize:4,color:"base.700",transform:d?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs($,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs($,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs($,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:d?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(lue,{id:t}),a.jsx(Xue,{id:t})]}),!d&&a.jsx($,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(b_,{id:t,isSmall:!0})})]}),a.jsxs($,{sx:{gap:2},children:[a.jsx(Yue,{id:t}),a.jsx(rde,{id:t})]}),a.jsx(tde,{id:t})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(b_,{id:t}),a.jsx(Vue,{id:t}),a.jsx(Bue,{id:t})]})]}):null},sde=i.memo(ode),_1=e=>{const t=H(c=>{var d;return(d=c.generation.model)==null?void 0:d.base_model}),n=te(),r=wO(e),o=i.useMemo(()=>{const c=r.filter(d=>t?d.base_model===t:!0)[0];return c||r[0]},[t,r]),s=i.useMemo(()=>!o,[o]);return[i.useCallback(()=>{s||n(j9({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},ade=fe([pe],({controlAdapters:e})=>{const t=[];let n=!1;const r=_9(e).filter(m=>m.isEnabled).length,o=I9(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=P9(e).filter(m=>m.isEnabled).length,l=E9(e).length;s>0&&t.push(`${s} ControlNet`),s>l&&(n=!0);const c=M9(e).filter(m=>m.isEnabled).length,d=O9(e).length;return c>0&&t.push(`${c} T2I`),c>d&&(n=!0),{controlAdapterIds:D9(e).map(String),activeLabel:t.join(", "),isError:n}}),lde=()=>{const{t:e}=W(),{controlAdapterIds:t,activeLabel:n}=H(ade),r=Mt("controlNet").isFeatureDisabled,[o,s]=_1("controlnet"),[l,c]=_1("ip_adapter"),[d,f]=_1("t2i_adapter");return r?null:a.jsx(_r,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsxs($t,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Xe,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(nl,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Xe,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(nl,{}),onClick:l,"data-testid":"add ip adapter",flexGrow:1,isDisabled:c,children:e("common.ipAdapter")}),a.jsx(Xe,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(nl,{}),onClick:d,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:f,children:e("common.t2iAdapter")})]}),t.map((m,h)=>a.jsxs(i.Fragment,{children:[a.jsx(On,{}),a.jsx(sde,{id:m,number:h+1})]},m))]})})},pu=i.memo(lde),ide=e=>{const{onClick:t}=e,{t:n}=W();return a.jsx(Fe,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(LM,{}),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=i.memo(ide),cde="28rem",ude=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=R9(),l=i.useRef(null),{t:c}=W(),d=H(g=>g.generation.model),f=i.useMemo(()=>{if(!s)return[];const g=[];return qn(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:xn[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]),m=i.useCallback(g=>{g&&t(g)},[t]),h=i.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(lf,{initialFocusRef:l,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(yg,{children:o}),a.jsx(cf,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Cg,{sx:{p:0,w:`calc(${cde} - 2rem )`},children:f.length===0?a.jsx($,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(be,{children:c("embedding.noEmbeddingsLoaded")})}):a.jsx(sn,{inputRef:l,autoFocus:!0,placeholder:c("embedding.addEmbedding"),value:null,data:f,nothingFound:c("embedding.noMatchingEmbedding"),itemComponent:xl,disabled:f.length===0,onDropdownClose:r,filter:h,onChange:m})})})]})},u0=i.memo(ude),dde=()=>{const e=H(h=>h.generation.negativePrompt),t=i.useRef(null),{isOpen:n,onClose:r,onOpen:o}=sr(),s=te(),{t:l}=W(),c=i.useCallback(h=>{s(rd(h.target.value))},[s]),d=i.useCallback(h=>{h.key==="<"&&o()},[o]),f=i.useCallback(h=>{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+=`${h}>`;const y=b.length;b+=e.slice(g),Jr.flushSync(()=>{s(rd(b))}),t.current.selectionEnd=y,r()},[s,r,e]),m=Mt("embedding").isFeatureEnabled;return a.jsxs(Gt,{children:[a.jsx(u0,{isOpen:n,onClose:r,onSelect:f,children:a.jsx(Ot,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(ga,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:l("parameters.negativePromptPlaceholder"),onChange:c,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:d}})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(c0,{onClick:o})})]})},jO=i.memo(dde),fde=fe([pe],({generation:e})=>({prompt:e.positivePrompt})),pde=()=>{const e=te(),{prompt:t}=H(fde),n=i.useRef(null),{isOpen:r,onClose:o,onOpen:s}=sr(),{t:l}=W(),c=i.useCallback(h=>{e(nd(h.target.value))},[e]);tt("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const d=i.useCallback(h=>{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+=`${h}>`;const y=b.length;b+=t.slice(g),Jr.flushSync(()=>{e(nd(b))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),f=Mt("embedding").isFeatureEnabled,m=i.useCallback(h=>{f&&h.key==="<"&&s()},[s,f]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(Gt,{children:a.jsx(u0,{isOpen:r,onClose:o,onSelect:d,children:a.jsx(Ot,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(ga,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:l("parameters.positivePromptPlaceholder"),onChange:c,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&f&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(c0,{onClick:s})})]})},_O=i.memo(pde);function mde(){const e=H(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=W(),r=i.useCallback(()=>{t(A9(!e))},[t,e]);return a.jsx(Fe,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(WM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const E_={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 IO(){return a.jsxs($,{children:[a.jsx(Ie,{as:Mn.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",...E_,_dark:{borderColor:"accent.500"}}}),a.jsx(Ie,{as:Mn.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(WM,{size:12})}),a.jsx(Ie,{as:Mn.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",...E_,_dark:{borderColor:"accent.500"}}})]})}const hde=fe([pe],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}}),gde=()=>{const e=te(),t=i.useRef(null),{isOpen:n,onClose:r,onOpen:o}=sr(),{t:s}=W(),{prompt:l,shouldConcatSDXLStylePrompt:c}=H(hde),d=i.useCallback(g=>{e(sd(g.target.value))},[e]),f=i.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=l.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=l.slice(b),Jr.flushSync(()=>{e(sd(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,l]),m=Mt("embedding").isFeatureEnabled,h=i.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(hr,{children:c&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(IO,{})})}),a.jsx(Gt,{children:a.jsx(u0,{isOpen:n,onClose:r,onSelect:f,children:a.jsx(ga,{id:"prompt",name:"prompt",ref:t,value:l,placeholder:s("sdxl.negStylePrompt"),onChange:d,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(c0,{onClick:o})})]})},vde=i.memo(gde),bde=fe([pe],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}}),xde=()=>{const e=te(),t=i.useRef(null),{isOpen:n,onClose:r,onOpen:o}=sr(),{t:s}=W(),{prompt:l,shouldConcatSDXLStylePrompt:c}=H(bde),d=i.useCallback(g=>{e(od(g.target.value))},[e]),f=i.useCallback(g=>{if(!t.current)return;const b=t.current.selectionStart;if(b===void 0)return;let y=l.slice(0,b);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const x=y.length;y+=l.slice(b),Jr.flushSync(()=>{e(od(y))}),t.current.selectionStart=x,t.current.selectionEnd=x,r()},[e,r,l]),m=Mt("embedding").isFeatureEnabled,h=i.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(hr,{children:c&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(IO,{})})}),a.jsx(Gt,{children:a.jsx(u0,{isOpen:n,onClose:r,onSelect:f,children:a.jsx(ga,{id:"prompt",name:"prompt",ref:t,value:l,placeholder:s("sdxl.posStylePrompt"),onChange:d,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(c0,{onClick:o})})]})},yde=i.memo(xde);function L2(){return a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(_O,{}),a.jsx(mde,{}),a.jsx(yde,{}),a.jsx(jO,{}),a.jsx(vde,{})]})}const kl=()=>{const{isRefinerAvailable:e}=as(Fx,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},Cde=fe([pe],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}}),wde=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=H(Cde),r=kl(),o=te(),{t:s}=W(),l=i.useCallback(d=>o(B1(d)),[o]),c=i.useCallback(()=>o(B1(7)),[o]);return t?a.jsx(nt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:l,handleReset:c,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(_s,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:l,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Sde=i.memo(wde),kde=e=>{const t=hl("models"),[n,r,o]=e.split("/"),s=T9.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},jde=fe(pe,e=>({model:e.sdxl.refinerModel})),_de=()=>{const e=te(),t=Mt("syncModels").isFeatureEnabled,{model:n}=H(jde),{t:r}=W(),{data:o,isLoading:s}=as(Fx),l=i.useMemo(()=>{if(!o)return[];const f=[];return qn(o.entities,(m,h)=>{m&&f.push({value:h,label:m.model_name,group:xn[m.base_model]})}),f},[o]),c=i.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=i.useCallback(f=>{if(!f)return;const m=kde(f);m&&e(FI(m))},[e]);return s?a.jsx(sn,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(sn,{tooltip:c==null?void 0:c.description,label:r("sdxl.refinermodel"),value:c==null?void 0:c.id,placeholder:l.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:l,error:l.length===0,disabled:l.length===0,onChange:d,w:"100%"}),t&&a.jsx(Ie,{mt:7,children:a.jsx(cu,{iconMode:!0})})]})},Ide=i.memo(_de),Pde=fe([pe],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}}),Ede=()=>{const{refinerNegativeAestheticScore:e,shift:t}=H(Pde),n=kl(),r=te(),{t:o}=W(),s=i.useCallback(c=>r(W1(c)),[r]),l=i.useCallback(()=>r(W1(2.5)),[r]);return a.jsx(nt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:l,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Mde=i.memo(Ede),Ode=fe([pe],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}}),Dde=()=>{const{refinerPositiveAestheticScore:e,shift:t}=H(Ode),n=kl(),r=te(),{t:o}=W(),s=i.useCallback(c=>r(H1(c)),[r]),l=i.useCallback(()=>r(H1(6)),[r]);return a.jsx(nt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:l,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Rde=i.memo(Dde),Ade=fe(pe,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=Hr(Gh,(s,l)=>({value:l,label:s,group:r.includes(l)?"Favorites":void 0})).sort((s,l)=>s.label.localeCompare(l.label));return{refinerScheduler:n,data:o}}),Tde=()=>{const e=te(),{t}=W(),{refinerScheduler:n,data:r}=H(Ade),o=kl(),s=i.useCallback(l=>{l&&e(zI(l))},[e]);return a.jsx(sn,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Nde=i.memo(Tde),$de=fe([pe],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}}),Lde=()=>{const{refinerStart:e}=H($de),t=te(),n=kl(),r=i.useCallback(l=>t(V1(l)),[t]),{t:o}=W(),s=i.useCallback(()=>t(V1(.8)),[t]);return a.jsx(nt,{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})},Fde=i.memo(Lde),zde=fe([pe],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}}),Bde=()=>{const{refinerSteps:e,shouldUseSliders:t}=H(zde),n=kl(),r=te(),{t:o}=W(),s=i.useCallback(c=>{r(z1(c))},[r]),l=i.useCallback(()=>{r(z1(20))},[r]);return t?a.jsx(nt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:l,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(_s,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},Hde=i.memo(Bde);function Wde(){const e=H(s=>s.sdxl.shouldUseSDXLRefiner),t=kl(),n=te(),{t:r}=W(),o=i.useCallback(s=>{n(N9(s.target.checked))},[n]);return a.jsx(_n,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Vde=fe(pe,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}}),Ude=()=>{const{activeLabel:e,shouldUseSliders:t}=H(Vde),{t:n}=W();return kl()?a.jsx(_r,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Wde,{}),a.jsx(Ide,{}),a.jsxs($,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(Hde,{}),a.jsx(Sde,{})]}),a.jsx(Nde,{}),a.jsx(Rde,{}),a.jsx(Mde,{}),a.jsx(Fde,{})]})}):a.jsx(_r,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(be,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},F2=i.memo(Ude),Gde=fe([pe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:l,inputMax:c}=t.sd.guidance,{cfgScale:d}=e,{shouldUseSliders:f}=n,{shift:m}=r;return{cfgScale:d,initial:o,min:s,sliderMax:l,inputMax:c,shouldUseSliders:f,shift:m}}),Kde=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:l}=H(Gde),c=te(),{t:d}=W(),f=i.useCallback(h=>c(Cm(h)),[c]),m=i.useCallback(()=>c(Cm(t)),[c,t]);return s?a.jsx(Ot,{feature:"paramCFGScale",children:a.jsx(nt,{label:d("parameters.cfgScale"),step:l?.1:.5,min:n,max:r,onChange:f,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(Ot,{feature:"paramCFGScale",children:a.jsx(_s,{label:d("parameters.cfgScale"),step:.5,min:n,max:o,onChange:f,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Ds=i.memo(Kde),qde=fe(pe,e=>({model:e.generation.model})),Xde=()=>{const e=te(),{t}=W(),{model:n}=H(qde),r=Mt("syncModels").isFeatureEnabled,{data:o,isLoading:s}=as(tS),{data:l,isLoading:c}=vd(tS),d=H(tr),f=i.useMemo(()=>{if(!o)return[];const g=[];return qn(o.entities,(b,y)=>{b&&g.push({value:y,label:b.model_name,group:xn[b.base_model]})}),qn(l==null?void 0:l.entities,(b,y)=>{!b||d==="unifiedCanvas"||d==="img2img"||g.push({value:y,label:b.model_name,group:xn[b.base_model]})}),g},[o,l,d]),m=i.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(l==null?void 0:l.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,l==null?void 0:l.entities]),h=i.useCallback(g=>{if(!g)return;const b=i0(g);b&&e(N1(b))},[e]);return s||c?a.jsx(sn,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(Ot,{feature:"paramModel",children:a.jsx(sn,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:f.length>0?"Select a model":"No models available",data:f,error:f.length===0,disabled:f.length===0,onChange:h,w:"100%"})}),r&&a.jsx(Ie,{mt:6,children:a.jsx(cu,{iconMode:!0})})]})},Qde=i.memo(Xde),Yde=fe(pe,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}}),Zde=()=>{const e=te(),{t}=W(),{model:n,vae:r}=H(Yde),{data:o}=YI(),s=i.useMemo(()=>{if(!o)return[];const d=[{value:"default",label:"Default",group:"Default"}];return qn(o.entities,(f,m)=>{if(!f)return;const h=(n==null?void 0:n.base_model)!==f.base_model;d.push({value:m,label:f.model_name,group:xn[f.base_model],disabled:h,tooltip:h?`Incompatible base model: ${f.base_model}`:void 0})}),d.sort((f,m)=>f.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),l=i.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=i.useCallback(d=>{if(!d||d==="default"){e(nc(null));return}const f=xO(d);f&&e(nc(f))},[e]);return a.jsx(Ot,{feature:"paramVAE",children:a.jsx(sn,{itemComponent:xl,tooltip:l==null?void 0:l.description,label:t("modelManager.vae"),value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:s,onChange:c,disabled:s.length===0,clearable:!0})})},Jde=i.memo(Zde),efe=fe([pe],({ui:e,generation:t})=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=Hr(Gh,(s,l)=>({value:l,label:s,group:r.includes(l)?"Favorites":void 0})).sort((s,l)=>s.label.localeCompare(l.label));return{scheduler:n,data:o}}),tfe=()=>{const e=te(),{t}=W(),{scheduler:n,data:r}=H(efe),o=i.useCallback(s=>{s&&e($1(s))},[e]);return a.jsx(Ot,{feature:"paramScheduler",children:a.jsx(sn,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},nfe=i.memo(tfe),rfe=fe(pe,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}}),ofe=["fp16","fp32"],sfe=()=>{const{t:e}=W(),t=te(),{vaePrecision:n}=H(rfe),r=i.useCallback(o=>{o&&t($9(o))},[t]);return a.jsx(Ot,{feature:"paramVAEPrecision",children:a.jsx(yn,{label:e("modelManager.vaePrecision"),value:n,data:ofe,onChange:r})})},afe=i.memo(sfe),lfe=()=>{const e=Mt("vae").isFeatureEnabled;return a.jsxs($,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Ie,{w:"full",children:a.jsx(Qde,{})}),a.jsx(Ie,{w:"full",children:a.jsx(nfe,{})}),e&&a.jsxs($,{w:"full",gap:3,children:[a.jsx(Jde,{}),a.jsx(afe,{})]})]})},Rs=i.memo(lfe),PO=[{name:wt.t("parameters.aspectRatioFree"),value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],EO=PO.map(e=>e.value);function MO(){const e=H(s=>s.generation.aspectRatio),t=te(),n=H(s=>s.generation.shouldFitToWidthHeight),r=H(tr),o=i.useCallback(s=>{t(Xo(s.value)),t(bd(!1))},[t]);return a.jsx($t,{isAttached:!0,children:PO.map(s=>a.jsx(Xe,{size:"sm",isChecked:e===s.value,isDisabled:r==="img2img"?!n:!1,onClick:o.bind(null,s),children:s.name},s.name))})}const ife=fe([pe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:l,coarseStep:c}=n.sd.height,{model:d,height:f}=e,{aspectRatio:m}=e,h=t.shift?l:c;return{model:d,height:f,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}}),cfe=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:l,aspectRatio:c}=H(ife),d=te(),{t:f}=W(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=i.useCallback(b=>{if(d(Ja(b)),c){const y=kr(b*c,8);d(Za(y))}},[d,c]),g=i.useCallback(()=>{if(d(Ja(m)),c){const b=kr(m*c,8);d(Za(b))}},[d,m,c]);return a.jsx(nt,{label:f("parameters.height"),value:n,min:r,step:l,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},ufe=i.memo(cfe),dfe=fe([pe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:l,coarseStep:c}=n.sd.width,{model:d,width:f,aspectRatio:m}=e,h=t.shift?l:c;return{model:d,width:f,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}}),ffe=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:l,aspectRatio:c}=H(dfe),d=te(),{t:f}=W(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=i.useCallback(b=>{if(d(Za(b)),c){const y=kr(b/c,8);d(Ja(y))}},[d,c]),g=i.useCallback(()=>{if(d(Za(m)),c){const b=kr(m/c,8);d(Ja(b))}},[d,m,c]);return a.jsx(nt,{label:f("parameters.width"),value:n,min:r,step:l,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},pfe=i.memo(ffe),mfe=fe([pe,tr],({generation:e},t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}});function Hc(){const{t:e}=W(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:l}=H(mfe),c=i.useCallback(()=>{o?(t(bd(!1)),EO.includes(s/l)?t(Xo(s/l)):t(Xo(null))):(t(bd(!0)),t(Xo(s/l)))},[o,s,l,t]),d=i.useCallback(()=>{t(L9()),t(Xo(null)),o&&t(Xo(l/s))},[t,o,s,l]);return a.jsxs($,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(Ot,{feature:"paramRatio",children:a.jsxs(Gt,{as:$,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(ln,{children:e("parameters.aspectRatio")}),a.jsx(Wr,{}),a.jsx(MO,{}),a.jsx(Fe,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(k7,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:d}),a.jsx(Fe,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(VM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:c})]})}),a.jsx($,{gap:2,alignItems:"center",children:a.jsxs($,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(pfe,{isDisabled:n==="img2img"?!r:!1}),a.jsx(ufe,{isDisabled:n==="img2img"?!r:!1})]})})]})}const hfe=fe([pe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:l,inputMax:c,fineStep:d,coarseStep:f}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?d:f;return{steps:m,initial:o,min:s,sliderMax:l,inputMax:c,step:g,shouldUseSliders:h}}),gfe=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:l}=H(hfe),c=te(),{t:d}=W(),f=i.useCallback(g=>{c(Sm(g))},[c]),m=i.useCallback(()=>{c(Sm(t))},[c,t]),h=i.useCallback(()=>{c(Nx())},[c]);return l?a.jsx(Ot,{feature:"paramSteps",children:a.jsx(nt,{label:d("parameters.steps"),min:n,max:r,step:s,onChange:f,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(Ot,{feature:"paramSteps",children:a.jsx(_s,{label:d("parameters.steps"),min:n,max:o,step:s,onChange:f,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},As=i.memo(gfe);function OO(){const e=te(),t=H(o=>o.generation.shouldFitToWidthHeight),n=i.useCallback(o=>{e(F9(o.target.checked))},[e]),{t:r}=W();return a.jsx(_n,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function vfe(){const e=H(l=>l.generation.seed),t=H(l=>l.generation.shouldRandomizeSeed),n=H(l=>l.generation.shouldGenerateVariations),{t:r}=W(),o=te(),s=i.useCallback(l=>o(ym(l)),[o]);return a.jsx(_s,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:e3,max:t3,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const bfe=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function xfe(){const e=te(),t=H(o=>o.generation.shouldRandomizeSeed),{t:n}=W(),r=i.useCallback(()=>e(ym(bfe(e3,t3))),[e]);return a.jsx(Fe,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(Wte,{})})}const yfe=()=>{const e=te(),{t}=W(),n=H(o=>o.generation.shouldRandomizeSeed),r=i.useCallback(o=>e(z9(o.target.checked)),[e]);return a.jsx(_n,{label:t("common.random"),isChecked:n,onChange:r})},Cfe=i.memo(yfe),wfe=()=>a.jsx(Ot,{feature:"paramSeed",children:a.jsxs($,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(vfe,{}),a.jsx(xfe,{}),a.jsx(Cfe,{})]})}),Ts=i.memo(wfe),DO=_e((e,t)=>a.jsxs($,{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(be,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));DO.displayName="SubSettingsWrapper";const Wc=i.memo(DO),Sfe=fe([pe],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}}),kfe=()=>{const{sdxlImg2ImgDenoisingStrength:e}=H(Sfe),t=te(),{t:n}=W(),r=i.useCallback(s=>t(nS(s)),[t]),o=i.useCallback(()=>{t(nS(.7))},[t]);return a.jsx(Ot,{feature:"paramDenoisingStrength",children:a.jsx(Wc,{children:a.jsx(nt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},RO=i.memo(kfe),jfe=fe([pe],({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}}),_fe=()=>{const{t:e}=W(),{shouldUseSliders:t,activeLabel:n}=H(jfe);return a.jsx(_r,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{})]}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hc,{})]}),a.jsx(RO,{}),a.jsx(OO,{})]})})},Ife=i.memo(_fe),Pfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(L2,{}),a.jsx(Ife,{}),a.jsx(F2,{}),a.jsx(pu,{}),a.jsx(du,{}),a.jsx(uu,{}),a.jsx(fu,{})]}),Efe=i.memo(Pfe),z2=()=>{const{t:e}=W(),t=H(l=>l.generation.shouldRandomizeSeed),n=H(l=>l.generation.iterations),r=i.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=i.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:i.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},Mfe=()=>{const{t:e}=W(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(_r,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx($,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{})]}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hc,{})]})})})},AO=i.memo(Mfe),Ofe=()=>a.jsxs(a.Fragment,{children:[a.jsx(L2,{}),a.jsx(AO,{}),a.jsx(F2,{}),a.jsx(pu,{}),a.jsx(du,{}),a.jsx(uu,{}),a.jsx(fu,{})]}),Dfe=i.memo(Ofe),Rfe=()=>{const e=te(),t=H(s=>s.generation.canvasCoherenceMode),{t:n}=W(),r=i.useMemo(()=>[{label:n("parameters.unmasked"),value:"unmasked"},{label:n("unifiedCanvas.mask"),value:"mask"},{label:n("parameters.maskEdge"),value:"edge"}],[n]),o=i.useCallback(s=>{s&&e(B9(s))},[e]);return a.jsx(Ot,{feature:"compositingCoherenceMode",children:a.jsx(yn,{label:n("parameters.coherenceMode"),data:r,value:t,onChange:o})})},Afe=i.memo(Rfe),Tfe=()=>{const e=te(),t=H(s=>s.generation.canvasCoherenceSteps),{t:n}=W(),r=i.useCallback(s=>{e(rS(s))},[e]),o=i.useCallback(()=>{e(rS(20))},[e]);return a.jsx(Ot,{feature:"compositingCoherenceSteps",children:a.jsx(nt,{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})})},Nfe=i.memo(Tfe),$fe=()=>{const e=te(),t=H(s=>s.generation.canvasCoherenceStrength),{t:n}=W(),r=i.useCallback(s=>{e(oS(s))},[e]),o=i.useCallback(()=>{e(oS(.3))},[e]);return a.jsx(Ot,{feature:"compositingStrength",children:a.jsx(nt,{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})})},Lfe=i.memo($fe);function Ffe(){const e=te(),t=H(s=>s.generation.maskBlur),{t:n}=W(),r=i.useCallback(s=>{e(sS(s))},[e]),o=i.useCallback(()=>{e(sS(16))},[e]);return a.jsx(Ot,{feature:"compositingBlur",children:a.jsx(nt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:o})})}const zfe=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function Bfe(){const e=H(o=>o.generation.maskBlurMethod),t=te(),{t:n}=W(),r=i.useCallback(o=>{o&&t(H9(o))},[t]);return a.jsx(Ot,{feature:"compositingBlurMethod",children:a.jsx(yn,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:zfe})})}const Hfe=()=>{const{t:e}=W();return a.jsx(_r,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Wc,{label:e("parameters.coherencePassHeader"),children:[a.jsx(Afe,{}),a.jsx(Nfe,{}),a.jsx(Lfe,{})]}),a.jsx(On,{}),a.jsxs(Wc,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(Ffe,{}),a.jsx(Bfe,{})]})]})})},TO=i.memo(Hfe),Wfe=fe([pe],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}}),Vfe=()=>{const e=te(),{infillMethod:t}=H(Wfe),{data:n,isLoading:r}=_I(),o=n==null?void 0:n.infill_methods,{t:s}=W(),l=i.useCallback(c=>{e(W9(c))},[e]);return a.jsx(Ot,{feature:"infillMethod",children:a.jsx(yn,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:l})})},Ufe=i.memo(Vfe),Gfe=fe([pe],({generation:e})=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}}),Kfe=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=H(Gfe),{t:r}=W(),o=i.useCallback(l=>{e(aS(l))},[e]),s=i.useCallback(()=>{e(aS(2))},[e]);return a.jsx(nt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},qfe=i.memo(Kfe),Xfe=fe([pe],({generation:e})=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}}),Qfe=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=H(Xfe),{t:r}=W(),o=i.useCallback(l=>{e(lS(l))},[e]),s=i.useCallback(()=>{e(lS(32))},[e]);return a.jsx(nt,{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})},Yfe=i.memo(Qfe),Zfe=fe([pe],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}});function Jfe(){const{infillMethod:e}=H(Zfe);return a.jsxs($,{children:[e==="tile"&&a.jsx(Yfe,{}),e==="patchmatch"&&a.jsx(qfe,{})]})}const epe=fe([pe],({canvas:e})=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}}),tpe=()=>{const e=te(),{boundingBoxScale:t}=H(epe),{t:n}=W(),r=i.useCallback(o=>{e(V9(o))},[e]);return a.jsx(Ot,{feature:"scaleBeforeProcessing",children:a.jsx(sn,{label:n("parameters.scaleBeforeProcessing"),data:U9,value:t,onChange:r})})},npe=i.memo(tpe),rpe=fe([pe],({generation:e,canvas:t})=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}}),ope=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(rpe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:l}=W(),c=i.useCallback(f=>{let m=r.width;const h=Math.floor(f);o&&(m=kr(h*o,64)),e(Pm({width:m,height:h}))},[o,e,r.width]),d=i.useCallback(()=>{let f=r.width;const m=Math.floor(s);o&&(f=kr(m*o,64)),e(Pm({width:f,height:m}))},[o,e,s,r.width]);return a.jsx(nt,{isDisabled:!n,label:l("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},spe=i.memo(ope),ape=fe([pe],({canvas:e,generation:t})=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}}),lpe=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=H(ape),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:l}=W(),c=i.useCallback(f=>{const m=Math.floor(f);let h=r.height;o&&(h=kr(m/o,64)),e(Pm({width:m,height:h}))},[o,e,r.height]),d=i.useCallback(()=>{const f=Math.floor(s);let m=r.height;o&&(m=kr(f/o,64)),e(Pm({width:f,height:m}))},[o,e,s,r.height]);return a.jsx(nt,{isDisabled:!n,label:l("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:c,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d})},ipe=i.memo(lpe),cpe=()=>{const{t:e}=W();return a.jsx(_r,{label:e("parameters.infillScalingHeader"),children:a.jsxs($,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Wc,{children:[a.jsx(Ufe,{}),a.jsx(Jfe,{})]}),a.jsx(On,{}),a.jsxs(Wc,{children:[a.jsx(npe,{}),a.jsx(ipe,{}),a.jsx(spe,{})]})]})})},NO=i.memo(cpe),Lo=fe([pe],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),upe=fe([pe,Lo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}}),dpe=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(upe),{t:s}=W(),l=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,c=i.useCallback(f=>{if(e(es({...n,height:Math.floor(f)})),o){const m=kr(f*o,64);e(es({width:m,height:Math.floor(f)}))}},[o,n,e]),d=i.useCallback(()=>{if(e(es({...n,height:Math.floor(l)})),o){const f=kr(l*o,64);e(es({width:f,height:Math.floor(l)}))}},[o,n,e,l]);return a.jsx(nt,{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})},fpe=i.memo(dpe),ppe=fe([pe,Lo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}}),mpe=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=H(ppe),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:l}=W(),c=i.useCallback(f=>{if(e(es({...n,width:Math.floor(f)})),o){const m=kr(f/o,64);e(es({width:Math.floor(f),height:m}))}},[o,n,e]),d=i.useCallback(()=>{if(e(es({...n,width:Math.floor(s)})),o){const f=kr(s/o,64);e(es({width:Math.floor(s),height:f}))}},[o,n,e,s]);return a.jsx(nt,{label:l("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})},hpe=i.memo(mpe),gpe=fe([pe],({generation:e,canvas:t})=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function Hh(){const e=te(),{t}=W(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=H(gpe),o=i.useCallback(()=>{n?(e(bd(!1)),EO.includes(r.width/r.height)?e(Xo(r.width/r.height)):e(Xo(null))):(e(bd(!0)),e(Xo(r.width/r.height)))},[n,r,e]),s=i.useCallback(()=>{e(G9()),e(Xo(null)),n&&e(Xo(r.height/r.width))},[e,n,r]);return a.jsxs($,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(Ot,{feature:"paramRatio",children:a.jsxs(Gt,{as:$,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(ln,{children:t("parameters.aspectRatio")}),a.jsx(Wr,{}),a.jsx(MO,{}),a.jsx(Fe,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(k7,{}),fontSize:20,onClick:s}),a.jsx(Fe,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(VM,{}),isChecked:n,onClick:o})]})}),a.jsx(hpe,{}),a.jsx(fpe,{})]})}const vpe=fe(pe,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}}),bpe=()=>{const{t:e}=W(),{shouldUseSliders:t,activeLabel:n}=H(vpe);return a.jsx(_r,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{})]}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hh,{})]}),a.jsx(RO,{})]})})},xpe=i.memo(bpe);function ype(){return a.jsxs(a.Fragment,{children:[a.jsx(L2,{}),a.jsx(xpe,{}),a.jsx(F2,{}),a.jsx(pu,{}),a.jsx(du,{}),a.jsx(uu,{}),a.jsx(NO,{}),a.jsx(TO,{}),a.jsx(fu,{})]})}function B2(){return a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(_O,{}),a.jsx(jO,{})]})}function Cpe(){const e=H(l=>l.generation.horizontalSymmetrySteps),t=H(l=>l.generation.steps),n=te(),{t:r}=W(),o=i.useCallback(l=>{n(iS(l))},[n]),s=i.useCallback(()=>{n(iS(0))},[n]);return a.jsx(nt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}function wpe(){const e=H(r=>r.generation.shouldUseSymmetry),t=te(),n=i.useCallback(r=>{t(K9(r.target.checked))},[t]);return a.jsx(_n,{label:"Enable Symmetry",isChecked:e,onChange:n})}function Spe(){const e=H(l=>l.generation.verticalSymmetrySteps),t=H(l=>l.generation.steps),n=te(),{t:r}=W(),o=i.useCallback(l=>{n(cS(l))},[n]),s=i.useCallback(()=>{n(cS(0))},[n]);return a.jsx(nt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o,min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})}const kpe=fe(pe,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0})),jpe=()=>{const{t:e}=W(),{activeLabel:t}=H(kpe);return Mt("symmetry").isFeatureEnabled?a.jsx(_r,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs($,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(wpe,{}),a.jsx(Cpe,{}),a.jsx(Spe,{})]})}):null},H2=i.memo(jpe),_pe=fe([pe],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:l,fineStep:c,coarseStep:d}=n.sd.img2imgStrength,{img2imgStrength:f}=e,m=t.shift?c:d;return{img2imgStrength:f,initial:r,min:o,sliderMax:s,inputMax:l,step:m}}),Ipe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=H(_pe),l=te(),{t:c}=W(),d=i.useCallback(m=>l(km(m)),[l]),f=i.useCallback(()=>{l(km(t))},[l,t]);return a.jsx(Ot,{feature:"paramDenoisingStrength",children:a.jsx(Wc,{children:a.jsx(nt,{label:`${c("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:d,handleReset:f,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},$O=i.memo(Ipe),Ppe=()=>{const{t:e}=W(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(_r,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{})]}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hc,{})]}),a.jsx($O,{}),a.jsx(OO,{})]})})},Epe=i.memo(Ppe),Mpe=()=>a.jsxs(a.Fragment,{children:[a.jsx(B2,{}),a.jsx(Epe,{}),a.jsx(pu,{}),a.jsx(du,{}),a.jsx(uu,{}),a.jsx(H2,{}),a.jsx(fu,{})]}),Ope=i.memo(Mpe),Dpe=fe(pe,({generation:e})=>{const{hrfMethod:t,hrfEnabled:n}=e;return{hrfMethod:t,hrfEnabled:n}}),Rpe=["ESRGAN","bilinear"],Ape=()=>{const e=te(),{t}=W(),{hrfMethod:n,hrfEnabled:r}=H(Dpe),o=i.useCallback(s=>{s&&e(F1(s))},[e]);return a.jsx(yn,{label:t("hrf.upscaleMethod"),value:n,data:Rpe,onChange:o,disabled:!r})},Tpe=i.memo(Ape),Npe=fe([pe],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:l,fineStep:c,coarseStep:d}=n.sd.hrfStrength,{hrfStrength:f,hrfEnabled:m}=e,h=t.shift?c:d;return{hrfStrength:f,initial:r,min:o,sliderMax:s,inputMax:l,step:h,hrfEnabled:m}}),$pe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=H(Npe),l=te(),{t:c}=W(),d=i.useCallback(()=>{l(jm(t))},[l,t]),f=i.useCallback(m=>{l(jm(m))},[l]);return a.jsx(Ut,{label:c("hrf.strengthTooltip"),placement:"right",hasArrow:!0,children:a.jsx(nt,{label:c("parameters.denoisingStrength"),min:n,max:r,step:o,value:e,onChange:f,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:d,isDisabled:!s})})},Lpe=i.memo($pe);function Fpe(){const e=te(),{t}=W(),n=H(o=>o.generation.hrfEnabled),r=i.useCallback(o=>e(L1(o.target.checked)),[e]);return a.jsx(_n,{label:t("hrf.enableHrf"),isChecked:n,onChange:r,tooltip:t("hrf.enableHrfTooltip")})}const zpe=fe(pe,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}});function Bpe(){const{t:e}=W(),t=Mt("hrf").isFeatureEnabled,{hrfEnabled:n}=H(zpe),r=i.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(_r,{label:e("hrf.hrf"),activeLabel:r,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Fpe,{}),a.jsx(Lpe,{}),a.jsx(Tpe,{})]})}):null}const Hpe=()=>a.jsxs(a.Fragment,{children:[a.jsx(B2,{}),a.jsx(AO,{}),a.jsx(pu,{}),a.jsx(du,{}),a.jsx(uu,{}),a.jsx(H2,{}),a.jsx(Bpe,{}),a.jsx(fu,{})]}),Wpe=i.memo(Hpe),Vpe=()=>{const{t:e}=W(),t=H(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(_r,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ds,{}),a.jsx(As,{}),a.jsx(Ds,{})]}),a.jsx(Rs,{}),a.jsx(Ie,{pt:2,children:a.jsx(Ts,{})}),a.jsx(Hh,{})]}),a.jsx($O,{})]})})},Upe=i.memo(Vpe),Gpe=()=>a.jsxs(a.Fragment,{children:[a.jsx(B2,{}),a.jsx(Upe,{}),a.jsx(pu,{}),a.jsx(du,{}),a.jsx(uu,{}),a.jsx(H2,{}),a.jsx(NO,{}),a.jsx(TO,{}),a.jsx(fu,{})]}),Kpe=i.memo(Gpe),qpe=()=>{const e=H(tr),t=H(n=>n.generation.model);return e==="txt2img"?a.jsx(bm,{children:t&&t.base_model==="sdxl"?a.jsx(Dfe,{}):a.jsx(Wpe,{})}):e==="img2img"?a.jsx(bm,{children:t&&t.base_model==="sdxl"?a.jsx(Efe,{}):a.jsx(Ope,{})}):e==="unifiedCanvas"?a.jsx(bm,{children:t&&t.base_model==="sdxl"?a.jsx(ype,{}):a.jsx(Kpe,{})}):null},Xpe=i.memo(qpe),bm=i.memo(e=>a.jsxs($,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(z7,{}),a.jsx($,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx($,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(Gg,{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($,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));bm.displayName="ParametersPanelWrapper";const Qpe=fe([pe],e=>{const{initialImage:t}=e.generation,{isConnected:n}=e.system;return{initialImage:t,isResetButtonDisabled:!t,isConnected:n}}),Ype=()=>{const e=te(),{initialImage:t,isConnected:n}=H(Qpe),{currentData:r,isError:o}=jo((t==null?void 0:t.imageName)??Br),s=i.useMemo(()=>{if(r)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r]),l=i.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return i.useEffect(()=>{o&&n&&e(n3())},[e,n,o]),a.jsx(fl,{imageDTO:r,droppableData:l,draggableData:s,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(Tn,{label:"No initial image selected"}),dataTestId:"initial-image"})},Zpe=i.memo(Ype),Jpe=fe([pe],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t,initialImage:t}}),eme={type:"SET_INITIAL_IMAGE"},tme=()=>{const{recallWidthAndHeight:e}=Sf(),{t}=W(),{isResetButtonDisabled:n,initialImage:r}=H(Jpe),o=te(),{getUploadButtonProps:s,getUploadInputProps:l}=S2({postUploadAction:eme}),c=i.useCallback(()=>{o(n3())},[o]),d=i.useCallback(()=>{r&&e(r.width,r.height)},[r,e]);return tt("shift+d",d,[r]),a.jsxs($,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs($,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(be,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:t("metadata.initImage")}),a.jsx(Wr,{}),a.jsx(Fe,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx($g,{}),...s()}),a.jsx(Fe,{tooltip:`${t("parameters.useSize")} (Shift+D)`,"aria-label":`${t("parameters.useSize")} (Shift+D)`,icon:a.jsx(Qy,{}),onClick:d,isDisabled:n}),a.jsx(Fe,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Ng,{}),onClick:c,isDisabled:n})]}),a.jsx(Zpe,{}),a.jsx("input",{...l()})]})},nme=i.memo(tme),rme=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=W(),o=H(s=>s.system.isConnected);return a.jsx(Fe,{onClick:t,icon:a.jsx(ao,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},LO=()=>{const[e,{isLoading:t}]=Yh({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=KI({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=UI({fixedCacheKey:"pauseProcessor"}),[l,{isLoading:c}]=Rx({fixedCacheKey:"cancelQueueItem"}),[d,{isLoading:f}]=VI({fixedCacheKey:"clearQueue"}),[m,{isLoading:h}]=r3({fixedCacheKey:"pruneQueue"});return t||r||s||c||f||h},ome=[{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 sme(){const{t:e}=W(),t=H(o=>o.postprocessing.esrganModelName),n=te(),r=i.useCallback(o=>n(q9(o)),[n]);return a.jsx(yn,{label:e("models.esrganModel"),value:t,itemComponent:xl,onChange:r,data:ome})}const ame=e=>{const{imageDTO:t}=e,n=te(),r=LO(),{t:o}=W(),{isOpen:s,onOpen:l,onClose:c}=sr(),{isAllowedToUpscale:d,detail:f}=X9(t),m=i.useCallback(()=>{c(),!(!t||!d)&&n(o3({imageDTO:t}))},[n,t,d,c]);return a.jsx(xf,{isOpen:s,onClose:c,triggerComponent:a.jsx(Fe,{tooltip:o("parameters.upscale"),onClick:l,icon:a.jsx(zM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs($,{sx:{flexDirection:"column",gap:4},children:[a.jsx(sme,{}),a.jsx(Xe,{tooltip:f,size:"sm",isDisabled:!t||r||!d,onClick:m,children:o("parameters.upscaleImage")})]})})},lme=i.memo(ame),ime=fe([pe,tr],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:l,denoiseProgress:c}=t,{shouldShowImageDetails:d,shouldHidePreview:f,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:l,isConnected:s,shouldDisableToolbarButtons:!!(c!=null&&c.progress_image)||!g,shouldShowImageDetails:d,activeTabName:o,shouldHidePreview:f,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}}),cme=()=>{const e=te(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=H(ime),l=Mt("upscaling").isFeatureEnabled,c=LO(),d=zs(),{t:f}=W(),{recallBothPrompts:m,recallSeed:h,recallWidthAndHeight:g,recallAllParameters:b}=Sf(),{currentData:y}=jo((o==null?void 0:o.image_name)??Br),{metadata:x,isLoading:w}=_2(o==null?void 0:o.image_name),{getAndLoadEmbeddedWorkflow:S,getAndLoadEmbeddedWorkflowResult:j}=I7({}),_=i.useCallback(()=>{!o||!o.has_workflow||S(o.image_name)},[S,o]);tt("w",_,[o]);const I=i.useCallback(()=>{b(x)},[x,b]);tt("a",I,[x]);const E=i.useCallback(()=>{h(x==null?void 0:x.seed)},[x==null?void 0:x.seed,h]);tt("s",E,[x]);const M=i.useCallback(()=>{m(x==null?void 0:x.positive_prompt,x==null?void 0:x.negative_prompt,x==null?void 0:x.positive_style_prompt,x==null?void 0:x.negative_style_prompt)},[x==null?void 0:x.negative_prompt,x==null?void 0:x.positive_prompt,x==null?void 0:x.positive_style_prompt,x==null?void 0:x.negative_style_prompt,m]);tt("p",M,[x]);const D=i.useCallback(()=>{g(x==null?void 0:x.width,x==null?void 0:x.height)},[x==null?void 0:x.width,x==null?void 0:x.height,g]);tt("d",D,[x]);const R=i.useCallback(()=>{e(_7()),e(Qh(y))},[e,y]);tt("shift+i",R,[y]);const N=i.useCallback(()=>{y&&e(o3({imageDTO:y}))},[e,y]),O=i.useCallback(()=>{y&&e(Xh([y]))},[e,y]);tt("Shift+U",()=>{N()},{enabled:()=>!!(l&&!n&&t)},[l,y,n,t]);const T=i.useCallback(()=>e(Q9(!r)),[e,r]);tt("i",()=>{y?T():d({title:f("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[y,r,d]),tt("delete",()=>{O()},[e,y]);const U=i.useCallback(()=>{e(II(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs($,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx($t,{isAttached:!0,isDisabled:n,children:a.jsxs(of,{isLazy:!0,children:[a.jsx(sf,{as:Fe,"aria-label":f("parameters.imageActions"),tooltip:f("parameters.imageActions"),isDisabled:!y,icon:a.jsx(P7,{})}),a.jsx(al,{motionProps:Yl,children:y&&a.jsx(E7,{imageDTO:y})})]})}),a.jsxs($t,{isAttached:!0,isDisabled:n,children:[a.jsx(Fe,{icon:a.jsx(e0,{}),tooltip:`${f("nodes.loadWorkflow")} (W)`,"aria-label":`${f("nodes.loadWorkflow")} (W)`,isDisabled:!(y!=null&&y.has_workflow),onClick:_,isLoading:j.isLoading}),a.jsx(Fe,{isLoading:w,icon:a.jsx(GM,{}),tooltip:`${f("parameters.usePrompt")} (P)`,"aria-label":`${f("parameters.usePrompt")} (P)`,isDisabled:!(x!=null&&x.positive_prompt),onClick:M}),a.jsx(Fe,{isLoading:w,icon:a.jsx(KM,{}),tooltip:`${f("parameters.useSeed")} (S)`,"aria-label":`${f("parameters.useSeed")} (S)`,isDisabled:(x==null?void 0:x.seed)===null||(x==null?void 0:x.seed)===void 0,onClick:E}),a.jsx(Fe,{isLoading:w,icon:a.jsx(Qy,{}),tooltip:`${f("parameters.useSize")} (D)`,"aria-label":`${f("parameters.useSize")} (D)`,isDisabled:(x==null?void 0:x.height)===null||(x==null?void 0:x.height)===void 0||(x==null?void 0:x.width)===null||(x==null?void 0:x.width)===void 0,onClick:D}),a.jsx(Fe,{isLoading:w,icon:a.jsx(NM,{}),tooltip:`${f("parameters.useAll")} (A)`,"aria-label":`${f("parameters.useAll")} (A)`,isDisabled:!x,onClick:I})]}),l&&a.jsx($t,{isAttached:!0,isDisabled:c,children:l&&a.jsx(lme,{imageDTO:y})}),a.jsx($t,{isAttached:!0,children:a.jsx(Fe,{icon:a.jsx(LM,{}),tooltip:`${f("parameters.info")} (I)`,"aria-label":`${f("parameters.info")} (I)`,isChecked:r,onClick:T})}),a.jsx($t,{isAttached:!0,children:a.jsx(Fe,{"aria-label":f("settings.displayInProgress"),tooltip:f("settings.displayInProgress"),icon:a.jsx(Ate,{}),isChecked:s,onClick:U})}),a.jsx($t,{isAttached:!0,children:a.jsx(rme,{onClick:O})})]})})},ume=i.memo(cme),dme=()=>{const e=H(n=>{var r;return(r=n.system.denoiseProgress)==null?void 0:r.progress_image}),t=H(n=>n.system.shouldAntialiasProgressImage);return e?a.jsx(Ca,{src:e.dataURL,width:e.width,height:e.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:t?"auto":"pixelated"}}):null},fme=i.memo(dme);function pme(e){return De({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 mme=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:l}=W(),c=i.useCallback(()=>navigator.clipboard.writeText(t.toString()),[t]);return t?a.jsxs($,{gap:2,children:[n&&a.jsx(Ut,{label:`Recall ${e}`,children:a.jsx(rs,{"aria-label":l("accessibility.useThisParameter"),icon:a.jsx(pme,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Ut,{label:`Copy ${e}`,children:a.jsx(rs,{"aria-label":`Copy ${e}`,icon:a.jsx(ru,{}),size:"xs",variant:"ghost",fontSize:14,onClick:c})}),a.jsxs($,{direction:o?"column":"row",children:[a.jsxs(be,{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(T8,{mx:"2px"})]}):a.jsx(be,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},Rn=i.memo(mme),hme=e=>{var ne;const{metadata:t}=e,{t:n}=W(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:l,recallCfgRescaleMultiplier:c,recallModel:d,recallScheduler:f,recallVaeModel:m,recallSteps:h,recallWidth:g,recallHeight:b,recallStrength:y,recallHrfEnabled:x,recallHrfStrength:w,recallHrfMethod:S,recallLoRA:j,recallControlNet:_,recallIPAdapter:I,recallT2IAdapter:E}=Sf(),M=i.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),D=i.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),R=i.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),N=i.useCallback(()=>{d(t==null?void 0:t.model)},[t==null?void 0:t.model,d]),O=i.useCallback(()=>{g(t==null?void 0:t.width)},[t==null?void 0:t.width,g]),T=i.useCallback(()=>{b(t==null?void 0:t.height)},[t==null?void 0:t.height,b]),U=i.useCallback(()=>{f(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,f]),G=i.useCallback(()=>{m(t==null?void 0:t.vae)},[t==null?void 0:t.vae,m]),q=i.useCallback(()=>{h(t==null?void 0:t.steps)},[t==null?void 0:t.steps,h]),Y=i.useCallback(()=>{l(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,l]),Q=i.useCallback(()=>{c(t==null?void 0:t.cfg_rescale_multiplier)},[t==null?void 0:t.cfg_rescale_multiplier,c]),V=i.useCallback(()=>{y(t==null?void 0:t.strength)},[t==null?void 0:t.strength,y]),se=i.useCallback(()=>{x(t==null?void 0:t.hrf_enabled)},[t==null?void 0:t.hrf_enabled,x]),ee=i.useCallback(()=>{w(t==null?void 0:t.hrf_strength)},[t==null?void 0:t.hrf_strength,w]),le=i.useCallback(()=>{S(t==null?void 0:t.hrf_method)},[t==null?void 0:t.hrf_method,S]),ae=i.useCallback(z=>{j(z)},[j]),ce=i.useCallback(z=>{_(z)},[_]),J=i.useCallback(z=>{I(z)},[I]),re=i.useCallback(z=>{E(z)},[E]),A=i.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(z=>_m(z.control_model)):[],[t==null?void 0:t.controlnets]),L=i.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(z=>_m(z.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),K=i.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(z=>Y9(z.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(Rn,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(Rn,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(Rn,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:M}),t.negative_prompt&&a.jsx(Rn,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:D}),t.seed!==void 0&&t.seed!==null&&a.jsx(Rn,{label:n("metadata.seed"),value:t.seed,onClick:R}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(Rn,{label:n("metadata.model"),value:t.model.model_name,onClick:N}),t.width&&a.jsx(Rn,{label:n("metadata.width"),value:t.width,onClick:O}),t.height&&a.jsx(Rn,{label:n("metadata.height"),value:t.height,onClick:T}),t.scheduler&&a.jsx(Rn,{label:n("metadata.scheduler"),value:t.scheduler,onClick:U}),a.jsx(Rn,{label:n("metadata.vae"),value:((ne=t.vae)==null?void 0:ne.model_name)??"Default",onClick:G}),t.steps&&a.jsx(Rn,{label:n("metadata.steps"),value:t.steps,onClick:q}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(Rn,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:Y}),t.cfg_rescale_multiplier!==void 0&&t.cfg_rescale_multiplier!==null&&a.jsx(Rn,{label:n("metadata.cfgRescaleMultiplier"),value:t.cfg_rescale_multiplier,onClick:Q}),t.strength&&a.jsx(Rn,{label:n("metadata.strength"),value:t.strength,onClick:V}),t.hrf_enabled&&a.jsx(Rn,{label:n("hrf.metadata.enabled"),value:t.hrf_enabled,onClick:se}),t.hrf_enabled&&t.hrf_strength&&a.jsx(Rn,{label:n("hrf.metadata.strength"),value:t.hrf_strength,onClick:ee}),t.hrf_enabled&&t.hrf_method&&a.jsx(Rn,{label:n("hrf.metadata.method"),value:t.hrf_method,onClick:le}),t.loras&&t.loras.map((z,oe)=>{if(TI(z.lora))return a.jsx(Rn,{label:"LoRA",value:`${z.lora.model_name} - ${z.weight}`,onClick:ae.bind(null,z)},oe)}),A.map((z,oe)=>{var X;return a.jsx(Rn,{label:"ControlNet",value:`${(X=z.control_model)==null?void 0:X.model_name} - ${z.control_weight}`,onClick:ce.bind(null,z)},oe)}),L.map((z,oe)=>{var X;return a.jsx(Rn,{label:"IP Adapter",value:`${(X=z.ip_adapter_model)==null?void 0:X.model_name} - ${z.weight}`,onClick:J.bind(null,z)},oe)}),K.map((z,oe)=>{var X;return a.jsx(Rn,{label:"T2I Adapter",value:`${(X=z.t2i_adapter_model)==null?void 0:X.model_name} - ${z.weight}`,onClick:re.bind(null,z)},oe)})]})},gme=i.memo(hme),vme=e=>{const t=H(s=>s.config.workflowFetchDebounce??300),[n]=kc(e!=null&&e.has_workflow?e.image_name:null,t),{data:r,isLoading:o}=Z9(n??Br);return{workflow:r,isLoading:o}},bme=({image:e})=>{const{t}=W(),{workflow:n}=vme(e);return n?a.jsx(pl,{data:n,label:t("metadata.workflow")}):a.jsx(Tn,{label:t("nodes.noWorkflow")})},xme=i.memo(bme),yme=({image:e})=>{const{t}=W(),{metadata:n}=_2(e.image_name);return a.jsxs($,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs($,{gap:2,children:[a.jsxs(be,{fontWeight:"semibold",children:[t("common.file"),":"]}),a.jsxs(ig,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(T8,{mx:"2px"})]})]}),a.jsxs(ci,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},isLazy:!0,children:[a.jsxs(ui,{children:[a.jsx(mr,{children:t("metadata.recallParameters")}),a.jsx(mr,{children:t("metadata.metadata")}),a.jsx(mr,{children:t("metadata.imageDetails")}),a.jsx(mr,{children:t("metadata.workflow")})]}),a.jsxs(eu,{children:[a.jsx($r,{children:n?a.jsx(Sl,{children:a.jsx(gme,{metadata:n})}):a.jsx(Tn,{label:t("metadata.noRecallParameters")})}),a.jsx($r,{children:n?a.jsx(pl,{data:n,label:t("metadata.metadata")}):a.jsx(Tn,{label:t("metadata.noMetaData")})}),a.jsx($r,{children:e?a.jsx(pl,{data:e,label:t("metadata.imageDetails")}):a.jsx(Tn,{label:t("metadata.noImageDetails")})}),a.jsx($r,{children:a.jsx(xme,{image:e})})]})]})]})},Cme=i.memo(yme),I1={color:"base.100",pointerEvents:"auto"},wme=()=>{const{t:e}=W(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:l,isFetching:c}=G8();return a.jsxs(Ie,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(rs,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(cte,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:I1})}),a.jsxs(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(rs,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(ute,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:I1}),o&&l&&!c&&a.jsx(rs,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(ite,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:I1}),o&&l&&c&&a.jsx($,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(va,{opacity:.5,size:"xl"})})]})]})},FO=i.memo(wme),Sme=fe([pe,J9],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,hasDenoiseProgress:!!l,shouldShowProgressInViewer:s}}),kme=()=>{const{shouldShowImageDetails:e,imageName:t,hasDenoiseProgress:n,shouldShowProgressInViewer:r}=H(Sme),{handlePrevImage:o,handleNextImage:s,isOnLastImage:l,handleLoadMoreImages:c,areMoreImagesAvailable:d,isFetching:f}=G8();tt("left",()=>{o()},[o]),tt("right",()=>{if(l&&d&&!f){c();return}l||s()},[l,d,c,f,s]);const{currentData:m}=jo(t??Br),h=i.useMemo(()=>{if(m)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:m}}},[m]),g=i.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[b,y]=i.useState(!1),x=i.useRef(0),{t:w}=W(),S=i.useCallback(()=>{y(!0),window.clearTimeout(x.current)},[]),j=i.useCallback(()=>{x.current=window.setTimeout(()=>{y(!1)},500)},[]);return a.jsxs($,{onMouseOver:S,onMouseOut:j,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n&&r?a.jsx(fme,{}):a.jsx(fl,{imageDTO:m,droppableData:g,draggableData:h,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:w("gallery.setCurrentImage"),noContentFallback:a.jsx(Tn,{icon:si,label:w("gallery.noImageSelected")}),dataTestId:"image-preview"}),e&&m&&a.jsx(Ie,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(Cme,{image:m})}),a.jsx(hr,{children:!e&&m&&b&&a.jsx(Mn.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(FO,{})},"nextPrevButtons")})]})},jme=i.memo(kme),_me=()=>a.jsxs($,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(ume,{}),a.jsx(jme,{})]}),Ime=i.memo(_me),Pme=()=>a.jsx(Ie,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx($,{sx:{width:"100%",height:"100%"},children:a.jsx(Ime,{})})}),zO=i.memo(Pme),Eme=()=>{const e=i.useRef(null),t=i.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=R2();return a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsxs(o0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(rl,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(nme,{})}),a.jsx(Bh,{onDoubleClick:t}),a.jsx(rl,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(zO,{})})]})})},Mme=i.memo(Eme);var Ome=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 l=s[o];if(!e(t[l],n[l]))return!1}return!0}return t!==t&&n!==n};const M_=Bd(Ome);function ax(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 Dme=Object.defineProperty,O_=Object.getOwnPropertySymbols,Rme=Object.prototype.hasOwnProperty,Ame=Object.prototype.propertyIsEnumerable,D_=(e,t,n)=>t in e?Dme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tme=(e,t)=>{for(var n in t||(t={}))Rme.call(t,n)&&D_(e,n,t[n]);if(O_)for(var n of O_(t))Ame.call(t,n)&&D_(e,n,t[n]);return e};function BO(e,t){if(t===null||typeof t!="object")return{};const n=Tme({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const Nme="__MANTINE_FORM_INDEX__";function R_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${Nme}`)):!1:!1}function A_(e,t,n){typeof n.value=="object"&&(n.value=ic(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function ic(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(l){o.add(ic(l))})):s==="[object Map]"?(o=new Map,e.forEach(function(l,c){o.set(ic(c),ic(l))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(ic(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)A_(o,r[t],Object.getOwnPropertyDescriptor(e,r[t]));for(t=0,r=Object.getOwnPropertyNames(e);t<r.length;t++)Object.hasOwnProperty.call(o,n=r[t])&&o[n]===e[n]||A_(o,n,Object.getOwnPropertyDescriptor(e,n))}return o||e}function HO(e){return typeof e!="string"?[]:e.split(".")}function d0(e,t,n){const r=HO(e);if(r.length===0)return n;const o=ic(n);if(r.length===1)return o[r[0]]=t,o;let s=o[r[0]];for(let l=1;l<r.length-1;l+=1){if(s===void 0)return o;s=s[r[l]]}return s[r[r.length-1]]=t,o}function ea(e,t){const n=HO(e);if(n.length===0||typeof t!="object"||t===null)return;let r=t[n[0]];for(let o=1;o<n.length&&r!==void 0;o+=1)r=r[n[o]];return r}function T_(e){const t=ax(e);return{hasErrors:Object.keys(t).length>0,errors:t}}function lx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const l=e[s],c=`${n===""?"":`${n}.`}${s}`,d=ea(c,t);let f=!1;return typeof l=="function"&&(o[c]=l(d,t,c)),typeof l=="object"&&Array.isArray(d)&&(f=!0,d.forEach((m,h)=>lx(l,t,`${c}.${h}`,o))),typeof l=="object"&&typeof d=="object"&&d!==null&&(f||lx(l,t,c,o)),o},r)}function ix(e,t){return T_(typeof e=="function"?e(t):lx(e,t))}function tm(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=ix(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((l,c)=>l===s.split(".")[c]));return{hasError:!!o,error:o?r.errors[o]:null}}function $me(e,{from:t,to:n},r){const o=ea(e,r);if(!Array.isArray(o))return r;const s=[...o],l=o[t];return s.splice(t,1),s.splice(n,0,l),d0(e,s,r)}var Lme=Object.defineProperty,N_=Object.getOwnPropertySymbols,Fme=Object.prototype.hasOwnProperty,zme=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?Lme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bme=(e,t)=>{for(var n in t||(t={}))Fme.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))zme.call(t,n)&&$_(e,n,t[n]);return e};function Hme(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,l=Bme({},r);return Object.keys(r).every(c=>{let d,f;if(c.startsWith(o)&&(d=c,f=c.replace(o,s)),c.startsWith(s)&&(d=c.replace(s,o),f=c),d&&f){const m=l[d],h=l[f];return h===void 0?delete l[d]:l[d]=h,m===void 0?delete l[f]:l[f]=m,!1}return!0}),l}function Wme(e,t,n){const r=ea(e,n);return Array.isArray(r)?d0(e,r.filter((o,s)=>s!==t),n):n}var Vme=Object.defineProperty,L_=Object.getOwnPropertySymbols,Ume=Object.prototype.hasOwnProperty,Gme=Object.prototype.propertyIsEnumerable,F_=(e,t,n)=>t in e?Vme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kme=(e,t)=>{for(var n in t||(t={}))Ume.call(t,n)&&F_(e,n,t[n]);if(L_)for(var n of L_(t))Gme.call(t,n)&&F_(e,n,t[n]);return e};function z_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function B_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=BO(`${o}.${t}`,s));const l=Kme({},s),c=new Set;return Object.entries(s).filter(([d])=>{if(!d.startsWith(`${o}.`))return!1;const f=z_(d,o);return Number.isNaN(f)?!1:f>=t}).forEach(([d,f])=>{const m=z_(d,o),h=d.replace(`${o}.${m}`,`${o}.${m+r}`);l[h]=f,c.add(h),c.has(d)||delete l[d]}),l}function qme(e,t,n,r){const o=ea(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),d0(e,s,r)}function H_(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 Xme(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 Qme=Object.defineProperty,Yme=Object.defineProperties,Zme=Object.getOwnPropertyDescriptors,W_=Object.getOwnPropertySymbols,Jme=Object.prototype.hasOwnProperty,ehe=Object.prototype.propertyIsEnumerable,V_=(e,t,n)=>t in e?Qme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ha=(e,t)=>{for(var n in t||(t={}))Jme.call(t,n)&&V_(e,n,t[n]);if(W_)for(var n of W_(t))ehe.call(t,n)&&V_(e,n,t[n]);return e},P1=(e,t)=>Yme(e,Zme(t));function vi({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:l=!1,transformValues:c=f=>f,validate:d}={}){const[f,m]=i.useState(r),[h,g]=i.useState(n),[b,y]=i.useState(e),[x,w]=i.useState(ax(t)),S=i.useRef(e),j=A=>{S.current=A},_=i.useCallback(()=>m({}),[]),I=A=>{const L=A?Ha(Ha({},b),A):b;j(L),g({})},E=i.useCallback(A=>w(L=>ax(typeof A=="function"?A(L):A)),[]),M=i.useCallback(()=>w({}),[]),D=i.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),R=i.useCallback((A,L)=>E(K=>P1(Ha({},K),{[A]:L})),[]),N=i.useCallback(A=>E(L=>{if(typeof A!="string")return L;const K=Ha({},L);return delete K[A],K}),[]),O=i.useCallback(A=>g(L=>{if(typeof A!="string")return L;const K=BO(A,L);return delete K[A],K}),[]),T=i.useCallback((A,L)=>{const K=R_(A,s);O(A),m(ne=>P1(Ha({},ne),{[A]:!0})),y(ne=>{const z=d0(A,L,ne);if(K){const oe=tm(A,d,z);oe.hasError?R(A,oe.error):N(A)}return z}),!K&&o&&R(A,null)},[]),U=i.useCallback(A=>{y(L=>{const K=typeof A=="function"?A(L):A;return Ha(Ha({},L),K)}),o&&M()},[]),G=i.useCallback((A,L)=>{O(A),y(K=>$me(A,L,K)),w(K=>Hme(A,L,K))},[]),q=i.useCallback((A,L)=>{O(A),y(K=>Wme(A,L,K)),w(K=>B_(A,L,K,-1))},[]),Y=i.useCallback((A,L,K)=>{O(A),y(ne=>qme(A,L,K,ne)),w(ne=>B_(A,K,ne,1))},[]),Q=i.useCallback(()=>{const A=ix(d,b);return w(A.errors),A},[b,d]),V=i.useCallback(A=>{const L=tm(A,d,b);return L.hasError?R(A,L.error):N(A),L},[b,d]),se=(A,{type:L="input",withError:K=!0,withFocus:ne=!0}={})=>{const oe={onChange:Xme(X=>T(A,X))};return K&&(oe.error=x[A]),L==="checkbox"?oe.checked=ea(A,b):oe.value=ea(A,b),ne&&(oe.onFocus=()=>m(X=>P1(Ha({},X),{[A]:!0})),oe.onBlur=()=>{if(R_(A,l)){const X=tm(A,d,b);X.hasError?R(A,X.error):N(A)}}),oe},ee=(A,L)=>K=>{K==null||K.preventDefault();const ne=Q();ne.hasErrors?L==null||L(ne.errors,b,K):A==null||A(c(b),K)},le=A=>c(A||b),ae=i.useCallback(A=>{A.preventDefault(),D()},[]),ce=A=>{if(A){const K=ea(A,h);if(typeof K=="boolean")return K;const ne=ea(A,b),z=ea(A,S.current);return!M_(ne,z)}return Object.keys(h).length>0?H_(h):!M_(b,S.current)},J=i.useCallback(A=>H_(f,A),[f]),re=i.useCallback(A=>A?!tm(A,d,b).hasError:!ix(d,b).hasErrors,[b,d]);return{values:b,errors:x,setValues:U,setErrors:E,setFieldValue:T,setFieldError:R,clearFieldError:N,clearErrors:M,reset:D,validate:Q,validateField:V,reorderListItem:G,removeListItem:q,insertListItem:Y,getInputProps:se,onSubmit:ee,onReset:ae,isDirty:ce,isTouched:J,setTouched:m,setDirty:g,resetTouched:_,resetDirty:I,isValid:re,getTransformedValues:le}}function En(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:l,base700:c,base900:d,accent500:f,accent300:m}=hf(),{colorMode:h}=ya(),g=i.useCallback(()=>({input:{color:Te(d,r)(h),backgroundColor:Te(n,d)(h),borderColor:Te(o,l)(h),borderWidth:2,outline:"none",":focus":{borderColor:Te(m,f)(h)}},label:{color:Te(c,s)(h),fontWeight:"normal",marginBottom:4}}),[m,f,r,o,s,n,c,l,d,h]);return a.jsx(_M,{styles:g,...t})}const the=[{value:"sd-1",label:xn["sd-1"]},{value:"sd-2",label:xn["sd-2"]},{value:"sdxl",label:xn.sdxl},{value:"sdxl-refiner",label:xn["sdxl-refiner"]}];function kf(e){const{...t}=e,{t:n}=W();return a.jsx(yn,{label:n("modelManager.baseModel"),data:the,...t})}function WO(e){const{data:t}=s3(),{...n}=e;return a.jsx(yn,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const nhe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function f0(e){const{...t}=e,{t:n}=W();return a.jsx(yn,{label:n("modelManager.variant"),data:nhe,...t})}function Wh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function VO(e){const{t}=W(),n=te(),{model_path:r}=e,o=vi({initialValues:{model_name:r?Wh(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]=a3(),[l,c]=i.useState(!1),d=h=>{s({body:h}).unwrap().then(g=>{n(lt(rn({title:t("modelManager.modelAdded",{modelName:h.model_name}),status:"success"}))),o.reset(),r&&n(Ud(null))}).catch(g=>{g&&n(lt(rn({title:t("toast.modelAddFailed"),status:"error"})))})},f=i.useCallback(h=>{if(o.values.model_name===""){const g=Wh(h.currentTarget.value);g&&o.setFieldValue("model_name",g)}},[o]),m=i.useCallback(()=>c(h=>!h),[]);return a.jsx("form",{onSubmit:o.onSubmit(h=>d(h)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",gap:2,children:[a.jsx(En,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(kf,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(En,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:f}),a.jsx(En,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(En,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(f0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs($,{flexDirection:"column",width:"100%",gap:2,children:[l?a.jsx(En,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(WO,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(yr,{isChecked:l,onChange:m,label:t("modelManager.useCustomConfig")}),a.jsx(Xe,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function UO(e){const{t}=W(),n=te(),{model_path:r}=e,[o]=a3(),s=vi({initialValues:{model_name:r?Wh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),l=d=>{o({body:d}).unwrap().then(f=>{n(lt(rn({title:t("modelManager.modelAdded",{modelName:d.model_name}),status:"success"}))),s.reset(),r&&n(Ud(null))}).catch(f=>{f&&n(lt(rn({title:t("toast.modelAddFailed"),status:"error"})))})},c=i.useCallback(d=>{if(s.values.model_name===""){const f=Wh(d.currentTarget.value,!1);f&&s.setFieldValue("model_name",f)}},[s]);return a.jsx("form",{onSubmit:s.onSubmit(d=>l(d)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",gap:2,children:[a.jsx(En,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(kf,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(En,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:c}),a.jsx(En,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(En,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(f0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Xe,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}function rhe(){const[e,t]=i.useState("diffusers"),{t:n}=W(),r=i.useCallback(s=>{s&&t(s)},[]),o=i.useMemo(()=>[{label:n("modelManager.diffusersModels"),value:"diffusers"},{label:n("modelManager.checkpointOrSafetensors"),value:"checkpoint"}],[n]);return a.jsxs($,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(yn,{label:n("modelManager.modelType"),value:e,data:o,onChange:r}),a.jsxs($,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(UO,{}),e==="checkpoint"&&a.jsx(VO,{})]})]})}const ohe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function she(){const e=te(),{t}=W(),[n,{isLoading:r}]=l3(),o=vi({initialValues:{location:"",prediction_type:void 0}}),s=l=>{const c={location:l.location,prediction_type:l.prediction_type==="none"?void 0:l.prediction_type};n({body:c}).unwrap().then(d=>{e(lt(rn({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(d=>{d&&e(lt(rn({title:`${d.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(En,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(yn,{label:t("modelManager.predictionType"),data:ohe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Xe,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function ahe(){const{t:e}=W(),[t,n]=i.useState("simple"),r=i.useCallback(()=>n("simple"),[]),o=i.useCallback(()=>n("advanced"),[]);return a.jsxs($,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs($t,{isAttached:!0,children:[a.jsx(Xe,{size:"sm",isChecked:t=="simple",onClick:r,children:e("common.simple")}),a.jsx(Xe,{size:"sm",isChecked:t=="advanced",onClick:o,children:e("common.advanced")})]}),a.jsxs($,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[t==="simple"&&a.jsx(she,{}),t==="advanced"&&a.jsx(rhe,{})]})]})}function lhe(e){const{...t}=e;return a.jsx(bE,{w:"100%",...t,children:e.children})}function ihe(){const e=H(w=>w.modelmanager.searchFolder),[t,n]=i.useState(""),{data:r}=as(Bl),{foundModels:o,alreadyInstalled:s,filteredModels:l}=i3({search_path:e||""},{selectFromResult:({data:w})=>{const S=gL(r==null?void 0:r.entities),j=Hr(S,"path"),_=dL(w,j),I=CL(w,j);return{foundModels:w,alreadyInstalled:U_(I,t),filteredModels:U_(_,t)}}}),[c,{isLoading:d}]=l3(),f=te(),{t:m}=W(),h=i.useCallback(w=>{const S=w.currentTarget.id.split("\\").splice(-1)[0];c({body:{location:w.currentTarget.id}}).unwrap().then(j=>{f(lt(rn({title:`Added Model: ${S}`,status:"success"})))}).catch(j=>{j&&f(lt(rn({title:m("toast.modelAddFailed"),status:"error"})))})},[f,c,m]),g=i.useCallback(w=>{n(w.target.value)},[]),b=i.useCallback(w=>f(Ud(w)),[f]),y=({models:w,showActions:S=!0})=>w.map(j=>a.jsxs($,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(be,{sx:{fontWeight:600},children:j.split("\\").slice(-1)[0]}),a.jsx(be,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:j})]}),S?a.jsxs($,{gap:2,children:[a.jsx(Xe,{id:j,onClick:h,isLoading:d,children:m("modelManager.quickAdd")}),a.jsx(Xe,{onClick:b.bind(null,j),isLoading:d,children:m("modelManager.advanced")})]}):a.jsx(be,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:m("common.installed")})]},j));return(()=>e?!o||o.length===0?a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(be,{variant:"subtext",children:m("modelManager.noModels")})}):a.jsxs($,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(yo,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs($,{p:2,gap:2,children:[a.jsxs(be,{sx:{fontWeight:600},children:[m("modelManager.modelsFound"),": ",o.length]}),a.jsxs(be,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:[m("common.notInstalled"),": ",l.length]})]}),a.jsx(lhe,{offsetScrollbars:!0,children:a.jsxs($,{gap:2,flexDirection:"column",children:[y({models:l}),y({models:s,showActions:!1})]})})]}):null)()}const U_=(e,t)=>{const n=[];return qn(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function che(){const e=H(m=>m.modelmanager.advancedAddScanModel),{t}=W(),n=i.useMemo(()=>[{label:t("modelManager.diffusersModels"),value:"diffusers"},{label:t("modelManager.checkpointOrSafetensors"),value:"checkpoint"}],[t]),[r,o]=i.useState("diffusers"),[s,l]=i.useState(!0);i.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(m=>e.endsWith(m))?o("checkpoint"):o("diffusers")},[e,o,s]);const c=te(),d=i.useCallback(()=>c(Ud(null)),[c]),f=i.useCallback(m=>{m&&(o(m),l(m==="checkpoint"))},[]);return e?a.jsxs(Ie,{as:Mn.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($,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(be,{size:"xl",fontWeight:600,children:s||r==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(Fe,{icon:a.jsx(Nc,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:d,size:"sm"})]}),a.jsx(yn,{label:t("modelManager.modelType"),value:r,data:n,onChange:f}),s?a.jsx(VO,{model_path:e},e):a.jsx(UO,{model_path:e},e)]}):null}function uhe(){const e=te(),{t}=W(),n=H(d=>d.modelmanager.searchFolder),{refetch:r}=i3({search_path:n||""}),o=vi({initialValues:{folder:""}}),s=i.useCallback(d=>{e(uS(d.folder))},[e]),l=i.useCallback(()=>{r()},[r]),c=i.useCallback(()=>{e(uS(null)),e(Ud(null))},[e]);return a.jsx("form",{onSubmit:o.onSubmit(d=>s(d)),style:{width:"100%"},children:a.jsxs($,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs($,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(be,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:t("common.folder")}),n?a.jsx($,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(yo,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs($,{gap:2,children:[n?a.jsx(Fe,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(XM,{}),onClick:l,fontSize:18,size:"sm"}):a.jsx(Fe,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(Ute,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(Fe,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(ao,{}),size:"sm",onClick:c,isDisabled:!n,colorScheme:"red"})]})]})})}const dhe=i.memo(uhe);function fhe(){return a.jsxs($,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(dhe,{}),a.jsxs($,{gap:4,children:[a.jsx($,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(ihe,{})}),a.jsx(che,{})]})]})}function phe(){const[e,t]=i.useState("add"),{t:n}=W(),r=i.useCallback(()=>t("add"),[]),o=i.useCallback(()=>t("scan"),[]);return a.jsxs($,{flexDirection:"column",gap:4,children:[a.jsxs($t,{isAttached:!0,children:[a.jsx(Xe,{onClick:r,isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Xe,{onClick:o,isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(ahe,{}),e=="scan"&&a.jsx(fhe,{})]})}const mhe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function hhe(){var K,ne;const{t:e}=W(),t=te(),{data:n}=as(Bl),[r,{isLoading:o}]=eN(),[s,l]=i.useState("sd-1"),c=wS(n==null?void 0:n.entities,(z,oe)=>(z==null?void 0:z.model_format)==="diffusers"&&(z==null?void 0:z.base_model)==="sd-1"),d=wS(n==null?void 0:n.entities,(z,oe)=>(z==null?void 0:z.model_format)==="diffusers"&&(z==null?void 0:z.base_model)==="sd-2"),f=i.useMemo(()=>({"sd-1":c,"sd-2":d}),[c,d]),[m,h]=i.useState(((K=Object.keys(f[s]))==null?void 0:K[0])??null),[g,b]=i.useState(((ne=Object.keys(f[s]))==null?void 0:ne[1])??null),[y,x]=i.useState(null),[w,S]=i.useState(""),[j,_]=i.useState(.5),[I,E]=i.useState("weighted_sum"),[M,D]=i.useState("root"),[R,N]=i.useState(""),[O,T]=i.useState(!1),U=Object.keys(f[s]).filter(z=>z!==g&&z!==y),G=Object.keys(f[s]).filter(z=>z!==m&&z!==y),q=Object.keys(f[s]).filter(z=>z!==m&&z!==g),Y=i.useCallback(z=>{l(z),h(null),b(null)},[]),Q=i.useCallback(z=>{h(z)},[]),V=i.useCallback(z=>{b(z)},[]),se=i.useCallback(z=>{z?(x(z),E("weighted_sum")):(x(null),E("add_difference"))},[]),ee=i.useCallback(z=>S(z.target.value),[]),le=i.useCallback(z=>_(z),[]),ae=i.useCallback(()=>_(.5),[]),ce=i.useCallback(z=>E(z),[]),J=i.useCallback(z=>D(z),[]),re=i.useCallback(z=>N(z.target.value),[]),A=i.useCallback(z=>T(z.target.checked),[]),L=i.useCallback(()=>{const z=[];let oe=[m,g,y];oe=oe.filter(Z=>Z!==null),oe.forEach(Z=>{var ve;const me=(ve=Z==null?void 0:Z.split("/"))==null?void 0:ve[2];me&&z.push(me)});const X={model_names:z,merged_model_name:w!==""?w:z.join("-"),alpha:j,interp:I,force:O,merge_dest_directory:M==="root"?void 0:R};r({base_model:s,body:{body:X}}).unwrap().then(Z=>{t(lt(rn({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(Z=>{Z&&t(lt(rn({title:e("modelManager.modelsMergeFailed"),status:"error"})))})},[s,t,r,w,j,R,O,I,M,m,y,g,e]);return a.jsxs($,{flexDirection:"column",rowGap:4,children:[a.jsxs($,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(be,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(be,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs($,{columnGap:4,children:[a.jsx(yn,{label:e("modelManager.modelType"),w:"100%",data:mhe,value:s,onChange:Y}),a.jsx(sn,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:U,onChange:Q}),a.jsx(sn,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:G,onChange:V}),a.jsx(sn,{label:e("modelManager.modelThree"),data:q,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:se})]}),a.jsx(yo,{label:e("modelManager.mergedModelName"),value:w,onChange:ee}),a.jsxs($,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(nt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:le,withInput:!0,withReset:!0,handleReset:ae,withSliderMarks:!0}),a.jsx(be,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs($,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(be,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx($m,{value:I,onChange:ce,children:a.jsx($,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Ys,{value:"weighted_sum",children:a.jsx(be,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Ys,{value:"sigmoid",children:a.jsx(be,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Ys,{value:"inv_sigmoid",children:a.jsx(be,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Ys,{value:"add_difference",children:a.jsx(Ut,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(be,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs($,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs($,{columnGap:4,children:[a.jsx(be,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx($m,{value:M,onChange:J,children:a.jsxs($,{columnGap:4,children:[a.jsx(Ys,{value:"root",children:a.jsx(be,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Ys,{value:"custom",children:a.jsx(be,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(yo,{label:e("modelManager.mergedModelCustomSaveLocation"),value:R,onChange:re})]}),a.jsx(yr,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:A,fontWeight:"500"}),a.jsx(Xe,{onClick:L,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function ghe(e){const{model:t}=e,n=te(),{t:r}=W(),[o,{isLoading:s}]=tN(),[l,c]=i.useState("InvokeAIRoot"),[d,f]=i.useState("");i.useEffect(()=>{c("InvokeAIRoot")},[t]);const m=i.useCallback(()=>{c("InvokeAIRoot")},[]),h=i.useCallback(y=>{c(y)},[]),g=i.useCallback(y=>{f(y.target.value)},[]),b=i.useCallback(()=>{const y={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:l==="Custom"?d:void 0};if(l==="Custom"&&d===""){n(lt(rn({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(lt(rn({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(y).unwrap().then(()=>{n(lt(rn({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(lt(rn({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})},[o,d,n,t.base_model,t.model_name,l,r]);return a.jsxs(t0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:b,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Xe,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs($,{flexDirection:"column",rowGap:4,children:[a.jsx(be,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(cg,{children:[a.jsx(ts,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(ts,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(ts,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(ts,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(be,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs($,{flexDir:"column",gap:2,children:[a.jsxs($,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(be,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx($m,{value:l,onChange:h,children:a.jsxs($,{gap:4,children:[a.jsx(Ys,{value:"InvokeAIRoot",children:a.jsx(Ut,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Ys,{value:"Custom",children:a.jsx(Ut,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),l==="Custom"&&a.jsxs($,{flexDirection:"column",rowGap:2,children:[a.jsx(be,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(yo,{value:d,onChange:g,width:"full"})]})]})]})}function vhe(e){const{model:t}=e,[n,{isLoading:r}]=c3(),{data:o}=s3(),[s,l]=i.useState(!1);i.useEffect(()=>{o!=null&&o.includes(t.config)||l(!0)},[o,t.config]);const c=te(),{t:d}=W(),f=vi({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}}),m=i.useCallback(()=>l(g=>!g),[]),h=i.useCallback(g=>{const b={base_model:t.base_model,model_name:t.model_name,body:g};n(b).unwrap().then(y=>{f.setValues(y),c(lt(rn({title:d("modelManager.modelUpdated"),status:"success"})))}).catch(y=>{f.reset(),c(lt(rn({title:d("modelManager.modelUpdateFailed"),status:"error"})))})},[f,c,t.base_model,t.model_name,d,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs($,{flexDirection:"column",children:[a.jsx(be,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(be,{fontSize:"sm",color:"base.400",children:[xn[t.base_model]," ",d("modelManager.model")]})]}),[""].includes(t.base_model)?a.jsx(Sa,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:d("modelManager.conversionNotSupported")}):a.jsx(ghe,{model:t})]}),a.jsx(On,{}),a.jsx($,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:f.onSubmit(g=>h(g)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(En,{label:d("modelManager.name"),...f.getInputProps("model_name")}),a.jsx(En,{label:d("modelManager.description"),...f.getInputProps("description")}),a.jsx(kf,{required:!0,...f.getInputProps("base_model")}),a.jsx(f0,{required:!0,...f.getInputProps("variant")}),a.jsx(En,{required:!0,label:d("modelManager.modelLocation"),...f.getInputProps("path")}),a.jsx(En,{label:d("modelManager.vaeLocation"),...f.getInputProps("vae")}),a.jsxs($,{flexDirection:"column",gap:2,children:[s?a.jsx(En,{required:!0,label:d("modelManager.config"),...f.getInputProps("config")}):a.jsx(WO,{required:!0,...f.getInputProps("config")}),a.jsx(yr,{isChecked:s,onChange:m,label:"Use Custom Config"})]}),a.jsx(Xe,{type:"submit",isLoading:r,children:d("modelManager.updateModel")})]})})})]})}function bhe(e){const{model:t}=e,[n,{isLoading:r}]=c3(),o=te(),{t:s}=W(),l=vi({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=i.useCallback(d=>{const f={base_model:t.base_model,model_name:t.model_name,body:d};n(f).unwrap().then(m=>{l.setValues(m),o(lt(rn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{l.reset(),o(lt(rn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[l,o,t.base_model,t.model_name,s,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{flexDirection:"column",children:[a.jsx(be,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(be,{fontSize:"sm",color:"base.400",children:[xn[t.base_model]," ",s("modelManager.model")]})]}),a.jsx(On,{}),a.jsx("form",{onSubmit:l.onSubmit(d=>c(d)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(En,{label:s("modelManager.name"),...l.getInputProps("model_name")}),a.jsx(En,{label:s("modelManager.description"),...l.getInputProps("description")}),a.jsx(kf,{required:!0,...l.getInputProps("base_model")}),a.jsx(f0,{required:!0,...l.getInputProps("variant")}),a.jsx(En,{required:!0,label:s("modelManager.modelLocation"),...l.getInputProps("path")}),a.jsx(En,{label:s("modelManager.vaeLocation"),...l.getInputProps("vae")}),a.jsx(Xe,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function xhe(e){const{model:t}=e,[n,{isLoading:r}]=nN(),o=te(),{t:s}=W(),l=vi({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=i.useCallback(d=>{const f={base_model:t.base_model,model_name:t.model_name,body:d};n(f).unwrap().then(m=>{l.setValues(m),o(lt(rn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{l.reset(),o(lt(rn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,l,t.base_model,t.model_name,s,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{flexDirection:"column",children:[a.jsx(be,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(be,{fontSize:"sm",color:"base.400",children:[xn[t.base_model]," ",s("modelManager.model")," ⋅"," ",rN[t.model_format]," ",s("common.format")]})]}),a.jsx(On,{}),a.jsx("form",{onSubmit:l.onSubmit(d=>c(d)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(En,{label:s("modelManager.name"),...l.getInputProps("model_name")}),a.jsx(En,{label:s("modelManager.description"),...l.getInputProps("description")}),a.jsx(kf,{...l.getInputProps("base_model")}),a.jsx(En,{label:s("modelManager.modelLocation"),...l.getInputProps("path")}),a.jsx(Xe,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function yhe(e){const{t}=W(),n=te(),[r]=oN(),[o]=sN(),{model:s,isSelected:l,setSelectedModelId:c}=e,d=i.useCallback(()=>{c(s.id)},[s.id,c]),f=i.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n(lt(rn({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n(lt(rn({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),c(void 0)},[r,o,s,c,n,t]);return a.jsxs($,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx($,{as:Xe,isChecked:l,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:l?"accent.400":"base.100",color:l?"base.50":"base.800",_hover:{bg:l?"accent.500":"base.300",color:l?"base.50":"base.800"},_dark:{color:l?"base.50":"base.100",bg:l?"accent.600":"base.850",_hover:{color:l?"base.50":"base.100",bg:l?"accent.550":"base.700"}}},onClick:d,children:a.jsxs($,{gap:4,alignItems:"center",children:[a.jsx(Sa,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:aN[s.base_model]}),a.jsx(Ut,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(be,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(t0,{title:t("modelManager.deleteModel"),acceptCallback:f,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(Fe,{icon:a.jsx(Fre,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs($,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const Che=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=W(),[o,s]=i.useState(""),[l,c]=i.useState("all"),{filteredDiffusersModels:d,isLoadingDiffusersModels:f}=as(Bl,{selectFromResult:({data:_,isLoading:I})=>({filteredDiffusersModels:Vu(_,"main","diffusers",o),isLoadingDiffusersModels:I})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=as(Bl,{selectFromResult:({data:_,isLoading:I})=>({filteredCheckpointModels:Vu(_,"main","checkpoint",o),isLoadingCheckpointModels:I})}),{filteredLoraModels:g,isLoadingLoraModels:b}=Vd(void 0,{selectFromResult:({data:_,isLoading:I})=>({filteredLoraModels:Vu(_,"lora",void 0,o),isLoadingLoraModels:I})}),{filteredOnnxModels:y,isLoadingOnnxModels:x}=vd(Bl,{selectFromResult:({data:_,isLoading:I})=>({filteredOnnxModels:Vu(_,"onnx","onnx",o),isLoadingOnnxModels:I})}),{filteredOliveModels:w,isLoadingOliveModels:S}=vd(Bl,{selectFromResult:({data:_,isLoading:I})=>({filteredOliveModels:Vu(_,"onnx","olive",o),isLoadingOliveModels:I})}),j=i.useCallback(_=>{s(_.target.value)},[]);return a.jsx($,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs($,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs($t,{isAttached:!0,children:[a.jsx(Xe,{onClick:c.bind(null,"all"),isChecked:l==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Xe,{size:"sm",onClick:c.bind(null,"diffusers"),isChecked:l==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Xe,{size:"sm",onClick:c.bind(null,"checkpoint"),isChecked:l==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Xe,{size:"sm",onClick:c.bind(null,"onnx"),isChecked:l==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Xe,{size:"sm",onClick:c.bind(null,"olive"),isChecked:l==="olive",children:r("modelManager.oliveModels")}),a.jsx(Xe,{size:"sm",onClick:c.bind(null,"lora"),isChecked:l==="lora",children:r("modelManager.loraModels")})]}),a.jsx(yo,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs($,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[f&&a.jsx(tc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(l)&&!f&&d.length>0&&a.jsx(ec,{title:"Diffusers",modelList:d,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(tc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(l)&&!h&&m.length>0&&a.jsx(ec,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),b&&a.jsx(tc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(l)&&!b&&g.length>0&&a.jsx(ec,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(tc,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(l)&&!S&&w.length>0&&a.jsx(ec,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),x&&a.jsx(tc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(l)&&!x&&y.length>0&&a.jsx(ec,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},whe=i.memo(Che),Vu=(e,t,n,r)=>{const o=[];return qn(e==null?void 0:e.entities,s=>{if(!s)return;const l=s.model_name.toLowerCase().includes(r.toLowerCase()),c=n===void 0||s.model_format===n,d=s.model_type===t;l&&c&&d&&o.push(s)}),o},W2=i.memo(e=>a.jsx($,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));W2.displayName="StyledModelContainer";const ec=i.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(W2,{children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(be,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(yhe,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});ec.displayName="ModelListWrapper";const tc=i.memo(({loadingMessage:e})=>a.jsx(W2,{children:a.jsxs($,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(va,{}),a.jsx(be,{variant:"subtext",children:e||"Fetching..."})]})}));tc.displayName="FetchingModelsLoader";function She(){const[e,t]=i.useState(),{mainModel:n}=as(Bl,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=Vd(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs($,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(whe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(khe,{model:o})]})}const khe=e=>{const{t}=W(),{model:n}=e;return(n==null?void 0:n.model_format)==="checkpoint"?a.jsx(vhe,{model:n},n.id):(n==null?void 0:n.model_format)==="diffusers"?a.jsx(bhe,{model:n},n.id):(n==null?void 0:n.model_type)==="lora"?a.jsx(xhe,{model:n},n.id):a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(be,{variant:"subtext",children:t("modelManager.noModelSelected")})})};function jhe(){const{t:e}=W();return a.jsxs($,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(be,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(be,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(cu,{})]})}function _he(){return a.jsx($,{children:a.jsx(jhe,{})})}const Ihe=()=>{const{t:e}=W(),t=i.useMemo(()=>[{id:"modelManager",label:e("modelManager.modelManager"),content:a.jsx(She,{})},{id:"importModels",label:e("modelManager.importModels"),content:a.jsx(phe,{})},{id:"mergeModels",label:e("modelManager.mergeModels"),content:a.jsx(hhe,{})},{id:"settings",label:e("modelManager.settings"),content:a.jsx(_he,{})}],[e]);return a.jsxs(ci,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(ui,{children:t.map(n=>a.jsx(mr,{sx:{borderTopRadius:"base"},children:n.label},n.id))}),a.jsx(eu,{sx:{w:"full",h:"full"},children:t.map(n=>a.jsx($r,{sx:{w:"full",h:"full"},children:n.content},n.id))})]})},Phe=i.memo(Ihe),Ehe=e=>{const t=Ya();return{...u3,id:t,type:"current_image",position:e,data:{id:t,type:"current_image",isOpen:!0,label:"Current Image"}}},Mhe=e=>{const t=Ya();return{...u3,id:t,type:"notes",position:e,data:{id:t,isOpen:!0,label:"Notes",notes:"",type:"notes"}}},Ohe=fe([e=>e.nodes],e=>e.nodeTemplates),Dhe=()=>{const e=H(Ohe),t=zx();return i.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-U1/2+s.left,o=s.height/2-U1/2+s.top);const l=t.screenToFlowPosition({x:r,y:o});if(n==="current_image")return Ehe(l);if(n==="notes")return Mhe(l);const c=e[n];return lN(l,c)},[e,t])},GO=i.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(be,{fontWeight:600,children:e}),a.jsx(be,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));GO.displayName="AddNodePopoverSelectItem";const Rhe=(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))},Ahe=()=>{const e=te(),t=Dhe(),n=zs(),{t:r}=W(),o=H(w=>w.nodes.connectionStartFieldType),s=H(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),l=fe([pe],({nodes:w})=>{const S=o?pL(w.nodeTemplates,_=>{const I=s=="source"?_.inputs:_.outputs;return Jo(I,E=>{const M=s=="source"?o:E.type,D=s=="target"?o:E.type;return Bx(M,D)})}):Hr(w.nodeTemplates),j=Hr(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}}),{data:c}=H(l),d=H(w=>w.nodes.isAddNodePopoverOpen),f=i.useRef(null),m=i.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(iN(S))},[e,t,n,r]),h=i.useCallback(w=>{w&&m(w)},[m]),g=i.useCallback(()=>{e(cN())},[e]),b=i.useCallback(()=>{e(d3())},[e]),y=i.useCallback(w=>{w.preventDefault(),b(),setTimeout(()=>{var S;(S=f.current)==null||S.focus()},0)},[b]),x=i.useCallback(()=>{g()},[g]);return tt(["shift+a","space"],y),tt(["escape"],x),a.jsxs(lf,{initialFocusRef:f,isOpen:d,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(p6,{children:a.jsx($,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(cf,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Cg,{sx:{p:0},children:a.jsx(sn,{inputRef:f,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:c,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:GO,filter:Rhe,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},The=i.memo(Ahe),Nhe=()=>{const e=zx(),t=H(r=>r.nodes.shouldValidateGraph);return i.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:l})=>{const c=e.getEdges(),d=e.getNodes();if(!(r&&o&&s&&l))return!1;const f=e.getNode(r),m=e.getNode(s);if(!(f&&m&&f.data&&m.data))return!1;const h=f.data.outputs[o],g=m.data.inputs[l];return!h||!g||r===s?!1:t?c.find(b=>{b.target===s&&b.targetHandle===l&&b.source===r&&b.sourceHandle})||c.find(b=>b.target===s&&b.targetHandle===l)&&g.type.name!=="CollectionItemField"||!Bx(h.type,g.type)?!1:f3(r,s,d,c):!0},[e,t])},_c=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,V2=e=>{if(!e)return _c("base.500");const t=uN[e.name];return _c(t||"base.500")},$he=fe(pe,({nodes:e})=>{const{shouldAnimateEdges:t,connectionStartFieldType:n,shouldColorEdges:r}=e,o=r?V2(n):_c("base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),Lhe=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:l,className:c}=H($he),d={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[f]=Hx(d);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:l,strokeWidth:2,className:c,d:f,style:{opacity:.8}})})},Fhe=i.memo(Lhe),KO=(e,t,n,r,o)=>fe(pe,({nodes:s})=>{var g,b;const l=s.nodes.find(y=>y.id===e),c=s.nodes.find(y=>y.id===n),d=Jt(l)&&Jt(c),f=(l==null?void 0:l.selected)||(c==null?void 0:c.selected)||o,m=d?(b=(g=l==null?void 0:l.data)==null?void 0:g.outputs[t||""])==null?void 0:b.type:void 0,h=m&&s.shouldColorEdges?V2(m):_c("base.500");return{isSelected:f,shouldAnimate:s.shouldAnimateEdges&&f,stroke:h}}),zhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:l,data:c,selected:d,source:f,target:m,sourceHandleId:h,targetHandleId:g})=>{const b=i.useMemo(()=>KO(f,h,m,g,d),[d,f,h,m,g]),{isSelected:y,shouldAnimate:x}=H(b),[w,S,j]=Hx({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=hf();return a.jsxs(a.Fragment,{children:[a.jsx(p3,{path:w,markerEnd:l,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(dN,{children:a.jsx($,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Sa,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:c.count})})})]})},Bhe=i.memo(zhe),Hhe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:l,selected:c,source:d,target:f,sourceHandleId:m,targetHandleId:h})=>{const g=i.useMemo(()=>KO(d,m,f,h,c),[d,m,f,h,c]),{isSelected:b,shouldAnimate:y,stroke:x}=H(g),[w]=Hx({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(p3,{path:w,markerEnd:l,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=i.memo(Hhe),Vhe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:l,handleMouseOver:c}=oO(t),d=i.useMemo(()=>fe(pe,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===ta.enum.IN_PROGRESS}),[t]),f=H(d),[m,h,g,b]=Zo("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),x=ia(m,h),w=H(j=>j.nodes.nodeOpacity),S=i.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(fN(t)),y(m3())},[y,t]);return a.jsxs(Ie,{onClick:S,onMouseEnter:c,onMouseLeave:l,className:Kc,sx:{h:"full",position:"relative",borderRadius:"base",w:n??U1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${b}, ${b}`,zIndex:-1}}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:f?x:void 0,zIndex:-1}}),r,a.jsx(rO,{isSelected:o,isHovered:s})]})},p0=i.memo(Vhe),Uhe=fe(pe,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Ghe=e=>{const{progressImage:t,imageDTO:n}=pN(Uhe);return t?a.jsx(E1,{nodeProps:e,children:a.jsx(Ca,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(E1,{nodeProps:e,children:a.jsx(fl,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(E1,{nodeProps:e,children:a.jsx(Tn,{})})},Khe=i.memo(Ghe),E1=e=>{const[t,n]=i.useState(!1),r=i.useCallback(()=>{n(!0)},[]),o=i.useCallback(()=>{n(!1)},[]),{t:s}=W();return a.jsx(p0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs($,{onMouseEnter:r,onMouseLeave:o,className:Kc,sx:{position:"relative",flexDirection:"column"},children:[a.jsx($,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(be,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:s("nodes.currentImage")})}),a.jsxs($,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Mn.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(FO,{})},"nextPrevButtons")]})]})})},U2=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!na(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>na(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},qhe=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Jt(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const l=Hr(s.inputs).filter(c=>(["any","direct"].includes(c.input)||c.type.isCollectionOrScalar)&&hx(h3).includes(c.type.name));return U2(l)}),[e]);return H(t)},Xhe=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(c=>c.id===e);if(!Jt(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const l=Hr(s.inputs).filter(c=>c.input==="connection"&&!c.type.isCollectionOrScalar||!hx(h3).includes(c.type.name));return U2(l)}),[e]);return H(t)},Qhe=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Jt(o))return[];const s=r.nodeTemplates[o.data.type];return s?U2(Hr(s.outputs)):[]}),[e]);return H(t)},G2=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Jt(o)?Jo(o.data.outputs,s=>s.type.name==="ImageField"&&o.data.type!=="image"):!1}),[e]);return H(t)},Yhe=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Jt(o)?o.data.isIntermediate:!1}),[e]);return H(t)},Zhe=({nodeId:e})=>{const{t}=W(),n=te(),r=G2(e),o=Yhe(e),s=i.useCallback(l=>{n(mN({nodeId:e,isIntermediate:!l.target.checked}))},[n,e]);return r?a.jsxs(Gt,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(ln,{sx:{fontSize:"xs",mb:"1px"},children:t("hotkeys.saveToGallery.title")}),a.jsx(og,{className:"nopan",size:"sm",onChange:s,isChecked:!o})]}):null},Jhe=i.memo(Zhe),ege=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Jt(o)?o.data.useCache:!1}),[e]);return H(t)},tge=({nodeId:e})=>{const t=te(),n=ege(e),r=i.useCallback(s=>{t(hN({nodeId:e,useCache:s.target.checked}))},[t,e]),{t:o}=W();return a.jsxs(Gt,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(ln,{sx:{fontSize:"xs",mb:"1px"},children:o("invocationCache.useCache")}),a.jsx(og,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},nge=i.memo(tge),rge=({nodeId:e})=>{const t=G2(e),n=Mt("invocationCache").isFeatureEnabled;return a.jsxs($,{className:Kc,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(nge,{nodeId:e}),t&&a.jsx(Jhe,{nodeId:e})]})},oge=i.memo(rge),sge=({nodeId:e,isOpen:t})=>{const n=te(),r=gN(),o=i.useCallback(()=>{n(vN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(Fe,{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(Kg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},K2=i.memo(sge),age=({nodeId:e,title:t})=>{const n=te(),r=eO(e),o=tO(e),{t:s}=W(),[l,c]=i.useState(""),d=i.useCallback(async m=>{n(qI({nodeId:e,label:m})),c(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),f=i.useCallback(m=>{c(m)},[]);return i.useEffect(()=>{c(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx($,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(ef,{as:$,value:l,onChange:f,onSubmit:d,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(Jd,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(Zd,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(lge,{})]})})},qO=i.memo(age);function lge(){const{isEditing:e,getEditButtonProps:t}=K3(),n=i.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Ie,{className:Kc,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const ige=({nodeId:e})=>{const t=A2(e),{base400:n,base600:r}=hf(),o=ia(n,r),s=i.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Im(t)?a.jsxs(a.Fragment,{children:[a.jsx(qu,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:rc.Left,style:{...s,left:"-0.5rem"}}),Hr(t.inputs,l=>a.jsx(qu,{type:"target",id:l.name,isConnectable:!1,position:rc.Left,style:{visibility:"hidden"}},`${t.id}-${l.name}-collapsed-input-handle`)),a.jsx(qu,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:rc.Right,style:{...s,right:"-0.5rem"}}),Hr(t.outputs,l=>a.jsx(qu,{type:"source",id:l.name,isConnectable:!1,position:rc.Right,style:{visibility:"hidden"}},`${t.id}-${l.name}-collapsed-output-handle`))]}):null},cge=i.memo(ige),uge=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]}),[e]);return H(t)},dge=e=>{const t=i.useMemo(()=>fe(pe,({nodes:s})=>{const l=s.nodes.find(d=>d.id===e),c=s.nodeTemplates[(l==null?void 0:l.data.type)??""];return{node:l,template:c}}),[e]),{node:n,template:r}=H(t);return i.useMemo(()=>Jt(n)&&r?$x(n,r):!1,[n,r])},fge=({nodeId:e})=>{const t=dge(e);return a.jsx(Ut,{label:a.jsx(XO,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(An,{as:HM,sx:{display:"block",boxSize:4,w:8,color:t?"error.400":"base.400"}})})},pge=i.memo(fge),XO=i.memo(({nodeId:e})=>{const t=A2(e),n=uge(e),{t:r}=W(),o=i.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=i.useMemo(()=>!Im(t)||!n?null:t.version?n.version?dS(t.version,n.version,"<")?a.jsxs(be,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):dS(t.version,n.version,">")?a.jsxs(be,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(be,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(be,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(be,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return Im(t)?a.jsxs($,{sx:{flexDir:"column"},children:[a.jsx(be,{as:"span",sx:{fontWeight:600},children:o}),(n==null?void 0:n.nodePack)&&a.jsxs(be,{opacity:.7,children:[r("nodes.nodePack"),": ",n.nodePack]}),a.jsx(be,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(be,{children:t.notes})]}):a.jsx(be,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});XO.displayName="TooltipContent";const M1=3,G_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},mge=({nodeId:e})=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=H(t);return n?a.jsx(Ut,{label:a.jsx(QO,{nodeExecutionState:n}),placement:"top",children:a.jsx($,{className:Kc,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(YO,{nodeExecutionState:n})})}):null},hge=i.memo(mge),QO=i.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=W();return t===ta.enum.PENDING?a.jsx(be,{children:o("queue.pending")}):t===ta.enum.IN_PROGRESS?r?a.jsxs($,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(Ca,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Sa,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(be,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(be,{children:o("nodes.executionStateInProgress")}):t===ta.enum.COMPLETED?a.jsx(be,{children:o("nodes.executionStateCompleted")}):t===ta.enum.FAILED?a.jsx(be,{children:o("nodes.executionStateError")}):null});QO.displayName="TooltipLabel";const YO=i.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===ta.enum.PENDING?a.jsx(An,{as:wte,sx:{boxSize:M1,color:"base.600",_dark:{color:"base.300"}}}):n===ta.enum.IN_PROGRESS?t===null?a.jsx(hb,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:G_}):a.jsx(hb,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:G_}):n===ta.enum.COMPLETED?a.jsx(An,{as:$M,sx:{boxSize:M1,color:"ok.600",_dark:{color:"ok.300"}}}):n===ta.enum.FAILED?a.jsx(An,{as:_te,sx:{boxSize:M1,color:"error.600",_dark:{color:"error.300"}}}):null});YO.displayName="StatusIcon";const gge=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Jt(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s==null?void 0:s.classification}),[e]);return H(t)},vge=({nodeId:e})=>{const t=gge(e);return!t||t==="stable"?null:a.jsx(Ut,{label:a.jsx(ZO,{classification:t}),placement:"top",shouldWrapChildren:!0,children:a.jsx(An,{as:xge(t),sx:{display:"block",boxSize:4,color:"base.400"}})})},bge=i.memo(vge),ZO=i.memo(({classification:e})=>{const{t}=W();return e==="beta"?t("nodes.betaDesc"):e==="prototype"?t("nodes.prototypeDesc"):null});ZO.displayName="ClassificationTooltipContent";const xge=e=>{if(e==="beta")return iae;if(e==="prototype")return Ote},yge=({nodeId:e,isOpen:t})=>a.jsxs($,{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(K2,{nodeId:e,isOpen:t}),a.jsx(bge,{nodeId:e}),a.jsx(qO,{nodeId:e}),a.jsxs($,{alignItems:"center",children:[a.jsx(hge,{nodeId:e}),a.jsx(pge,{nodeId:e})]}),!t&&a.jsx(cge,{nodeId:e})]}),Cge=i.memo(yge),wge=(e,t,n,r)=>fe(pe,o=>{if(!r)return wt.t("nodes.noFieldType");const{connectionStartFieldType:s,connectionStartParams:l,nodes:c,edges:d}=o.nodes;if(!l||!s)return wt.t("nodes.noConnectionInProgress");const{handleType:f,nodeId:m,handleId:h}=l;if(!f||!m||!h)return wt.t("nodes.noConnectionData");const g=n==="target"?r:s,b=n==="source"?r:s;if(e===m)return wt.t("nodes.cannotConnectToSelf");if(n===f)return n==="source"?wt.t("nodes.cannotConnectOutputToOutput"):wt.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,x=n==="target"?t:h,w=n==="source"?e:m,S=n==="source"?t:h;if(d.find(_=>{_.target===y&&_.targetHandle===x&&_.source===w&&_.sourceHandle}))return wt.t("nodes.cannotDuplicateConnection");if(d.find(_=>_.target===y&&_.targetHandle===x)&&g.name!=="CollectionItemField")return wt.t("nodes.inputMayOnlyHaveOneConnection");if(!Bx(b,g))return wt.t("nodes.fieldTypesMustMatch");if(!f3(f==="source"?m:e,f==="source"?e:m,c,d))return wt.t("nodes.connectionWouldCreateCycle")}),Sge=(e,t,n)=>{const r=i.useMemo(()=>fe(pe,({nodes:s})=>{const l=s.nodes.find(d=>d.id===e);if(!Jt(l))return;const c=l.data[Lx[n]][t];return c==null?void 0:c.type}),[t,n,e]);return H(r)},kge=fe(pe,({nodes:e})=>e.connectionStartFieldType!==null&&e.connectionStartParams!==null),JO=({nodeId:e,fieldName:t,kind:n})=>{const r=Sge(e,t,n),o=i.useMemo(()=>fe(pe,({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=i.useMemo(()=>wge(e,t,n==="input"?"target":"source",r),[e,t,n,r]),l=i.useMemo(()=>fe(pe,({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(kge),f=H(l),m=H(s),h=i.useMemo(()=>!!(d&&m&&!f),[m,d,f]);return{isConnected:c,isConnectionInProgress:d,isConnectionStartField:f,connectionError:m,shouldDim:h}},jge=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{var l;const s=o.nodes.find(c=>c.id===e);if(Jt(s))return((l=s==null?void 0:s.data.inputs[t])==null?void 0:l.value)!==void 0}),[t,e]);return H(n)},_ge=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{const s=o.nodes.find(l=>l.id===e);if(Jt(s))return s.data.inputs[t]}),[t,e]);return H(n)},Ige=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{const s=o.nodes.find(c=>c.id===e);if(!Jt(s))return;const l=o.nodeTemplates[(s==null?void 0:s.data.type)??""];return l==null?void 0:l.inputs[t]}),[t,e]);return H(n)},Pge=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{const s=o.nodes.find(d=>d.id===e);if(!Jt(s))return;const l=o.nodeTemplates[(s==null?void 0:s.data.type)??""],c=l==null?void 0:l.inputs[t];return c==null?void 0:c.input}),[t,e]);return H(n)},Ege=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=sO(e,t),l=aO(e,t,n),c=Pge(e,t),{t:d}=W(),f=i.useCallback(S=>{S.preventDefault()},[]),m=i.useMemo(()=>fe(pe,({workflow:S})=>({isExposed:!!S.exposedFields.find(_=>_.nodeId===e&&_.fieldName===t)})),[t,e]),h=i.useMemo(()=>c&&["any","direct"].includes(c),[c]),{isExposed:g}=H(m),b=i.useCallback(()=>{o(bN({nodeId:e,fieldName:t}))},[o,t,e]),y=i.useCallback(()=>{o(ZI({nodeId:e,fieldName:t}))},[o,t,e]),x=i.useMemo(()=>{const S=[];return h&&!g&&S.push(a.jsx(At,{icon:a.jsx(nl,{}),onClick:b,children:d("nodes.addLinearView")},`${e}.${t}.expose-field`)),h&&g&&S.push(a.jsx(At,{icon:a.jsx(Fte,{}),onClick:y,children:d("nodes.removeLinearView")},`${e}.${t}.unexpose-field`)),S},[t,b,y,g,h,e,d]),w=i.useCallback(()=>x.length?a.jsx(al,{sx:{visibility:"visible !important"},motionProps:Yl,onContextMenu:f,children:a.jsx(_d,{title:s||l||d("nodes.unknownField"),children:x})}):null,[l,s,x,f,d]);return a.jsx(f2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:w,children:r})},Mge=i.memo(Ege),Oge=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:l}=t,c=t.type,d=cO(c),f=i.useMemo(()=>{const h=xN.some(y=>y===c.name),g=V2(c),b={backgroundColor:c.isCollection||c.isCollectionOrScalar?_c("base.900"):g,position:"absolute",width:"1rem",height:"1rem",borderWidth:c.isCollection||c.isCollectionOrScalar?4:0,borderStyle:"solid",borderColor:g,borderRadius:h?4:"100%",zIndex:1};return n==="target"?b.insetInlineStart="-1rem":b.insetInlineEnd="-1rem",r&&!o&&s&&(b.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?b.cursor="grab":b.cursor="not-allowed":b.cursor="crosshair",b},[s,n,r,o,c]),m=i.useMemo(()=>r&&s?s:d,[s,d,r]);return a.jsx(Ut,{label:m,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:Zh,children:a.jsx(qu,{type:n,id:l,position:n==="target"?rc.Left:rc.Right,style:f})})},eD=i.memo(Oge),Dge=({nodeId:e,fieldName:t})=>{const{t:n}=W(),r=Ige(e,t),o=_ge(e,t),s=jge(e,t),{isConnected:l,isConnectionInProgress:c,isConnectionStartField:d,connectionError:f,shouldDim:m}=JO({nodeId:e,fieldName:t,kind:"input"}),h=i.useMemo(()=>{if(!r||!r.required)return!1;if(!l&&r.input==="connection"||!s&&!l&&r.input==="any")return!0},[r,l,s]);return!r||!o?a.jsx(cx,{shouldDim:m,children:a.jsx(Gt,{sx:{alignItems:"stretch",justifyContent:"space-between",gap:2,h:"full",w:"full"},children:a.jsx(ln,{sx:{display:"flex",alignItems:"center",mb:0,px:1,gap:2,h:"full",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:n("nodes.unknownInput",{name:(o==null?void 0:o.label)??(r==null?void 0:r.title)??t})})})}):a.jsxs(cx,{shouldDim:m,children:[a.jsxs(Gt,{isInvalid:h,isDisabled:l,sx:{alignItems:"stretch",justifyContent:"space-between",ps:r.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(Mge,{nodeId:e,fieldName:t,kind:"input",children:g=>a.jsx(ln,{sx:{display:"flex",alignItems:"center",mb:0,px:1,gap:2,h:"full"},children:a.jsx(uO,{ref:g,nodeId:e,fieldName:t,kind:"input",isMissingInput:h,withTooltip:!0})})}),a.jsx(Ie,{children:a.jsx(yO,{nodeId:e,fieldName:t})})]}),r.input!=="direct"&&a.jsx(eD,{fieldTemplate:r,handleType:"target",isConnectionInProgress:c,isConnectionStartField:d,connectionError:f})]})},K_=i.memo(Dge),cx=i.memo(({shouldDim:e,children:t})=>a.jsx($,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));cx.displayName="InputFieldWrapper";const Rge=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{const s=o.nodes.find(l=>l.id===e);if(Jt(s))return s.data.outputs[t]}),[t,e]);return H(n)},Age=(e,t)=>{const n=i.useMemo(()=>fe(pe,({nodes:o})=>{const s=o.nodes.find(c=>c.id===e);if(!Jt(s))return;const l=o.nodeTemplates[(s==null?void 0:s.data.type)??""];return l==null?void 0:l.outputs[t]}),[t,e]);return H(n)},Tge=({nodeId:e,fieldName:t})=>{const{t:n}=W(),r=Age(e,t),o=Rge(e,t),{isConnected:s,isConnectionInProgress:l,isConnectionStartField:c,connectionError:d,shouldDim:f}=JO({nodeId:e,fieldName:t,kind:"output"});return!r||!o?a.jsx(ux,{shouldDim:f,children:a.jsx(Gt,{sx:{alignItems:"stretch",justifyContent:"space-between",gap:2,h:"full",w:"full"},children:a.jsx(ln,{sx:{display:"flex",alignItems:"center",mb:0,px:1,gap:2,h:"full",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:n("nodes.unknownOutput",{name:(r==null?void 0:r.title)??t})})})}):a.jsxs(ux,{shouldDim:f,children:[a.jsx(Ut,{label:a.jsx(T2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:Zh,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Gt,{isDisabled:s,pe:2,children:a.jsx(ln,{sx:{mb:0,fontWeight:500},children:r==null?void 0:r.title})})}),a.jsx(eD,{fieldTemplate:r,handleType:"source",isConnectionInProgress:l,isConnectionStartField:c,connectionError:d})]})},Nge=i.memo(Tge),ux=i.memo(({shouldDim:e,children:t})=>a.jsx($,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));ux.displayName="OutputFieldWrapper";const $ge=e=>{const t=G2(e),n=Mt("invocationCache").isFeatureEnabled;return i.useMemo(()=>t||n,[t,n])},Lge=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Xhe(e),l=qhe(e),c=$ge(e),d=Qhe(e);return a.jsxs(p0,{nodeId:e,selected:o,children:[a.jsx(Cge,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx($,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:c?0:"base"},children:a.jsxs($,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(sl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((f,m)=>a.jsx(Sd,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(K_,{nodeId:e,fieldName:f})},`${e}.${f}.input-field`)),d.map((f,m)=>a.jsx(Sd,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(Nge,{nodeId:e,fieldName:f})},`${e}.${f}.output-field`))]}),l.map(f=>a.jsx(K_,{nodeId:e,fieldName:f},`${e}.${f}.input-field`))]})}),c&&a.jsx(oge,{nodeId:e})]})]})},Fge=i.memo(Lge),zge=e=>{const t=i.useMemo(()=>fe(pe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Jt(o)?o.data.nodePack:!1}),[e]);return H(t)},Bge=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const{t:s}=W(),l=zge(e);return a.jsxs(p0,{nodeId:e,selected:o,children:[a.jsxs($,{className:Kc,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(K2,{nodeId:e,isOpen:t}),a.jsx(be,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx($,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs($,{gap:2,flexDir:"column",children:[a.jsxs(be,{as:"span",children:[s("nodes.unknownNodeType"),":"," ",a.jsx(be,{as:"span",fontWeight:600,children:r})]}),l&&a.jsxs(be,{as:"span",children:[s("nodes.nodePack"),":"," ",a.jsx(be,{as:"span",fontWeight:600,children:l})]})]})})]})},Hge=i.memo(Bge),Wge=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:l}=t,c=i.useMemo(()=>fe(pe,({nodes:f})=>!!f.nodeTemplates[o]),[o]);return H(c)?a.jsx(Fge,{nodeId:r,isOpen:s,label:l,type:o,selected:n}):a.jsx(Hge,{nodeId:r,isOpen:s,label:l,type:o,selected:n})},Vge=i.memo(Wge),Uge=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,l=te(),c=i.useCallback(d=>{l(yN({nodeId:t,value:d.target.value}))},[l,t]);return a.jsxs(p0,{nodeId:t,selected:r,children:[a.jsxs($,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(K2,{nodeId:t,isOpen:s}),a.jsx(qO,{nodeId:t,title:"Notes"}),a.jsx(Ie,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx($,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx($,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(ga,{value:o,onChange:c,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},Gge=i.memo(Uge),Kge=["Delete","Backspace"],qge={collapsed:Bhe,default:Whe},Xge={invocation:Vge,current_image:Khe,notes:Gge},Qge={hideAttribution:!0},Yge=fe(pe,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}}),Zge=()=>{const e=te(),t=H(O=>O.nodes.nodes),n=H(O=>O.nodes.edges),r=H(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=H(Yge),l=i.useRef(null),c=i.useRef(),d=Nhe(),[f]=Zo("radii",["base"]),m=i.useCallback(O=>{e(CN(O))},[e]),h=i.useCallback(O=>{e(wN(O))},[e]),g=i.useCallback((O,T)=>{e(SN(T))},[e]),b=i.useCallback(O=>{e(fS(O))},[e]),y=i.useCallback(()=>{e(kN({cursorPosition:c.current}))},[e]),x=i.useCallback(O=>{e(jN(O))},[e]),w=i.useCallback(O=>{e(_N(O))},[e]),S=i.useCallback(({nodes:O,edges:T})=>{e(IN(O?O.map(U=>U.id):[])),e(PN(T?T.map(U=>U.id):[]))},[e]),j=i.useCallback((O,T)=>{e(EN(T))},[e]),_=i.useCallback(()=>{e(m3())},[e]),I=i.useCallback(O=>{pS.set(O),O.fitView()},[]),E=i.useCallback(O=>{var T,U;(T=l.current)!=null&&T.getBoundingClientRect()&&(c.current=(U=pS.get())==null?void 0:U.screenToFlowPosition({x:O.clientX,y:O.clientY}))},[]),M=i.useRef(),D=i.useCallback((O,T,U)=>{M.current=O,e(MN(T.id)),e(ON())},[e]),R=i.useCallback((O,T)=>{e(fS(T))},[e]),N=i.useCallback((O,T,U)=>{var G,q;!("touches"in O)&&((G=M.current)==null?void 0:G.clientX)===O.clientX&&((q=M.current)==null?void 0:q.clientY)===O.clientY&&e(DN(T)),M.current=void 0},[e]);return tt(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(RN())}),tt(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(AN())}),tt(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(TN({cursorPosition:c.current}))}),a.jsx(NN,{id:"workflow-editor",ref:l,defaultViewport:r,nodeTypes:Xge,edgeTypes:qge,nodes:t,edges:n,onInit:I,onMouseMove:E,onNodesChange:m,onEdgesChange:h,onEdgesDelete:x,onEdgeUpdate:R,onEdgeUpdateStart:D,onEdgeUpdateEnd:N,onNodesDelete:w,onConnectStart:g,onConnect:b,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Fhe,onSelectionChange:S,isValidConnection:d,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Qge,style:{borderRadius:f},onPaneClick:_,deleteKeyCode:Kge,selectionMode:s,children:a.jsx($L,{})})};function Jge(){const e=te(),t=H(o=>o.nodes.nodeOpacity),{t:n}=W(),r=i.useCallback(o=>{e($N(o))},[e]);return a.jsx($,{alignItems:"center",children:a.jsxs(Sy,{"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(jy,{children:a.jsx(_y,{})}),a.jsx(ky,{})]})})}const e0e=()=>{const{t:e}=W(),{zoomIn:t,zoomOut:n,fitView:r}=zx(),o=te(),s=H(m=>m.nodes.shouldShowMinimapPanel),l=i.useCallback(()=>{t()},[t]),c=i.useCallback(()=>{n()},[n]),d=i.useCallback(()=>{r()},[r]),f=i.useCallback(()=>{o(LN(!s))},[s,o]);return a.jsxs($t,{isAttached:!0,orientation:"vertical",children:[a.jsx(Fe,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:l,icon:a.jsx(uae,{})}),a.jsx(Fe,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:c,icon:a.jsx(cae,{})}),a.jsx(Fe,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:d,icon:a.jsx(zM,{})}),a.jsx(Fe,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:f,icon:a.jsx(Lte,{})})]})},t0e=i.memo(e0e),n0e=()=>a.jsxs($,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(t0e,{}),a.jsx(Jge,{})]}),r0e=i.memo(n0e),o0e=je(OL),s0e=()=>{const e=H(r=>r.nodes.shouldShowMinimapPanel),t=ia("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=ia("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx($,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(o0e,{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})})},a0e=i.memo(s0e),l0e=()=>{const e=te(),{t}=W(),n=i.useCallback(()=>{e(d3())},[e]);return a.jsx(Fe,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(nl,{}),onClick:n,pointerEvents:"auto"})},i0e=i.memo(l0e),c0e=fe(pe,e=>{const t=e.nodes.nodes,n=e.nodes.nodeTemplates;return t.filter(Jt).some(o=>{const s=n[o.data.type];return s?$x(o,s):!1})}),u0e=()=>H(c0e),d0e=()=>{const e=te(),{t}=W(),n=u0e(),r=i.useCallback(()=>{e(FN())},[e]);return n?a.jsx(Xe,{leftIcon:a.jsx(jte,{}),onClick:r,pointerEvents:"auto",children:t("nodes.updateAllNodes")}):null},f0e=i.memo(d0e),p0e=()=>{const{t:e}=W(),t=H(o=>o.workflow.name),n=H(o=>o.workflow.isTouched),r=Mt("workflowLibrary").isFeatureEnabled;return a.jsxs(be,{m:2,fontSize:"lg",userSelect:"none",noOfLines:1,wordBreak:"break-all",fontWeight:600,opacity:.8,children:[t||e("workflows.unnamedWorkflow"),n&&r?` (${e("common.unsaved")})`:""]})},m0e=i.memo(p0e),tD=i.createContext(null);var h0e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,g0e=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,v0e=/[^-+\dA-Z]/g;function nm(e,t,n,r){if(arguments.length===1&&typeof e=="string"&&!/\d/.test(e)&&(t=e,e=void 0),e=e||e===0?e:new Date,e instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");t=String(cc[t]||t||cc.default);var o=t.slice(0,4);(o==="UTC:"||o==="GMT:")&&(t=t.slice(4),n=!0,o==="GMT:"&&(r=!0));var s=function(){return n?"getUTC":"get"},l=function(){return e[s()+"Date"]()},c=function(){return e[s()+"Day"]()},d=function(){return e[s()+"Month"]()},f=function(){return e[s()+"FullYear"]()},m=function(){return e[s()+"Hours"]()},h=function(){return e[s()+"Minutes"]()},g=function(){return e[s()+"Seconds"]()},b=function(){return e[s()+"Milliseconds"]()},y=function(){return n?0:e.getTimezoneOffset()},x=function(){return b0e(e)},w=function(){return x0e(e)},S={d:function(){return l()},dd:function(){return Yr(l())},ddd:function(){return Rr.dayNames[c()]},DDD:function(){return q_({y:f(),m:d(),d:l(),_:s(),dayName:Rr.dayNames[c()],short:!0})},dddd:function(){return Rr.dayNames[c()+7]},DDDD:function(){return q_({y:f(),m:d(),d:l(),_:s(),dayName:Rr.dayNames[c()+7]})},m:function(){return d()+1},mm:function(){return Yr(d()+1)},mmm:function(){return Rr.monthNames[d()]},mmmm:function(){return Rr.monthNames[d()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Yr(f(),4)},h:function(){return m()%12||12},hh:function(){return Yr(m()%12||12)},H:function(){return m()},HH:function(){return Yr(m())},M:function(){return h()},MM:function(){return Yr(h())},s:function(){return g()},ss:function(){return Yr(g())},l:function(){return Yr(b(),3)},L:function(){return Yr(Math.floor(b()/10))},t:function(){return m()<12?Rr.timeNames[0]:Rr.timeNames[1]},tt:function(){return m()<12?Rr.timeNames[2]:Rr.timeNames[3]},T:function(){return m()<12?Rr.timeNames[4]:Rr.timeNames[5]},TT:function(){return m()<12?Rr.timeNames[6]:Rr.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":y0e(e)},o:function(){return(y()>0?"-":"+")+Yr(Math.floor(Math.abs(y())/60)*100+Math.abs(y())%60,4)},p:function(){return(y()>0?"-":"+")+Yr(Math.floor(Math.abs(y())/60),2)+":"+Yr(Math.floor(Math.abs(y())%60),2)},S:function(){return["th","st","nd","rd"][l()%10>3?0:(l()%100-l()%10!=10)*l()%10]},W:function(){return x()},WW:function(){return Yr(x())},N:function(){return w()}};return t.replace(h0e,function(j){return j in S?S[j]():j.slice(1,j.length-1)})}var cc={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Rr={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Yr=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(t).padStart(n,"0")},q_=function(t){var n=t.y,r=t.m,o=t.d,s=t._,l=t.dayName,c=t.short,d=c===void 0?!1:c,f=new Date,m=new Date;m.setDate(m[s+"Date"]()-1);var h=new Date;h.setDate(h[s+"Date"]()+1);var g=function(){return f[s+"Date"]()},b=function(){return f[s+"Month"]()},y=function(){return f[s+"FullYear"]()},x=function(){return m[s+"Date"]()},w=function(){return m[s+"Month"]()},S=function(){return m[s+"FullYear"]()},j=function(){return h[s+"Date"]()},_=function(){return h[s+"Month"]()},I=function(){return h[s+"FullYear"]()};return y()===n&&b()===r&&g()===o?d?"Tdy":"Today":S()===n&&w()===r&&x()===o?d?"Ysd":"Yesterday":I()===n&&_()===r&&j()===o?d?"Tmw":"Tomorrow":l},b0e=function(t){var n=new Date(t.getFullYear(),t.getMonth(),t.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var o=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-o);var s=(n-r)/(864e5*7);return 1+Math.floor(s)},x0e=function(t){var n=t.getDay();return n===0&&(n=7),n},y0e=function(t){return(String(t).match(g0e)||[""]).pop().replace(v0e,"").replace(/GMT\+0000/g,"UTC")};const nD=zN.injectEndpoints({endpoints:e=>({getWorkflow:e.query({query:t=>`workflows/i/${t}`,providesTags:(t,n,r)=>[{type:"Workflow",id:r}],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:o}=n;try{await o,r(nD.util.invalidateTags([{type:"WorkflowsRecent",id:Fa}]))}catch{}}}),deleteWorkflow:e.mutation({query:t=>({url:`workflows/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,r)=>[{type:"Workflow",id:Fa},{type:"Workflow",id:r},{type:"WorkflowsRecent",id:Fa}]}),createWorkflow:e.mutation({query:t=>({url:"workflows/",method:"POST",body:{workflow:t}}),invalidatesTags:[{type:"Workflow",id:Fa},{type:"WorkflowsRecent",id:Fa}]}),updateWorkflow:e.mutation({query:t=>({url:`workflows/i/${t.id}`,method:"PATCH",body:{workflow:t}}),invalidatesTags:(t,n,r)=>[{type:"WorkflowsRecent",id:Fa},{type:"Workflow",id:Fa},{type:"Workflow",id:r.id}]}),listWorkflows:e.query({query:t=>({url:"workflows/",params:t}),providesTags:[{type:"Workflow",id:Fa}]})})}),{useLazyGetWorkflowQuery:C0e,useCreateWorkflowMutation:rD,useDeleteWorkflowMutation:w0e,useUpdateWorkflowMutation:S0e,useListWorkflowsQuery:k0e}=nD,j0e=({onSuccess:e,onError:t})=>{const n=zs(),{t:r}=W(),[o,s]=w0e();return{deleteWorkflow:i.useCallback(async c=>{try{await o(c).unwrap(),n({title:r("toast.workflowDeleted")}),e&&e()}catch{n({title:r("toast.problemDeletingWorkflow"),status:"error"}),t&&t()}},[o,n,r,e,t]),deleteWorkflowResult:s}},_0e=({onSuccess:e,onError:t})=>{const n=te(),r=zs(),{t:o}=W(),[s,l]=C0e();return{getAndLoadWorkflow:i.useCallback(async d=>{try{const f=await s(d).unwrap();n(Dx({workflow:f.workflow,asCopy:!1})),e&&e()}catch{r({title:o("toast.problemRetrievingWorkflow"),status:"error"}),t&&t()}},[s,n,e,r,o,t]),getAndLoadWorkflowResult:l}},oD=()=>{const e=i.useContext(tD);if(!e)throw new Error("useWorkflowLibraryContext must be used within a WorkflowLibraryContext.Provider");return e},I0e=({workflowDTO:e})=>{const{t}=W(),n=H(h=>h.workflow.id),{onClose:r}=oD(),{deleteWorkflow:o,deleteWorkflowResult:s}=j0e({}),{getAndLoadWorkflow:l,getAndLoadWorkflowResult:c}=_0e({onSuccess:r}),d=i.useCallback(()=>{o(e.workflow_id)},[o,e.workflow_id]),f=i.useCallback(()=>{l(e.workflow_id)},[l,e.workflow_id]),m=i.useMemo(()=>n===e.workflow_id,[n,e.workflow_id]);return a.jsx($,{w:"full",children:a.jsxs($,{w:"full",alignItems:"center",gap:2,h:12,children:[a.jsxs($,{flexDir:"column",flexGrow:1,h:"full",children:[a.jsxs($,{alignItems:"center",w:"full",h:"50%",children:[a.jsx(or,{size:"sm",variant:m?"accent":void 0,children:e.name||t("workflows.unnamedWorkflow")}),a.jsx(Wr,{}),e.category==="user"&&a.jsxs(be,{fontSize:"sm",variant:"subtext",children:[t("common.updated"),":"," ",nm(e.updated_at,cc.shortDate)," ",nm(e.updated_at,cc.shortTime)]})]}),a.jsxs($,{alignItems:"center",w:"full",h:"50%",children:[e.description?a.jsx(be,{fontSize:"sm",noOfLines:1,children:e.description}):a.jsx(be,{fontSize:"sm",variant:"subtext",fontStyle:"italic",noOfLines:1,children:t("workflows.noDescription")}),a.jsx(Wr,{}),e.category==="user"&&a.jsxs(be,{fontSize:"sm",variant:"subtext",children:[t("common.created"),":"," ",nm(e.created_at,cc.shortDate)," ",nm(e.created_at,cc.shortTime)]})]})]}),a.jsx(Xe,{isDisabled:m,onClick:f,isLoading:c.isLoading,"aria-label":t("workflows.openWorkflow"),children:t("common.load")}),e.category==="user"&&a.jsx(Xe,{colorScheme:"error",isDisabled:m,onClick:d,isLoading:s.isLoading,"aria-label":t("workflows.deleteWorkflow"),children:t("common.delete")})]})},e.workflow_id)},P0e=i.memo(I0e),Nl=7,E0e=({page:e,setPage:t,data:n})=>{const{t:r}=W(),o=i.useCallback(()=>{t(c=>Math.max(c-1,0))},[t]),s=i.useCallback(()=>{t(c=>Math.min(c+1,n.pages-1))},[n.pages,t]),l=i.useMemo(()=>{const c=[];let d=n.pages>Nl?Math.max(0,e-Math.floor(Nl/2)):0;const f=n.pages>Nl?Math.min(n.pages,d+Nl):n.pages;f-d<Nl&&n.pages>Nl&&(d=f-Nl);for(let m=d;m<f;m++)c.push({page:m,onClick:()=>t(m)});return c},[n.pages,e,t]);return a.jsxs($t,{children:[a.jsx(Fe,{variant:"ghost",onClick:o,isDisabled:e===0,"aria-label":r("common.prevPage"),icon:a.jsx(gte,{})}),l.map(c=>a.jsx(Xe,{w:10,isDisabled:n.pages===1,onClick:c.page===e?void 0:c.onClick,variant:c.page===e?"invokeAI":"ghost",transitionDuration:"0s",children:c.page+1},c.page)),a.jsx(Fe,{variant:"ghost",onClick:s,isDisabled:e===n.pages-1,"aria-label":r("common.nextPage"),icon:a.jsx(vte,{})})]})},M0e=i.memo(E0e),X_=10,O0e=[{value:"opened_at",label:"Opened"},{value:"created_at",label:"Created"},{value:"updated_at",label:"Updated"},{value:"name",label:"Name"}],D0e=[{value:"ASC",label:"Ascending"},{value:"DESC",label:"Descending"}],R0e=()=>{const{t:e}=W(),[t,n]=i.useState("user"),[r,o]=i.useState(0),[s,l]=i.useState(""),[c,d]=i.useState("opened_at"),[f,m]=i.useState("ASC"),[h]=kc(s,500),g=i.useMemo(()=>t==="user"?{page:r,per_page:X_,order_by:c,direction:f,category:t,query:h}:{page:r,per_page:X_,order_by:"name",direction:"ASC",category:t,query:h},[t,h,f,c,r]),{data:b,isLoading:y,isError:x,isFetching:w}=k0e(g),S=i.useCallback(R=>{!R||R===c||(d(R),o(0))},[c]),j=i.useCallback(R=>{!R||R===f||(m(R),o(0))},[f]),_=i.useCallback(()=>{l(""),o(0)},[]),I=i.useCallback(R=>{R.key==="Escape"&&(_(),R.preventDefault(),o(0))},[_]),E=i.useCallback(R=>{l(R.target.value),o(0)},[]),M=i.useCallback(()=>{n("user"),o(0)},[]),D=i.useCallback(()=>{n("default"),o(0)},[]);return a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:4,alignItems:"center",h:10,flexShrink:0,flexGrow:0,children:[a.jsxs($t,{children:[a.jsx(Xe,{variant:t==="user"?void 0:"ghost",onClick:M,isChecked:t==="user",children:e("workflows.userWorkflows")}),a.jsx(Xe,{variant:t==="default"?void 0:"ghost",onClick:D,isChecked:t==="default",children:e("workflows.defaultWorkflows")})]}),a.jsx(Wr,{}),t==="user"&&a.jsxs(a.Fragment,{children:[a.jsx(yn,{label:e("common.orderBy"),value:c,data:O0e,onChange:S,formControlProps:{w:48,display:"flex",alignItems:"center",gap:2},disabled:w}),a.jsx(yn,{label:e("common.direction"),value:f,data:D0e,onChange:j,formControlProps:{w:48,display:"flex",alignItems:"center",gap:2},disabled:w})]}),a.jsxs(cy,{w:"20rem",children:[a.jsx(Qc,{placeholder:e("workflows.searchWorkflows"),value:s,onKeyDown:I,onChange:E,"data-testid":"workflow-search-input"}),s.trim().length&&a.jsx(lg,{children:a.jsx(rs,{onClick:_,size:"xs",variant:"ghost","aria-label":e("workflows.clearWorkflowSearchFilter"),opacity:.5,icon:a.jsx(N8,{boxSize:2})})})]})]}),a.jsx(On,{}),y?a.jsx(U8,{label:e("workflows.loading")}):!b||x?a.jsx(Tn,{label:e("workflows.problemLoading")}):b.items.length?a.jsx(Sl,{children:a.jsx($,{w:"full",h:"full",gap:2,px:1,flexDir:"column",children:b.items.map(R=>a.jsx(P0e,{workflowDTO:R},R.workflow_id))})}):a.jsx(Tn,{label:e("workflows.noUserWorkflows")}),a.jsx(On,{}),b&&a.jsx($,{w:"full",justifyContent:"space-around",children:a.jsx(M0e,{data:b,page:r,setPage:o})})]})},A0e=i.memo(R0e),T0e=e=>a.jsx($,{w:"full",h:"full",flexDir:"column",layerStyle:"second",py:2,px:4,gap:2,borderRadius:"base",children:e.children}),N0e=i.memo(T0e),$0e=()=>a.jsx(N0e,{children:a.jsx(A0e,{})}),L0e=i.memo($0e),F0e=()=>{const{t:e}=W(),{isOpen:t,onClose:n}=oD();return a.jsxs(ni,{isOpen:t,onClose:n,isCentered:!0,children:[a.jsx(Eo,{}),a.jsxs(ri,{w:"80%",h:"80%",minW:"unset",minH:"unset",maxW:"unset",maxH:"unset",children:[a.jsx(Po,{children:e("workflows.workflowLibrary")}),a.jsx(af,{}),a.jsx(Mo,{children:a.jsx(L0e,{})}),a.jsx(ls,{})]})]})},z0e=i.memo(F0e),B0e=()=>{const{t:e}=W(),t=sr();return a.jsxs(tD.Provider,{value:t,children:[a.jsx(Xe,{leftIcon:a.jsx(Dte,{}),onClick:t.onOpen,pointerEvents:"auto",children:e("workflows.workflowLibrary")}),a.jsx(z0e,{})]})},H0e=i.memo(B0e),W0e=()=>{const e=s0();return i.useCallback(()=>{const n=new Blob([JSON.stringify(e,null,2)]),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${e.name||"My Workflow"}.json`,document.body.appendChild(r),r.click(),r.remove()},[e])},V0e=()=>{const{t:e}=W(),t=W0e();return a.jsx(At,{as:"button",icon:a.jsx(ou,{}),onClick:t,children:e("workflows.downloadWorkflow")})},U0e=i.memo(V0e),G0e=()=>{const{t:e}=W(),t=te(),{isOpen:n,onOpen:r,onClose:o}=sr(),s=i.useRef(null),l=H(f=>f.workflow.isTouched),c=i.useCallback(()=>{t(BN()),t(lt(rn({title:e("workflows.newWorkflowCreated"),status:"success"}))),o()},[t,o,e]),d=i.useCallback(()=>{if(!l){c();return}r()},[c,l,r]);return a.jsxs(a.Fragment,{children:[a.jsx(At,{as:"button",icon:a.jsx(e0,{}),onClick:d,children:e("nodes.newWorkflow")}),a.jsxs(Zc,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Eo,{}),a.jsxs(Jc,{children:[a.jsx(Po,{fontSize:"lg",fontWeight:"bold",children:e("nodes.newWorkflow")}),a.jsx(Mo,{py:4,children:a.jsxs($,{flexDir:"column",gap:2,children:[a.jsx(be,{children:e("nodes.newWorkflowDesc")}),a.jsx(be,{variant:"subtext",children:e("nodes.newWorkflowDesc2")})]})}),a.jsxs(ls,{children:[a.jsx(ol,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(ol,{colorScheme:"error",ml:3,onClick:c,children:e("common.accept")})]})]})]})]})},K0e=i.memo(G0e),q0e=()=>{const{t:e}=W(),t=te(),n=s0(),[r,o]=rD(),s=tg(),l=i.useRef();return{saveWorkflowAs:i.useCallback(async({name:d,onSuccess:f,onError:m})=>{l.current=s({title:e("workflows.savingWorkflow"),status:"loading",duration:null,isClosable:!1});try{n.id=void 0,n.name=d;const h=await r(n).unwrap();t(g3(h.workflow.id)),t(XI(h.workflow.name)),t(v3()),f&&f(),s.update(l.current,{title:e("workflows.workflowSaved"),status:"success",duration:1e3,isClosable:!0})}catch{m&&m(),s.update(l.current,{title:e("workflows.problemSavingWorkflow"),status:"error",duration:1e3,isClosable:!0})}},[s,n,r,t,e]),isLoading:o.isLoading,isError:o.isError}},Q_=e=>`${e.trim()} (copy)`,X0e=()=>{const e=H(g=>g.workflow.name),{t}=W(),{saveWorkflowAs:n}=q0e(),[r,o]=i.useState(Q_(e)),{isOpen:s,onOpen:l,onClose:c}=sr(),d=i.useRef(null),f=i.useCallback(()=>{o(Q_(e)),l()},[e,l]),m=i.useCallback(async()=>{n({name:r,onSuccess:c,onError:c})},[r,c,n]),h=i.useCallback(g=>{o(g.target.value)},[]);return a.jsxs(a.Fragment,{children:[a.jsx(At,{as:"button",icon:a.jsx(xte,{}),onClick:f,children:t("workflows.saveWorkflowAs")}),a.jsx(Zc,{isOpen:s,onClose:c,leastDestructiveRef:d,isCentered:!0,children:a.jsx(Eo,{children:a.jsxs(Jc,{children:[a.jsx(Po,{fontSize:"lg",fontWeight:"bold",children:t("workflows.saveWorkflowAs")}),a.jsx(Mo,{children:a.jsxs(Gt,{children:[a.jsx(ln,{children:t("workflows.workflowName")}),a.jsx(Qc,{ref:d,value:r,onChange:h,placeholder:t("workflows.workflowName")})]})}),a.jsxs(ls,{children:[a.jsx(Xe,{onClick:c,children:t("common.cancel")}),a.jsx(Xe,{colorScheme:"accent",onClick:m,ml:3,children:t("common.saveAs")})]})]})})})]})},Q0e=i.memo(X0e),Y0e=e=>!!e.id,Z0e=()=>{const{t:e}=W(),t=te(),n=s0(),[r,o]=S0e(),[s,l]=rD(),c=tg(),d=i.useRef();return{saveWorkflow:i.useCallback(async()=>{d.current=c({title:e("workflows.savingWorkflow"),status:"loading",duration:null,isClosable:!1});try{if(Y0e(n))await r(n).unwrap();else{const m=await s(n).unwrap();t(g3(m.workflow.id))}t(v3()),c.update(d.current,{title:e("workflows.workflowSaved"),status:"success",duration:1e3,isClosable:!0})}catch{c.update(d.current,{title:e("workflows.problemSavingWorkflow"),status:"error",duration:1e3,isClosable:!0})}},[n,r,t,c,e,s]),isLoading:o.isLoading||l.isLoading,isError:o.isError||l.isError}},J0e=()=>{const{t:e}=W(),{saveWorkflow:t}=Z0e();return a.jsx(At,{as:"button",icon:a.jsx(gf,{}),onClick:t,children:e("workflows.saveWorkflow")})},eve=i.memo(J0e),tve=()=>{const{t:e}=W(),t=te(),n=i.useCallback(()=>{t(HN())},[t]);return a.jsx(Xe,{leftIcon:a.jsx(qte,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},nve=i.memo(tve),Uu={fontWeight:600},rve=fe(pe,({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===WN.Full}}),ove=({children:e})=>{const{isOpen:t,onOpen:n,onClose:r}=sr(),o=te(),{shouldAnimateEdges:s,shouldValidateGraph:l,shouldSnapToGrid:c,shouldColorEdges:d,selectionModeIsChecked:f}=H(rve),m=i.useCallback(w=>{o(VN(w.target.checked))},[o]),h=i.useCallback(w=>{o(UN(w.target.checked))},[o]),g=i.useCallback(w=>{o(GN(w.target.checked))},[o]),b=i.useCallback(w=>{o(KN(w.target.checked))},[o]),y=i.useCallback(w=>{o(qN(w.target.checked))},[o]),{t:x}=W();return a.jsxs(a.Fragment,{children:[e({onOpen:n}),a.jsxs(ni,{isOpen:t,onClose:r,size:"2xl",isCentered:!0,children:[a.jsx(Eo,{}),a.jsxs(ri,{children:[a.jsx(Po,{children:x("nodes.workflowSettings")}),a.jsx(af,{}),a.jsx(Mo,{children:a.jsxs($,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(or,{size:"sm",children:x("parameters.general")}),a.jsx(_n,{formLabelProps:Uu,onChange:h,isChecked:s,label:x("nodes.animatedEdges"),helperText:x("nodes.animatedEdgesHelp")}),a.jsx(On,{}),a.jsx(_n,{formLabelProps:Uu,isChecked:c,onChange:g,label:x("nodes.snapToGrid"),helperText:x("nodes.snapToGridHelp")}),a.jsx(On,{}),a.jsx(_n,{formLabelProps:Uu,isChecked:d,onChange:b,label:x("nodes.colorCodeEdges"),helperText:x("nodes.colorCodeEdgesHelp")}),a.jsx(On,{}),a.jsx(_n,{formLabelProps:Uu,isChecked:f,onChange:y,label:x("nodes.fullyContainNodes"),helperText:x("nodes.fullyContainNodesHelp")}),a.jsx(or,{size:"sm",pt:4,children:x("common.advanced")}),a.jsx(_n,{formLabelProps:Uu,isChecked:l,onChange:m,label:x("nodes.validateConnections"),helperText:x("nodes.validateConnectionsHelp")}),a.jsx(nve,{})]})})]})]})]})},sve=i.memo(ove),ave=()=>{const{t:e}=W();return a.jsx(sve,{children:({onOpen:t})=>a.jsx(At,{as:"button",icon:a.jsx(FM,{}),onClick:t,children:e("nodes.workflowSettings")})})},lve=i.memo(ave),ive=({resetRef:e})=>{const t=te(),n=H6("nodes"),{t:r}=W();return i.useCallback(s=>{var c;if(!s)return;const l=new FileReader;l.onload=async()=>{const d=l.result;try{const f=JSON.parse(String(d));t(Dx({workflow:f,asCopy:!0}))}catch{n.error(r("nodes.unableToLoadWorkflow")),t(lt(rn({title:r("nodes.unableToLoadWorkflow"),status:"error"}))),l.abort()}},l.readAsText(s),(c=e.current)==null||c.call(e)},[t,n,e,r])},cve=()=>{const{t:e}=W(),t=i.useRef(null),n=ive({resetRef:t});return a.jsx(uM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(At,{as:"button",icon:a.jsx($g,{}),...r,children:e("workflows.uploadWorkflow")})})},uve=i.memo(cve),dve=()=>{const{t:e}=W(),{isOpen:t,onOpen:n,onClose:r}=sr();Yy(r);const o=Mt("workflowLibrary").isFeatureEnabled;return a.jsxs(of,{isOpen:t,onOpen:n,onClose:r,children:[a.jsx(sf,{as:Fe,"aria-label":e("workflows.workflowEditorMenu"),icon:a.jsx(P7,{}),pointerEvents:"auto"}),a.jsxs(al,{motionProps:Yl,pointerEvents:"auto",children:[o&&a.jsx(eve,{}),o&&a.jsx(Q0e,{}),a.jsx(U0e,{}),a.jsx(uve,{}),a.jsx(K0e,{}),a.jsx(n6,{}),a.jsx(lve,{})]})]})},fve=i.memo(dve),pve=()=>{const e=Mt("workflowLibrary").isFeatureEnabled;return a.jsxs($,{sx:{gap:2,top:2,left:2,right:2,position:"absolute",alignItems:"center",pointerEvents:"none"},children:[a.jsx(i0e,{}),a.jsx(f0e,{}),a.jsx(Wr,{}),a.jsx(m0e,{}),a.jsx(Wr,{}),e&&a.jsx(H0e,{}),a.jsx(fve,{})]})},mve=i.memo(pve),hve=()=>{const e=H(n=>n.nodes.isReady),{t}=W();return a.jsxs($,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(hr,{children:e&&a.jsxs(Mn.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(Zge,{}),a.jsx(The,{}),a.jsx(mve,{}),a.jsx(r0e,{}),a.jsx(a0e,{})]})}),a.jsx(hr,{children:!e&&a.jsx(Mn.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($,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(Tn,{label:t("nodes.loadingNodes"),icon:Yse})})})})]})},gve=i.memo(hve),vve=()=>a.jsx(XN,{children:a.jsx(gve,{})}),bve=i.memo(vve),xve=()=>{const{t:e}=W(),t=te(),{data:n}=Gd(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=QN({fixedCacheKey:"clearInvocationCache"}),l=i.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:i.useCallback(async()=>{if(!l)try{await o().unwrap(),t(lt({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(lt({title:e("invocationCache.clearFailed"),status:"error"}))}},[l,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:l}},yve=()=>{const{t:e}=W(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=xve();return a.jsx(Xe,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},Cve=i.memo(yve),wve=()=>{const{t:e}=W(),t=te(),{data:n}=Gd(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=YN({fixedCacheKey:"disableInvocationCache"}),l=i.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:i.useCallback(async()=>{if(!l)try{await o().unwrap(),t(lt({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(lt({title:e("invocationCache.disableFailed"),status:"error"}))}},[l,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:l}},Sve=()=>{const{t:e}=W(),t=te(),{data:n}=Gd(),r=H(d=>d.system.isConnected),[o,{isLoading:s}]=ZN({fixedCacheKey:"enableInvocationCache"}),l=i.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:i.useCallback(async()=>{if(!l)try{await o().unwrap(),t(lt({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(lt({title:e("invocationCache.enableFailed"),status:"error"}))}},[l,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:l}},kve=()=>{const{t:e}=W(),{data:t}=Gd(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Sve(),{disableInvocationCache:s,isDisabled:l,isLoading:c}=wve();return t!=null&&t.enabled?a.jsx(Xe,{isDisabled:l,isLoading:c,onClick:s,children:e("invocationCache.disable")}):a.jsx(Xe,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},jve=i.memo(kve),_ve=({children:e,...t})=>a.jsx(N6,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),sD=i.memo(_ve),Ive={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},Pve=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(T6,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Ive,...r,children:[a.jsx($6,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(L6,{children:t})]}),Cs=i.memo(Pve),Eve=()=>{const{t:e}=W(),{data:t}=Gd(void 0);return a.jsxs(sD,{children:[a.jsx(Cs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(Cs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(Cs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(Cs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs($t,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(Cve,{}),a.jsx(jve,{})]})]})},Mve=i.memo(Eve),aD=e=>{const t=H(c=>c.system.isConnected),[n,{isLoading:r}]=Rx(),o=te(),{t:s}=W();return{cancelQueueItem:i.useCallback(async()=>{try{await n(e).unwrap(),o(lt({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(lt({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},lD=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),Y_={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"}},Ove=({status:e})=>{const{t}=W();return a.jsx(Sa,{colorScheme:Y_[e].colorScheme,children:t(Y_[e].translationKey)})},Dve=i.memo(Ove),Rve=e=>{const t=H(d=>d.system.isConnected),{isCanceled:n}=JN({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}]=e$({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:l}=W();return{cancelBatch:i.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(lt({title:l("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(lt({title:l("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,l,r]),isLoading:o,isCanceled:n,isDisabled:!t}},Ave=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=W(),{cancelBatch:s,isLoading:l,isCanceled:c}=Rve(n),{cancelQueueItem:d,isLoading:f}=aD(r),{data:m}=t$(r),h=i.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=lD(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs($,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs($,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(rm,{label:o("queue.status"),data:h}),a.jsx(rm,{label:o("queue.item"),data:r}),a.jsx(rm,{label:o("queue.batch"),data:n}),a.jsx(rm,{label:o("queue.session"),data:t}),a.jsxs($t,{size:"xs",orientation:"vertical",children:[a.jsx(Xe,{onClick:d,isLoading:f,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(Nc,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Xe,{onClick:s,isLoading:l,isDisabled:c,"aria-label":o("queue.cancelBatch"),icon:a.jsx(Nc,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs($,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(or,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:o("common.error")}),a.jsx("pre",{children:m.error})]}),a.jsx($,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Sl,{children:a.jsx(pl,{label:"Queue Item",data:m})}):a.jsx(va,{opacity:.5})})]})},Tve=i.memo(Ave),rm=({label:e,data:t})=>a.jsxs($,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(or,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(be,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),Ss={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},Z_={bg:"base.300",_dark:{bg:"base.750"}},Nve={_hover:Z_,"&[aria-selected='true']":Z_},$ve=({index:e,item:t,context:n})=>{const{t:r}=W(),o=i.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:l}=aD(t.item_id),c=i.useCallback(h=>{h.stopPropagation(),s()},[s]),d=i.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),f=i.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${lD(t.started_at,t.completed_at)}s`,[t]),m=i.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs($,{flexDir:"column","aria-selected":d,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Nve,"data-testid":"queue-item",children:[a.jsxs($,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx($,{w:Ss.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(be,{variant:"subtext",children:e+1})}),a.jsx($,{w:Ss.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Dve,{status:t.status})}),a.jsx($,{w:Ss.time,alignItems:"center",flexShrink:0,children:f||"-"}),a.jsx($,{w:Ss.batchId,flexShrink:0,children:a.jsx(be,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx($,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx($,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:b})=>a.jsxs(be,{as:"span",children:[a.jsxs(be,{as:"span",fontWeight:600,children:[h,".",g]}),": ",b]},`${t.item_id}.${h}.${g}.${b}`))})}),a.jsx($,{alignItems:"center",w:Ss.actions,pe:3,children:a.jsx($t,{size:"xs",variant:"ghost",children:a.jsx(Fe,{onClick:c,isDisabled:m,isLoading:l,"aria-label":r("queue.cancelItem"),icon:a.jsx(Nc,{})})})})]}),a.jsx(Xd,{in:d,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Tve,{queueItemDTO:t})})]})},Lve=i.memo($ve),Fve=i.memo(_e((e,t)=>a.jsx($,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),zve=i.memo(Fve),Bve=()=>{const{t:e}=W();return a.jsxs($,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx($,{w:Ss.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(be,{variant:"subtext",children:"#"})}),a.jsx($,{ps:.5,w:Ss.statusBadge,alignItems:"center",children:a.jsx(be,{variant:"subtext",children:e("queue.status")})}),a.jsx($,{ps:.5,w:Ss.time,alignItems:"center",children:a.jsx(be,{variant:"subtext",children:e("queue.time")})}),a.jsx($,{ps:.5,w:Ss.batchId,alignItems:"center",children:a.jsx(be,{variant:"subtext",children:e("queue.batch")})}),a.jsx($,{ps:.5,w:Ss.fieldValues,alignItems:"center",children:a.jsx(be,{variant:"subtext",children:e("queue.batchFieldValues")})})]})},Hve=i.memo(Bve),Wve={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Vve=fe(pe,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}}),Uve=(e,t)=>t.item_id,Gve={List:zve},Kve=(e,t,n)=>a.jsx(Lve,{index:e,item:t,context:n}),qve=()=>{const{listCursor:e,listPriority:t}=H(Vve),n=te(),r=i.useRef(null),[o,s]=i.useState(null),[l,c]=c2(Wve),{t:d}=W();i.useEffect(()=>{const{current:S}=r;return o&&S&&l({target:S,elements:{viewport:o}}),()=>{var j;return(j=c())==null?void 0:j.destroy()}},[o,l,c]);const{data:f,isLoading:m}=n$({cursor:e,priority:t}),h=i.useMemo(()=>f?r$.getSelectors().selectAll(f):[],[f]),g=i.useCallback(()=>{if(!(f!=null&&f.has_more))return;const S=h[h.length-1];S&&(n(Ax(S.item_id)),n(Tx(S.priority)))},[n,f==null?void 0:f.has_more,h]),[b,y]=i.useState([]),x=i.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),w=i.useMemo(()=>({openQueueItems:b,toggleQueueItem:x}),[b,x]);return m?a.jsx(U8,{}):h.length?a.jsxs($,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Hve,{}),a.jsx($,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(Ose,{data:h,endReached:g,scrollerRef:s,itemContent:Kve,computeItemKey:Uve,components:Gve,context:w})})]}):a.jsx($,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(or,{color:"base.400",_dark:{color:"base.500"},children:d("queue.queueEmpty")})})},Xve=i.memo(qve),Qve=()=>{const{data:e}=Ls(),{t}=W();return a.jsxs(sD,{"data-testid":"queue-status",children:[a.jsx(Cs,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(Cs,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(Cs,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(Cs,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(Cs,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(Cs,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},Yve=i.memo(Qve);function Zve(e){return De({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 Jve=()=>{const e=te(),{t}=W(),n=H(d=>d.system.isConnected),[r,{isLoading:o}]=r3({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Ls(void 0,{selectFromResult:({data:d})=>d?{finishedCount:d.queue.completed+d.queue.canceled+d.queue.failed}:{finishedCount:0}}),l=i.useCallback(async()=>{if(s)try{const d=await r().unwrap();e(lt({title:t("queue.pruneSucceeded",{item_count:d.deleted}),status:"success"})),e(Ax(void 0)),e(Tx(void 0))}catch{e(lt({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),c=i.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:l,isLoading:o,finishedCount:s,isDisabled:c}},e1e=({asIconButton:e})=>{const{t}=W(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=Jve();return a.jsx(gi,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(Zve,{}),onClick:n,colorScheme:"blue"})},t1e=i.memo(e1e),n1e=()=>{const e=Mt("pauseQueue").isFeatureEnabled,t=Mt("resumeQueue").isFeatureEnabled;return a.jsxs($,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs($t,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(F7,{}):a.jsx(a.Fragment,{}),e?a.jsx(R7,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs($t,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(t1e,{}),a.jsx(P2,{})]})]})},r1e=i.memo(n1e),o1e=()=>{const e=Mt("invocationCache").isFeatureEnabled;return a.jsxs($,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs($,{gap:2,w:"full",children:[a.jsx(r1e,{}),a.jsx(Yve,{}),e&&a.jsx(Mve,{})]}),a.jsx(Ie,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(Xve,{})})]})},s1e=i.memo(o1e),a1e=()=>a.jsx(s1e,{}),l1e=i.memo(a1e),i1e=()=>a.jsx(zO,{}),c1e=i.memo(i1e),u1e=fe([pe,Lo],({canvas:e},t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}}),d1e=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=H(u1e);return{handleDragStart:i.useCallback(()=>{(t==="move"||n)&&!r&&e(Em(!0))},[e,r,n,t]),handleDragMove:i.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(b3(s))},[e,r,n,t]),handleDragEnd:i.useCallback(()=>{(t==="move"||n)&&!r&&e(Em(!1))},[e,r,n,t])}},f1e=fe([pe,tr,Lo],({canvas:e},t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:l,isMaskEnabled:c,shouldSnapToGrid:d}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:l,isStaging:n,isMaskEnabled:c,shouldSnapToGrid:d}}),p1e=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:l}=H(f1e),c=i.useRef(null),d=x3(),f=()=>e(y3());tt(["shift+c"],()=>{f()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(Wx(!s));tt(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),tt(["n"],()=>{e(Mm(!l))},{enabled:!0,preventDefault:!0},[l]),tt("esc",()=>{e(o$())},{enabled:()=>!0,preventDefault:!0}),tt("shift+h",()=>{e(s$(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),tt(["space"],h=>{h.repeat||(d==null||d.container().focus(),r!=="move"&&(c.current=r,e(fc("move"))),r==="move"&&c.current&&c.current!=="move"&&(e(fc(c.current)),c.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,c])},q2=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}},iD=()=>{const e=te(),t=G1(),n=x3();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=a$.pixelRatio,[s,l,c,d]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||l===void 0||c===void 0||d===void 0||e(l$({r:s,g:l,b:c,a:d}))},commitColorUnderCursor:()=>{e(i$())}}},m1e=fe([tr,pe,Lo],(e,{canvas:t},n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}}),h1e=e=>{const t=te(),{tool:n,isStaging:r}=H(m1e),{commitColorUnderCursor:o}=iD();return i.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Em(!0));return}if(n==="colorPicker"){o();return}const l=q2(e.current);l&&(s.evt.preventDefault(),t(C3(!0)),t(c$([l.x,l.y])))},[e,n,r,t,o])},g1e=fe([tr,pe,Lo],(e,{canvas:t},n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}}),v1e=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:l}=H(g1e),{updateColorUnderCursor:c}=iD();return i.useCallback(()=>{if(!e.current)return;const d=q2(e.current);if(d){if(r(u$(d)),n.current=d,s==="colorPicker"){c();return}!o||s==="move"||l||(t.current=!0,r(w3([d.x,d.y])))}},[t,r,o,l,n,e,s,c])},b1e=()=>{const e=te();return i.useCallback(()=>{e(d$())},[e])},x1e=fe([tr,pe,Lo],(e,{canvas:t},n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}}),y1e=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=H(x1e);return i.useCallback(()=>{if(r==="move"||s){n(Em(!1));return}if(!t.current&&o&&e.current){const l=q2(e.current);if(!l)return;n(w3([l.x,l.y]))}else t.current=!1;n(C3(!1))},[t,n,o,s,e,r])},C1e=fe([pe],({canvas:e})=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}}),w1e=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=H(C1e);return i.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const l={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=Zl(r*m$**c,p$,f$),f={x:s.x-l.x*d,y:s.y-l.y*d};t(h$(d)),t(b3(f))},[e,n,r,t])};var dx={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=mS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=mS;e.exports=r.Konva})(dx,dx.exports);var S1e=dx.exports;const Fd=Bd(S1e);var cD={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 k1e=function(t){var n={},r=i,o=sm,s=Object.assign;function l(u){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v]);return"Minified React error #"+u+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,d=Symbol.for("react.element"),f=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),y=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),E=Symbol.iterator;function M(u){return u===null||typeof u!="object"?null:(u=E&&u[E]||u["@@iterator"],typeof u=="function"?u:null)}function D(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case m:return"Fragment";case f:return"Portal";case g:return"Profiler";case h:return"StrictMode";case w:return"Suspense";case S:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case y:return(u.displayName||"Context")+".Consumer";case b:return(u._context.displayName||"Context")+".Provider";case x:var p=u.render;return u=u.displayName,u||(u=p.displayName||p.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case j:return p=u.displayName||null,p!==null?p:D(u.type)||"Memo";case _:p=u._payload,u=u._init;try{return D(u(p))}catch{}}return null}function R(u){var p=u.type;switch(u.tag){case 24:return"Cache";case 9:return(p.displayName||"Context")+".Consumer";case 10:return(p._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=p.render,u=u.displayName||u.name||"",p.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(p);case 8:return p===h?"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 p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p}return null}function N(u){var p=u,v=u;if(u.alternate)for(;p.return;)p=p.return;else{u=p;do p=u,p.flags&4098&&(v=p.return),u=p.return;while(u)}return p.tag===3?v:null}function O(u){if(N(u)!==u)throw Error(l(188))}function T(u){var p=u.alternate;if(!p){if(p=N(u),p===null)throw Error(l(188));return p!==u?null:u}for(var v=u,C=p;;){var k=v.return;if(k===null)break;var P=k.alternate;if(P===null){if(C=k.return,C!==null){v=C;continue}break}if(k.child===P.child){for(P=k.child;P;){if(P===v)return O(k),u;if(P===C)return O(k),p;P=P.sibling}throw Error(l(188))}if(v.return!==C.return)v=k,C=P;else{for(var F=!1,ie=k.child;ie;){if(ie===v){F=!0,v=k,C=P;break}if(ie===C){F=!0,C=k,v=P;break}ie=ie.sibling}if(!F){for(ie=P.child;ie;){if(ie===v){F=!0,v=P,C=k;break}if(ie===C){F=!0,C=P,v=k;break}ie=ie.sibling}if(!F)throw Error(l(189))}}if(v.alternate!==C)throw Error(l(190))}if(v.tag!==3)throw Error(l(188));return v.stateNode.current===v?u:p}function U(u){return u=T(u),u!==null?G(u):null}function G(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){var p=G(u);if(p!==null)return p;u=u.sibling}return null}function q(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){if(u.tag!==4){var p=q(u);if(p!==null)return p}u=u.sibling}return null}var Y=Array.isArray,Q=t.getPublicInstance,V=t.getRootHostContext,se=t.getChildHostContext,ee=t.prepareForCommit,le=t.resetAfterCommit,ae=t.createInstance,ce=t.appendInitialChild,J=t.finalizeInitialChildren,re=t.prepareUpdate,A=t.shouldSetTextContent,L=t.createTextInstance,K=t.scheduleTimeout,ne=t.cancelTimeout,z=t.noTimeout,oe=t.isPrimaryRenderer,X=t.supportsMutation,Z=t.supportsPersistence,me=t.supportsHydration,ve=t.getInstanceFromNode,de=t.preparePortalMount,ke=t.getCurrentEventPriority,we=t.detachDeletedInstance,Re=t.supportsMicrotasks,Qe=t.scheduleMicrotask,$e=t.supportsTestSelectors,vt=t.findFiberRoot,it=t.getBoundingRect,ot=t.getTextContent,Ce=t.isHiddenSubtree,Me=t.matchAccessibilityRole,qe=t.setFocusIfFocusable,dt=t.setupIntersectionObserver,ye=t.appendChild,Ue=t.appendChildToContainer,st=t.commitTextUpdate,mt=t.commitMount,Pe=t.commitUpdate,Ne=t.insertBefore,kt=t.insertInContainerBefore,Se=t.removeChild,Ve=t.removeChildFromContainer,Ge=t.resetTextContent,Le=t.hideInstance,bt=t.hideTextInstance,fn=t.unhideInstance,Bt=t.unhideTextInstance,Ht=t.clearContainer,zn=t.cloneInstance,pn=t.createContainerChildSet,en=t.appendChildToContainerChildSet,un=t.finalizeContainerChildren,Wt=t.replaceContainerChildren,ar=t.cloneHiddenInstance,vr=t.cloneHiddenTextInstance,Bn=t.canHydrateInstance,Hn=t.canHydrateTextInstance,lo=t.canHydrateSuspenseInstance,Fo=t.isSuspenseInstancePending,zo=t.isSuspenseInstanceFallback,Ia=t.getSuspenseInstanceFallbackErrorDetails,xi=t.registerSuspenseInstanceRetry,Pa=t.getNextHydratableSibling,yi=t.getFirstHydratableChild,Je=t.getFirstHydratableChildWithinContainer,qt=t.getFirstHydratableChildWithinSuspenseInstance,Wn=t.hydrateInstance,jt=t.hydrateTextInstance,Ea=t.hydrateSuspenseInstance,qr=t.getNextHydratableInstanceAfterSuspenseInstance,jf=t.commitHydratedContainer,h0=t.commitHydratedSuspenseInstance,g0=t.clearSuspenseBoundary,Vn=t.clearSuspenseBoundaryFromContainer,Hs=t.shouldDeleteUnhydratedTailInstances,_f=t.didNotMatchHydratedContainerTextInstance,Ci=t.didNotMatchHydratedTextInstance,mu;function _l(u){if(mu===void 0)try{throw Error()}catch(v){var p=v.stack.trim().match(/\n( *(at )?)/);mu=p&&p[1]||""}return`
`+mu+u}var hu=!1;function gu(u,p){if(!u||hu)return"";hu=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(p)if(p=function(){throw Error()},Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(Oe){var C=Oe}Reflect.construct(u,[],p)}else{try{p.call()}catch(Oe){C=Oe}u.call(p.prototype)}else{try{throw Error()}catch(Oe){C=Oe}u()}}catch(Oe){if(Oe&&C&&typeof Oe.stack=="string"){for(var k=Oe.stack.split(`
`),P=C.stack.split(`
`),F=k.length-1,ie=P.length-1;1<=F&&0<=ie&&k[F]!==P[ie];)ie--;for(;1<=F&&0<=ie;F--,ie--)if(k[F]!==P[ie]){if(F!==1||ie!==1)do if(F--,ie--,0>ie||k[F]!==P[ie]){var ge=`
`+k[F].replace(" at new "," at ");return u.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",u.displayName)),ge}while(1<=F&&0<=ie);break}}}finally{hu=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?_l(u):""}var v0=Object.prototype.hasOwnProperty,Ma=[],rt=-1;function Dt(u){return{current:u}}function _t(u){0>rt||(u.current=Ma[rt],Ma[rt]=null,rt--)}function Rt(u,p){rt++,Ma[rt]=u.current,u.current=p}var lr={},an=Dt(lr),$n=Dt(!1),br=lr;function wi(u,p){var v=u.type.contextTypes;if(!v)return lr;var C=u.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===p)return C.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in v)k[P]=p[P];return C&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=p,u.__reactInternalMemoizedMaskedChildContext=k),k}function Pr(u){return u=u.childContextTypes,u!=null}function If(){_t($n),_t(an)}function Y2(u,p,v){if(an.current!==lr)throw Error(l(168));Rt(an,p),Rt($n,v)}function Z2(u,p,v){var C=u.stateNode;if(p=p.childContextTypes,typeof C.getChildContext!="function")return v;C=C.getChildContext();for(var k in C)if(!(k in p))throw Error(l(108,R(u)||"Unknown",k));return s({},v,C)}function Pf(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||lr,br=an.current,Rt(an,u),Rt($n,$n.current),!0}function J2(u,p,v){var C=u.stateNode;if(!C)throw Error(l(169));v?(u=Z2(u,p,br),C.__reactInternalMemoizedMergedChildContext=u,_t($n),_t(an),Rt(an,u)):_t($n),Rt($n,v)}var Bo=Math.clz32?Math.clz32:SD,CD=Math.log,wD=Math.LN2;function SD(u){return u>>>=0,u===0?32:31-(CD(u)/wD|0)|0}var Ef=64,Mf=4194304;function vu(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 Of(u,p){var v=u.pendingLanes;if(v===0)return 0;var C=0,k=u.suspendedLanes,P=u.pingedLanes,F=v&268435455;if(F!==0){var ie=F&~k;ie!==0?C=vu(ie):(P&=F,P!==0&&(C=vu(P)))}else F=v&~k,F!==0?C=vu(F):P!==0&&(C=vu(P));if(C===0)return 0;if(p!==0&&p!==C&&!(p&k)&&(k=C&-C,P=p&-p,k>=P||k===16&&(P&4194240)!==0))return p;if(C&4&&(C|=v&16),p=u.entangledLanes,p!==0)for(u=u.entanglements,p&=C;0<p;)v=31-Bo(p),k=1<<v,C|=u[v],p&=~k;return C}function kD(u,p){switch(u){case 1:case 2:case 4:return p+250;case 8:case 16:case 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 p+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jD(u,p){for(var v=u.suspendedLanes,C=u.pingedLanes,k=u.expirationTimes,P=u.pendingLanes;0<P;){var F=31-Bo(P),ie=1<<F,ge=k[F];ge===-1?(!(ie&v)||ie&C)&&(k[F]=kD(ie,p)):ge<=p&&(u.expiredLanes|=ie),P&=~ie}}function b0(u){return u=u.pendingLanes&-1073741825,u!==0?u:u&1073741824?1073741824:0}function eC(){var u=Ef;return Ef<<=1,!(Ef&4194240)&&(Ef=64),u}function x0(u){for(var p=[],v=0;31>v;v++)p.push(u);return p}function bu(u,p,v){u.pendingLanes|=p,p!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,p=31-Bo(p),u[p]=v}function _D(u,p){var v=u.pendingLanes&~p;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=p,u.mutableReadLanes&=p,u.entangledLanes&=p,p=u.entanglements;var C=u.eventTimes;for(u=u.expirationTimes;0<v;){var k=31-Bo(v),P=1<<k;p[k]=0,C[k]=-1,u[k]=-1,v&=~P}}function y0(u,p){var v=u.entangledLanes|=p;for(u=u.entanglements;v;){var C=31-Bo(v),k=1<<C;k&p|u[C]&p&&(u[C]|=p),v&=~k}}var Lt=0;function tC(u){return u&=-u,1<u?4<u?u&268435455?16:536870912:4:1}var C0=o.unstable_scheduleCallback,nC=o.unstable_cancelCallback,ID=o.unstable_shouldYield,PD=o.unstable_requestPaint,Qn=o.unstable_now,w0=o.unstable_ImmediatePriority,ED=o.unstable_UserBlockingPriority,S0=o.unstable_NormalPriority,MD=o.unstable_IdlePriority,Df=null,fs=null;function OD(u){if(fs&&typeof fs.onCommitFiberRoot=="function")try{fs.onCommitFiberRoot(Df,u,void 0,(u.current.flags&128)===128)}catch{}}function DD(u,p){return u===p&&(u!==0||1/u===1/p)||u!==u&&p!==p}var Ho=typeof Object.is=="function"?Object.is:DD,Ws=null,Rf=!1,k0=!1;function rC(u){Ws===null?Ws=[u]:Ws.push(u)}function RD(u){Rf=!0,rC(u)}function ps(){if(!k0&&Ws!==null){k0=!0;var u=0,p=Lt;try{var v=Ws;for(Lt=1;u<v.length;u++){var C=v[u];do C=C(!0);while(C!==null)}Ws=null,Rf=!1}catch(k){throw Ws!==null&&(Ws=Ws.slice(u+1)),C0(w0,ps),k}finally{Lt=p,k0=!1}}return null}var Si=[],ki=0,Af=null,Tf=0,io=[],co=0,Il=null,Vs=1,Us="";function Pl(u,p){Si[ki++]=Tf,Si[ki++]=Af,Af=u,Tf=p}function oC(u,p,v){io[co++]=Vs,io[co++]=Us,io[co++]=Il,Il=u;var C=Vs;u=Us;var k=32-Bo(C)-1;C&=~(1<<k),v+=1;var P=32-Bo(p)+k;if(30<P){var F=k-k%5;P=(C&(1<<F)-1).toString(32),C>>=F,k-=F,Vs=1<<32-Bo(p)+k|v<<k|C,Us=P+u}else Vs=1<<P|v<<k|C,Us=u}function j0(u){u.return!==null&&(Pl(u,1),oC(u,1,0))}function _0(u){for(;u===Af;)Af=Si[--ki],Si[ki]=null,Tf=Si[--ki],Si[ki]=null;for(;u===Il;)Il=io[--co],io[co]=null,Us=io[--co],io[co]=null,Vs=io[--co],io[co]=null}var Xr=null,uo=null,mn=!1,xu=!1,Wo=null;function sC(u,p){var v=go(5,null,null,0);v.elementType="DELETED",v.stateNode=p,v.return=u,p=u.deletions,p===null?(u.deletions=[v],u.flags|=16):p.push(v)}function aC(u,p){switch(u.tag){case 5:return p=Bn(p,u.type,u.pendingProps),p!==null?(u.stateNode=p,Xr=u,uo=yi(p),!0):!1;case 6:return p=Hn(p,u.pendingProps),p!==null?(u.stateNode=p,Xr=u,uo=null,!0):!1;case 13:if(p=lo(p),p!==null){var v=Il!==null?{id:Vs,overflow:Us}:null;return u.memoizedState={dehydrated:p,treeContext:v,retryLane:1073741824},v=go(18,null,null,0),v.stateNode=p,v.return=u,u.child=v,Xr=u,uo=null,!0}return!1;default:return!1}}function I0(u){return(u.mode&1)!==0&&(u.flags&128)===0}function P0(u){if(mn){var p=uo;if(p){var v=p;if(!aC(u,p)){if(I0(u))throw Error(l(418));p=Pa(v);var C=Xr;p&&aC(u,p)?sC(C,v):(u.flags=u.flags&-4097|2,mn=!1,Xr=u)}}else{if(I0(u))throw Error(l(418));u.flags=u.flags&-4097|2,mn=!1,Xr=u}}}function lC(u){for(u=u.return;u!==null&&u.tag!==5&&u.tag!==3&&u.tag!==13;)u=u.return;Xr=u}function Nf(u){if(!me||u!==Xr)return!1;if(!mn)return lC(u),mn=!0,!1;if(u.tag!==3&&(u.tag!==5||Hs(u.type)&&!A(u.type,u.memoizedProps))){var p=uo;if(p){if(I0(u))throw iC(),Error(l(418));for(;p;)sC(u,p),p=Pa(p)}}if(lC(u),u.tag===13){if(!me)throw Error(l(316));if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));uo=qr(u)}else uo=Xr?Pa(u.stateNode):null;return!0}function iC(){for(var u=uo;u;)u=Pa(u)}function ji(){me&&(uo=Xr=null,xu=mn=!1)}function E0(u){Wo===null?Wo=[u]:Wo.push(u)}var AD=c.ReactCurrentBatchConfig;function $f(u,p){if(Ho(u,p))return!0;if(typeof u!="object"||u===null||typeof p!="object"||p===null)return!1;var v=Object.keys(u),C=Object.keys(p);if(v.length!==C.length)return!1;for(C=0;C<v.length;C++){var k=v[C];if(!v0.call(p,k)||!Ho(u[k],p[k]))return!1}return!0}function TD(u){switch(u.tag){case 5:return _l(u.type);case 16:return _l("Lazy");case 13:return _l("Suspense");case 19:return _l("SuspenseList");case 0:case 2:case 15:return u=gu(u.type,!1),u;case 11:return u=gu(u.type.render,!1),u;case 1:return u=gu(u.type,!0),u;default:return""}}function Vo(u,p){if(u&&u.defaultProps){p=s({},p),u=u.defaultProps;for(var v in u)p[v]===void 0&&(p[v]=u[v]);return p}return p}var Lf=Dt(null),Ff=null,_i=null,M0=null;function O0(){M0=_i=Ff=null}function cC(u,p,v){oe?(Rt(Lf,p._currentValue),p._currentValue=v):(Rt(Lf,p._currentValue2),p._currentValue2=v)}function D0(u){var p=Lf.current;_t(Lf),oe?u._currentValue=p:u._currentValue2=p}function R0(u,p,v){for(;u!==null;){var C=u.alternate;if((u.childLanes&p)!==p?(u.childLanes|=p,C!==null&&(C.childLanes|=p)):C!==null&&(C.childLanes&p)!==p&&(C.childLanes|=p),u===v)break;u=u.return}}function Ii(u,p){Ff=u,M0=_i=null,u=u.dependencies,u!==null&&u.firstContext!==null&&(u.lanes&p&&(Er=!0),u.firstContext=null)}function fo(u){var p=oe?u._currentValue:u._currentValue2;if(M0!==u)if(u={context:u,memoizedValue:p,next:null},_i===null){if(Ff===null)throw Error(l(308));_i=u,Ff.dependencies={lanes:0,firstContext:u}}else _i=_i.next=u;return p}var El=null;function A0(u){El===null?El=[u]:El.push(u)}function uC(u,p,v,C){var k=p.interleaved;return k===null?(v.next=v,A0(p)):(v.next=k.next,k.next=v),p.interleaved=v,ms(u,C)}function ms(u,p){u.lanes|=p;var v=u.alternate;for(v!==null&&(v.lanes|=p),v=u,u=u.return;u!==null;)u.childLanes|=p,v=u.alternate,v!==null&&(v.childLanes|=p),v=u,u=u.return;return v.tag===3?v.stateNode:null}var Oa=!1;function T0(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dC(u,p){u=u.updateQueue,p.updateQueue===u&&(p.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function Gs(u,p){return{eventTime:u,lane:p,tag:0,payload:null,callback:null,next:null}}function Da(u,p,v){var C=u.updateQueue;if(C===null)return null;if(C=C.shared,It&2){var k=C.pending;return k===null?p.next=p:(p.next=k.next,k.next=p),C.pending=p,ms(u,v)}return k=C.interleaved,k===null?(p.next=p,A0(C)):(p.next=k.next,k.next=p),C.interleaved=p,ms(u,v)}function zf(u,p,v){if(p=p.updateQueue,p!==null&&(p=p.shared,(v&4194240)!==0)){var C=p.lanes;C&=u.pendingLanes,v|=C,p.lanes=v,y0(u,v)}}function fC(u,p){var v=u.updateQueue,C=u.alternate;if(C!==null&&(C=C.updateQueue,v===C)){var k=null,P=null;if(v=v.firstBaseUpdate,v!==null){do{var F={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};P===null?k=P=F:P=P.next=F,v=v.next}while(v!==null);P===null?k=P=p:P=P.next=p}else k=P=p;v={baseState:C.baseState,firstBaseUpdate:k,lastBaseUpdate:P,shared:C.shared,effects:C.effects},u.updateQueue=v;return}u=v.lastBaseUpdate,u===null?v.firstBaseUpdate=p:u.next=p,v.lastBaseUpdate=p}function Bf(u,p,v,C){var k=u.updateQueue;Oa=!1;var P=k.firstBaseUpdate,F=k.lastBaseUpdate,ie=k.shared.pending;if(ie!==null){k.shared.pending=null;var ge=ie,Oe=ge.next;ge.next=null,F===null?P=Oe:F.next=Oe,F=ge;var Ye=u.alternate;Ye!==null&&(Ye=Ye.updateQueue,ie=Ye.lastBaseUpdate,ie!==F&&(ie===null?Ye.firstBaseUpdate=Oe:ie.next=Oe,Ye.lastBaseUpdate=ge))}if(P!==null){var xt=k.baseState;F=0,Ye=Oe=ge=null,ie=P;do{var He=ie.lane,dn=ie.eventTime;if((C&He)===He){Ye!==null&&(Ye=Ye.next={eventTime:dn,lane:0,tag:ie.tag,payload:ie.payload,callback:ie.callback,next:null});e:{var tn=u,Dr=ie;switch(He=p,dn=v,Dr.tag){case 1:if(tn=Dr.payload,typeof tn=="function"){xt=tn.call(dn,xt,He);break e}xt=tn;break e;case 3:tn.flags=tn.flags&-65537|128;case 0:if(tn=Dr.payload,He=typeof tn=="function"?tn.call(dn,xt,He):tn,He==null)break e;xt=s({},xt,He);break e;case 2:Oa=!0}}ie.callback!==null&&ie.lane!==0&&(u.flags|=64,He=k.effects,He===null?k.effects=[ie]:He.push(ie))}else dn={eventTime:dn,lane:He,tag:ie.tag,payload:ie.payload,callback:ie.callback,next:null},Ye===null?(Oe=Ye=dn,ge=xt):Ye=Ye.next=dn,F|=He;if(ie=ie.next,ie===null){if(ie=k.shared.pending,ie===null)break;He=ie,ie=He.next,He.next=null,k.lastBaseUpdate=He,k.shared.pending=null}}while(1);if(Ye===null&&(ge=xt),k.baseState=ge,k.firstBaseUpdate=Oe,k.lastBaseUpdate=Ye,p=k.shared.interleaved,p!==null){k=p;do F|=k.lane,k=k.next;while(k!==p)}else P===null&&(k.shared.lanes=0);Ol|=F,u.lanes=F,u.memoizedState=xt}}function pC(u,p,v){if(u=p.effects,p.effects=null,u!==null)for(p=0;p<u.length;p++){var C=u[p],k=C.callback;if(k!==null){if(C.callback=null,C=v,typeof k!="function")throw Error(l(191,k));k.call(C)}}}var mC=new r.Component().refs;function N0(u,p,v,C){p=u.memoizedState,v=v(C,p),v=v==null?p:s({},p,v),u.memoizedState=v,u.lanes===0&&(u.updateQueue.baseState=v)}var Hf={isMounted:function(u){return(u=u._reactInternals)?N(u)===u:!1},enqueueSetState:function(u,p,v){u=u._reactInternals;var C=dr(),k=Ta(u),P=Gs(C,k);P.payload=p,v!=null&&(P.callback=v),p=Da(u,P,k),p!==null&&(ho(p,u,k,C),zf(p,u,k))},enqueueReplaceState:function(u,p,v){u=u._reactInternals;var C=dr(),k=Ta(u),P=Gs(C,k);P.tag=1,P.payload=p,v!=null&&(P.callback=v),p=Da(u,P,k),p!==null&&(ho(p,u,k,C),zf(p,u,k))},enqueueForceUpdate:function(u,p){u=u._reactInternals;var v=dr(),C=Ta(u),k=Gs(v,C);k.tag=2,p!=null&&(k.callback=p),p=Da(u,k,C),p!==null&&(ho(p,u,C,v),zf(p,u,C))}};function hC(u,p,v,C,k,P,F){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(C,P,F):p.prototype&&p.prototype.isPureReactComponent?!$f(v,C)||!$f(k,P):!0}function gC(u,p,v){var C=!1,k=lr,P=p.contextType;return typeof P=="object"&&P!==null?P=fo(P):(k=Pr(p)?br:an.current,C=p.contextTypes,P=(C=C!=null)?wi(u,k):lr),p=new p(v,P),u.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Hf,u.stateNode=p,p._reactInternals=u,C&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=k,u.__reactInternalMemoizedMaskedChildContext=P),p}function vC(u,p,v,C){u=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(v,C),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(v,C),p.state!==u&&Hf.enqueueReplaceState(p,p.state,null)}function $0(u,p,v,C){var k=u.stateNode;k.props=v,k.state=u.memoizedState,k.refs=mC,T0(u);var P=p.contextType;typeof P=="object"&&P!==null?k.context=fo(P):(P=Pr(p)?br:an.current,k.context=wi(u,P)),k.state=u.memoizedState,P=p.getDerivedStateFromProps,typeof P=="function"&&(N0(u,p,P,v),k.state=u.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(p=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),p!==k.state&&Hf.enqueueReplaceState(k,k.state,null),Bf(u,v,k,C),k.state=u.memoizedState),typeof k.componentDidMount=="function"&&(u.flags|=4194308)}function yu(u,p,v){if(u=v.ref,u!==null&&typeof u!="function"&&typeof u!="object"){if(v._owner){if(v=v._owner,v){if(v.tag!==1)throw Error(l(309));var C=v.stateNode}if(!C)throw Error(l(147,u));var k=C,P=""+u;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===P?p.ref:(p=function(F){var ie=k.refs;ie===mC&&(ie=k.refs={}),F===null?delete ie[P]:ie[P]=F},p._stringRef=P,p)}if(typeof u!="string")throw Error(l(284));if(!v._owner)throw Error(l(290,u))}return u}function Wf(u,p){throw u=Object.prototype.toString.call(p),Error(l(31,u==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":u))}function bC(u){var p=u._init;return p(u._payload)}function xC(u){function p(he,ue){if(u){var xe=he.deletions;xe===null?(he.deletions=[ue],he.flags|=16):xe.push(ue)}}function v(he,ue){if(!u)return null;for(;ue!==null;)p(he,ue),ue=ue.sibling;return null}function C(he,ue){for(he=new Map;ue!==null;)ue.key!==null?he.set(ue.key,ue):he.set(ue.index,ue),ue=ue.sibling;return he}function k(he,ue){return he=$a(he,ue),he.index=0,he.sibling=null,he}function P(he,ue,xe){return he.index=xe,u?(xe=he.alternate,xe!==null?(xe=xe.index,xe<ue?(he.flags|=2,ue):xe):(he.flags|=2,ue)):(he.flags|=1048576,ue)}function F(he){return u&&he.alternate===null&&(he.flags|=2),he}function ie(he,ue,xe,We){return ue===null||ue.tag!==6?(ue=kv(xe,he.mode,We),ue.return=he,ue):(ue=k(ue,xe),ue.return=he,ue)}function ge(he,ue,xe,We){var ct=xe.type;return ct===m?Ye(he,ue,xe.props.children,We,xe.key):ue!==null&&(ue.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===_&&bC(ct)===ue.type)?(We=k(ue,xe.props),We.ref=yu(he,ue,xe),We.return=he,We):(We=hp(xe.type,xe.key,xe.props,null,he.mode,We),We.ref=yu(he,ue,xe),We.return=he,We)}function Oe(he,ue,xe,We){return ue===null||ue.tag!==4||ue.stateNode.containerInfo!==xe.containerInfo||ue.stateNode.implementation!==xe.implementation?(ue=jv(xe,he.mode,We),ue.return=he,ue):(ue=k(ue,xe.children||[]),ue.return=he,ue)}function Ye(he,ue,xe,We,ct){return ue===null||ue.tag!==7?(ue=Tl(xe,he.mode,We,ct),ue.return=he,ue):(ue=k(ue,xe),ue.return=he,ue)}function xt(he,ue,xe){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return ue=kv(""+ue,he.mode,xe),ue.return=he,ue;if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case d:return xe=hp(ue.type,ue.key,ue.props,null,he.mode,xe),xe.ref=yu(he,null,ue),xe.return=he,xe;case f:return ue=jv(ue,he.mode,xe),ue.return=he,ue;case _:var We=ue._init;return xt(he,We(ue._payload),xe)}if(Y(ue)||M(ue))return ue=Tl(ue,he.mode,xe,null),ue.return=he,ue;Wf(he,ue)}return null}function He(he,ue,xe,We){var ct=ue!==null?ue.key:null;if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ct!==null?null:ie(he,ue,""+xe,We);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case d:return xe.key===ct?ge(he,ue,xe,We):null;case f:return xe.key===ct?Oe(he,ue,xe,We):null;case _:return ct=xe._init,He(he,ue,ct(xe._payload),We)}if(Y(xe)||M(xe))return ct!==null?null:Ye(he,ue,xe,We,null);Wf(he,xe)}return null}function dn(he,ue,xe,We,ct){if(typeof We=="string"&&We!==""||typeof We=="number")return he=he.get(xe)||null,ie(ue,he,""+We,ct);if(typeof We=="object"&&We!==null){switch(We.$$typeof){case d:return he=he.get(We.key===null?xe:We.key)||null,ge(ue,he,We,ct);case f:return he=he.get(We.key===null?xe:We.key)||null,Oe(ue,he,We,ct);case _:var Ct=We._init;return dn(he,ue,xe,Ct(We._payload),ct)}if(Y(We)||M(We))return he=he.get(xe)||null,Ye(ue,he,We,ct,null);Wf(ue,We)}return null}function tn(he,ue,xe,We){for(var ct=null,Ct=null,yt=ue,Ft=ue=0,Jn=null;yt!==null&&Ft<xe.length;Ft++){yt.index>Ft?(Jn=yt,yt=null):Jn=yt.sibling;var zt=He(he,yt,xe[Ft],We);if(zt===null){yt===null&&(yt=Jn);break}u&&yt&&zt.alternate===null&&p(he,yt),ue=P(zt,ue,Ft),Ct===null?ct=zt:Ct.sibling=zt,Ct=zt,yt=Jn}if(Ft===xe.length)return v(he,yt),mn&&Pl(he,Ft),ct;if(yt===null){for(;Ft<xe.length;Ft++)yt=xt(he,xe[Ft],We),yt!==null&&(ue=P(yt,ue,Ft),Ct===null?ct=yt:Ct.sibling=yt,Ct=yt);return mn&&Pl(he,Ft),ct}for(yt=C(he,yt);Ft<xe.length;Ft++)Jn=dn(yt,he,Ft,xe[Ft],We),Jn!==null&&(u&&Jn.alternate!==null&&yt.delete(Jn.key===null?Ft:Jn.key),ue=P(Jn,ue,Ft),Ct===null?ct=Jn:Ct.sibling=Jn,Ct=Jn);return u&&yt.forEach(function(La){return p(he,La)}),mn&&Pl(he,Ft),ct}function Dr(he,ue,xe,We){var ct=M(xe);if(typeof ct!="function")throw Error(l(150));if(xe=ct.call(xe),xe==null)throw Error(l(151));for(var Ct=ct=null,yt=ue,Ft=ue=0,Jn=null,zt=xe.next();yt!==null&&!zt.done;Ft++,zt=xe.next()){yt.index>Ft?(Jn=yt,yt=null):Jn=yt.sibling;var La=He(he,yt,zt.value,We);if(La===null){yt===null&&(yt=Jn);break}u&&yt&&La.alternate===null&&p(he,yt),ue=P(La,ue,Ft),Ct===null?ct=La:Ct.sibling=La,Ct=La,yt=Jn}if(zt.done)return v(he,yt),mn&&Pl(he,Ft),ct;if(yt===null){for(;!zt.done;Ft++,zt=xe.next())zt=xt(he,zt.value,We),zt!==null&&(ue=P(zt,ue,Ft),Ct===null?ct=zt:Ct.sibling=zt,Ct=zt);return mn&&Pl(he,Ft),ct}for(yt=C(he,yt);!zt.done;Ft++,zt=xe.next())zt=dn(yt,he,Ft,zt.value,We),zt!==null&&(u&&zt.alternate!==null&&yt.delete(zt.key===null?Ft:zt.key),ue=P(zt,ue,Ft),Ct===null?ct=zt:Ct.sibling=zt,Ct=zt);return u&&yt.forEach(function(dR){return p(he,dR)}),mn&&Pl(he,Ft),ct}function Xs(he,ue,xe,We){if(typeof xe=="object"&&xe!==null&&xe.type===m&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case d:e:{for(var ct=xe.key,Ct=ue;Ct!==null;){if(Ct.key===ct){if(ct=xe.type,ct===m){if(Ct.tag===7){v(he,Ct.sibling),ue=k(Ct,xe.props.children),ue.return=he,he=ue;break e}}else if(Ct.elementType===ct||typeof ct=="object"&&ct!==null&&ct.$$typeof===_&&bC(ct)===Ct.type){v(he,Ct.sibling),ue=k(Ct,xe.props),ue.ref=yu(he,Ct,xe),ue.return=he,he=ue;break e}v(he,Ct);break}else p(he,Ct);Ct=Ct.sibling}xe.type===m?(ue=Tl(xe.props.children,he.mode,We,xe.key),ue.return=he,he=ue):(We=hp(xe.type,xe.key,xe.props,null,he.mode,We),We.ref=yu(he,ue,xe),We.return=he,he=We)}return F(he);case f:e:{for(Ct=xe.key;ue!==null;){if(ue.key===Ct)if(ue.tag===4&&ue.stateNode.containerInfo===xe.containerInfo&&ue.stateNode.implementation===xe.implementation){v(he,ue.sibling),ue=k(ue,xe.children||[]),ue.return=he,he=ue;break e}else{v(he,ue);break}else p(he,ue);ue=ue.sibling}ue=jv(xe,he.mode,We),ue.return=he,he=ue}return F(he);case _:return Ct=xe._init,Xs(he,ue,Ct(xe._payload),We)}if(Y(xe))return tn(he,ue,xe,We);if(M(xe))return Dr(he,ue,xe,We);Wf(he,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ue!==null&&ue.tag===6?(v(he,ue.sibling),ue=k(ue,xe),ue.return=he,he=ue):(v(he,ue),ue=kv(xe,he.mode,We),ue.return=he,he=ue),F(he)):v(he,ue)}return Xs}var Pi=xC(!0),yC=xC(!1),Cu={},po=Dt(Cu),wu=Dt(Cu),Ei=Dt(Cu);function hs(u){if(u===Cu)throw Error(l(174));return u}function L0(u,p){Rt(Ei,p),Rt(wu,u),Rt(po,Cu),u=V(p),_t(po),Rt(po,u)}function Mi(){_t(po),_t(wu),_t(Ei)}function CC(u){var p=hs(Ei.current),v=hs(po.current);p=se(v,u.type,p),v!==p&&(Rt(wu,u),Rt(po,p))}function F0(u){wu.current===u&&(_t(po),_t(wu))}var wn=Dt(0);function Vf(u){for(var p=u;p!==null;){if(p.tag===13){var v=p.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Fo(v)||zo(v)))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if(p.flags&128)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var z0=[];function B0(){for(var u=0;u<z0.length;u++){var p=z0[u];oe?p._workInProgressVersionPrimary=null:p._workInProgressVersionSecondary=null}z0.length=0}var Uf=c.ReactCurrentDispatcher,H0=c.ReactCurrentBatchConfig,Ml=0,Sn=null,Un=null,Yn=null,Gf=!1,Su=!1,ku=0,ND=0;function ir(){throw Error(l(321))}function W0(u,p){if(p===null)return!1;for(var v=0;v<p.length&&v<u.length;v++)if(!Ho(u[v],p[v]))return!1;return!0}function V0(u,p,v,C,k,P){if(Ml=P,Sn=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,Uf.current=u===null||u.memoizedState===null?zD:BD,u=v(C,k),Su){P=0;do{if(Su=!1,ku=0,25<=P)throw Error(l(301));P+=1,Yn=Un=null,p.updateQueue=null,Uf.current=HD,u=v(C,k)}while(Su)}if(Uf.current=Xf,p=Un!==null&&Un.next!==null,Ml=0,Yn=Un=Sn=null,Gf=!1,p)throw Error(l(300));return u}function U0(){var u=ku!==0;return ku=0,u}function gs(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yn===null?Sn.memoizedState=Yn=u:Yn=Yn.next=u,Yn}function mo(){if(Un===null){var u=Sn.alternate;u=u!==null?u.memoizedState:null}else u=Un.next;var p=Yn===null?Sn.memoizedState:Yn.next;if(p!==null)Yn=p,Un=u;else{if(u===null)throw Error(l(310));Un=u,u={memoizedState:Un.memoizedState,baseState:Un.baseState,baseQueue:Un.baseQueue,queue:Un.queue,next:null},Yn===null?Sn.memoizedState=Yn=u:Yn=Yn.next=u}return Yn}function ju(u,p){return typeof p=="function"?p(u):p}function G0(u){var p=mo(),v=p.queue;if(v===null)throw Error(l(311));v.lastRenderedReducer=u;var C=Un,k=C.baseQueue,P=v.pending;if(P!==null){if(k!==null){var F=k.next;k.next=P.next,P.next=F}C.baseQueue=k=P,v.pending=null}if(k!==null){P=k.next,C=C.baseState;var ie=F=null,ge=null,Oe=P;do{var Ye=Oe.lane;if((Ml&Ye)===Ye)ge!==null&&(ge=ge.next={lane:0,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null}),C=Oe.hasEagerState?Oe.eagerState:u(C,Oe.action);else{var xt={lane:Ye,action:Oe.action,hasEagerState:Oe.hasEagerState,eagerState:Oe.eagerState,next:null};ge===null?(ie=ge=xt,F=C):ge=ge.next=xt,Sn.lanes|=Ye,Ol|=Ye}Oe=Oe.next}while(Oe!==null&&Oe!==P);ge===null?F=C:ge.next=ie,Ho(C,p.memoizedState)||(Er=!0),p.memoizedState=C,p.baseState=F,p.baseQueue=ge,v.lastRenderedState=C}if(u=v.interleaved,u!==null){k=u;do P=k.lane,Sn.lanes|=P,Ol|=P,k=k.next;while(k!==u)}else k===null&&(v.lanes=0);return[p.memoizedState,v.dispatch]}function K0(u){var p=mo(),v=p.queue;if(v===null)throw Error(l(311));v.lastRenderedReducer=u;var C=v.dispatch,k=v.pending,P=p.memoizedState;if(k!==null){v.pending=null;var F=k=k.next;do P=u(P,F.action),F=F.next;while(F!==k);Ho(P,p.memoizedState)||(Er=!0),p.memoizedState=P,p.baseQueue===null&&(p.baseState=P),v.lastRenderedState=P}return[P,C]}function wC(){}function SC(u,p){var v=Sn,C=mo(),k=p(),P=!Ho(C.memoizedState,k);if(P&&(C.memoizedState=k,Er=!0),C=C.queue,q0(_C.bind(null,v,C,u),[u]),C.getSnapshot!==p||P||Yn!==null&&Yn.memoizedState.tag&1){if(v.flags|=2048,_u(9,jC.bind(null,v,C,k,p),void 0,null),Zn===null)throw Error(l(349));Ml&30||kC(v,p,k)}return k}function kC(u,p,v){u.flags|=16384,u={getSnapshot:p,value:v},p=Sn.updateQueue,p===null?(p={lastEffect:null,stores:null},Sn.updateQueue=p,p.stores=[u]):(v=p.stores,v===null?p.stores=[u]:v.push(u))}function jC(u,p,v,C){p.value=v,p.getSnapshot=C,IC(p)&&PC(u)}function _C(u,p,v){return v(function(){IC(p)&&PC(u)})}function IC(u){var p=u.getSnapshot;u=u.value;try{var v=p();return!Ho(u,v)}catch{return!0}}function PC(u){var p=ms(u,1);p!==null&&ho(p,u,1,-1)}function EC(u){var p=gs();return typeof u=="function"&&(u=u()),p.memoizedState=p.baseState=u,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ju,lastRenderedState:u},p.queue=u,u=u.dispatch=FD.bind(null,Sn,u),[p.memoizedState,u]}function _u(u,p,v,C){return u={tag:u,create:p,destroy:v,deps:C,next:null},p=Sn.updateQueue,p===null?(p={lastEffect:null,stores:null},Sn.updateQueue=p,p.lastEffect=u.next=u):(v=p.lastEffect,v===null?p.lastEffect=u.next=u:(C=v.next,v.next=u,u.next=C,p.lastEffect=u)),u}function MC(){return mo().memoizedState}function Kf(u,p,v,C){var k=gs();Sn.flags|=u,k.memoizedState=_u(1|p,v,void 0,C===void 0?null:C)}function qf(u,p,v,C){var k=mo();C=C===void 0?null:C;var P=void 0;if(Un!==null){var F=Un.memoizedState;if(P=F.destroy,C!==null&&W0(C,F.deps)){k.memoizedState=_u(p,v,P,C);return}}Sn.flags|=u,k.memoizedState=_u(1|p,v,P,C)}function OC(u,p){return Kf(8390656,8,u,p)}function q0(u,p){return qf(2048,8,u,p)}function DC(u,p){return qf(4,2,u,p)}function RC(u,p){return qf(4,4,u,p)}function AC(u,p){if(typeof p=="function")return u=u(),p(u),function(){p(null)};if(p!=null)return u=u(),p.current=u,function(){p.current=null}}function TC(u,p,v){return v=v!=null?v.concat([u]):null,qf(4,4,AC.bind(null,p,u),v)}function X0(){}function NC(u,p){var v=mo();p=p===void 0?null:p;var C=v.memoizedState;return C!==null&&p!==null&&W0(p,C[1])?C[0]:(v.memoizedState=[u,p],u)}function $C(u,p){var v=mo();p=p===void 0?null:p;var C=v.memoizedState;return C!==null&&p!==null&&W0(p,C[1])?C[0]:(u=u(),v.memoizedState=[u,p],u)}function LC(u,p,v){return Ml&21?(Ho(v,p)||(v=eC(),Sn.lanes|=v,Ol|=v,u.baseState=!0),p):(u.baseState&&(u.baseState=!1,Er=!0),u.memoizedState=v)}function $D(u,p){var v=Lt;Lt=v!==0&&4>v?v:4,u(!0);var C=H0.transition;H0.transition={};try{u(!1),p()}finally{Lt=v,H0.transition=C}}function FC(){return mo().memoizedState}function LD(u,p,v){var C=Ta(u);if(v={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null},zC(u))BC(p,v);else if(v=uC(u,p,v,C),v!==null){var k=dr();ho(v,u,C,k),HC(v,p,C)}}function FD(u,p,v){var C=Ta(u),k={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null};if(zC(u))BC(p,k);else{var P=u.alternate;if(u.lanes===0&&(P===null||P.lanes===0)&&(P=p.lastRenderedReducer,P!==null))try{var F=p.lastRenderedState,ie=P(F,v);if(k.hasEagerState=!0,k.eagerState=ie,Ho(ie,F)){var ge=p.interleaved;ge===null?(k.next=k,A0(p)):(k.next=ge.next,ge.next=k),p.interleaved=k;return}}catch{}finally{}v=uC(u,p,k,C),v!==null&&(k=dr(),ho(v,u,C,k),HC(v,p,C))}}function zC(u){var p=u.alternate;return u===Sn||p!==null&&p===Sn}function BC(u,p){Su=Gf=!0;var v=u.pending;v===null?p.next=p:(p.next=v.next,v.next=p),u.pending=p}function HC(u,p,v){if(v&4194240){var C=p.lanes;C&=u.pendingLanes,v|=C,p.lanes=v,y0(u,v)}}var Xf={readContext:fo,useCallback:ir,useContext:ir,useEffect:ir,useImperativeHandle:ir,useInsertionEffect:ir,useLayoutEffect:ir,useMemo:ir,useReducer:ir,useRef:ir,useState:ir,useDebugValue:ir,useDeferredValue:ir,useTransition:ir,useMutableSource:ir,useSyncExternalStore:ir,useId:ir,unstable_isNewReconciler:!1},zD={readContext:fo,useCallback:function(u,p){return gs().memoizedState=[u,p===void 0?null:p],u},useContext:fo,useEffect:OC,useImperativeHandle:function(u,p,v){return v=v!=null?v.concat([u]):null,Kf(4194308,4,AC.bind(null,p,u),v)},useLayoutEffect:function(u,p){return Kf(4194308,4,u,p)},useInsertionEffect:function(u,p){return Kf(4,2,u,p)},useMemo:function(u,p){var v=gs();return p=p===void 0?null:p,u=u(),v.memoizedState=[u,p],u},useReducer:function(u,p,v){var C=gs();return p=v!==void 0?v(p):p,C.memoizedState=C.baseState=p,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:p},C.queue=u,u=u.dispatch=LD.bind(null,Sn,u),[C.memoizedState,u]},useRef:function(u){var p=gs();return u={current:u},p.memoizedState=u},useState:EC,useDebugValue:X0,useDeferredValue:function(u){return gs().memoizedState=u},useTransition:function(){var u=EC(!1),p=u[0];return u=$D.bind(null,u[1]),gs().memoizedState=u,[p,u]},useMutableSource:function(){},useSyncExternalStore:function(u,p,v){var C=Sn,k=gs();if(mn){if(v===void 0)throw Error(l(407));v=v()}else{if(v=p(),Zn===null)throw Error(l(349));Ml&30||kC(C,p,v)}k.memoizedState=v;var P={value:v,getSnapshot:p};return k.queue=P,OC(_C.bind(null,C,P,u),[u]),C.flags|=2048,_u(9,jC.bind(null,C,P,v,p),void 0,null),v},useId:function(){var u=gs(),p=Zn.identifierPrefix;if(mn){var v=Us,C=Vs;v=(C&~(1<<32-Bo(C)-1)).toString(32)+v,p=":"+p+"R"+v,v=ku++,0<v&&(p+="H"+v.toString(32)),p+=":"}else v=ND++,p=":"+p+"r"+v.toString(32)+":";return u.memoizedState=p},unstable_isNewReconciler:!1},BD={readContext:fo,useCallback:NC,useContext:fo,useEffect:q0,useImperativeHandle:TC,useInsertionEffect:DC,useLayoutEffect:RC,useMemo:$C,useReducer:G0,useRef:MC,useState:function(){return G0(ju)},useDebugValue:X0,useDeferredValue:function(u){var p=mo();return LC(p,Un.memoizedState,u)},useTransition:function(){var u=G0(ju)[0],p=mo().memoizedState;return[u,p]},useMutableSource:wC,useSyncExternalStore:SC,useId:FC,unstable_isNewReconciler:!1},HD={readContext:fo,useCallback:NC,useContext:fo,useEffect:q0,useImperativeHandle:TC,useInsertionEffect:DC,useLayoutEffect:RC,useMemo:$C,useReducer:K0,useRef:MC,useState:function(){return K0(ju)},useDebugValue:X0,useDeferredValue:function(u){var p=mo();return Un===null?p.memoizedState=u:LC(p,Un.memoizedState,u)},useTransition:function(){var u=K0(ju)[0],p=mo().memoizedState;return[u,p]},useMutableSource:wC,useSyncExternalStore:SC,useId:FC,unstable_isNewReconciler:!1};function Oi(u,p){try{var v="",C=p;do v+=TD(C),C=C.return;while(C);var k=v}catch(P){k=`
Error generating stack: `+P.message+`
`+P.stack}return{value:u,source:p,stack:k,digest:null}}function Q0(u,p,v){return{value:u,source:null,stack:v??null,digest:p??null}}function Y0(u,p){try{console.error(p.value)}catch(v){setTimeout(function(){throw v})}}var WD=typeof WeakMap=="function"?WeakMap:Map;function WC(u,p,v){v=Gs(-1,v),v.tag=3,v.payload={element:null};var C=p.value;return v.callback=function(){cp||(cp=!0,vv=C),Y0(u,p)},v}function VC(u,p,v){v=Gs(-1,v),v.tag=3;var C=u.type.getDerivedStateFromError;if(typeof C=="function"){var k=p.value;v.payload=function(){return C(k)},v.callback=function(){Y0(u,p)}}var P=u.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(v.callback=function(){Y0(u,p),typeof C!="function"&&(Ra===null?Ra=new Set([this]):Ra.add(this));var F=p.stack;this.componentDidCatch(p.value,{componentStack:F!==null?F:""})}),v}function UC(u,p,v){var C=u.pingCache;if(C===null){C=u.pingCache=new WD;var k=new Set;C.set(p,k)}else k=C.get(p),k===void 0&&(k=new Set,C.set(p,k));k.has(v)||(k.add(v),u=rR.bind(null,u,p,v),p.then(u,u))}function GC(u){do{var p;if((p=u.tag===13)&&(p=u.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return u;u=u.return}while(u!==null);return null}function KC(u,p,v,C,k){return u.mode&1?(u.flags|=65536,u.lanes=k,u):(u===p?u.flags|=65536:(u.flags|=128,v.flags|=131072,v.flags&=-52805,v.tag===1&&(v.alternate===null?v.tag=17:(p=Gs(-1,1),p.tag=2,Da(v,p,1))),v.lanes|=1),u)}var VD=c.ReactCurrentOwner,Er=!1;function xr(u,p,v,C){p.child=u===null?yC(p,null,v,C):Pi(p,u.child,v,C)}function qC(u,p,v,C,k){v=v.render;var P=p.ref;return Ii(p,k),C=V0(u,p,v,C,P,k),v=U0(),u!==null&&!Er?(p.updateQueue=u.updateQueue,p.flags&=-2053,u.lanes&=~k,Ks(u,p,k)):(mn&&v&&j0(p),p.flags|=1,xr(u,p,C,k),p.child)}function XC(u,p,v,C,k){if(u===null){var P=v.type;return typeof P=="function"&&!Sv(P)&&P.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(p.tag=15,p.type=P,QC(u,p,P,C,k)):(u=hp(v.type,null,C,p,p.mode,k),u.ref=p.ref,u.return=p,p.child=u)}if(P=u.child,!(u.lanes&k)){var F=P.memoizedProps;if(v=v.compare,v=v!==null?v:$f,v(F,C)&&u.ref===p.ref)return Ks(u,p,k)}return p.flags|=1,u=$a(P,C),u.ref=p.ref,u.return=p,p.child=u}function QC(u,p,v,C,k){if(u!==null){var P=u.memoizedProps;if($f(P,C)&&u.ref===p.ref)if(Er=!1,p.pendingProps=C=P,(u.lanes&k)!==0)u.flags&131072&&(Er=!0);else return p.lanes=u.lanes,Ks(u,p,k)}return Z0(u,p,v,C,k)}function YC(u,p,v){var C=p.pendingProps,k=C.children,P=u!==null?u.memoizedState:null;if(C.mode==="hidden")if(!(p.mode&1))p.memoizedState={baseLanes:0,cachePool:null,transitions:null},Rt(Ri,Qr),Qr|=v;else{if(!(v&1073741824))return u=P!==null?P.baseLanes|v:v,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:u,cachePool:null,transitions:null},p.updateQueue=null,Rt(Ri,Qr),Qr|=u,null;p.memoizedState={baseLanes:0,cachePool:null,transitions:null},C=P!==null?P.baseLanes:v,Rt(Ri,Qr),Qr|=C}else P!==null?(C=P.baseLanes|v,p.memoizedState=null):C=v,Rt(Ri,Qr),Qr|=C;return xr(u,p,k,v),p.child}function ZC(u,p){var v=p.ref;(u===null&&v!==null||u!==null&&u.ref!==v)&&(p.flags|=512,p.flags|=2097152)}function Z0(u,p,v,C,k){var P=Pr(v)?br:an.current;return P=wi(p,P),Ii(p,k),v=V0(u,p,v,C,P,k),C=U0(),u!==null&&!Er?(p.updateQueue=u.updateQueue,p.flags&=-2053,u.lanes&=~k,Ks(u,p,k)):(mn&&C&&j0(p),p.flags|=1,xr(u,p,v,k),p.child)}function JC(u,p,v,C,k){if(Pr(v)){var P=!0;Pf(p)}else P=!1;if(Ii(p,k),p.stateNode===null)Yf(u,p),gC(p,v,C),$0(p,v,C,k),C=!0;else if(u===null){var F=p.stateNode,ie=p.memoizedProps;F.props=ie;var ge=F.context,Oe=v.contextType;typeof Oe=="object"&&Oe!==null?Oe=fo(Oe):(Oe=Pr(v)?br:an.current,Oe=wi(p,Oe));var Ye=v.getDerivedStateFromProps,xt=typeof Ye=="function"||typeof F.getSnapshotBeforeUpdate=="function";xt||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(ie!==C||ge!==Oe)&&vC(p,F,C,Oe),Oa=!1;var He=p.memoizedState;F.state=He,Bf(p,C,F,k),ge=p.memoizedState,ie!==C||He!==ge||$n.current||Oa?(typeof Ye=="function"&&(N0(p,v,Ye,C),ge=p.memoizedState),(ie=Oa||hC(p,v,ie,C,He,ge,Oe))?(xt||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount=="function"&&(p.flags|=4194308)):(typeof F.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=C,p.memoizedState=ge),F.props=C,F.state=ge,F.context=Oe,C=ie):(typeof F.componentDidMount=="function"&&(p.flags|=4194308),C=!1)}else{F=p.stateNode,dC(u,p),ie=p.memoizedProps,Oe=p.type===p.elementType?ie:Vo(p.type,ie),F.props=Oe,xt=p.pendingProps,He=F.context,ge=v.contextType,typeof ge=="object"&&ge!==null?ge=fo(ge):(ge=Pr(v)?br:an.current,ge=wi(p,ge));var dn=v.getDerivedStateFromProps;(Ye=typeof dn=="function"||typeof F.getSnapshotBeforeUpdate=="function")||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(ie!==xt||He!==ge)&&vC(p,F,C,ge),Oa=!1,He=p.memoizedState,F.state=He,Bf(p,C,F,k);var tn=p.memoizedState;ie!==xt||He!==tn||$n.current||Oa?(typeof dn=="function"&&(N0(p,v,dn,C),tn=p.memoizedState),(Oe=Oa||hC(p,v,Oe,C,He,tn,ge)||!1)?(Ye||typeof F.UNSAFE_componentWillUpdate!="function"&&typeof F.componentWillUpdate!="function"||(typeof F.componentWillUpdate=="function"&&F.componentWillUpdate(C,tn,ge),typeof F.UNSAFE_componentWillUpdate=="function"&&F.UNSAFE_componentWillUpdate(C,tn,ge)),typeof F.componentDidUpdate=="function"&&(p.flags|=4),typeof F.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof F.componentDidUpdate!="function"||ie===u.memoizedProps&&He===u.memoizedState||(p.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||ie===u.memoizedProps&&He===u.memoizedState||(p.flags|=1024),p.memoizedProps=C,p.memoizedState=tn),F.props=C,F.state=tn,F.context=ge,C=Oe):(typeof F.componentDidUpdate!="function"||ie===u.memoizedProps&&He===u.memoizedState||(p.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||ie===u.memoizedProps&&He===u.memoizedState||(p.flags|=1024),C=!1)}return J0(u,p,v,C,P,k)}function J0(u,p,v,C,k,P){ZC(u,p);var F=(p.flags&128)!==0;if(!C&&!F)return k&&J2(p,v,!1),Ks(u,p,P);C=p.stateNode,VD.current=p;var ie=F&&typeof v.getDerivedStateFromError!="function"?null:C.render();return p.flags|=1,u!==null&&F?(p.child=Pi(p,u.child,null,P),p.child=Pi(p,null,ie,P)):xr(u,p,ie,P),p.memoizedState=C.state,k&&J2(p,v,!0),p.child}function ew(u){var p=u.stateNode;p.pendingContext?Y2(u,p.pendingContext,p.pendingContext!==p.context):p.context&&Y2(u,p.context,!1),L0(u,p.containerInfo)}function tw(u,p,v,C,k){return ji(),E0(k),p.flags|=256,xr(u,p,v,C),p.child}var ev={dehydrated:null,treeContext:null,retryLane:0};function tv(u){return{baseLanes:u,cachePool:null,transitions:null}}function nw(u,p,v){var C=p.pendingProps,k=wn.current,P=!1,F=(p.flags&128)!==0,ie;if((ie=F)||(ie=u!==null&&u.memoizedState===null?!1:(k&2)!==0),ie?(P=!0,p.flags&=-129):(u===null||u.memoizedState!==null)&&(k|=1),Rt(wn,k&1),u===null)return P0(p),u=p.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?(p.mode&1?zo(u)?p.lanes=8:p.lanes=1073741824:p.lanes=1,null):(F=C.children,u=C.fallback,P?(C=p.mode,P=p.child,F={mode:"hidden",children:F},!(C&1)&&P!==null?(P.childLanes=0,P.pendingProps=F):P=gp(F,C,0,null),u=Tl(u,C,v,null),P.return=p,u.return=p,P.sibling=u,p.child=P,p.child.memoizedState=tv(v),p.memoizedState=ev,u):nv(p,F));if(k=u.memoizedState,k!==null&&(ie=k.dehydrated,ie!==null))return UD(u,p,F,C,ie,k,v);if(P){P=C.fallback,F=p.mode,k=u.child,ie=k.sibling;var ge={mode:"hidden",children:C.children};return!(F&1)&&p.child!==k?(C=p.child,C.childLanes=0,C.pendingProps=ge,p.deletions=null):(C=$a(k,ge),C.subtreeFlags=k.subtreeFlags&14680064),ie!==null?P=$a(ie,P):(P=Tl(P,F,v,null),P.flags|=2),P.return=p,C.return=p,C.sibling=P,p.child=C,C=P,P=p.child,F=u.child.memoizedState,F=F===null?tv(v):{baseLanes:F.baseLanes|v,cachePool:null,transitions:F.transitions},P.memoizedState=F,P.childLanes=u.childLanes&~v,p.memoizedState=ev,C}return P=u.child,u=P.sibling,C=$a(P,{mode:"visible",children:C.children}),!(p.mode&1)&&(C.lanes=v),C.return=p,C.sibling=null,u!==null&&(v=p.deletions,v===null?(p.deletions=[u],p.flags|=16):v.push(u)),p.child=C,p.memoizedState=null,C}function nv(u,p){return p=gp({mode:"visible",children:p},u.mode,0,null),p.return=u,u.child=p}function Qf(u,p,v,C){return C!==null&&E0(C),Pi(p,u.child,null,v),u=nv(p,p.pendingProps.children),u.flags|=2,p.memoizedState=null,u}function UD(u,p,v,C,k,P,F){if(v)return p.flags&256?(p.flags&=-257,C=Q0(Error(l(422))),Qf(u,p,F,C)):p.memoizedState!==null?(p.child=u.child,p.flags|=128,null):(P=C.fallback,k=p.mode,C=gp({mode:"visible",children:C.children},k,0,null),P=Tl(P,k,F,null),P.flags|=2,C.return=p,P.return=p,C.sibling=P,p.child=C,p.mode&1&&Pi(p,u.child,null,F),p.child.memoizedState=tv(F),p.memoizedState=ev,P);if(!(p.mode&1))return Qf(u,p,F,null);if(zo(k))return C=Ia(k).digest,P=Error(l(419)),C=Q0(P,C,void 0),Qf(u,p,F,C);if(v=(F&u.childLanes)!==0,Er||v){if(C=Zn,C!==null){switch(F&-F){case 4:k=2;break;case 16:k=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:k=32;break;case 536870912:k=268435456;break;default:k=0}k=k&(C.suspendedLanes|F)?0:k,k!==0&&k!==P.retryLane&&(P.retryLane=k,ms(u,k),ho(C,u,k,-1))}return wv(),C=Q0(Error(l(421))),Qf(u,p,F,C)}return Fo(k)?(p.flags|=128,p.child=u.child,p=oR.bind(null,u),xi(k,p),null):(u=P.treeContext,me&&(uo=qt(k),Xr=p,mn=!0,Wo=null,xu=!1,u!==null&&(io[co++]=Vs,io[co++]=Us,io[co++]=Il,Vs=u.id,Us=u.overflow,Il=p)),p=nv(p,C.children),p.flags|=4096,p)}function rw(u,p,v){u.lanes|=p;var C=u.alternate;C!==null&&(C.lanes|=p),R0(u.return,p,v)}function rv(u,p,v,C,k){var P=u.memoizedState;P===null?u.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:C,tail:v,tailMode:k}:(P.isBackwards=p,P.rendering=null,P.renderingStartTime=0,P.last=C,P.tail=v,P.tailMode=k)}function ow(u,p,v){var C=p.pendingProps,k=C.revealOrder,P=C.tail;if(xr(u,p,C.children,v),C=wn.current,C&2)C=C&1|2,p.flags|=128;else{if(u!==null&&u.flags&128)e:for(u=p.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&rw(u,v,p);else if(u.tag===19)rw(u,v,p);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===p)break e;for(;u.sibling===null;){if(u.return===null||u.return===p)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}C&=1}if(Rt(wn,C),!(p.mode&1))p.memoizedState=null;else switch(k){case"forwards":for(v=p.child,k=null;v!==null;)u=v.alternate,u!==null&&Vf(u)===null&&(k=v),v=v.sibling;v=k,v===null?(k=p.child,p.child=null):(k=v.sibling,v.sibling=null),rv(p,!1,k,v,P);break;case"backwards":for(v=null,k=p.child,p.child=null;k!==null;){if(u=k.alternate,u!==null&&Vf(u)===null){p.child=k;break}u=k.sibling,k.sibling=v,v=k,k=u}rv(p,!0,v,null,P);break;case"together":rv(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function Yf(u,p){!(p.mode&1)&&u!==null&&(u.alternate=null,p.alternate=null,p.flags|=2)}function Ks(u,p,v){if(u!==null&&(p.dependencies=u.dependencies),Ol|=p.lanes,!(v&p.childLanes))return null;if(u!==null&&p.child!==u.child)throw Error(l(153));if(p.child!==null){for(u=p.child,v=$a(u,u.pendingProps),p.child=v,v.return=p;u.sibling!==null;)u=u.sibling,v=v.sibling=$a(u,u.pendingProps),v.return=p;v.sibling=null}return p.child}function GD(u,p,v){switch(p.tag){case 3:ew(p),ji();break;case 5:CC(p);break;case 1:Pr(p.type)&&Pf(p);break;case 4:L0(p,p.stateNode.containerInfo);break;case 10:cC(p,p.type._context,p.memoizedProps.value);break;case 13:var C=p.memoizedState;if(C!==null)return C.dehydrated!==null?(Rt(wn,wn.current&1),p.flags|=128,null):v&p.child.childLanes?nw(u,p,v):(Rt(wn,wn.current&1),u=Ks(u,p,v),u!==null?u.sibling:null);Rt(wn,wn.current&1);break;case 19:if(C=(v&p.childLanes)!==0,u.flags&128){if(C)return ow(u,p,v);p.flags|=128}var k=p.memoizedState;if(k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),Rt(wn,wn.current),C)break;return null;case 22:case 23:return p.lanes=0,YC(u,p,v)}return Ks(u,p,v)}function vs(u){u.flags|=4}function sw(u,p){if(u!==null&&u.child===p.child)return!0;if(p.flags&16)return!1;for(u=p.child;u!==null;){if(u.flags&12854||u.subtreeFlags&12854)return!1;u=u.sibling}return!0}var Iu,Pu,Zf,Jf;if(X)Iu=function(u,p){for(var v=p.child;v!==null;){if(v.tag===5||v.tag===6)ce(u,v.stateNode);else if(v.tag!==4&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===p)break;for(;v.sibling===null;){if(v.return===null||v.return===p)return;v=v.return}v.sibling.return=v.return,v=v.sibling}},Pu=function(){},Zf=function(u,p,v,C,k){if(u=u.memoizedProps,u!==C){var P=p.stateNode,F=hs(po.current);v=re(P,v,u,C,k,F),(p.updateQueue=v)&&vs(p)}},Jf=function(u,p,v,C){v!==C&&vs(p)};else if(Z){Iu=function(u,p,v,C){for(var k=p.child;k!==null;){if(k.tag===5){var P=k.stateNode;v&&C&&(P=ar(P,k.type,k.memoizedProps,k)),ce(u,P)}else if(k.tag===6)P=k.stateNode,v&&C&&(P=vr(P,k.memoizedProps,k)),ce(u,P);else if(k.tag!==4){if(k.tag===22&&k.memoizedState!==null)P=k.child,P!==null&&(P.return=k),Iu(u,k,!0,!0);else if(k.child!==null){k.child.return=k,k=k.child;continue}}if(k===p)break;for(;k.sibling===null;){if(k.return===null||k.return===p)return;k=k.return}k.sibling.return=k.return,k=k.sibling}};var aw=function(u,p,v,C){for(var k=p.child;k!==null;){if(k.tag===5){var P=k.stateNode;v&&C&&(P=ar(P,k.type,k.memoizedProps,k)),en(u,P)}else if(k.tag===6)P=k.stateNode,v&&C&&(P=vr(P,k.memoizedProps,k)),en(u,P);else if(k.tag!==4){if(k.tag===22&&k.memoizedState!==null)P=k.child,P!==null&&(P.return=k),aw(u,k,!0,!0);else if(k.child!==null){k.child.return=k,k=k.child;continue}}if(k===p)break;for(;k.sibling===null;){if(k.return===null||k.return===p)return;k=k.return}k.sibling.return=k.return,k=k.sibling}};Pu=function(u,p){var v=p.stateNode;if(!sw(u,p)){u=v.containerInfo;var C=pn(u);aw(C,p,!1,!1),v.pendingChildren=C,vs(p),un(u,C)}},Zf=function(u,p,v,C,k){var P=u.stateNode,F=u.memoizedProps;if((u=sw(u,p))&&F===C)p.stateNode=P;else{var ie=p.stateNode,ge=hs(po.current),Oe=null;F!==C&&(Oe=re(ie,v,F,C,k,ge)),u&&Oe===null?p.stateNode=P:(P=zn(P,Oe,v,F,C,p,u,ie),J(P,v,C,k,ge)&&vs(p),p.stateNode=P,u?vs(p):Iu(P,p,!1,!1))}},Jf=function(u,p,v,C){v!==C?(u=hs(Ei.current),v=hs(po.current),p.stateNode=L(C,u,v,p),vs(p)):p.stateNode=u.stateNode}}else Pu=function(){},Zf=function(){},Jf=function(){};function Eu(u,p){if(!mn)switch(u.tailMode){case"hidden":p=u.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?u.tail=null:v.sibling=null;break;case"collapsed":v=u.tail;for(var C=null;v!==null;)v.alternate!==null&&(C=v),v=v.sibling;C===null?p||u.tail===null?u.tail=null:u.tail.sibling=null:C.sibling=null}}function cr(u){var p=u.alternate!==null&&u.alternate.child===u.child,v=0,C=0;if(p)for(var k=u.child;k!==null;)v|=k.lanes|k.childLanes,C|=k.subtreeFlags&14680064,C|=k.flags&14680064,k.return=u,k=k.sibling;else for(k=u.child;k!==null;)v|=k.lanes|k.childLanes,C|=k.subtreeFlags,C|=k.flags,k.return=u,k=k.sibling;return u.subtreeFlags|=C,u.childLanes=v,p}function KD(u,p,v){var C=p.pendingProps;switch(_0(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cr(p),null;case 1:return Pr(p.type)&&If(),cr(p),null;case 3:return v=p.stateNode,Mi(),_t($n),_t(an),B0(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(u===null||u.child===null)&&(Nf(p)?vs(p):u===null||u.memoizedState.isDehydrated&&!(p.flags&256)||(p.flags|=1024,Wo!==null&&(yv(Wo),Wo=null))),Pu(u,p),cr(p),null;case 5:F0(p),v=hs(Ei.current);var k=p.type;if(u!==null&&p.stateNode!=null)Zf(u,p,k,C,v),u.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!C){if(p.stateNode===null)throw Error(l(166));return cr(p),null}if(u=hs(po.current),Nf(p)){if(!me)throw Error(l(175));u=Wn(p.stateNode,p.type,p.memoizedProps,v,u,p,!xu),p.updateQueue=u,u!==null&&vs(p)}else{var P=ae(k,C,v,u,p);Iu(P,p,!1,!1),p.stateNode=P,J(P,k,C,v,u)&&vs(p)}p.ref!==null&&(p.flags|=512,p.flags|=2097152)}return cr(p),null;case 6:if(u&&p.stateNode!=null)Jf(u,p,u.memoizedProps,C);else{if(typeof C!="string"&&p.stateNode===null)throw Error(l(166));if(u=hs(Ei.current),v=hs(po.current),Nf(p)){if(!me)throw Error(l(176));if(u=p.stateNode,v=p.memoizedProps,(C=jt(u,v,p,!xu))&&(k=Xr,k!==null))switch(k.tag){case 3:_f(k.stateNode.containerInfo,u,v,(k.mode&1)!==0);break;case 5:Ci(k.type,k.memoizedProps,k.stateNode,u,v,(k.mode&1)!==0)}C&&vs(p)}else p.stateNode=L(C,u,v,p)}return cr(p),null;case 13:if(_t(wn),C=p.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(mn&&uo!==null&&p.mode&1&&!(p.flags&128))iC(),ji(),p.flags|=98560,k=!1;else if(k=Nf(p),C!==null&&C.dehydrated!==null){if(u===null){if(!k)throw Error(l(318));if(!me)throw Error(l(344));if(k=p.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(l(317));Ea(k,p)}else ji(),!(p.flags&128)&&(p.memoizedState=null),p.flags|=4;cr(p),k=!1}else Wo!==null&&(yv(Wo),Wo=null),k=!0;if(!k)return p.flags&65536?p:null}return p.flags&128?(p.lanes=v,p):(v=C!==null,v!==(u!==null&&u.memoizedState!==null)&&v&&(p.child.flags|=8192,p.mode&1&&(u===null||wn.current&1?Gn===0&&(Gn=3):wv())),p.updateQueue!==null&&(p.flags|=4),cr(p),null);case 4:return Mi(),Pu(u,p),u===null&&de(p.stateNode.containerInfo),cr(p),null;case 10:return D0(p.type._context),cr(p),null;case 17:return Pr(p.type)&&If(),cr(p),null;case 19:if(_t(wn),k=p.memoizedState,k===null)return cr(p),null;if(C=(p.flags&128)!==0,P=k.rendering,P===null)if(C)Eu(k,!1);else{if(Gn!==0||u!==null&&u.flags&128)for(u=p.child;u!==null;){if(P=Vf(u),P!==null){for(p.flags|=128,Eu(k,!1),u=P.updateQueue,u!==null&&(p.updateQueue=u,p.flags|=4),p.subtreeFlags=0,u=v,v=p.child;v!==null;)C=v,k=u,C.flags&=14680066,P=C.alternate,P===null?(C.childLanes=0,C.lanes=k,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=P.childLanes,C.lanes=P.lanes,C.child=P.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=P.memoizedProps,C.memoizedState=P.memoizedState,C.updateQueue=P.updateQueue,C.type=P.type,k=P.dependencies,C.dependencies=k===null?null:{lanes:k.lanes,firstContext:k.firstContext}),v=v.sibling;return Rt(wn,wn.current&1|2),p.child}u=u.sibling}k.tail!==null&&Qn()>gv&&(p.flags|=128,C=!0,Eu(k,!1),p.lanes=4194304)}else{if(!C)if(u=Vf(P),u!==null){if(p.flags|=128,C=!0,u=u.updateQueue,u!==null&&(p.updateQueue=u,p.flags|=4),Eu(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!mn)return cr(p),null}else 2*Qn()-k.renderingStartTime>gv&&v!==1073741824&&(p.flags|=128,C=!0,Eu(k,!1),p.lanes=4194304);k.isBackwards?(P.sibling=p.child,p.child=P):(u=k.last,u!==null?u.sibling=P:p.child=P,k.last=P)}return k.tail!==null?(p=k.tail,k.rendering=p,k.tail=p.sibling,k.renderingStartTime=Qn(),p.sibling=null,u=wn.current,Rt(wn,C?u&1|2:u&1),p):(cr(p),null);case 22:case 23:return Cv(),v=p.memoizedState!==null,u!==null&&u.memoizedState!==null!==v&&(p.flags|=8192),v&&p.mode&1?Qr&1073741824&&(cr(p),X&&p.subtreeFlags&6&&(p.flags|=8192)):cr(p),null;case 24:return null;case 25:return null}throw Error(l(156,p.tag))}function qD(u,p){switch(_0(p),p.tag){case 1:return Pr(p.type)&&If(),u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 3:return Mi(),_t($n),_t(an),B0(),u=p.flags,u&65536&&!(u&128)?(p.flags=u&-65537|128,p):null;case 5:return F0(p),null;case 13:if(_t(wn),u=p.memoizedState,u!==null&&u.dehydrated!==null){if(p.alternate===null)throw Error(l(340));ji()}return u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 19:return _t(wn),null;case 4:return Mi(),null;case 10:return D0(p.type._context),null;case 22:case 23:return Cv(),null;case 24:return null;default:return null}}var ep=!1,ur=!1,XD=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function Di(u,p){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){hn(u,p,C)}else v.current=null}function ov(u,p,v){try{v()}catch(C){hn(u,p,C)}}var lw=!1;function QD(u,p){for(ee(u.containerInfo),Ke=p;Ke!==null;)if(u=Ke,p=u.child,(u.subtreeFlags&1028)!==0&&p!==null)p.return=u,Ke=p;else for(;Ke!==null;){u=Ke;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,F=P.getSnapshotBeforeUpdate(u.elementType===u.type?C:Vo(u.type,C),k);P.__reactInternalSnapshotBeforeUpdate=F}break;case 3:X&&Ht(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(ie){hn(u,u.return,ie)}if(p=u.sibling,p!==null){p.return=u.return,Ke=p;break}Ke=u.return}return v=lw,lw=!1,v}function Mu(u,p,v){var C=p.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&&ov(p,v,P)}k=k.next}while(k!==C)}}function tp(u,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var v=p=p.next;do{if((v.tag&u)===u){var C=v.create;v.destroy=C()}v=v.next}while(v!==p)}}function sv(u){var p=u.ref;if(p!==null){var v=u.stateNode;switch(u.tag){case 5:u=Q(v);break;default:u=v}typeof p=="function"?p(u):p.current=u}}function iw(u){var p=u.alternate;p!==null&&(u.alternate=null,iw(p)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(p=u.stateNode,p!==null&&we(p)),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 cw(u){return u.tag===5||u.tag===3||u.tag===4}function uw(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||cw(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 av(u,p,v){var C=u.tag;if(C===5||C===6)u=u.stateNode,p?kt(v,u,p):Ue(v,u);else if(C!==4&&(u=u.child,u!==null))for(av(u,p,v),u=u.sibling;u!==null;)av(u,p,v),u=u.sibling}function lv(u,p,v){var C=u.tag;if(C===5||C===6)u=u.stateNode,p?Ne(v,u,p):ye(v,u);else if(C!==4&&(u=u.child,u!==null))for(lv(u,p,v),u=u.sibling;u!==null;)lv(u,p,v),u=u.sibling}var nr=null,Uo=!1;function bs(u,p,v){for(v=v.child;v!==null;)iv(u,p,v),v=v.sibling}function iv(u,p,v){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(Df,v)}catch{}switch(v.tag){case 5:ur||Di(v,p);case 6:if(X){var C=nr,k=Uo;nr=null,bs(u,p,v),nr=C,Uo=k,nr!==null&&(Uo?Ve(nr,v.stateNode):Se(nr,v.stateNode))}else bs(u,p,v);break;case 18:X&&nr!==null&&(Uo?Vn(nr,v.stateNode):g0(nr,v.stateNode));break;case 4:X?(C=nr,k=Uo,nr=v.stateNode.containerInfo,Uo=!0,bs(u,p,v),nr=C,Uo=k):(Z&&(C=v.stateNode.containerInfo,k=pn(C),Wt(C,k)),bs(u,p,v));break;case 0:case 11:case 14:case 15:if(!ur&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,F=P.destroy;P=P.tag,F!==void 0&&(P&2||P&4)&&ov(v,p,F),k=k.next}while(k!==C)}bs(u,p,v);break;case 1:if(!ur&&(Di(v,p),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ie){hn(v,p,ie)}bs(u,p,v);break;case 21:bs(u,p,v);break;case 22:v.mode&1?(ur=(C=ur)||v.memoizedState!==null,bs(u,p,v),ur=C):bs(u,p,v);break;default:bs(u,p,v)}}function dw(u){var p=u.updateQueue;if(p!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new XD),p.forEach(function(C){var k=sR.bind(null,u,C);v.has(C)||(v.add(C),C.then(k,k))})}}function Go(u,p){var v=p.deletions;if(v!==null)for(var C=0;C<v.length;C++){var k=v[C];try{var P=u,F=p;if(X){var ie=F;e:for(;ie!==null;){switch(ie.tag){case 5:nr=ie.stateNode,Uo=!1;break e;case 3:nr=ie.stateNode.containerInfo,Uo=!0;break e;case 4:nr=ie.stateNode.containerInfo,Uo=!0;break e}ie=ie.return}if(nr===null)throw Error(l(160));iv(P,F,k),nr=null,Uo=!1}else iv(P,F,k);var ge=k.alternate;ge!==null&&(ge.return=null),k.return=null}catch(Oe){hn(k,p,Oe)}}if(p.subtreeFlags&12854)for(p=p.child;p!==null;)fw(p,u),p=p.sibling}function fw(u,p){var v=u.alternate,C=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Go(p,u),xs(u),C&4){try{Mu(3,u,u.return),tp(3,u)}catch(He){hn(u,u.return,He)}try{Mu(5,u,u.return)}catch(He){hn(u,u.return,He)}}break;case 1:Go(p,u),xs(u),C&512&&v!==null&&Di(v,v.return);break;case 5:if(Go(p,u),xs(u),C&512&&v!==null&&Di(v,v.return),X){if(u.flags&32){var k=u.stateNode;try{Ge(k)}catch(He){hn(u,u.return,He)}}if(C&4&&(k=u.stateNode,k!=null)){var P=u.memoizedProps;if(v=v!==null?v.memoizedProps:P,C=u.type,p=u.updateQueue,u.updateQueue=null,p!==null)try{Pe(k,p,C,v,P,u)}catch(He){hn(u,u.return,He)}}}break;case 6:if(Go(p,u),xs(u),C&4&&X){if(u.stateNode===null)throw Error(l(162));k=u.stateNode,P=u.memoizedProps,v=v!==null?v.memoizedProps:P;try{st(k,v,P)}catch(He){hn(u,u.return,He)}}break;case 3:if(Go(p,u),xs(u),C&4){if(X&&me&&v!==null&&v.memoizedState.isDehydrated)try{jf(p.containerInfo)}catch(He){hn(u,u.return,He)}if(Z){k=p.containerInfo,P=p.pendingChildren;try{Wt(k,P)}catch(He){hn(u,u.return,He)}}}break;case 4:if(Go(p,u),xs(u),C&4&&Z){P=u.stateNode,k=P.containerInfo,P=P.pendingChildren;try{Wt(k,P)}catch(He){hn(u,u.return,He)}}break;case 13:Go(p,u),xs(u),k=u.child,k.flags&8192&&(P=k.memoizedState!==null,k.stateNode.isHidden=P,!P||k.alternate!==null&&k.alternate.memoizedState!==null||(hv=Qn())),C&4&&dw(u);break;case 22:var F=v!==null&&v.memoizedState!==null;if(u.mode&1?(ur=(v=ur)||F,Go(p,u),ur=v):Go(p,u),xs(u),C&8192){if(v=u.memoizedState!==null,(u.stateNode.isHidden=v)&&!F&&u.mode&1)for(Ke=u,C=u.child;C!==null;){for(p=Ke=C;Ke!==null;){F=Ke;var ie=F.child;switch(F.tag){case 0:case 11:case 14:case 15:Mu(4,F,F.return);break;case 1:Di(F,F.return);var ge=F.stateNode;if(typeof ge.componentWillUnmount=="function"){var Oe=F,Ye=F.return;try{var xt=Oe;ge.props=xt.memoizedProps,ge.state=xt.memoizedState,ge.componentWillUnmount()}catch(He){hn(Oe,Ye,He)}}break;case 5:Di(F,F.return);break;case 22:if(F.memoizedState!==null){hw(p);continue}}ie!==null?(ie.return=F,Ke=ie):hw(p)}C=C.sibling}if(X){e:if(C=null,X)for(p=u;;){if(p.tag===5){if(C===null){C=p;try{k=p.stateNode,v?Le(k):fn(p.stateNode,p.memoizedProps)}catch(He){hn(u,u.return,He)}}}else if(p.tag===6){if(C===null)try{P=p.stateNode,v?bt(P):Bt(P,p.memoizedProps)}catch(He){hn(u,u.return,He)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===u)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break e;for(;p.sibling===null;){if(p.return===null||p.return===u)break e;C===p&&(C=null),p=p.return}C===p&&(C=null),p.sibling.return=p.return,p=p.sibling}}}break;case 19:Go(p,u),xs(u),C&4&&dw(u);break;case 21:break;default:Go(p,u),xs(u)}}function xs(u){var p=u.flags;if(p&2){try{if(X){e:{for(var v=u.return;v!==null;){if(cw(v)){var C=v;break e}v=v.return}throw Error(l(160))}switch(C.tag){case 5:var k=C.stateNode;C.flags&32&&(Ge(k),C.flags&=-33);var P=uw(u);lv(u,P,k);break;case 3:case 4:var F=C.stateNode.containerInfo,ie=uw(u);av(u,ie,F);break;default:throw Error(l(161))}}}catch(ge){hn(u,u.return,ge)}u.flags&=-3}p&4096&&(u.flags&=-4097)}function YD(u,p,v){Ke=u,pw(u)}function pw(u,p,v){for(var C=(u.mode&1)!==0;Ke!==null;){var k=Ke,P=k.child;if(k.tag===22&&C){var F=k.memoizedState!==null||ep;if(!F){var ie=k.alternate,ge=ie!==null&&ie.memoizedState!==null||ur;ie=ep;var Oe=ur;if(ep=F,(ur=ge)&&!Oe)for(Ke=k;Ke!==null;)F=Ke,ge=F.child,F.tag===22&&F.memoizedState!==null?gw(k):ge!==null?(ge.return=F,Ke=ge):gw(k);for(;P!==null;)Ke=P,pw(P),P=P.sibling;Ke=k,ep=ie,ur=Oe}mw(u)}else k.subtreeFlags&8772&&P!==null?(P.return=k,Ke=P):mw(u)}}function mw(u){for(;Ke!==null;){var p=Ke;if(p.flags&8772){var v=p.alternate;try{if(p.flags&8772)switch(p.tag){case 0:case 11:case 15:ur||tp(5,p);break;case 1:var C=p.stateNode;if(p.flags&4&&!ur)if(v===null)C.componentDidMount();else{var k=p.elementType===p.type?v.memoizedProps:Vo(p.type,v.memoizedProps);C.componentDidUpdate(k,v.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var P=p.updateQueue;P!==null&&pC(p,P,C);break;case 3:var F=p.updateQueue;if(F!==null){if(v=null,p.child!==null)switch(p.child.tag){case 5:v=Q(p.child.stateNode);break;case 1:v=p.child.stateNode}pC(p,F,v)}break;case 5:var ie=p.stateNode;v===null&&p.flags&4&&mt(ie,p.type,p.memoizedProps,p);break;case 6:break;case 4:break;case 12:break;case 13:if(me&&p.memoizedState===null){var ge=p.alternate;if(ge!==null){var Oe=ge.memoizedState;if(Oe!==null){var Ye=Oe.dehydrated;Ye!==null&&h0(Ye)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(l(163))}ur||p.flags&512&&sv(p)}catch(xt){hn(p,p.return,xt)}}if(p===u){Ke=null;break}if(v=p.sibling,v!==null){v.return=p.return,Ke=v;break}Ke=p.return}}function hw(u){for(;Ke!==null;){var p=Ke;if(p===u){Ke=null;break}var v=p.sibling;if(v!==null){v.return=p.return,Ke=v;break}Ke=p.return}}function gw(u){for(;Ke!==null;){var p=Ke;try{switch(p.tag){case 0:case 11:case 15:var v=p.return;try{tp(4,p)}catch(ge){hn(p,v,ge)}break;case 1:var C=p.stateNode;if(typeof C.componentDidMount=="function"){var k=p.return;try{C.componentDidMount()}catch(ge){hn(p,k,ge)}}var P=p.return;try{sv(p)}catch(ge){hn(p,P,ge)}break;case 5:var F=p.return;try{sv(p)}catch(ge){hn(p,F,ge)}}}catch(ge){hn(p,p.return,ge)}if(p===u){Ke=null;break}var ie=p.sibling;if(ie!==null){ie.return=p.return,Ke=ie;break}Ke=p.return}}var np=0,rp=1,op=2,sp=3,ap=4;if(typeof Symbol=="function"&&Symbol.for){var Ou=Symbol.for;np=Ou("selector.component"),rp=Ou("selector.has_pseudo_class"),op=Ou("selector.role"),sp=Ou("selector.test_id"),ap=Ou("selector.text")}function cv(u){var p=ve(u);if(p!=null){if(typeof p.memoizedProps["data-testname"]!="string")throw Error(l(364));return p}if(u=vt(u),u===null)throw Error(l(362));return u.stateNode.current}function uv(u,p){switch(p.$$typeof){case np:if(u.type===p.value)return!0;break;case rp:e:{p=p.value,u=[u,0];for(var v=0;v<u.length;){var C=u[v++],k=u[v++],P=p[k];if(C.tag!==5||!Ce(C)){for(;P!=null&&uv(C,P);)k++,P=p[k];if(k===p.length){p=!0;break e}else for(C=C.child;C!==null;)u.push(C,k),C=C.sibling}}p=!1}return p;case op:if(u.tag===5&&Me(u.stateNode,p.value))return!0;break;case ap:if((u.tag===5||u.tag===6)&&(u=ot(u),u!==null&&0<=u.indexOf(p.value)))return!0;break;case sp:if(u.tag===5&&(u=u.memoizedProps["data-testname"],typeof u=="string"&&u.toLowerCase()===p.value.toLowerCase()))return!0;break;default:throw Error(l(365))}return!1}function dv(u){switch(u.$$typeof){case np:return"<"+(D(u.value)||"Unknown")+">";case rp:return":has("+(dv(u)||"")+")";case op:return'[role="'+u.value+'"]';case ap:return'"'+u.value+'"';case sp:return'[data-testname="'+u.value+'"]';default:throw Error(l(365))}}function vw(u,p){var v=[];u=[u,0];for(var C=0;C<u.length;){var k=u[C++],P=u[C++],F=p[P];if(k.tag!==5||!Ce(k)){for(;F!=null&&uv(k,F);)P++,F=p[P];if(P===p.length)v.push(k);else for(k=k.child;k!==null;)u.push(k,P),k=k.sibling}}return v}function fv(u,p){if(!$e)throw Error(l(363));u=cv(u),u=vw(u,p),p=[],u=Array.from(u);for(var v=0;v<u.length;){var C=u[v++];if(C.tag===5)Ce(C)||p.push(C.stateNode);else for(C=C.child;C!==null;)u.push(C),C=C.sibling}return p}var ZD=Math.ceil,lp=c.ReactCurrentDispatcher,pv=c.ReactCurrentOwner,Dn=c.ReactCurrentBatchConfig,It=0,Zn=null,Ln=null,rr=0,Qr=0,Ri=Dt(0),Gn=0,Du=null,Ol=0,ip=0,mv=0,Ru=null,Mr=null,hv=0,gv=1/0,qs=null;function Ai(){gv=Qn()+500}var cp=!1,vv=null,Ra=null,up=!1,Aa=null,dp=0,Au=0,bv=null,fp=-1,pp=0;function dr(){return It&6?Qn():fp!==-1?fp:fp=Qn()}function Ta(u){return u.mode&1?It&2&&rr!==0?rr&-rr:AD.transition!==null?(pp===0&&(pp=eC()),pp):(u=Lt,u!==0?u:ke()):1}function ho(u,p,v,C){if(50<Au)throw Au=0,bv=null,Error(l(185));bu(u,v,C),(!(It&2)||u!==Zn)&&(u===Zn&&(!(It&2)&&(ip|=v),Gn===4&&Na(u,rr)),Or(u,C),v===1&&It===0&&!(p.mode&1)&&(Ai(),Rf&&ps()))}function Or(u,p){var v=u.callbackNode;jD(u,p);var C=Of(u,u===Zn?rr:0);if(C===0)v!==null&&nC(v),u.callbackNode=null,u.callbackPriority=0;else if(p=C&-C,u.callbackPriority!==p){if(v!=null&&nC(v),p===1)u.tag===0?RD(xw.bind(null,u)):rC(xw.bind(null,u)),Re?Qe(function(){!(It&6)&&ps()}):C0(w0,ps),v=null;else{switch(tC(C)){case 1:v=w0;break;case 4:v=ED;break;case 16:v=S0;break;case 536870912:v=MD;break;default:v=S0}v=Pw(v,bw.bind(null,u))}u.callbackPriority=p,u.callbackNode=v}}function bw(u,p){if(fp=-1,pp=0,It&6)throw Error(l(327));var v=u.callbackNode;if(Al()&&u.callbackNode!==v)return null;var C=Of(u,u===Zn?rr:0);if(C===0)return null;if(C&30||C&u.expiredLanes||p)p=mp(u,C);else{p=C;var k=It;It|=2;var P=ww();(Zn!==u||rr!==p)&&(qs=null,Ai(),Dl(u,p));do try{tR();break}catch(ie){Cw(u,ie)}while(1);O0(),lp.current=P,It=k,Ln!==null?p=0:(Zn=null,rr=0,p=Gn)}if(p!==0){if(p===2&&(k=b0(u),k!==0&&(C=k,p=xv(u,k))),p===1)throw v=Du,Dl(u,0),Na(u,C),Or(u,Qn()),v;if(p===6)Na(u,C);else{if(k=u.current.alternate,!(C&30)&&!JD(k)&&(p=mp(u,C),p===2&&(P=b0(u),P!==0&&(C=P,p=xv(u,P))),p===1))throw v=Du,Dl(u,0),Na(u,C),Or(u,Qn()),v;switch(u.finishedWork=k,u.finishedLanes=C,p){case 0:case 1:throw Error(l(345));case 2:Rl(u,Mr,qs);break;case 3:if(Na(u,C),(C&130023424)===C&&(p=hv+500-Qn(),10<p)){if(Of(u,0)!==0)break;if(k=u.suspendedLanes,(k&C)!==C){dr(),u.pingedLanes|=u.suspendedLanes&k;break}u.timeoutHandle=K(Rl.bind(null,u,Mr,qs),p);break}Rl(u,Mr,qs);break;case 4:if(Na(u,C),(C&4194240)===C)break;for(p=u.eventTimes,k=-1;0<C;){var F=31-Bo(C);P=1<<F,F=p[F],F>k&&(k=F),C&=~P}if(C=k,C=Qn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*ZD(C/1960))-C,10<C){u.timeoutHandle=K(Rl.bind(null,u,Mr,qs),C);break}Rl(u,Mr,qs);break;case 5:Rl(u,Mr,qs);break;default:throw Error(l(329))}}}return Or(u,Qn()),u.callbackNode===v?bw.bind(null,u):null}function xv(u,p){var v=Ru;return u.current.memoizedState.isDehydrated&&(Dl(u,p).flags|=256),u=mp(u,p),u!==2&&(p=Mr,Mr=v,p!==null&&yv(p)),u}function yv(u){Mr===null?Mr=u:Mr.push.apply(Mr,u)}function JD(u){for(var p=u;;){if(p.flags&16384){var v=p.updateQueue;if(v!==null&&(v=v.stores,v!==null))for(var C=0;C<v.length;C++){var k=v[C],P=k.getSnapshot;k=k.value;try{if(!Ho(P(),k))return!1}catch{return!1}}}if(v=p.child,p.subtreeFlags&16384&&v!==null)v.return=p,p=v;else{if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function Na(u,p){for(p&=~mv,p&=~ip,u.suspendedLanes|=p,u.pingedLanes&=~p,u=u.expirationTimes;0<p;){var v=31-Bo(p),C=1<<v;u[v]=-1,p&=~C}}function xw(u){if(It&6)throw Error(l(327));Al();var p=Of(u,0);if(!(p&1))return Or(u,Qn()),null;var v=mp(u,p);if(u.tag!==0&&v===2){var C=b0(u);C!==0&&(p=C,v=xv(u,C))}if(v===1)throw v=Du,Dl(u,0),Na(u,p),Or(u,Qn()),v;if(v===6)throw Error(l(345));return u.finishedWork=u.current.alternate,u.finishedLanes=p,Rl(u,Mr,qs),Or(u,Qn()),null}function yw(u){Aa!==null&&Aa.tag===0&&!(It&6)&&Al();var p=It;It|=1;var v=Dn.transition,C=Lt;try{if(Dn.transition=null,Lt=1,u)return u()}finally{Lt=C,Dn.transition=v,It=p,!(It&6)&&ps()}}function Cv(){Qr=Ri.current,_t(Ri)}function Dl(u,p){u.finishedWork=null,u.finishedLanes=0;var v=u.timeoutHandle;if(v!==z&&(u.timeoutHandle=z,ne(v)),Ln!==null)for(v=Ln.return;v!==null;){var C=v;switch(_0(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&If();break;case 3:Mi(),_t($n),_t(an),B0();break;case 5:F0(C);break;case 4:Mi();break;case 13:_t(wn);break;case 19:_t(wn);break;case 10:D0(C.type._context);break;case 22:case 23:Cv()}v=v.return}if(Zn=u,Ln=u=$a(u.current,null),rr=Qr=p,Gn=0,Du=null,mv=ip=Ol=0,Mr=Ru=null,El!==null){for(p=0;p<El.length;p++)if(v=El[p],C=v.interleaved,C!==null){v.interleaved=null;var k=C.next,P=v.pending;if(P!==null){var F=P.next;P.next=k,C.next=F}v.pending=C}El=null}return u}function Cw(u,p){do{var v=Ln;try{if(O0(),Uf.current=Xf,Gf){for(var C=Sn.memoizedState;C!==null;){var k=C.queue;k!==null&&(k.pending=null),C=C.next}Gf=!1}if(Ml=0,Yn=Un=Sn=null,Su=!1,ku=0,pv.current=null,v===null||v.return===null){Gn=1,Du=p,Ln=null;break}e:{var P=u,F=v.return,ie=v,ge=p;if(p=rr,ie.flags|=32768,ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var Oe=ge,Ye=ie,xt=Ye.tag;if(!(Ye.mode&1)&&(xt===0||xt===11||xt===15)){var He=Ye.alternate;He?(Ye.updateQueue=He.updateQueue,Ye.memoizedState=He.memoizedState,Ye.lanes=He.lanes):(Ye.updateQueue=null,Ye.memoizedState=null)}var dn=GC(F);if(dn!==null){dn.flags&=-257,KC(dn,F,ie,P,p),dn.mode&1&&UC(P,Oe,p),p=dn,ge=Oe;var tn=p.updateQueue;if(tn===null){var Dr=new Set;Dr.add(ge),p.updateQueue=Dr}else tn.add(ge);break e}else{if(!(p&1)){UC(P,Oe,p),wv();break e}ge=Error(l(426))}}else if(mn&&ie.mode&1){var Xs=GC(F);if(Xs!==null){!(Xs.flags&65536)&&(Xs.flags|=256),KC(Xs,F,ie,P,p),E0(Oi(ge,ie));break e}}P=ge=Oi(ge,ie),Gn!==4&&(Gn=2),Ru===null?Ru=[P]:Ru.push(P),P=F;do{switch(P.tag){case 3:P.flags|=65536,p&=-p,P.lanes|=p;var he=WC(P,ge,p);fC(P,he);break e;case 1:ie=ge;var ue=P.type,xe=P.stateNode;if(!(P.flags&128)&&(typeof ue.getDerivedStateFromError=="function"||xe!==null&&typeof xe.componentDidCatch=="function"&&(Ra===null||!Ra.has(xe)))){P.flags|=65536,p&=-p,P.lanes|=p;var We=VC(P,ie,p);fC(P,We);break e}}P=P.return}while(P!==null)}kw(v)}catch(ct){p=ct,Ln===v&&v!==null&&(Ln=v=v.return);continue}break}while(1)}function ww(){var u=lp.current;return lp.current=Xf,u===null?Xf:u}function wv(){(Gn===0||Gn===3||Gn===2)&&(Gn=4),Zn===null||!(Ol&268435455)&&!(ip&268435455)||Na(Zn,rr)}function mp(u,p){var v=It;It|=2;var C=ww();(Zn!==u||rr!==p)&&(qs=null,Dl(u,p));do try{eR();break}catch(k){Cw(u,k)}while(1);if(O0(),It=v,lp.current=C,Ln!==null)throw Error(l(261));return Zn=null,rr=0,Gn}function eR(){for(;Ln!==null;)Sw(Ln)}function tR(){for(;Ln!==null&&!ID();)Sw(Ln)}function Sw(u){var p=Iw(u.alternate,u,Qr);u.memoizedProps=u.pendingProps,p===null?kw(u):Ln=p,pv.current=null}function kw(u){var p=u;do{var v=p.alternate;if(u=p.return,p.flags&32768){if(v=qD(v,p),v!==null){v.flags&=32767,Ln=v;return}if(u!==null)u.flags|=32768,u.subtreeFlags=0,u.deletions=null;else{Gn=6,Ln=null;return}}else if(v=KD(v,p,Qr),v!==null){Ln=v;return}if(p=p.sibling,p!==null){Ln=p;return}Ln=p=u}while(p!==null);Gn===0&&(Gn=5)}function Rl(u,p,v){var C=Lt,k=Dn.transition;try{Dn.transition=null,Lt=1,nR(u,p,v,C)}finally{Dn.transition=k,Lt=C}return null}function nR(u,p,v,C){do Al();while(Aa!==null);if(It&6)throw Error(l(327));v=u.finishedWork;var k=u.finishedLanes;if(v===null)return null;if(u.finishedWork=null,u.finishedLanes=0,v===u.current)throw Error(l(177));u.callbackNode=null,u.callbackPriority=0;var P=v.lanes|v.childLanes;if(_D(u,P),u===Zn&&(Ln=Zn=null,rr=0),!(v.subtreeFlags&2064)&&!(v.flags&2064)||up||(up=!0,Pw(S0,function(){return Al(),null})),P=(v.flags&15990)!==0,v.subtreeFlags&15990||P){P=Dn.transition,Dn.transition=null;var F=Lt;Lt=1;var ie=It;It|=4,pv.current=null,QD(u,v),fw(v,u),le(u.containerInfo),u.current=v,YD(v),PD(),It=ie,Lt=F,Dn.transition=P}else u.current=v;if(up&&(up=!1,Aa=u,dp=k),P=u.pendingLanes,P===0&&(Ra=null),OD(v.stateNode),Or(u,Qn()),p!==null)for(C=u.onRecoverableError,v=0;v<p.length;v++)k=p[v],C(k.value,{componentStack:k.stack,digest:k.digest});if(cp)throw cp=!1,u=vv,vv=null,u;return dp&1&&u.tag!==0&&Al(),P=u.pendingLanes,P&1?u===bv?Au++:(Au=0,bv=u):Au=0,ps(),null}function Al(){if(Aa!==null){var u=tC(dp),p=Dn.transition,v=Lt;try{if(Dn.transition=null,Lt=16>u?16:u,Aa===null)var C=!1;else{if(u=Aa,Aa=null,dp=0,It&6)throw Error(l(331));var k=It;for(It|=4,Ke=u.current;Ke!==null;){var P=Ke,F=P.child;if(Ke.flags&16){var ie=P.deletions;if(ie!==null){for(var ge=0;ge<ie.length;ge++){var Oe=ie[ge];for(Ke=Oe;Ke!==null;){var Ye=Ke;switch(Ye.tag){case 0:case 11:case 15:Mu(8,Ye,P)}var xt=Ye.child;if(xt!==null)xt.return=Ye,Ke=xt;else for(;Ke!==null;){Ye=Ke;var He=Ye.sibling,dn=Ye.return;if(iw(Ye),Ye===Oe){Ke=null;break}if(He!==null){He.return=dn,Ke=He;break}Ke=dn}}}var tn=P.alternate;if(tn!==null){var Dr=tn.child;if(Dr!==null){tn.child=null;do{var Xs=Dr.sibling;Dr.sibling=null,Dr=Xs}while(Dr!==null)}}Ke=P}}if(P.subtreeFlags&2064&&F!==null)F.return=P,Ke=F;else e:for(;Ke!==null;){if(P=Ke,P.flags&2048)switch(P.tag){case 0:case 11:case 15:Mu(9,P,P.return)}var he=P.sibling;if(he!==null){he.return=P.return,Ke=he;break e}Ke=P.return}}var ue=u.current;for(Ke=ue;Ke!==null;){F=Ke;var xe=F.child;if(F.subtreeFlags&2064&&xe!==null)xe.return=F,Ke=xe;else e:for(F=ue;Ke!==null;){if(ie=Ke,ie.flags&2048)try{switch(ie.tag){case 0:case 11:case 15:tp(9,ie)}}catch(ct){hn(ie,ie.return,ct)}if(ie===F){Ke=null;break e}var We=ie.sibling;if(We!==null){We.return=ie.return,Ke=We;break e}Ke=ie.return}}if(It=k,ps(),fs&&typeof fs.onPostCommitFiberRoot=="function")try{fs.onPostCommitFiberRoot(Df,u)}catch{}C=!0}return C}finally{Lt=v,Dn.transition=p}}return!1}function jw(u,p,v){p=Oi(v,p),p=WC(u,p,1),u=Da(u,p,1),p=dr(),u!==null&&(bu(u,1,p),Or(u,p))}function hn(u,p,v){if(u.tag===3)jw(u,u,v);else for(;p!==null;){if(p.tag===3){jw(p,u,v);break}else if(p.tag===1){var C=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(Ra===null||!Ra.has(C))){u=Oi(v,u),u=VC(p,u,1),p=Da(p,u,1),u=dr(),p!==null&&(bu(p,1,u),Or(p,u));break}}p=p.return}}function rR(u,p,v){var C=u.pingCache;C!==null&&C.delete(p),p=dr(),u.pingedLanes|=u.suspendedLanes&v,Zn===u&&(rr&v)===v&&(Gn===4||Gn===3&&(rr&130023424)===rr&&500>Qn()-hv?Dl(u,0):mv|=v),Or(u,p)}function _w(u,p){p===0&&(u.mode&1?(p=Mf,Mf<<=1,!(Mf&130023424)&&(Mf=4194304)):p=1);var v=dr();u=ms(u,p),u!==null&&(bu(u,p,v),Or(u,v))}function oR(u){var p=u.memoizedState,v=0;p!==null&&(v=p.retryLane),_w(u,v)}function sR(u,p){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(l(314))}C!==null&&C.delete(p),_w(u,v)}var Iw;Iw=function(u,p,v){if(u!==null)if(u.memoizedProps!==p.pendingProps||$n.current)Er=!0;else{if(!(u.lanes&v)&&!(p.flags&128))return Er=!1,GD(u,p,v);Er=!!(u.flags&131072)}else Er=!1,mn&&p.flags&1048576&&oC(p,Tf,p.index);switch(p.lanes=0,p.tag){case 2:var C=p.type;Yf(u,p),u=p.pendingProps;var k=wi(p,an.current);Ii(p,v),k=V0(null,p,C,u,k,v);var P=U0();return p.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,Pr(C)?(P=!0,Pf(p)):P=!1,p.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,T0(p),k.updater=Hf,p.stateNode=k,k._reactInternals=p,$0(p,C,u,v),p=J0(null,p,C,!0,P,v)):(p.tag=0,mn&&P&&j0(p),xr(null,p,k,v),p=p.child),p;case 16:C=p.elementType;e:{switch(Yf(u,p),u=p.pendingProps,k=C._init,C=k(C._payload),p.type=C,k=p.tag=lR(C),u=Vo(C,u),k){case 0:p=Z0(null,p,C,u,v);break e;case 1:p=JC(null,p,C,u,v);break e;case 11:p=qC(null,p,C,u,v);break e;case 14:p=XC(null,p,C,Vo(C.type,u),v);break e}throw Error(l(306,C,""))}return p;case 0:return C=p.type,k=p.pendingProps,k=p.elementType===C?k:Vo(C,k),Z0(u,p,C,k,v);case 1:return C=p.type,k=p.pendingProps,k=p.elementType===C?k:Vo(C,k),JC(u,p,C,k,v);case 3:e:{if(ew(p),u===null)throw Error(l(387));C=p.pendingProps,P=p.memoizedState,k=P.element,dC(u,p),Bf(p,C,null,v);var F=p.memoizedState;if(C=F.element,me&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:F.cache,pendingSuspenseBoundaries:F.pendingSuspenseBoundaries,transitions:F.transitions},p.updateQueue.baseState=P,p.memoizedState=P,p.flags&256){k=Oi(Error(l(423)),p),p=tw(u,p,C,v,k);break e}else if(C!==k){k=Oi(Error(l(424)),p),p=tw(u,p,C,v,k);break e}else for(me&&(uo=Je(p.stateNode.containerInfo),Xr=p,mn=!0,Wo=null,xu=!1),v=yC(p,null,C,v),p.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(ji(),C===k){p=Ks(u,p,v);break e}xr(u,p,C,v)}p=p.child}return p;case 5:return CC(p),u===null&&P0(p),C=p.type,k=p.pendingProps,P=u!==null?u.memoizedProps:null,F=k.children,A(C,k)?F=null:P!==null&&A(C,P)&&(p.flags|=32),ZC(u,p),xr(u,p,F,v),p.child;case 6:return u===null&&P0(p),null;case 13:return nw(u,p,v);case 4:return L0(p,p.stateNode.containerInfo),C=p.pendingProps,u===null?p.child=Pi(p,null,C,v):xr(u,p,C,v),p.child;case 11:return C=p.type,k=p.pendingProps,k=p.elementType===C?k:Vo(C,k),qC(u,p,C,k,v);case 7:return xr(u,p,p.pendingProps,v),p.child;case 8:return xr(u,p,p.pendingProps.children,v),p.child;case 12:return xr(u,p,p.pendingProps.children,v),p.child;case 10:e:{if(C=p.type._context,k=p.pendingProps,P=p.memoizedProps,F=k.value,cC(p,C,F),P!==null)if(Ho(P.value,F)){if(P.children===k.children&&!$n.current){p=Ks(u,p,v);break e}}else for(P=p.child,P!==null&&(P.return=p);P!==null;){var ie=P.dependencies;if(ie!==null){F=P.child;for(var ge=ie.firstContext;ge!==null;){if(ge.context===C){if(P.tag===1){ge=Gs(-1,v&-v),ge.tag=2;var Oe=P.updateQueue;if(Oe!==null){Oe=Oe.shared;var Ye=Oe.pending;Ye===null?ge.next=ge:(ge.next=Ye.next,Ye.next=ge),Oe.pending=ge}}P.lanes|=v,ge=P.alternate,ge!==null&&(ge.lanes|=v),R0(P.return,v,p),ie.lanes|=v;break}ge=ge.next}}else if(P.tag===10)F=P.type===p.type?null:P.child;else if(P.tag===18){if(F=P.return,F===null)throw Error(l(341));F.lanes|=v,ie=F.alternate,ie!==null&&(ie.lanes|=v),R0(F,v,p),F=P.sibling}else F=P.child;if(F!==null)F.return=P;else for(F=P;F!==null;){if(F===p){F=null;break}if(P=F.sibling,P!==null){P.return=F.return,F=P;break}F=F.return}P=F}xr(u,p,k.children,v),p=p.child}return p;case 9:return k=p.type,C=p.pendingProps.children,Ii(p,v),k=fo(k),C=C(k),p.flags|=1,xr(u,p,C,v),p.child;case 14:return C=p.type,k=Vo(C,p.pendingProps),k=Vo(C.type,k),XC(u,p,C,k,v);case 15:return QC(u,p,p.type,p.pendingProps,v);case 17:return C=p.type,k=p.pendingProps,k=p.elementType===C?k:Vo(C,k),Yf(u,p),p.tag=1,Pr(C)?(u=!0,Pf(p)):u=!1,Ii(p,v),gC(p,C,k),$0(p,C,k,v),J0(null,p,C,!0,u,v);case 19:return ow(u,p,v);case 22:return YC(u,p,v)}throw Error(l(156,p.tag))};function Pw(u,p){return C0(u,p)}function aR(u,p,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=p,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 go(u,p,v,C){return new aR(u,p,v,C)}function Sv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function lR(u){if(typeof u=="function")return Sv(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===j)return 14}return 2}function $a(u,p){var v=u.alternate;return v===null?(v=go(u.tag,p,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=p,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,p=u.dependencies,v.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function hp(u,p,v,C,k,P){var F=2;if(C=u,typeof u=="function")Sv(u)&&(F=1);else if(typeof u=="string")F=5;else e:switch(u){case m:return Tl(v.children,k,P,p);case h:F=8,k|=8;break;case g:return u=go(12,v,p,k|2),u.elementType=g,u.lanes=P,u;case w:return u=go(13,v,p,k),u.elementType=w,u.lanes=P,u;case S:return u=go(19,v,p,k),u.elementType=S,u.lanes=P,u;case I:return gp(v,k,P,p);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case b:F=10;break e;case y:F=9;break e;case x:F=11;break e;case j:F=14;break e;case _:F=16,C=null;break e}throw Error(l(130,u==null?u:typeof u,""))}return p=go(F,v,p,k),p.elementType=u,p.type=C,p.lanes=P,p}function Tl(u,p,v,C){return u=go(7,u,C,p),u.lanes=v,u}function gp(u,p,v,C){return u=go(22,u,C,p),u.elementType=I,u.lanes=v,u.stateNode={isHidden:!1},u}function kv(u,p,v){return u=go(6,u,null,p),u.lanes=v,u}function jv(u,p,v){return p=go(4,u.children!==null?u.children:[],u.key,p),p.lanes=v,p.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},p}function iR(u,p,v,C,k){this.tag=p,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=z,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=x0(0),this.expirationTimes=x0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=x0(0),this.identifierPrefix=C,this.onRecoverableError=k,me&&(this.mutableSourceEagerHydrationData=null)}function Ew(u,p,v,C,k,P,F,ie,ge){return u=new iR(u,p,v,ie,ge),p===1?(p=1,P===!0&&(p|=8)):p=0,P=go(3,null,null,p),u.current=P,P.stateNode=u,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},T0(P),u}function Mw(u){if(!u)return lr;u=u._reactInternals;e:{if(N(u)!==u||u.tag!==1)throw Error(l(170));var p=u;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(Pr(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(l(171))}if(u.tag===1){var v=u.type;if(Pr(v))return Z2(u,v,p)}return p}function Ow(u){var p=u._reactInternals;if(p===void 0)throw typeof u.render=="function"?Error(l(188)):(u=Object.keys(u).join(","),Error(l(268,u)));return u=U(p),u===null?null:u.stateNode}function Dw(u,p){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v<p?v:p}}function vp(u,p){Dw(u,p),(u=u.alternate)&&Dw(u,p)}function cR(u){return u=U(u),u===null?null:u.stateNode}function uR(){return null}return n.attemptContinuousHydration=function(u){if(u.tag===13){var p=ms(u,134217728);if(p!==null){var v=dr();ho(p,u,134217728,v)}vp(u,134217728)}},n.attemptDiscreteHydration=function(u){if(u.tag===13){var p=ms(u,1);if(p!==null){var v=dr();ho(p,u,1,v)}vp(u,1)}},n.attemptHydrationAtCurrentPriority=function(u){if(u.tag===13){var p=Ta(u),v=ms(u,p);if(v!==null){var C=dr();ho(v,u,p,C)}vp(u,p)}},n.attemptSynchronousHydration=function(u){switch(u.tag){case 3:var p=u.stateNode;if(p.current.memoizedState.isDehydrated){var v=vu(p.pendingLanes);v!==0&&(y0(p,v|1),Or(p,Qn()),!(It&6)&&(Ai(),ps()))}break;case 13:yw(function(){var C=ms(u,1);if(C!==null){var k=dr();ho(C,u,1,k)}}),vp(u,1)}},n.batchedUpdates=function(u,p){var v=It;It|=1;try{return u(p)}finally{It=v,It===0&&(Ai(),Rf&&ps())}},n.createComponentSelector=function(u){return{$$typeof:np,value:u}},n.createContainer=function(u,p,v,C,k,P,F){return Ew(u,p,!1,null,v,C,k,P,F)},n.createHasPseudoClassSelector=function(u){return{$$typeof:rp,value:u}},n.createHydrationContainer=function(u,p,v,C,k,P,F,ie,ge){return u=Ew(v,C,!0,u,k,P,F,ie,ge),u.context=Mw(null),v=u.current,C=dr(),k=Ta(v),P=Gs(C,k),P.callback=p??null,Da(v,P,k),u.current.lanes=k,bu(u,k,C),Or(u,C),u},n.createPortal=function(u,p,v){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:C==null?null:""+C,children:u,containerInfo:p,implementation:v}},n.createRoleSelector=function(u){return{$$typeof:op,value:u}},n.createTestNameSelector=function(u){return{$$typeof:sp,value:u}},n.createTextSelector=function(u){return{$$typeof:ap,value:u}},n.deferredUpdates=function(u){var p=Lt,v=Dn.transition;try{return Dn.transition=null,Lt=16,u()}finally{Lt=p,Dn.transition=v}},n.discreteUpdates=function(u,p,v,C,k){var P=Lt,F=Dn.transition;try{return Dn.transition=null,Lt=1,u(p,v,C,k)}finally{Lt=P,Dn.transition=F,It===0&&Ai()}},n.findAllNodes=fv,n.findBoundingRects=function(u,p){if(!$e)throw Error(l(363));p=fv(u,p),u=[];for(var v=0;v<p.length;v++)u.push(it(p[v]));for(p=u.length-1;0<p;p--){v=u[p];for(var C=v.x,k=C+v.width,P=v.y,F=P+v.height,ie=p-1;0<=ie;ie--)if(p!==ie){var ge=u[ie],Oe=ge.x,Ye=Oe+ge.width,xt=ge.y,He=xt+ge.height;if(C>=Oe&&P>=xt&&k<=Ye&&F<=He){u.splice(p,1);break}else if(C!==Oe||v.width!==ge.width||He<P||xt>F){if(!(P!==xt||v.height!==ge.height||Ye<C||Oe>k)){Oe>C&&(ge.width+=Oe-C,ge.x=C),Ye<k&&(ge.width=k-Oe),u.splice(p,1);break}}else{xt>P&&(ge.height+=xt-P,ge.y=P),He<F&&(ge.height=F-xt),u.splice(p,1);break}}}return u},n.findHostInstance=Ow,n.findHostInstanceWithNoPortals=function(u){return u=T(u),u=u!==null?q(u):null,u===null?null:u.stateNode},n.findHostInstanceWithWarning=function(u){return Ow(u)},n.flushControlled=function(u){var p=It;It|=1;var v=Dn.transition,C=Lt;try{Dn.transition=null,Lt=1,u()}finally{Lt=C,Dn.transition=v,It=p,It===0&&(Ai(),ps())}},n.flushPassiveEffects=Al,n.flushSync=yw,n.focusWithin=function(u,p){if(!$e)throw Error(l(363));for(u=cv(u),p=vw(u,p),p=Array.from(p),u=0;u<p.length;){var v=p[u++];if(!Ce(v)){if(v.tag===5&&qe(v.stateNode))return!0;for(v=v.child;v!==null;)p.push(v),v=v.sibling}}return!1},n.getCurrentUpdatePriority=function(){return Lt},n.getFindAllNodesFailureDescription=function(u,p){if(!$e)throw Error(l(363));var v=0,C=[];u=[cv(u),0];for(var k=0;k<u.length;){var P=u[k++],F=u[k++],ie=p[F];if((P.tag!==5||!Ce(P))&&(uv(P,ie)&&(C.push(dv(ie)),F++,F>v&&(v=F)),F<p.length))for(P=P.child;P!==null;)u.push(P,F),P=P.sibling}if(v<p.length){for(u=[];v<p.length;v++)u.push(dv(p[v]));return`findAllNodes was able to match part of the selector:
`+(C.join(" > ")+`
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 Q(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:cR,findFiberByHostInstance:u.findFiberByHostInstance||uR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var p=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(p.isDisabled||!p.supportsFiber)u=!0;else{try{Df=p.inject(u),fs=p}catch{}u=!!p.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,p,v,C){if(!$e)throw Error(l(363));u=fv(u,p);var k=dt(u,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(u,p){var v=p._getVersion;v=v(p._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[p,v]:u.mutableSourceEagerHydrationData.push(p,v)},n.runWithPriority=function(u,p){var v=Lt;try{return Lt=u,p()}finally{Lt=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,p,v,C){var k=p.current,P=dr(),F=Ta(k);return v=Mw(v),p.context===null?p.context=v:p.pendingContext=v,p=Gs(P,F),p.payload={element:u},C=C===void 0?null:C,C!==null&&(p.callback=C),u=Da(k,p,F),u!==null&&(ho(u,k,F,P),zf(u,k,F)),F},n};cD.exports=k1e;var j1e=cD.exports;const _1e=Bd(j1e);var uD={exports:{}},bi={};/**
* @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.
*/bi.ConcurrentRoot=1;bi.ContinuousEventPriority=4;bi.DefaultEventPriority=16;bi.DiscreteEventPriority=1;bi.IdleEventPriority=536870912;bi.LegacyRoot=0;uD.exports=bi;var dD=uD.exports;const J_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let eI=!1,tI=!1;const X2=".react-konva-event",I1e=`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
`,P1e=`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
`,E1e={};function m0(e,t,n=E1e){if(!eI&&"zIndex"in t&&(console.warn(P1e),eI=!0),!tI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(I1e),tI=!0)}for(var s in n)if(!J_[s]){var l=s.slice(0,2)==="on",c=n[s]!==t[s];if(l&&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 f=!t.hasOwnProperty(s);f&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const b={};for(var s in t)if(!J_[s]){var l=s.slice(0,2)==="on",y=n[s]!==t[s];if(l&&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])}!l&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),jl(e));for(var d in b)e.on(d+X2,b[d])}function jl(e){if(!g$.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const fD={},M1e={};Fd.Node.prototype._applyProps=m0;function O1e(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),jl(e)}function D1e(e,t,n){let r=Fd[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=Fd.Group);const o={},s={};for(var l in t){var c=l.slice(0,2)==="on";c?s[l]=t[l]:o[l]=t[l]}const d=new r(o);return m0(d,s),d}function R1e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function A1e(e,t,n){return!1}function T1e(e){return e}function N1e(){return null}function $1e(){return null}function L1e(e,t,n,r){return M1e}function F1e(){}function z1e(e){}function B1e(e,t){return!1}function H1e(){return fD}function W1e(){return fD}const V1e=setTimeout,U1e=clearTimeout,G1e=-1;function K1e(e,t){return!1}const q1e=!1,X1e=!0,Q1e=!0;function Y1e(e,t){t.parent===e?t.moveToTop():e.add(t),jl(e)}function Z1e(e,t){t.parent===e?t.moveToTop():e.add(t),jl(e)}function pD(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),jl(e)}function J1e(e,t,n){pD(e,t,n)}function ebe(e,t){t.destroy(),t.off(X2),jl(e)}function tbe(e,t){t.destroy(),t.off(X2),jl(e)}function nbe(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function rbe(e,t,n){}function obe(e,t,n,r,o){m0(e,o,r)}function sbe(e){e.hide(),jl(e)}function abe(e){}function lbe(e,t){(t.visible==null||t.visible)&&e.show()}function ibe(e,t){}function cbe(e){}function ube(){}const dbe=()=>dD.DefaultEventPriority,fbe=Object.freeze(Object.defineProperty({__proto__:null,appendChild:Y1e,appendChildToContainer:Z1e,appendInitialChild:O1e,cancelTimeout:U1e,clearContainer:cbe,commitMount:rbe,commitTextUpdate:nbe,commitUpdate:obe,createInstance:D1e,createTextInstance:R1e,detachDeletedInstance:ube,finalizeInitialChildren:A1e,getChildHostContext:W1e,getCurrentEventPriority:dbe,getPublicInstance:T1e,getRootHostContext:H1e,hideInstance:sbe,hideTextInstance:abe,idlePriority:sm.unstable_IdlePriority,insertBefore:pD,insertInContainerBefore:J1e,isPrimaryRenderer:q1e,noTimeout:G1e,now:sm.unstable_now,prepareForCommit:N1e,preparePortalMount:$1e,prepareUpdate:L1e,removeChild:ebe,removeChildFromContainer:tbe,resetAfterCommit:F1e,resetTextContent:z1e,run:sm.unstable_runWithPriority,scheduleTimeout:V1e,shouldDeprioritizeSubtree:B1e,shouldSetTextContent:K1e,supportsMutation:Q1e,unhideInstance:lbe,unhideTextInstance:ibe,warnsIfNotActing:X1e},Symbol.toStringTag,{value:"Module"}));var pbe=Object.defineProperty,mbe=Object.defineProperties,hbe=Object.getOwnPropertyDescriptors,nI=Object.getOwnPropertySymbols,gbe=Object.prototype.hasOwnProperty,vbe=Object.prototype.propertyIsEnumerable,rI=(e,t,n)=>t in e?pbe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oI=(e,t)=>{for(var n in t||(t={}))gbe.call(t,n)&&rI(e,n,t[n]);if(nI)for(var n of nI(t))vbe.call(t,n)&&rI(e,n,t[n]);return e},bbe=(e,t)=>mbe(e,hbe(t));function mD(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=mD(r,t,n);if(o)return o;r=t?null:r.sibling}}function hD(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Q2=hD(i.createContext(null));class gD extends i.Component{render(){return i.createElement(Q2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:sI,ReactCurrentDispatcher:aI}=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function xbe(){const e=i.useContext(Q2);if(e===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=i.useId();return i.useMemo(()=>{for(const r of[sI==null?void 0:sI.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=mD(r,!1,s=>{let l=s.memoizedState;for(;l;){if(l.memoizedState===t)return!0;l=l.next}});if(o)return o}},[e,t])}function ybe(){var e,t;const n=xbe(),[r]=i.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==Q2&&!r.has(s)&&r.set(s,(t=aI==null?void 0:aI.current)==null?void 0:t.readContext(hD(s))),o=o.return}return r}function Cbe(){const e=ybe();return i.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>i.createElement(t,null,i.createElement(n.Provider,bbe(oI({},r),{value:e.get(n)}))),t=>i.createElement(gD,oI({},t))),[e])}function wbe(e){const t=B.useRef({});return B.useLayoutEffect(()=>{t.current=e}),B.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const Sbe=e=>{const t=B.useRef(),n=B.useRef(),r=B.useRef(),o=wbe(e),s=Cbe(),l=c=>{const{forwardedRef:d}=e;d&&(typeof d=="function"?d(c):d.current=c)};return B.useLayoutEffect(()=>(n.current=new Fd.Stage({width:e.width,height:e.height,container:t.current}),l(n.current),r.current=td.createContainer(n.current,dD.LegacyRoot,!1,null),td.updateContainer(B.createElement(s,{},e.children),r.current),()=>{Fd.isBrowser&&(l(null),td.updateContainer(null,r.current,null),n.current.destroy())}),[]),B.useLayoutEffect(()=>{l(n.current),m0(n.current,e,o),td.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})},Gu="Layer",Ns="Group",$s="Rect",$l="Circle",Vh="Line",vD="Image",kbe="Text",jbe="Transformer",td=_1e(fbe);td.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:B.version,rendererPackageName:"react-konva"});const _be=B.forwardRef((e,t)=>B.createElement(gD,{},B.createElement(Sbe,{...e,forwardedRef:t}))),Ibe=fe(pe,({canvas:e})=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:l}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:l,stageDimensions:r,stageScale:o}}),Pbe=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(Ibe);return a.jsxs(Ns,{children:[a.jsx($s,{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($s,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},Ebe=i.memo(Pbe),Mbe=fe([pe],({canvas:e})=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}}),Obe=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=H(Mbe),{colorMode:r}=ya(),[o,s]=i.useState([]),[l,c]=Zo("colors",["base.800","base.200"]),d=i.useCallback(f=>f/e,[e]);return i.useLayoutEffect(()=>{const{width:f,height:m}=n,{x:h,y:g}=t,b={x1:0,y1:0,x2:f,y2:m,offset:{x:d(h),y:d(g)}},y={x:Math.ceil(d(h)/64)*64,y:Math.ceil(d(g)/64)*64},x={x1:-y.x,y1:-y.y,x2:d(f)-y.x+64,y2:d(m)-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,E=Math.round(_/64)+1,M=hS(0,I).map(R=>a.jsx(Vh,{x:S.x1+R*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?l:c,strokeWidth:1},`x_${R}`)),D=hS(0,E).map(R=>a.jsx(Vh,{x:S.x1,y:S.y1+R*64,points:[0,0,j,0],stroke:r==="dark"?l:c,strokeWidth:1},`y_${R}`));s(M.concat(D))},[e,t,n,d,r,l,c]),a.jsx(Ns,{children:o})},Dbe=i.memo(Obe),Rbe=v$([pe],({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}}),Abe=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=H(Rbe),[o,s]=i.useState(null);return i.useEffect(()=>{if(!n)return;const l=new Image;l.onload=()=>{s(l)},l.src=n.dataURL},[n]),n&&r&&o?a.jsx(vD,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},Tbe=i.memo(Abe),Ql=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Nbe=fe(pe,({canvas:e})=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Ql(t)}}),lI=e=>`data:image/svg+xml;utf8,<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="60px" height="60px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
<g transform="matrix(0.5,0,0,0.5,0,0)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,2.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,7.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,10)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,12.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,15)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,17.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,20)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,22.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,25)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,27.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,30)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-2.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-7.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-10)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-12.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-15)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-17.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-20)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-22.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-25)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-27.5)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
<g transform="matrix(0.5,0,0,0.5,0,-30)">
<path d="M-3.5,63.5L64,-4" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>
</svg>`.replaceAll("black",e),$be=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=H(Nbe),[l,c]=i.useState(null),[d,f]=i.useState(0),m=i.useRef(null),h=i.useCallback(()=>{f(d+1),setTimeout(h,500)},[d]);return i.useEffect(()=>{if(l)return;const g=new Image;g.onload=()=>{c(g)},g.src=lI(n)},[l,n]),i.useEffect(()=>{l&&(l.src=lI(n))},[l,n]),i.useEffect(()=>{const g=setInterval(()=>f(b=>(b+1)%5),50);return()=>clearInterval(g)},[]),!l||!Ni(r.x)||!Ni(r.y)||!Ni(s)||!Ni(o.width)||!Ni(o.height)?null:a.jsx($s,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:l,fillPatternOffsetY:Ni(d)?d:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Lbe=i.memo($be),Fbe=fe([pe],({canvas:e})=>({objects:e.layerState.objects})),zbe=e=>{const{...t}=e,{objects:n}=H(Fbe);return a.jsx(Ns,{listening:!1,...t,children:n.filter(b$).map((r,o)=>a.jsx(Vh,{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))})},Bbe=i.memo(zbe);var Ll=i,Hbe=function(t,n,r){const o=Ll.useRef("loading"),s=Ll.useRef(),[l,c]=Ll.useState(0),d=Ll.useRef(),f=Ll.useRef(),m=Ll.useRef();return(d.current!==t||f.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,d.current=t,f.current=n,m.current=r),Ll.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,c(Math.random())}function b(){o.current="failed",s.current=void 0,c(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",b),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",b)}},[t,n,r]),[s.current,o.current]};const Wbe=Bd(Hbe),Vbe=({canvasImage:e})=>{const[t,n,r,o]=Zo("colors",["base.400","base.500","base.700","base.900"]),s=ia(t,n),l=ia(r,o),{t:c}=W();return a.jsxs(Ns,{children:[a.jsx($s,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(kbe,{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:l})]})},Ube=i.memo(Vbe),Gbe=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=jo(r??Br),[l,c]=Wbe((o==null?void 0:o.image_url)??"",AI.get()?"use-credentials":"anonymous");return s||c==="failed"?a.jsx(Ube,{canvasImage:e.canvasImage}):a.jsx(vD,{x:t,y:n,image:l,listening:!1})},bD=i.memo(Gbe),Kbe=fe([pe],({canvas:e})=>{const{layerState:{objects:t}}=e;return{objects:t}}),qbe=()=>{const{objects:e}=H(Kbe);return e?a.jsx(Ns,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(x$(t))return a.jsx(bD,{canvasImage:t},n);if(y$(t)){const r=a.jsx(Vh,{points:t.points,stroke:t.color?Ql(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(Ns,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(C$(t))return a.jsx($s,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Ql(t.color)},n);if(w$(t))return a.jsx($s,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},Xbe=i.memo(qbe),Qbe=fe([pe],({canvas:e})=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:l,images:c,boundingBox:d}=t.stagingArea;return{currentStagingAreaImage:c.length>0&&l!==void 0?c[l]:void 0,isOnFirstImage:l===0,isOnLastImage:l===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}}),Ybe=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:l,width:c,height:d}=H(Qbe);return a.jsxs(Ns,{...t,children:[r&&n&&a.jsx(bD,{canvasImage:n}),o&&a.jsxs(Ns,{children:[a.jsx($s,{x:s,y:l,width:c,height:d,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx($s,{x:s,y:l,width:c,height:d,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Zbe=i.memo(Ybe),Jbe=fe([pe],({canvas: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}}),exe=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=H(Jbe),{t:s}=W(),l=i.useCallback(()=>{e(gS(!0))},[e]),c=i.useCallback(()=>{e(gS(!1))},[e]),d=i.useCallback(()=>e(S$()),[e]),f=i.useCallback(()=>e(k$()),[e]),m=i.useCallback(()=>e(j$()),[e]);tt(["left"],d,{enabled:()=>!0,preventDefault:!0}),tt(["right"],f,{enabled:()=>!0,preventDefault:!0}),tt(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=jo((t==null?void 0:t.imageName)??Br),g=i.useCallback(()=>{e(_$(!n))},[e,n]),b=i.useCallback(()=>{h&&e(I$({imageDTO:h}))},[e,h]),y=i.useCallback(()=>{e(P$())},[e]);return t?a.jsxs($,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:l,onMouseLeave:c,children:[a.jsxs($t,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(dte,{}),onClick:d,colorScheme:"accent",isDisabled:!n}),a.jsx(Xe,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(Fe,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(fte,{}),onClick:f,colorScheme:"accent",isDisabled:!n})]}),a.jsxs($t,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx($M,{}),onClick:m,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(Ete,{}):a.jsx(Pte,{}),onClick:g,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(gf,{}),onClick:b,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(Nc,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},txe=i.memo(exe),uc=e=>Math.round(e*100)/100,nxe=()=>{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,l]=i.useState();return i.useEffect(()=>{l(void 0)},[e,t,n,r,o]),nne(async()=>{const c=await E$(e,t,n,r,o);if(!c)return;const{baseImageData:d,maskImageData:f}=c,m=M$(d,f);l(m)},1e3,[e,t,n,r,o]),s},rxe=()=>{const e=nxe(),{t}=W(),n=i.useMemo(()=>({txt2img:t("common.txt2img"),img2img:t("common.img2img"),inpaint:t("common.inpaint"),outpaint:t("common.outpaint")}),[t]);return a.jsxs(Ie,{children:[t("accessibility.mode"),":"," ",e?n[e]:"..."]})},oxe=i.memo(rxe),sxe=fe([pe],({canvas:e})=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${uc(n)}, ${uc(r)})`}});function axe(){const{cursorCoordinatesString:e}=H(sxe),{t}=W();return a.jsx(Ie,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const fx="var(--invokeai-colors-warning-500)",lxe=fe([pe],({canvas:e})=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:l},scaledBoundingBoxDimensions:{width:c,height:d},boundingBoxCoordinates:{x:f,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:b,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:x}=e;let w="inherit";return(y==="none"&&(s<512||l<512)||y==="manual"&&c*d<512*512)&&(w=fx),{activeLayerColor:b==="mask"?fx:"inherit",layer:b,boundingBoxColor:w,boundingBoxCoordinatesString:`(${uc(f)}, ${uc(m)})`,boundingBoxDimensionsString:`${s}×${l}`,scaledBoundingBoxDimensionsString:`${c}×${d}`,canvasCoordinatesString:`${uc(r)}×${uc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:x}}),ixe=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:l,canvasCoordinatesString:c,canvasDimensionsString:d,canvasScaleString:f,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=H(lxe),{t:b}=W();return a.jsxs($,{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(oxe,{}),a.jsx(Ie,{style:{color:e},children:`${b("unifiedCanvas.activeLayer")}: ${b(`unifiedCanvas.${t}`)}`}),a.jsx(Ie,{children:`${b("unifiedCanvas.canvasScale")}: ${f}%`}),g&&a.jsxs(Ie,{style:{color:fx},children:[b("unifiedCanvas.preserveMaskedArea"),": ",b("common.on")]}),h&&a.jsx(Ie,{style:{color:n},children:`${b("unifiedCanvas.boundingBox")}: ${o}`}),l&&a.jsx(Ie,{style:{color:n},children:`${b("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:`${b("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Ie,{children:`${b("unifiedCanvas.canvasDimensions")}: ${d}`}),a.jsx(Ie,{children:`${b("unifiedCanvas.canvasPosition")}: ${c}`}),a.jsx(axe,{})]})]})},cxe=i.memo(ixe),uxe=fe([pe],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:l,isMovingBoundingBox:c,tool:d,shouldSnapToGrid:f}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:l,stageScale:o,shouldSnapToGrid:f,tool:d,hitStrokeWidth:20/o,aspectRatio:m}}),dxe=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:c,stageScale:d,shouldSnapToGrid:f,tool:m,hitStrokeWidth:h,aspectRatio:g}=H(uxe),b=i.useRef(null),y=i.useRef(null),[x,w]=i.useState(!1);i.useEffect(()=>{var G;!b.current||!y.current||(b.current.nodes([y.current]),(G=b.current.getLayer())==null||G.batchDraw())},[]);const S=64*d;tt("N",()=>{n(Mm(!f))});const j=i.useCallback(G=>{if(!f){n(Rv({x:Math.floor(G.target.x()),y:Math.floor(G.target.y())}));return}const q=G.target.x(),Y=G.target.y(),Q=kr(q,64),V=kr(Y,64);G.target.x(Q),G.target.y(V),n(Rv({x:Q,y:V}))},[n,f]),_=i.useCallback(()=>{if(!y.current)return;const G=y.current,q=G.scaleX(),Y=G.scaleY(),Q=Math.round(G.width()*q),V=Math.round(G.height()*Y),se=Math.round(G.x()),ee=Math.round(G.y());if(g){const le=kr(Q/g,64);n(es({width:Q,height:le}))}else n(es({width:Q,height:V}));n(Rv({x:f?Ku(se,64):se,y:f?Ku(ee,64):ee})),G.scaleX(1),G.scaleY(1)},[n,f,g]),I=i.useCallback((G,q,Y)=>{const Q=G.x%S,V=G.y%S;return{x:Ku(q.x,S)+Q,y:Ku(q.y,S)+V}},[S]),E=i.useCallback(()=>{n(Av(!0))},[n]),M=i.useCallback(()=>{n(Av(!1)),n(Tv(!1)),n(Sp(!1)),w(!1)},[n]),D=i.useCallback(()=>{n(Tv(!0))},[n]),R=i.useCallback(()=>{n(Av(!1)),n(Tv(!1)),n(Sp(!1)),w(!1)},[n]),N=i.useCallback(()=>{w(!0)},[]),O=i.useCallback(()=>{!c&&!l&&w(!1)},[l,c]),T=i.useCallback(()=>{n(Sp(!0))},[n]),U=i.useCallback(()=>{n(Sp(!1))},[n]);return a.jsxs(Ns,{...t,children:[a.jsx($s,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:U,onMouseOut:U}),a.jsx($s,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:D,onDragEnd:R,onDragMove:j,onMouseDown:D,onMouseOut:O,onMouseOver:N,onMouseEnter:N,onMouseUp:R,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(jbe,{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:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:D,onDragEnd:R,onMouseDown:E,onMouseUp:M,onTransformEnd:M,ref:b,rotateEnabled:!1})]})},fxe=i.memo(dxe),pxe=fe(pe,({canvas:e})=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:l,layer:c,shouldShowBrush:d,isMovingBoundingBox:f,isTransformingBoundingBox:m,stageScale:h,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:vS/h,colorPickerInnerRadius:(vS-K1+1)/h,maskColorString:Ql({...o,a:.5}),brushColorString:Ql(s),colorPickerColorString:Ql(r),tool:l,layer:c,shouldShowBrush:d,shouldDrawBrushPreview:!(f||m||!t)&&d,strokeWidth:1.5/h,dotRadius:1.5/h,clip:w}}),mxe=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:l,layer:c,shouldDrawBrushPreview:d,dotRadius:f,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:b,colorPickerOuterRadius:y,clip:x}=H(pxe);return d?a.jsxs(Ns,{listening:!1,...x,...t,children:[l==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx($l,{x:n,y:r,radius:y,stroke:h,strokeWidth:K1,strokeScaleEnabled:!1}),a.jsx($l,{x:n,y:r,radius:b,stroke:g,strokeWidth:K1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx($l,{x:n,y:r,radius:o,fill:c==="mask"?s:h,globalCompositeOperation:l==="eraser"?"destination-out":"source-out"}),a.jsx($l,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx($l,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx($l,{x:n,y:r,radius:f*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx($l,{x:n,y:r,radius:f,fill:"rgba(0,0,0,1)",listening:!1})]}):null},hxe=i.memo(mxe),gxe=fe([pe,Lo],({canvas:e},t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:l,isMovingBoundingBox:c,stageDimensions:d,stageCoordinates:f,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:b,shouldRestrictStrokesToBox:y,shouldAntialias:x}=e;let w="none";return m==="move"||t?h?w="grabbing":w="grab":s?w=void 0:y&&!l&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||c,shouldShowBoundingBox:o,shouldShowGrid:b,stageCoordinates:f,stageCursor:w,stageDimensions:d,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:x}}),vxe=je(_be,{shouldForwardProp:e=>!["sx"].includes(e)}),bxe=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:l,stageScale:c,tool:d,isStaging:f,shouldShowIntermediates:m,shouldAntialias:h}=H(gxe);p1e();const g=te(),b=i.useRef(null),y=i.useRef(null),x=i.useRef(null),w=i.useCallback(G=>{O$(G),y.current=G},[]),S=i.useCallback(G=>{D$(G),x.current=G},[]),j=i.useRef({x:0,y:0}),_=i.useRef(!1),I=w1e(y),E=h1e(y),M=y1e(y,_),D=v1e(y,_,j),R=b1e(),{handleDragStart:N,handleDragMove:O,handleDragEnd:T}=d1e(),U=i.useCallback(G=>G.evt.preventDefault(),[]);return i.useEffect(()=>{if(!b.current)return;const G=new ResizeObserver(Q=>{for(const V of Q)if(V.contentBoxSize){const{width:se,height:ee}=V.contentRect;g(bS({width:se,height:ee}))}});G.observe(b.current);const{width:q,height:Y}=b.current.getBoundingClientRect();return g(bS({width:q,height:Y})),()=>{G.disconnect()}},[g]),a.jsxs($,{id:"canvas-container",ref:b,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Ie,{sx:{position:"absolute"},children:a.jsxs(vxe,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:l.width,height:l.height,scale:{x:c,y:c},onTouchStart:E,onTouchMove:D,onTouchEnd:M,onMouseDown:E,onMouseLeave:R,onMouseMove:D,onMouseUp:M,onDragStart:N,onDragMove:O,onDragEnd:T,onContextMenu:U,onWheel:I,draggable:(d==="move"||f)&&!t,children:[a.jsx(Gu,{id:"grid",visible:r,children:a.jsx(Dbe,{})}),a.jsx(Gu,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(Xbe,{})}),a.jsxs(Gu,{id:"mask",visible:e&&!f,listening:!1,children:[a.jsx(Bbe,{visible:!0,listening:!1}),a.jsx(Lbe,{listening:!1})]}),a.jsx(Gu,{children:a.jsx(Ebe,{})}),a.jsxs(Gu,{id:"preview",imageSmoothingEnabled:h,children:[!f&&a.jsx(hxe,{visible:d!=="move",listening:!1}),a.jsx(Zbe,{visible:f}),m&&a.jsx(Tbe,{}),a.jsx(fxe,{visible:n&&!f})]})]})}),a.jsx(cxe,{}),a.jsx(txe,{})]})},xxe=i.memo(bxe);function yxe(e,t,n=250){const[r,o]=i.useState(0);return i.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 O1={width:6,height:6,borderColor:"base.100"},Cxe={".react-colorful__hue-pointer":O1,".react-colorful__saturation-pointer":O1,".react-colorful__alpha-pointer":O1,gap:2,flexDir:"column"},om="4.2rem",wxe=e=>{const{color:t,onChange:n,withNumberInput:r,...o}=e,s=i.useCallback(f=>n({...t,r:f}),[t,n]),l=i.useCallback(f=>n({...t,g:f}),[t,n]),c=i.useCallback(f=>n({...t,b:f}),[t,n]),d=i.useCallback(f=>n({...t,a:f}),[t,n]);return a.jsxs($,{sx:Cxe,children:[a.jsx(hO,{color:t,onChange:n,style:{width:"100%"},...o}),r&&a.jsxs($,{children:[a.jsx(_s,{value:t.r,onChange:s,min:0,max:255,step:1,label:"Red",w:om}),a.jsx(_s,{value:t.g,onChange:l,min:0,max:255,step:1,label:"Green",w:om}),a.jsx(_s,{value:t.b,onChange:c,min:0,max:255,step:1,label:"Blue",w:om}),a.jsx(_s,{value:t.a,onChange:d,step:.1,min:0,max:1,label:"Alpha",w:om,isInteger:!1})]})]})},xD=i.memo(wxe),Sxe=fe([pe,Lo],({canvas:e},t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Ql(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}}),kxe=()=>{const e=te(),{t}=W(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:l}=H(Sxe);tt(["q"],()=>{c()},{enabled:()=>!l,preventDefault:!0},[n]),tt(["shift+c"],()=>{d()},{enabled:()=>!l,preventDefault:!0},[]),tt(["h"],()=>{f()},{enabled:()=>!l,preventDefault:!0},[o]);const c=i.useCallback(()=>{e(S3(n==="mask"?"base":"mask"))},[e,n]),d=i.useCallback(()=>{e(y3())},[e]),f=i.useCallback(()=>{e(Wx(!o))},[e,o]),m=i.useCallback(async()=>{e(R$())},[e]),h=i.useCallback(b=>{e(A$(b.target.checked))},[e]),g=i.useCallback(b=>{e(T$(b))},[e]);return a.jsx(xf,{triggerComponent:a.jsx($t,{children:a.jsx(Fe,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(UM,{}),isChecked:n==="mask",isDisabled:l})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(yr,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:f}),a.jsx(yr,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h}),a.jsx(Ie,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(xD,{color:r,onChange:g})}),a.jsx(Xe,{size:"sm",leftIcon:a.jsx(gf,{}),onClick:m,children:t("unifiedCanvas.saveMask")}),a.jsx(Xe,{size:"sm",leftIcon:a.jsx(ao,{}),onClick:d,children:t("unifiedCanvas.clearMask")})]})})},jxe=i.memo(kxe),_xe=fe([pe,tr],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}});function Ixe(){const e=te(),{canRedo:t,activeTabName:n}=H(_xe),{t:r}=W(),o=i.useCallback(()=>{e(N$())},[e]);return tt(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(Fe,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(Vte,{}),onClick:o,isDisabled:!t})}const Pxe=()=>{const e=H(Lo),t=te(),{t:n}=W(),r=i.useCallback(()=>t($$()),[t]);return a.jsxs(t0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Xe,{size:"sm",leftIcon:a.jsx(ao,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Exe=i.memo(Pxe),Mxe=fe([pe],({canvas:e})=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:l,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:f}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:l,shouldSnapToGrid:c,shouldRestrictStrokesToBox:d,shouldAntialias:f}}),Oxe=()=>{const e=te(),{t}=W(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:l,shouldShowIntermediates:c,shouldSnapToGrid:d,shouldRestrictStrokesToBox:f,shouldAntialias:m}=H(Mxe);tt(["n"],()=>{e(Mm(!d))},{enabled:!0,preventDefault:!0},[d]);const h=i.useCallback(I=>e(Mm(I.target.checked)),[e]),g=i.useCallback(I=>e(L$(I.target.checked)),[e]),b=i.useCallback(I=>e(F$(I.target.checked)),[e]),y=i.useCallback(I=>e(z$(I.target.checked)),[e]),x=i.useCallback(I=>e(B$(I.target.checked)),[e]),w=i.useCallback(I=>e(H$(I.target.checked)),[e]),S=i.useCallback(I=>e(W$(I.target.checked)),[e]),j=i.useCallback(I=>e(V$(I.target.checked)),[e]),_=i.useCallback(I=>e(U$(I.target.checked)),[e]);return a.jsx(xf,{isLazy:!1,triggerComponent:a.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(QM,{})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(yr,{label:t("unifiedCanvas.showIntermediates"),isChecked:c,onChange:g}),a.jsx(yr,{label:t("unifiedCanvas.showGrid"),isChecked:l,onChange:b}),a.jsx(yr,{label:t("unifiedCanvas.snapToGrid"),isChecked:d,onChange:h}),a.jsx(yr,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y}),a.jsx(yr,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:x}),a.jsx(yr,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:w}),a.jsx(yr,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:f,onChange:S}),a.jsx(yr,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:j}),a.jsx(yr,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:_}),a.jsx(Exe,{})]})})},Dxe=i.memo(Oxe),Rxe=fe([pe,Lo],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}}),Axe=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=H(Rxe),{t:s}=W();tt(["b"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[]),tt(["e"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[t]),tt(["c"],()=>{d()},{enabled:()=>!o,preventDefault:!0},[t]),tt(["shift+f"],()=>{f()},{enabled:()=>!o,preventDefault:!0}),tt(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),tt(["BracketLeft"],()=>{r-5<=5?e(kp(Math.max(r-1,1))):e(kp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),tt(["BracketRight"],()=>{e(kp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),tt(["Shift+BracketLeft"],()=>{e(Nv({...n,a:Zl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),tt(["Shift+BracketRight"],()=>{e(Nv({...n,a:Zl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const l=i.useCallback(()=>{e(fc("brush"))},[e]),c=i.useCallback(()=>{e(fc("eraser"))},[e]),d=i.useCallback(()=>{e(fc("colorPicker"))},[e]),f=i.useCallback(()=>{e(G$())},[e]),m=i.useCallback(()=>{e(K$())},[e]),h=i.useCallback(b=>{e(kp(b))},[e]),g=i.useCallback(b=>{e(Nv(b))},[e]);return a.jsxs($t,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(zte,{}),isChecked:t==="brush"&&!o,onClick:l,isDisabled:o}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(Ste,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:c}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(Mte,{}),isDisabled:o,onClick:f}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(nl,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(Ite,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:d}),a.jsx(xf,{triggerComponent:a.jsx(Fe,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(qM,{})}),children:a.jsxs($,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx($,{gap:4,justifyContent:"space-between",children:a.jsx(nt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h,sliderNumberInputProps:{max:500}})}),a.jsx(Ie,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(xD,{withNumberInput:!0,color:n,onChange:g})})]})})]})},Txe=i.memo(Axe),Nxe=fe([pe,tr],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}});function $xe(){const e=te(),{t}=W(),{canUndo:n,activeTabName:r}=H(Nxe),o=i.useCallback(()=>{e(q$())},[e]);return tt(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(Fe,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Ng,{}),onClick:o,isDisabled:!n})}const Lxe=fe([pe,Lo],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}}),Fxe=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=H(Lxe),s=G1(),{t:l}=W(),{isClipboardAPIAvailable:c}=j7(),{getUploadButtonProps:d,getUploadInputProps:f}=S2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});tt(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),tt(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),tt(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),tt(["shift+s"],()=>{x()},{enabled:()=>!t,preventDefault:!0},[s]),tt(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&c,preventDefault:!0},[s,c]),tt(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=i.useCallback(()=>{e(fc("move"))},[e]),h=yxe(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const I=G1();if(!I)return;const E=I.getClientRect({skipTransform:!0});e(eL({contentRect:E,shouldScaleTo1:_}))},b=i.useCallback(()=>{e(jI())},[e]),y=i.useCallback(()=>{e(X$())},[e]),x=i.useCallback(()=>{e(Q$())},[e]),w=i.useCallback(()=>{c&&e(Y$())},[e,c]),S=i.useCallback(()=>{e(Z$())},[e]),j=i.useCallback(_=>{const I=_;e(S3(I)),I==="mask"&&!n&&e(Wx(!0))},[e,n]);return a.jsxs($,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Ie,{w:24,children:a.jsx(yn,{tooltip:`${l("unifiedCanvas.layer")} (Q)`,value:r,data:J$,onChange:j,disabled:t})}),a.jsx(jxe,{}),a.jsx(Txe,{}),a.jsxs($t,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.move")} (V)`,tooltip:`${l("unifiedCanvas.move")} (V)`,icon:a.jsx(pte,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.resetView")} (R)`,tooltip:`${l("unifiedCanvas.resetView")} (R)`,icon:a.jsx(yte,{}),onClick:h})]}),a.jsxs($t,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${l("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx($te,{}),onClick:y,isDisabled:t}),a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${l("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(gf,{}),onClick:x,isDisabled:t}),c&&a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${l("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(ru,{}),onClick:w,isDisabled:t}),a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${l("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(ou,{}),onClick:S,isDisabled:t})]}),a.jsxs($t,{isAttached:!0,children:[a.jsx($xe,{}),a.jsx(Ixe,{})]}),a.jsxs($t,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${l("common.upload")}`,tooltip:`${l("common.upload")}`,icon:a.jsx($g,{}),isDisabled:t,...d()}),a.jsx("input",{...f()}),a.jsx(Fe,{"aria-label":`${l("unifiedCanvas.clearCanvas")}`,tooltip:`${l("unifiedCanvas.clearCanvas")}`,icon:a.jsx(ao,{}),onClick:b,colorScheme:"error",isDisabled:t})]}),a.jsx($t,{isAttached:!0,children:a.jsx(Dxe,{})})]})},zxe=i.memo(Fxe),iI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Bxe=()=>{const{t:e}=W(),{isOver:t,setNodeRef:n,active:r}=$8({id:"unifiedCanvas",data:iI});return a.jsxs($,{layerStyle:"first",ref:n,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(zxe,{}),a.jsx(xxe,{}),L8(iI,r)&&a.jsx(F8,{isOver:t,label:e("toast.setCanvasInitialImage")})]})},Hxe=i.memo(Bxe),Wxe=()=>a.jsx(Hxe,{}),Vxe=i.memo(Wxe),Uxe=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(An,{as:Rte,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(c1e,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(An,{as:si,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Mme,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(An,{as:Zse,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Vxe,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(An,{as:e0,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(bve,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(An,{as:Cte,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Phe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(An,{as:Kte,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(l1e,{})}],Gxe=fe([pe],({config:e})=>{const{disabledTabs:t}=e;return Uxe.filter(r=>!t.includes(r.id))}),Kxe=448,qxe=448,Xxe=360,Qxe=["modelManager","queue"],Yxe=["modelManager","queue"],Zxe=()=>{const e=H(tL),t=H(tr),n=H(Gxe),{t:r}=W(),o=te(),s=i.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),l=i.useMemo(()=>n.map(O=>a.jsx(Ut,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(mr,{onClick:s,children:[a.jsx(L3,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),c=i.useMemo(()=>n.map(O=>a.jsx($r,{children:O.content},O.id)),[n]),d=i.useCallback(O=>{const T=n[O];T&&o(Js(T.id))},[o,n]),{minSize:f,isCollapsed:m,setIsCollapsed:h,ref:g,reset:b,expand:y,collapse:x,toggle:w}=v_(Kxe,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:I,reset:E,expand:M,collapse:D,toggle:R}=v_(Xxe,"pixels");tt("f",()=>{_||m?(M(),y()):(x(),D())},[o,_,m]),tt(["t","o"],()=>{w()},[o]),tt("g",()=>{R()},[o]);const N=R2();return a.jsxs(ci,{variant:"appTabs",defaultIndex:e,index:e,onChange:d,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(ui,{sx:{pt:2,gap:4,flexDir:"column"},children:[l,a.jsx(Wr,{})]}),a.jsxs(o0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:N,units:"pixels",children:[!Yxe.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(rl,{order:0,id:"side",ref:g,defaultSize:f,minSize:f,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(mce,{}):a.jsx(Xpe,{})}),a.jsx(Bh,{onDoubleClick:b,collapsedDirection:m?"left":void 0}),a.jsx(bce,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(rl,{id:"main",order:1,minSize:qxe,children:a.jsx(eu,{style:{height:"100%",width:"100%"},children:c})}),!Qxe.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Bh,{onDoubleClick:E,collapsedDirection:_?"right":void 0}),a.jsx(rl,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:I,collapsible:!0,children:a.jsx(zae,{})}),a.jsx(gce,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},Jxe=i.memo(Zxe),eye=i.createContext(null),D1={didCatch:!1,error:null};class tye extends i.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=D1}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),l=0;l<o;l++)s[l]=arguments[l];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:s,reason:"imperative-api"}),this.setState(D1)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&nye(t.resetKeys,o)){var s,l;(s=(l=this.props).onReset)===null||s===void 0||s.call(l,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(D1)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:s,error:l}=this.state;let c=t;if(s){const d={error:l,resetErrorBoundary:this.resetErrorBoundary};if(i.isValidElement(o))c=o;else if(typeof n=="function")c=n(d);else if(r)c=i.createElement(r,d);else throw l}return i.createElement(eye.Provider,{value:{didCatch:s,error:l,resetErrorBoundary:this.resetErrorBoundary}},c)}}function nye(){let e=arguments.length>0&&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 rye(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 oye=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),sye=new Map(oye),aye=sye,lye=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],px=new WeakSet,iye=e=>{px.add(e);const t=e.toJSON();return px.delete(e),t},cye=e=>aye.get(e)??Error,yD=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:l,serialize:c})=>{if(!n)if(Array.isArray(e))n=[];else if(!c&&cI(e)){const f=cye(e.name);n=new f}else n={};if(t.push(e),s>=o)return n;if(l&&typeof e.toJSON=="function"&&!px.has(e))return iye(e);const d=f=>yD({from:f,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:l,serialize:c});for(const[f,m]of Object.entries(e)){if(m&&m instanceof Uint8Array&&m.constructor.name==="Buffer"){n[f]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[f]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){try{n[f]=m}catch{}continue}if(!t.includes(e[f])){s++,n[f]=d(e[f]);continue}n[f]="[Circular]"}}for(const{property:f,enumerable:m}of lye)typeof e[f]<"u"&&e[f]!==null&&Object.defineProperty(n,f,{value:cI(e[f])?d(e[f]):e[f],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function uye(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?yD({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e}function cI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const dye=({error:e,resetErrorBoundary:t})=>{const n=tg(),{t:r}=W(),o=i.useCallback(()=>{const l=JSON.stringify(uye(e),null,2);navigator.clipboard.writeText(`\`\`\`
${l}
\`\`\``),n({title:"Error Copied"})},[e,n]),s=i.useMemo(()=>rye({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx($,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs($,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(or,{children:r("common.somethingWentWrong")}),a.jsx($,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(be,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs($,{sx:{gap:4},children:[a.jsx(Xe,{leftIcon:a.jsx(sae,{}),onClick:t,children:r("accessibility.resetUI")}),a.jsx(Xe,{leftIcon:a.jsx(ru,{}),onClick:o,children:r("common.copyError")}),a.jsx(ig,{href:s,isExternal:!0,children:a.jsx(Xe,{leftIcon:a.jsx(Xy,{}),children:r("accessibility.createIssue")})})]})]})})},fye=i.memo(dye),pye=fe([pe],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}}),mye=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=H(pye),{queueBack:o,isDisabled:s,isLoading:l}=A7();tt(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!l,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,l]);const{queueFront:c,isDisabled:d,isLoading:f}=L7();return tt(["ctrl+shift+enter","meta+shift+enter"],c,{enabled:()=>!d&&!f,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[c,d,f]),tt("*",()=>{pm("shift")?!t&&e(zr(!0)):t&&e(zr(!1)),pm("ctrl")?!n&&e(xS(!0)):n&&e(xS(!1)),pm("meta")?!r&&e(yS(!0)):r&&e(yS(!1))},{keyup:!0,keydown:!0},[t,n,r]),tt("1",()=>{e(Js("txt2img"))}),tt("2",()=>{e(Js("img2img"))}),tt("3",()=>{e(Js("unifiedCanvas"))}),tt("4",()=>{e(Js("nodes"))}),tt("5",()=>{e(Js("modelManager"))}),null},hye=i.memo(mye),gye=e=>{const t=te(),{recallAllParameters:n}=Sf(),r=zs(),{currentData:o}=jo((e==null?void 0:e.imageName)??Br),{currentData:s}=BI((e==null?void 0:e.imageName)??Br),l=i.useCallback(()=>{o&&(t(HI(o)),t(Js("unifiedCanvas")),r({title:PI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),c=i.useCallback(()=>{o&&t(Qh(o))},[t,o]),d=i.useCallback(()=>{s&&n(s)},[s]);return i.useEffect(()=>{e&&e.action==="sendToCanvas"&&l()},[e,l]),i.useEffect(()=>{e&&e.action==="sendToImg2Img"&&c()},[e,c]),i.useEffect(()=>{e&&e.action==="useAllParameters"&&d()},[e,d]),{handleSendToCanvas:l,handleSendToImg2Img:c,handleUseAllMetadata:d}},vye=e=>(gye(e.selectedImage),null),bye=i.memo(vye),xye={},yye=({config:e=xye,selectedImage:t})=>{const n=H(e8),r=H6("system"),o=te(),s=JM();nL();const l=i.useCallback(()=>(s(),location.reload(),!1),[s]);i.useEffect(()=>{wt.changeLanguage(n)},[n]),i.useEffect(()=>{JI(e)&&(r.info({config:e},"Received config"),o(rL(e)))},[o,e,r]),i.useEffect(()=>{o(oL())},[o]);const c=qh(sL);return a.jsxs(tye,{onReset:l,FallbackComponent:fye,children:[a.jsx(sl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(SK,{children:a.jsxs(sl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[c||a.jsx(Cne,{}),a.jsx($,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(Jxe,{})})]})})}),a.jsx(rte,{}),a.jsx(Jee,{}),a.jsx(fG,{}),a.jsx(hye,{}),a.jsx(bye,{selectedImage:t})]})},_ye=i.memo(yye);export{_ye as default};