diff --git a/invokeai/frontend/web/dist/assets/App-31be1ab7.js b/invokeai/frontend/web/dist/assets/App-2d0c33e3.js similarity index 99% rename from invokeai/frontend/web/dist/assets/App-31be1ab7.js rename to invokeai/frontend/web/dist/assets/App-2d0c33e3.js index 7403da1edc..0a371cf252 100644 --- a/invokeai/frontend/web/dist/assets/App-31be1ab7.js +++ b/invokeai/frontend/web/dist/assets/App-2d0c33e3.js @@ -1,4 +1,4 @@ -import{t as pv,r as X8,i as hv,a as Mc,b as g_,S as v_,c as b_,d as y_,e as mv,f as x_,g as gv,h as J8,j as Z8,k as eR,l as tR,m as w_,n as nR,o as rR,p as oR,q as S_,s as sR,u as aR,v as iR,w as lR,x as cR,y as uR,z as f,A as i,B as tm,C as Rp,D as dR,E as C_,F as k_,G as fR,P as ld,H as N1,I as pR,J as hR,K as mR,L as gR,M as vR,N as bR,O as yR,Q as O2,R as xR,T as Te,U as je,V as Ct,W as tt,X as cd,Y as Fo,Z as Yr,_ as Br,$ as qn,a0 as fl,a1 as ia,a2 as Ft,a3 as ns,a4 as ec,a5 as za,a6 as nm,a7 as $1,a8 as ud,a9 as or,aa as wR,ab as F,ac as __,ad as R2,ae as P_,af as vv,ag as Dc,ah as SR,ai as j_,aj as I_,ak as Tc,al as CR,am as fe,an as Ge,ao as Jt,ap as L,aq as kR,ar as M2,as as _R,at as PR,au as D2,av as te,aw as jR,ax as Dn,ay as Bn,az as Re,aA as H,aB as Qs,aC as Ye,aD as Kn,aE as E_,aF as O_,aG as R_,aH as _i,aI as Ds,aJ as z1,aK as IR,aL as ER,aM as OR,aN as Ml,aO as Su,aP as RR,aQ as MR,aR as DR,aS as TR,aT as AR,aU as T2,aV as ui,aW as L1,aX as Mp,aY as rm,aZ as M_,a_ as os,a$ as D_,b0 as NR,b1 as Ac,b2 as T_,b3 as A_,b4 as Es,b5 as Po,b6 as Cu,b7 as $R,b8 as zR,b9 as LR,ba as BR,bb as B1,bc as Dp,bd as FR,be as HR,bf as If,bg as Ef,bh as Du,bi as Tu,bj as A2,bk as Tp,bl as N2,bm as Ap,bn as $2,bo as bv,bp as z2,bq as yv,br as L2,bs as Np,bt as B2,bu as mc,bv as F2,bw as gc,bx as H2,by as $p,bz as F1,bA as H1,bB as N_,bC as W1,bD as V1,bE as WR,bF as VR,bG as om,bH as Kl,bI as UR,bJ as GR,bK as xp,bL as qR,bM as KR,bN as YR,bO as xv,bP as $_,bQ as QR,bR as z_,bS as L_,bT as ss,bU as W2,bV as La,bW as XR,bX as wv,bY as JR,bZ as B_,b_ as V2,b$ as ZR,c0 as eM,c1 as tM,c2 as nM,c3 as rM,c4 as oM,c5 as U1,c6 as G1,c7 as sM,c8 as Ln,c9 as U2,ca as F_,cb as aM,cc as iM,cd as lM,ce as cM,cf as uM,cg as dM,ch as fM,ci as pM,cj as hM,ck as H_,cl as mM,cm as gM,cn as vM,co as bM,cp as yM,cq as xM,cr as wM,cs as SM,ct as CM,cu as kM,cv as so,cw as sr,cx as _M,cy as q1,cz as dd,cA as fd,cB as PM,cC as G2,cD as jM,cE as q2,cF as IM,cG as EM,cH as OM,cI as K2,cJ as Y2,cK as na,cL as K1,cM as Q2,cN as X2,cO as sm,cP as RM,cQ as MM,cR as DM,cS as TM,cT as J2,cU as Z2,cV as AM,cW as ew,cX as zp,cY as NM,cZ as W_,c_ as tw,c$ as $M,d0 as zM,d1 as Ss,d2 as LM,d3 as BM,d4 as V_,d5 as U_,d6 as FM,d7 as nw,d8 as HM,d9 as WM,da as G_,db as VM,dc as UM,dd as GM,de as qM,df as KM,dg as YM,dh as QM,di as q_,dj as XM,dk as K_,dl as rw,dm as Of,dn as JM,dp as Y1,dq as Y_,dr as ZM,ds as e7,dt as t7,du as ls,dv as n7,dw as r7,dx as o7,dy as s7,dz as a7,dA as i7,dB as l7,dC as c7,dD as u7,dE as d7,dF as f7,dG as p7,dH as h7,dI as m7,dJ as ow,dK as sw,dL as g7,dM as Q_,dN as X_,dO as pd,dP as J_,dQ as Gi,dR as Z_,dS as aw,dT as v7,dU as b7,dV as e3,dW as y7,dX as Q1,dY as iw,dZ as t3,d_ as x7,d$ as lw,e0 as n3,e1 as Ts,e2 as w7,e3 as r3,e4 as cw,e5 as S7,e6 as C7,e7 as k7,e8 as _7,e9 as P7,ea as j7,eb as I7,ec as E7,ed as O7,ee as R7,ef as M7,eg as D7,eh as T7,ei as A7,ej as N7,ek as $7,el as z7,em as L7,en as B7,eo as F7,ep as uw,eq as wp,er as H7,es as Lp,et as o3,eu as Vu,ev as W7,ew as V7,ex as ea,ey as s3,ez as X1,eA as hd,eB as U7,eC as G7,eD as q7,eE as Ea,eF as a3,eG as K7,eH as Y7,eI as i3,eJ as Q7,eK as X7,eL as J7,eM as Z7,eN as eD,eO as tD,eP as nD,eQ as rD,eR as oD,eS as sD,eT as dw,eU as aD,eV as iD,eW as lD,eX as cD,eY as uD,eZ as dD,e_ as fD,e$ as pD,f0 as u0,f1 as Js,f2 as d0,f3 as f0,f4 as Rf,f5 as fw,f6 as Sv,f7 as hD,f8 as mD,f9 as gD,fa as vD,fb as Bp,fc as l3,fd as c3,fe as bD,ff as yD,fg as u3,fh as d3,fi as f3,fj as p3,fk as h3,fl as m3,fm as g3,fn as v3,fo as tc,fp as nc,fq as b3,fr as y3,fs as xD,ft as x3,fu as w3,fv as S3,fw as C3,fx as k3,fy as _3,fz as J1,fA as wD,fB as pw,fC as SD,fD as CD,fE as Fp,fF as hw,fG as mw,fH as gw,fI as vw,fJ as kD,fK as _D,fL as PD,fM as jD,fN as ID,fO as ED,fP as OD,fQ as RD,fR as MD}from"./index-190cc92f.js";import{u as DD,c as TD,a as Rn,b as rr,I as no,d as Ba,P as Uu,C as AD,e as be,m as am,f as P3,g as Fa,h as ND,r as Ue,i as $D,j as bw,k as Vt,l as wr}from"./MantineProvider-26d2feb2.js";function zD(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var yw=1/0,LD=17976931348623157e292;function p0(e){if(!e)return e===0?e:0;if(e=pv(e),e===yw||e===-yw){var t=e<0?-1:1;return t*LD}return e===e?e:0}var BD=function(){return X8.Date.now()};const h0=BD;var FD="Expected a function",HD=Math.max,WD=Math.min;function VD(e,t,n){var r,o,s,a,c,d,p=0,h=!1,m=!1,v=!0;if(typeof e!="function")throw new TypeError(FD);t=pv(t)||0,hv(n)&&(h=!!n.leading,m="maxWait"in n,s=m?HD(pv(n.maxWait)||0,t):s,v="trailing"in n?!!n.trailing:v);function b(O){var R=r,M=o;return r=o=void 0,p=O,a=e.apply(M,R),a}function w(O){return p=O,c=setTimeout(k,t),h?b(O):a}function y(O){var R=O-d,M=O-p,T=t-R;return m?WD(T,s-M):T}function S(O){var R=O-d,M=O-p;return d===void 0||R>=t||R<0||m&&M>=s}function k(){var O=h0();if(S(O))return _(O);c=setTimeout(k,y(O))}function _(O){return c=void 0,v&&r?b(O):(r=o=void 0,a)}function I(){c!==void 0&&clearTimeout(c),p=0,r=d=o=c=void 0}function P(){return c===void 0?a:_(h0())}function E(){var O=h0(),R=S(O);if(r=arguments,o=this,d=O,R){if(c===void 0)return w(d);if(m)return clearTimeout(c),c=setTimeout(k,t),b(d)}return c===void 0&&(c=setTimeout(k,t)),a}return E.cancel=I,E.flush=P,E}var UD=200;function GD(e,t,n,r){var o=-1,s=b_,a=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Mc(t,g_(n))),r?(s=y_,a=!1):t.length>=UD&&(s=mv,a=!1,t=new v_(t));e:for(;++o=120&&h.length>=120)?new v_(a&&h):void 0}h=e[0];var m=-1,v=c[0];e:for(;++m{r.has(s)&&n(o,s)})}const j3=({id:e,x:t,y:n,width:r,height:o,style:s,color:a,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:v})=>{const{background:b,backgroundColor:w}=s||{},y=a||b||w;return i.jsx("rect",{className:tm(["react-flow__minimap-node",p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:y,stroke:c,strokeWidth:d,shapeRendering:m,onClick:v?S=>v(S,e):void 0})};j3.displayName="MiniMapNode";var fT=f.memo(j3);const pT=e=>e.nodeOrigin,hT=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),m0=e=>e instanceof Function?e:()=>e;function mT({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=fT,onClick:a}){const c=Rp(hT,N1),d=Rp(pT),p=m0(t),h=m0(e),m=m0(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:c.map(b=>{const{x:w,y}=dR(b,d).positionAbsolute;return i.jsx(s,{x:w,y,width:b.width,height:b.height,style:b.style,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:v,onClick:a,id:b.id},b.id)})})}var gT=f.memo(mT);const vT=200,bT=150,yT=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?mR(gR(t,e.nodeOrigin),n):n,rfId:e.rfId}},xT="react-flow__minimap-desc";function I3({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:y=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:_=10}){const I=C_(),P=f.useRef(null),{boundingRect:E,viewBB:O,rfId:R}=Rp(yT,N1),M=(e==null?void 0:e.width)??vT,T=(e==null?void 0:e.height)??bT,A=E.width/M,$=E.height/T,Q=Math.max(A,$),B=Q*M,V=Q*T,q=5*Q,G=E.x-(B-E.width)/2-q,D=E.y-(V-E.height)/2-q,z=B+q*2,W=V+q*2,Y=`${xT}-${R}`,ie=f.useRef(0);ie.current=Q,f.useEffect(()=>{if(P.current){const oe=k_(P.current),K=re=>{const{transform:se,d3Selection:pe,d3Zoom:le}=I.getState();if(re.sourceEvent.type!=="wheel"||!pe||!le)return;const ge=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*_,ke=se[2]*Math.pow(2,ge);le.scaleTo(pe,ke)},U=re=>{const{transform:se,d3Selection:pe,d3Zoom:le,translateExtent:ge,width:ke,height:xe}=I.getState();if(re.sourceEvent.type!=="mousemove"||!pe||!le)return;const de=ie.current*Math.max(1,se[2])*(k?-1:1),Ae={x:se[0]-re.sourceEvent.movementX*de,y:se[1]-re.sourceEvent.movementY*de},Ee=[[0,0],[ke,xe]],$e=pR.translate(Ae.x,Ae.y).scale(se[2]),kt=le.constrain()($e,Ee,ge);le.transform(pe,kt)},ae=fR().on("zoom",w?U:null).on("zoom.wheel",y?K:null);return oe.call(ae),()=>{oe.on("zoom",null)}}},[w,y,k,_]);const ye=v?oe=>{const K=hR(oe);v(oe,{x:K[0],y:K[1]})}:void 0,Z=b?(oe,K)=>{const U=I.getState().nodeInternals.get(K);b(oe,U)}:void 0;return i.jsx(ld,{position:m,style:e,className:tm(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:M,height:T,viewBox:`${G} ${D} ${z} ${W}`,role:"img","aria-labelledby":Y,ref:P,onClick:ye,children:[S&&i.jsx("title",{id:Y,children:S}),i.jsx(gT,{onClick:Z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:c}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-q},${D-q}h${z+q*2}v${W+q*2}h${-z-q*2}z +import{t as pv,r as X8,i as hv,a as Mc,b as g_,S as v_,c as b_,d as y_,e as mv,f as x_,g as gv,h as J8,j as Z8,k as eR,l as tR,m as w_,n as nR,o as rR,p as oR,q as S_,s as sR,u as aR,v as iR,w as lR,x as cR,y as uR,z as f,A as i,B as tm,C as Rp,D as dR,E as C_,F as k_,G as fR,P as ld,H as N1,I as pR,J as hR,K as mR,L as gR,M as vR,N as bR,O as yR,Q as O2,R as xR,T as Te,U as je,V as Ct,W as tt,X as cd,Y as Fo,Z as Yr,_ as Br,$ as qn,a0 as fl,a1 as ia,a2 as Ft,a3 as ns,a4 as ec,a5 as za,a6 as nm,a7 as $1,a8 as ud,a9 as or,aa as wR,ab as F,ac as __,ad as R2,ae as P_,af as vv,ag as Dc,ah as SR,ai as j_,aj as I_,ak as Tc,al as CR,am as fe,an as Ge,ao as Jt,ap as L,aq as kR,ar as M2,as as _R,at as PR,au as D2,av as te,aw as jR,ax as Dn,ay as Bn,az as Re,aA as H,aB as Qs,aC as Ye,aD as Kn,aE as E_,aF as O_,aG as R_,aH as _i,aI as Ds,aJ as z1,aK as IR,aL as ER,aM as OR,aN as Ml,aO as Su,aP as RR,aQ as MR,aR as DR,aS as TR,aT as AR,aU as T2,aV as ui,aW as L1,aX as Mp,aY as rm,aZ as M_,a_ as os,a$ as D_,b0 as NR,b1 as Ac,b2 as T_,b3 as A_,b4 as Es,b5 as Po,b6 as Cu,b7 as $R,b8 as zR,b9 as LR,ba as BR,bb as B1,bc as Dp,bd as FR,be as HR,bf as If,bg as Ef,bh as Du,bi as Tu,bj as A2,bk as Tp,bl as N2,bm as Ap,bn as $2,bo as bv,bp as z2,bq as yv,br as L2,bs as Np,bt as B2,bu as mc,bv as F2,bw as gc,bx as H2,by as $p,bz as F1,bA as H1,bB as N_,bC as W1,bD as V1,bE as WR,bF as VR,bG as om,bH as Kl,bI as UR,bJ as GR,bK as xp,bL as qR,bM as KR,bN as YR,bO as xv,bP as $_,bQ as QR,bR as z_,bS as L_,bT as ss,bU as W2,bV as La,bW as XR,bX as wv,bY as JR,bZ as B_,b_ as V2,b$ as ZR,c0 as eM,c1 as tM,c2 as nM,c3 as rM,c4 as oM,c5 as U1,c6 as G1,c7 as sM,c8 as Ln,c9 as U2,ca as F_,cb as aM,cc as iM,cd as lM,ce as cM,cf as uM,cg as dM,ch as fM,ci as pM,cj as hM,ck as H_,cl as mM,cm as gM,cn as vM,co as bM,cp as yM,cq as xM,cr as wM,cs as SM,ct as CM,cu as kM,cv as so,cw as sr,cx as _M,cy as q1,cz as dd,cA as fd,cB as PM,cC as G2,cD as jM,cE as q2,cF as IM,cG as EM,cH as OM,cI as K2,cJ as Y2,cK as na,cL as K1,cM as Q2,cN as X2,cO as sm,cP as RM,cQ as MM,cR as DM,cS as TM,cT as J2,cU as Z2,cV as AM,cW as ew,cX as zp,cY as NM,cZ as W_,c_ as tw,c$ as $M,d0 as zM,d1 as Ss,d2 as LM,d3 as BM,d4 as V_,d5 as U_,d6 as FM,d7 as nw,d8 as HM,d9 as WM,da as G_,db as VM,dc as UM,dd as GM,de as qM,df as KM,dg as YM,dh as QM,di as q_,dj as XM,dk as K_,dl as rw,dm as Of,dn as JM,dp as Y1,dq as Y_,dr as ZM,ds as e7,dt as t7,du as ls,dv as n7,dw as r7,dx as o7,dy as s7,dz as a7,dA as i7,dB as l7,dC as c7,dD as u7,dE as d7,dF as f7,dG as p7,dH as h7,dI as m7,dJ as ow,dK as sw,dL as g7,dM as Q_,dN as X_,dO as pd,dP as J_,dQ as Gi,dR as Z_,dS as aw,dT as v7,dU as b7,dV as e3,dW as y7,dX as Q1,dY as iw,dZ as t3,d_ as x7,d$ as lw,e0 as n3,e1 as Ts,e2 as w7,e3 as r3,e4 as cw,e5 as S7,e6 as C7,e7 as k7,e8 as _7,e9 as P7,ea as j7,eb as I7,ec as E7,ed as O7,ee as R7,ef as M7,eg as D7,eh as T7,ei as A7,ej as N7,ek as $7,el as z7,em as L7,en as B7,eo as F7,ep as uw,eq as wp,er as H7,es as Lp,et as o3,eu as Vu,ev as W7,ew as V7,ex as ea,ey as s3,ez as X1,eA as hd,eB as U7,eC as G7,eD as q7,eE as Ea,eF as a3,eG as K7,eH as Y7,eI as i3,eJ as Q7,eK as X7,eL as J7,eM as Z7,eN as eD,eO as tD,eP as nD,eQ as rD,eR as oD,eS as sD,eT as dw,eU as aD,eV as iD,eW as lD,eX as cD,eY as uD,eZ as dD,e_ as fD,e$ as pD,f0 as u0,f1 as Js,f2 as d0,f3 as f0,f4 as Rf,f5 as fw,f6 as Sv,f7 as hD,f8 as mD,f9 as gD,fa as vD,fb as Bp,fc as l3,fd as c3,fe as bD,ff as yD,fg as u3,fh as d3,fi as f3,fj as p3,fk as h3,fl as m3,fm as g3,fn as v3,fo as tc,fp as nc,fq as b3,fr as y3,fs as xD,ft as x3,fu as w3,fv as S3,fw as C3,fx as k3,fy as _3,fz as J1,fA as wD,fB as pw,fC as SD,fD as CD,fE as Fp,fF as hw,fG as mw,fH as gw,fI as vw,fJ as kD,fK as _D,fL as PD,fM as jD,fN as ID,fO as ED,fP as OD,fQ as RD,fR as MD}from"./index-91eecded.js";import{u as DD,c as TD,a as Rn,b as rr,I as no,d as Ba,P as Uu,C as AD,e as be,m as am,f as P3,g as Fa,h as ND,r as Ue,i as $D,j as bw,k as Vt,l as wr}from"./MantineProvider-149dbf3d.js";function zD(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var yw=1/0,LD=17976931348623157e292;function p0(e){if(!e)return e===0?e:0;if(e=pv(e),e===yw||e===-yw){var t=e<0?-1:1;return t*LD}return e===e?e:0}var BD=function(){return X8.Date.now()};const h0=BD;var FD="Expected a function",HD=Math.max,WD=Math.min;function VD(e,t,n){var r,o,s,a,c,d,p=0,h=!1,m=!1,v=!0;if(typeof e!="function")throw new TypeError(FD);t=pv(t)||0,hv(n)&&(h=!!n.leading,m="maxWait"in n,s=m?HD(pv(n.maxWait)||0,t):s,v="trailing"in n?!!n.trailing:v);function b(O){var R=r,M=o;return r=o=void 0,p=O,a=e.apply(M,R),a}function w(O){return p=O,c=setTimeout(k,t),h?b(O):a}function y(O){var R=O-d,M=O-p,T=t-R;return m?WD(T,s-M):T}function S(O){var R=O-d,M=O-p;return d===void 0||R>=t||R<0||m&&M>=s}function k(){var O=h0();if(S(O))return _(O);c=setTimeout(k,y(O))}function _(O){return c=void 0,v&&r?b(O):(r=o=void 0,a)}function I(){c!==void 0&&clearTimeout(c),p=0,r=d=o=c=void 0}function P(){return c===void 0?a:_(h0())}function E(){var O=h0(),R=S(O);if(r=arguments,o=this,d=O,R){if(c===void 0)return w(d);if(m)return clearTimeout(c),c=setTimeout(k,t),b(d)}return c===void 0&&(c=setTimeout(k,t)),a}return E.cancel=I,E.flush=P,E}var UD=200;function GD(e,t,n,r){var o=-1,s=b_,a=!0,c=e.length,d=[],p=t.length;if(!c)return d;n&&(t=Mc(t,g_(n))),r?(s=y_,a=!1):t.length>=UD&&(s=mv,a=!1,t=new v_(t));e:for(;++o=120&&h.length>=120)?new v_(a&&h):void 0}h=e[0];var m=-1,v=c[0];e:for(;++m{r.has(s)&&n(o,s)})}const j3=({id:e,x:t,y:n,width:r,height:o,style:s,color:a,strokeColor:c,strokeWidth:d,className:p,borderRadius:h,shapeRendering:m,onClick:v})=>{const{background:b,backgroundColor:w}=s||{},y=a||b||w;return i.jsx("rect",{className:tm(["react-flow__minimap-node",p]),x:t,y:n,rx:h,ry:h,width:r,height:o,fill:y,stroke:c,strokeWidth:d,shapeRendering:m,onClick:v?S=>v(S,e):void 0})};j3.displayName="MiniMapNode";var fT=f.memo(j3);const pT=e=>e.nodeOrigin,hT=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),m0=e=>e instanceof Function?e:()=>e;function mT({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=fT,onClick:a}){const c=Rp(hT,N1),d=Rp(pT),p=m0(t),h=m0(e),m=m0(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:c.map(b=>{const{x:w,y}=dR(b,d).positionAbsolute;return i.jsx(s,{x:w,y,width:b.width,height:b.height,style:b.style,className:m(b),color:p(b),borderRadius:r,strokeColor:h(b),strokeWidth:o,shapeRendering:v,onClick:a,id:b.id},b.id)})})}var gT=f.memo(mT);const vT=200,bT=150,yT=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?mR(gR(t,e.nodeOrigin),n):n,rfId:e.rfId}},xT="react-flow__minimap-desc";function I3({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:c,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:y=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:_=10}){const I=C_(),P=f.useRef(null),{boundingRect:E,viewBB:O,rfId:R}=Rp(yT,N1),M=(e==null?void 0:e.width)??vT,T=(e==null?void 0:e.height)??bT,A=E.width/M,$=E.height/T,Q=Math.max(A,$),B=Q*M,V=Q*T,q=5*Q,G=E.x-(B-E.width)/2-q,D=E.y-(V-E.height)/2-q,z=B+q*2,W=V+q*2,Y=`${xT}-${R}`,ie=f.useRef(0);ie.current=Q,f.useEffect(()=>{if(P.current){const oe=k_(P.current),K=re=>{const{transform:se,d3Selection:pe,d3Zoom:le}=I.getState();if(re.sourceEvent.type!=="wheel"||!pe||!le)return;const ge=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*_,ke=se[2]*Math.pow(2,ge);le.scaleTo(pe,ke)},U=re=>{const{transform:se,d3Selection:pe,d3Zoom:le,translateExtent:ge,width:ke,height:xe}=I.getState();if(re.sourceEvent.type!=="mousemove"||!pe||!le)return;const de=ie.current*Math.max(1,se[2])*(k?-1:1),Ae={x:se[0]-re.sourceEvent.movementX*de,y:se[1]-re.sourceEvent.movementY*de},Ee=[[0,0],[ke,xe]],$e=pR.translate(Ae.x,Ae.y).scale(se[2]),kt=le.constrain()($e,Ee,ge);le.transform(pe,kt)},ae=fR().on("zoom",w?U:null).on("zoom.wheel",y?K:null);return oe.call(ae),()=>{oe.on("zoom",null)}}},[w,y,k,_]);const ye=v?oe=>{const K=hR(oe);v(oe,{x:K[0],y:K[1]})}:void 0,Z=b?(oe,K)=>{const U=I.getState().nodeInternals.get(K);b(oe,U)}:void 0;return i.jsx(ld,{position:m,style:e,className:tm(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:M,height:T,viewBox:`${G} ${D} ${z} ${W}`,role:"img","aria-labelledby":Y,ref:P,onClick:ye,children:[S&&i.jsx("title",{id:Y,children:S}),i.jsx(gT,{onClick:Z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:c}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-q},${D-q}h${z+q*2}v${W+q*2}h${-z-q*2}z M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:d,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})]})})}I3.displayName="MiniMap";var wT=f.memo(I3),Cs;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Cs||(Cs={}));function ST({color:e,dimensions:t,lineWidth:n}){return i.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function CT({color:e,radius:t}){return i.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const kT={[Cs.Dots]:"#91919a",[Cs.Lines]:"#eee",[Cs.Cross]:"#e2e2e2"},_T={[Cs.Dots]:1,[Cs.Lines]:1,[Cs.Cross]:6},PT=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function E3({id:e,variant:t=Cs.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:a,style:c,className:d}){const p=f.useRef(null),{transform:h,patternId:m}=Rp(PT,N1),v=a||kT[t],b=r||_T[t],w=t===Cs.Dots,y=t===Cs.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*h[2]||1,S[1]*h[2]||1],_=b*h[2],I=y?[_,_]:k,P=w?[_/s,_/s]:[I[0]/s,I[1]/s];return i.jsxs("svg",{className:tm(["react-flow__background",d]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[i.jsx("pattern",{id:m+e,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:w?i.jsx(CT,{color:v,radius:_/s}):i.jsx(ST,{dimensions:I,color:v,lineWidth:o})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`})]})}E3.displayName="Background";var jT=f.memo(E3),Au;(function(e){e.Line="line",e.Handle="handle"})(Au||(Au={}));function IT({width:e,prevWidth:t,height:n,prevHeight:r,invertX:o,invertY:s}){const a=e-t,c=n-r,d=[a>0?1:a<0?-1:0,c>0?1:c<0?-1:0];return a&&o&&(d[0]=d[0]*-1),c&&s&&(d[1]=d[1]*-1),d}const O3={width:0,height:0,x:0,y:0},ET={...O3,pointerX:0,pointerY:0,aspectRatio:1};function OT({nodeId:e,position:t,variant:n=Au.Handle,className:r,style:o={},children:s,color:a,minWidth:c=10,minHeight:d=10,maxWidth:p=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:m=!1,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:y}){const S=vR(),k=typeof e=="string"?e:S,_=C_(),I=f.useRef(null),P=f.useRef(ET),E=f.useRef(O3),O=bR(),R=n===Au.Line?"right":"bottom-right",M=t??R;f.useEffect(()=>{if(!I.current||!k)return;const Q=k_(I.current),B=M.includes("right")||M.includes("left"),V=M.includes("bottom")||M.includes("top"),q=M.includes("left"),G=M.includes("top"),D=yR().on("start",z=>{const W=_.getState().nodeInternals.get(k),{xSnapped:Y,ySnapped:ie}=O(z);E.current={width:(W==null?void 0:W.width)??0,height:(W==null?void 0:W.height)??0,x:(W==null?void 0:W.position.x)??0,y:(W==null?void 0:W.position.y)??0},P.current={...E.current,pointerX:Y,pointerY:ie,aspectRatio:E.current.width/E.current.height},b==null||b(z,{...E.current})}).on("drag",z=>{const{nodeInternals:W,triggerNodeChanges:Y}=_.getState(),{xSnapped:ie,ySnapped:ye}=O(z),Z=W.get(k);if(Z){const oe=[],{pointerX:K,pointerY:U,width:ae,height:re,x:se,y:pe,aspectRatio:le}=P.current,{x:ge,y:ke,width:xe,height:de}=E.current,Ae=Math.floor(B?ie-K:0),Ee=Math.floor(V?ye-U:0);let $e=O2(ae+(q?-Ae:Ae),c,p),kt=O2(re+(G?-Ee:Ee),d,h);if(m){const Me=$e/kt,Pt=B&&V,At=B&&!V,we=V&&!B;$e=Me<=le&&Pt||we?kt*le:$e,kt=Me>le&&Pt||At?$e/le:kt,$e>=p?($e=p,kt=p/le):$e<=c&&($e=c,kt=c/le),kt>=h?(kt=h,$e=h*le):kt<=d&&(kt=d,$e=d*le)}const ct=$e!==xe,on=kt!==de;if(q||G){const Me=q?se-($e-ae):se,Pt=G?pe-(kt-re):pe,At=Me!==ge&&ct,we=Pt!==ke&&on;if(At||we){const ht={id:Z.id,type:"position",position:{x:At?Me:ge,y:we?Pt:ke}};oe.push(ht),E.current.x=ht.position.x,E.current.y=ht.position.y}}if(ct||on){const Me={id:k,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:$e,height:kt}};oe.push(Me),E.current.width=$e,E.current.height=kt}if(oe.length===0)return;const vt=IT({width:E.current.width,prevWidth:xe,height:E.current.height,prevHeight:de,invertX:q,invertY:G}),bt={...E.current,direction:vt};if((v==null?void 0:v(z,bt))===!1)return;w==null||w(z,bt),Y(oe)}}).on("end",z=>{const W={id:k,type:"dimensions",resizing:!1};y==null||y(z,{...E.current}),_.getState().triggerNodeChanges([W])});return Q.call(D),()=>{Q.on(".drag",null)}},[k,M,c,d,p,h,m,O,b,w,y]);const T=M.split("-"),A=n===Au.Line?"borderColor":"backgroundColor",$=a?{...o,[A]:a}:o;return i.jsx("div",{className:tm(["react-flow__resize-control","nodrag",...T,n,r]),ref:I,style:$,children:s})}var RT=f.memo(OT);const R3=1/60*1e3,MT=typeof performance<"u"?()=>performance.now():()=>Date.now(),M3=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(MT()),R3);function DT(e){let t=[],n=[],r=0,o=!1,s=!1;const a=new WeakSet,c={schedule:(d,p=!1,h=!1)=>{const m=h&&o,v=m?t:n;return p&&a.add(d),v.indexOf(d)===-1&&(v.push(d),m&&o&&(r=t.length)),d},cancel:d=>{const p=n.indexOf(d);p!==-1&&n.splice(p,1),a.delete(d)},process:d=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=DT(()=>Gu=!0),e),{}),AT=md.reduce((e,t)=>{const n=im[t];return e[t]=(r,o=!1,s=!1)=>(Gu||zT(),n.schedule(r,o,s)),e},{}),NT=md.reduce((e,t)=>(e[t]=im[t].cancel,e),{});md.reduce((e,t)=>(e[t]=()=>im[t].process(rc),e),{});const $T=e=>im[e].process(rc),D3=e=>{Gu=!1,rc.delta=Cv?R3:Math.max(Math.min(e-rc.timestamp,TT),1),rc.timestamp=e,kv=!0,md.forEach($T),kv=!1,Gu&&(Cv=!1,M3(D3))},zT=()=>{Gu=!0,Cv=!0,kv||M3(D3)},Sw=()=>rc;function Z1(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function LT(e){const{theme:t}=xR(),n=DD();return f.useMemo(()=>TD(t.direction,{...n,...e}),[e,t.direction,n])}var BT=Object.defineProperty,FT=(e,t,n)=>t in e?BT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vr=(e,t,n)=>(FT(e,typeof t!="symbol"?t+"":t,n),n);function Cw(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 HT=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function kw(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function _w(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var _v=typeof window<"u"?f.useLayoutEffect:f.useEffect,Hp=e=>e,WT=class{constructor(){vr(this,"descendants",new Map),vr(this,"register",e=>{if(e!=null)return HT(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),vr(this,"unregister",e=>{this.descendants.delete(e);const t=Cw(Array.from(this.descendants.keys()));this.assignIndex(t)}),vr(this,"destroy",()=>{this.descendants.clear()}),vr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),vr(this,"count",()=>this.descendants.size),vr(this,"enabledCount",()=>this.enabledValues().length),vr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),vr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),vr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),vr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),vr(this,"first",()=>this.item(0)),vr(this,"firstEnabled",()=>this.enabledItem(0)),vr(this,"last",()=>this.item(this.descendants.size-1)),vr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),vr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),vr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),vr(this,"next",(e,t=!0)=>{const n=kw(e,this.count(),t);return this.item(n)}),vr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=kw(r,this.enabledCount(),t);return this.enabledItem(o)}),vr(this,"prev",(e,t=!0)=>{const n=_w(e,this.count()-1,t);return this.item(n)}),vr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=_w(r,this.enabledCount()-1,t);return this.enabledItem(o)}),vr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Cw(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 VT(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 cn(...e){return t=>{e.forEach(n=>{VT(n,t)})}}function UT(...e){return f.useMemo(()=>cn(...e),e)}function GT(){const e=f.useRef(new WT);return _v(()=>()=>e.current.destroy()),e.current}var[qT,T3]=Rn({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function KT(e){const t=T3(),[n,r]=f.useState(-1),o=f.useRef(null);_v(()=>()=>{o.current&&t.unregister(o.current)},[]),_v(()=>{if(!o.current)return;const a=Number(o.current.dataset.index);n!=a&&!Number.isNaN(a)&&r(a)});const s=Hp(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:cn(s,o)}}function eb(){return[Hp(qT),()=>Hp(T3()),()=>GT(),o=>KT(o)]}var[YT,lm]=Rn({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[QT,tb]=Rn({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[XT,gde,JT,ZT]=eb(),ku=Te(function(t,n){const{getButtonProps:r}=tb(),o=r(t,n),a={display:"flex",alignItems:"center",width:"100%",outline:0,...lm().button};return i.jsx(je.button,{...o,className:Ct("chakra-accordion__button",t.className),__css:a})});ku.displayName="AccordionButton";function Nc(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(v,b)=>v!==b}=e,s=rr(r),a=rr(o),[c,d]=f.useState(n),p=t!==void 0,h=p?t:c,m=rr(v=>{const w=typeof v=="function"?v(h):v;a(h,w)&&(p||d(w),s(w))},[p,s,h,a]);return[h,m]}function eA(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...a}=e;rA(e),oA(e);const c=JT(),[d,p]=f.useState(-1);f.useEffect(()=>()=>{p(-1)},[]);const[h,m]=Nc({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:m,htmlProps:a,getAccordionItemProps:b=>{let w=!1;return b!==null&&(w=Array.isArray(h)?h.includes(b):h===b),{isOpen:w,onChange:S=>{if(b!==null)if(o&&Array.isArray(h)){const k=S?h.concat(b):h.filter(_=>_!==b);m(k)}else S?m(b):s&&m(-1)}}},focusedIndex:d,setFocusedIndex:p,descendants:c}}var[tA,nb]=Rn({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function nA(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:a}=nb(),c=f.useRef(null),d=f.useId(),p=r??d,h=`accordion-button-${p}`,m=`accordion-panel-${p}`;sA(e);const{register:v,index:b,descendants:w}=ZT({disabled:t&&!n}),{isOpen:y,onChange:S}=s(b===-1?null:b);aA({isOpen:y,isDisabled:t});const k=()=>{S==null||S(!0)},_=()=>{S==null||S(!1)},I=f.useCallback(()=>{S==null||S(!y),a(b)},[b,a,y,S]),P=f.useCallback(M=>{const A={ArrowDown:()=>{const $=w.nextEnabled(b);$==null||$.node.focus()},ArrowUp:()=>{const $=w.prevEnabled(b);$==null||$.node.focus()},Home:()=>{const $=w.firstEnabled();$==null||$.node.focus()},End:()=>{const $=w.lastEnabled();$==null||$.node.focus()}}[M.key];A&&(M.preventDefault(),A(M))},[w,b]),E=f.useCallback(()=>{a(b)},[a,b]),O=f.useCallback(function(T={},A=null){return{...T,type:"button",ref:cn(v,c,A),id:h,disabled:!!t,"aria-expanded":!!y,"aria-controls":m,onClick:tt(T.onClick,I),onFocus:tt(T.onFocus,E),onKeyDown:tt(T.onKeyDown,P)}},[h,t,y,I,E,P,m,v]),R=f.useCallback(function(T={},A=null){return{...T,ref:A,role:"region",id:m,"aria-labelledby":h,hidden:!y}},[h,y,m]);return{isOpen:y,isDisabled:t,isFocusable:n,onOpen:k,onClose:_,getButtonProps:O,getPanelProps:R,htmlProps:o}}function rA(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;cd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function oA(e){cd({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 sA(e){cd({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 aA(e){cd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function _u(e){const{isOpen:t,isDisabled:n}=tb(),{reduceMotion:r}=nb(),o=Ct("chakra-accordion__icon",e.className),s=lm(),a={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return i.jsx(no,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:a,...e,children:i.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}_u.displayName="AccordionIcon";var Pu=Te(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...a}=nA(t),d={...lm().container,overflowAnchor:"none"},p=f.useMemo(()=>a,[a]);return i.jsx(QT,{value:p,children:i.jsx(je.div,{ref:n,...s,className:Ct("chakra-accordion__item",o),__css:d,children:typeof r=="function"?r({isExpanded:!!a.isOpen,isDisabled:!!a.isDisabled}):r})})});Pu.displayName="AccordionItem";var qi={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},fu={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function Pv(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return fu.slideRight;case"left":return fu.slideLeft;case"bottom":return fu.slideDown;case"top":return fu.slideUp;default:return fu.slideRight}}var Yi={enter:{duration:.2,ease:qi.easeOut},exit:{duration:.1,ease:qi.easeIn}},ks={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})},iA=e=>e!=null&&parseInt(e.toString(),10)>0,Pw={exit:{height:{duration:.2,ease:qi.ease},opacity:{duration:.3,ease:qi.ease}},enter:{height:{duration:.3,ease:qi.ease},opacity:{duration:.4,ease:qi.ease}}},lA={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:iA(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:ks.exit(Pw.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:ks.enter(Pw.enter,o)}}},cm=f.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:a="auto",style:c,className:d,transition:p,transitionEnd:h,...m}=e,[v,b]=f.useState(!1);f.useEffect(()=>{const _=setTimeout(()=>{b(!0)});return()=>clearTimeout(_)},[]),cd({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const w=parseFloat(s.toString())>0,y={startingHeight:s,endingHeight:a,animateOpacity:o,transition:v?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:w?"block":"none"}}},S=r?n:!0,k=n||r?"enter":"exit";return i.jsx(Fo,{initial:!1,custom:y,children:S&&i.jsx(Yr.div,{ref:t,...m,className:Ct("chakra-collapse",d),style:{overflow:"hidden",display:"block",...c},custom:y,variants:lA,initial:r?"exit":!1,animate:k,exit:"exit"})})});cm.displayName="Collapse";var cA={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:ks.enter(Yi.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:ks.exit(Yi.exit,n),transitionEnd:t==null?void 0:t.exit}}},A3={initial:"exit",animate:"enter",exit:"exit",variants:cA},uA=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:a,transitionEnd:c,delay:d,...p}=t,h=o||r?"enter":"exit",m=r?o&&r:!0,v={transition:a,transitionEnd:c,delay:d};return i.jsx(Fo,{custom:v,children:m&&i.jsx(Yr.div,{ref:n,className:Ct("chakra-fade",s),custom:v,...A3,animate:h,...p})})});uA.displayName="Fade";var dA={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:ks.exit(Yi.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:ks.enter(Yi.enter,n),transitionEnd:e==null?void 0:e.enter}}},N3={initial:"exit",animate:"enter",exit:"exit",variants:dA},fA=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:a=.95,className:c,transition:d,transitionEnd:p,delay:h,...m}=t,v=r?o&&r:!0,b=o||r?"enter":"exit",w={initialScale:a,reverse:s,transition:d,transitionEnd:p,delay:h};return i.jsx(Fo,{custom:w,children:v&&i.jsx(Yr.div,{ref:n,className:Ct("chakra-offset-slide",c),...N3,animate:b,custom:w,...m})})});fA.displayName="ScaleFade";var pA={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:ks.exit(Yi.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:ks.enter(Yi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var a;const c={x:t,y:e};return{opacity:0,transition:(a=n==null?void 0:n.exit)!=null?a:ks.exit(Yi.exit,s),...o?{...c,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...c,...r==null?void 0:r.exit}}}}},jv={initial:"initial",animate:"enter",exit:"exit",variants:pA},hA=f.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:a,offsetX:c=0,offsetY:d=8,transition:p,transitionEnd:h,delay:m,...v}=t,b=r?o&&r:!0,w=o||r?"enter":"exit",y={offsetX:c,offsetY:d,reverse:s,transition:p,transitionEnd:h,delay:m};return i.jsx(Fo,{custom:y,children:b&&i.jsx(Yr.div,{ref:n,className:Ct("chakra-offset-slide",a),custom:y,...jv,animate:w,...v})})});hA.displayName="SlideFade";var jw={exit:{duration:.15,ease:qi.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},mA={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=Pv({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:ks.exit(jw.exit,r),transitionEnd:n==null?void 0:n.exit}},enter:({direction:e,transitionEnd:t,transition:n,delay:r})=>{var o;const{enter:s}=Pv({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:ks.enter(jw.enter,r),transitionEnd:t==null?void 0:t.enter}}},$3=f.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:a,className:c,transition:d,transitionEnd:p,delay:h,motionProps:m,...v}=t,b=Pv({direction:r}),w=Object.assign({position:"fixed"},b.position,o),y=s?a&&s:!0,S=a||s?"enter":"exit",k={transitionEnd:p,transition:d,direction:r,delay:h};return i.jsx(Fo,{custom:k,children:y&&i.jsx(Yr.div,{...v,ref:n,initial:"exit",className:Ct("chakra-slide",c),animate:S,exit:"exit",custom:k,variants:mA,style:w,...m})})});$3.displayName="Slide";var ju=Te(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:a}=nb(),{getPanelProps:c,isOpen:d}=tb(),p=c(s,n),h=Ct("chakra-accordion__panel",r),m=lm();a||delete p.hidden;const v=i.jsx(je.div,{...p,__css:m.panel,className:h});return a?v:i.jsx(cm,{in:d,...o,children:v})});ju.displayName="AccordionPanel";var z3=Te(function({children:t,reduceMotion:n,...r},o){const s=Br("Accordion",r),a=qn(r),{htmlProps:c,descendants:d,...p}=eA(a),h=f.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return i.jsx(XT,{value:d,children:i.jsx(tA,{value:h,children:i.jsx(YT,{value:s,children:i.jsx(je.div,{ref:o,...c,className:Ct("chakra-accordion",r.className),__css:s.root,children:t})})})})});z3.displayName="Accordion";function gd(e){return f.Children.toArray(e).filter(t=>f.isValidElement(t))}var[gA,vA]=Rn({strict:!1,name:"ButtonGroupContext"}),bA={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}}},yA={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},nr=Te(function(t,n){const{size:r,colorScheme:o,variant:s,className:a,spacing:c="0.5rem",isAttached:d,isDisabled:p,orientation:h="horizontal",...m}=t,v=Ct("chakra-button__group",a),b=f.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let w={display:"inline-flex",...d?bA[h]:yA[h](c)};const y=h==="vertical";return i.jsx(gA,{value:b,children:i.jsx(je.div,{ref:n,role:"group",__css:w,className:v,"data-attached":d?"":void 0,"data-orientation":h,flexDir:y?"column":void 0,...m})})});nr.displayName="ButtonGroup";function xA(e){const[t,n]=f.useState(!e);return{ref:f.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function Iv(e){const{children:t,className:n,...r}=e,o=f.isValidElement(t)?f.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ct("chakra-button__icon",n);return i.jsx(je.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}Iv.displayName="ButtonIcon";function Wp(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=i.jsx(fl,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:a,...c}=e,d=Ct("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=f.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...a}),[a,t,p,r]);return i.jsx(je.div,{className:d,...c,__css:h,children:o})}Wp.displayName="ButtonSpinner";var vc=Te((e,t)=>{const n=vA(),r=ia("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:a,children:c,leftIcon:d,rightIcon:p,loadingText:h,iconSpacing:m="0.5rem",type:v,spinner:b,spinnerPlacement:w="start",className:y,as:S,...k}=qn(e),_=f.useMemo(()=>{const O={...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:O}}},[r,n]),{ref:I,type:P}=xA(S),E={rightIcon:p,leftIcon:d,iconSpacing:m,children:c};return i.jsxs(je.button,{ref:UT(t,I),as:S,type:v??P,"data-active":Ft(a),"data-loading":Ft(s),__css:_,className:Ct("chakra-button",y),...k,disabled:o||s,children:[s&&w==="start"&&i.jsx(Wp,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:m,children:b}),s?h||i.jsx(je.span,{opacity:0,children:i.jsx(Iw,{...E})}):i.jsx(Iw,{...E}),s&&w==="end"&&i.jsx(Wp,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:m,children:b})]})});vc.displayName="Button";function Iw(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return i.jsxs(i.Fragment,{children:[t&&i.jsx(Iv,{marginEnd:o,children:t}),r,n&&i.jsx(Iv,{marginStart:o,children:n})]})}var Ca=Te((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...a}=e,c=n||r,d=f.isValidElement(c)?f.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return i.jsx(vc,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...a,children:d})});Ca.displayName="IconButton";var[vde,wA]=Rn({name:"CheckboxGroupContext",strict:!1});function SA(e){const[t,n]=f.useState(e),[r,o]=f.useState(!1);return e!==t&&(o(!0),n(e)),r}function CA(e){return i.jsx(je.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:i.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function kA(e){return i.jsx(je.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:i.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function _A(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?kA:CA;return n||t?i.jsx(je.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:i.jsx(o,{...r})}):null}var[PA,L3]=Rn({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[jA,vd]=Rn({strict:!1,name:"FormControlContext"});function IA(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...a}=e,c=f.useId(),d=t||`field-${c}`,p=`${d}-label`,h=`${d}-feedback`,m=`${d}-helptext`,[v,b]=f.useState(!1),[w,y]=f.useState(!1),[S,k]=f.useState(!1),_=f.useCallback((R={},M=null)=>({id:m,...R,ref:cn(M,T=>{T&&y(!0)})}),[m]),I=f.useCallback((R={},M=null)=>({...R,ref:M,"data-focus":Ft(S),"data-disabled":Ft(o),"data-invalid":Ft(r),"data-readonly":Ft(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:d}),[d,o,S,r,s,p]),P=f.useCallback((R={},M=null)=>({id:h,...R,ref:cn(M,T=>{T&&b(!0)}),"aria-live":"polite"}),[h]),E=f.useCallback((R={},M=null)=>({...R,...a,ref:M,role:"group"}),[a]),O=f.useCallback((R={},M=null)=>({...R,ref:M,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!S,onFocus:()=>k(!0),onBlur:()=>k(!1),hasFeedbackText:v,setHasFeedbackText:b,hasHelpText:w,setHasHelpText:y,id:d,labelId:p,feedbackId:h,helpTextId:m,htmlProps:a,getHelpTextProps:_,getErrorMessageProps:P,getRootProps:E,getLabelProps:I,getRequiredIndicatorProps:O}}var mo=Te(function(t,n){const r=Br("Form",t),o=qn(t),{getRootProps:s,htmlProps:a,...c}=IA(o),d=Ct("chakra-form-control",t.className);return i.jsx(jA,{value:c,children:i.jsx(PA,{value:r,children:i.jsx(je.div,{...s({},n),className:d,__css:r.container})})})});mo.displayName="FormControl";var EA=Te(function(t,n){const r=vd(),o=L3(),s=Ct("chakra-form__helper-text",t.className);return i.jsx(je.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});EA.displayName="FormHelperText";var zo=Te(function(t,n){var r;const o=ia("FormLabel",t),s=qn(t),{className:a,children:c,requiredIndicator:d=i.jsx(B3,{}),optionalIndicator:p=null,...h}=s,m=vd(),v=(r=m==null?void 0:m.getLabelProps(h,n))!=null?r:{ref:n,...h};return i.jsxs(je.label,{...v,className:Ct("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[c,m!=null&&m.isRequired?d:p]})});zo.displayName="FormLabel";var B3=Te(function(t,n){const r=vd(),o=L3();if(!(r!=null&&r.isRequired))return null;const s=Ct("chakra-form__required-indicator",t.className);return i.jsx(je.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});B3.displayName="RequiredIndicator";function rb(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=ob(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":ns(n),"aria-required":ns(o),"aria-readonly":ns(r)}}function ob(e){var t,n,r;const o=vd(),{id:s,disabled:a,readOnly:c,required:d,isRequired:p,isInvalid:h,isReadOnly:m,isDisabled:v,onFocus:b,onBlur:w,...y}=e,S=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&S.push(o.feedbackId),o!=null&&o.hasHelpText&&S.push(o.helpTextId),{...y,"aria-describedby":S.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=a??v)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=c??m)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=d??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:tt(o==null?void 0:o.onFocus,b),onBlur:tt(o==null?void 0:o.onBlur,w)}}var sb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},F3=je("span",{baseStyle:sb});F3.displayName="VisuallyHidden";var OA=je("input",{baseStyle:sb});OA.displayName="VisuallyHiddenInput";const RA=()=>typeof document<"u";let Ew=!1,bd=null,rl=!1,Ev=!1;const Ov=new Set;function ab(e,t){Ov.forEach(n=>n(e,t))}const MA=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function DA(e){return!(e.metaKey||!MA&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Ow(e){rl=!0,DA(e)&&(bd="keyboard",ab("keyboard",e))}function Tl(e){if(bd="pointer",e.type==="mousedown"||e.type==="pointerdown"){rl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;ab("pointer",e)}}function TA(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function AA(e){TA(e)&&(rl=!0,bd="virtual")}function NA(e){e.target===window||e.target===document||(!rl&&!Ev&&(bd="virtual",ab("virtual",e)),rl=!1,Ev=!1)}function $A(){rl=!1,Ev=!0}function Rw(){return bd!=="pointer"}function zA(){if(!RA()||Ew)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){rl=!0,e.apply(this,n)},document.addEventListener("keydown",Ow,!0),document.addEventListener("keyup",Ow,!0),document.addEventListener("click",AA,!0),window.addEventListener("focus",NA,!0),window.addEventListener("blur",$A,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Tl,!0),document.addEventListener("pointermove",Tl,!0),document.addEventListener("pointerup",Tl,!0)):(document.addEventListener("mousedown",Tl,!0),document.addEventListener("mousemove",Tl,!0),document.addEventListener("mouseup",Tl,!0)),Ew=!0}function H3(e){zA(),e(Rw());const t=()=>e(Rw());return Ov.add(t),()=>{Ov.delete(t)}}function LA(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function W3(e={}){const t=ob(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:a,onBlur:c,onFocus:d,"aria-describedby":p}=t,{defaultChecked:h,isChecked:m,isFocusable:v,onChange:b,isIndeterminate:w,name:y,value:S,tabIndex:k=void 0,"aria-label":_,"aria-labelledby":I,"aria-invalid":P,...E}=e,O=LA(E,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=rr(b),M=rr(c),T=rr(d),[A,$]=f.useState(!1),[Q,B]=f.useState(!1),[V,q]=f.useState(!1),[G,D]=f.useState(!1);f.useEffect(()=>H3($),[]);const z=f.useRef(null),[W,Y]=f.useState(!0),[ie,ye]=f.useState(!!h),Z=m!==void 0,oe=Z?m:ie,K=f.useCallback(de=>{if(r||n){de.preventDefault();return}Z||ye(oe?de.target.checked:w?!0:de.target.checked),R==null||R(de)},[r,n,oe,Z,w,R]);ec(()=>{z.current&&(z.current.indeterminate=!!w)},[w]),Ba(()=>{n&&B(!1)},[n,B]),ec(()=>{const de=z.current;if(!(de!=null&&de.form))return;const Ae=()=>{ye(!!h)};return de.form.addEventListener("reset",Ae),()=>{var Ee;return(Ee=de.form)==null?void 0:Ee.removeEventListener("reset",Ae)}},[]);const U=n&&!v,ae=f.useCallback(de=>{de.key===" "&&D(!0)},[D]),re=f.useCallback(de=>{de.key===" "&&D(!1)},[D]);ec(()=>{if(!z.current)return;z.current.checked!==oe&&ye(z.current.checked)},[z.current]);const se=f.useCallback((de={},Ae=null)=>{const Ee=$e=>{Q&&$e.preventDefault(),D(!0)};return{...de,ref:Ae,"data-active":Ft(G),"data-hover":Ft(V),"data-checked":Ft(oe),"data-focus":Ft(Q),"data-focus-visible":Ft(Q&&A),"data-indeterminate":Ft(w),"data-disabled":Ft(n),"data-invalid":Ft(s),"data-readonly":Ft(r),"aria-hidden":!0,onMouseDown:tt(de.onMouseDown,Ee),onMouseUp:tt(de.onMouseUp,()=>D(!1)),onMouseEnter:tt(de.onMouseEnter,()=>q(!0)),onMouseLeave:tt(de.onMouseLeave,()=>q(!1))}},[G,oe,n,Q,A,V,w,s,r]),pe=f.useCallback((de={},Ae=null)=>({...de,ref:Ae,"data-active":Ft(G),"data-hover":Ft(V),"data-checked":Ft(oe),"data-focus":Ft(Q),"data-focus-visible":Ft(Q&&A),"data-indeterminate":Ft(w),"data-disabled":Ft(n),"data-invalid":Ft(s),"data-readonly":Ft(r)}),[G,oe,n,Q,A,V,w,s,r]),le=f.useCallback((de={},Ae=null)=>({...O,...de,ref:cn(Ae,Ee=>{Ee&&Y(Ee.tagName==="LABEL")}),onClick:tt(de.onClick,()=>{var Ee;W||((Ee=z.current)==null||Ee.click(),requestAnimationFrame(()=>{var $e;($e=z.current)==null||$e.focus({preventScroll:!0})}))}),"data-disabled":Ft(n),"data-checked":Ft(oe),"data-invalid":Ft(s)}),[O,n,oe,s,W]),ge=f.useCallback((de={},Ae=null)=>({...de,ref:cn(z,Ae),type:"checkbox",name:y,value:S,id:a,tabIndex:k,onChange:tt(de.onChange,K),onBlur:tt(de.onBlur,M,()=>B(!1)),onFocus:tt(de.onFocus,T,()=>B(!0)),onKeyDown:tt(de.onKeyDown,ae),onKeyUp:tt(de.onKeyUp,re),required:o,checked:oe,disabled:U,readOnly:r,"aria-label":_,"aria-labelledby":I,"aria-invalid":P?!!P:s,"aria-describedby":p,"aria-disabled":n,style:sb}),[y,S,a,K,M,T,ae,re,o,oe,U,r,_,I,P,s,p,n,k]),ke=f.useCallback((de={},Ae=null)=>({...de,ref:Ae,onMouseDown:tt(de.onMouseDown,BA),"data-disabled":Ft(n),"data-checked":Ft(oe),"data-invalid":Ft(s)}),[oe,n,s]);return{state:{isInvalid:s,isFocused:Q,isChecked:oe,isActive:G,isHovered:V,isIndeterminate:w,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:le,getCheckboxProps:se,getIndicatorProps:pe,getInputProps:ge,getLabelProps:ke,htmlProps:O}}function BA(e){e.preventDefault(),e.stopPropagation()}var FA={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},HA={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},WA=za({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),VA=za({from:{opacity:0},to:{opacity:1}}),UA=za({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),V3=Te(function(t,n){const r=wA(),o={...r,...t},s=Br("Checkbox",o),a=qn(t),{spacing:c="0.5rem",className:d,children:p,iconColor:h,iconSize:m,icon:v=i.jsx(_A,{}),isChecked:b,isDisabled:w=r==null?void 0:r.isDisabled,onChange:y,inputProps:S,...k}=a;let _=b;r!=null&&r.value&&a.value&&(_=r.value.includes(a.value));let I=y;r!=null&&r.onChange&&a.value&&(I=nm(r.onChange,y));const{state:P,getInputProps:E,getCheckboxProps:O,getLabelProps:R,getRootProps:M}=W3({...k,isDisabled:w,isChecked:_,onChange:I}),T=SA(P.isChecked),A=f.useMemo(()=>({animation:T?P.isIndeterminate?`${VA} 20ms linear, ${UA} 200ms linear`:`${WA} 200ms linear`:void 0,fontSize:m,color:h,...s.icon}),[h,m,T,P.isIndeterminate,s.icon]),$=f.cloneElement(v,{__css:A,isIndeterminate:P.isIndeterminate,isChecked:P.isChecked});return i.jsxs(je.label,{__css:{...HA,...s.container},className:Ct("chakra-checkbox",d),...M(),children:[i.jsx("input",{className:"chakra-checkbox__input",...E(S,n)}),i.jsx(je.span,{__css:{...FA,...s.control},className:"chakra-checkbox__control",...O(),children:$}),p&&i.jsx(je.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:c,...s.label},children:p})]})});V3.displayName="Checkbox";function GA(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function ib(e,t){let n=GA(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function Rv(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 Vp(e,t,n){return(e-t)*100/(n-t)}function U3(e,t,n){return(n-t)*e+t}function Mv(e,t,n){const r=Math.round((e-t)/n)*n+t,o=Rv(n);return ib(r,o)}function oc(e,t,n){return e==null?e:(n{var A;return r==null?"":(A=g0(r,s,n))!=null?A:""}),v=typeof o<"u",b=v?o:h,w=G3(ni(b),s),y=n??w,S=f.useCallback(A=>{A!==b&&(v||m(A.toString()),p==null||p(A.toString(),ni(A)))},[p,v,b]),k=f.useCallback(A=>{let $=A;return d&&($=oc($,a,c)),ib($,y)},[y,d,c,a]),_=f.useCallback((A=s)=>{let $;b===""?$=ni(A):$=ni(b)+A,$=k($),S($)},[k,s,S,b]),I=f.useCallback((A=s)=>{let $;b===""?$=ni(-A):$=ni(b)-A,$=k($),S($)},[k,s,S,b]),P=f.useCallback(()=>{var A;let $;r==null?$="":$=(A=g0(r,s,n))!=null?A:a,S($)},[r,n,s,S,a]),E=f.useCallback(A=>{var $;const Q=($=g0(A,s,y))!=null?$:a;S(Q)},[y,s,S,a]),O=ni(b);return{isOutOfRange:O>c||O" `}),[YA,K3]=Rn({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),Y3={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},Q3=Te(function(t,n){const{getInputProps:r}=K3(),o=q3(),s=r(t,n),a=Ct("chakra-editable__input",t.className);return i.jsx(je.input,{...s,__css:{outline:0,...Y3,...o.input},className:a})});Q3.displayName="EditableInput";var X3=Te(function(t,n){const{getPreviewProps:r}=K3(),o=q3(),s=r(t,n),a=Ct("chakra-editable__preview",t.className);return i.jsx(je.span,{...s,__css:{cursor:"text",display:"inline-block",...Y3,...o.preview},className:a})});X3.displayName="EditablePreview";function Qi(e,t,n,r){const o=rr(n);return f.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 QA(e){return"current"in e}var J3=()=>typeof window<"u";function XA(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var JA=e=>J3()&&e.test(navigator.vendor),ZA=e=>J3()&&e.test(XA()),e9=()=>ZA(/mac|iphone|ipad|ipod/i),t9=()=>e9()&&JA(/apple/i);function Z3(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,a;return(a=(s=t.current)==null?void 0:s.ownerDocument)!=null?a:document};Qi(o,"pointerdown",s=>{if(!t9()||!r)return;const a=s.target,d=(n??[t]).some(p=>{const h=QA(p)?p.current:p;return(h==null?void 0:h.contains(a))||h===a});o().activeElement!==a&&d&&(s.preventDefault(),a.focus())})}function Mw(e,t){return e?e===t||e.contains(t):!1}function n9(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:a,defaultValue:c,startWithEditView:d,isPreviewFocusable:p=!0,submitOnBlur:h=!0,selectAllOnFocus:m=!0,placeholder:v,onEdit:b,finalFocusRef:w,...y}=e,S=rr(b),k=!!(d&&!a),[_,I]=f.useState(k),[P,E]=Nc({defaultValue:c||"",value:s,onChange:t}),[O,R]=f.useState(P),M=f.useRef(null),T=f.useRef(null),A=f.useRef(null),$=f.useRef(null),Q=f.useRef(null);Z3({ref:M,enabled:_,elements:[$,Q]});const B=!_&&!a;ec(()=>{var se,pe;_&&((se=M.current)==null||se.focus(),m&&((pe=M.current)==null||pe.select()))},[]),Ba(()=>{var se,pe,le,ge;if(!_){w?(se=w.current)==null||se.focus():(pe=A.current)==null||pe.focus();return}(le=M.current)==null||le.focus(),m&&((ge=M.current)==null||ge.select()),S==null||S()},[_,S,m]);const V=f.useCallback(()=>{B&&I(!0)},[B]),q=f.useCallback(()=>{R(P)},[P]),G=f.useCallback(()=>{I(!1),E(O),n==null||n(O),o==null||o(O)},[n,o,E,O]),D=f.useCallback(()=>{I(!1),R(P),r==null||r(P),o==null||o(O)},[P,r,o,O]);f.useEffect(()=>{if(_)return;const se=M.current;(se==null?void 0:se.ownerDocument.activeElement)===se&&(se==null||se.blur())},[_]);const z=f.useCallback(se=>{E(se.currentTarget.value)},[E]),W=f.useCallback(se=>{const pe=se.key,ge={Escape:G,Enter:ke=>{!ke.shiftKey&&!ke.metaKey&&D()}}[pe];ge&&(se.preventDefault(),ge(se))},[G,D]),Y=f.useCallback(se=>{const pe=se.key,ge={Escape:G}[pe];ge&&(se.preventDefault(),ge(se))},[G]),ie=P.length===0,ye=f.useCallback(se=>{var pe;if(!_)return;const le=se.currentTarget.ownerDocument,ge=(pe=se.relatedTarget)!=null?pe:le.activeElement,ke=Mw($.current,ge),xe=Mw(Q.current,ge);!ke&&!xe&&(h?D():G())},[h,D,G,_]),Z=f.useCallback((se={},pe=null)=>{const le=B&&p?0:void 0;return{...se,ref:cn(pe,T),children:ie?v:P,hidden:_,"aria-disabled":ns(a),tabIndex:le,onFocus:tt(se.onFocus,V,q)}},[a,_,B,p,ie,V,q,v,P]),oe=f.useCallback((se={},pe=null)=>({...se,hidden:!_,placeholder:v,ref:cn(pe,M),disabled:a,"aria-disabled":ns(a),value:P,onBlur:tt(se.onBlur,ye),onChange:tt(se.onChange,z),onKeyDown:tt(se.onKeyDown,W),onFocus:tt(se.onFocus,q)}),[a,_,ye,z,W,q,v,P]),K=f.useCallback((se={},pe=null)=>({...se,hidden:!_,placeholder:v,ref:cn(pe,M),disabled:a,"aria-disabled":ns(a),value:P,onBlur:tt(se.onBlur,ye),onChange:tt(se.onChange,z),onKeyDown:tt(se.onKeyDown,Y),onFocus:tt(se.onFocus,q)}),[a,_,ye,z,Y,q,v,P]),U=f.useCallback((se={},pe=null)=>({"aria-label":"Edit",...se,type:"button",onClick:tt(se.onClick,V),ref:cn(pe,A),disabled:a}),[V,a]),ae=f.useCallback((se={},pe=null)=>({...se,"aria-label":"Submit",ref:cn(Q,pe),type:"button",onClick:tt(se.onClick,D),disabled:a}),[D,a]),re=f.useCallback((se={},pe=null)=>({"aria-label":"Cancel",id:"cancel",...se,ref:cn($,pe),type:"button",onClick:tt(se.onClick,G),disabled:a}),[G,a]);return{isEditing:_,isDisabled:a,isValueEmpty:ie,value:P,onEdit:V,onCancel:G,onSubmit:D,getPreviewProps:Z,getInputProps:oe,getTextareaProps:K,getEditButtonProps:U,getSubmitButtonProps:ae,getCancelButtonProps:re,htmlProps:y}}var e5=Te(function(t,n){const r=Br("Editable",t),o=qn(t),{htmlProps:s,...a}=n9(o),{isEditing:c,onSubmit:d,onCancel:p,onEdit:h}=a,m=Ct("chakra-editable",t.className),v=$1(t.children,{isEditing:c,onSubmit:d,onCancel:p,onEdit:h});return i.jsx(YA,{value:a,children:i.jsx(KA,{value:r,children:i.jsx(je.div,{ref:n,...s,className:m,children:v})})})});e5.displayName="Editable";var t5={exports:{}},r9="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",o9=r9,s9=o9;function n5(){}function r5(){}r5.resetWarningCache=n5;var a9=function(){function e(r,o,s,a,c,d){if(d!==s9){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r5,resetWarningCache:n5};return n.PropTypes=n,n};t5.exports=a9();var i9=t5.exports;const zn=ud(i9);var Dv="data-focus-lock",o5="data-focus-lock-disabled",l9="data-no-focus-lock",c9="data-autofocus-inside",u9="data-no-autofocus";function d9(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function f9(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function s5(e,t){return f9(t||null,function(n){return e.forEach(function(r){return d9(r,n)})})}var v0={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Xs=function(){return Xs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(c){a={error:c}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return s}function Tv(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(P9)},j9=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],db=j9.join(","),I9="".concat(db,", [data-focus-guard]"),C5=function(e,t){return la((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?I9:db)?[r]:[],C5(r))},[])},E9=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?um([e.contentDocument.body],t):[e]},um=function(e,t){return e.reduce(function(n,r){var o,s=C5(r,t),a=(o=[]).concat.apply(o,s.map(function(c){return E9(c,t)}));return n.concat(a,r.parentNode?la(r.parentNode.querySelectorAll(db)).filter(function(c){return c===r}):[])},[])},O9=function(e){var t=e.querySelectorAll("[".concat(c9,"]"));return la(t).map(function(n){return um([n])}).reduce(function(n,r){return n.concat(r)},[])},fb=function(e,t){return la(e).filter(function(n){return v5(t,n)}).filter(function(n){return C9(n)})},Tw=function(e,t){return t===void 0&&(t=new Map),la(e).filter(function(n){return b5(t,n)})},Nv=function(e,t,n){return S5(fb(um(e,n),t),!0,n)},Aw=function(e,t){return S5(fb(um(e),t),!1)},R9=function(e,t){return fb(O9(e),t)},sc=function(e,t){return e.shadowRoot?sc(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:la(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?sc(o,t):!1}return sc(n,t)})},M9=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(a,c){return!t.has(c)})},k5=function(e){return e.parentNode?k5(e.parentNode):e},pb=function(e){var t=Up(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(Dv);return n.push.apply(n,o?M9(la(k5(r).querySelectorAll("[".concat(Dv,'="').concat(o,'"]:not([').concat(o5,'="disabled"])')))):[r]),n},[])},D9=function(e){try{return e()}catch{return}},qu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?qu(t.shadowRoot):t instanceof HTMLIFrameElement&&D9(function(){return t.contentWindow.document})?qu(t.contentWindow.document):t}},T9=function(e,t){return e===t},A9=function(e,t){return!!la(e.querySelectorAll("iframe")).some(function(n){return T9(n,t)})},_5=function(e,t){return t===void 0&&(t=qu(h5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:pb(e).some(function(n){return sc(n,t)||A9(n,t)})},N9=function(e){e===void 0&&(e=document);var t=qu(e);return t?la(e.querySelectorAll("[".concat(l9,"]"))).some(function(n){return sc(n,t)}):!1},$9=function(e,t){return t.filter(w5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},hb=function(e,t){return w5(e)&&e.name?$9(e,t):e},z9=function(e){var t=new Set;return e.forEach(function(n){return t.add(hb(n,e))}),e.filter(function(n){return t.has(n)})},Nw=function(e){return e[0]&&e.length>1?hb(e[0],e):e[0]},$w=function(e,t){return e.length>1?e.indexOf(hb(e[t],e)):t},P5="NEW_FOCUS",L9=function(e,t,n,r){var o=e.length,s=e[0],a=e[o-1],c=ub(n);if(!(n&&e.indexOf(n)>=0)){var d=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):d,h=r?e.indexOf(r):-1,m=d-p,v=t.indexOf(s),b=t.indexOf(a),w=z9(t),y=n!==void 0?w.indexOf(n):-1,S=y-(r?w.indexOf(r):d),k=$w(e,0),_=$w(e,o-1);if(d===-1||h===-1)return P5;if(!m&&h>=0)return h;if(d<=v&&c&&Math.abs(m)>1)return _;if(d>=b&&c&&Math.abs(m)>1)return k;if(m&&Math.abs(S)>1)return h;if(d<=v)return _;if(d>b)return k;if(m)return Math.abs(m)>1?h:(o+h+m)%o}},B9=function(e){return function(t){var n,r=(n=y5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},F9=function(e,t,n){var r=e.map(function(s){var a=s.node;return a}),o=Tw(r.filter(B9(n)));return o&&o.length?Nw(o):Nw(Tw(t))},$v=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&$v(e.parentNode.host||e.parentNode,t),t},b0=function(e,t){for(var n=$v(e),r=$v(t),o=0;o=0)return s}return!1},j5=function(e,t,n){var r=Up(e),o=Up(t),s=r[0],a=!1;return o.filter(Boolean).forEach(function(c){a=b0(a||c,c)||a,n.filter(Boolean).forEach(function(d){var p=b0(s,d);p&&(!a||sc(p,a)?a=p:a=b0(p,a))})}),a},H9=function(e,t){return e.reduce(function(n,r){return n.concat(R9(r,t))},[])},W9=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(_9)},V9=function(e,t){var n=qu(Up(e).length>0?document:h5(e).ownerDocument),r=pb(e).filter(Gp),o=j5(n||e,e,r),s=new Map,a=Aw(r,s),c=Nv(r,s).filter(function(b){var w=b.node;return Gp(w)});if(!(!c[0]&&(c=a,!c[0]))){var d=Aw([o],s).map(function(b){var w=b.node;return w}),p=W9(d,c),h=p.map(function(b){var w=b.node;return w}),m=L9(h,d,n,t);if(m===P5){var v=F9(a,h,H9(r,s));if(v)return{node:v};console.warn("focus-lock: cannot find any node to move focus into");return}return m===void 0?m:p[m]}},U9=function(e){var t=pb(e).filter(Gp),n=j5(e,e,t),r=new Map,o=Nv([n],r,!0),s=Nv(t,r).filter(function(a){var c=a.node;return Gp(c)}).map(function(a){var c=a.node;return c});return o.map(function(a){var c=a.node,d=a.index;return{node:c,index:d,lockItem:s.indexOf(c)>=0,guard:ub(c)}})},G9=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},y0=0,x0=!1,I5=function(e,t,n){n===void 0&&(n={});var r=V9(e,t);if(!x0&&r){if(y0>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),x0=!0,setTimeout(function(){x0=!1},1);return}y0++,G9(r.node,n.focusOptions),y0--}};function mb(e){setTimeout(e,1)}var q9=function(){return document&&document.activeElement===document.body},K9=function(){return q9()||N9()},ac=null,Yl=null,ic=null,Ku=!1,Y9=function(){return!0},Q9=function(t){return(ac.whiteList||Y9)(t)},X9=function(t,n){ic={observerNode:t,portaledElement:n}},J9=function(t){return ic&&ic.portaledElement===t};function zw(e,t,n,r){var o=null,s=e;do{var a=r[s];if(a.guard)a.node.dataset.focusAutoGuard&&(o=a);else if(a.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var Z9=function(t){return t&&"current"in t?t.current:t},eN=function(t){return t?!!Ku:Ku==="meanwhile"},tN=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},nN=function(t,n){return n.some(function(r){return tN(t,r,r)})},qp=function(){var t=!1;if(ac){var n=ac,r=n.observed,o=n.persistentFocus,s=n.autoFocus,a=n.shards,c=n.crossFrame,d=n.focusOptions,p=r||ic&&ic.portaledElement,h=document&&document.activeElement;if(p){var m=[p].concat(a.map(Z9).filter(Boolean));if((!h||Q9(h))&&(o||eN(c)||!K9()||!Yl&&s)&&(p&&!(_5(m)||h&&nN(h,m)||J9(h))&&(document&&!Yl&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=I5(m,Yl,{focusOptions:d}),ic={})),Ku=!1,Yl=document&&document.activeElement),document){var v=document&&document.activeElement,b=U9(m),w=b.map(function(y){var S=y.node;return S}).indexOf(v);w>-1&&(b.filter(function(y){var S=y.guard,k=y.node;return S&&k.dataset.focusAutoGuard}).forEach(function(y){var S=y.node;return S.removeAttribute("tabIndex")}),zw(w,b.length,1,b),zw(w,-1,-1,b))}}}return t},E5=function(t){qp()&&t&&(t.stopPropagation(),t.preventDefault())},gb=function(){return mb(qp)},rN=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||X9(r,n)},oN=function(){return null},O5=function(){Ku="just",mb(function(){Ku="meanwhile"})},sN=function(){document.addEventListener("focusin",E5),document.addEventListener("focusout",gb),window.addEventListener("blur",O5)},aN=function(){document.removeEventListener("focusin",E5),document.removeEventListener("focusout",gb),window.removeEventListener("blur",O5)};function iN(e){return e.filter(function(t){var n=t.disabled;return!n})}function lN(e){var t=e.slice(-1)[0];t&&!ac&&sN();var n=ac,r=n&&t&&t.id===n.id;ac=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Yl=null,(!r||n.observed!==t.observed)&&t.onActivation(),qp(),mb(qp)):(aN(),Yl=null)}d5.assignSyncMedium(rN);f5.assignMedium(gb);h9.assignMedium(function(e){return e({moveFocusInside:I5,focusInside:_5})});const cN=b9(iN,lN)(oN);var R5=f.forwardRef(function(t,n){return f.createElement(p5,or({sideCar:cN,ref:n},t))}),M5=p5.propTypes||{};M5.sideCar;zD(M5,["sideCar"]);R5.propTypes={};const Lw=R5;function D5(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function vb(e){var t;if(!D5(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function uN(e){var t,n;return(n=(t=T5(e))==null?void 0:t.defaultView)!=null?n:window}function T5(e){return D5(e)?e.ownerDocument:document}function dN(e){return T5(e).activeElement}function fN(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 pN(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function A5(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:vb(e)&&fN(e)?e:A5(pN(e))}var N5=e=>e.hasAttribute("tabindex"),hN=e=>N5(e)&&e.tabIndex===-1;function mN(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function $5(e){return e.parentElement&&$5(e.parentElement)?!0:e.hidden}function gN(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function z5(e){if(!vb(e)||$5(e)||mN(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]():gN(e)?!0:N5(e)}function vN(e){return e?vb(e)&&z5(e)&&!hN(e):!1}var bN=["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]"],yN=bN.join(),xN=e=>e.offsetWidth>0&&e.offsetHeight>0;function L5(e){const t=Array.from(e.querySelectorAll(yN));return t.unshift(e),t.filter(n=>z5(n)&&xN(n))}var Bw,wN=(Bw=Lw.default)!=null?Bw:Lw,B5=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:a,autoFocus:c,persistentFocus:d,lockFocusAcrossFrames:p}=e,h=f.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&L5(r.current).length===0&&requestAnimationFrame(()=>{var w;(w=r.current)==null||w.focus()})},[t,r]),m=f.useCallback(()=>{var b;(b=n==null?void 0:n.current)==null||b.focus()},[n]),v=o&&!n;return i.jsx(wN,{crossFrame:p,persistentFocus:d,autoFocus:c,disabled:a,onActivation:h,onDeactivation:m,returnFocus:v,children:s})};B5.displayName="FocusLock";function SN(e,t,n,r){const o=__(t);return f.useEffect(()=>{var s;const a=(s=R2(n))!=null?s:document;if(t)return a.addEventListener(e,o,r),()=>{a.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=R2(n))!=null?s:document).removeEventListener(e,o,r)}}function CN(e){const{ref:t,handler:n,enabled:r=!0}=e,o=__(n),a=f.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;f.useEffect(()=>{if(!r)return;const c=m=>{w0(m,t)&&(a.isPointerDown=!0)},d=m=>{if(a.ignoreEmulatedMouseEvents){a.ignoreEmulatedMouseEvents=!1;return}a.isPointerDown&&n&&w0(m,t)&&(a.isPointerDown=!1,o(m))},p=m=>{a.ignoreEmulatedMouseEvents=!0,n&&a.isPointerDown&&w0(m,t)&&(a.isPointerDown=!1,o(m))},h=P_(t.current);return h.addEventListener("mousedown",c,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",c,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",c,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",c,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,a,r])}function w0(e,t){var n;const r=e.target;return r&&!P_(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}var[kN,_N]=Rn({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),F5=Te(function(t,n){const r=Br("Input",t),{children:o,className:s,...a}=qn(t),c=Ct("chakra-input__group",s),d={},p=gd(o),h=r.field;p.forEach(v=>{var b,w;r&&(h&&v.type.id==="InputLeftElement"&&(d.paddingStart=(b=h.height)!=null?b:h.h),h&&v.type.id==="InputRightElement"&&(d.paddingEnd=(w=h.height)!=null?w:h.h),v.type.id==="InputRightAddon"&&(d.borderEndRadius=0),v.type.id==="InputLeftAddon"&&(d.borderStartRadius=0))});const m=p.map(v=>{var b,w;const y=Z1({size:((b=v.props)==null?void 0:b.size)||t.size,variant:((w=v.props)==null?void 0:w.variant)||t.variant});return v.type.id!=="Input"?f.cloneElement(v,y):f.cloneElement(v,Object.assign(y,d,v.props))});return i.jsx(je.div,{className:c,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...a,children:i.jsx(kN,{value:r,children:m})})});F5.displayName="InputGroup";var PN=je("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),dm=Te(function(t,n){var r,o;const{placement:s="left",...a}=t,c=_N(),d=c.field,h={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=d==null?void 0:d.height)!=null?r:d==null?void 0:d.h,height:(o=d==null?void 0:d.height)!=null?o:d==null?void 0:d.h,fontSize:d==null?void 0:d.fontSize,...c.element};return i.jsx(PN,{ref:n,__css:h,...a})});dm.id="InputElement";dm.displayName="InputElement";var H5=Te(function(t,n){const{className:r,...o}=t,s=Ct("chakra-input__left-element",r);return i.jsx(dm,{ref:n,placement:"left",className:s,...o})});H5.id="InputLeftElement";H5.displayName="InputLeftElement";var bb=Te(function(t,n){const{className:r,...o}=t,s=Ct("chakra-input__right-element",r);return i.jsx(dm,{ref:n,placement:"right",className:s,...o})});bb.id="InputRightElement";bb.displayName="InputRightElement";var yd=Te(function(t,n){const{htmlSize:r,...o}=t,s=Br("Input",o),a=qn(o),c=rb(a),d=Ct("chakra-input",t.className);return i.jsx(je.input,{size:r,...c,__css:s.field,ref:n,className:d})});yd.displayName="Input";yd.id="Input";var yb=Te(function(t,n){const r=ia("Link",t),{className:o,isExternal:s,...a}=qn(t);return i.jsx(je.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ct("chakra-link",o),...a,__css:r})});yb.displayName="Link";var[jN,W5]=Rn({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),xb=Te(function(t,n){const r=Br("List",t),{children:o,styleType:s="none",stylePosition:a,spacing:c,...d}=qn(t),p=gd(o),m=c?{["& > *:not(style) ~ *:not(style)"]:{mt:c}}:{};return i.jsx(jN,{value:r,children:i.jsx(je.ul,{ref:n,listStyleType:s,listStylePosition:a,role:"list",__css:{...r.container,...m},...d,children:p})})});xb.displayName="List";var IN=Te((e,t)=>{const{as:n,...r}=e;return i.jsx(xb,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});IN.displayName="OrderedList";var wb=Te(function(t,n){const{as:r,...o}=t;return i.jsx(xb,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});wb.displayName="UnorderedList";var wa=Te(function(t,n){const r=W5();return i.jsx(je.li,{ref:n,...t,__css:r.item})});wa.displayName="ListItem";var EN=Te(function(t,n){const r=W5();return i.jsx(no,{ref:n,role:"presentation",...t,__css:r.icon})});EN.displayName="ListIcon";var ol=Te(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:a,column:c,row:d,autoFlow:p,autoRows:h,templateRows:m,autoColumns:v,templateColumns:b,...w}=t,y={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:a,gridAutoColumns:v,gridColumn:c,gridRow:d,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:m,gridTemplateColumns:b};return i.jsx(je.div,{ref:n,__css:y,...w})});ol.displayName="Grid";function V5(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):vv(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var pl=je("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});pl.displayName="Spacer";var Je=Te(function(t,n){const r=ia("Text",t),{className:o,align:s,decoration:a,casing:c,...d}=qn(t),p=Z1({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return i.jsx(je.p,{ref:n,className:Ct("chakra-text",t.className),...p,...d,__css:r})});Je.displayName="Text";var U5=e=>i.jsx(je.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});U5.displayName="StackItem";function ON(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{"&":V5(n,o=>r[o])}}var Sb=Te((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:a="0.5rem",wrap:c,children:d,divider:p,className:h,shouldWrapChildren:m,...v}=e,b=n?"row":r??"column",w=f.useMemo(()=>ON({spacing:a,direction:b}),[a,b]),y=!!p,S=!m&&!y,k=f.useMemo(()=>{const I=gd(d);return S?I:I.map((P,E)=>{const O=typeof P.key<"u"?P.key:E,R=E+1===I.length,T=m?i.jsx(U5,{children:P},O):P;if(!y)return T;const A=f.cloneElement(p,{__css:w}),$=R?null:A;return i.jsxs(f.Fragment,{children:[T,$]},O)})},[p,w,y,S,m,d]),_=Ct("chakra-stack",h);return i.jsx(je.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:b,flexWrap:c,gap:y?void 0:a,className:_,...v,children:k})});Sb.displayName="Stack";var G5=Te((e,t)=>i.jsx(Sb,{align:"center",...e,direction:"column",ref:t}));G5.displayName="VStack";var di=Te((e,t)=>i.jsx(Sb,{align:"center",...e,direction:"row",ref:t}));di.displayName="HStack";function Fw(e){return V5(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var zv=Te(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:a,rowEnd:c,rowSpan:d,rowStart:p,...h}=t,m=Z1({gridArea:r,gridColumn:Fw(o),gridRow:Fw(d),gridColumnStart:s,gridColumnEnd:a,gridRowStart:p,gridRowEnd:c});return i.jsx(je.div,{ref:n,__css:m,...h})});zv.displayName="GridItem";var hl=Te(function(t,n){const r=ia("Badge",t),{className:o,...s}=qn(t);return i.jsx(je.span,{ref:n,className:Ct("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});hl.displayName="Badge";var ml=Te(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:a,borderWidth:c,borderStyle:d,borderColor:p,...h}=ia("Divider",t),{className:m,orientation:v="horizontal",__css:b,...w}=qn(t),y={vertical:{borderLeftWidth:r||a||c||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||c||"1px",width:"100%"}};return i.jsx(je.hr,{ref:n,"aria-orientation":v,...w,__css:{...h,border:"0",borderColor:p,borderStyle:d,...y[v],...b},className:Ct("chakra-divider",m)})});ml.displayName="Divider";function RN(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function MN(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=f.useState([]),s=f.useRef(),a=()=>{s.current&&(clearTimeout(s.current),s.current=null)},c=()=>{a(),s.current=setTimeout(()=>{o([]),s.current=null},t)};f.useEffect(()=>a,[]);function d(p){return h=>{if(h.key==="Backspace"){const m=[...r];m.pop(),o(m);return}if(RN(h)){const m=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(m),p(m.join("")),c()}}}return d}function DN(e,t,n,r){if(t==null)return r;if(!r)return e.find(a=>n(a).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 TN(){const e=f.useRef(new Map),t=e.current,n=f.useCallback((o,s,a,c)=>{e.current.set(a,{type:s,el:o,options:c}),o.addEventListener(s,a,c)},[]),r=f.useCallback((o,s,a,c)=>{o.removeEventListener(s,a,c),e.current.delete(a)},[]);return f.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function S0(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function q5(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:a,onMouseUp:c,onClick:d,onKeyDown:p,onKeyUp:h,tabIndex:m,onMouseOver:v,onMouseLeave:b,...w}=e,[y,S]=f.useState(!0),[k,_]=f.useState(!1),I=TN(),P=D=>{D&&D.tagName!=="BUTTON"&&S(!1)},E=y?m:m||0,O=n&&!r,R=f.useCallback(D=>{if(n){D.stopPropagation(),D.preventDefault();return}D.currentTarget.focus(),d==null||d(D)},[n,d]),M=f.useCallback(D=>{k&&S0(D)&&(D.preventDefault(),D.stopPropagation(),_(!1),I.remove(document,"keyup",M,!1))},[k,I]),T=f.useCallback(D=>{if(p==null||p(D),n||D.defaultPrevented||D.metaKey||!S0(D.nativeEvent)||y)return;const z=o&&D.key==="Enter";s&&D.key===" "&&(D.preventDefault(),_(!0)),z&&(D.preventDefault(),D.currentTarget.click()),I.add(document,"keyup",M,!1)},[n,y,p,o,s,I,M]),A=f.useCallback(D=>{if(h==null||h(D),n||D.defaultPrevented||D.metaKey||!S0(D.nativeEvent)||y)return;s&&D.key===" "&&(D.preventDefault(),_(!1),D.currentTarget.click())},[s,y,n,h]),$=f.useCallback(D=>{D.button===0&&(_(!1),I.remove(document,"mouseup",$,!1))},[I]),Q=f.useCallback(D=>{if(D.button!==0)return;if(n){D.stopPropagation(),D.preventDefault();return}y||_(!0),D.currentTarget.focus({preventScroll:!0}),I.add(document,"mouseup",$,!1),a==null||a(D)},[n,y,a,I,$]),B=f.useCallback(D=>{D.button===0&&(y||_(!1),c==null||c(D))},[c,y]),V=f.useCallback(D=>{if(n){D.preventDefault();return}v==null||v(D)},[n,v]),q=f.useCallback(D=>{k&&(D.preventDefault(),_(!1)),b==null||b(D)},[k,b]),G=cn(t,P);return y?{...w,ref:G,type:"button","aria-disabled":O?void 0:n,disabled:O,onClick:R,onMouseDown:a,onMouseUp:c,onKeyUp:h,onKeyDown:p,onMouseOver:v,onMouseLeave:b}:{...w,ref:G,role:"button","data-active":Ft(k),"aria-disabled":n?"true":void 0,tabIndex:O?void 0:E,onClick:R,onMouseDown:Q,onMouseUp:B,onKeyUp:A,onKeyDown:T,onMouseOver:V,onMouseLeave:q}}function AN(e){const t=e.current;if(!t)return!1;const n=dN(t);return!n||t.contains(n)?!1:!!vN(n)}function K5(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;Ba(()=>{if(!s||AN(e))return;const a=(o==null?void 0:o.current)||e.current;let c;if(a)return c=requestAnimationFrame(()=>{a.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(c)}},[s,e,o])}var NN={preventScroll:!0,shouldFocus:!1};function $N(e,t=NN){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,a=zN(e)?e.current:e,c=o&&s,d=f.useRef(c),p=f.useRef(s);ec(()=>{!p.current&&s&&(d.current=c),p.current=s},[s,c]);const h=f.useCallback(()=>{if(!(!s||!a||!d.current)&&(d.current=!1,!a.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var m;(m=n.current)==null||m.focus({preventScroll:r})});else{const m=L5(a);m.length>0&&requestAnimationFrame(()=>{m[0].focus({preventScroll:r})})}},[s,r,a,n]);Ba(()=>{h()},[h]),Qi(a,"transitionend",h)}function zN(e){return"current"in e}var Al=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),_r={arrowShadowColor:Al("--popper-arrow-shadow-color"),arrowSize:Al("--popper-arrow-size","8px"),arrowSizeHalf:Al("--popper-arrow-size-half"),arrowBg:Al("--popper-arrow-bg"),transformOrigin:Al("--popper-transform-origin"),arrowOffset:Al("--popper-arrow-offset")};function LN(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 BN={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"},FN=e=>BN[e],Hw={scroll:!0,resize:!0};function HN(e){let t;return typeof e=="object"?t={enabled:!0,options:{...Hw,...e}}:t={enabled:e,options:Hw},t}var WN={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`}},VN={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{Ww(e)},effect:({state:e})=>()=>{Ww(e)}},Ww=e=>{e.elements.popper.style.setProperty(_r.transformOrigin.var,FN(e.placement))},UN={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{GN(e)}},GN=e=>{var t;if(!e.placement)return;const n=qN(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:_r.arrowSize.varRef,height:_r.arrowSize.varRef,zIndex:-1});const r={[_r.arrowSizeHalf.var]:`calc(${_r.arrowSize.varRef} / 2 - 1px)`,[_r.arrowOffset.var]:`calc(${_r.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},qN=e=>{if(e.startsWith("top"))return{property:"bottom",value:_r.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:_r.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:_r.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:_r.arrowOffset.varRef}},KN={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{Vw(e)},effect:({state:e})=>()=>{Vw(e)}},Vw=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=LN(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:_r.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},YN={"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"}},QN={"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 XN(e,t="ltr"){var n,r;const o=((n=YN[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=QN[e])!=null?r:o}var ko="top",as="bottom",is="right",_o="left",Cb="auto",xd=[ko,as,is,_o],bc="start",Yu="end",JN="clippingParents",Y5="viewport",pu="popper",ZN="reference",Uw=xd.reduce(function(e,t){return e.concat([t+"-"+bc,t+"-"+Yu])},[]),Q5=[].concat(xd,[Cb]).reduce(function(e,t){return e.concat([t,t+"-"+bc,t+"-"+Yu])},[]),e$="beforeRead",t$="read",n$="afterRead",r$="beforeMain",o$="main",s$="afterMain",a$="beforeWrite",i$="write",l$="afterWrite",c$=[e$,t$,n$,r$,o$,s$,a$,i$,l$];function ra(e){return e?(e.nodeName||"").toLowerCase():null}function Lo(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function sl(e){var t=Lo(e).Element;return e instanceof t||e instanceof Element}function rs(e){var t=Lo(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function kb(e){if(typeof ShadowRoot>"u")return!1;var t=Lo(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function u$(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];!rs(s)||!ra(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(a){var c=o[a];c===!1?s.removeAttribute(a):s.setAttribute(a,c===!0?"":c)}))})}function d$(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]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=a.reduce(function(d,p){return d[p]="",d},{});!rs(o)||!ra(o)||(Object.assign(o.style,c),Object.keys(s).forEach(function(d){o.removeAttribute(d)}))})}}const f$={name:"applyStyles",enabled:!0,phase:"write",fn:u$,effect:d$,requires:["computeStyles"]};function ta(e){return e.split("-")[0]}var Xi=Math.max,Kp=Math.min,yc=Math.round;function Lv(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function X5(){return!/^((?!chrome|android).)*safari/i.test(Lv())}function xc(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&rs(e)&&(o=e.offsetWidth>0&&yc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&yc(r.height)/e.offsetHeight||1);var a=sl(e)?Lo(e):window,c=a.visualViewport,d=!X5()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/o,h=(r.top+(d&&c?c.offsetTop:0))/s,m=r.width/o,v=r.height/s;return{width:m,height:v,top:h,right:p+m,bottom:h+v,left:p,x:p,y:h}}function _b(e){var t=xc(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 J5(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&kb(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Oa(e){return Lo(e).getComputedStyle(e)}function p$(e){return["table","td","th"].indexOf(ra(e))>=0}function Pi(e){return((sl(e)?e.ownerDocument:e.document)||window.document).documentElement}function fm(e){return ra(e)==="html"?e:e.assignedSlot||e.parentNode||(kb(e)?e.host:null)||Pi(e)}function Gw(e){return!rs(e)||Oa(e).position==="fixed"?null:e.offsetParent}function h$(e){var t=/firefox/i.test(Lv()),n=/Trident/i.test(Lv());if(n&&rs(e)){var r=Oa(e);if(r.position==="fixed")return null}var o=fm(e);for(kb(o)&&(o=o.host);rs(o)&&["html","body"].indexOf(ra(o))<0;){var s=Oa(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 wd(e){for(var t=Lo(e),n=Gw(e);n&&p$(n)&&Oa(n).position==="static";)n=Gw(n);return n&&(ra(n)==="html"||ra(n)==="body"&&Oa(n).position==="static")?t:n||h$(e)||t}function Pb(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Nu(e,t,n){return Xi(e,Kp(t,n))}function m$(e,t,n){var r=Nu(e,t,n);return r>n?n:r}function Z5(){return{top:0,right:0,bottom:0,left:0}}function eP(e){return Object.assign({},Z5(),e)}function tP(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var g$=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,eP(typeof t!="number"?t:tP(t,xd))};function v$(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,c=ta(n.placement),d=Pb(c),p=[_o,is].indexOf(c)>=0,h=p?"height":"width";if(!(!s||!a)){var m=g$(o.padding,n),v=_b(s),b=d==="y"?ko:_o,w=d==="y"?as:is,y=n.rects.reference[h]+n.rects.reference[d]-a[d]-n.rects.popper[h],S=a[d]-n.rects.reference[d],k=wd(s),_=k?d==="y"?k.clientHeight||0:k.clientWidth||0:0,I=y/2-S/2,P=m[b],E=_-v[h]-m[w],O=_/2-v[h]/2+I,R=Nu(P,O,E),M=d;n.modifiersData[r]=(t={},t[M]=R,t.centerOffset=R-O,t)}}function b$(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)||J5(t.elements.popper,o)&&(t.elements.arrow=o))}const y$={name:"arrow",enabled:!0,phase:"main",fn:v$,effect:b$,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wc(e){return e.split("-")[1]}var x$={top:"auto",right:"auto",bottom:"auto",left:"auto"};function w$(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:yc(n*o)/o||0,y:yc(r*o)/o||0}}function qw(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,m=e.isFixed,v=a.x,b=v===void 0?0:v,w=a.y,y=w===void 0?0:w,S=typeof h=="function"?h({x:b,y}):{x:b,y};b=S.x,y=S.y;var k=a.hasOwnProperty("x"),_=a.hasOwnProperty("y"),I=_o,P=ko,E=window;if(p){var O=wd(n),R="clientHeight",M="clientWidth";if(O===Lo(n)&&(O=Pi(n),Oa(O).position!=="static"&&c==="absolute"&&(R="scrollHeight",M="scrollWidth")),O=O,o===ko||(o===_o||o===is)&&s===Yu){P=as;var T=m&&O===E&&E.visualViewport?E.visualViewport.height:O[R];y-=T-r.height,y*=d?1:-1}if(o===_o||(o===ko||o===as)&&s===Yu){I=is;var A=m&&O===E&&E.visualViewport?E.visualViewport.width:O[M];b-=A-r.width,b*=d?1:-1}}var $=Object.assign({position:c},p&&x$),Q=h===!0?w$({x:b,y},Lo(n)):{x:b,y};if(b=Q.x,y=Q.y,d){var B;return Object.assign({},$,(B={},B[P]=_?"0":"",B[I]=k?"0":"",B.transform=(E.devicePixelRatio||1)<=1?"translate("+b+"px, "+y+"px)":"translate3d("+b+"px, "+y+"px, 0)",B))}return Object.assign({},$,(t={},t[P]=_?y+"px":"",t[I]=k?b+"px":"",t.transform="",t))}function S$(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,a=s===void 0?!0:s,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:ta(t.placement),variation:wc(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,qw(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,qw(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const C$={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:S$,data:{}};var Mf={passive:!0};function k$(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,a=r.resize,c=a===void 0?!0:a,d=Lo(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,Mf)}),c&&d.addEventListener("resize",n.update,Mf),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,Mf)}),c&&d.removeEventListener("resize",n.update,Mf)}}const _$={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:k$,data:{}};var P$={left:"right",right:"left",bottom:"top",top:"bottom"};function Sp(e){return e.replace(/left|right|bottom|top/g,function(t){return P$[t]})}var j$={start:"end",end:"start"};function Kw(e){return e.replace(/start|end/g,function(t){return j$[t]})}function jb(e){var t=Lo(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ib(e){return xc(Pi(e)).left+jb(e).scrollLeft}function I$(e,t){var n=Lo(e),r=Pi(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,c=0,d=0;if(o){s=o.width,a=o.height;var p=X5();(p||!p&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}return{width:s,height:a,x:c+Ib(e),y:d}}function E$(e){var t,n=Pi(e),r=jb(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Xi(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Xi(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),c=-r.scrollLeft+Ib(e),d=-r.scrollTop;return Oa(o||n).direction==="rtl"&&(c+=Xi(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:c,y:d}}function Eb(e){var t=Oa(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function nP(e){return["html","body","#document"].indexOf(ra(e))>=0?e.ownerDocument.body:rs(e)&&Eb(e)?e:nP(fm(e))}function $u(e,t){var n;t===void 0&&(t=[]);var r=nP(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Lo(r),a=o?[s].concat(s.visualViewport||[],Eb(r)?r:[]):r,c=t.concat(a);return o?c:c.concat($u(fm(a)))}function Bv(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function O$(e,t){var n=xc(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 Yw(e,t,n){return t===Y5?Bv(I$(e,n)):sl(t)?O$(t,n):Bv(E$(Pi(e)))}function R$(e){var t=$u(fm(e)),n=["absolute","fixed"].indexOf(Oa(e).position)>=0,r=n&&rs(e)?wd(e):e;return sl(r)?t.filter(function(o){return sl(o)&&J5(o,r)&&ra(o)!=="body"}):[]}function M$(e,t,n,r){var o=t==="clippingParents"?R$(e):[].concat(t),s=[].concat(o,[n]),a=s[0],c=s.reduce(function(d,p){var h=Yw(e,p,r);return d.top=Xi(h.top,d.top),d.right=Kp(h.right,d.right),d.bottom=Kp(h.bottom,d.bottom),d.left=Xi(h.left,d.left),d},Yw(e,a,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function rP(e){var t=e.reference,n=e.element,r=e.placement,o=r?ta(r):null,s=r?wc(r):null,a=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(o){case ko:d={x:a,y:t.y-n.height};break;case as:d={x:a,y:t.y+t.height};break;case is:d={x:t.x+t.width,y:c};break;case _o:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=o?Pb(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case bc:d[p]=d[p]-(t[h]/2-n[h]/2);break;case Yu:d[p]=d[p]+(t[h]/2-n[h]/2);break}}return d}function Qu(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,a=s===void 0?e.strategy:s,c=n.boundary,d=c===void 0?JN:c,p=n.rootBoundary,h=p===void 0?Y5:p,m=n.elementContext,v=m===void 0?pu:m,b=n.altBoundary,w=b===void 0?!1:b,y=n.padding,S=y===void 0?0:y,k=eP(typeof S!="number"?S:tP(S,xd)),_=v===pu?ZN:pu,I=e.rects.popper,P=e.elements[w?_:v],E=M$(sl(P)?P:P.contextElement||Pi(e.elements.popper),d,h,a),O=xc(e.elements.reference),R=rP({reference:O,element:I,strategy:"absolute",placement:o}),M=Bv(Object.assign({},I,R)),T=v===pu?M:O,A={top:E.top-T.top+k.top,bottom:T.bottom-E.bottom+k.bottom,left:E.left-T.left+k.left,right:T.right-E.right+k.right},$=e.modifiersData.offset;if(v===pu&&$){var Q=$[o];Object.keys(A).forEach(function(B){var V=[is,as].indexOf(B)>=0?1:-1,q=[ko,as].indexOf(B)>=0?"y":"x";A[B]+=Q[q]*V})}return A}function D$(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,a=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?Q5:d,h=wc(r),m=h?c?Uw:Uw.filter(function(w){return wc(w)===h}):xd,v=m.filter(function(w){return p.indexOf(w)>=0});v.length===0&&(v=m);var b=v.reduce(function(w,y){return w[y]=Qu(e,{placement:y,boundary:o,rootBoundary:s,padding:a})[ta(y)],w},{});return Object.keys(b).sort(function(w,y){return b[w]-b[y]})}function T$(e){if(ta(e)===Cb)return[];var t=Sp(e);return[Kw(e),t,Kw(t)]}function A$(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,a=n.altAxis,c=a===void 0?!0:a,d=n.fallbackPlacements,p=n.padding,h=n.boundary,m=n.rootBoundary,v=n.altBoundary,b=n.flipVariations,w=b===void 0?!0:b,y=n.allowedAutoPlacements,S=t.options.placement,k=ta(S),_=k===S,I=d||(_||!w?[Sp(S)]:T$(S)),P=[S].concat(I).reduce(function(oe,K){return oe.concat(ta(K)===Cb?D$(t,{placement:K,boundary:h,rootBoundary:m,padding:p,flipVariations:w,allowedAutoPlacements:y}):K)},[]),E=t.rects.reference,O=t.rects.popper,R=new Map,M=!0,T=P[0],A=0;A=0,q=V?"width":"height",G=Qu(t,{placement:$,boundary:h,rootBoundary:m,altBoundary:v,padding:p}),D=V?B?is:_o:B?as:ko;E[q]>O[q]&&(D=Sp(D));var z=Sp(D),W=[];if(s&&W.push(G[Q]<=0),c&&W.push(G[D]<=0,G[z]<=0),W.every(function(oe){return oe})){T=$,M=!1;break}R.set($,W)}if(M)for(var Y=w?3:1,ie=function(K){var U=P.find(function(ae){var re=R.get(ae);if(re)return re.slice(0,K).every(function(se){return se})});if(U)return T=U,"break"},ye=Y;ye>0;ye--){var Z=ie(ye);if(Z==="break")break}t.placement!==T&&(t.modifiersData[r]._skip=!0,t.placement=T,t.reset=!0)}}const N$={name:"flip",enabled:!0,phase:"main",fn:A$,requiresIfExists:["offset"],data:{_skip:!1}};function Qw(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 Xw(e){return[ko,is,as,_o].some(function(t){return e[t]>=0})}function $$(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=Qu(t,{elementContext:"reference"}),c=Qu(t,{altBoundary:!0}),d=Qw(a,r),p=Qw(c,o,s),h=Xw(d),m=Xw(p);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":m})}const z$={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:$$};function L$(e,t,n){var r=ta(e),o=[_o,ko].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],c=s[1];return a=a||0,c=(c||0)*o,[_o,is].indexOf(r)>=0?{x:c,y:a}:{x:a,y:c}}function B$(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=Q5.reduce(function(h,m){return h[m]=L$(m,t.rects,s),h},{}),c=a[t.placement],d=c.x,p=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=a}const F$={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:B$};function H$(e){var t=e.state,n=e.name;t.modifiersData[n]=rP({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const W$={name:"popperOffsets",enabled:!0,phase:"read",fn:H$,data:{}};function V$(e){return e==="x"?"y":"x"}function U$(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,c=a===void 0?!1:a,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,m=n.padding,v=n.tether,b=v===void 0?!0:v,w=n.tetherOffset,y=w===void 0?0:w,S=Qu(t,{boundary:d,rootBoundary:p,padding:m,altBoundary:h}),k=ta(t.placement),_=wc(t.placement),I=!_,P=Pb(k),E=V$(P),O=t.modifiersData.popperOffsets,R=t.rects.reference,M=t.rects.popper,T=typeof y=="function"?y(Object.assign({},t.rects,{placement:t.placement})):y,A=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),$=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(O){if(s){var B,V=P==="y"?ko:_o,q=P==="y"?as:is,G=P==="y"?"height":"width",D=O[P],z=D+S[V],W=D-S[q],Y=b?-M[G]/2:0,ie=_===bc?R[G]:M[G],ye=_===bc?-M[G]:-R[G],Z=t.elements.arrow,oe=b&&Z?_b(Z):{width:0,height:0},K=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Z5(),U=K[V],ae=K[q],re=Nu(0,R[G],oe[G]),se=I?R[G]/2-Y-re-U-A.mainAxis:ie-re-U-A.mainAxis,pe=I?-R[G]/2+Y+re+ae+A.mainAxis:ye+re+ae+A.mainAxis,le=t.elements.arrow&&wd(t.elements.arrow),ge=le?P==="y"?le.clientTop||0:le.clientLeft||0:0,ke=(B=$==null?void 0:$[P])!=null?B:0,xe=D+se-ke-ge,de=D+pe-ke,Ae=Nu(b?Kp(z,xe):z,D,b?Xi(W,de):W);O[P]=Ae,Q[P]=Ae-D}if(c){var Ee,$e=P==="x"?ko:_o,kt=P==="x"?as:is,ct=O[E],on=E==="y"?"height":"width",vt=ct+S[$e],bt=ct-S[kt],Se=[ko,_o].indexOf(k)!==-1,Me=(Ee=$==null?void 0:$[E])!=null?Ee:0,Pt=Se?vt:ct-R[on]-M[on]-Me+A.altAxis,At=Se?ct+R[on]+M[on]-Me-A.altAxis:bt,we=b&&Se?m$(Pt,ct,At):Nu(b?Pt:vt,ct,b?At:bt);O[E]=we,Q[E]=we-ct}t.modifiersData[r]=Q}}const G$={name:"preventOverflow",enabled:!0,phase:"main",fn:U$,requiresIfExists:["offset"]};function q$(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function K$(e){return e===Lo(e)||!rs(e)?jb(e):q$(e)}function Y$(e){var t=e.getBoundingClientRect(),n=yc(t.width)/e.offsetWidth||1,r=yc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Q$(e,t,n){n===void 0&&(n=!1);var r=rs(t),o=rs(t)&&Y$(t),s=Pi(t),a=xc(e,o,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((ra(t)!=="body"||Eb(s))&&(c=K$(t)),rs(t)?(d=xc(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Ib(s))),{x:a.left+c.scrollLeft-d.x,y:a.top+c.scrollTop-d.y,width:a.width,height:a.height}}function X$(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 a=[].concat(s.requires||[],s.requiresIfExists||[]);a.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 J$(e){var t=X$(e);return c$.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function Z$(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function ez(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 Jw={placement:"bottom",modifiers:[],strategy:"absolute"};function Zw(){for(var e=arguments.length,t=new Array(e),n=0;n{}),I=f.useCallback(()=>{var A;!t||!w.current||!y.current||((A=_.current)==null||A.call(_),S.current=rz(w.current,y.current,{placement:k,modifiers:[KN,UN,VN,{...WN,enabled:!!v},{name:"eventListeners",...HN(a)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:c??[0,d]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!m,options:{boundary:h}},...n??[]],strategy:o}),S.current.forceUpdate(),_.current=S.current.destroy)},[k,t,n,v,a,s,c,d,p,m,h,o]);f.useEffect(()=>()=>{var A;!w.current&&!y.current&&((A=S.current)==null||A.destroy(),S.current=null)},[]);const P=f.useCallback(A=>{w.current=A,I()},[I]),E=f.useCallback((A={},$=null)=>({...A,ref:cn(P,$)}),[P]),O=f.useCallback(A=>{y.current=A,I()},[I]),R=f.useCallback((A={},$=null)=>({...A,ref:cn(O,$),style:{...A.style,position:o,minWidth:v?void 0:"max-content",inset:"0 auto auto 0"}}),[o,O,v]),M=f.useCallback((A={},$=null)=>{const{size:Q,shadowColor:B,bg:V,style:q,...G}=A;return{...G,ref:$,"data-popper-arrow":"",style:oz(A)}},[]),T=f.useCallback((A={},$=null)=>({...A,ref:$,"data-popper-arrow-inner":""}),[]);return{update(){var A;(A=S.current)==null||A.update()},forceUpdate(){var A;(A=S.current)==null||A.forceUpdate()},transformOrigin:_r.transformOrigin.varRef,referenceRef:P,popperRef:O,getPopperProps:R,getArrowProps:M,getArrowInnerProps:T,getReferenceProps:E}}function oz(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 Rb(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=rr(n),a=rr(t),[c,d]=f.useState(e.defaultIsOpen||!1),p=r!==void 0?r:c,h=r!==void 0,m=f.useId(),v=o??`disclosure-${m}`,b=f.useCallback(()=>{h||d(!1),a==null||a()},[h,a]),w=f.useCallback(()=>{h||d(!0),s==null||s()},[h,s]),y=f.useCallback(()=>{p?b():w()},[p,w,b]);function S(_={}){return{..._,"aria-expanded":p,"aria-controls":v,onClick(I){var P;(P=_.onClick)==null||P.call(_,I),y()}}}function k(_={}){return{..._,hidden:!p,id:v}}return{isOpen:p,onOpen:w,onClose:b,onToggle:y,isControlled:h,getButtonProps:S,getDisclosureProps:k}}function sz(e){const{ref:t,handler:n,enabled:r=!0}=e,o=rr(n),a=f.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;f.useEffect(()=>{if(!r)return;const c=m=>{C0(m,t)&&(a.isPointerDown=!0)},d=m=>{if(a.ignoreEmulatedMouseEvents){a.ignoreEmulatedMouseEvents=!1;return}a.isPointerDown&&n&&C0(m,t)&&(a.isPointerDown=!1,o(m))},p=m=>{a.ignoreEmulatedMouseEvents=!0,n&&a.isPointerDown&&C0(m,t)&&(a.isPointerDown=!1,o(m))},h=oP(t.current);return h.addEventListener("mousedown",c,!0),h.addEventListener("mouseup",d,!0),h.addEventListener("touchstart",c,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",c,!0),h.removeEventListener("mouseup",d,!0),h.removeEventListener("touchstart",c,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,a,r])}function C0(e,t){var n;const r=e.target;return r&&!oP(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function oP(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function sP(e){const{isOpen:t,ref:n}=e,[r,o]=f.useState(t),[s,a]=f.useState(!1);return f.useEffect(()=>{s||(o(t),a(!0))},[t,s,r]),Qi(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var d;const p=uN(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(d=n.current)==null||d.dispatchEvent(h)}}}function Mb(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[az,iz,lz,cz]=eb(),[uz,Sd]=Rn({strict:!1,name:"MenuContext"});function dz(e,...t){const n=f.useId(),r=e||n;return f.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function aP(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function eS(e){return aP(e).activeElement===e}function fz(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:a,isOpen:c,defaultIsOpen:d,onClose:p,onOpen:h,placement:m="bottom-start",lazyBehavior:v="unmount",direction:b,computePositionOnMount:w=!1,...y}=e,S=f.useRef(null),k=f.useRef(null),_=lz(),I=f.useCallback(()=>{requestAnimationFrame(()=>{var Z;(Z=S.current)==null||Z.focus({preventScroll:!1})})},[]),P=f.useCallback(()=>{const Z=setTimeout(()=>{var oe;if(o)(oe=o.current)==null||oe.focus();else{const K=_.firstEnabled();K&&B(K.index)}});z.current.add(Z)},[_,o]),E=f.useCallback(()=>{const Z=setTimeout(()=>{const oe=_.lastEnabled();oe&&B(oe.index)});z.current.add(Z)},[_]),O=f.useCallback(()=>{h==null||h(),s?P():I()},[s,P,I,h]),{isOpen:R,onOpen:M,onClose:T,onToggle:A}=Rb({isOpen:c,defaultIsOpen:d,onClose:p,onOpen:O});sz({enabled:R&&r,ref:S,handler:Z=>{var oe;(oe=k.current)!=null&&oe.contains(Z.target)||T()}});const $=Ob({...y,enabled:R||w,placement:m,direction:b}),[Q,B]=f.useState(-1);Ba(()=>{R||B(-1)},[R]),K5(S,{focusRef:k,visible:R,shouldFocus:!0});const V=sP({isOpen:R,ref:S}),[q,G]=dz(t,"menu-button","menu-list"),D=f.useCallback(()=>{M(),I()},[M,I]),z=f.useRef(new Set([]));xz(()=>{z.current.forEach(Z=>clearTimeout(Z)),z.current.clear()});const W=f.useCallback(()=>{M(),P()},[P,M]),Y=f.useCallback(()=>{M(),E()},[M,E]),ie=f.useCallback(()=>{var Z,oe;const K=aP(S.current),U=(Z=S.current)==null?void 0:Z.contains(K.activeElement);if(!(R&&!U))return;const re=(oe=_.item(Q))==null?void 0:oe.node;re==null||re.focus()},[R,Q,_]),ye=f.useRef(null);return{openAndFocusMenu:D,openAndFocusFirstItem:W,openAndFocusLastItem:Y,onTransitionEnd:ie,unstable__animationState:V,descendants:_,popper:$,buttonId:q,menuId:G,forceUpdate:$.forceUpdate,orientation:"vertical",isOpen:R,onToggle:A,onOpen:M,onClose:T,menuRef:S,buttonRef:k,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:a,lazyBehavior:v,initialFocusRef:o,rafId:ye}}function pz(e={},t=null){const n=Sd(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:a}=n,c=f.useCallback(d=>{const p=d.key,m={Enter:s,ArrowDown:s,ArrowUp:a}[p];m&&(d.preventDefault(),d.stopPropagation(),m(d))},[s,a]);return{...e,ref:cn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":Ft(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:tt(e.onClick,r),onKeyDown:tt(e.onKeyDown,c)}}function Fv(e){var t;return bz(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function hz(e={},t=null){const n=Sd();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:a,onClose:c,menuId:d,isLazy:p,lazyBehavior:h,unstable__animationState:m}=n,v=iz(),b=MN({preventDefault:k=>k.key!==" "&&Fv(k.target)}),w=f.useCallback(k=>{if(!k.currentTarget.contains(k.target))return;const _=k.key,P={Tab:O=>O.preventDefault(),Escape:c,ArrowDown:()=>{const O=v.nextEnabled(r);O&&o(O.index)},ArrowUp:()=>{const O=v.prevEnabled(r);O&&o(O.index)}}[_];if(P){k.preventDefault(),P(k);return}const E=b(O=>{const R=DN(v.values(),O,M=>{var T,A;return(A=(T=M==null?void 0:M.node)==null?void 0:T.textContent)!=null?A:""},v.item(r));if(R){const M=v.indexOf(R.node);o(M)}});Fv(k.target)&&E(k)},[v,r,b,c,o]),y=f.useRef(!1);a&&(y.current=!0);const S=Mb({wasSelected:y.current,enabled:p,mode:h,isSelected:m.present});return{...e,ref:cn(s,t),children:S?e.children:null,tabIndex:-1,role:"menu",id:d,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:tt(e.onKeyDown,w)}}function mz(e={}){const{popper:t,isOpen:n}=Sd();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function iP(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:a,isDisabled:c,isFocusable:d,closeOnSelect:p,type:h,...m}=e,v=Sd(),{setFocusedIndex:b,focusedIndex:w,closeOnSelect:y,onClose:S,menuRef:k,isOpen:_,menuId:I,rafId:P}=v,E=f.useRef(null),O=`${I}-menuitem-${f.useId()}`,{index:R,register:M}=cz({disabled:c&&!d}),T=f.useCallback(D=>{n==null||n(D),!c&&b(R)},[b,R,c,n]),A=f.useCallback(D=>{r==null||r(D),E.current&&!eS(E.current)&&T(D)},[T,r]),$=f.useCallback(D=>{o==null||o(D),!c&&b(-1)},[b,c,o]),Q=f.useCallback(D=>{s==null||s(D),Fv(D.currentTarget)&&(p??y)&&S()},[S,s,y,p]),B=f.useCallback(D=>{a==null||a(D),b(R)},[b,a,R]),V=R===w,q=c&&!d;Ba(()=>{_&&(V&&!q&&E.current?(P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{var D;(D=E.current)==null||D.focus(),P.current=null})):k.current&&!eS(k.current)&&k.current.focus({preventScroll:!0}))},[V,q,k,_]);const G=q5({onClick:Q,onFocus:B,onMouseEnter:T,onMouseMove:A,onMouseLeave:$,ref:cn(M,E,t),isDisabled:c,isFocusable:d});return{...m,...G,type:h??G.type,id:O,role:"menuitem",tabIndex:V?0:-1}}function gz(e={},t=null){const{type:n="radio",isChecked:r,...o}=e;return{...iP(o,t),role:`menuitem${n}`,"aria-checked":r}}function vz(e={}){const{children:t,type:n="radio",value:r,defaultValue:o,onChange:s,...a}=e,d=n==="radio"?"":[],[p,h]=Nc({defaultValue:o??d,value:r,onChange:s}),m=f.useCallback(w=>{if(n==="radio"&&typeof p=="string"&&h(w),n==="checkbox"&&Array.isArray(p)){const y=p.includes(w)?p.filter(S=>S!==w):p.concat(w);h(y)}},[p,h,n]),b=gd(t).map(w=>{if(w.type.id!=="MenuItemOption")return w;const y=k=>{var _,I;m(w.props.value),(I=(_=w.props).onClick)==null||I.call(_,k)},S=n==="radio"?w.props.value===p:p.includes(w.props.value);return f.cloneElement(w,{type:n,onClick:y,isChecked:S})});return{...a,children:b}}function bz(e){var t;if(!yz(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function yz(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function xz(e,t=[]){return f.useEffect(()=>()=>e(),t)}var[wz,Lc]=Rn({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Cd=e=>{const{children:t}=e,n=Br("Menu",e),r=qn(e),{direction:o}=Dc(),{descendants:s,...a}=fz({...r,direction:o}),c=f.useMemo(()=>a,[a]),{isOpen:d,onClose:p,forceUpdate:h}=c;return i.jsx(az,{value:s,children:i.jsx(uz,{value:c,children:i.jsx(wz,{value:n,children:$1(t,{isOpen:d,onClose:p,forceUpdate:h})})})})};Cd.displayName="Menu";var lP=Te((e,t)=>{const n=Lc();return i.jsx(je.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});lP.displayName="MenuCommand";var cP=Te((e,t)=>{const{type:n,...r}=e,o=Lc(),s=r.as||n?n??void 0:"button",a=f.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 i.jsx(je.button,{ref:t,type:s,...r,__css:a})}),Db=e=>{const{className:t,children:n,...r}=e,o=Lc(),s=f.Children.only(n),a=f.isValidElement(s)?f.cloneElement(s,{focusable:"false","aria-hidden":!0,className:Ct("chakra-menu__icon",s.props.className)}):null,c=Ct("chakra-menu__icon-wrapper",t);return i.jsx(je.span,{className:c,...r,__css:o.icon,children:a})};Db.displayName="MenuIcon";var kr=Te((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:a,...c}=e,d=iP(c,t),h=n||o?i.jsx("span",{style:{pointerEvents:"none",flex:1},children:a}):a;return i.jsxs(cP,{...d,className:Ct("chakra-menu__menuitem",d.className),children:[n&&i.jsx(Db,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&i.jsx(lP,{marginStart:s,children:o})]})});kr.displayName="MenuItem";var Sz={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"}}},Cz=je(Yr.div),Bc=Te(function(t,n){var r,o;const{rootProps:s,motionProps:a,...c}=t,{isOpen:d,onTransitionEnd:p,unstable__animationState:h}=Sd(),m=hz(c,n),v=mz(s),b=Lc();return i.jsx(je.div,{...v,__css:{zIndex:(o=t.zIndex)!=null?o:(r=b.list)==null?void 0:r.zIndex},children:i.jsx(Cz,{variants:Sz,initial:!1,animate:d?"enter":"exit",__css:{outline:0,...b.list},...a,className:Ct("chakra-menu__menu-list",m.className),...m,onUpdate:p,onAnimationComplete:nm(h.onComplete,m.onAnimationComplete)})})});Bc.displayName="MenuList";var Xu=Te((e,t)=>{const{title:n,children:r,className:o,...s}=e,a=Ct("chakra-menu__group__title",o),c=Lc();return i.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&i.jsx(je.p,{className:a,...s,__css:c.groupTitle,children:n}),r]})});Xu.displayName="MenuGroup";var uP=e=>{const{className:t,title:n,...r}=e,o=vz(r);return i.jsx(Xu,{title:n,className:Ct("chakra-menu__option-group",t),...o})};uP.displayName="MenuOptionGroup";var kz=Te((e,t)=>{const n=Lc();return i.jsx(je.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),kd=Te((e,t)=>{const{children:n,as:r,...o}=e,s=pz(o,t),a=r||kz;return i.jsx(a,{...s,className:Ct("chakra-menu__menu-button",e.className),children:i.jsx(je.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});kd.displayName="MenuButton";var _z=e=>i.jsx("svg",{viewBox:"0 0 14 14",width:"1em",height:"1em",...e,children:i.jsx("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})}),Yp=Te((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",...o}=e,s=gz(o,t);return i.jsxs(cP,{...s,className:Ct("chakra-menu__menuitem-option",o.className),children:[n!==null&&i.jsx(Db,{fontSize:"0.8em",marginEnd:r,opacity:e.isChecked?1:0,children:n||i.jsx(_z,{})}),i.jsx("span",{style:{flex:1},children:s.children})]})});Yp.id="MenuItemOption";Yp.displayName="MenuItemOption";var Pz={slideInBottom:{...jv,custom:{offsetY:16,reverse:!0}},slideInRight:{...jv,custom:{offsetX:16,reverse:!0}},scale:{...N3,custom:{initialScale:.95,reverse:!0}},none:{}},jz=je(Yr.section),Iz=e=>Pz[e||"none"],dP=f.forwardRef((e,t)=>{const{preset:n,motionProps:r=Iz(n),...o}=e;return i.jsx(jz,{ref:t,...r,...o})});dP.displayName="ModalTransition";var Ez=Object.defineProperty,Oz=(e,t,n)=>t in e?Ez(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rz=(e,t,n)=>(Oz(e,typeof t!="symbol"?t+"":t,n),n),Mz=class{constructor(){Rz(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}},Hv=new Mz;function fP(e,t){const[n,r]=f.useState(0);return f.useEffect(()=>{const o=e.current;if(o){if(t){const s=Hv.add(o);r(s)}return()=>{Hv.remove(o),r(0)}}},[t,e]),n}var Dz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nl=new WeakMap,Df=new WeakMap,Tf={},k0=0,pP=function(e){return e&&(e.host||pP(e.parentNode))},Tz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=pP(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})},Az=function(e,t,n,r){var o=Tz(t,Array.isArray(e)?e:[e]);Tf[n]||(Tf[n]=new WeakMap);var s=Tf[n],a=[],c=new Set,d=new Set(o),p=function(m){!m||c.has(m)||(c.add(m),p(m.parentNode))};o.forEach(p);var h=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(v){if(c.has(v))h(v);else{var b=v.getAttribute(r),w=b!==null&&b!=="false",y=(Nl.get(v)||0)+1,S=(s.get(v)||0)+1;Nl.set(v,y),s.set(v,S),a.push(v),y===1&&w&&Df.set(v,!0),S===1&&v.setAttribute(n,"true"),w||v.setAttribute(r,"true")}})};return h(t),c.clear(),k0++,function(){a.forEach(function(m){var v=Nl.get(m)-1,b=s.get(m)-1;Nl.set(m,v),s.set(m,b),v||(Df.has(m)||m.removeAttribute(r),Df.delete(m)),b||m.removeAttribute(n)}),k0--,k0||(Nl=new WeakMap,Nl=new WeakMap,Df=new WeakMap,Tf={})}},Nz=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||Dz(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Az(r,o,n,"aria-hidden")):function(){return null}};function $z(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:a=!0,onOverlayClick:c,onEsc:d}=e,p=f.useRef(null),h=f.useRef(null),[m,v,b]=Lz(r,"chakra-modal","chakra-modal--header","chakra-modal--body");zz(p,t&&a);const w=fP(p,t),y=f.useRef(null),S=f.useCallback(T=>{y.current=T.target},[]),k=f.useCallback(T=>{T.key==="Escape"&&(T.stopPropagation(),s&&(n==null||n()),d==null||d())},[s,n,d]),[_,I]=f.useState(!1),[P,E]=f.useState(!1),O=f.useCallback((T={},A=null)=>({role:"dialog",...T,ref:cn(A,p),id:m,tabIndex:-1,"aria-modal":!0,"aria-labelledby":_?v:void 0,"aria-describedby":P?b:void 0,onClick:tt(T.onClick,$=>$.stopPropagation())}),[b,P,m,v,_]),R=f.useCallback(T=>{T.stopPropagation(),y.current===T.target&&Hv.isTopModal(p.current)&&(o&&(n==null||n()),c==null||c())},[n,o,c]),M=f.useCallback((T={},A=null)=>({...T,ref:cn(A,h),onClick:tt(T.onClick,R),onKeyDown:tt(T.onKeyDown,k),onMouseDown:tt(T.onMouseDown,S)}),[k,S,R]);return{isOpen:t,onClose:n,headerId:v,bodyId:b,setBodyMounted:E,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:O,getDialogContainerProps:M,index:w}}function zz(e,t){const n=e.current;f.useEffect(()=>{if(!(!e.current||!t))return Nz(e.current)},[t,e,n])}function Lz(e,...t){const n=f.useId(),r=e||n;return f.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Bz,Fc]=Rn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Fz,al]=Rn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Ju=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:a,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:v,lockFocusAcrossFrames:b,onCloseComplete:w}=t,y=Br("Modal",t),k={...$z(t),autoFocus:o,trapFocus:s,initialFocusRef:a,finalFocusRef:c,returnFocusOnClose:d,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:m,motionPreset:v,lockFocusAcrossFrames:b};return i.jsx(Fz,{value:k,children:i.jsx(Bz,{value:y,children:i.jsx(Fo,{onExitComplete:w,children:k.isOpen&&i.jsx(Uu,{...n,children:r})})})})};Ju.displayName="Modal";var Cp="right-scroll-bar-position",kp="width-before-scroll-bar",Hz="with-scroll-bars-hidden",Wz="--removed-body-scroll-bar-size",hP=c5(),_0=function(){},pm=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:_0,onWheelCapture:_0,onTouchMoveCapture:_0}),o=r[0],s=r[1],a=e.forwardProps,c=e.children,d=e.className,p=e.removeScrollBar,h=e.enabled,m=e.shards,v=e.sideCar,b=e.noIsolation,w=e.inert,y=e.allowPinchZoom,S=e.as,k=S===void 0?"div":S,_=e.gapMode,I=a5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=v,E=s5([n,t]),O=Xs(Xs({},I),o);return f.createElement(f.Fragment,null,h&&f.createElement(P,{sideCar:hP,removeScrollBar:p,shards:m,noIsolation:b,inert:w,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:_}),a?f.cloneElement(f.Children.only(c),Xs(Xs({},O),{ref:E})):f.createElement(k,Xs({},O,{className:d,ref:E}),c))});pm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};pm.classNames={fullWidth:kp,zeroRight:Cp};var tS,Vz=function(){if(tS)return tS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Uz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vz();return t&&e.setAttribute("nonce",t),e}function Gz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function qz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Kz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Uz())&&(Gz(t,n),qz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Yz=function(){var e=Kz();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mP=function(){var e=Yz(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Qz={left:0,top:0,right:0,gap:0},P0=function(e){return parseInt(e||"",10)||0},Xz=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[P0(n),P0(r),P0(o)]},Jz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qz;var t=Xz(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])}},Zz=mP(),eL=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` .`.concat(Hz,` { diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-26d2feb2.js b/invokeai/frontend/web/dist/assets/MantineProvider-149dbf3d.js similarity index 99% rename from invokeai/frontend/web/dist/assets/MantineProvider-26d2feb2.js rename to invokeai/frontend/web/dist/assets/MantineProvider-149dbf3d.js index 639d6e3e71..51b22e03a0 100644 --- a/invokeai/frontend/web/dist/assets/MantineProvider-26d2feb2.js +++ b/invokeai/frontend/web/dist/assets/MantineProvider-149dbf3d.js @@ -1 +1 @@ -import{z as p,A as d,a4 as Z,aH as xe,g1 as We,Z as De,U as j,a7 as q,T as z,V as R,a1 as _e,a0 as Be,$ as Ce,_ as Ge,Y as Ue,g2 as Ve,g3 as Ze,fU as qe,ab as A,fS as B,f_ as Xe}from"./index-190cc92f.js";function Je(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function M(e={}){const{name:t,strict:r=!0,hookName:o="useContext",providerName:a="Provider",errorMessage:n,defaultValue:s}=e,i=p.createContext(s);i.displayName=t;function l(){var c;const u=p.useContext(i);if(!u&&r){const f=new Error(n??Je(o,a));throw f.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,f,l),f}return u}return[i.Provider,l,i]}var[Ke,Ye]=M({strict:!1,name:"PortalManagerContext"});function Qe(e){const{children:t,zIndex:r}=e;return d.jsx(Ke,{value:{zIndex:r},children:t})}Qe.displayName="PortalManager";var[ke,et]=M({strict:!1,name:"PortalContext"}),J="chakra-portal",tt=".chakra-portal",rt=e=>d.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),nt=e=>{const{appendToParentPortal:t,children:r}=e,[o,a]=p.useState(null),n=p.useRef(null),[,s]=p.useState({});p.useEffect(()=>s({}),[]);const i=et(),l=Ye();Z(()=>{if(!o)return;const u=o.ownerDocument,f=t?i??u.body:u.body;if(!f)return;n.current=u.createElement("div"),n.current.className=J,f.appendChild(n.current),s({});const y=n.current;return()=>{f.contains(y)&&f.removeChild(y)}},[o]);const c=l!=null&&l.zIndex?d.jsx(rt,{zIndex:l==null?void 0:l.zIndex,children:r}):r;return n.current?xe.createPortal(d.jsx(ke,{value:n.current,children:c}),n.current):d.jsx("span",{ref:u=>{u&&a(u)}})},ot=e=>{const{children:t,containerRef:r,appendToParentPortal:o}=e,a=r.current,n=a??(typeof window<"u"?document.body:void 0),s=p.useMemo(()=>{const l=a==null?void 0:a.ownerDocument.createElement("div");return l&&(l.className=J),l},[a]),[,i]=p.useState({});return Z(()=>i({}),[]),Z(()=>{if(!(!s||!n))return n.appendChild(s),()=>{n.removeChild(s)}},[s,n]),n&&s?xe.createPortal(d.jsx(ke,{value:o?s:null,children:t}),s):null};function G(e){const t={appendToParentPortal:!0,...e},{containerRef:r,...o}=t;return r?d.jsx(ot,{containerRef:r,...o}):d.jsx(nt,{...o})}G.className=J;G.selector=tt;G.displayName="Portal";function m(e,t={}){let r=!1;function o(){if(!r){r=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function a(...u){o();for(const f of u)t[f]=l(f);return m(e,t)}function n(...u){for(const f of u)f in t||(t[f]=l(f));return m(e,t)}function s(){return Object.fromEntries(Object.entries(t).map(([f,y])=>[f,y.selector]))}function i(){return Object.fromEntries(Object.entries(t).map(([f,y])=>[f,y.className]))}function l(u){const g=`chakra-${(["container","root"].includes(u??"")?[e]:[e,u]).filter(Boolean).join("__")}`;return{className:g,selector:`.${g}`,toString:()=>u}}return{parts:a,toPart:l,extend:n,selectors:s,classnames:i,get keys(){return Object.keys(t)},__type:{}}}var Or=m("accordion").parts("root","container","button","panel").extend("icon"),zr=m("alert").parts("title","description","container").extend("icon","spinner"),Rr=m("avatar").parts("label","badge","container").extend("excessLabel","group"),Mr=m("breadcrumb").parts("link","item","container").extend("separator");m("button").parts();var Lr=m("checkbox").parts("control","icon","container").extend("label");m("progress").parts("track","filledTrack").extend("label");var Fr=m("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Hr=m("editable").parts("preview","input","textarea"),Wr=m("form").parts("container","requiredIndicator","helperText"),Dr=m("formError").parts("text","icon"),Br=m("input").parts("addon","field","element","group"),Gr=m("list").parts("container","item","icon"),at=m("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),Ur=m("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Vr=m("numberinput").parts("root","field","stepperGroup","stepper");m("pininput").parts("field");var Zr=m("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),qr=m("progress").parts("label","filledTrack","track"),Xr=m("radio").parts("container","control","label"),Jr=m("select").parts("field","icon"),Kr=m("slider").parts("container","track","thumb","filledTrack","mark"),Yr=m("stat").parts("container","label","helpText","number","icon"),Qr=m("switch").parts("container","track","thumb"),en=m("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),tn=m("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),rn=m("tag").parts("container","label","closeButton"),nn=m("card").parts("container","header","body","footer");function P(e,t){return r=>r.colorMode==="dark"?t:e}function on(e){const{orientation:t,vertical:r,horizontal:o}=e;return t?t==="vertical"?r:o:{}}var st=(e,t)=>e.find(r=>r.id===t);function re(e,t){const r=we(e,t),o=r?e[r].findIndex(a=>a.id===t):-1;return{position:r,index:o}}function we(e,t){for(const[r,o]of Object.entries(e))if(st(o,t))return r}function it(e){const t=e.includes("right"),r=e.includes("left");let o="center";return t&&(o="flex-end"),r&&(o="flex-start"),{display:"flex",flexDirection:"column",alignItems:o}}function lt(e){const r=e==="top"||e==="bottom"?"0 auto":void 0,o=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,a=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,n=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",s=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:r,top:o,bottom:a,right:n,left:s}}function ct(e,t=[]){const r=p.useRef(e);return p.useEffect(()=>{r.current=e}),p.useCallback((...o)=>{var a;return(a=r.current)==null?void 0:a.call(r,...o)},t)}function ut(e,t){const r=ct(e);p.useEffect(()=>{if(t==null)return;let o=null;return o=window.setTimeout(()=>{r()},t),()=>{o&&window.clearTimeout(o)}},[t,r])}function ne(e,t){const r=p.useRef(!1),o=p.useRef(!1);p.useEffect(()=>{if(r.current&&o.current)return e();o.current=!0},t),p.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])}var dt={initial:e=>{const{position:t}=e,r=["top","bottom"].includes(t)?"y":"x";let o=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(o=1),{opacity:0,[r]:o*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},Pe=p.memo(e=>{const{id:t,message:r,onCloseComplete:o,onRequestRemove:a,requestClose:n=!1,position:s="bottom",duration:i=5e3,containerStyle:l,motionVariants:c=dt,toastSpacing:u="0.5rem"}=e,[f,y]=p.useState(i),g=We();ne(()=>{g||o==null||o()},[g]),ne(()=>{y(i)},[i]);const h=()=>y(null),$=()=>y(i),S=()=>{g&&a()};p.useEffect(()=>{g&&n&&a()},[g,n,a]),ut(S,f);const H=p.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:u,...l}),[l,u]),N=p.useMemo(()=>it(s),[s]);return d.jsx(De.div,{layout:!0,className:"chakra-toast",variants:c,initial:"initial",animate:"animate",exit:"exit",onHoverStart:h,onHoverEnd:$,custom:{position:s},style:N,children:d.jsx(j.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:H,children:q(r,{id:t,onClose:S})})})});Pe.displayName="ToastComponent";function ft(e,t){var r;const o=e??"bottom",n={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[o];return(r=n==null?void 0:n[t])!=null?r:o}var oe={path:d.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[d.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),d.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),d.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},L=z((e,t)=>{const{as:r,viewBox:o,color:a="currentColor",focusable:n=!1,children:s,className:i,__css:l,...c}=e,u=R("chakra-icon",i),f=_e("Icon",e),y={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:a,...l,...f},g={ref:t,focusable:n,className:u,__css:y},h=o??oe.viewBox;if(r&&typeof r!="string")return d.jsx(j.svg,{as:r,...g,...c});const $=s??oe.path;return d.jsx(j.svg,{verticalAlign:"middle",viewBox:h,...g,...c,children:$})});L.displayName="Icon";function pt(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function mt(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function ae(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var[gt,K]=M({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[bt,Y]=M({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Ae={info:{icon:mt,colorScheme:"blue"},warning:{icon:ae,colorScheme:"orange"},success:{icon:pt,colorScheme:"green"},error:{icon:ae,colorScheme:"red"},loading:{icon:Be,colorScheme:"blue"}};function yt(e){return Ae[e].colorScheme}function vt(e){return Ae[e].icon}var je=z(function(t,r){const o=Y(),{status:a}=K(),n={display:"inline",...o.description};return d.jsx(j.div,{ref:r,"data-status":a,...t,className:R("chakra-alert__desc",t.className),__css:n})});je.displayName="AlertDescription";function Ee(e){const{status:t}=K(),r=vt(t),o=Y(),a=t==="loading"?o.spinner:o.icon;return d.jsx(j.span,{display:"inherit","data-status":t,...e,className:R("chakra-alert__icon",e.className),__css:a,children:e.children||d.jsx(r,{h:"100%",w:"100%"})})}Ee.displayName="AlertIcon";var Ne=z(function(t,r){const o=Y(),{status:a}=K();return d.jsx(j.div,{ref:r,"data-status":a,...t,className:R("chakra-alert__title",t.className),__css:o.title})});Ne.displayName="AlertTitle";var $e=z(function(t,r){var o;const{status:a="info",addRole:n=!0,...s}=Ce(t),i=(o=t.colorScheme)!=null?o:yt(a),l=Ge("Alert",{...t,colorScheme:i}),c={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return d.jsx(gt,{value:{status:a},children:d.jsx(bt,{value:l,children:d.jsx(j.div,{"data-status":a,role:n?"alert":void 0,ref:r,...s,className:R("chakra-alert",t.className),__css:c})})})});$e.displayName="Alert";function ht(e){return d.jsx(L,{focusable:"false","aria-hidden":!0,...e,children:d.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var Te=z(function(t,r){const o=_e("CloseButton",t),{children:a,isDisabled:n,__css:s,...i}=Ce(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return d.jsx(j.button,{type:"button","aria-label":"Close",ref:r,disabled:n,__css:{...l,...o,...s},...i,children:a||d.jsx(ht,{width:"1em",height:"1em"})})});Te.displayName="CloseButton";var St={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},C=xt(St);function xt(e){let t=e;const r=new Set,o=a=>{t=a(t),r.forEach(n=>n())};return{getState:()=>t,subscribe:a=>(r.add(a),()=>{o(()=>e),r.delete(a)}),removeToast:(a,n)=>{o(s=>({...s,[n]:s[n].filter(i=>i.id!=a)}))},notify:(a,n)=>{const s=_t(a,n),{position:i,id:l}=s;return o(c=>{var u,f;const g=i.includes("top")?[s,...(u=c[i])!=null?u:[]]:[...(f=c[i])!=null?f:[],s];return{...c,[i]:g}}),l},update:(a,n)=>{a&&o(s=>{const i={...s},{position:l,index:c}=re(i,a);return l&&c!==-1&&(i[l][c]={...i[l][c],...n,message:Ie(n)}),i})},closeAll:({positions:a}={})=>{o(n=>(a??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,c)=>(l[c]=n[c].map(u=>({...u,requestClose:!0})),l),{...n}))},close:a=>{o(n=>{const s=we(n,a);return s?{...n,[s]:n[s].map(i=>i.id==a?{...i,requestClose:!0}:i)}:n})},isActive:a=>!!re(C.getState(),a).position}}var se=0;function _t(e,t={}){var r,o;se+=1;const a=(r=t.id)!=null?r:se,n=(o=t.position)!=null?o:"bottom";return{id:a,message:e,position:n,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>C.removeToast(String(a),n),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var Ct=e=>{const{status:t,variant:r="solid",id:o,title:a,isClosable:n,onClose:s,description:i,colorScheme:l,icon:c}=e,u=o?{root:`toast-${o}`,title:`toast-${o}-title`,description:`toast-${o}-description`}:void 0;return d.jsxs($e,{addRole:!1,status:t,variant:r,id:u==null?void 0:u.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[d.jsx(Ee,{children:c}),d.jsxs(j.div,{flex:"1",maxWidth:"100%",children:[a&&d.jsx(Ne,{id:u==null?void 0:u.title,children:a}),i&&d.jsx(je,{id:u==null?void 0:u.description,display:"block",children:i})]}),n&&d.jsx(Te,{size:"sm",onClick:s,position:"absolute",insetEnd:1,top:1})]})};function Ie(e={}){const{render:t,toastComponent:r=Ct}=e;return a=>typeof t=="function"?t({...a,...e}):d.jsx(r,{...a,...e})}function an(e,t){const r=a=>{var n;return{...t,...a,position:ft((n=a==null?void 0:a.position)!=null?n:t==null?void 0:t.position,e)}},o=a=>{const n=r(a),s=Ie(n);return C.notify(s,n)};return o.update=(a,n)=>{C.update(a,r(n))},o.promise=(a,n)=>{const s=o({...n.loading,status:"loading",duration:null});a.then(i=>o.update(s,{status:"success",duration:5e3,...q(n.success,i)})).catch(i=>o.update(s,{status:"error",duration:5e3,...q(n.error,i)}))},o.closeAll=C.closeAll,o.close=C.close,o.isActive=C.isActive,o}var[sn,ln]=M({name:"ToastOptionsContext",strict:!1}),cn=e=>{const t=p.useSyncExternalStore(C.subscribe,C.getState,C.getState),{motionVariants:r,component:o=Pe,portalProps:a}=e,s=Object.keys(t).map(i=>{const l=t[i];return d.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${i}`,style:lt(i),children:d.jsx(Ue,{initial:!1,children:l.map(c=>d.jsx(o,{motionVariants:r,...c},c.id))})},i)});return d.jsx(G,{...a,children:s})};function kt(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),r=0;r()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}};function le(e,t,r){e.loadNamespaces(t,Oe(e,r))}function ce(e,t,r,o){typeof r=="string"&&(r=[r]),r.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Oe(e,o))}function wt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=t.languages[0],a=t.options?t.options.fallbackLng:!1,n=t.languages[t.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const s=(i,l)=>{const c=t.services.backendConnector.state[`${i}|${l}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(o,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(o,e)&&(!a||s(n,e)))}function Pt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(X("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:r.lng,precheck:(a,n)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!n(a.isLanguageChangingTo,e))return!1}}):wt(e,t,r)}const At=p.createContext();class jt{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Et=(e,t)=>{const r=p.useRef();return p.useEffect(()=>{r.current=t?r.current:e},[e,t]),r.current};function un(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=t,{i18n:o,defaultNS:a}=p.useContext(At)||{},n=r||o||Ze();if(n&&!n.reportNamespaces&&(n.reportNamespaces=new jt),!n){X("You will need to pass in an i18next instance by using initReactI18next");const v=(w,x)=>typeof x=="string"?x:x&&typeof x=="object"&&typeof x.defaultValue=="string"?x.defaultValue:Array.isArray(w)?w[w.length-1]:w,k=[v,{},!1];return k.t=v,k.i18n={},k.ready=!1,k}n.options.react&&n.options.react.wait!==void 0&&X("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...Ve(),...n.options.react,...t},{useSuspense:i,keyPrefix:l}=s;let c=e||a||n.options&&n.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],n.reportNamespaces.addUsedNamespaces&&n.reportNamespaces.addUsedNamespaces(c);const u=(n.isInitialized||n.initializedStoreOnce)&&c.every(v=>Pt(v,n,s));function f(){return n.getFixedT(t.lng||null,s.nsMode==="fallback"?c:c[0],l)}const[y,g]=p.useState(f);let h=c.join();t.lng&&(h=`${t.lng}${h}`);const $=Et(h),S=p.useRef(!0);p.useEffect(()=>{const{bindI18n:v,bindI18nStore:k}=s;S.current=!0,!u&&!i&&(t.lng?ce(n,t.lng,c,()=>{S.current&&g(f)}):le(n,c,()=>{S.current&&g(f)})),u&&$&&$!==h&&S.current&&g(f);function w(){S.current&&g(f)}return v&&n&&n.on(v,w),k&&n&&n.store.on(k,w),()=>{S.current=!1,v&&n&&v.split(" ").forEach(x=>n.off(x,w)),k&&n&&k.split(" ").forEach(x=>n.store.off(x,w))}},[n,h]);const H=p.useRef(!0);p.useEffect(()=>{S.current&&!H.current&&g(f),H.current=!1},[n,l]);const N=[y,n,u];if(N.t=y,N.i18n=n,N.ready=u,u||!u&&!i)return N;throw new Promise(v=>{t.lng?ce(n,t.lng,c,()=>v()):le(n,c,()=>v())})}const{definePartsStyle:Nt,defineMultiStyleConfig:$t}=qe(at.keys),Tt=Nt(e=>({button:{fontWeight:500,bg:P("base.300","base.500")(e),color:P("base.900","base.100")(e),_hover:{bg:P("base.400","base.600")(e),color:P("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:P("base.900","base.150")(e),bg:P("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:P("base.200","base.800")(e),_hover:{bg:P("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:P("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),dn=$t({variants:{invokeAI:Tt},defaultProps:{variant:"invokeAI"}}),fn={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},It={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function Ot(e){return()=>({fontFamily:e.fontFamily||"sans-serif"})}var zt=Object.defineProperty,ue=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,de=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fe=(e,t)=>{for(var r in t||(t={}))Rt.call(t,r)&&de(e,r,t[r]);if(ue)for(var r of ue(t))Mt.call(t,r)&&de(e,r,t[r]);return e};function Lt(e){return t=>({WebkitTapHighlightColor:"transparent",[t||"&:focus"]:fe({},e.focusRing==="always"||e.focusRing==="auto"?e.focusRingStyles.styles(e):e.focusRingStyles.resetStyles(e)),[t?t.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:fe({},e.focusRing==="auto"||e.focusRing==="never"?e.focusRingStyles.resetStyles(e):null)})}function F(e){return t=>typeof e.primaryShade=="number"?e.primaryShade:e.primaryShade[t||e.colorScheme]}function Q(e){const t=F(e);return(r,o,a=!0,n=!0)=>{if(typeof r=="string"&&r.includes(".")){const[i,l]=r.split("."),c=parseInt(l,10);if(i in e.colors&&c>=0&&c<10)return e.colors[i][typeof o=="number"&&!n?o:c]}const s=typeof o=="number"?o:t();return r in e.colors?e.colors[r][s]:a?e.colors[e.primaryColor][s]:r}}function ze(e){let t="";for(let r=1;r{const a={from:(o==null?void 0:o.from)||e.defaultGradient.from,to:(o==null?void 0:o.to)||e.defaultGradient.to,deg:(o==null?void 0:o.deg)||e.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${t(a.from,r(),!1)} 0%, ${t(a.to,r(),!1)} 100%)`}}function Me(e){return t=>{if(typeof t=="number")return`${t/16}${e}`;if(typeof t=="string"){const r=t.replace("px","");if(!Number.isNaN(Number(r)))return`${Number(r)/16}${e}`}return t}}const E=Me("rem"),U=Me("em");function Le({size:e,sizes:t,units:r}){return e in t?t[e]:typeof e=="number"?r==="em"?U(e):E(e):e||t.md}function W(e){return typeof e=="number"?e:typeof e=="string"&&e.includes("rem")?Number(e.replace("rem",""))*16:typeof e=="string"&&e.includes("em")?Number(e.replace("em",""))*16:Number(e)}function Wt(e){return t=>`@media (min-width: ${U(W(Le({size:t,sizes:e.breakpoints})))})`}function Dt(e){return t=>`@media (max-width: ${U(W(Le({size:t,sizes:e.breakpoints}))-1)})`}function Bt(e){return/^#?([0-9A-F]{3}){1,2}$/i.test(e)}function Gt(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}const r=parseInt(t,16),o=r>>16&255,a=r>>8&255,n=r&255;return{r:o,g:a,b:n,a:1}}function Ut(e){const[t,r,o,a]=e.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:t,g:r,b:o,a:a||1}}function ee(e){return Bt(e)?Gt(e):e.startsWith("rgb")?Ut(e):{r:0,g:0,b:0,a:1}}function T(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(--"))return e;const{r,g:o,b:a}=ee(e);return`rgba(${r}, ${o}, ${a}, ${t})`}function Vt(e=0){return{position:"absolute",top:E(e),right:E(e),left:E(e),bottom:E(e)}}function Zt(e,t){if(typeof e=="string"&&e.startsWith("var(--"))return e;const{r,g:o,b:a,a:n}=ee(e),s=1-t,i=l=>Math.round(l*s);return`rgba(${i(r)}, ${i(o)}, ${i(a)}, ${n})`}function qt(e,t){if(typeof e=="string"&&e.startsWith("var(--"))return e;const{r,g:o,b:a,a:n}=ee(e),s=i=>Math.round(i+(255-i)*t);return`rgba(${s(r)}, ${s(o)}, ${s(a)}, ${n})`}function Xt(e){return t=>{if(typeof t=="number")return E(t);const r=typeof e.defaultRadius=="number"?e.defaultRadius:e.radius[e.defaultRadius]||e.defaultRadius;return e.radius[t]||t||r}}function Jt(e,t){if(typeof e=="string"&&e.includes(".")){const[r,o]=e.split("."),a=parseInt(o,10);if(r in t.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:r,shade:a}}return{isSplittedColor:!1}}function Kt(e){const t=Q(e),r=F(e),o=Re(e);return({variant:a,color:n,gradient:s,primaryFallback:i})=>{const l=Jt(n,e);switch(a){case"light":return{border:"transparent",background:T(t(n,e.colorScheme==="dark"?8:0,i,!1),e.colorScheme==="dark"?.2:1),color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),hover:T(t(n,e.colorScheme==="dark"?7:1,i,!1),e.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),hover:T(t(n,e.colorScheme==="dark"?8:0,i,!1),e.colorScheme==="dark"?.2:1)};case"outline":return{border:t(n,e.colorScheme==="dark"?5:r("light")),background:"transparent",color:t(n,e.colorScheme==="dark"?5:r("light")),hover:e.colorScheme==="dark"?T(t(n,5,i,!1),.05):T(t(n,0,i,!1),.35)};case"default":return{border:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4],background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,color:e.colorScheme==="dark"?e.white:e.black,hover:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]};case"white":return{border:"transparent",background:e.white,color:t(n,r()),hover:null};case"transparent":return{border:"transparent",color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),background:"transparent",hover:null};case"gradient":return{background:o(s),color:e.white,border:"transparent",hover:null};default:{const c=r(),u=l.isSplittedColor?l.shade:c,f=l.isSplittedColor?l.key:n;return{border:"transparent",background:t(f,u,i),color:e.white,hover:t(f,u===9?8:u+1)}}}}}function Yt(e){return t=>{const r=F(e)(t);return e.colors[e.primaryColor][r]}}function Qt(e){return{"@media (hover: hover)":{"&:hover":e},"@media (hover: none)":{"&:active":e}}}function er(e){return()=>({userSelect:"none",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]})}function tr(e){return()=>e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]}const b={fontStyles:Ot,themeColor:Q,focusStyles:Lt,linearGradient:Ft,radialGradient:Ht,smallerThan:Dt,largerThan:Wt,rgba:T,cover:Vt,darken:Zt,lighten:qt,radius:Xt,variant:Kt,primaryShade:F,hover:Qt,gradient:Re,primaryColor:Yt,placeholderStyles:er,dimmed:tr};var rr=Object.defineProperty,nr=Object.defineProperties,or=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,me=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ir=(e,t)=>{for(var r in t||(t={}))ar.call(t,r)&&me(e,r,t[r]);if(pe)for(var r of pe(t))sr.call(t,r)&&me(e,r,t[r]);return e},lr=(e,t)=>nr(e,or(t));function Fe(e){return lr(ir({},e),{fn:{fontStyles:b.fontStyles(e),themeColor:b.themeColor(e),focusStyles:b.focusStyles(e),largerThan:b.largerThan(e),smallerThan:b.smallerThan(e),radialGradient:b.radialGradient,linearGradient:b.linearGradient,gradient:b.gradient(e),rgba:b.rgba,cover:b.cover,lighten:b.lighten,darken:b.darken,primaryShade:b.primaryShade(e),radius:b.radius(e),variant:b.variant(e),hover:b.hover,primaryColor:b.primaryColor(e),placeholderStyles:b.placeholderStyles(e),dimmed:b.dimmed(e)}})}const cr={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:It,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:e=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${e.colors[e.primaryColor][e.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:e=>({outline:"none",borderColor:e.colors[e.primaryColor][typeof e.primaryShade=="object"?e.primaryShade[e.colorScheme]:e.primaryShade]})}},te=Fe(cr);var ur=Object.defineProperty,dr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,be=(e,t,r)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))pr.call(t,r)&&be(e,r,t[r]);if(ge)for(var r of ge(t))mr.call(t,r)&&be(e,r,t[r]);return e},br=(e,t)=>dr(e,fr(t));function yr({theme:e}){return A.createElement(B,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:e.colorScheme==="dark"?"dark":"light"},body:br(gr({},e.fn.fontStyles()),{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,lineHeight:e.lineHeight,fontSize:e.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function I(e,t,r,o=E){Object.keys(t).forEach(a=>{e[`--mantine-${r}-${a}`]=o(t[a])})}function vr({theme:e}){const t={"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-transition-timing-function":e.transitionTimingFunction,"--mantine-line-height":`${e.lineHeight}`,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":`${e.headings.fontWeight}`};I(t,e.shadows,"shadow"),I(t,e.fontSizes,"font-size"),I(t,e.radius,"radius"),I(t,e.spacing,"spacing"),I(t,e.breakpoints,"breakpoints",U),Object.keys(e.colors).forEach(o=>{e.colors[o].forEach((a,n)=>{t[`--mantine-color-${o}-${n}`]=a})});const r=e.headings.sizes;return Object.keys(r).forEach(o=>{t[`--mantine-${o}-font-size`]=r[o].fontSize,t[`--mantine-${o}-line-height`]=`${r[o].lineHeight}`}),A.createElement(B,{styles:{":root":t}})}var hr=Object.defineProperty,Sr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,ve=(e,t,r)=>t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))_r.call(t,r)&&ve(e,r,t[r]);if(ye)for(var r of ye(t))Cr.call(t,r)&&ve(e,r,t[r]);return e},V=(e,t)=>Sr(e,xr(t));function kr(e,t){var r;if(!t)return e;const o=Object.keys(e).reduce((a,n)=>{if(n==="headings"&&t.headings){const s=t.headings.sizes?Object.keys(e.headings.sizes).reduce((i,l)=>(i[l]=_(_({},e.headings.sizes[l]),t.headings.sizes[l]),i),{}):e.headings.sizes;return V(_({},a),{headings:V(_(_({},e.headings),t.headings),{sizes:s})})}if(n==="breakpoints"&&t.breakpoints){const s=_(_({},e.breakpoints),t.breakpoints);return V(_({},a),{breakpoints:Object.fromEntries(Object.entries(s).sort((i,l)=>W(i[1])-W(l[1])))})}return a[n]=typeof t[n]=="object"?_(_({},e[n]),t[n]):typeof t[n]=="number"||typeof t[n]=="boolean"||typeof t[n]=="function"?t[n]:t[n]||e[n],a},{});if(t!=null&&t.fontFamily&&!((r=t==null?void 0:t.headings)!=null&&r.fontFamily)&&(o.headings.fontFamily=t.fontFamily),!(o.primaryColor in o.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return o}function wr(e,t){return Fe(kr(e,t))}function Pr(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}const Ar={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${E(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function jr(){return A.createElement(B,{styles:Ar})}var Er=Object.defineProperty,he=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Se=(e,t,r)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,O=(e,t)=>{for(var r in t||(t={}))Nr.call(t,r)&&Se(e,r,t[r]);if(he)for(var r of he(t))$r.call(t,r)&&Se(e,r,t[r]);return e};const D=p.createContext({theme:te});function He(){var e;return((e=p.useContext(D))==null?void 0:e.theme)||te}function pn(e){const t=He(),r=o=>{var a,n,s,i;return{styles:((a=t.components[o])==null?void 0:a.styles)||{},classNames:((n=t.components[o])==null?void 0:n.classNames)||{},variants:(s=t.components[o])==null?void 0:s.variants,sizes:(i=t.components[o])==null?void 0:i.sizes}};return Array.isArray(e)?e.map(r):[r(e)]}function mn(){var e;return(e=p.useContext(D))==null?void 0:e.emotionCache}function gn(e,t,r){var o;const a=He(),n=(o=a.components[e])==null?void 0:o.defaultProps,s=typeof n=="function"?n(a):n;return O(O(O({},t),s),Pr(r))}function Tr({theme:e,emotionCache:t,withNormalizeCSS:r=!1,withGlobalStyles:o=!1,withCSSVariables:a=!1,inherit:n=!1,children:s}){const i=p.useContext(D),l=wr(te,n?O(O({},i.theme),e):e);return A.createElement(Xe,{theme:l},A.createElement(D.Provider,{value:{theme:l,emotionCache:t}},r&&A.createElement(jr,null),o&&A.createElement(yr,{theme:l}),a&&A.createElement(vr,{theme:l}),typeof l.globalStyles=="function"&&A.createElement(B,{styles:l.globalStyles(l)}),s))}Tr.displayName="@mantine/core/MantineProvider";export{on as A,Yr as B,Te as C,Gr as D,at as E,Ur as F,Vr as G,Zr as H,L as I,Fr as J,Hr as K,Wr as L,Dr as M,Mr as N,nn as O,G as P,Or as Q,zr as R,Rr as S,Qe as T,sn as U,cn as V,dn as W,Tr as X,M as a,ct as b,an as c,ne as d,un as e,mn as f,He as g,pn as h,Pr as i,W as j,Le as k,gn as l,fn as m,P as n,tn as o,rn as p,Br as q,E as r,Qr as s,en as t,ln as u,qr as v,Lr as w,Xr as x,Jr as y,Kr as z}; +import{z as p,A as d,a4 as Z,aH as xe,g1 as We,Z as De,U as j,a7 as q,T as z,V as R,a1 as _e,a0 as Be,$ as Ce,_ as Ge,Y as Ue,g2 as Ve,g3 as Ze,fU as qe,ab as A,fS as B,f_ as Xe}from"./index-91eecded.js";function Je(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function M(e={}){const{name:t,strict:r=!0,hookName:o="useContext",providerName:a="Provider",errorMessage:n,defaultValue:s}=e,i=p.createContext(s);i.displayName=t;function l(){var c;const u=p.useContext(i);if(!u&&r){const f=new Error(n??Je(o,a));throw f.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,f,l),f}return u}return[i.Provider,l,i]}var[Ke,Ye]=M({strict:!1,name:"PortalManagerContext"});function Qe(e){const{children:t,zIndex:r}=e;return d.jsx(Ke,{value:{zIndex:r},children:t})}Qe.displayName="PortalManager";var[ke,et]=M({strict:!1,name:"PortalContext"}),J="chakra-portal",tt=".chakra-portal",rt=e=>d.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),nt=e=>{const{appendToParentPortal:t,children:r}=e,[o,a]=p.useState(null),n=p.useRef(null),[,s]=p.useState({});p.useEffect(()=>s({}),[]);const i=et(),l=Ye();Z(()=>{if(!o)return;const u=o.ownerDocument,f=t?i??u.body:u.body;if(!f)return;n.current=u.createElement("div"),n.current.className=J,f.appendChild(n.current),s({});const y=n.current;return()=>{f.contains(y)&&f.removeChild(y)}},[o]);const c=l!=null&&l.zIndex?d.jsx(rt,{zIndex:l==null?void 0:l.zIndex,children:r}):r;return n.current?xe.createPortal(d.jsx(ke,{value:n.current,children:c}),n.current):d.jsx("span",{ref:u=>{u&&a(u)}})},ot=e=>{const{children:t,containerRef:r,appendToParentPortal:o}=e,a=r.current,n=a??(typeof window<"u"?document.body:void 0),s=p.useMemo(()=>{const l=a==null?void 0:a.ownerDocument.createElement("div");return l&&(l.className=J),l},[a]),[,i]=p.useState({});return Z(()=>i({}),[]),Z(()=>{if(!(!s||!n))return n.appendChild(s),()=>{n.removeChild(s)}},[s,n]),n&&s?xe.createPortal(d.jsx(ke,{value:o?s:null,children:t}),s):null};function G(e){const t={appendToParentPortal:!0,...e},{containerRef:r,...o}=t;return r?d.jsx(ot,{containerRef:r,...o}):d.jsx(nt,{...o})}G.className=J;G.selector=tt;G.displayName="Portal";function m(e,t={}){let r=!1;function o(){if(!r){r=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function a(...u){o();for(const f of u)t[f]=l(f);return m(e,t)}function n(...u){for(const f of u)f in t||(t[f]=l(f));return m(e,t)}function s(){return Object.fromEntries(Object.entries(t).map(([f,y])=>[f,y.selector]))}function i(){return Object.fromEntries(Object.entries(t).map(([f,y])=>[f,y.className]))}function l(u){const g=`chakra-${(["container","root"].includes(u??"")?[e]:[e,u]).filter(Boolean).join("__")}`;return{className:g,selector:`.${g}`,toString:()=>u}}return{parts:a,toPart:l,extend:n,selectors:s,classnames:i,get keys(){return Object.keys(t)},__type:{}}}var Or=m("accordion").parts("root","container","button","panel").extend("icon"),zr=m("alert").parts("title","description","container").extend("icon","spinner"),Rr=m("avatar").parts("label","badge","container").extend("excessLabel","group"),Mr=m("breadcrumb").parts("link","item","container").extend("separator");m("button").parts();var Lr=m("checkbox").parts("control","icon","container").extend("label");m("progress").parts("track","filledTrack").extend("label");var Fr=m("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Hr=m("editable").parts("preview","input","textarea"),Wr=m("form").parts("container","requiredIndicator","helperText"),Dr=m("formError").parts("text","icon"),Br=m("input").parts("addon","field","element","group"),Gr=m("list").parts("container","item","icon"),at=m("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),Ur=m("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Vr=m("numberinput").parts("root","field","stepperGroup","stepper");m("pininput").parts("field");var Zr=m("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),qr=m("progress").parts("label","filledTrack","track"),Xr=m("radio").parts("container","control","label"),Jr=m("select").parts("field","icon"),Kr=m("slider").parts("container","track","thumb","filledTrack","mark"),Yr=m("stat").parts("container","label","helpText","number","icon"),Qr=m("switch").parts("container","track","thumb"),en=m("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),tn=m("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),rn=m("tag").parts("container","label","closeButton"),nn=m("card").parts("container","header","body","footer");function P(e,t){return r=>r.colorMode==="dark"?t:e}function on(e){const{orientation:t,vertical:r,horizontal:o}=e;return t?t==="vertical"?r:o:{}}var st=(e,t)=>e.find(r=>r.id===t);function re(e,t){const r=we(e,t),o=r?e[r].findIndex(a=>a.id===t):-1;return{position:r,index:o}}function we(e,t){for(const[r,o]of Object.entries(e))if(st(o,t))return r}function it(e){const t=e.includes("right"),r=e.includes("left");let o="center";return t&&(o="flex-end"),r&&(o="flex-start"),{display:"flex",flexDirection:"column",alignItems:o}}function lt(e){const r=e==="top"||e==="bottom"?"0 auto":void 0,o=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,a=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,n=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",s=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:r,top:o,bottom:a,right:n,left:s}}function ct(e,t=[]){const r=p.useRef(e);return p.useEffect(()=>{r.current=e}),p.useCallback((...o)=>{var a;return(a=r.current)==null?void 0:a.call(r,...o)},t)}function ut(e,t){const r=ct(e);p.useEffect(()=>{if(t==null)return;let o=null;return o=window.setTimeout(()=>{r()},t),()=>{o&&window.clearTimeout(o)}},[t,r])}function ne(e,t){const r=p.useRef(!1),o=p.useRef(!1);p.useEffect(()=>{if(r.current&&o.current)return e();o.current=!0},t),p.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])}var dt={initial:e=>{const{position:t}=e,r=["top","bottom"].includes(t)?"y":"x";let o=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(o=1),{opacity:0,[r]:o*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},Pe=p.memo(e=>{const{id:t,message:r,onCloseComplete:o,onRequestRemove:a,requestClose:n=!1,position:s="bottom",duration:i=5e3,containerStyle:l,motionVariants:c=dt,toastSpacing:u="0.5rem"}=e,[f,y]=p.useState(i),g=We();ne(()=>{g||o==null||o()},[g]),ne(()=>{y(i)},[i]);const h=()=>y(null),$=()=>y(i),S=()=>{g&&a()};p.useEffect(()=>{g&&n&&a()},[g,n,a]),ut(S,f);const H=p.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:u,...l}),[l,u]),N=p.useMemo(()=>it(s),[s]);return d.jsx(De.div,{layout:!0,className:"chakra-toast",variants:c,initial:"initial",animate:"animate",exit:"exit",onHoverStart:h,onHoverEnd:$,custom:{position:s},style:N,children:d.jsx(j.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:H,children:q(r,{id:t,onClose:S})})})});Pe.displayName="ToastComponent";function ft(e,t){var r;const o=e??"bottom",n={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[o];return(r=n==null?void 0:n[t])!=null?r:o}var oe={path:d.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[d.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),d.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),d.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},L=z((e,t)=>{const{as:r,viewBox:o,color:a="currentColor",focusable:n=!1,children:s,className:i,__css:l,...c}=e,u=R("chakra-icon",i),f=_e("Icon",e),y={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:a,...l,...f},g={ref:t,focusable:n,className:u,__css:y},h=o??oe.viewBox;if(r&&typeof r!="string")return d.jsx(j.svg,{as:r,...g,...c});const $=s??oe.path;return d.jsx(j.svg,{verticalAlign:"middle",viewBox:h,...g,...c,children:$})});L.displayName="Icon";function pt(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function mt(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function ae(e){return d.jsx(L,{viewBox:"0 0 24 24",...e,children:d.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var[gt,K]=M({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[bt,Y]=M({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Ae={info:{icon:mt,colorScheme:"blue"},warning:{icon:ae,colorScheme:"orange"},success:{icon:pt,colorScheme:"green"},error:{icon:ae,colorScheme:"red"},loading:{icon:Be,colorScheme:"blue"}};function yt(e){return Ae[e].colorScheme}function vt(e){return Ae[e].icon}var je=z(function(t,r){const o=Y(),{status:a}=K(),n={display:"inline",...o.description};return d.jsx(j.div,{ref:r,"data-status":a,...t,className:R("chakra-alert__desc",t.className),__css:n})});je.displayName="AlertDescription";function Ee(e){const{status:t}=K(),r=vt(t),o=Y(),a=t==="loading"?o.spinner:o.icon;return d.jsx(j.span,{display:"inherit","data-status":t,...e,className:R("chakra-alert__icon",e.className),__css:a,children:e.children||d.jsx(r,{h:"100%",w:"100%"})})}Ee.displayName="AlertIcon";var Ne=z(function(t,r){const o=Y(),{status:a}=K();return d.jsx(j.div,{ref:r,"data-status":a,...t,className:R("chakra-alert__title",t.className),__css:o.title})});Ne.displayName="AlertTitle";var $e=z(function(t,r){var o;const{status:a="info",addRole:n=!0,...s}=Ce(t),i=(o=t.colorScheme)!=null?o:yt(a),l=Ge("Alert",{...t,colorScheme:i}),c={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return d.jsx(gt,{value:{status:a},children:d.jsx(bt,{value:l,children:d.jsx(j.div,{"data-status":a,role:n?"alert":void 0,ref:r,...s,className:R("chakra-alert",t.className),__css:c})})})});$e.displayName="Alert";function ht(e){return d.jsx(L,{focusable:"false","aria-hidden":!0,...e,children:d.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var Te=z(function(t,r){const o=_e("CloseButton",t),{children:a,isDisabled:n,__css:s,...i}=Ce(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return d.jsx(j.button,{type:"button","aria-label":"Close",ref:r,disabled:n,__css:{...l,...o,...s},...i,children:a||d.jsx(ht,{width:"1em",height:"1em"})})});Te.displayName="CloseButton";var St={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},C=xt(St);function xt(e){let t=e;const r=new Set,o=a=>{t=a(t),r.forEach(n=>n())};return{getState:()=>t,subscribe:a=>(r.add(a),()=>{o(()=>e),r.delete(a)}),removeToast:(a,n)=>{o(s=>({...s,[n]:s[n].filter(i=>i.id!=a)}))},notify:(a,n)=>{const s=_t(a,n),{position:i,id:l}=s;return o(c=>{var u,f;const g=i.includes("top")?[s,...(u=c[i])!=null?u:[]]:[...(f=c[i])!=null?f:[],s];return{...c,[i]:g}}),l},update:(a,n)=>{a&&o(s=>{const i={...s},{position:l,index:c}=re(i,a);return l&&c!==-1&&(i[l][c]={...i[l][c],...n,message:Ie(n)}),i})},closeAll:({positions:a}={})=>{o(n=>(a??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,c)=>(l[c]=n[c].map(u=>({...u,requestClose:!0})),l),{...n}))},close:a=>{o(n=>{const s=we(n,a);return s?{...n,[s]:n[s].map(i=>i.id==a?{...i,requestClose:!0}:i)}:n})},isActive:a=>!!re(C.getState(),a).position}}var se=0;function _t(e,t={}){var r,o;se+=1;const a=(r=t.id)!=null?r:se,n=(o=t.position)!=null?o:"bottom";return{id:a,message:e,position:n,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>C.removeToast(String(a),n),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var Ct=e=>{const{status:t,variant:r="solid",id:o,title:a,isClosable:n,onClose:s,description:i,colorScheme:l,icon:c}=e,u=o?{root:`toast-${o}`,title:`toast-${o}-title`,description:`toast-${o}-description`}:void 0;return d.jsxs($e,{addRole:!1,status:t,variant:r,id:u==null?void 0:u.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[d.jsx(Ee,{children:c}),d.jsxs(j.div,{flex:"1",maxWidth:"100%",children:[a&&d.jsx(Ne,{id:u==null?void 0:u.title,children:a}),i&&d.jsx(je,{id:u==null?void 0:u.description,display:"block",children:i})]}),n&&d.jsx(Te,{size:"sm",onClick:s,position:"absolute",insetEnd:1,top:1})]})};function Ie(e={}){const{render:t,toastComponent:r=Ct}=e;return a=>typeof t=="function"?t({...a,...e}):d.jsx(r,{...a,...e})}function an(e,t){const r=a=>{var n;return{...t,...a,position:ft((n=a==null?void 0:a.position)!=null?n:t==null?void 0:t.position,e)}},o=a=>{const n=r(a),s=Ie(n);return C.notify(s,n)};return o.update=(a,n)=>{C.update(a,r(n))},o.promise=(a,n)=>{const s=o({...n.loading,status:"loading",duration:null});a.then(i=>o.update(s,{status:"success",duration:5e3,...q(n.success,i)})).catch(i=>o.update(s,{status:"error",duration:5e3,...q(n.error,i)}))},o.closeAll=C.closeAll,o.close=C.close,o.isActive=C.isActive,o}var[sn,ln]=M({name:"ToastOptionsContext",strict:!1}),cn=e=>{const t=p.useSyncExternalStore(C.subscribe,C.getState,C.getState),{motionVariants:r,component:o=Pe,portalProps:a}=e,s=Object.keys(t).map(i=>{const l=t[i];return d.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${i}`,style:lt(i),children:d.jsx(Ue,{initial:!1,children:l.map(c=>d.jsx(o,{motionVariants:r,...c},c.id))})},i)});return d.jsx(G,{...a,children:s})};function kt(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),r=0;r()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}};function le(e,t,r){e.loadNamespaces(t,Oe(e,r))}function ce(e,t,r,o){typeof r=="string"&&(r=[r]),r.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Oe(e,o))}function wt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=t.languages[0],a=t.options?t.options.fallbackLng:!1,n=t.languages[t.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const s=(i,l)=>{const c=t.services.backendConnector.state[`${i}|${l}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(o,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(o,e)&&(!a||s(n,e)))}function Pt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(X("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:r.lng,precheck:(a,n)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!n(a.isLanguageChangingTo,e))return!1}}):wt(e,t,r)}const At=p.createContext();class jt{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Et=(e,t)=>{const r=p.useRef();return p.useEffect(()=>{r.current=t?r.current:e},[e,t]),r.current};function un(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=t,{i18n:o,defaultNS:a}=p.useContext(At)||{},n=r||o||Ze();if(n&&!n.reportNamespaces&&(n.reportNamespaces=new jt),!n){X("You will need to pass in an i18next instance by using initReactI18next");const v=(w,x)=>typeof x=="string"?x:x&&typeof x=="object"&&typeof x.defaultValue=="string"?x.defaultValue:Array.isArray(w)?w[w.length-1]:w,k=[v,{},!1];return k.t=v,k.i18n={},k.ready=!1,k}n.options.react&&n.options.react.wait!==void 0&&X("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...Ve(),...n.options.react,...t},{useSuspense:i,keyPrefix:l}=s;let c=e||a||n.options&&n.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],n.reportNamespaces.addUsedNamespaces&&n.reportNamespaces.addUsedNamespaces(c);const u=(n.isInitialized||n.initializedStoreOnce)&&c.every(v=>Pt(v,n,s));function f(){return n.getFixedT(t.lng||null,s.nsMode==="fallback"?c:c[0],l)}const[y,g]=p.useState(f);let h=c.join();t.lng&&(h=`${t.lng}${h}`);const $=Et(h),S=p.useRef(!0);p.useEffect(()=>{const{bindI18n:v,bindI18nStore:k}=s;S.current=!0,!u&&!i&&(t.lng?ce(n,t.lng,c,()=>{S.current&&g(f)}):le(n,c,()=>{S.current&&g(f)})),u&&$&&$!==h&&S.current&&g(f);function w(){S.current&&g(f)}return v&&n&&n.on(v,w),k&&n&&n.store.on(k,w),()=>{S.current=!1,v&&n&&v.split(" ").forEach(x=>n.off(x,w)),k&&n&&k.split(" ").forEach(x=>n.store.off(x,w))}},[n,h]);const H=p.useRef(!0);p.useEffect(()=>{S.current&&!H.current&&g(f),H.current=!1},[n,l]);const N=[y,n,u];if(N.t=y,N.i18n=n,N.ready=u,u||!u&&!i)return N;throw new Promise(v=>{t.lng?ce(n,t.lng,c,()=>v()):le(n,c,()=>v())})}const{definePartsStyle:Nt,defineMultiStyleConfig:$t}=qe(at.keys),Tt=Nt(e=>({button:{fontWeight:500,bg:P("base.300","base.500")(e),color:P("base.900","base.100")(e),_hover:{bg:P("base.400","base.600")(e),color:P("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:P("base.900","base.150")(e),bg:P("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:P("base.200","base.800")(e),_hover:{bg:P("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:P("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),dn=$t({variants:{invokeAI:Tt},defaultProps:{variant:"invokeAI"}}),fn={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},It={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function Ot(e){return()=>({fontFamily:e.fontFamily||"sans-serif"})}var zt=Object.defineProperty,ue=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,de=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fe=(e,t)=>{for(var r in t||(t={}))Rt.call(t,r)&&de(e,r,t[r]);if(ue)for(var r of ue(t))Mt.call(t,r)&&de(e,r,t[r]);return e};function Lt(e){return t=>({WebkitTapHighlightColor:"transparent",[t||"&:focus"]:fe({},e.focusRing==="always"||e.focusRing==="auto"?e.focusRingStyles.styles(e):e.focusRingStyles.resetStyles(e)),[t?t.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:fe({},e.focusRing==="auto"||e.focusRing==="never"?e.focusRingStyles.resetStyles(e):null)})}function F(e){return t=>typeof e.primaryShade=="number"?e.primaryShade:e.primaryShade[t||e.colorScheme]}function Q(e){const t=F(e);return(r,o,a=!0,n=!0)=>{if(typeof r=="string"&&r.includes(".")){const[i,l]=r.split("."),c=parseInt(l,10);if(i in e.colors&&c>=0&&c<10)return e.colors[i][typeof o=="number"&&!n?o:c]}const s=typeof o=="number"?o:t();return r in e.colors?e.colors[r][s]:a?e.colors[e.primaryColor][s]:r}}function ze(e){let t="";for(let r=1;r{const a={from:(o==null?void 0:o.from)||e.defaultGradient.from,to:(o==null?void 0:o.to)||e.defaultGradient.to,deg:(o==null?void 0:o.deg)||e.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${t(a.from,r(),!1)} 0%, ${t(a.to,r(),!1)} 100%)`}}function Me(e){return t=>{if(typeof t=="number")return`${t/16}${e}`;if(typeof t=="string"){const r=t.replace("px","");if(!Number.isNaN(Number(r)))return`${Number(r)/16}${e}`}return t}}const E=Me("rem"),U=Me("em");function Le({size:e,sizes:t,units:r}){return e in t?t[e]:typeof e=="number"?r==="em"?U(e):E(e):e||t.md}function W(e){return typeof e=="number"?e:typeof e=="string"&&e.includes("rem")?Number(e.replace("rem",""))*16:typeof e=="string"&&e.includes("em")?Number(e.replace("em",""))*16:Number(e)}function Wt(e){return t=>`@media (min-width: ${U(W(Le({size:t,sizes:e.breakpoints})))})`}function Dt(e){return t=>`@media (max-width: ${U(W(Le({size:t,sizes:e.breakpoints}))-1)})`}function Bt(e){return/^#?([0-9A-F]{3}){1,2}$/i.test(e)}function Gt(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}const r=parseInt(t,16),o=r>>16&255,a=r>>8&255,n=r&255;return{r:o,g:a,b:n,a:1}}function Ut(e){const[t,r,o,a]=e.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:t,g:r,b:o,a:a||1}}function ee(e){return Bt(e)?Gt(e):e.startsWith("rgb")?Ut(e):{r:0,g:0,b:0,a:1}}function T(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(--"))return e;const{r,g:o,b:a}=ee(e);return`rgba(${r}, ${o}, ${a}, ${t})`}function Vt(e=0){return{position:"absolute",top:E(e),right:E(e),left:E(e),bottom:E(e)}}function Zt(e,t){if(typeof e=="string"&&e.startsWith("var(--"))return e;const{r,g:o,b:a,a:n}=ee(e),s=1-t,i=l=>Math.round(l*s);return`rgba(${i(r)}, ${i(o)}, ${i(a)}, ${n})`}function qt(e,t){if(typeof e=="string"&&e.startsWith("var(--"))return e;const{r,g:o,b:a,a:n}=ee(e),s=i=>Math.round(i+(255-i)*t);return`rgba(${s(r)}, ${s(o)}, ${s(a)}, ${n})`}function Xt(e){return t=>{if(typeof t=="number")return E(t);const r=typeof e.defaultRadius=="number"?e.defaultRadius:e.radius[e.defaultRadius]||e.defaultRadius;return e.radius[t]||t||r}}function Jt(e,t){if(typeof e=="string"&&e.includes(".")){const[r,o]=e.split("."),a=parseInt(o,10);if(r in t.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:r,shade:a}}return{isSplittedColor:!1}}function Kt(e){const t=Q(e),r=F(e),o=Re(e);return({variant:a,color:n,gradient:s,primaryFallback:i})=>{const l=Jt(n,e);switch(a){case"light":return{border:"transparent",background:T(t(n,e.colorScheme==="dark"?8:0,i,!1),e.colorScheme==="dark"?.2:1),color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),hover:T(t(n,e.colorScheme==="dark"?7:1,i,!1),e.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),hover:T(t(n,e.colorScheme==="dark"?8:0,i,!1),e.colorScheme==="dark"?.2:1)};case"outline":return{border:t(n,e.colorScheme==="dark"?5:r("light")),background:"transparent",color:t(n,e.colorScheme==="dark"?5:r("light")),hover:e.colorScheme==="dark"?T(t(n,5,i,!1),.05):T(t(n,0,i,!1),.35)};case"default":return{border:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4],background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,color:e.colorScheme==="dark"?e.white:e.black,hover:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]};case"white":return{border:"transparent",background:e.white,color:t(n,r()),hover:null};case"transparent":return{border:"transparent",color:n==="dark"?e.colorScheme==="dark"?e.colors.dark[0]:e.colors.dark[9]:t(n,e.colorScheme==="dark"?2:r("light")),background:"transparent",hover:null};case"gradient":return{background:o(s),color:e.white,border:"transparent",hover:null};default:{const c=r(),u=l.isSplittedColor?l.shade:c,f=l.isSplittedColor?l.key:n;return{border:"transparent",background:t(f,u,i),color:e.white,hover:t(f,u===9?8:u+1)}}}}}function Yt(e){return t=>{const r=F(e)(t);return e.colors[e.primaryColor][r]}}function Qt(e){return{"@media (hover: hover)":{"&:hover":e},"@media (hover: none)":{"&:active":e}}}function er(e){return()=>({userSelect:"none",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]})}function tr(e){return()=>e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]}const b={fontStyles:Ot,themeColor:Q,focusStyles:Lt,linearGradient:Ft,radialGradient:Ht,smallerThan:Dt,largerThan:Wt,rgba:T,cover:Vt,darken:Zt,lighten:qt,radius:Xt,variant:Kt,primaryShade:F,hover:Qt,gradient:Re,primaryColor:Yt,placeholderStyles:er,dimmed:tr};var rr=Object.defineProperty,nr=Object.defineProperties,or=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,me=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ir=(e,t)=>{for(var r in t||(t={}))ar.call(t,r)&&me(e,r,t[r]);if(pe)for(var r of pe(t))sr.call(t,r)&&me(e,r,t[r]);return e},lr=(e,t)=>nr(e,or(t));function Fe(e){return lr(ir({},e),{fn:{fontStyles:b.fontStyles(e),themeColor:b.themeColor(e),focusStyles:b.focusStyles(e),largerThan:b.largerThan(e),smallerThan:b.smallerThan(e),radialGradient:b.radialGradient,linearGradient:b.linearGradient,gradient:b.gradient(e),rgba:b.rgba,cover:b.cover,lighten:b.lighten,darken:b.darken,primaryShade:b.primaryShade(e),radius:b.radius(e),variant:b.variant(e),hover:b.hover,primaryColor:b.primaryColor(e),placeholderStyles:b.placeholderStyles(e),dimmed:b.dimmed(e)}})}const cr={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:It,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:e=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${e.colors[e.primaryColor][e.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:e=>({outline:"none",borderColor:e.colors[e.primaryColor][typeof e.primaryShade=="object"?e.primaryShade[e.colorScheme]:e.primaryShade]})}},te=Fe(cr);var ur=Object.defineProperty,dr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,be=(e,t,r)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))pr.call(t,r)&&be(e,r,t[r]);if(ge)for(var r of ge(t))mr.call(t,r)&&be(e,r,t[r]);return e},br=(e,t)=>dr(e,fr(t));function yr({theme:e}){return A.createElement(B,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:e.colorScheme==="dark"?"dark":"light"},body:br(gr({},e.fn.fontStyles()),{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,lineHeight:e.lineHeight,fontSize:e.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function I(e,t,r,o=E){Object.keys(t).forEach(a=>{e[`--mantine-${r}-${a}`]=o(t[a])})}function vr({theme:e}){const t={"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-transition-timing-function":e.transitionTimingFunction,"--mantine-line-height":`${e.lineHeight}`,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":`${e.headings.fontWeight}`};I(t,e.shadows,"shadow"),I(t,e.fontSizes,"font-size"),I(t,e.radius,"radius"),I(t,e.spacing,"spacing"),I(t,e.breakpoints,"breakpoints",U),Object.keys(e.colors).forEach(o=>{e.colors[o].forEach((a,n)=>{t[`--mantine-color-${o}-${n}`]=a})});const r=e.headings.sizes;return Object.keys(r).forEach(o=>{t[`--mantine-${o}-font-size`]=r[o].fontSize,t[`--mantine-${o}-line-height`]=`${r[o].lineHeight}`}),A.createElement(B,{styles:{":root":t}})}var hr=Object.defineProperty,Sr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,ve=(e,t,r)=>t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))_r.call(t,r)&&ve(e,r,t[r]);if(ye)for(var r of ye(t))Cr.call(t,r)&&ve(e,r,t[r]);return e},V=(e,t)=>Sr(e,xr(t));function kr(e,t){var r;if(!t)return e;const o=Object.keys(e).reduce((a,n)=>{if(n==="headings"&&t.headings){const s=t.headings.sizes?Object.keys(e.headings.sizes).reduce((i,l)=>(i[l]=_(_({},e.headings.sizes[l]),t.headings.sizes[l]),i),{}):e.headings.sizes;return V(_({},a),{headings:V(_(_({},e.headings),t.headings),{sizes:s})})}if(n==="breakpoints"&&t.breakpoints){const s=_(_({},e.breakpoints),t.breakpoints);return V(_({},a),{breakpoints:Object.fromEntries(Object.entries(s).sort((i,l)=>W(i[1])-W(l[1])))})}return a[n]=typeof t[n]=="object"?_(_({},e[n]),t[n]):typeof t[n]=="number"||typeof t[n]=="boolean"||typeof t[n]=="function"?t[n]:t[n]||e[n],a},{});if(t!=null&&t.fontFamily&&!((r=t==null?void 0:t.headings)!=null&&r.fontFamily)&&(o.headings.fontFamily=t.fontFamily),!(o.primaryColor in o.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return o}function wr(e,t){return Fe(kr(e,t))}function Pr(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}const Ar={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${E(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function jr(){return A.createElement(B,{styles:Ar})}var Er=Object.defineProperty,he=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Se=(e,t,r)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,O=(e,t)=>{for(var r in t||(t={}))Nr.call(t,r)&&Se(e,r,t[r]);if(he)for(var r of he(t))$r.call(t,r)&&Se(e,r,t[r]);return e};const D=p.createContext({theme:te});function He(){var e;return((e=p.useContext(D))==null?void 0:e.theme)||te}function pn(e){const t=He(),r=o=>{var a,n,s,i;return{styles:((a=t.components[o])==null?void 0:a.styles)||{},classNames:((n=t.components[o])==null?void 0:n.classNames)||{},variants:(s=t.components[o])==null?void 0:s.variants,sizes:(i=t.components[o])==null?void 0:i.sizes}};return Array.isArray(e)?e.map(r):[r(e)]}function mn(){var e;return(e=p.useContext(D))==null?void 0:e.emotionCache}function gn(e,t,r){var o;const a=He(),n=(o=a.components[e])==null?void 0:o.defaultProps,s=typeof n=="function"?n(a):n;return O(O(O({},t),s),Pr(r))}function Tr({theme:e,emotionCache:t,withNormalizeCSS:r=!1,withGlobalStyles:o=!1,withCSSVariables:a=!1,inherit:n=!1,children:s}){const i=p.useContext(D),l=wr(te,n?O(O({},i.theme),e):e);return A.createElement(Xe,{theme:l},A.createElement(D.Provider,{value:{theme:l,emotionCache:t}},r&&A.createElement(jr,null),o&&A.createElement(yr,{theme:l}),a&&A.createElement(vr,{theme:l}),typeof l.globalStyles=="function"&&A.createElement(B,{styles:l.globalStyles(l)}),s))}Tr.displayName="@mantine/core/MantineProvider";export{on as A,Yr as B,Te as C,Gr as D,at as E,Ur as F,Vr as G,Zr as H,L as I,Fr as J,Hr as K,Wr as L,Dr as M,Mr as N,nn as O,G as P,Or as Q,zr as R,Rr as S,Qe as T,sn as U,cn as V,dn as W,Tr as X,M as a,ct as b,an as c,ne as d,un as e,mn as f,He as g,pn as h,Pr as i,W as j,Le as k,gn as l,fn as m,P as n,tn as o,rn as p,Br as q,E as r,Qr as s,en as t,ln as u,qr as v,Lr as w,Xr as x,Jr as y,Kr as z}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-38a3ad93.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-36ea6c56.js similarity index 99% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-38a3ad93.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-36ea6c56.js index c239d883b3..a5edd746f6 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-38a3ad93.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-36ea6c56.js @@ -1,4 +1,4 @@ -import{A as m,fS as Ze,z as y,a4 as Xa,fT as Ya,af as va,aj as d,fU as b,fV as t,fW as Ka,fX as h,fY as ua,fZ as Za,f_ as Ja,aI as Qa,f$ as et,ad as rt,g0 as at}from"./index-190cc92f.js";import{s as fa,n as o,t as tt,o as ha,p as ot,q as ma,v as ga,w as ya,x as it,y as Sa,z as pa,A as xr,B as nt,D as lt,E as st,F as xa,G as $a,H as ka,J as dt,K as _a,L as ct,M as bt,N as vt,O as ut,Q as wa,R as ft,S as ht,T as mt,U as gt,V as yt,W as St,e as pt,X as xt}from"./MantineProvider-26d2feb2.js";var za=String.raw,Ca=za` +import{A as m,fS as Ze,z as y,a4 as Xa,fT as Ya,af as va,aj as d,fU as b,fV as t,fW as Ka,fX as h,fY as ua,fZ as Za,f_ as Ja,aI as Qa,f$ as et,ad as rt,g0 as at}from"./index-91eecded.js";import{s as fa,n as o,t as tt,o as ha,p as ot,q as ma,v as ga,w as ya,x as it,y as Sa,z as pa,A as xr,B as nt,D as lt,E as st,F as xa,G as $a,H as ka,J as dt,K as _a,L as ct,M as bt,N as vt,O as ut,Q as wa,R as ft,S as ht,T as mt,U as gt,V as yt,W as St,e as pt,X as xt}from"./MantineProvider-149dbf3d.js";var za=String.raw,Ca=za` :root, :host { --chakra-vh: 100vh; diff --git a/invokeai/frontend/web/dist/assets/index-190cc92f.js b/invokeai/frontend/web/dist/assets/index-91eecded.js similarity index 86% rename from invokeai/frontend/web/dist/assets/index-190cc92f.js rename to invokeai/frontend/web/dist/assets/index-91eecded.js index 8595942645..17301afc5e 100644 --- a/invokeai/frontend/web/dist/assets/index-190cc92f.js +++ b/invokeai/frontend/web/dist/assets/index-91eecded.js @@ -109,7 +109,7 @@ ${R}`),O.pop(),`{${U}}`}case"number":return isFinite(C)?String(C):v?v(C):"null"; color: inherit; `;Object.keys(d).length>0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message," %O"),m,_,y,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message),m,_,y)}}};D0.createLogWriter=Wse;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=D0;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(iI);Eh.ROARR.write=iI.createLogWriter();const OI={};Eh.Roarr.child(OI);const ev=P0(Eh.Roarr.child(OI)),fe=e=>ev.get().child({namespace:e}),V3e=["trace","debug","info","warn","error","fatal"],z3e={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function Kse(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const Lf=js("nodes/receivedOpenAPISchema",async(e,{dispatch:t,rejectWithValue:n})=>{const r=fe("system");try{const o=await(await fetch("openapi.json")).json();return r.info({openAPISchema:o},"Received OpenAPI schema"),JSON.parse(JSON.stringify(o,Kse()))}catch(i){return n({error:i})}}),RI={nodes:[],edges:[],schema:null,invocationTemplates:{},connectionStartParams:null,shouldShowGraphOverlay:!1,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,editorInstance:void 0,progressNodeSize:{width:512,height:512}},MI=Et({name:"nodes",initialState:RI,reducers:{nodesChanged:(e,t)=>{e.nodes=KM(t.payload,e.nodes)},nodeAdded:(e,t)=>{e.nodes.push(t.payload)},edgesChanged:(e,t)=>{e.edges=oie(t.payload,e.edges)},connectionStarted:(e,t)=>{e.connectionStartParams=t.payload},connectionMade:(e,t)=>{e.edges=SM(t.payload,e.edges)},connectionEnded:e=>{e.connectionStartParams=null},fieldValueChanged:(e,t)=>{const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(s=>s.id===n);o>-1&&(e.nodes[o].data.inputs[r].value=i)},imageCollectionFieldValueChanged:(e,t)=>{const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(a=>a.id===n);if(o===-1)return;const s=Dn(e.nodes[o].data.inputs[r].value);if(!s){e.nodes[o].data.inputs[r].value=i;return}e.nodes[o].data.inputs[r].value=iY(s.concat(i),"image_name")},shouldShowGraphOverlayChanged:(e,t)=>{e.shouldShowGraphOverlay=t.payload},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.invocationTemplates=t.payload},nodeEditorReset:e=>{e.nodes=[],e.edges=[]},setEditorInstance:(e,t)=>{e.editorInstance=t.payload},loadFileNodes:(e,t)=>{e.nodes=t.payload},loadFileEdges:(e,t)=>{e.edges=t.payload},setProgressNodeSize:(e,t)=>{e.progressNodeSize=t.payload}},extraReducers:e=>{e.addCase(Lf.fulfilled,(t,n)=>{t.schema=n.payload})}}),{nodesChanged:U3e,edgesChanged:G3e,nodeAdded:H3e,fieldValueChanged:c2,connectionMade:q3e,connectionStarted:W3e,connectionEnded:K3e,shouldShowGraphOverlayChanged:X3e,shouldShowFieldTypeLegendChanged:Y3e,shouldShowMinimapPanelChanged:Q3e,nodeTemplatesBuilt:fC,nodeEditorReset:II,imageCollectionFieldValueChanged:Z3e,setEditorInstance:J3e,loadFileNodes:e5e,loadFileEdges:t5e,setProgressNodeSize:n5e}=MI.actions,Xse=MI.reducer,NI={esrganModelName:"RealESRGAN_x4plus.pth"},DI=Et({name:"postprocessing",initialState:NI,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:r5e}=DI.actions,Yse=DI.reducer,Qse={positiveStylePrompt:"",negativeStylePrompt:"",shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerAestheticScore:6,refinerStart:.7},LI=Et({name:"sdxl",initialState:Qse,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerAestheticScore:(e,t)=>{e.refinerAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:i5e,setNegativeStylePromptSDXL:o5e,setShouldUseSDXLRefiner:Zse,setSDXLImg2ImgDenoisingStrength:s5e,refinerModelChanged:xE,setRefinerSteps:a5e,setRefinerCFGScale:l5e,setRefinerScheduler:u5e,setRefinerAestheticScore:c5e,setRefinerStart:d5e}=LI.actions,Jse=LI.reducer,Ah=ue("app/userInvoked"),eae={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Gm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||eae,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{s(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(s=>{s.apply(s,[t,...r])})}}function Qc(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function CE(e){return e==null?"":""+e}function tae(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function hC(e,t,n){function r(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const s=r(o.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function TE(e,t,n){const{obj:r,k:i}=hC(e,t,Object);r[i]=n}function nae(e,t,n,r){const{obj:i,k:o}=hC(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function Hm(e,t){const{obj:n,k:r}=hC(e,t);if(n)return n[r]}function rae(e,t,n){const r=Hm(e,n);return r!==void 0?r:Hm(t,n)}function $I(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):$I(e[r],t[r],n):e[r]=t[r]);return e}function Vl(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var iae={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function oae(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>iae[t]):e}const sae=[" ",",","?","!",";"];function aae(e,t,n){t=t||"",n=n||"";const r=sae.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!i.test(e);if(!o){const s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}function qm(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(t.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(o+s).join(n);return u?qm(l,u,n):void 0}i=i[r[o]]}return i}function Wm(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class EE extends tv{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[t,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."));const l=Hm(this.data,a);return l||!s||typeof r!="string"?l:qm(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),TE(this.data,a,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=Hm(this.data,a)||{};i?$I(l,r,o):l={...l,...r},TE(this.data,a,l),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var FI={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const PE={};class Km extends tv{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),tae(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Hi.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!aae(t,r,i);if(s&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:`${l}${b}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:s}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||s,p=d&&d.exactUsedKey||s,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof y=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d):b}if(o){const b=m==="[object Array]",S=b?[]:{},w=b?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const T=`${w}${o}${x}`;S[x]=this.translate(T,{...n,joinArrays:!1,ns:a}),S[x]===T&&(S[x]=f[x])}f=S}}else if(v&&typeof y=="string"&&m==="[object Array]")f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let b=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=Km.hasDefaultValue(n),T=w?this.pluralResolver.getSuffix(u,n.count,n):"",P=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",E=n[`defaultValue${T}`]||n[`defaultValue${P}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(b=!0,f=E),this.isValidLookup(f)||(S=!0,f=s);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,M=x&&E!==f&&this.options.updateMissing;if(S||b||M){if(this.logger.log(M?"updateKey":"missingKey",u,l,s,M?E:f),o){const N=this.resolve(s,{...n,keySeparator:!1});N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let C=[];const O=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&O&&O[0])for(let N=0;N{const L=x&&D!==f?D:$;this.options.missingKeyHandler?this.options.missingKeyHandler(N,l,R,L,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(N,l,R,L,M,n),this.emit("missingKey",N,l,R,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?C.forEach(N=>{this.pluralResolver.getSuffixes(N,n).forEach(R=>{I([N],s+R,n[`defaultValue${R}`]||E)})}):I(C,s,E))}f=this.extendTranslation(f,t,n,d,r),S&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${s}`),(S||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${s}`:s,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,s,a;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(a=_,!PE[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(PE[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(y=>{if(this.isValidLookup(r))return;s=y;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,y,_,n);else{let b;f&&(b=this.pluralResolver.getSuffix(y,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+b),n.ordinal&&b.indexOf(w)===0&&v.push(c+b.replace(w,this.options.pluralSeparator)),h&&v.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;v.push(x),f&&(v.push(x+b),n.ordinal&&b.indexOf(w)===0&&v.push(x+b.replace(w,this.options.pluralSeparator)),h&&v.push(x+S))}}let g;for(;g=v.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(y,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function Bb(e){return e.charAt(0).toUpperCase()+e.slice(1)}class AE{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Hi.create("languageUtils")}getScriptPartFromCode(t){if(t=Wm(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Wm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Bb(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Bb(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Bb(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(s=>{i.indexOf(s)<0&&o(this.formatLanguageCode(s))}),i}}let lae=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],uae={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const cae=["v1","v2","v3"],dae=["v4"],kE={zero:0,one:1,two:2,few:3,many:4,other:5};function fae(){const e={};return lae.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:uae[t.fc]}})}),e}class hae{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Hi.create("pluralResolver"),(!this.options.compatibilityJSON||dae.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=fae()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Wm(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>kE[i]-kE[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!cae.includes(this.options.compatibilityJSON)}}function OE(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=rae(e,t,n);return!o&&i&&typeof n=="string"&&(o=qm(e,n,r),o===void 0&&(o=qm(t,n,r))),o}class pae{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Hi.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:oae,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Vl(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Vl(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Vl(n.nestingPrefix):n.nestingPrefixEscaped||Vl("$t("),this.nestingSuffix=n.nestingSuffix?Vl(n.nestingSuffix):n.nestingSuffixEscaped||Vl(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,s,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=OE(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const m=p.split(this.formatSeparator),_=m.shift().trim(),y=m.join(this.formatSeparator).trim();return this.format(OE(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),y,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(a=0;o=p.regex.exec(t);){const m=o[1].trim();if(s=c(m),s===void 0)if(typeof d=="function"){const y=d(t,o,i);s=typeof y=="string"?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=CE(s));const _=p.safeValue(s);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=s.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,s;function a(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,s);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete s.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=CE(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function gae(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(s=>{if(!s)return;const[a,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function zl(e){const t={};return function(r,i,o){const s=i+JSON.stringify(o);let a=t[s];return a||(a=e(Wm(i),o),t[s]=a),a(r)}}class mae{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Hi.create("formatter"),this.options=t,this.formats={number:zl((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:zl((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:zl((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:zl((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:zl((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=zl(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:c}=gae(l);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function yae(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class vae extends tv{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Hi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},s={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,c=!1,s[f]===void 0&&(s[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],s=i[1];n&&this.emit("failedLoading",o,s,n),r&&this.store.addResourceBundle(o,s,r),this.state[t]=n?-1:2;const a={};this.queue.forEach(l=>{nae(l.loaded,[o],s),yae(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:s});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,s)},o);return}s(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...s,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,i,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function RE(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function ME(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Rp(){}function bae(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class $f extends tv{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=ME(t),this.services={},this.logger=Hi,this.modules={external:[]},bae(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=RE();this.options={...i,...this.options,...ME(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Hi.init(o(this.modules.logger),this.options):Hi.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=mae);const d=new AE(this.options);this.store=new EE(this.options.resources,this.options);const f=this.services;f.logger=Hi,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new hae(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new pae(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new vae(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Rp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Qc(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rp;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],s=a=>{if(!a)return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=Qc();return t||(t=this.languages),n||(n=this.options.ns),r||(r=Rp),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&FI.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=Qc();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{s(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const o=function(s,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${s}`:s,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}loadNamespaces(t,n){const r=Qc();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Qc();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(s=>i.indexOf(s)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new AE(RE());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new $f(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new $f(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new EE(this.store.data,i),o.services.resourceStore=o.store),o.translator=new Km(o.services,i),o.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;ctypeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},BI={isConnected:!1,isProcessing:!1,isGFPGANAvailable:!0,isESRGANAvailable:!0,shouldConfirmOnDelete:!0,currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatusHasSteps:!1,isCancelable:!0,enableImageDebugging:!1,toastQueue:[],progressImage:null,shouldAntialiasProgressImage:!1,sessionId:null,cancelType:"immediate",isCancelScheduled:!1,subscribedNodeIds:[],wereModelsReceived:!1,wasSchemaParsed:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,statusTranslationKey:"common.statusDisconnected",canceledSession:"",isPersisted:!1,language:"en",isUploading:!1,isNodesEnabled:!1,shouldUseNSFWChecker:!1,shouldUseWatermarker:!1},jI=Et({name:"system",initialState:BI,reducers:{setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.statusTranslationKey=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},cancelScheduled:e=>{e.isCancelScheduled=!0},scheduledCancelAborted:e=>{e.isCancelScheduled=!1},cancelTypeChanged:(e,t)=>{e.cancelType=t.payload},subscribedNodeIdsSet:(e,t)=>{e.subscribedNodeIds=t.payload},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},isPersistedChanged:(e,t)=>{e.isPersisted=t.payload},languageChanged:(e,t)=>{e.language=t.payload},progressImageSet(e,t){e.progressImage=t.payload},setIsNodesEnabled(e,t){e.isNodesEnabled=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload}},extraReducers(e){e.addCase(l7,(t,n)=>{t.sessionId=n.payload.sessionId,t.canceledSession=""}),e.addCase(c7,t=>{t.sessionId=null}),e.addCase(o7,t=>{t.isConnected=!0,t.isCancelable=!0,t.isProcessing=!1,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.statusTranslationKey="common.statusConnected"}),e.addCase(a7,t=>{t.isConnected=!1,t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusDisconnected"}),e.addCase(f7,t=>{t.isCancelable=!0,t.isProcessing=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusGenerating"}),e.addCase(v7,(t,n)=>{const{step:r,total_steps:i,progress_image:o}=n.payload.data;t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!0,t.currentStep=r+1,t.totalSteps=i,t.progressImage=o??null,t.statusTranslationKey="common.statusGenerating"}),e.addCase(h7,(t,n)=>{const{data:r}=n.payload;t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusProcessingComplete",t.canceledSession===r.graph_execution_state_id&&(t.isProcessing=!1,t.isCancelable=!0)}),e.addCase(m7,t=>{t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null}),e.addCase(Ah,t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.statusTranslationKey="common.statusPreparing"}),e.addCase(hl.fulfilled,(t,n)=>{t.canceledSession=n.meta.arg.session_id,t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(Ha({title:Od("toast.canceled"),status:"warning"}))}),e.addCase(fC,t=>{t.wasSchemaParsed=!0}),e.addMatcher(NR,(t,n)=>{var r;t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(Ha({title:Od("toast.serverError"),status:"error",description:((r=n.payload)==null?void 0:r.status)===422?"Validation Error":void 0}))}),e.addMatcher(Cae,(t,n)=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusError",t.progressImage=null,t.toastQueue.push(Ha({title:Od("toast.serverError"),status:"error",description:ZX(n.payload.data.error_type)}))})}}),{setIsProcessing:f5e,setShouldConfirmOnDelete:h5e,setCurrentStatus:p5e,setIsCancelable:g5e,setEnableImageDebugging:m5e,addToast:Ft,clearToastQueue:y5e,cancelScheduled:v5e,scheduledCancelAborted:b5e,cancelTypeChanged:_5e,subscribedNodeIdsSet:S5e,consoleLogLevelChanged:w5e,shouldLogToConsoleChanged:x5e,isPersistedChanged:C5e,shouldAntialiasProgressImageChanged:T5e,languageChanged:E5e,progressImageSet:_ae,setIsNodesEnabled:P5e,shouldUseNSFWCheckerChanged:Sae,shouldUseWatermarkerChanged:wae}=jI.actions,xae=jI.reducer,Cae=Jr(Gx,w7,C7),Tae={searchFolder:null,advancedAddScanModel:null},VI=Et({name:"modelmanager",initialState:Tae,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:A5e,setAdvancedAddScanModel:k5e}=VI.actions,Eae=VI.reducer,zI={shift:!1},UI=Et({name:"hotkeys",initialState:zI,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload}}}),{shiftKeyPressed:O5e}=UI.actions,Pae=UI.reducer,Aae=iF($V);GI=d2=void 0;var kae=Aae,Oae=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return kae.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function qI(e,t){if(e){if(typeof e=="string")return NE(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 NE(e,t)}}function NE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,s=r.persistWholeStore,a=r.serialize;try{var l=s?Gae:Hae;yield l(t,n,{prefix:i,driver:o,serialize:a})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function FE(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(u){n(u);return}a.done?t(l):Promise.resolve(l).then(r,i)}function BE(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){FE(o,r,i,s,a,"next",l)}function a(l){FE(o,r,i,s,a,"throw",l)}s(void 0)})}}var Wae=function(){var e=BE(function*(t,n,r){var i=r.prefix,o=r.driver,s=r.serialize,a=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield Bae(t,n,{prefix:i,driver:o,unserialize:a,persistWholeStore:c});var d={},f=function(){var h=BE(function*(){var p=HI(t.getState(),n);yield qae(p,d,{prefix:i,driver:o,serialize:s,persistWholeStore:c}),gC(p,d)||t.dispatch({type:Nae,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(Lae(f,u)):t.subscribe(Dae(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const Kae=Wae;function Ff(e){"@babel/helpers - typeof";return Ff=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},Ff(e)}function jE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zb(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=zb({},r));var o=typeof t=="function"?t:mc(t);switch(i.type){case f2:return n.state=o(zb(zb({},n.state),i.payload||{}),{type:f2}),n.state;default:return o(r,i)}}},Jae=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,s=r.serialize,a=s===void 0?function(_,y){return JSON.stringify(_)}:s,l=r.unserialize,u=l===void 0?function(_,y){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(y){return function(v,g,b){var S=y(v,g,b);return Kae(S,n,{driver:t,prefix:o,serialize:a,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const R5e=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],ele="@@invokeai-",tle=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"],nle=["pendingControlImages"],rle=["selection","selectedBoardId","galleryView"],ile=["schema","invocationTemplates"],ole=[],sle=[],ale=["currentIteration","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","totalIterations","totalSteps","isCancelScheduled","progressImage","wereModelsReceived","wasSchemaParsed","isPersisted","isUploading"],lle=["shouldShowImageDetails"],ule={canvas:tle,gallery:rle,generation:ole,nodes:ile,postprocessing:sle,system:ale,ui:lle,controlNet:nle},cle=(e,t)=>{const n=x0(e,ule[t]);return JSON.stringify(n)},dle={canvas:LR,gallery:R7,generation:qo,nodes:RI,postprocessing:NI,system:BI,config:yR,ui:RR,hotkeys:zI,controlNet:US},fle=(e,t)=>yX(JSON.parse(e),dle[t]),KI=ue("nodes/textToImageGraphBuilt"),XI=ue("nodes/imageToImageGraphBuilt"),YI=ue("nodes/canvasGraphBuilt"),QI=ue("nodes/nodesGraphBuilt"),hle=Jr(KI,XI,YI,QI),ple=e=>{if(hle(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return Lf.fulfilled.match(e)?{...e,payload:""}:fC.match(e)?{...e,payload:""}:e},gle=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","hotkeys/shiftKeyPressed","@@REMEMBER_PERSISTED"],mle=e=>e,yle=()=>{le({actionCreator:VQ,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("canvas"),i=n(),{sessionId:o,isProcessing:s}=i.system,a=e.payload;if(s){if(!a){r.debug("No canvas session, skipping cancel");return}if(a!==o){r.debug({canvasSessionId:a,session_id:o},"Canvas session does not match global session, skipping cancel");return}t(hl({session_id:o}))}}})};ue("app/appStarted");const vle=()=>{le({matcher:he.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==ci({board_id:"none",categories:pi}))return;r(),n();const i=e.payload;i.ids.length>0&&t(Os(i.ids[0]))}})},mC=Gs.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5})})}),{useGetAppVersionQuery:M5e,useGetAppConfigQuery:I5e}=mC,ble=()=>{le({matcher:mC.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r,nsfw_methods:i,watermarking_methods:o}=e.payload,s=t().generation.infillMethod;r.includes(s)||n(_Q(r[0])),i.includes("nsfw_checker")||n(Sae(!1)),o.includes("invisible_watermark")||n(wae(!1))}})},_le=ue("app/appStarted"),Sle=()=>{le({actionCreator:_le,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},yC={memoizeOptions:{resultEqualityCheck:w0}},ZI=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,s=((d=n.initialImage)==null?void 0:d.imageName)===t,a=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.some(f=>Pa(f.data.inputs,h=>{var p;return h.type==="image"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Pa(o.controlNets,f=>f.controlImage===t||f.processedControlImage===t);return{isInitialImage:s,isCanvasImage:a,isNodesImage:l,isControlNetImage:u}},wle=Zn([e=>e],e=>{const{imageToDelete:t}=e.imageDeletion;if(!t)return;const{image_name:n}=t;return ZI(e,n)},yC),xle=()=>{le({matcher:nc.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,s=!1,a=!1;const l=n();r.forEach(u=>{const c=ZI(l,u);c.isInitialImage&&!i&&(t(AR()),i=!0),c.isCanvasImage&&!o&&(t(FR()),o=!0),c.isNodesImage&&!s&&(t(II()),s=!0),c.isControlNetImage&&!a&&(t(P7()),a=!0)})}})},Cle=()=>{le({matcher:Jr(GS,Om),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),s=GS.match(e)?e.payload:o.gallery.selectedBoardId,l=(Om.match(e)?e.payload:o.gallery.galleryView)==="images"?pi:_s,u={board_id:s??"none",categories:l};if(await r(()=>he.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=he.endpoints.listImages.select(u)(t());d!=null&&d.ids.length?n(Os(d.ids[0]??null)):n(Os(null))}else n(Os(null))}})},Tle=ue("canvas/canvasSavedToGallery"),Ele=ue("canvas/canvasCopiedToClipboard"),Ple=ue("canvas/canvasDownloadedAsImage"),Ale=ue("canvas/canvasMerged"),kle=ue("canvas/stagingAreaImageSaved");let JI=null,eN=null;const N5e=e=>{JI=e},rv=()=>JI,D5e=e=>{eN=e},Ole=()=>eN,Rle=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),Ym=async(e,t)=>await Rle(e.toCanvas(t)),vC=async e=>{const t=rv();if(!t)return;const{shouldCropToBoundingBoxOnSave:n,boundingBoxCoordinates:r,boundingBoxDimensions:i}=e.canvas,o=t.clone();o.scale({x:1,y:1});const s=o.getAbsolutePosition(),a=n?{x:r.x+s.x,y:r.y+s.y,width:i.width,height:i.height}:o.getClientRect();return Ym(o,a)},Mle=e=>{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])},Ile=()=>{le({actionCreator:Ele,effect:async(e,{dispatch:t,getState:n})=>{const r=ev.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Copying Canvas",description:"Unable to export base layer",status:"error"}));return}Mle(o),t(Ft({title:"Canvas Copied to Clipboard",status:"success"}))}})},Nle=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Dle=()=>{le({actionCreator:Ple,effect:async(e,{dispatch:t,getState:n})=>{const r=ev.get().child({namespace:"canvasSavedToGalleryListener"}),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Downloading Canvas",description:"Unable to export base layer",status:"error"}));return}Nle(o,"canvas.png"),t(Ft({title:"Canvas Downloaded",status:"success"}))}})},Lle=async()=>{const e=rv();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),Ym(t,t.getClientRect())},$le=()=>{le({actionCreator:Ale,effect:async(e,{dispatch:t})=>{const n=ev.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await Lle();if(!r){n.error("Problem getting base layer blob"),t(Ft({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const i=rv();if(!i){n.error("Problem getting canvas base layer"),t(Ft({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),s=await t(he.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Merged"}}})).unwrap(),{image_name:a}=s;t(zQ({kind:"image",layer:"base",imageName:a,...o}))}})},Fle=()=>{le({actionCreator:Tle,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("canvas"),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Saving Canvas",description:"Unable to export base layer",status:"error"}));return}t(he.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:i.gallery.autoAddBoardId,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Saved to Gallery"}}}))}})},Ble=(e,t,n)=>{if(!(iJ.match(e)||_T.match(e)||qx.match(e)||oJ.match(e)||ST.match(e))||ST.match(e)&&n.controlNet.controlNets[e.payload.controlNetId].shouldAutoConfig===!0)return!1;const{controlImage:i,processorType:o,shouldAutoConfig:s}=t.controlNet.controlNets[e.payload.controlNetId];if(_T.match(e)&&!s)return!1;const a=o!=="none",l=t.system.isProcessing;return a&&!l&&!!i},jle=()=>{le({predicate:Ble,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=fe("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(Hx({controlNetId:o}))}})},pl=ue("system/sessionReadyToInvoke"),tN=e=>(e==null?void 0:e.type)==="image_output",Vle=()=>{le({actionCreator:Hx,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=fe("session"),{controlNetId:o}=e.payload,s=n().controlNet.controlNets[o];if(!s.controlImage){i.error("Unable to process ControlNet image");return}const a={nodes:{[s.processorNode.id]:{...s.processorNode,is_intermediate:!0,image:{image_name:s.controlImage}}}},l=t(kn({graph:a})),[u]=await r(f=>kn.fulfilled.match(f)&&f.meta.requestId===l.requestId),c=u.payload.id;t(pl());const[d]=await r(f=>Ux.match(f)&&f.payload.data.graph_execution_state_id===c);if(tN(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>he.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(rJ({controlNetId:o,processedControlImage:p.image_name}))}}})},zle=()=>{le({matcher:he.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=fe("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},Ule=()=>{le({matcher:he.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=fe("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},L5e=e=>e.gallery,$5e=Zn(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],yC),Gle=Zn([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t??"none",categories:n==="images"?pi:_s,offset:0,limit:WQ,is_intermediate:!1}},yC),nN=ue("imageDeletion/imageDeletionConfirmed"),Hle=()=>{le({actionCreator:nN,effect:async(e,{dispatch:t,getState:n,condition:r})=>{const{imageDTO:i,imageUsage:o}=e.payload;t(N7(!1));const{image_name:s}=i,a=n();if(a.gallery.selection[a.gallery.selection.length-1]===s){const d=Gle(a),{data:f}=he.endpoints.listImages.select(d)(a),h=(f==null?void 0:f.ids)??[],p=h.findIndex(v=>v.toString()===s),m=h.filter(v=>v.toString()!==s),_=bs(p,0,m.length-1),y=m[_];t(Os(y||null))}o.isCanvasImage&&t(FR()),o.isControlNetImage&&t(P7()),o.isInitialImage&&t(AR()),o.isNodesImage&&t(II());const{requestId:u}=t(he.endpoints.deleteImage.initiate(i));await r(d=>he.endpoints.deleteImage.matchFulfilled(d)&&d.meta.requestId===u,3e4)&&t(Gs.util.invalidateTags([{type:"Board",id:i.board_id}]))}})},qle=()=>{le({matcher:he.endpoints.deleteImage.matchPending,effect:()=>{}})},Wle=()=>{le({matcher:he.endpoints.deleteImage.matchFulfilled,effect:e=>{fe("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},Kle=()=>{le({matcher:he.endpoints.deleteImage.matchRejected,effect:e=>{fe("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},rN=ue("dnd/dndDropped"),Xle=()=>{le({actionCreator:rN,effect:async(e,{dispatch:t})=>{const n=fe("images"),{activeData:r,overData:i}=e.payload;if(n.debug({activeData:r,overData:i},"Image or selection dropped"),i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Os(r.payload.imageDTO.image_name));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(E0(r.payload.imageDTO));return}if(i.actionType==="ADD_TO_BATCH"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(HS([r.payload.imageDTO.image_name]));return}if(i.actionType==="ADD_TO_BATCH"&&r.payloadType==="IMAGE_NAMES"){t(HS(r.payload.image_names));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(qx({controlImage:r.payload.imageDTO.image_name,controlNetId:o}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(BR(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(c2({nodeId:s,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="SET_MULTI_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(c2({nodeId:s,fieldName:o,value:[r.payload.imageDTO]}));return}if(i.actionType==="MOVE_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:s}=i.context;if(!s){t(he.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}t(he.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:s}));return}}})},Yle=()=>{le({matcher:he.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=fe("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},Qle=()=>{le({matcher:he.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=fe("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},Zle=()=>{le({actionCreator:pJ,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,s=wle(n());if(!s)return;const a=s.isCanvasImage||s.isInitialImage||s.isControlNetImage||s.isNodesImage;if(o||a){t(N7(!0));return}t(nN({imageDTO:r,imageUsage:s}))}})},ma={title:"Image Uploaded",status:"success"},Jle=()=>{le({matcher:he.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=fe("images"),i=e.payload,o=n(),{autoAddBoardId:s}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:a}=e.meta.arg.originalArgs;if(!(e.payload.is_intermediate&&!a)){if((a==null?void 0:a.type)==="TOAST"){const{toastOptions:l}=a;if(!s)t(Ft({...ma,...l}));else{t(he.endpoints.addImageToBoard.initiate({board_id:s,imageDTO:i}));const{data:u}=nc.endpoints.listAllBoards.select()(o),c=u==null?void 0:u.find(f=>f.board_id===s),d=c?`Added to board ${c.board_name}`:`Added to board ${s}`;t(Ft({...ma,description:d}))}return}if((a==null?void 0:a.type)==="SET_CANVAS_INITIAL_IMAGE"){t(BR(i)),t(Ft({...ma,description:"Set as canvas initial image"}));return}if((a==null?void 0:a.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:l}=a;t(qx({controlNetId:l,controlImage:i.image_name})),t(Ft({...ma,description:"Set as control image"}));return}if((a==null?void 0:a.type)==="SET_INITIAL_IMAGE"){t(E0(i)),t(Ft({...ma,description:"Set as initial image"}));return}if((a==null?void 0:a.type)==="SET_NODES_IMAGE"){const{nodeId:l,fieldName:u}=a;t(c2({nodeId:l,fieldName:u,value:i})),t(Ft({...ma,description:`Set as node field ${u}`}));return}if((a==null?void 0:a.type)==="ADD_TO_BATCH"){t(HS([i.image_name])),t(Ft({...ma,description:"Added to batch"}));return}}}})},eue=()=>{le({matcher:he.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=fe("images"),r={arg:{...x0(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Ft({title:"Image Upload Failed",description:e.error.message,status:"error"}))}})},tue=ue("generation/initialImageSelected"),nue=ue("generation/modelSelected"),rue=()=>{le({actionCreator:tue,effect:(e,{dispatch:t})=>{if(!e.payload){t(Ft(Ha({title:Od("toast.imageNotLoadedDesc"),status:"error"})));return}t(E0(e.payload)),t(Ft(Ha(Od("toast.sentToImageToImage"))))}})},iue=()=>{le({actionCreator:nue,effect:(e,{getState:t,dispatch:n})=>{var l;const r=fe("models"),i=t(),o=Cf.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const s=o.data,{base_model:a}=s;if(((l=i.generation.model)==null?void 0:l.base_model)!==a){let u=0;Za(i.lora.loras,(f,h)=>{f.base_model!==a&&(n(L7(h)),u+=1)});const{vae:c}=i.generation;c&&c.base_model!==a&&(n(kR(null)),u+=1);const{controlNets:d}=i.controlNet;Za(d,(f,h)=>{var p;((p=f.model)==null?void 0:p.base_model)!==a&&(n(E7({controlNetId:h})),u+=1)}),u>0&&n(Ft(Ha({title:`Base model changed, cleared ${u} incompatible submodel${u===1?"":"s"}`,status:"warning"})))}n(Va(s))}})},VE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),UE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),GE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),HE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),qE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),oue=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Ul=e=>{const t=[];return e.forEach(n=>{const r={...Dn(n),id:oue(n)};t.push(r)}),t},wo=Gs.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${hg.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{id:"OnnxModel",type:Le}];return t&&i.push(...t.ids.map(o=>({type:"OnnxModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return zE.setAll(zE.getInitialState(),i)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${hg.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{type:"MainModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"MainModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return VE.setAll(VE.getInitialState(),i)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/main/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,params:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:r}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:(t,n,r)=>{const i=[{type:"LoRAModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"LoRAModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return UE.setAll(UE.getInitialState(),i)}}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:(t,n,r)=>{const i=[{type:"ControlNetModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"ControlNetModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return GE.setAll(GE.getInitialState(),i)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:(t,n,r)=>{const i=[{type:"VaeModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"VaeModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return qE.setAll(qE.getInitialState(),i)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:(t,n,r)=>{const i=[{type:"TextualInversionModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"TextualInversionModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return HE.setAll(HE.getInitialState(),i)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${hg.stringify(t,{})}`}),providesTags:(t,n,r)=>{const i=[{type:"ScannedModels",id:Le}];return t&&i.push(...t.map(o=>({type:"ScannedModels",id:o}))),i}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:F5e,useGetOnnxModelsQuery:B5e,useGetControlNetModelsQuery:j5e,useGetLoRAModelsQuery:V5e,useGetTextualInversionModelsQuery:z5e,useGetVaeModelsQuery:U5e,useUpdateMainModelsMutation:G5e,useDeleteMainModelsMutation:H5e,useImportMainModelsMutation:q5e,useAddMainModelsMutation:W5e,useConvertMainModelsMutation:K5e,useMergeMainModelsMutation:X5e,useSyncModelsMutation:Y5e,useGetModelsInFolderQuery:Q5e,useGetCheckpointConfigsQuery:Z5e}=wo,sue=()=>{le({predicate:(e,t)=>wo.endpoints.getMainModels.matchFulfilled(t)&&!t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model;if(Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Va(null));return}const l=Cf.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse main model");return}n(Va(l.data))}}),le({predicate:(e,t)=>wo.endpoints.getMainModels.matchFulfilled(t)&&t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel;if(Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(xE(null)),n(Zse(!1));return}const l=Cf.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse SDXL Refiner Model");return}n(xE(l.data))}}),le({matcher:wo.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Va(null));return}const l=yQ.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse VAE model");return}n(kR(l.data))}}),le({matcher:wo.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{fe("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Za(i,(o,s)=>{Pa(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(L7(s))})}}),le({matcher:wo.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{fe("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Za(i,(o,s)=>{Pa(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(E7({controlNetId:s}))})}}),le({matcher:wo.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{fe("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},ia=e=>JSON.parse(JSON.stringify(e)),p2=e=>!("$ref"in e),aue=e=>!("$ref"in e),J5e=500,lue={integer:"integer",float:"float",number:"float",string:"string",boolean:"boolean",enum:"enum",ImageField:"image",image_collection:"image_collection",LatentsField:"latents",ConditioningField:"conditioning",UNetField:"unet",ClipField:"clip",VaeField:"vae",model:"model",refiner_model:"refiner_model",vae_model:"vae_model",lora_model:"lora_model",controlnet_model:"controlnet_model",ControlNetModelField:"controlnet_model",array:"array",item:"item",ColorField:"color",ControlField:"control",control:"control",cfg_scale:"float",control_weight:"float"},uue=500,Dt=e=>`var(--invokeai-colors-${e}-${uue})`,e4e={integer:{color:"red",colorCssVar:Dt("red"),title:"Integer",description:"Integers are whole numbers, without a decimal point."},float:{color:"orange",colorCssVar:Dt("orange"),title:"Float",description:"Floats are numbers with a decimal point."},string:{color:"yellow",colorCssVar:Dt("yellow"),title:"String",description:"Strings are text."},boolean:{color:"green",colorCssVar:Dt("green"),title:"Boolean",description:"Booleans are true or false."},enum:{color:"blue",colorCssVar:Dt("blue"),title:"Enum",description:"Enums are values that may be one of a number of options."},image:{color:"purple",colorCssVar:Dt("purple"),title:"Image",description:"Images may be passed between nodes."},image_collection:{color:"purple",colorCssVar:Dt("purple"),title:"Image Collection",description:"A collection of images."},latents:{color:"pink",colorCssVar:Dt("pink"),title:"Latents",description:"Latents may be passed between nodes."},conditioning:{color:"cyan",colorCssVar:Dt("cyan"),title:"Conditioning",description:"Conditioning may be passed between nodes."},unet:{color:"red",colorCssVar:Dt("red"),title:"UNet",description:"UNet submodel."},clip:{color:"green",colorCssVar:Dt("green"),title:"Clip",description:"Tokenizer and text_encoder submodels."},vae:{color:"blue",colorCssVar:Dt("blue"),title:"Vae",description:"Vae submodel."},control:{color:"cyan",colorCssVar:Dt("cyan"),title:"Control",description:"Control info passed between nodes."},model:{color:"teal",colorCssVar:Dt("teal"),title:"Model",description:"Models are models."},refiner_model:{color:"teal",colorCssVar:Dt("teal"),title:"Refiner Model",description:"Models are models."},vae_model:{color:"teal",colorCssVar:Dt("teal"),title:"VAE",description:"Models are models."},lora_model:{color:"teal",colorCssVar:Dt("teal"),title:"LoRA",description:"Models are models."},controlnet_model:{color:"teal",colorCssVar:Dt("teal"),title:"ControlNet",description:"Models are models."},array:{color:"gray",colorCssVar:Dt("gray"),title:"Array",description:"TODO: Array type description."},item:{color:"gray",colorCssVar:Dt("gray"),title:"Collection Item",description:"TODO: Collection Item type description."},color:{color:"gray",colorCssVar:Dt("gray"),title:"Color",description:"A RGBA color."}},t4e=250,Ub=e=>e.$ref.split("/").slice(-1)[0],cue=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},due=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},fue=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",inputRequirement:"always",inputKind:"any",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},hue=({schemaObject:e,baseField:t})=>({...t,type:"boolean",inputRequirement:"always",inputKind:"any",default:e.default??!1}),pue=({schemaObject:e,baseField:t})=>({...t,type:"model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),gue=({schemaObject:e,baseField:t})=>({...t,type:"refiner_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),mue=({schemaObject:e,baseField:t})=>({...t,type:"vae_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),yue=({schemaObject:e,baseField:t})=>({...t,type:"lora_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),vue=({schemaObject:e,baseField:t})=>({...t,type:"controlnet_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),bue=({schemaObject:e,baseField:t})=>({...t,type:"image",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),_ue=({schemaObject:e,baseField:t})=>({...t,type:"image_collection",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),Sue=({schemaObject:e,baseField:t})=>({...t,type:"latents",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),wue=({schemaObject:e,baseField:t})=>({...t,type:"conditioning",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),xue=({schemaObject:e,baseField:t})=>({...t,type:"unet",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Cue=({schemaObject:e,baseField:t})=>({...t,type:"clip",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Tue=({schemaObject:e,baseField:t})=>({...t,type:"vae",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Eue=({schemaObject:e,baseField:t})=>({...t,type:"control",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Pue=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",enumType:e.type??"string",options:n,inputRequirement:"always",inputKind:"direct",default:e.default??n[0]}},WE=({baseField:e})=>({...e,type:"array",inputRequirement:"always",inputKind:"direct",default:[]}),KE=({baseField:e})=>({...e,type:"item",inputRequirement:"always",inputKind:"direct",default:void 0}),Aue=({schemaObject:e,baseField:t})=>({...t,type:"color",inputRequirement:"always",inputKind:"direct",default:e.default??{r:127,g:127,b:127,a:255}}),iN=(e,t,n)=>{let r="";n&&t in n?r=n[t]:e.type?e.enum?r="enum":e.type&&(r=e.type):e.allOf?r=Ub(e.allOf[0]):e.anyOf?r=Ub(e.anyOf[0]):e.oneOf&&(r=Ub(e.oneOf[0]));const i=lue[r];if(!i)throw`Field type "${r}" is unknown!`;return i},kue=(e,t,n)=>{const r=iN(e,t,n),i={name:t,title:e.title??"",description:e.description??""};if(["image"].includes(r))return bue({schemaObject:e,baseField:i});if(["image_collection"].includes(r))return _ue({schemaObject:e,baseField:i});if(["latents"].includes(r))return Sue({schemaObject:e,baseField:i});if(["conditioning"].includes(r))return wue({schemaObject:e,baseField:i});if(["unet"].includes(r))return xue({schemaObject:e,baseField:i});if(["clip"].includes(r))return Cue({schemaObject:e,baseField:i});if(["vae"].includes(r))return Tue({schemaObject:e,baseField:i});if(["control"].includes(r))return Eue({schemaObject:e,baseField:i});if(["model"].includes(r))return pue({schemaObject:e,baseField:i});if(["refiner_model"].includes(r))return gue({schemaObject:e,baseField:i});if(["vae_model"].includes(r))return mue({schemaObject:e,baseField:i});if(["lora_model"].includes(r))return yue({schemaObject:e,baseField:i});if(["controlnet_model"].includes(r))return vue({schemaObject:e,baseField:i});if(["enum"].includes(r))return Pue({schemaObject:e,baseField:i});if(["integer"].includes(r))return cue({schemaObject:e,baseField:i});if(["number","float"].includes(r))return due({schemaObject:e,baseField:i});if(["string"].includes(r))return fue({schemaObject:e,baseField:i});if(["boolean"].includes(r))return hue({schemaObject:e,baseField:i});if(["array"].includes(r))return WE({schemaObject:e,baseField:i});if(["item"].includes(r))return KE({schemaObject:e,baseField:i});if(["color"].includes(r))return Aue({schemaObject:e,baseField:i});if(["array"].includes(r))return WE({schemaObject:e,baseField:i});if(["item"].includes(r))return KE({schemaObject:e,baseField:i})},Oue=(e,t,n)=>{const r=e.$ref.split("/").slice(-1)[0],i=t.components.schemas[r];return p2(i)?$x(i.properties,(s,a,l)=>{if(!["type","id"].includes(l)&&!["object"].includes(a.type)&&p2(a)){const u=iN(a,l,n);s[l]={name:l,title:a.title??"",description:a.description??"",type:u}}return s},{}):{}},Rue=e=>e==="l2i"?["id","type","metadata"]:["id","type","is_intermediate","metadata"],Mue=["Graph","InvocationMeta","MetadataAccumulatorInvocation"],Iue=e=>{var r;return aR((r=e.components)==null?void 0:r.schemas,(i,o)=>o.includes("Invocation")&&!o.includes("InvocationOutput")&&!Mue.some(s=>o.includes(s))).reduce((i,o)=>{var s,a,l,u,c;if(aue(o)){const d=o.properties.type.default,f=Rue(d),h=((s=o.ui)==null?void 0:s.title)??o.title.replace("Invocation",""),p=(a=o.ui)==null?void 0:a.type_hints,m={};if(d==="collect"){const g=o.properties.item;m.item={type:"item",name:"item",description:g.description??"",title:"Collection Item",inputKind:"connection",inputRequirement:"always",default:void 0}}else if(d==="iterate"){const g=o.properties.collection;m.collection={type:"array",name:"collection",title:g.title??"",default:[],description:g.description??"",inputRequirement:"always",inputKind:"connection"}}else $x(o.properties,(g,b,S)=>{if(!f.includes(S)&&p2(b)){const w=kue(b,S,p);w&&(g[S]=w)}return g},m);const _=o.output;let y;if(d==="iterate"){const g=(u=(l=e.components)==null?void 0:l.schemas)==null?void 0:u.IterateInvocationOutput;y={item:{name:"item",title:(g==null?void 0:g.title)??"",description:(g==null?void 0:g.description)??"",type:"array"}}}else y=Oue(_,e,p);const v={title:h,type:d,tags:((c=o.ui)==null?void 0:c.tags)??[],description:o.description??"",inputs:m,outputs:y};Object.assign(i,{[d]:v})}return i},{})},Nue=()=>{le({actionCreator:Lf.fulfilled,effect:(e,{dispatch:t})=>{const n=fe("system"),r=e.payload;n.debug({schemaJSON:r},"Dereferenced OpenAPI schema");const i=Iue(r);n.debug({nodeTemplates:ia(i)},`Built ${gR(i)} node templates`),t(fC(i))}}),le({actionCreator:Lf.rejected,effect:()=>{fe("system").error("Problem dereferencing OpenAPI Schema")}})},Due=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),Lue=new Map(Due),$ue=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],g2=Symbol(".toJSON was called"),Fue=e=>{e[g2]=!0;const t=e.toJSON();return delete e[g2],t},Bue=e=>Lue.get(e)??Error,oN=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a})=>{if(!n)if(Array.isArray(e))n=[];else if(!a&&XE(e)){const u=Bue(e.name);n=new u}else n={};if(t.push(e),o>=i)return n;if(s&&typeof e.toJSON=="function"&&e[g2]!==!0)return Fue(e);const l=u=>oN({from:u,seen:[...t],forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a});for(const[u,c]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(c)){n[u]="[object Buffer]";continue}if(c!==null&&typeof c=="object"&&typeof c.pipe=="function"){n[u]="[object Stream]";continue}if(typeof c!="function"){if(!c||typeof c!="object"){n[u]=c;continue}if(!t.includes(e[u])){o++,n[u]=l(e[u]);continue}n[u]="[Circular]"}}for(const{property:u,enumerable:c}of $ue)typeof e[u]<"u"&&e[u]!==null&&Object.defineProperty(n,u,{value:XE(e[u])?l(e[u]):e[u],enumerable:r?!0:c,configurable:!0,writable:!0});return n};function bC(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?oN({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function XE(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const jue=()=>{le({actionCreator:hl.pending,effect:()=>{}})},Vue=()=>{le({actionCreator:hl.fulfilled,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session canceled (${n})`)}})},zue=()=>{le({actionCreator:hl.rejected,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:bC(r)},"Problem canceling session")}}})},Uue=()=>{le({actionCreator:kn.pending,effect:()=>{}})},Gue=()=>{le({actionCreator:kn.fulfilled,effect:e=>{const t=fe("session"),n=e.payload;t.debug({session:ia(n)},`Session created (${n.id})`)}})},Hue=()=>{le({actionCreator:kn.rejected,effect:e=>{const t=fe("session");if(e.payload){const{error:n,status:r}=e.payload,i=ia(e.meta.arg);t.error({graph:i,status:r,error:bC(n)},"Problem creating session")}}})},que=()=>{le({actionCreator:vh.pending,effect:()=>{}})},Wue=()=>{le({actionCreator:vh.fulfilled,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session invoked (${n})`)}})},Kue=()=>{le({actionCreator:vh.rejected,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:bC(r)},"Problem invoking session")}}})},Xue=()=>{le({actionCreator:pl,effect:(e,{getState:t,dispatch:n})=>{const r=fe("session"),{sessionId:i}=t().system;i&&(r.debug({session_id:i},`Session ready to invoke (${i})})`),n(vh({session_id:i})))}})},Yue=()=>{le({actionCreator:i7,effect:(e,{dispatch:t,getState:n})=>{fe("socketio").debug("Connected");const{nodes:i,config:o}=n(),{disabledTabs:s}=o;!i.schema&&!s.includes("nodes")&&t(Lf()),t(o7(e.payload)),t(wo.util.invalidateTags([{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le},{type:"LoRAModel",id:Le},{type:"ControlNetModel",id:Le},{type:"VaeModel",id:Le},{type:"TextualInversionModel",id:Le},{type:"ScannedModels",id:Le}])),t(mC.util.invalidateTags(["AppConfig","AppVersion"]))}})},Que=()=>{le({actionCreator:s7,effect:(e,{dispatch:t})=>{fe("socketio").debug("Disconnected"),t(a7(e.payload))}})},Zue=()=>{le({actionCreator:y7,effect:(e,{dispatch:t,getState:n})=>{const r=fe("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored generator progress for canceled session");return}r.trace(e.payload,`Generator progress (${e.payload.data.node.type})`),t(v7(e.payload))}})},Jue=()=>{le({actionCreator:g7,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Session complete"),t(m7(e.payload))}})},ece=["dataURL_image"],tce=()=>{le({actionCreator:Ux,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("socketio"),{data:i}=e.payload;r.debug({data:ia(i)},`Invocation complete (${e.payload.data.node.type})`);const o=e.payload.data.graph_execution_state_id,{cancelType:s,isCancelScheduled:a}=n().system;s==="scheduled"&&a&&t(hl({session_id:o}));const{result:l,node:u,graph_execution_state_id:c}=i;if(tN(l)&&!ece.includes(u.type)){const{image_name:d}=l.image,{canvas:f,gallery:h}=n(),p=await t(he.endpoints.getImageDTO.initiate(d)).unwrap();if(c===f.layerState.stagingArea.sessionId&&t(jQ(p)),!p.is_intermediate){const{autoAddBoardId:m}=h;t(m?he.endpoints.addImageToBoard.initiate({board_id:m,imageDTO:p}):he.util.updateQueryData("listImages",{board_id:"none",categories:pi},v=>{const g=v.total,S=Wn.addOne(v,p).total-g;v.total=v.total+S})),t(he.util.invalidateTags([{type:"BoardImagesTotal",id:m??"none"},{type:"BoardAssetsTotal",id:m??"none"}]));const{selectedBoardId:_,shouldAutoSwitch:y}=h;y&&(m&&m!==_?(t(GS(m)),t(Om("images"))):m||t(Om("images")),t(Os(p.image_name)))}t(_ae(null))}t(h7(e.payload))}})},nce=()=>{le({actionCreator:p7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(Gx(e.payload))}})},rce=()=>{le({actionCreator:x7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(C7(e.payload))}})},ice=()=>{le({actionCreator:d7,effect:(e,{dispatch:t,getState:n})=>{const r=fe("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored invocation started for canceled session");return}r.debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(f7(e.payload))}})},oce=()=>{le({actionCreator:b7,effect:(e,{dispatch:t})=>{const n=fe("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load started: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(tJ(e.payload))}}),le({actionCreator:_7,effect:(e,{dispatch:t})=>{const n=fe("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load complete: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(nJ(e.payload))}})},sce=()=>{le({actionCreator:S7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(w7(e.payload))}})},ace=()=>{le({actionCreator:zx,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Subscribed"),t(l7(e.payload))}})},lce=()=>{le({actionCreator:u7,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Unsubscribed"),t(c7(e.payload))}})},uce=()=>{le({actionCreator:kle,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(he.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&await t(he.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Ft({title:"Image Saved",status:"success"}))}catch(i){t(Ft({title:"Image Saving Failed",description:i==null?void 0:i.message,status:"error"}))}}})},n4e=["sd-1","sd-2","sdxl","sdxl-refiner"],cce=["sd-1","sd-2","sdxl"],r4e=["sdxl-refiner"],dce=()=>{le({actionCreator:IR,effect:(e,{getState:t,dispatch:n})=>{if(e.payload==="unifiedCanvas"){const{data:i}=wo.endpoints.getMainModels.select(cce)(t());if(!i){n(Va(null));return}const o=[];Za(i.entities,u=>{u&&["sd-1","sd-2"].includes(u.base_model)&&o.push(u)});const s=o[0];if(!s){n(Va(null));return}const{base_model:a,model_name:l}=s;n(Va({base_model:a,model_name:l}))}}})},Be="positive_conditioning",qe="negative_conditioning",cn="text_to_latents",nt="latents_to_image",pu="nsfw_checker",Zc="invisible_watermark",$e="noise",$i="rand_int",xo="range_of_size",ar="iterate",qs="main_model_loader",gl="onnx_model_loader",Jc="vae_loader",fce="lora_loader",rt="clip_skip",vt="image_to_latents",Wt="latents_to_latents",Yn="resize_image",Mi="inpaint",Mp="control_net_collect",Gb="dynamic_prompt",lt="metadata_accumulator",YE="esrgan",Jt="sdxl_model_loader",rs="t2l_sdxl",Ii="l2l_sdxl",Gl="sdxl_refiner_model_loader",Ip="sdxl_refiner_positive_conditioning",Np="sdxl_refiner_negative_conditioning",ya="l2l_sdxl_refiner",_C="text_to_image_graph",hce="sdxl_text_to_image_graph",pce="sxdl_image_to_image_graph",Qm="image_to_image_graph",sN="inpaint_graph",gce=({image_name:e,esrganModelName:t})=>{const n={id:YE,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!1};return{id:"adhoc-esrgan-graph",nodes:{[YE]:n},edges:[]}},mce=ue("upscale/upscaleRequested"),yce=()=>{le({actionCreator:mce,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{image_name:i}=e.payload,{esrganModelName:o}=n().postprocessing,s=gce({image_name:i,esrganModelName:o});t(kn({graph:s})),await r(kn.fulfilled.match),t(pl())}})},vce=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},QE=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)});var SC={exports:{}},iv={},aN={},Pe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ee<"u"?Ee:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Pe);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Pe;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var S=this.m;return{x:S[0]*b.x+S[2]*b.y+S[4],y:S[1]*b.x+S[3]*b.y+S[5]}}translate(b,S){return this.m[4]+=this.m[0]*b+this.m[2]*S,this.m[5]+=this.m[1]*b+this.m[3]*S,this}scale(b,S){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=S,this.m[3]*=S,this}rotate(b){var S=Math.cos(b),w=Math.sin(b),x=this.m[0]*S+this.m[2]*w,T=this.m[1]*S+this.m[3]*w,P=this.m[0]*-w+this.m[2]*S,E=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=T,this.m[2]=P,this.m[3]=E,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,T=this.m[2]+this.m[0]*b,P=this.m[3]+this.m[1]*b;return this.m[0]=w,this.m[1]=x,this.m[2]=T,this.m[3]=P,this}multiply(b){var S=this.m[0]*b.m[0]+this.m[2]*b.m[1],w=this.m[1]*b.m[0]+this.m[3]*b.m[1],x=this.m[0]*b.m[2]+this.m[2]*b.m[3],T=this.m[1]*b.m[2]+this.m[3]*b.m[3],P=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],E=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=T,this.m[4]=P,this.m[5]=E,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*b,w=-this.m[1]*b,x=-this.m[2]*b,T=this.m[0]*b,P=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),E=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=T,this.m[4]=P,this.m[5]=E,this}getMatrix(){return this.m}decompose(){var b=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],T=this.m[4],P=this.m[5],E=b*x-S*w;let A={x:T,y:P,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||S!=0){var $=Math.sqrt(b*b+S*S);A.rotation=S>0?Math.acos(b/$):-Math.acos(b/$),A.scaleX=$,A.scaleY=E/$,A.skewX=(b*w+S*x)/E,A.skewY=0}else if(w!=0||x!=0){var M=Math.sqrt(w*w+x*x);A.rotation=Math.PI/2-(x>0?Math.acos(-w/M):-Math.acos(w/M)),A.scaleX=E/M,A.scaleY=M,A.skewX=0,A.skewY=(b*w+S*x)/E}return A.rotation=e.Util._getRotation(A.rotation),A}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,y=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===s},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var b=g[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){y.push(g),y.length===1&&v(function(){const b=y;y=[],b.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,b){var S=e.Util.createImageElement();S.onload=function(){b(S)},S.src=g},_rgbToHex(g,b,S){return((1<<24)+(g<<16)+(b<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var b=parseInt(g,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var b;return g in m?(b=m[g],{r:b[0],g:b[1],b:b[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(b=_.exec(g.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var b=m[g.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var b=g.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var b=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[b,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,T=Number(S[2])/100;let P,E,A;if(x===0)return A=T*255,{r:Math.round(A),g:Math.round(A),b:Math.round(A),a:1};T<.5?P=T*(1+x):P=T+x-T*x;const $=2*T-P,M=[0,0,0];for(let C=0;C<3;C++)E=w+1/3*-(C-1),E<0&&E++,E>1&&E--,6*E<1?A=$+(P-$)*6*E:2*E<1?A=P:3*E<2?A=$+(P-$)*(2/3-E)*6:A=$,M[C]=A*255;return{r:Math.round(M[0]),g:Math.round(M[1]),b:Math.round(M[2]),a:1}}},haveIntersection(g,b){return!(b.x>g.x+g.width||b.x+b.widthg.y+g.height||b.y+b.height1?(P=S,E=w,A=(S-x)*(S-x)+(w-T)*(w-T)):(P=g+M*(S-g),E=b+M*(w-b),A=(P-x)*(P-x)+(E-T)*(E-T))}return[P,E,A]},_getProjectionToLine(g,b,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return b.forEach(function(T,P){if(!(!S&&P===b.length-1)){var E=b[(P+1)%b.length],A=e.Util._getProjectionToSegment(T.x,T.y,E.x,E.y,g.x,g.y),$=A[0],M=A[1],C=A[2];Cb.length){var P=b;b=g,g=P}for(w=0;w{b.width=0,b.height=0})},drawRoundedRectPath(g,b,S,w){let x=0,T=0,P=0,E=0;typeof w=="number"?x=T=P=E=Math.min(w,b/2,S/2):(x=Math.min(w[0]||0,b/2,S/2),T=Math.min(w[1]||0,b/2,S/2),E=Math.min(w[2]||0,b/2,S/2),P=Math.min(w[3]||0,b/2,S/2)),g.moveTo(x,0),g.lineTo(b-T,0),g.arc(b-T,T,T,Math.PI*3/2,0,!1),g.lineTo(b,S-E),g.arc(b-E,S-E,E,0,Math.PI/2,!1),g.lineTo(P,S),g.arc(P,S-P,P,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(Ot);var St={},Te={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.getComponentValidator=de.getBooleanValidator=de.getNumberArrayValidator=de.getFunctionValidator=de.getStringOrGradientValidator=de.getStringValidator=de.getNumberOrAutoValidator=de.getNumberOrArrayOfNumbersValidator=de.getNumberValidator=de.alphaComponent=de.RGBComponent=void 0;const Wo=Pe,It=Ot;function Ko(e){return It.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||It.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function bce(e){return e>255?255:e<0?0:Math.round(e)}de.RGBComponent=bce;function _ce(e){return e>1?1:e<1e-4?1e-4:e}de.alphaComponent=_ce;function Sce(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isNumber(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}de.getNumberValidator=Sce;function wce(e){if(Wo.Konva.isUnminified)return function(t,n){let r=It.Util._isNumber(t),i=It.Util._isArray(t)&&t.length==e;return!r&&!i&&It.Util.warn(Ko(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}de.getNumberOrArrayOfNumbersValidator=wce;function xce(){if(Wo.Konva.isUnminified)return function(e,t){var n=It.Util._isNumber(e),r=e==="auto";return n||r||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}de.getNumberOrAutoValidator=xce;function Cce(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isString(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}de.getStringValidator=Cce;function Tce(){if(Wo.Konva.isUnminified)return function(e,t){const n=It.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}de.getStringOrGradientValidator=Tce;function Ece(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isFunction(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}de.getFunctionValidator=Ece;function Pce(){if(Wo.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(It.Util._isArray(e)?e.forEach(function(r){It.Util._isNumber(r)||It.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}de.getNumberArrayValidator=Pce;function Ace(){if(Wo.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}de.getBooleanValidator=Ace;function kce(e){if(Wo.Konva.isUnminified)return function(t,n){return t==null||It.Util.isObject(t)||It.Util.warn(Ko(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}de.getComponentValidator=kce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=Ot,n=de;var r="get",i="set";e.Factory={addGetterSetter(o,s,a,l,u){e.Factory.addGetter(o,s,a),e.Factory.addSetter(o,s,l,u),e.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){var l=r+t.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]||e.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]=function(c){return a&&c!==void 0&&c!==null&&(c=a.call(this,c,s)),this._setAttr(s,c),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){var c=a.length,d=t.Util._capitalize,f=r+d(s),h=i+d(s),p,m;o.prototype[f]=function(){var y={};for(p=0;p{this._setAttr(s+d(b),void 0)}),this._fireChangeEvent(s,v,y),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){var a=t.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){t.Util.error("Adding deprecated "+s);var u=r+t.Util._capitalize(s),c=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[s];return d===void 0?a:d},e.Factory.addSetter(o,s,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){t.Util.each(s,function(a,l){var u=o.prototype[l],c=r+t.Util._capitalize(a),d=i+t.Util._capitalize(a);function f(){u.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(Te);var _i={},Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.HitContext=Oo.SceneContext=Oo.Context=void 0;const lN=Ot,Oce=Pe;function Rce(e){var t=[],n=e.length,r=lN.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=Mce+u.join(ZE)+Ice)):(o+=a.property,t||(o+=Fce+a.val)),o+=Lce;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=jce&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,s){this._context.arc(t,n,r,i,o,s)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,s){this._context.bezierCurveTo(t,n,r,i,o,s)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,s){return this._context.createRadialGradient(t,n,r,i,o,s)}drawImage(t,n,r,i,o,s,a,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,s,a,l,u)}ellipse(t,n,r,i,o,s,a,l){this._context.ellipse(t,n,r,i,o,s,a,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,s){this._context.setTransform(t,n,r,i,o,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,s){this._context.transform(t,n,r,i,o,s)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=JE.length,r=this.setAttr,i,o,s=function(a){var l=t[a],u;t[a]=function(){return o=Rce(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=a.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(av);Object.defineProperty(St,"__esModule",{value:!0});St.Node=void 0;const ke=Ot,kh=Te,Lp=_i,va=Pe,Fr=av,Vt=de;var Sg="absoluteOpacity",$p="allEventListeners",vo="absoluteTransform",e6="absoluteScale",ba="canvas",Kce="Change",Xce="children",Yce="konva",m2="listening",t6="mouseenter",n6="mouseleave",r6="set",i6="Shape",wg=" ",o6="stage",os="transform",Qce="Stage",y2="visible",Zce=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(wg);let Jce=1,_e=class v2{constructor(t){this._id=Jce++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===os||t===vo)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===os||t===vo,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(wg);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(ba)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===vo&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ba)){const{scene:t,filter:n,hit:r}=this._cache.get(ba);ke.Util.releaseCanvas(t,n,r),this._cache.delete(ba)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){ke.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,a-=u,l-=u;var f=new Lp.SceneCanvas({pixelRatio:s,width:i,height:o}),h=new Lp.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),p=new Lp.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(ba),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-a,-l),_.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Sg),this._clearSelfAndDescendantCache(e6),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(ba,{scene:f,filter:h,hit:p,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(ba)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,s,a,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==Xce&&(r=r6+ke.Util._capitalize(n),ke.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(m2,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(y2,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;Fr.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var o=!n&&!va.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,s,a;function l(u){for(i=[],o=u.length,s=0;s0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==Qce&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(os),this._clearSelfAndDescendantCache(vo)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new ke.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(os);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(os),this._clearSelfAndDescendantCache(vo),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,s=0;s0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return ke.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return ke.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&ke.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Sg,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,s,a;t.attrs={};for(r in n)i=n[r],a=ke.Util.isObject(i)&&!ke.Util._isPlainObject(i)&&!ke.Util._isArray(i),!a&&(o=typeof this[r]=="function"&&this[r],delete n[r],s=o?o.call(this):null,n[r]=i,s!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),ke.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,ke.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():va.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,s,a;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;Fr.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=Fr.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Fr.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return ke.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return ke.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=v2.prototype.getClassName.call(t),i=t.children,o,s,a;n&&(t.attrs.container=n),va.Konva[r]||(ke.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=va.Konva[r];if(o=new l(t.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Hb.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=Hb.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(a){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;if(a){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=s&&a||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,s,a)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,s,a,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,s=_.y,a=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),s=Math.min(s,_.y),a=Math.max(a,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hY.indexOf("pointer")>=0?"pointer":Y.indexOf("touch")>=0?"touch":"mouse",U=Y=>{const B=j(Y);if(B==="pointer")return i.Konva.pointerEventsEnabled&&L.pointer;if(B==="touch")return L.touch;if(B==="mouse")return L.mouse};function G(Y={}){return(Y.clipFunc||Y.clipWidth||Y.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Y}const W="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class X extends r.Container{constructor(B){super(G(B)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(B){const H=B.getType()==="Layer",Q=B.getType()==="FastLayer";H||Q||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const B=this.visible()?"":"none";this.content.style.display=B}setContainer(B){if(typeof B===c){if(B.charAt(0)==="."){var H=B.slice(1);B=document.getElementsByClassName(H)[0]}else{var Q;B.charAt(0)!=="#"?Q=B:Q=B.slice(1),B=document.getElementById(Q)}if(!B)throw"Can not find container in document with id "+Q}return this._setAttr("container",B),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),B.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var B=this.children,H=B.length,Q;for(Q=0;Q-1&&e.stages.splice(H,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const B=this._pointerPositions[0]||this._changedPointerPositions[0];return B?{x:B.x,y:B.y}:(t.Util.warn(W),null)}_getPointerById(B){return this._pointerPositions.find(H=>H.id===B)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(B){B=B||{},B.x=B.x||0,B.y=B.y||0,B.width=B.width||this.width(),B.height=B.height||this.height();var H=new o.SceneCanvas({width:B.width,height:B.height,pixelRatio:B.pixelRatio||1}),Q=H.getContext()._context,J=this.children;return(B.x||B.y)&&Q.translate(-1*B.x,-1*B.y),J.forEach(function(ne){if(ne.isVisible()){var te=ne._toKonvaCanvas(B);Q.drawImage(te._canvas,B.x,B.y,te.getWidth()/te.getPixelRatio(),te.getHeight()/te.getPixelRatio())}}),H}getIntersection(B){if(!B)return null;var H=this.children,Q=H.length,J=Q-1,ne;for(ne=J;ne>=0;ne--){const te=H[ne].getIntersection(B);if(te)return te}return null}_resizeDOM(){var B=this.width(),H=this.height();this.content&&(this.content.style.width=B+d,this.content.style.height=H+d),this.bufferCanvas.setSize(B,H),this.bufferHitCanvas.setSize(B,H),this.children.forEach(Q=>{Q.setSize({width:B,height:H}),Q.draw()})}add(B,...H){if(arguments.length>1){for(var Q=0;QR&&t.Util.warn("The stage has "+J+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),B.setSize({width:this.width(),height:this.height()}),B.draw(),i.Konva.isBrowser&&this.content.appendChild(B.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(B){return l.hasPointerCapture(B,this)}setPointerCapture(B){l.setPointerCapture(B,this)}releaseCapture(B){l.releaseCapture(B,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&D.forEach(([B,H])=>{this.content.addEventListener(B,Q=>{this[H](Q)},{passive:!1})})}_pointerenter(B){this.setPointersPositions(B);const H=U(B.type);this._fire(H.pointerenter,{evt:B,target:this,currentTarget:this})}_pointerover(B){this.setPointersPositions(B);const H=U(B.type);this._fire(H.pointerover,{evt:B,target:this,currentTarget:this})}_getTargetShape(B){let H=this[B+"targetShape"];return H&&!H.getStage()&&(H=null),H}_pointerleave(B){const H=U(B.type),Q=j(B.type);if(H){this.setPointersPositions(B);var J=this._getTargetShape(Q),ne=!s.DD.isDragging||i.Konva.hitOnDragEnabled;J&&ne?(J._fireAndBubble(H.pointerout,{evt:B}),J._fireAndBubble(H.pointerleave,{evt:B}),this._fire(H.pointerleave,{evt:B,target:this,currentTarget:this}),this[Q+"targetShape"]=null):ne&&(this._fire(H.pointerleave,{evt:B,target:this,currentTarget:this}),this._fire(H.pointerout,{evt:B,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(B){const H=U(B.type),Q=j(B.type);if(H){this.setPointersPositions(B);var J=!1;this._changedPointerPositions.forEach(ne=>{var te=this.getIntersection(ne);if(s.DD.justDragged=!1,i.Konva["_"+Q+"ListenClick"]=!0,!(te&&te.isListening()))return;i.Konva.capturePointerEventsEnabled&&te.setPointerCapture(ne.id),this[Q+"ClickStartShape"]=te,te._fireAndBubble(H.pointerdown,{evt:B,pointerId:ne.id}),J=!0;const ve=B.type.indexOf("touch")>=0;te.preventDefault()&&B.cancelable&&ve&&B.preventDefault()}),J||this._fire(H.pointerdown,{evt:B,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(B){const H=U(B.type),Q=j(B.type);if(!H)return;s.DD.isDragging&&s.DD.node.preventDefault()&&B.cancelable&&B.preventDefault(),this.setPointersPositions(B);var J=!s.DD.isDragging||i.Konva.hitOnDragEnabled;if(!J)return;var ne={};let te=!1;var xe=this._getTargetShape(Q);this._changedPointerPositions.forEach(ve=>{const ce=l.getCapturedShape(ve.id)||this.getIntersection(ve),Ne=ve.id,se={evt:B,pointerId:Ne};var pt=xe!==ce;if(pt&&xe&&(xe._fireAndBubble(H.pointerout,Object.assign({},se),ce),xe._fireAndBubble(H.pointerleave,Object.assign({},se),ce)),ce){if(ne[ce._id])return;ne[ce._id]=!0}ce&&ce.isListening()?(te=!0,pt&&(ce._fireAndBubble(H.pointerover,Object.assign({},se),xe),ce._fireAndBubble(H.pointerenter,Object.assign({},se),xe),this[Q+"targetShape"]=ce),ce._fireAndBubble(H.pointermove,Object.assign({},se))):xe&&(this._fire(H.pointerover,{evt:B,target:this,currentTarget:this,pointerId:Ne}),this[Q+"targetShape"]=null)}),te||this._fire(H.pointermove,{evt:B,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(B){const H=U(B.type),Q=j(B.type);if(!H)return;this.setPointersPositions(B);const J=this[Q+"ClickStartShape"],ne=this[Q+"ClickEndShape"];var te={};let xe=!1;this._changedPointerPositions.forEach(ve=>{const ce=l.getCapturedShape(ve.id)||this.getIntersection(ve);if(ce){if(ce.releaseCapture(ve.id),te[ce._id])return;te[ce._id]=!0}const Ne=ve.id,se={evt:B,pointerId:Ne};let pt=!1;i.Konva["_"+Q+"InDblClickWindow"]?(pt=!0,clearTimeout(this[Q+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+Q+"InDblClickWindow"]=!0,clearTimeout(this[Q+"DblTimeout"])),this[Q+"DblTimeout"]=setTimeout(function(){i.Konva["_"+Q+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ce&&ce.isListening()?(xe=!0,this[Q+"ClickEndShape"]=ce,ce._fireAndBubble(H.pointerup,Object.assign({},se)),i.Konva["_"+Q+"ListenClick"]&&J&&J===ce&&(ce._fireAndBubble(H.pointerclick,Object.assign({},se)),pt&&ne&&ne===ce&&ce._fireAndBubble(H.pointerdblclick,Object.assign({},se)))):(this[Q+"ClickEndShape"]=null,i.Konva["_"+Q+"ListenClick"]&&this._fire(H.pointerclick,{evt:B,target:this,currentTarget:this,pointerId:Ne}),pt&&this._fire(H.pointerdblclick,{evt:B,target:this,currentTarget:this,pointerId:Ne}))}),xe||this._fire(H.pointerup,{evt:B,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+Q+"ListenClick"]=!1,B.cancelable&&Q!=="touch"&&B.preventDefault()}_contextmenu(B){this.setPointersPositions(B);var H=this.getIntersection(this.getPointerPosition());H&&H.isListening()?H._fireAndBubble($,{evt:B}):this._fire($,{evt:B,target:this,currentTarget:this})}_wheel(B){this.setPointersPositions(B);var H=this.getIntersection(this.getPointerPosition());H&&H.isListening()?H._fireAndBubble(N,{evt:B}):this._fire(N,{evt:B,target:this,currentTarget:this})}_pointercancel(B){this.setPointersPositions(B);const H=l.getCapturedShape(B.pointerId)||this.getIntersection(this.getPointerPosition());H&&H._fireAndBubble(S,l.createEvent(B)),l.releaseCapture(B.pointerId)}_lostpointercapture(B){l.releaseCapture(B.pointerId)}setPointersPositions(B){var H=this._getContentPosition(),Q=null,J=null;B=B||window.event,B.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(B.touches,ne=>{this._pointerPositions.push({id:ne.identifier,x:(ne.clientX-H.left)/H.scaleX,y:(ne.clientY-H.top)/H.scaleY})}),Array.prototype.forEach.call(B.changedTouches||B.touches,ne=>{this._changedPointerPositions.push({id:ne.identifier,x:(ne.clientX-H.left)/H.scaleX,y:(ne.clientY-H.top)/H.scaleY})})):(Q=(B.clientX-H.left)/H.scaleX,J=(B.clientY-H.top)/H.scaleY,this.pointerPos={x:Q,y:J},this._pointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(B)}],this._changedPointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(B)}])}_setPointerPosition(B){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(B)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var B=this.content.getBoundingClientRect();return{top:B.top,left:B.left,scaleX:B.width/this.content.clientWidth||1,scaleY:B.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var B=this.container();if(!B)throw"Stage has no container. A container is required.";B.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),B.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(B){B.batchDraw()}),this}}e.Stage=X,X.prototype.nodeType=u,(0,a._registerNode)(X),n.Factory.addGetterSetter(X,"container")})(dN);var Oh={},on={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Pe,n=Ot,r=Te,i=St,o=de,s=Pe,a=Cr;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(P){const E=this.attrs.fillRule;E?P.fill(E):P.fill()}function _(P){P.stroke()}function y(P){P.fill()}function v(P){P.stroke()}function g(){this._clearCache(l)}function b(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class T extends i.Node{constructor(E){super(E);let A;for(;A=n.Util.getRandomColor(),!(A&&!(A in e.shapes)););this.colorKey=A,e.shapes[A]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var E=p();const A=E.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(A&&A.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const M=$.getMatrix(),C=typeof DOMMatrix>"u"?{a:M[0],b:M[1],c:M[2],d:M[3],e:M[4],f:M[5]}:new DOMMatrix(M);A.setTransform(C)}return A}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var E=this.fillLinearGradientColorStops();if(E){for(var A=p(),$=this.fillLinearGradientStartPoint(),M=this.fillLinearGradientEndPoint(),C=A.createLinearGradient($.x,$.y,M.x,M.y),O=0;Othis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const E=this.hitStrokeWidth();return E==="auto"?this.hasStroke():this.strokeEnabled()&&!!E}intersects(E){var A=this.getStage(),$=A.bufferHitCanvas,M;return $.getContext().clear(),this.drawHit($,null,!0),M=$.context.getImageData(Math.round(E.x),Math.round(E.y),1,1).data,M[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(E){var A;if(!this.getStage()||!((A=this.attrs.perfectDrawEnabled)!==null&&A!==void 0?A:!0))return!1;const M=E||this.hasFill(),C=this.hasStroke(),O=this.getAbsoluteOpacity()!==1;if(M&&C&&O)return!0;const I=this.hasShadow(),N=this.shadowForStrokeEnabled();return!!(M&&C&&I&&N)}setStrokeHitEnabled(E){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),E?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var E=this.size();return{x:this._centroid?-E.width/2:0,y:this._centroid?-E.height/2:0,width:E.width,height:E.height}}getClientRect(E={}){const A=E.skipTransform,$=E.relativeTo,M=this.getSelfRect(),O=!E.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,I=M.width+O,N=M.height+O,R=!E.skipShadow&&this.hasShadow(),D=R?this.shadowOffsetX():0,L=R?this.shadowOffsetY():0,j=I+Math.abs(D),U=N+Math.abs(L),G=R&&this.shadowBlur()||0,W=j+G*2,X=U+G*2,Y={width:W,height:X,x:-(O/2+G)+Math.min(D,0)+M.x,y:-(O/2+G)+Math.min(L,0)+M.y};return A?Y:this._transformedRect(Y,$)}drawScene(E,A){var $=this.getLayer(),M=E||$.getCanvas(),C=M.getContext(),O=this._getCanvasCache(),I=this.getSceneFunc(),N=this.hasShadow(),R,D,L,j=M.isCache,U=A===this;if(!this.isVisible()&&!U)return this;if(O){C.save();var G=this.getAbsoluteTransform(A).getMatrix();return C.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(C),C.restore(),this}if(!I)return this;if(C.save(),this._useBufferCanvas()&&!j){R=this.getStage(),D=R.bufferCanvas,L=D.getContext(),L.clear(),L.save(),L._applyLineJoin(this);var W=this.getAbsoluteTransform(A).getMatrix();L.transform(W[0],W[1],W[2],W[3],W[4],W[5]),I.call(this,L,this),L.restore();var X=D.pixelRatio;N&&C._applyShadow(this),C._applyOpacity(this),C._applyGlobalCompositeOperation(this),C.drawImage(D._canvas,0,0,D.width/X,D.height/X)}else{if(C._applyLineJoin(this),!U){var W=this.getAbsoluteTransform(A).getMatrix();C.transform(W[0],W[1],W[2],W[3],W[4],W[5]),C._applyOpacity(this),C._applyGlobalCompositeOperation(this)}N&&C._applyShadow(this),I.call(this,C,this)}return C.restore(),this}drawHit(E,A,$=!1){if(!this.shouldDrawHit(A,$))return this;var M=this.getLayer(),C=E||M.hitCanvas,O=C&&C.getContext(),I=this.hitFunc()||this.sceneFunc(),N=this._getCanvasCache(),R=N&&N.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),R){O.save();var D=this.getAbsoluteTransform(A).getMatrix();return O.transform(D[0],D[1],D[2],D[3],D[4],D[5]),this._drawCachedHitCanvas(O),O.restore(),this}if(!I)return this;if(O.save(),O._applyLineJoin(this),!(this===A)){var j=this.getAbsoluteTransform(A).getMatrix();O.transform(j[0],j[1],j[2],j[3],j[4],j[5])}return I.call(this,O,this),O.restore(),this}drawHitFromCache(E=0){var A=this._getCanvasCache(),$=this._getCachedSceneCanvas(),M=A.hit,C=M.getContext(),O=M.getWidth(),I=M.getHeight(),N,R,D,L,j,U;C.clear(),C.drawImage($._canvas,0,0,O,I);try{for(N=C.getImageData(0,0,O,I),R=N.data,D=R.length,L=n.Util._hexToRgb(this.colorKey),j=0;jE?(R[j]=L.r,R[j+1]=L.g,R[j+2]=L.b,R[j+3]=255):R[j+3]=0;C.putImageData(N,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(E){return a.hasPointerCapture(E,this)}setPointerCapture(E){a.setPointerCapture(E,this)}releaseCapture(E){a.releaseCapture(E,this)}}e.Shape=T,T.prototype._fillFunc=m,T.prototype._strokeFunc=_,T.prototype._fillFuncHit=y,T.prototype._strokeFuncHit=v,T.prototype._centroid=!1,T.prototype.nodeType="Shape",(0,s._registerNode)(T),T.prototype.eventListeners={},T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(T,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(T,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(T,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(T,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"lineJoin"),r.Factory.addGetterSetter(T,"lineCap"),r.Factory.addGetterSetter(T,"sceneFunc"),r.Factory.addGetterSetter(T,"hitFunc"),r.Factory.addGetterSetter(T,"dash"),r.Factory.addGetterSetter(T,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(T,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(T,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternImage"),r.Factory.addGetterSetter(T,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(T,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(T,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(T,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(T,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(T,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(T,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(T,"fillEnabled",!0),r.Factory.addGetterSetter(T,"strokeEnabled",!0),r.Factory.addGetterSetter(T,"shadowEnabled",!0),r.Factory.addGetterSetter(T,"dashEnabled",!0),r.Factory.addGetterSetter(T,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(T,"fillPriority","color"),r.Factory.addComponentsGetterSetter(T,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(T,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(T,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(T,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(T,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(T,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(T,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(T,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(T,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(T,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(T,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(T,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(T,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(T,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(T,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(T,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(T,"fillPatternRotation",0),r.Factory.addGetterSetter(T,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(T,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(on);Object.defineProperty(Oh,"__esModule",{value:!0});Oh.Layer=void 0;const po=Ot,qb=ml,Hl=St,xC=Te,s6=_i,ide=de,ode=on,sde=Pe;var ade="#",lde="beforeDraw",ude="draw",pN=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],cde=pN.length;class _c extends qb.Container{constructor(t){super(t),this.canvas=new s6.SceneCanvas,this.hitCanvas=new s6.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(lde,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qb.Container.prototype.drawScene.call(this,i,n),this._fire(ude,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qb.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){po.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return po.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return po.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Oh.Layer=_c;_c.prototype.nodeType="Layer";(0,sde._registerNode)(_c);xC.Factory.addGetterSetter(_c,"imageSmoothingEnabled",!0);xC.Factory.addGetterSetter(_c,"clearBeforeDraw",!0);xC.Factory.addGetterSetter(_c,"hitGraphEnabled",!0,(0,ide.getBooleanValidator)());var uv={};Object.defineProperty(uv,"__esModule",{value:!0});uv.FastLayer=void 0;const dde=Ot,fde=Oh,hde=Pe;class CC extends fde.Layer{constructor(t){super(t),this.listening(!1),dde.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}uv.FastLayer=CC;CC.prototype.nodeType="FastLayer";(0,hde._registerNode)(CC);var Sc={};Object.defineProperty(Sc,"__esModule",{value:!0});Sc.Group=void 0;const pde=Ot,gde=ml,mde=Pe;class TC extends gde.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&pde.Util.throw("You may only add groups and shapes to groups.")}}Sc.Group=TC;TC.prototype.nodeType="Group";(0,mde._registerNode)(TC);var wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.Animation=void 0;const Wb=Pe,a6=Ot;var Kb=function(){return Wb.glob.performance&&Wb.glob.performance.now?function(){return Wb.glob.performance.now()}:function(){return new Date().getTime()}}();class Ui{constructor(t,n){this.id=Ui.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Kb(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===a?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,y=_._id,v,g=p.easing||e.Easings.Linear,b=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,b),this._addListeners(),f.attrs[y]||(f.attrs[y]={}),f.attrs[y][this._id]||(f.attrs[y][this._id]={}),f.tweens[y]||(f.tweens[y]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,y=_._id,v,g,b,S,w,x,T,P;if(b=f.tweens[y][p],b&&delete f.attrs[y][b][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(T=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],y;this.pause();for(y in _)delete f.tweens[p][y];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var y=1.70158;return m*(h/=_)*h*((y+1)*h-y)+p},BackEaseOut(h,p,m,_){var y=1.70158;return m*((h=h/_-1)*h*((y+1)*h+y)+1)+p},BackEaseInOut(h,p,m,_){var y=1.70158;return(h/=_/2)<1?m/2*(h*h*(((y*=1.525)+1)*h-y))+p:m/2*((h-=2)*h*(((y*=1.525)+1)*h+y)+2)+p},ElasticEaseIn(h,p,m,_,y,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!y||y0?t:n),c=s*n,d=a*(a>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}cv.Arc=Xo;Xo.prototype._centroid=!0;Xo.prototype.className="Arc";Xo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,vde._registerNode)(Xo);dv.Factory.addGetterSetter(Xo,"innerRadius",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"outerRadius",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"angle",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"clockwise",!1,(0,fv.getBooleanValidator)());var hv={},Rh={};Object.defineProperty(Rh,"__esModule",{value:!0});Rh.Line=void 0;const pv=Te,bde=on,mN=de,_de=Pe;function b2(e,t,n,r,i,o,s){var a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),c=s*l/(a+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function u6(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(s,a,d);return u*c};e.getCubicArcLength=t;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],c=a[0]-2*a[1]+a[2],d=2*s[1]-2*s[0],f=2*a[1]-2*a[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const _=p/(2*h),y=m/h,v=l+_,g=y-_*_,b=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+b)/(_+S))):0;return Math.sqrt(h)/2*(v*b-_*S+w)};e.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),c=i(1,l,a),d=u*u+c*c;return Math.sqrt(d)}const i=(s,a,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(s===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-a,u-f)*Math.pow(a,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=s/a,d=(s-l(c))/a,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(s-h)/a;if(p500)break}return c};e.t2length=o})(yN);Object.defineProperty(xc,"__esModule",{value:!0});xc.Path=void 0;const Sde=Te,wde=on,xde=Pe,ql=yN;class Zt extends wde.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Zt.parsePathData(this.data()),this.pathLength=Zt.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,y=u>c?c/u:1;t.translate(a,l),t.rotate(h),t.scale(_,y),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/y),t.rotate(-h),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Zt.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var s=n[i],a=s.points;switch(s.command){case"L":return Zt.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return Zt.getPointOnCubicBezier((0,ql.t2length)(t,Zt.getPathLength(n),m=>(0,ql.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return Zt.getPointOnQuadraticBezier((0,ql.t2length)(t,Zt.getPathLength(n),m=>(0,ql.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],c=a[2],d=a[3],f=a[4],h=a[5],p=a[6];return f+=h*t/s.pathLength,Zt.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,s,a){s===void 0&&(s=n),a===void 0&&(a=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],b=l,S=u,w,x,T,P,E,A,$,M,C,O;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var I=p.shift(),N=p.shift();if(l+=I,u+=N,v="M",s.length>2&&s[s.length-1].command==="z"){for(var R=s.length-2;R>=0;R--)if(s[R].command==="M"){l=s[R].points[0]+I,u=s[R].points[1]+N;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,T=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),T=u+(u-w.points[3])),g.push(x,T,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,T=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),T=u+(u-w.points[3])),g.push(x,T,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,T=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),T=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,T,l,u);break;case"t":x=l,T=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),T=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,T,l,u);break;case"A":P=p.shift(),E=p.shift(),A=p.shift(),$=p.shift(),M=p.shift(),C=l,O=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(C,O,l,u,$,M,P,E,A);break;case"a":P=p.shift(),E=p.shift(),A=p.shift(),$=p.shift(),M=p.shift(),C=l,O=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(C,O,l,u,$,M,P,E,A);break}s.push({command:v||h,points:g,start:{x:b,y:S},pathLength:this.calcLength(b,S,v||h,g)})}(h==="z"||h==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,n,r,i){var o,s,a,l,u=Zt;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,ql.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,ql.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+h;l1&&(a*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((a*a*(l*l)-a*a*(f*f)-l*l*(d*d))/(a*a*(f*f)+l*l*(d*d)));o===s&&(p*=-1),isNaN(p)&&(p=0);var m=p*a*f/l,_=p*-l*d/a,y=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(E){return Math.sqrt(E[0]*E[0]+E[1]*E[1])},b=function(E,A){return(E[0]*A[0]+E[1]*A[1])/(g(E)*g(A))},S=function(E,A){return(E[0]*A[1]=1&&(P=0),s===0&&P>0&&(P=P-2*Math.PI),s===1&&P<0&&(P=P+2*Math.PI),[y,v,a,l,w,P,c,s]}}xc.Path=Zt;Zt.prototype.className="Path";Zt.prototype._attrsAffectingSize=["data"];(0,xde._registerNode)(Zt);Sde.Factory.addGetterSetter(Zt,"data");Object.defineProperty(hv,"__esModule",{value:!0});hv.Arrow=void 0;const gv=Te,Cde=Rh,vN=de,Tde=Pe,c6=xc;class vl extends Cde.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var s=this.pointerLength(),a=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],h=c6.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=c6.Path.getPointOnQuadraticBezier(Math.min(1,1-s/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[a-2]-p.x,u=r[a-1]-p.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[a-2],r[a-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}hv.Arrow=vl;vl.prototype.className="Arrow";(0,Tde._registerNode)(vl);gv.Factory.addGetterSetter(vl,"pointerLength",10,(0,vN.getNumberValidator)());gv.Factory.addGetterSetter(vl,"pointerWidth",10,(0,vN.getNumberValidator)());gv.Factory.addGetterSetter(vl,"pointerAtBeginning",!1);gv.Factory.addGetterSetter(vl,"pointerAtEnding",!0);var mv={};Object.defineProperty(mv,"__esModule",{value:!0});mv.Circle=void 0;const Ede=Te,Pde=on,Ade=de,kde=Pe;let Cc=class extends Pde.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};mv.Circle=Cc;Cc.prototype._centroid=!0;Cc.prototype.className="Circle";Cc.prototype._attrsAffectingSize=["radius"];(0,kde._registerNode)(Cc);Ede.Factory.addGetterSetter(Cc,"radius",0,(0,Ade.getNumberValidator)());var yv={};Object.defineProperty(yv,"__esModule",{value:!0});yv.Ellipse=void 0;const EC=Te,Ode=on,bN=de,Rde=Pe;class sa extends Ode.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}yv.Ellipse=sa;sa.prototype.className="Ellipse";sa.prototype._centroid=!0;sa.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Rde._registerNode)(sa);EC.Factory.addComponentsGetterSetter(sa,"radius",["x","y"]);EC.Factory.addGetterSetter(sa,"radiusX",0,(0,bN.getNumberValidator)());EC.Factory.addGetterSetter(sa,"radiusY",0,(0,bN.getNumberValidator)());var vv={};Object.defineProperty(vv,"__esModule",{value:!0});vv.Image=void 0;const Xb=Ot,bl=Te,Mde=on,Ide=Pe,Mh=de;let so=class _N extends Mde.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?Xb.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?Xb.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=Xb.Util.createImageElement();i.onload=function(){var o=new _N({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};vv.Image=so;so.prototype.className="Image";(0,Ide._registerNode)(so);bl.Factory.addGetterSetter(so,"cornerRadius",0,(0,Mh.getNumberOrArrayOfNumbersValidator)(4));bl.Factory.addGetterSetter(so,"image");bl.Factory.addComponentsGetterSetter(so,"crop",["x","y","width","height"]);bl.Factory.addGetterSetter(so,"cropX",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropY",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropWidth",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropHeight",0,(0,Mh.getNumberValidator)());var ac={};Object.defineProperty(ac,"__esModule",{value:!0});ac.Tag=ac.Label=void 0;const bv=Te,Nde=on,Dde=Sc,PC=de,SN=Pe;var wN=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],Lde="Change.konva",$de="none",_2="up",S2="right",w2="down",x2="left",Fde=wN.length;class AC extends Dde.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Sv.RegularPolygon=Sl;Sl.prototype.className="RegularPolygon";Sl.prototype._centroid=!0;Sl.prototype._attrsAffectingSize=["radius"];(0,Hde._registerNode)(Sl);xN.Factory.addGetterSetter(Sl,"radius",0,(0,CN.getNumberValidator)());xN.Factory.addGetterSetter(Sl,"sides",0,(0,CN.getNumberValidator)());var wv={};Object.defineProperty(wv,"__esModule",{value:!0});wv.Ring=void 0;const TN=Te,qde=on,EN=de,Wde=Pe;var d6=Math.PI*2;class wl extends qde.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,d6,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),d6,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}wv.Ring=wl;wl.prototype.className="Ring";wl.prototype._centroid=!0;wl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Wde._registerNode)(wl);TN.Factory.addGetterSetter(wl,"innerRadius",0,(0,EN.getNumberValidator)());TN.Factory.addGetterSetter(wl,"outerRadius",0,(0,EN.getNumberValidator)());var xv={};Object.defineProperty(xv,"__esModule",{value:!0});xv.Sprite=void 0;const xl=Te,Kde=on,Xde=wc,PN=de,Yde=Pe;class ao extends Kde.Shape{constructor(t){super(t),this._updated=!0,this.anim=new Xde.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(s){var f=s[n],h=r*2;t.drawImage(d,a,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,a,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(t.beginPath(),s){var u=s[n],c=r*2;t.rect(u[c+0],u[c+1],a,l)}else t.rect(0,0,a,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Bp;function Qb(){return Bp||(Bp=C2.Util.createCanvasElement().getContext(rfe),Bp)}function pfe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function gfe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function mfe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class zt extends Jde.Shape{constructor(t){super(mfe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(y+=s)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=C2.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(ife,n),this}getWidth(){var t=this.attrs.width===Wl||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Wl||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return C2.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=Qb(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Fp+this.fontVariant()+Fp+(this.fontSize()+lfe)+hfe(this.fontFamily())}_addTextLine(t){this.align()===ed&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return Qb().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function qI(e,t){if(e){if(typeof e=="string")return NE(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 NE(e,t)}}function NE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,s=r.persistWholeStore,a=r.serialize;try{var l=s?Gae:Hae;yield l(t,n,{prefix:i,driver:o,serialize:a})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function FE(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(u){n(u);return}a.done?t(l):Promise.resolve(l).then(r,i)}function BE(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){FE(o,r,i,s,a,"next",l)}function a(l){FE(o,r,i,s,a,"throw",l)}s(void 0)})}}var Wae=function(){var e=BE(function*(t,n,r){var i=r.prefix,o=r.driver,s=r.serialize,a=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield Bae(t,n,{prefix:i,driver:o,unserialize:a,persistWholeStore:c});var d={},f=function(){var h=BE(function*(){var p=HI(t.getState(),n);yield qae(p,d,{prefix:i,driver:o,serialize:s,persistWholeStore:c}),gC(p,d)||t.dispatch({type:Nae,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(Lae(f,u)):t.subscribe(Dae(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const Kae=Wae;function Ff(e){"@babel/helpers - typeof";return Ff=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},Ff(e)}function jE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zb(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=zb({},r));var o=typeof t=="function"?t:mc(t);switch(i.type){case f2:return n.state=o(zb(zb({},n.state),i.payload||{}),{type:f2}),n.state;default:return o(r,i)}}},Jae=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,s=r.serialize,a=s===void 0?function(_,y){return JSON.stringify(_)}:s,l=r.unserialize,u=l===void 0?function(_,y){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(y){return function(v,g,b){var S=y(v,g,b);return Kae(S,n,{driver:t,prefix:o,serialize:a,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const R5e=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],ele="@@invokeai-",tle=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"],nle=["pendingControlImages"],rle=["selection","selectedBoardId","galleryView"],ile=["schema","invocationTemplates"],ole=[],sle=[],ale=["currentIteration","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","totalIterations","totalSteps","isCancelScheduled","progressImage","wereModelsReceived","wasSchemaParsed","isPersisted","isUploading"],lle=["shouldShowImageDetails"],ule={canvas:tle,gallery:rle,generation:ole,nodes:ile,postprocessing:sle,system:ale,ui:lle,controlNet:nle},cle=(e,t)=>{const n=x0(e,ule[t]);return JSON.stringify(n)},dle={canvas:LR,gallery:R7,generation:qo,nodes:RI,postprocessing:NI,system:BI,config:yR,ui:RR,hotkeys:zI,controlNet:US},fle=(e,t)=>yX(JSON.parse(e),dle[t]),KI=ue("nodes/textToImageGraphBuilt"),XI=ue("nodes/imageToImageGraphBuilt"),YI=ue("nodes/canvasGraphBuilt"),QI=ue("nodes/nodesGraphBuilt"),hle=Jr(KI,XI,YI,QI),ple=e=>{if(hle(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return Lf.fulfilled.match(e)?{...e,payload:""}:fC.match(e)?{...e,payload:""}:e},gle=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","hotkeys/shiftKeyPressed","@@REMEMBER_PERSISTED"],mle=e=>e,yle=()=>{le({actionCreator:VQ,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("canvas"),i=n(),{sessionId:o,isProcessing:s}=i.system,a=e.payload;if(s){if(!a){r.debug("No canvas session, skipping cancel");return}if(a!==o){r.debug({canvasSessionId:a,session_id:o},"Canvas session does not match global session, skipping cancel");return}t(hl({session_id:o}))}}})};ue("app/appStarted");const vle=()=>{le({matcher:he.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==ci({board_id:"none",categories:pi}))return;r(),n();const i=e.payload;i.ids.length>0&&t(Os(i.ids[0]))}})},mC=Gs.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5})})}),{useGetAppVersionQuery:M5e,useGetAppConfigQuery:I5e}=mC,ble=()=>{le({matcher:mC.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r,nsfw_methods:i,watermarking_methods:o}=e.payload,s=t().generation.infillMethod;r.includes(s)||n(_Q(r[0])),i.includes("nsfw_checker")||n(Sae(!1)),o.includes("invisible_watermark")||n(wae(!1))}})},_le=ue("app/appStarted"),Sle=()=>{le({actionCreator:_le,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},yC={memoizeOptions:{resultEqualityCheck:w0}},ZI=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,s=((d=n.initialImage)==null?void 0:d.imageName)===t,a=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.some(f=>Pa(f.data.inputs,h=>{var p;return h.type==="image"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Pa(o.controlNets,f=>f.controlImage===t||f.processedControlImage===t);return{isInitialImage:s,isCanvasImage:a,isNodesImage:l,isControlNetImage:u}},wle=Zn([e=>e],e=>{const{imageToDelete:t}=e.imageDeletion;if(!t)return;const{image_name:n}=t;return ZI(e,n)},yC),xle=()=>{le({matcher:nc.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,s=!1,a=!1;const l=n();r.forEach(u=>{const c=ZI(l,u);c.isInitialImage&&!i&&(t(AR()),i=!0),c.isCanvasImage&&!o&&(t(FR()),o=!0),c.isNodesImage&&!s&&(t(II()),s=!0),c.isControlNetImage&&!a&&(t(P7()),a=!0)})}})},Cle=()=>{le({matcher:Jr(GS,Om),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),s=GS.match(e)?e.payload:o.gallery.selectedBoardId,l=(Om.match(e)?e.payload:o.gallery.galleryView)==="images"?pi:_s,u={board_id:s??"none",categories:l};if(await r(()=>he.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=he.endpoints.listImages.select(u)(t());d!=null&&d.ids.length?n(Os(d.ids[0]??null)):n(Os(null))}else n(Os(null))}})},Tle=ue("canvas/canvasSavedToGallery"),Ele=ue("canvas/canvasCopiedToClipboard"),Ple=ue("canvas/canvasDownloadedAsImage"),Ale=ue("canvas/canvasMerged"),kle=ue("canvas/stagingAreaImageSaved");let JI=null,eN=null;const N5e=e=>{JI=e},rv=()=>JI,D5e=e=>{eN=e},Ole=()=>eN,Rle=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),Ym=async(e,t)=>await Rle(e.toCanvas(t)),vC=async e=>{const t=rv();if(!t)return;const{shouldCropToBoundingBoxOnSave:n,boundingBoxCoordinates:r,boundingBoxDimensions:i}=e.canvas,o=t.clone();o.scale({x:1,y:1});const s=o.getAbsolutePosition(),a=n?{x:r.x+s.x,y:r.y+s.y,width:i.width,height:i.height}:o.getClientRect();return Ym(o,a)},Mle=e=>{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])},Ile=()=>{le({actionCreator:Ele,effect:async(e,{dispatch:t,getState:n})=>{const r=ev.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Copying Canvas",description:"Unable to export base layer",status:"error"}));return}Mle(o),t(Ft({title:"Canvas Copied to Clipboard",status:"success"}))}})},Nle=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Dle=()=>{le({actionCreator:Ple,effect:async(e,{dispatch:t,getState:n})=>{const r=ev.get().child({namespace:"canvasSavedToGalleryListener"}),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Downloading Canvas",description:"Unable to export base layer",status:"error"}));return}Nle(o,"canvas.png"),t(Ft({title:"Canvas Downloaded",status:"success"}))}})},Lle=async()=>{const e=rv();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),Ym(t,t.getClientRect())},$le=()=>{le({actionCreator:Ale,effect:async(e,{dispatch:t})=>{const n=ev.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await Lle();if(!r){n.error("Problem getting base layer blob"),t(Ft({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const i=rv();if(!i){n.error("Problem getting canvas base layer"),t(Ft({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),s=await t(he.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Merged"}}})).unwrap(),{image_name:a}=s;t(zQ({kind:"image",layer:"base",imageName:a,...o}))}})},Fle=()=>{le({actionCreator:Tle,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("canvas"),i=n(),o=await vC(i);if(!o){r.error("Problem getting base layer blob"),t(Ft({title:"Problem Saving Canvas",description:"Unable to export base layer",status:"error"}));return}t(he.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:i.gallery.autoAddBoardId,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Saved to Gallery"}}}))}})},Ble=(e,t,n)=>{if(!(iJ.match(e)||_T.match(e)||qx.match(e)||oJ.match(e)||ST.match(e))||ST.match(e)&&n.controlNet.controlNets[e.payload.controlNetId].shouldAutoConfig===!0)return!1;const{controlImage:i,processorType:o,shouldAutoConfig:s}=t.controlNet.controlNets[e.payload.controlNetId];if(_T.match(e)&&!s)return!1;const a=o!=="none",l=t.system.isProcessing;return a&&!l&&!!i},jle=()=>{le({predicate:Ble,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=fe("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(Hx({controlNetId:o}))}})},pl=ue("system/sessionReadyToInvoke"),tN=e=>(e==null?void 0:e.type)==="image_output",Vle=()=>{le({actionCreator:Hx,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=fe("session"),{controlNetId:o}=e.payload,s=n().controlNet.controlNets[o];if(!s.controlImage){i.error("Unable to process ControlNet image");return}const a={nodes:{[s.processorNode.id]:{...s.processorNode,is_intermediate:!0,image:{image_name:s.controlImage}}}},l=t(kn({graph:a})),[u]=await r(f=>kn.fulfilled.match(f)&&f.meta.requestId===l.requestId),c=u.payload.id;t(pl());const[d]=await r(f=>Ux.match(f)&&f.payload.data.graph_execution_state_id===c);if(tN(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>he.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(rJ({controlNetId:o,processedControlImage:p.image_name}))}}})},zle=()=>{le({matcher:he.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=fe("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},Ule=()=>{le({matcher:he.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=fe("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},L5e=e=>e.gallery,$5e=Zn(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],yC),Gle=Zn([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t??"none",categories:n==="images"?pi:_s,offset:0,limit:WQ,is_intermediate:!1}},yC),nN=ue("imageDeletion/imageDeletionConfirmed"),Hle=()=>{le({actionCreator:nN,effect:async(e,{dispatch:t,getState:n,condition:r})=>{const{imageDTO:i,imageUsage:o}=e.payload;t(N7(!1));const{image_name:s}=i,a=n();if(a.gallery.selection[a.gallery.selection.length-1]===s){const d=Gle(a),{data:f}=he.endpoints.listImages.select(d)(a),h=(f==null?void 0:f.ids)??[],p=h.findIndex(v=>v.toString()===s),m=h.filter(v=>v.toString()!==s),_=bs(p,0,m.length-1),y=m[_];t(Os(y||null))}o.isCanvasImage&&t(FR()),o.isControlNetImage&&t(P7()),o.isInitialImage&&t(AR()),o.isNodesImage&&t(II());const{requestId:u}=t(he.endpoints.deleteImage.initiate(i));await r(d=>he.endpoints.deleteImage.matchFulfilled(d)&&d.meta.requestId===u,3e4)&&t(Gs.util.invalidateTags([{type:"Board",id:i.board_id}]))}})},qle=()=>{le({matcher:he.endpoints.deleteImage.matchPending,effect:()=>{}})},Wle=()=>{le({matcher:he.endpoints.deleteImage.matchFulfilled,effect:e=>{fe("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},Kle=()=>{le({matcher:he.endpoints.deleteImage.matchRejected,effect:e=>{fe("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},rN=ue("dnd/dndDropped"),Xle=()=>{le({actionCreator:rN,effect:async(e,{dispatch:t})=>{const n=fe("images"),{activeData:r,overData:i}=e.payload;if(n.debug({activeData:r,overData:i},"Image or selection dropped"),i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Os(r.payload.imageDTO.image_name));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(E0(r.payload.imageDTO));return}if(i.actionType==="ADD_TO_BATCH"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(HS([r.payload.imageDTO.image_name]));return}if(i.actionType==="ADD_TO_BATCH"&&r.payloadType==="IMAGE_NAMES"){t(HS(r.payload.image_names));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(qx({controlImage:r.payload.imageDTO.image_name,controlNetId:o}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(BR(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(c2({nodeId:s,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="SET_MULTI_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(c2({nodeId:s,fieldName:o,value:[r.payload.imageDTO]}));return}if(i.actionType==="MOVE_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:s}=i.context;if(!s){t(he.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}t(he.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:s}));return}}})},Yle=()=>{le({matcher:he.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=fe("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},Qle=()=>{le({matcher:he.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=fe("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},Zle=()=>{le({actionCreator:pJ,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,s=wle(n());if(!s)return;const a=s.isCanvasImage||s.isInitialImage||s.isControlNetImage||s.isNodesImage;if(o||a){t(N7(!0));return}t(nN({imageDTO:r,imageUsage:s}))}})},ma={title:"Image Uploaded",status:"success"},Jle=()=>{le({matcher:he.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=fe("images"),i=e.payload,o=n(),{autoAddBoardId:s}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:a}=e.meta.arg.originalArgs;if(!(e.payload.is_intermediate&&!a)){if((a==null?void 0:a.type)==="TOAST"){const{toastOptions:l}=a;if(!s)t(Ft({...ma,...l}));else{t(he.endpoints.addImageToBoard.initiate({board_id:s,imageDTO:i}));const{data:u}=nc.endpoints.listAllBoards.select()(o),c=u==null?void 0:u.find(f=>f.board_id===s),d=c?`Added to board ${c.board_name}`:`Added to board ${s}`;t(Ft({...ma,description:d}))}return}if((a==null?void 0:a.type)==="SET_CANVAS_INITIAL_IMAGE"){t(BR(i)),t(Ft({...ma,description:"Set as canvas initial image"}));return}if((a==null?void 0:a.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:l}=a;t(qx({controlNetId:l,controlImage:i.image_name})),t(Ft({...ma,description:"Set as control image"}));return}if((a==null?void 0:a.type)==="SET_INITIAL_IMAGE"){t(E0(i)),t(Ft({...ma,description:"Set as initial image"}));return}if((a==null?void 0:a.type)==="SET_NODES_IMAGE"){const{nodeId:l,fieldName:u}=a;t(c2({nodeId:l,fieldName:u,value:i})),t(Ft({...ma,description:`Set as node field ${u}`}));return}if((a==null?void 0:a.type)==="ADD_TO_BATCH"){t(HS([i.image_name])),t(Ft({...ma,description:"Added to batch"}));return}}}})},eue=()=>{le({matcher:he.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=fe("images"),r={arg:{...x0(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Ft({title:"Image Upload Failed",description:e.error.message,status:"error"}))}})},tue=ue("generation/initialImageSelected"),nue=ue("generation/modelSelected"),rue=()=>{le({actionCreator:tue,effect:(e,{dispatch:t})=>{if(!e.payload){t(Ft(Ha({title:Od("toast.imageNotLoadedDesc"),status:"error"})));return}t(E0(e.payload)),t(Ft(Ha(Od("toast.sentToImageToImage"))))}})},iue=()=>{le({actionCreator:nue,effect:(e,{getState:t,dispatch:n})=>{var l;const r=fe("models"),i=t(),o=Cf.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const s=o.data,{base_model:a}=s;if(((l=i.generation.model)==null?void 0:l.base_model)!==a){let u=0;Za(i.lora.loras,(f,h)=>{f.base_model!==a&&(n(L7(h)),u+=1)});const{vae:c}=i.generation;c&&c.base_model!==a&&(n(kR(null)),u+=1);const{controlNets:d}=i.controlNet;Za(d,(f,h)=>{var p;((p=f.model)==null?void 0:p.base_model)!==a&&(n(E7({controlNetId:h})),u+=1)}),u>0&&n(Ft(Ha({title:`Base model changed, cleared ${u} incompatible submodel${u===1?"":"s"}`,status:"warning"})))}n(Va(s))}})},VE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),UE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),GE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),HE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),qE=ea({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),oue=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Ul=e=>{const t=[];return e.forEach(n=>{const r={...Dn(n),id:oue(n)};t.push(r)}),t},wo=Gs.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${hg.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{id:"OnnxModel",type:Le}];return t&&i.push(...t.ids.map(o=>({type:"OnnxModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return zE.setAll(zE.getInitialState(),i)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${hg.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{type:"MainModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"MainModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return VE.setAll(VE.getInitialState(),i)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,params:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:r}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:(t,n,r)=>{const i=[{type:"LoRAModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"LoRAModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return UE.setAll(UE.getInitialState(),i)}}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:(t,n,r)=>{const i=[{type:"ControlNetModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"ControlNetModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return GE.setAll(GE.getInitialState(),i)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:(t,n,r)=>{const i=[{type:"VaeModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"VaeModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return qE.setAll(qE.getInitialState(),i)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:(t,n,r)=>{const i=[{type:"TextualInversionModel",id:Le}];return t&&i.push(...t.ids.map(o=>({type:"TextualInversionModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Ul(t.models);return HE.setAll(HE.getInitialState(),i)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${hg.stringify(t,{})}`}),providesTags:(t,n,r)=>{const i=[{type:"ScannedModels",id:Le}];return t&&i.push(...t.map(o=>({type:"ScannedModels",id:o}))),i}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:F5e,useGetOnnxModelsQuery:B5e,useGetControlNetModelsQuery:j5e,useGetLoRAModelsQuery:V5e,useGetTextualInversionModelsQuery:z5e,useGetVaeModelsQuery:U5e,useUpdateMainModelsMutation:G5e,useDeleteMainModelsMutation:H5e,useImportMainModelsMutation:q5e,useAddMainModelsMutation:W5e,useConvertMainModelsMutation:K5e,useMergeMainModelsMutation:X5e,useSyncModelsMutation:Y5e,useGetModelsInFolderQuery:Q5e,useGetCheckpointConfigsQuery:Z5e}=wo,sue=()=>{le({predicate:(e,t)=>wo.endpoints.getMainModels.matchFulfilled(t)&&!t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model;if(Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Va(null));return}const l=Cf.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse main model");return}n(Va(l.data))}}),le({predicate:(e,t)=>wo.endpoints.getMainModels.matchFulfilled(t)&&t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel;if(Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(xE(null)),n(Zse(!1));return}const l=Cf.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse SDXL Refiner Model");return}n(xE(l.data))}}),le({matcher:wo.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=fe("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Pa(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Va(null));return}const l=yQ.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse VAE model");return}n(kR(l.data))}}),le({matcher:wo.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{fe("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Za(i,(o,s)=>{Pa(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(L7(s))})}}),le({matcher:wo.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{fe("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Za(i,(o,s)=>{Pa(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(E7({controlNetId:s}))})}}),le({matcher:wo.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{fe("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},ia=e=>JSON.parse(JSON.stringify(e)),p2=e=>!("$ref"in e),aue=e=>!("$ref"in e),J5e=500,lue={integer:"integer",float:"float",number:"float",string:"string",boolean:"boolean",enum:"enum",ImageField:"image",image_collection:"image_collection",LatentsField:"latents",ConditioningField:"conditioning",UNetField:"unet",ClipField:"clip",VaeField:"vae",model:"model",refiner_model:"refiner_model",vae_model:"vae_model",lora_model:"lora_model",controlnet_model:"controlnet_model",ControlNetModelField:"controlnet_model",array:"array",item:"item",ColorField:"color",ControlField:"control",control:"control",cfg_scale:"float",control_weight:"float"},uue=500,Dt=e=>`var(--invokeai-colors-${e}-${uue})`,e4e={integer:{color:"red",colorCssVar:Dt("red"),title:"Integer",description:"Integers are whole numbers, without a decimal point."},float:{color:"orange",colorCssVar:Dt("orange"),title:"Float",description:"Floats are numbers with a decimal point."},string:{color:"yellow",colorCssVar:Dt("yellow"),title:"String",description:"Strings are text."},boolean:{color:"green",colorCssVar:Dt("green"),title:"Boolean",description:"Booleans are true or false."},enum:{color:"blue",colorCssVar:Dt("blue"),title:"Enum",description:"Enums are values that may be one of a number of options."},image:{color:"purple",colorCssVar:Dt("purple"),title:"Image",description:"Images may be passed between nodes."},image_collection:{color:"purple",colorCssVar:Dt("purple"),title:"Image Collection",description:"A collection of images."},latents:{color:"pink",colorCssVar:Dt("pink"),title:"Latents",description:"Latents may be passed between nodes."},conditioning:{color:"cyan",colorCssVar:Dt("cyan"),title:"Conditioning",description:"Conditioning may be passed between nodes."},unet:{color:"red",colorCssVar:Dt("red"),title:"UNet",description:"UNet submodel."},clip:{color:"green",colorCssVar:Dt("green"),title:"Clip",description:"Tokenizer and text_encoder submodels."},vae:{color:"blue",colorCssVar:Dt("blue"),title:"Vae",description:"Vae submodel."},control:{color:"cyan",colorCssVar:Dt("cyan"),title:"Control",description:"Control info passed between nodes."},model:{color:"teal",colorCssVar:Dt("teal"),title:"Model",description:"Models are models."},refiner_model:{color:"teal",colorCssVar:Dt("teal"),title:"Refiner Model",description:"Models are models."},vae_model:{color:"teal",colorCssVar:Dt("teal"),title:"VAE",description:"Models are models."},lora_model:{color:"teal",colorCssVar:Dt("teal"),title:"LoRA",description:"Models are models."},controlnet_model:{color:"teal",colorCssVar:Dt("teal"),title:"ControlNet",description:"Models are models."},array:{color:"gray",colorCssVar:Dt("gray"),title:"Array",description:"TODO: Array type description."},item:{color:"gray",colorCssVar:Dt("gray"),title:"Collection Item",description:"TODO: Collection Item type description."},color:{color:"gray",colorCssVar:Dt("gray"),title:"Color",description:"A RGBA color."}},t4e=250,Ub=e=>e.$ref.split("/").slice(-1)[0],cue=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},due=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},fue=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",inputRequirement:"always",inputKind:"any",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},hue=({schemaObject:e,baseField:t})=>({...t,type:"boolean",inputRequirement:"always",inputKind:"any",default:e.default??!1}),pue=({schemaObject:e,baseField:t})=>({...t,type:"model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),gue=({schemaObject:e,baseField:t})=>({...t,type:"refiner_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),mue=({schemaObject:e,baseField:t})=>({...t,type:"vae_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),yue=({schemaObject:e,baseField:t})=>({...t,type:"lora_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),vue=({schemaObject:e,baseField:t})=>({...t,type:"controlnet_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),bue=({schemaObject:e,baseField:t})=>({...t,type:"image",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),_ue=({schemaObject:e,baseField:t})=>({...t,type:"image_collection",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),Sue=({schemaObject:e,baseField:t})=>({...t,type:"latents",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),wue=({schemaObject:e,baseField:t})=>({...t,type:"conditioning",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),xue=({schemaObject:e,baseField:t})=>({...t,type:"unet",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Cue=({schemaObject:e,baseField:t})=>({...t,type:"clip",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Tue=({schemaObject:e,baseField:t})=>({...t,type:"vae",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Eue=({schemaObject:e,baseField:t})=>({...t,type:"control",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Pue=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",enumType:e.type??"string",options:n,inputRequirement:"always",inputKind:"direct",default:e.default??n[0]}},WE=({baseField:e})=>({...e,type:"array",inputRequirement:"always",inputKind:"direct",default:[]}),KE=({baseField:e})=>({...e,type:"item",inputRequirement:"always",inputKind:"direct",default:void 0}),Aue=({schemaObject:e,baseField:t})=>({...t,type:"color",inputRequirement:"always",inputKind:"direct",default:e.default??{r:127,g:127,b:127,a:255}}),iN=(e,t,n)=>{let r="";n&&t in n?r=n[t]:e.type?e.enum?r="enum":e.type&&(r=e.type):e.allOf?r=Ub(e.allOf[0]):e.anyOf?r=Ub(e.anyOf[0]):e.oneOf&&(r=Ub(e.oneOf[0]));const i=lue[r];if(!i)throw`Field type "${r}" is unknown!`;return i},kue=(e,t,n)=>{const r=iN(e,t,n),i={name:t,title:e.title??"",description:e.description??""};if(["image"].includes(r))return bue({schemaObject:e,baseField:i});if(["image_collection"].includes(r))return _ue({schemaObject:e,baseField:i});if(["latents"].includes(r))return Sue({schemaObject:e,baseField:i});if(["conditioning"].includes(r))return wue({schemaObject:e,baseField:i});if(["unet"].includes(r))return xue({schemaObject:e,baseField:i});if(["clip"].includes(r))return Cue({schemaObject:e,baseField:i});if(["vae"].includes(r))return Tue({schemaObject:e,baseField:i});if(["control"].includes(r))return Eue({schemaObject:e,baseField:i});if(["model"].includes(r))return pue({schemaObject:e,baseField:i});if(["refiner_model"].includes(r))return gue({schemaObject:e,baseField:i});if(["vae_model"].includes(r))return mue({schemaObject:e,baseField:i});if(["lora_model"].includes(r))return yue({schemaObject:e,baseField:i});if(["controlnet_model"].includes(r))return vue({schemaObject:e,baseField:i});if(["enum"].includes(r))return Pue({schemaObject:e,baseField:i});if(["integer"].includes(r))return cue({schemaObject:e,baseField:i});if(["number","float"].includes(r))return due({schemaObject:e,baseField:i});if(["string"].includes(r))return fue({schemaObject:e,baseField:i});if(["boolean"].includes(r))return hue({schemaObject:e,baseField:i});if(["array"].includes(r))return WE({schemaObject:e,baseField:i});if(["item"].includes(r))return KE({schemaObject:e,baseField:i});if(["color"].includes(r))return Aue({schemaObject:e,baseField:i});if(["array"].includes(r))return WE({schemaObject:e,baseField:i});if(["item"].includes(r))return KE({schemaObject:e,baseField:i})},Oue=(e,t,n)=>{const r=e.$ref.split("/").slice(-1)[0],i=t.components.schemas[r];return p2(i)?$x(i.properties,(s,a,l)=>{if(!["type","id"].includes(l)&&!["object"].includes(a.type)&&p2(a)){const u=iN(a,l,n);s[l]={name:l,title:a.title??"",description:a.description??"",type:u}}return s},{}):{}},Rue=e=>e==="l2i"?["id","type","metadata"]:["id","type","is_intermediate","metadata"],Mue=["Graph","InvocationMeta","MetadataAccumulatorInvocation"],Iue=e=>{var r;return aR((r=e.components)==null?void 0:r.schemas,(i,o)=>o.includes("Invocation")&&!o.includes("InvocationOutput")&&!Mue.some(s=>o.includes(s))).reduce((i,o)=>{var s,a,l,u,c;if(aue(o)){const d=o.properties.type.default,f=Rue(d),h=((s=o.ui)==null?void 0:s.title)??o.title.replace("Invocation",""),p=(a=o.ui)==null?void 0:a.type_hints,m={};if(d==="collect"){const g=o.properties.item;m.item={type:"item",name:"item",description:g.description??"",title:"Collection Item",inputKind:"connection",inputRequirement:"always",default:void 0}}else if(d==="iterate"){const g=o.properties.collection;m.collection={type:"array",name:"collection",title:g.title??"",default:[],description:g.description??"",inputRequirement:"always",inputKind:"connection"}}else $x(o.properties,(g,b,S)=>{if(!f.includes(S)&&p2(b)){const w=kue(b,S,p);w&&(g[S]=w)}return g},m);const _=o.output;let y;if(d==="iterate"){const g=(u=(l=e.components)==null?void 0:l.schemas)==null?void 0:u.IterateInvocationOutput;y={item:{name:"item",title:(g==null?void 0:g.title)??"",description:(g==null?void 0:g.description)??"",type:"array"}}}else y=Oue(_,e,p);const v={title:h,type:d,tags:((c=o.ui)==null?void 0:c.tags)??[],description:o.description??"",inputs:m,outputs:y};Object.assign(i,{[d]:v})}return i},{})},Nue=()=>{le({actionCreator:Lf.fulfilled,effect:(e,{dispatch:t})=>{const n=fe("system"),r=e.payload;n.debug({schemaJSON:r},"Dereferenced OpenAPI schema");const i=Iue(r);n.debug({nodeTemplates:ia(i)},`Built ${gR(i)} node templates`),t(fC(i))}}),le({actionCreator:Lf.rejected,effect:()=>{fe("system").error("Problem dereferencing OpenAPI Schema")}})},Due=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),Lue=new Map(Due),$ue=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],g2=Symbol(".toJSON was called"),Fue=e=>{e[g2]=!0;const t=e.toJSON();return delete e[g2],t},Bue=e=>Lue.get(e)??Error,oN=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a})=>{if(!n)if(Array.isArray(e))n=[];else if(!a&&XE(e)){const u=Bue(e.name);n=new u}else n={};if(t.push(e),o>=i)return n;if(s&&typeof e.toJSON=="function"&&e[g2]!==!0)return Fue(e);const l=u=>oN({from:u,seen:[...t],forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a});for(const[u,c]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(c)){n[u]="[object Buffer]";continue}if(c!==null&&typeof c=="object"&&typeof c.pipe=="function"){n[u]="[object Stream]";continue}if(typeof c!="function"){if(!c||typeof c!="object"){n[u]=c;continue}if(!t.includes(e[u])){o++,n[u]=l(e[u]);continue}n[u]="[Circular]"}}for(const{property:u,enumerable:c}of $ue)typeof e[u]<"u"&&e[u]!==null&&Object.defineProperty(n,u,{value:XE(e[u])?l(e[u]):e[u],enumerable:r?!0:c,configurable:!0,writable:!0});return n};function bC(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?oN({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function XE(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const jue=()=>{le({actionCreator:hl.pending,effect:()=>{}})},Vue=()=>{le({actionCreator:hl.fulfilled,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session canceled (${n})`)}})},zue=()=>{le({actionCreator:hl.rejected,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:bC(r)},"Problem canceling session")}}})},Uue=()=>{le({actionCreator:kn.pending,effect:()=>{}})},Gue=()=>{le({actionCreator:kn.fulfilled,effect:e=>{const t=fe("session"),n=e.payload;t.debug({session:ia(n)},`Session created (${n.id})`)}})},Hue=()=>{le({actionCreator:kn.rejected,effect:e=>{const t=fe("session");if(e.payload){const{error:n,status:r}=e.payload,i=ia(e.meta.arg);t.error({graph:i,status:r,error:bC(n)},"Problem creating session")}}})},que=()=>{le({actionCreator:vh.pending,effect:()=>{}})},Wue=()=>{le({actionCreator:vh.fulfilled,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session invoked (${n})`)}})},Kue=()=>{le({actionCreator:vh.rejected,effect:e=>{const t=fe("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:bC(r)},"Problem invoking session")}}})},Xue=()=>{le({actionCreator:pl,effect:(e,{getState:t,dispatch:n})=>{const r=fe("session"),{sessionId:i}=t().system;i&&(r.debug({session_id:i},`Session ready to invoke (${i})})`),n(vh({session_id:i})))}})},Yue=()=>{le({actionCreator:i7,effect:(e,{dispatch:t,getState:n})=>{fe("socketio").debug("Connected");const{nodes:i,config:o}=n(),{disabledTabs:s}=o;!i.schema&&!s.includes("nodes")&&t(Lf()),t(o7(e.payload)),t(wo.util.invalidateTags([{type:"MainModel",id:Le},{type:"SDXLRefinerModel",id:Le},{type:"LoRAModel",id:Le},{type:"ControlNetModel",id:Le},{type:"VaeModel",id:Le},{type:"TextualInversionModel",id:Le},{type:"ScannedModels",id:Le}])),t(mC.util.invalidateTags(["AppConfig","AppVersion"]))}})},Que=()=>{le({actionCreator:s7,effect:(e,{dispatch:t})=>{fe("socketio").debug("Disconnected"),t(a7(e.payload))}})},Zue=()=>{le({actionCreator:y7,effect:(e,{dispatch:t,getState:n})=>{const r=fe("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored generator progress for canceled session");return}r.trace(e.payload,`Generator progress (${e.payload.data.node.type})`),t(v7(e.payload))}})},Jue=()=>{le({actionCreator:g7,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Session complete"),t(m7(e.payload))}})},ece=["dataURL_image"],tce=()=>{le({actionCreator:Ux,effect:async(e,{dispatch:t,getState:n})=>{const r=fe("socketio"),{data:i}=e.payload;r.debug({data:ia(i)},`Invocation complete (${e.payload.data.node.type})`);const o=e.payload.data.graph_execution_state_id,{cancelType:s,isCancelScheduled:a}=n().system;s==="scheduled"&&a&&t(hl({session_id:o}));const{result:l,node:u,graph_execution_state_id:c}=i;if(tN(l)&&!ece.includes(u.type)){const{image_name:d}=l.image,{canvas:f,gallery:h}=n(),p=await t(he.endpoints.getImageDTO.initiate(d)).unwrap();if(c===f.layerState.stagingArea.sessionId&&t(jQ(p)),!p.is_intermediate){const{autoAddBoardId:m}=h;t(m?he.endpoints.addImageToBoard.initiate({board_id:m,imageDTO:p}):he.util.updateQueryData("listImages",{board_id:"none",categories:pi},v=>{const g=v.total,S=Wn.addOne(v,p).total-g;v.total=v.total+S})),t(he.util.invalidateTags([{type:"BoardImagesTotal",id:m??"none"},{type:"BoardAssetsTotal",id:m??"none"}]));const{selectedBoardId:_,shouldAutoSwitch:y}=h;y&&(m&&m!==_?(t(GS(m)),t(Om("images"))):m||t(Om("images")),t(Os(p.image_name)))}t(_ae(null))}t(h7(e.payload))}})},nce=()=>{le({actionCreator:p7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(Gx(e.payload))}})},rce=()=>{le({actionCreator:x7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(C7(e.payload))}})},ice=()=>{le({actionCreator:d7,effect:(e,{dispatch:t,getState:n})=>{const r=fe("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored invocation started for canceled session");return}r.debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(f7(e.payload))}})},oce=()=>{le({actionCreator:b7,effect:(e,{dispatch:t})=>{const n=fe("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load started: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(tJ(e.payload))}}),le({actionCreator:_7,effect:(e,{dispatch:t})=>{const n=fe("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load complete: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(nJ(e.payload))}})},sce=()=>{le({actionCreator:S7,effect:(e,{dispatch:t})=>{fe("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(w7(e.payload))}})},ace=()=>{le({actionCreator:zx,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Subscribed"),t(l7(e.payload))}})},lce=()=>{le({actionCreator:u7,effect:(e,{dispatch:t})=>{fe("socketio").debug(e.payload,"Unsubscribed"),t(c7(e.payload))}})},uce=()=>{le({actionCreator:kle,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(he.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&await t(he.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Ft({title:"Image Saved",status:"success"}))}catch(i){t(Ft({title:"Image Saving Failed",description:i==null?void 0:i.message,status:"error"}))}}})},n4e=["sd-1","sd-2","sdxl","sdxl-refiner"],cce=["sd-1","sd-2","sdxl"],r4e=["sdxl-refiner"],dce=()=>{le({actionCreator:IR,effect:(e,{getState:t,dispatch:n})=>{if(e.payload==="unifiedCanvas"){const{data:i}=wo.endpoints.getMainModels.select(cce)(t());if(!i){n(Va(null));return}const o=[];Za(i.entities,u=>{u&&["sd-1","sd-2"].includes(u.base_model)&&o.push(u)});const s=o[0];if(!s){n(Va(null));return}const{base_model:a,model_name:l}=s;n(Va({base_model:a,model_name:l}))}}})},Be="positive_conditioning",qe="negative_conditioning",cn="text_to_latents",nt="latents_to_image",pu="nsfw_checker",Zc="invisible_watermark",$e="noise",$i="rand_int",xo="range_of_size",ar="iterate",qs="main_model_loader",gl="onnx_model_loader",Jc="vae_loader",fce="lora_loader",rt="clip_skip",vt="image_to_latents",Wt="latents_to_latents",Yn="resize_image",Mi="inpaint",Mp="control_net_collect",Gb="dynamic_prompt",lt="metadata_accumulator",YE="esrgan",Jt="sdxl_model_loader",rs="t2l_sdxl",Ii="l2l_sdxl",Gl="sdxl_refiner_model_loader",Ip="sdxl_refiner_positive_conditioning",Np="sdxl_refiner_negative_conditioning",ya="l2l_sdxl_refiner",_C="text_to_image_graph",hce="sdxl_text_to_image_graph",pce="sxdl_image_to_image_graph",Qm="image_to_image_graph",sN="inpaint_graph",gce=({image_name:e,esrganModelName:t})=>{const n={id:YE,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!1};return{id:"adhoc-esrgan-graph",nodes:{[YE]:n},edges:[]}},mce=ue("upscale/upscaleRequested"),yce=()=>{le({actionCreator:mce,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{image_name:i}=e.payload,{esrganModelName:o}=n().postprocessing,s=gce({image_name:i,esrganModelName:o});t(kn({graph:s})),await r(kn.fulfilled.match),t(pl())}})},vce=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},QE=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)});var SC={exports:{}},iv={},aN={},Pe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ee<"u"?Ee:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Pe);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Pe;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var S=this.m;return{x:S[0]*b.x+S[2]*b.y+S[4],y:S[1]*b.x+S[3]*b.y+S[5]}}translate(b,S){return this.m[4]+=this.m[0]*b+this.m[2]*S,this.m[5]+=this.m[1]*b+this.m[3]*S,this}scale(b,S){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=S,this.m[3]*=S,this}rotate(b){var S=Math.cos(b),w=Math.sin(b),x=this.m[0]*S+this.m[2]*w,T=this.m[1]*S+this.m[3]*w,P=this.m[0]*-w+this.m[2]*S,E=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=T,this.m[2]=P,this.m[3]=E,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,T=this.m[2]+this.m[0]*b,P=this.m[3]+this.m[1]*b;return this.m[0]=w,this.m[1]=x,this.m[2]=T,this.m[3]=P,this}multiply(b){var S=this.m[0]*b.m[0]+this.m[2]*b.m[1],w=this.m[1]*b.m[0]+this.m[3]*b.m[1],x=this.m[0]*b.m[2]+this.m[2]*b.m[3],T=this.m[1]*b.m[2]+this.m[3]*b.m[3],P=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],E=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=T,this.m[4]=P,this.m[5]=E,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*b,w=-this.m[1]*b,x=-this.m[2]*b,T=this.m[0]*b,P=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),E=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=T,this.m[4]=P,this.m[5]=E,this}getMatrix(){return this.m}decompose(){var b=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],T=this.m[4],P=this.m[5],E=b*x-S*w;let A={x:T,y:P,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||S!=0){var $=Math.sqrt(b*b+S*S);A.rotation=S>0?Math.acos(b/$):-Math.acos(b/$),A.scaleX=$,A.scaleY=E/$,A.skewX=(b*w+S*x)/E,A.skewY=0}else if(w!=0||x!=0){var M=Math.sqrt(w*w+x*x);A.rotation=Math.PI/2-(x>0?Math.acos(-w/M):-Math.acos(w/M)),A.scaleX=E/M,A.scaleY=M,A.skewX=0,A.skewY=(b*w+S*x)/E}return A.rotation=e.Util._getRotation(A.rotation),A}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,y=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===s},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var b=g[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){y.push(g),y.length===1&&v(function(){const b=y;y=[],b.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,b){var S=e.Util.createImageElement();S.onload=function(){b(S)},S.src=g},_rgbToHex(g,b,S){return((1<<24)+(g<<16)+(b<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var b=parseInt(g,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var b;return g in m?(b=m[g],{r:b[0],g:b[1],b:b[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(b=_.exec(g.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var b=m[g.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var b=g.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var b=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[b,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,T=Number(S[2])/100;let P,E,A;if(x===0)return A=T*255,{r:Math.round(A),g:Math.round(A),b:Math.round(A),a:1};T<.5?P=T*(1+x):P=T+x-T*x;const $=2*T-P,M=[0,0,0];for(let C=0;C<3;C++)E=w+1/3*-(C-1),E<0&&E++,E>1&&E--,6*E<1?A=$+(P-$)*6*E:2*E<1?A=P:3*E<2?A=$+(P-$)*(2/3-E)*6:A=$,M[C]=A*255;return{r:Math.round(M[0]),g:Math.round(M[1]),b:Math.round(M[2]),a:1}}},haveIntersection(g,b){return!(b.x>g.x+g.width||b.x+b.widthg.y+g.height||b.y+b.height1?(P=S,E=w,A=(S-x)*(S-x)+(w-T)*(w-T)):(P=g+M*(S-g),E=b+M*(w-b),A=(P-x)*(P-x)+(E-T)*(E-T))}return[P,E,A]},_getProjectionToLine(g,b,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return b.forEach(function(T,P){if(!(!S&&P===b.length-1)){var E=b[(P+1)%b.length],A=e.Util._getProjectionToSegment(T.x,T.y,E.x,E.y,g.x,g.y),$=A[0],M=A[1],C=A[2];Cb.length){var P=b;b=g,g=P}for(w=0;w{b.width=0,b.height=0})},drawRoundedRectPath(g,b,S,w){let x=0,T=0,P=0,E=0;typeof w=="number"?x=T=P=E=Math.min(w,b/2,S/2):(x=Math.min(w[0]||0,b/2,S/2),T=Math.min(w[1]||0,b/2,S/2),E=Math.min(w[2]||0,b/2,S/2),P=Math.min(w[3]||0,b/2,S/2)),g.moveTo(x,0),g.lineTo(b-T,0),g.arc(b-T,T,T,Math.PI*3/2,0,!1),g.lineTo(b,S-E),g.arc(b-E,S-E,E,0,Math.PI/2,!1),g.lineTo(P,S),g.arc(P,S-P,P,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(Ot);var St={},Te={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.getComponentValidator=de.getBooleanValidator=de.getNumberArrayValidator=de.getFunctionValidator=de.getStringOrGradientValidator=de.getStringValidator=de.getNumberOrAutoValidator=de.getNumberOrArrayOfNumbersValidator=de.getNumberValidator=de.alphaComponent=de.RGBComponent=void 0;const Wo=Pe,It=Ot;function Ko(e){return It.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||It.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function bce(e){return e>255?255:e<0?0:Math.round(e)}de.RGBComponent=bce;function _ce(e){return e>1?1:e<1e-4?1e-4:e}de.alphaComponent=_ce;function Sce(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isNumber(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}de.getNumberValidator=Sce;function wce(e){if(Wo.Konva.isUnminified)return function(t,n){let r=It.Util._isNumber(t),i=It.Util._isArray(t)&&t.length==e;return!r&&!i&&It.Util.warn(Ko(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}de.getNumberOrArrayOfNumbersValidator=wce;function xce(){if(Wo.Konva.isUnminified)return function(e,t){var n=It.Util._isNumber(e),r=e==="auto";return n||r||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}de.getNumberOrAutoValidator=xce;function Cce(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isString(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}de.getStringValidator=Cce;function Tce(){if(Wo.Konva.isUnminified)return function(e,t){const n=It.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}de.getStringOrGradientValidator=Tce;function Ece(){if(Wo.Konva.isUnminified)return function(e,t){return It.Util._isFunction(e)||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}de.getFunctionValidator=Ece;function Pce(){if(Wo.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(It.Util._isArray(e)?e.forEach(function(r){It.Util._isNumber(r)||It.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}de.getNumberArrayValidator=Pce;function Ace(){if(Wo.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||It.Util.warn(Ko(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}de.getBooleanValidator=Ace;function kce(e){if(Wo.Konva.isUnminified)return function(t,n){return t==null||It.Util.isObject(t)||It.Util.warn(Ko(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}de.getComponentValidator=kce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=Ot,n=de;var r="get",i="set";e.Factory={addGetterSetter(o,s,a,l,u){e.Factory.addGetter(o,s,a),e.Factory.addSetter(o,s,l,u),e.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){var l=r+t.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]||e.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]=function(c){return a&&c!==void 0&&c!==null&&(c=a.call(this,c,s)),this._setAttr(s,c),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){var c=a.length,d=t.Util._capitalize,f=r+d(s),h=i+d(s),p,m;o.prototype[f]=function(){var y={};for(p=0;p{this._setAttr(s+d(b),void 0)}),this._fireChangeEvent(s,v,y),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){var a=t.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){t.Util.error("Adding deprecated "+s);var u=r+t.Util._capitalize(s),c=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[s];return d===void 0?a:d},e.Factory.addSetter(o,s,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){t.Util.each(s,function(a,l){var u=o.prototype[l],c=r+t.Util._capitalize(a),d=i+t.Util._capitalize(a);function f(){u.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(Te);var _i={},Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.HitContext=Oo.SceneContext=Oo.Context=void 0;const lN=Ot,Oce=Pe;function Rce(e){var t=[],n=e.length,r=lN.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=Mce+u.join(ZE)+Ice)):(o+=a.property,t||(o+=Fce+a.val)),o+=Lce;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=jce&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,s){this._context.arc(t,n,r,i,o,s)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,s){this._context.bezierCurveTo(t,n,r,i,o,s)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,s){return this._context.createRadialGradient(t,n,r,i,o,s)}drawImage(t,n,r,i,o,s,a,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,s,a,l,u)}ellipse(t,n,r,i,o,s,a,l){this._context.ellipse(t,n,r,i,o,s,a,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,s){this._context.setTransform(t,n,r,i,o,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,s){this._context.transform(t,n,r,i,o,s)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=JE.length,r=this.setAttr,i,o,s=function(a){var l=t[a],u;t[a]=function(){return o=Rce(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=a.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(av);Object.defineProperty(St,"__esModule",{value:!0});St.Node=void 0;const ke=Ot,kh=Te,Lp=_i,va=Pe,Fr=av,Vt=de;var Sg="absoluteOpacity",$p="allEventListeners",vo="absoluteTransform",e6="absoluteScale",ba="canvas",Kce="Change",Xce="children",Yce="konva",m2="listening",t6="mouseenter",n6="mouseleave",r6="set",i6="Shape",wg=" ",o6="stage",os="transform",Qce="Stage",y2="visible",Zce=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(wg);let Jce=1,_e=class v2{constructor(t){this._id=Jce++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===os||t===vo)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===os||t===vo,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(wg);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(ba)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===vo&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ba)){const{scene:t,filter:n,hit:r}=this._cache.get(ba);ke.Util.releaseCanvas(t,n,r),this._cache.delete(ba)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){ke.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,a-=u,l-=u;var f=new Lp.SceneCanvas({pixelRatio:s,width:i,height:o}),h=new Lp.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),p=new Lp.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(ba),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-a,-l),_.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Sg),this._clearSelfAndDescendantCache(e6),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(ba,{scene:f,filter:h,hit:p,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(ba)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,s,a,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==Xce&&(r=r6+ke.Util._capitalize(n),ke.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(m2,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(y2,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;Fr.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var o=!n&&!va.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,s,a;function l(u){for(i=[],o=u.length,s=0;s0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==Qce&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(os),this._clearSelfAndDescendantCache(vo)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new ke.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(os);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(os),this._clearSelfAndDescendantCache(vo),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,s=0;s0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return ke.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return ke.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&ke.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Sg,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,s,a;t.attrs={};for(r in n)i=n[r],a=ke.Util.isObject(i)&&!ke.Util._isPlainObject(i)&&!ke.Util._isArray(i),!a&&(o=typeof this[r]=="function"&&this[r],delete n[r],s=o?o.call(this):null,n[r]=i,s!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),ke.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,ke.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():va.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,s,a;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;Fr.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=Fr.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Fr.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return ke.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return ke.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=v2.prototype.getClassName.call(t),i=t.children,o,s,a;n&&(t.attrs.container=n),va.Konva[r]||(ke.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=va.Konva[r];if(o=new l(t.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Hb.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=Hb.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(a){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;if(a){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=s&&a||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,s,a)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,s,a,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,s=_.y,a=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),s=Math.min(s,_.y),a=Math.max(a,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hY.indexOf("pointer")>=0?"pointer":Y.indexOf("touch")>=0?"touch":"mouse",U=Y=>{const B=j(Y);if(B==="pointer")return i.Konva.pointerEventsEnabled&&L.pointer;if(B==="touch")return L.touch;if(B==="mouse")return L.mouse};function G(Y={}){return(Y.clipFunc||Y.clipWidth||Y.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Y}const W="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class X extends r.Container{constructor(B){super(G(B)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(B){const H=B.getType()==="Layer",Q=B.getType()==="FastLayer";H||Q||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const B=this.visible()?"":"none";this.content.style.display=B}setContainer(B){if(typeof B===c){if(B.charAt(0)==="."){var H=B.slice(1);B=document.getElementsByClassName(H)[0]}else{var Q;B.charAt(0)!=="#"?Q=B:Q=B.slice(1),B=document.getElementById(Q)}if(!B)throw"Can not find container in document with id "+Q}return this._setAttr("container",B),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),B.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var B=this.children,H=B.length,Q;for(Q=0;Q-1&&e.stages.splice(H,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const B=this._pointerPositions[0]||this._changedPointerPositions[0];return B?{x:B.x,y:B.y}:(t.Util.warn(W),null)}_getPointerById(B){return this._pointerPositions.find(H=>H.id===B)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(B){B=B||{},B.x=B.x||0,B.y=B.y||0,B.width=B.width||this.width(),B.height=B.height||this.height();var H=new o.SceneCanvas({width:B.width,height:B.height,pixelRatio:B.pixelRatio||1}),Q=H.getContext()._context,J=this.children;return(B.x||B.y)&&Q.translate(-1*B.x,-1*B.y),J.forEach(function(ne){if(ne.isVisible()){var te=ne._toKonvaCanvas(B);Q.drawImage(te._canvas,B.x,B.y,te.getWidth()/te.getPixelRatio(),te.getHeight()/te.getPixelRatio())}}),H}getIntersection(B){if(!B)return null;var H=this.children,Q=H.length,J=Q-1,ne;for(ne=J;ne>=0;ne--){const te=H[ne].getIntersection(B);if(te)return te}return null}_resizeDOM(){var B=this.width(),H=this.height();this.content&&(this.content.style.width=B+d,this.content.style.height=H+d),this.bufferCanvas.setSize(B,H),this.bufferHitCanvas.setSize(B,H),this.children.forEach(Q=>{Q.setSize({width:B,height:H}),Q.draw()})}add(B,...H){if(arguments.length>1){for(var Q=0;QR&&t.Util.warn("The stage has "+J+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),B.setSize({width:this.width(),height:this.height()}),B.draw(),i.Konva.isBrowser&&this.content.appendChild(B.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(B){return l.hasPointerCapture(B,this)}setPointerCapture(B){l.setPointerCapture(B,this)}releaseCapture(B){l.releaseCapture(B,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&D.forEach(([B,H])=>{this.content.addEventListener(B,Q=>{this[H](Q)},{passive:!1})})}_pointerenter(B){this.setPointersPositions(B);const H=U(B.type);this._fire(H.pointerenter,{evt:B,target:this,currentTarget:this})}_pointerover(B){this.setPointersPositions(B);const H=U(B.type);this._fire(H.pointerover,{evt:B,target:this,currentTarget:this})}_getTargetShape(B){let H=this[B+"targetShape"];return H&&!H.getStage()&&(H=null),H}_pointerleave(B){const H=U(B.type),Q=j(B.type);if(H){this.setPointersPositions(B);var J=this._getTargetShape(Q),ne=!s.DD.isDragging||i.Konva.hitOnDragEnabled;J&&ne?(J._fireAndBubble(H.pointerout,{evt:B}),J._fireAndBubble(H.pointerleave,{evt:B}),this._fire(H.pointerleave,{evt:B,target:this,currentTarget:this}),this[Q+"targetShape"]=null):ne&&(this._fire(H.pointerleave,{evt:B,target:this,currentTarget:this}),this._fire(H.pointerout,{evt:B,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(B){const H=U(B.type),Q=j(B.type);if(H){this.setPointersPositions(B);var J=!1;this._changedPointerPositions.forEach(ne=>{var te=this.getIntersection(ne);if(s.DD.justDragged=!1,i.Konva["_"+Q+"ListenClick"]=!0,!(te&&te.isListening()))return;i.Konva.capturePointerEventsEnabled&&te.setPointerCapture(ne.id),this[Q+"ClickStartShape"]=te,te._fireAndBubble(H.pointerdown,{evt:B,pointerId:ne.id}),J=!0;const ve=B.type.indexOf("touch")>=0;te.preventDefault()&&B.cancelable&&ve&&B.preventDefault()}),J||this._fire(H.pointerdown,{evt:B,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(B){const H=U(B.type),Q=j(B.type);if(!H)return;s.DD.isDragging&&s.DD.node.preventDefault()&&B.cancelable&&B.preventDefault(),this.setPointersPositions(B);var J=!s.DD.isDragging||i.Konva.hitOnDragEnabled;if(!J)return;var ne={};let te=!1;var xe=this._getTargetShape(Q);this._changedPointerPositions.forEach(ve=>{const ce=l.getCapturedShape(ve.id)||this.getIntersection(ve),Ne=ve.id,se={evt:B,pointerId:Ne};var pt=xe!==ce;if(pt&&xe&&(xe._fireAndBubble(H.pointerout,Object.assign({},se),ce),xe._fireAndBubble(H.pointerleave,Object.assign({},se),ce)),ce){if(ne[ce._id])return;ne[ce._id]=!0}ce&&ce.isListening()?(te=!0,pt&&(ce._fireAndBubble(H.pointerover,Object.assign({},se),xe),ce._fireAndBubble(H.pointerenter,Object.assign({},se),xe),this[Q+"targetShape"]=ce),ce._fireAndBubble(H.pointermove,Object.assign({},se))):xe&&(this._fire(H.pointerover,{evt:B,target:this,currentTarget:this,pointerId:Ne}),this[Q+"targetShape"]=null)}),te||this._fire(H.pointermove,{evt:B,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(B){const H=U(B.type),Q=j(B.type);if(!H)return;this.setPointersPositions(B);const J=this[Q+"ClickStartShape"],ne=this[Q+"ClickEndShape"];var te={};let xe=!1;this._changedPointerPositions.forEach(ve=>{const ce=l.getCapturedShape(ve.id)||this.getIntersection(ve);if(ce){if(ce.releaseCapture(ve.id),te[ce._id])return;te[ce._id]=!0}const Ne=ve.id,se={evt:B,pointerId:Ne};let pt=!1;i.Konva["_"+Q+"InDblClickWindow"]?(pt=!0,clearTimeout(this[Q+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+Q+"InDblClickWindow"]=!0,clearTimeout(this[Q+"DblTimeout"])),this[Q+"DblTimeout"]=setTimeout(function(){i.Konva["_"+Q+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ce&&ce.isListening()?(xe=!0,this[Q+"ClickEndShape"]=ce,ce._fireAndBubble(H.pointerup,Object.assign({},se)),i.Konva["_"+Q+"ListenClick"]&&J&&J===ce&&(ce._fireAndBubble(H.pointerclick,Object.assign({},se)),pt&&ne&&ne===ce&&ce._fireAndBubble(H.pointerdblclick,Object.assign({},se)))):(this[Q+"ClickEndShape"]=null,i.Konva["_"+Q+"ListenClick"]&&this._fire(H.pointerclick,{evt:B,target:this,currentTarget:this,pointerId:Ne}),pt&&this._fire(H.pointerdblclick,{evt:B,target:this,currentTarget:this,pointerId:Ne}))}),xe||this._fire(H.pointerup,{evt:B,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+Q+"ListenClick"]=!1,B.cancelable&&Q!=="touch"&&B.preventDefault()}_contextmenu(B){this.setPointersPositions(B);var H=this.getIntersection(this.getPointerPosition());H&&H.isListening()?H._fireAndBubble($,{evt:B}):this._fire($,{evt:B,target:this,currentTarget:this})}_wheel(B){this.setPointersPositions(B);var H=this.getIntersection(this.getPointerPosition());H&&H.isListening()?H._fireAndBubble(N,{evt:B}):this._fire(N,{evt:B,target:this,currentTarget:this})}_pointercancel(B){this.setPointersPositions(B);const H=l.getCapturedShape(B.pointerId)||this.getIntersection(this.getPointerPosition());H&&H._fireAndBubble(S,l.createEvent(B)),l.releaseCapture(B.pointerId)}_lostpointercapture(B){l.releaseCapture(B.pointerId)}setPointersPositions(B){var H=this._getContentPosition(),Q=null,J=null;B=B||window.event,B.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(B.touches,ne=>{this._pointerPositions.push({id:ne.identifier,x:(ne.clientX-H.left)/H.scaleX,y:(ne.clientY-H.top)/H.scaleY})}),Array.prototype.forEach.call(B.changedTouches||B.touches,ne=>{this._changedPointerPositions.push({id:ne.identifier,x:(ne.clientX-H.left)/H.scaleX,y:(ne.clientY-H.top)/H.scaleY})})):(Q=(B.clientX-H.left)/H.scaleX,J=(B.clientY-H.top)/H.scaleY,this.pointerPos={x:Q,y:J},this._pointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(B)}],this._changedPointerPositions=[{x:Q,y:J,id:t.Util._getFirstPointerId(B)}])}_setPointerPosition(B){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(B)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var B=this.content.getBoundingClientRect();return{top:B.top,left:B.left,scaleX:B.width/this.content.clientWidth||1,scaleY:B.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var B=this.container();if(!B)throw"Stage has no container. A container is required.";B.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),B.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(B){B.batchDraw()}),this}}e.Stage=X,X.prototype.nodeType=u,(0,a._registerNode)(X),n.Factory.addGetterSetter(X,"container")})(dN);var Oh={},on={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Pe,n=Ot,r=Te,i=St,o=de,s=Pe,a=Cr;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(P){const E=this.attrs.fillRule;E?P.fill(E):P.fill()}function _(P){P.stroke()}function y(P){P.fill()}function v(P){P.stroke()}function g(){this._clearCache(l)}function b(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class T extends i.Node{constructor(E){super(E);let A;for(;A=n.Util.getRandomColor(),!(A&&!(A in e.shapes)););this.colorKey=A,e.shapes[A]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var E=p();const A=E.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(A&&A.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const M=$.getMatrix(),C=typeof DOMMatrix>"u"?{a:M[0],b:M[1],c:M[2],d:M[3],e:M[4],f:M[5]}:new DOMMatrix(M);A.setTransform(C)}return A}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var E=this.fillLinearGradientColorStops();if(E){for(var A=p(),$=this.fillLinearGradientStartPoint(),M=this.fillLinearGradientEndPoint(),C=A.createLinearGradient($.x,$.y,M.x,M.y),O=0;Othis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const E=this.hitStrokeWidth();return E==="auto"?this.hasStroke():this.strokeEnabled()&&!!E}intersects(E){var A=this.getStage(),$=A.bufferHitCanvas,M;return $.getContext().clear(),this.drawHit($,null,!0),M=$.context.getImageData(Math.round(E.x),Math.round(E.y),1,1).data,M[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(E){var A;if(!this.getStage()||!((A=this.attrs.perfectDrawEnabled)!==null&&A!==void 0?A:!0))return!1;const M=E||this.hasFill(),C=this.hasStroke(),O=this.getAbsoluteOpacity()!==1;if(M&&C&&O)return!0;const I=this.hasShadow(),N=this.shadowForStrokeEnabled();return!!(M&&C&&I&&N)}setStrokeHitEnabled(E){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),E?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var E=this.size();return{x:this._centroid?-E.width/2:0,y:this._centroid?-E.height/2:0,width:E.width,height:E.height}}getClientRect(E={}){const A=E.skipTransform,$=E.relativeTo,M=this.getSelfRect(),O=!E.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,I=M.width+O,N=M.height+O,R=!E.skipShadow&&this.hasShadow(),D=R?this.shadowOffsetX():0,L=R?this.shadowOffsetY():0,j=I+Math.abs(D),U=N+Math.abs(L),G=R&&this.shadowBlur()||0,W=j+G*2,X=U+G*2,Y={width:W,height:X,x:-(O/2+G)+Math.min(D,0)+M.x,y:-(O/2+G)+Math.min(L,0)+M.y};return A?Y:this._transformedRect(Y,$)}drawScene(E,A){var $=this.getLayer(),M=E||$.getCanvas(),C=M.getContext(),O=this._getCanvasCache(),I=this.getSceneFunc(),N=this.hasShadow(),R,D,L,j=M.isCache,U=A===this;if(!this.isVisible()&&!U)return this;if(O){C.save();var G=this.getAbsoluteTransform(A).getMatrix();return C.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(C),C.restore(),this}if(!I)return this;if(C.save(),this._useBufferCanvas()&&!j){R=this.getStage(),D=R.bufferCanvas,L=D.getContext(),L.clear(),L.save(),L._applyLineJoin(this);var W=this.getAbsoluteTransform(A).getMatrix();L.transform(W[0],W[1],W[2],W[3],W[4],W[5]),I.call(this,L,this),L.restore();var X=D.pixelRatio;N&&C._applyShadow(this),C._applyOpacity(this),C._applyGlobalCompositeOperation(this),C.drawImage(D._canvas,0,0,D.width/X,D.height/X)}else{if(C._applyLineJoin(this),!U){var W=this.getAbsoluteTransform(A).getMatrix();C.transform(W[0],W[1],W[2],W[3],W[4],W[5]),C._applyOpacity(this),C._applyGlobalCompositeOperation(this)}N&&C._applyShadow(this),I.call(this,C,this)}return C.restore(),this}drawHit(E,A,$=!1){if(!this.shouldDrawHit(A,$))return this;var M=this.getLayer(),C=E||M.hitCanvas,O=C&&C.getContext(),I=this.hitFunc()||this.sceneFunc(),N=this._getCanvasCache(),R=N&&N.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),R){O.save();var D=this.getAbsoluteTransform(A).getMatrix();return O.transform(D[0],D[1],D[2],D[3],D[4],D[5]),this._drawCachedHitCanvas(O),O.restore(),this}if(!I)return this;if(O.save(),O._applyLineJoin(this),!(this===A)){var j=this.getAbsoluteTransform(A).getMatrix();O.transform(j[0],j[1],j[2],j[3],j[4],j[5])}return I.call(this,O,this),O.restore(),this}drawHitFromCache(E=0){var A=this._getCanvasCache(),$=this._getCachedSceneCanvas(),M=A.hit,C=M.getContext(),O=M.getWidth(),I=M.getHeight(),N,R,D,L,j,U;C.clear(),C.drawImage($._canvas,0,0,O,I);try{for(N=C.getImageData(0,0,O,I),R=N.data,D=R.length,L=n.Util._hexToRgb(this.colorKey),j=0;jE?(R[j]=L.r,R[j+1]=L.g,R[j+2]=L.b,R[j+3]=255):R[j+3]=0;C.putImageData(N,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(E){return a.hasPointerCapture(E,this)}setPointerCapture(E){a.setPointerCapture(E,this)}releaseCapture(E){a.releaseCapture(E,this)}}e.Shape=T,T.prototype._fillFunc=m,T.prototype._strokeFunc=_,T.prototype._fillFuncHit=y,T.prototype._strokeFuncHit=v,T.prototype._centroid=!1,T.prototype.nodeType="Shape",(0,s._registerNode)(T),T.prototype.eventListeners={},T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(T,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(T,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(T,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(T,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(T,"lineJoin"),r.Factory.addGetterSetter(T,"lineCap"),r.Factory.addGetterSetter(T,"sceneFunc"),r.Factory.addGetterSetter(T,"hitFunc"),r.Factory.addGetterSetter(T,"dash"),r.Factory.addGetterSetter(T,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(T,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(T,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternImage"),r.Factory.addGetterSetter(T,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(T,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(T,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(T,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(T,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(T,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(T,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(T,"fillEnabled",!0),r.Factory.addGetterSetter(T,"strokeEnabled",!0),r.Factory.addGetterSetter(T,"shadowEnabled",!0),r.Factory.addGetterSetter(T,"dashEnabled",!0),r.Factory.addGetterSetter(T,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(T,"fillPriority","color"),r.Factory.addComponentsGetterSetter(T,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(T,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(T,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(T,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(T,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(T,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(T,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(T,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(T,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(T,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(T,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(T,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(T,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(T,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(T,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(T,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(T,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(T,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(T,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(T,"fillPatternRotation",0),r.Factory.addGetterSetter(T,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(T,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(on);Object.defineProperty(Oh,"__esModule",{value:!0});Oh.Layer=void 0;const po=Ot,qb=ml,Hl=St,xC=Te,s6=_i,ide=de,ode=on,sde=Pe;var ade="#",lde="beforeDraw",ude="draw",pN=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],cde=pN.length;class _c extends qb.Container{constructor(t){super(t),this.canvas=new s6.SceneCanvas,this.hitCanvas=new s6.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(lde,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qb.Container.prototype.drawScene.call(this,i,n),this._fire(ude,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qb.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){po.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return po.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return po.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Oh.Layer=_c;_c.prototype.nodeType="Layer";(0,sde._registerNode)(_c);xC.Factory.addGetterSetter(_c,"imageSmoothingEnabled",!0);xC.Factory.addGetterSetter(_c,"clearBeforeDraw",!0);xC.Factory.addGetterSetter(_c,"hitGraphEnabled",!0,(0,ide.getBooleanValidator)());var uv={};Object.defineProperty(uv,"__esModule",{value:!0});uv.FastLayer=void 0;const dde=Ot,fde=Oh,hde=Pe;class CC extends fde.Layer{constructor(t){super(t),this.listening(!1),dde.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}uv.FastLayer=CC;CC.prototype.nodeType="FastLayer";(0,hde._registerNode)(CC);var Sc={};Object.defineProperty(Sc,"__esModule",{value:!0});Sc.Group=void 0;const pde=Ot,gde=ml,mde=Pe;class TC extends gde.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&pde.Util.throw("You may only add groups and shapes to groups.")}}Sc.Group=TC;TC.prototype.nodeType="Group";(0,mde._registerNode)(TC);var wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.Animation=void 0;const Wb=Pe,a6=Ot;var Kb=function(){return Wb.glob.performance&&Wb.glob.performance.now?function(){return Wb.glob.performance.now()}:function(){return new Date().getTime()}}();class Ui{constructor(t,n){this.id=Ui.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Kb(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===a?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,y=_._id,v,g=p.easing||e.Easings.Linear,b=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,b),this._addListeners(),f.attrs[y]||(f.attrs[y]={}),f.attrs[y][this._id]||(f.attrs[y][this._id]={}),f.tweens[y]||(f.tweens[y]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,y=_._id,v,g,b,S,w,x,T,P;if(b=f.tweens[y][p],b&&delete f.attrs[y][b][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(T=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],y;this.pause();for(y in _)delete f.tweens[p][y];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var y=1.70158;return m*(h/=_)*h*((y+1)*h-y)+p},BackEaseOut(h,p,m,_){var y=1.70158;return m*((h=h/_-1)*h*((y+1)*h+y)+1)+p},BackEaseInOut(h,p,m,_){var y=1.70158;return(h/=_/2)<1?m/2*(h*h*(((y*=1.525)+1)*h-y))+p:m/2*((h-=2)*h*(((y*=1.525)+1)*h+y)+2)+p},ElasticEaseIn(h,p,m,_,y,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!y||y0?t:n),c=s*n,d=a*(a>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}cv.Arc=Xo;Xo.prototype._centroid=!0;Xo.prototype.className="Arc";Xo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,vde._registerNode)(Xo);dv.Factory.addGetterSetter(Xo,"innerRadius",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"outerRadius",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"angle",0,(0,fv.getNumberValidator)());dv.Factory.addGetterSetter(Xo,"clockwise",!1,(0,fv.getBooleanValidator)());var hv={},Rh={};Object.defineProperty(Rh,"__esModule",{value:!0});Rh.Line=void 0;const pv=Te,bde=on,mN=de,_de=Pe;function b2(e,t,n,r,i,o,s){var a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),c=s*l/(a+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function u6(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(s,a,d);return u*c};e.getCubicArcLength=t;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],c=a[0]-2*a[1]+a[2],d=2*s[1]-2*s[0],f=2*a[1]-2*a[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const _=p/(2*h),y=m/h,v=l+_,g=y-_*_,b=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+b)/(_+S))):0;return Math.sqrt(h)/2*(v*b-_*S+w)};e.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),c=i(1,l,a),d=u*u+c*c;return Math.sqrt(d)}const i=(s,a,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(s===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-a,u-f)*Math.pow(a,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=s/a,d=(s-l(c))/a,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(s-h)/a;if(p500)break}return c};e.t2length=o})(yN);Object.defineProperty(xc,"__esModule",{value:!0});xc.Path=void 0;const Sde=Te,wde=on,xde=Pe,ql=yN;class Zt extends wde.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Zt.parsePathData(this.data()),this.pathLength=Zt.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,y=u>c?c/u:1;t.translate(a,l),t.rotate(h),t.scale(_,y),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/y),t.rotate(-h),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Zt.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var s=n[i],a=s.points;switch(s.command){case"L":return Zt.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return Zt.getPointOnCubicBezier((0,ql.t2length)(t,Zt.getPathLength(n),m=>(0,ql.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return Zt.getPointOnQuadraticBezier((0,ql.t2length)(t,Zt.getPathLength(n),m=>(0,ql.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],c=a[2],d=a[3],f=a[4],h=a[5],p=a[6];return f+=h*t/s.pathLength,Zt.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,s,a){s===void 0&&(s=n),a===void 0&&(a=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],b=l,S=u,w,x,T,P,E,A,$,M,C,O;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var I=p.shift(),N=p.shift();if(l+=I,u+=N,v="M",s.length>2&&s[s.length-1].command==="z"){for(var R=s.length-2;R>=0;R--)if(s[R].command==="M"){l=s[R].points[0]+I,u=s[R].points[1]+N;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,T=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),T=u+(u-w.points[3])),g.push(x,T,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,T=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),T=u+(u-w.points[3])),g.push(x,T,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,T=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),T=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,T,l,u);break;case"t":x=l,T=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),T=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,T,l,u);break;case"A":P=p.shift(),E=p.shift(),A=p.shift(),$=p.shift(),M=p.shift(),C=l,O=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(C,O,l,u,$,M,P,E,A);break;case"a":P=p.shift(),E=p.shift(),A=p.shift(),$=p.shift(),M=p.shift(),C=l,O=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(C,O,l,u,$,M,P,E,A);break}s.push({command:v||h,points:g,start:{x:b,y:S},pathLength:this.calcLength(b,S,v||h,g)})}(h==="z"||h==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,n,r,i){var o,s,a,l,u=Zt;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,ql.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,ql.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+h;l1&&(a*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((a*a*(l*l)-a*a*(f*f)-l*l*(d*d))/(a*a*(f*f)+l*l*(d*d)));o===s&&(p*=-1),isNaN(p)&&(p=0);var m=p*a*f/l,_=p*-l*d/a,y=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(E){return Math.sqrt(E[0]*E[0]+E[1]*E[1])},b=function(E,A){return(E[0]*A[0]+E[1]*A[1])/(g(E)*g(A))},S=function(E,A){return(E[0]*A[1]=1&&(P=0),s===0&&P>0&&(P=P-2*Math.PI),s===1&&P<0&&(P=P+2*Math.PI),[y,v,a,l,w,P,c,s]}}xc.Path=Zt;Zt.prototype.className="Path";Zt.prototype._attrsAffectingSize=["data"];(0,xde._registerNode)(Zt);Sde.Factory.addGetterSetter(Zt,"data");Object.defineProperty(hv,"__esModule",{value:!0});hv.Arrow=void 0;const gv=Te,Cde=Rh,vN=de,Tde=Pe,c6=xc;class vl extends Cde.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var s=this.pointerLength(),a=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],h=c6.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=c6.Path.getPointOnQuadraticBezier(Math.min(1,1-s/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[a-2]-p.x,u=r[a-1]-p.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[a-2],r[a-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}hv.Arrow=vl;vl.prototype.className="Arrow";(0,Tde._registerNode)(vl);gv.Factory.addGetterSetter(vl,"pointerLength",10,(0,vN.getNumberValidator)());gv.Factory.addGetterSetter(vl,"pointerWidth",10,(0,vN.getNumberValidator)());gv.Factory.addGetterSetter(vl,"pointerAtBeginning",!1);gv.Factory.addGetterSetter(vl,"pointerAtEnding",!0);var mv={};Object.defineProperty(mv,"__esModule",{value:!0});mv.Circle=void 0;const Ede=Te,Pde=on,Ade=de,kde=Pe;let Cc=class extends Pde.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};mv.Circle=Cc;Cc.prototype._centroid=!0;Cc.prototype.className="Circle";Cc.prototype._attrsAffectingSize=["radius"];(0,kde._registerNode)(Cc);Ede.Factory.addGetterSetter(Cc,"radius",0,(0,Ade.getNumberValidator)());var yv={};Object.defineProperty(yv,"__esModule",{value:!0});yv.Ellipse=void 0;const EC=Te,Ode=on,bN=de,Rde=Pe;class sa extends Ode.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}yv.Ellipse=sa;sa.prototype.className="Ellipse";sa.prototype._centroid=!0;sa.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Rde._registerNode)(sa);EC.Factory.addComponentsGetterSetter(sa,"radius",["x","y"]);EC.Factory.addGetterSetter(sa,"radiusX",0,(0,bN.getNumberValidator)());EC.Factory.addGetterSetter(sa,"radiusY",0,(0,bN.getNumberValidator)());var vv={};Object.defineProperty(vv,"__esModule",{value:!0});vv.Image=void 0;const Xb=Ot,bl=Te,Mde=on,Ide=Pe,Mh=de;let so=class _N extends Mde.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?Xb.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?Xb.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=Xb.Util.createImageElement();i.onload=function(){var o=new _N({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};vv.Image=so;so.prototype.className="Image";(0,Ide._registerNode)(so);bl.Factory.addGetterSetter(so,"cornerRadius",0,(0,Mh.getNumberOrArrayOfNumbersValidator)(4));bl.Factory.addGetterSetter(so,"image");bl.Factory.addComponentsGetterSetter(so,"crop",["x","y","width","height"]);bl.Factory.addGetterSetter(so,"cropX",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropY",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropWidth",0,(0,Mh.getNumberValidator)());bl.Factory.addGetterSetter(so,"cropHeight",0,(0,Mh.getNumberValidator)());var ac={};Object.defineProperty(ac,"__esModule",{value:!0});ac.Tag=ac.Label=void 0;const bv=Te,Nde=on,Dde=Sc,PC=de,SN=Pe;var wN=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],Lde="Change.konva",$de="none",_2="up",S2="right",w2="down",x2="left",Fde=wN.length;class AC extends Dde.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Sv.RegularPolygon=Sl;Sl.prototype.className="RegularPolygon";Sl.prototype._centroid=!0;Sl.prototype._attrsAffectingSize=["radius"];(0,Hde._registerNode)(Sl);xN.Factory.addGetterSetter(Sl,"radius",0,(0,CN.getNumberValidator)());xN.Factory.addGetterSetter(Sl,"sides",0,(0,CN.getNumberValidator)());var wv={};Object.defineProperty(wv,"__esModule",{value:!0});wv.Ring=void 0;const TN=Te,qde=on,EN=de,Wde=Pe;var d6=Math.PI*2;class wl extends qde.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,d6,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),d6,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}wv.Ring=wl;wl.prototype.className="Ring";wl.prototype._centroid=!0;wl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Wde._registerNode)(wl);TN.Factory.addGetterSetter(wl,"innerRadius",0,(0,EN.getNumberValidator)());TN.Factory.addGetterSetter(wl,"outerRadius",0,(0,EN.getNumberValidator)());var xv={};Object.defineProperty(xv,"__esModule",{value:!0});xv.Sprite=void 0;const xl=Te,Kde=on,Xde=wc,PN=de,Yde=Pe;class ao extends Kde.Shape{constructor(t){super(t),this._updated=!0,this.anim=new Xde.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(s){var f=s[n],h=r*2;t.drawImage(d,a,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,a,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(t.beginPath(),s){var u=s[n],c=r*2;t.rect(u[c+0],u[c+1],a,l)}else t.rect(0,0,a,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Bp;function Qb(){return Bp||(Bp=C2.Util.createCanvasElement().getContext(rfe),Bp)}function pfe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function gfe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function mfe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class zt extends Jde.Shape{constructor(t){super(mfe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(y+=s)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=C2.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(ife,n),this}getWidth(){var t=this.attrs.width===Wl||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Wl||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return C2.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=Qb(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Fp+this.fontVariant()+Fp+(this.fontSize()+lfe)+hfe(this.fontFamily())}_addTextLine(t){this.align()===ed&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return Qb().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,s=this.attrs.height,a=o!==Wl&&o!==void 0,l=s!==Wl&&s!==void 0,u=this.padding(),c=o-u*2,d=s-u*2,f=0,h=this.wrap(),p=h!==p6,m=h!==dfe&&p,_=this.ellipsis();this.textArr=[],Qb().font=this._getContextFont();for(var y=_?this._getTextWidth(Yb):0,v=0,g=t.length;vc)for(;b.length>0;){for(var w=0,x=b.length,T="",P=0;w>>1,A=b.slice(0,E+1),$=this._getTextWidth(A)+y;$<=c?(w=E+1,T=A,P=$):x=E}if(T){if(m){var M,C=b[T.length],O=C===Fp||C===f6;O&&P<=c?M=T.length:M=Math.max(T.lastIndexOf(Fp),T.lastIndexOf(f6))+1,M>0&&(w=M,T=T.slice(0,w),P=this._getTextWidth(T))}T=T.trimRight(),this._addTextLine(T),r=Math.max(r,P),f+=i;var I=this._shouldHandleEllipsis(f);if(I){this._tryToAddEllipsisToLastLine();break}if(b=b.slice(w),b=b.trimLeft(),b.length>0&&(S=this._getTextWidth(b),S<=c)){this._addTextLine(b),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(b),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&vd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Wl&&i!==void 0,s=this.padding(),a=i-s*2,l=this.wrap(),u=l!==p6;return!u||o&&t+r>a}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Wl&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!o)){if(n){var a=this._getTextWidth(s.text+Yb)n?null:td.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=td.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var s=0;s=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${LN}`).join(" "),y6="nodesRect",Cfe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Tfe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const Efe="ontouchstart"in oi.Konva._global;function Pfe(e,t){if(e==="rotater")return"crosshair";t+=Qe.Util.degToRad(Tfe[e]||0);var n=(Qe.Util.radToDeg(t)%360+360)%360;return Qe.Util._inRange(n,315+22.5,360)||Qe.Util._inRange(n,0,22.5)?"ns-resize":Qe.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Qe.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Qe.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Qe.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Qe.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Qe.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Qe.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Qe.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Jm=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],v6=1e8;function Afe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function $N(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function kfe(e,t){const n=Afe(e);return $N(e,t,n)}function Ofe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Qe.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},s=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(s,o),i.on(Cfe.map(a=>a+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,s=i.y-n.y;this.nodes().forEach(a=>{if(a===t||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+o,y:l.y+s}),a.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(y6),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(y6,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),s=t.getAbsolutePosition(r),a=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(oi.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:s.x+a*Math.cos(u)+l*Math.sin(-u),y:s.y+l*Math.cos(u)+a*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return $N(c,-oi.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-v6,y:-v6,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Qe.Transform;r.rotate(-oi.Konva.getAngle(this.rotation()));var i,o,s,a;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:s-i,height:a-o,rotation:oi.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Jm.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new Sfe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Efe?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=oi.Konva.getAngle(this.rotation()),o=Pfe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new _fe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Qe.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),s=o.getStage();s.setPointersPositions(t);const a=s.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let M=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(M-=Math.PI);var f=oi.Konva.getAngle(this.rotation());const C=f+M,O=oi.Konva.getAngle(this.rotationSnapTolerance()),N=Ofe(this.rotationSnaps(),C,O)-d.rotation,R=kfe(d,N);this._fitNodesInto(R,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,y=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*y,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*y,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Qe.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Qe.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var s=new Qe.Transform;if(s.rotate(oi.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=s.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=s.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Qe.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,l=new Qe.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/a,r.height/a);const u=new Qe.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/a,t.height/a);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Qe.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Qe.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Qe.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),s=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:s&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:s&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:s&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:s&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:s&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:s&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Qe.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),m6.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return g6.Node.prototype.toObject.call(this)}clone(t){var n=g6.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Ev.Transformer=ze;function Rfe(e){return e instanceof Array||Qe.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Jm.indexOf(t)===-1&&Qe.Util.warn("Unknown anchor name: "+t+". Available names are: "+Jm.join(", "))}),e||[]}ze.prototype.className="Transformer";(0,wfe._registerNode)(ze);Ye.Factory.addGetterSetter(ze,"enabledAnchors",Jm,Rfe);Ye.Factory.addGetterSetter(ze,"flipEnabled",!0,(0,ua.getBooleanValidator)());Ye.Factory.addGetterSetter(ze,"resizeEnabled",!0);Ye.Factory.addGetterSetter(ze,"anchorSize",10,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"rotateEnabled",!0);Ye.Factory.addGetterSetter(ze,"rotationSnaps",[]);Ye.Factory.addGetterSetter(ze,"rotateAnchorOffset",50,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"rotationSnapTolerance",5,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"borderEnabled",!0);Ye.Factory.addGetterSetter(ze,"anchorStroke","rgb(0, 161, 255)");Ye.Factory.addGetterSetter(ze,"anchorStrokeWidth",1,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"anchorFill","white");Ye.Factory.addGetterSetter(ze,"anchorCornerRadius",0,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"borderStroke","rgb(0, 161, 255)");Ye.Factory.addGetterSetter(ze,"borderStrokeWidth",1,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"borderDash");Ye.Factory.addGetterSetter(ze,"keepRatio",!0);Ye.Factory.addGetterSetter(ze,"shiftBehavior","default");Ye.Factory.addGetterSetter(ze,"centeredScaling",!1);Ye.Factory.addGetterSetter(ze,"ignoreStroke",!1);Ye.Factory.addGetterSetter(ze,"padding",0,(0,ua.getNumberValidator)());Ye.Factory.addGetterSetter(ze,"node");Ye.Factory.addGetterSetter(ze,"nodes");Ye.Factory.addGetterSetter(ze,"boundBoxFunc");Ye.Factory.addGetterSetter(ze,"anchorDragBoundFunc");Ye.Factory.addGetterSetter(ze,"anchorStyleFunc");Ye.Factory.addGetterSetter(ze,"shouldOverdrawWholeArea",!1);Ye.Factory.addGetterSetter(ze,"useSingleNodeRotation",!0);Ye.Factory.backCompat(ze,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Pv={};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.Wedge=void 0;const Av=Te,Mfe=on,Ife=Pe,FN=de,Nfe=Pe;class Yo extends Mfe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,Ife.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Pv.Wedge=Yo;Yo.prototype.className="Wedge";Yo.prototype._centroid=!0;Yo.prototype._attrsAffectingSize=["radius"];(0,Nfe._registerNode)(Yo);Av.Factory.addGetterSetter(Yo,"radius",0,(0,FN.getNumberValidator)());Av.Factory.addGetterSetter(Yo,"angle",0,(0,FN.getNumberValidator)());Av.Factory.addGetterSetter(Yo,"clockwise",!1);Av.Factory.backCompat(Yo,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var kv={};Object.defineProperty(kv,"__esModule",{value:!0});kv.Blur=void 0;const b6=Te,Dfe=St,Lfe=de;function _6(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var $fe=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Ffe=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Bfe(e,t){var n=e.data,r=e.width,i=e.height,o,s,a,l,u,c,d,f,h,p,m,_,y,v,g,b,S,w,x,T,P,E,A,$,M=t+t+1,C=r-1,O=i-1,I=t+1,N=I*(I+1)/2,R=new _6,D=null,L=R,j=null,U=null,G=$fe[t],W=Ffe[t];for(a=1;a>W,A!==0?(A=255/A,n[c]=(f*G>>W)*A,n[c+1]=(h*G>>W)*A,n[c+2]=(p*G>>W)*A):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=y,p-=v,m-=g,_-=j.r,y-=j.g,v-=j.b,g-=j.a,l=d+((l=o+t+1)>W,A>0?(A=255/A,n[l]=(f*G>>W)*A,n[l+1]=(h*G>>W)*A,n[l+2]=(p*G>>W)*A):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=y,p-=v,m-=g,_-=j.r,y-=j.g,v-=j.b,g-=j.a,l=o+((l=s+I)0&&Bfe(t,n)};kv.Blur=jfe;b6.Factory.addGetterSetter(Dfe.Node,"blurRadius",0,(0,Lfe.getNumberValidator)(),b6.Factory.afterSetFilter);var Ov={};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.Brighten=void 0;const S6=Te,Vfe=St,zfe=de,Ufe=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[a]=i,n[a+1]=o,n[a+2]=s};Rv.Contrast=qfe;w6.Factory.addGetterSetter(Gfe.Node,"contrast",0,(0,Hfe.getNumberValidator)(),w6.Factory.afterSetFilter);var Mv={};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.Emboss=void 0;const Ws=Te,Iv=St,Wfe=Ot,BN=de,Kfe=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,s=0,a=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,s=-1;break;case"top":o=-1,s=0;break;case"top-right":o=-1,s=1;break;case"right":o=0,s=1;break;case"bottom-right":o=1,s=1;break;case"bottom":o=1,s=0;break;case"bottom-left":o=1,s=-1;break;case"left":o=0,s=-1;break;default:Wfe.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,y=s;m+y<1&&(y=0),m+y>l&&(y=0);var v=p+(m-1+y)*4,g=a[_]-a[v],b=a[_+1]-a[v+1],S=a[_+2]-a[v+2],w=g,x=w>0?w:-w,T=b>0?b:-b,P=S>0?S:-S;if(T>x&&(w=b),P>x&&(w=S),w*=t,i){var E=a[_]+w,A=a[_+1]+w,$=a[_+2]+w;a[_]=E>255?255:E<0?0:E,a[_+1]=A>255?255:A<0?0:A,a[_+2]=$>255?255:$<0?0:$}else{var M=n-w;M<0?M=0:M>255&&(M=255),a[_]=a[_+1]=a[_+2]=M}}while(--m)}while(--d)};Mv.Emboss=Kfe;Ws.Factory.addGetterSetter(Iv.Node,"embossStrength",.5,(0,BN.getNumberValidator)(),Ws.Factory.afterSetFilter);Ws.Factory.addGetterSetter(Iv.Node,"embossWhiteLevel",.5,(0,BN.getNumberValidator)(),Ws.Factory.afterSetFilter);Ws.Factory.addGetterSetter(Iv.Node,"embossDirection","top-left",null,Ws.Factory.afterSetFilter);Ws.Factory.addGetterSetter(Iv.Node,"embossBlend",!1,null,Ws.Factory.afterSetFilter);var Nv={};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.Enhance=void 0;const x6=Te,Xfe=St,Yfe=de;function e_(e,t,n,r,i){var o=n-t,s=i-r,a;return o===0?r+s/2:s===0?r:(a=(e-t)/o,a=s*a+r,a)}const Qfe=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,s=t[1],a=s,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],la&&(a=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),a===s&&(a=255,s=0),c===u&&(c=255,u=0);var p,m,_,y,v,g,b,S,w;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),v=a+h*(255-a),g=s-h*(s-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),y=(a+s)*.5,v=a+h*(a-y),g=s+h*(s-y),b=(c+u)*.5,S=c+h*(c-b),w=u+h*(u-b)),f=0;fy?_:y;var v=s,g=o,b,S,w=360/g*Math.PI/180,x,T;for(S=0;Sg?v:g;var b=s,S=o,w,x,T=n.polarRotation||0,P,E;for(c=0;ct&&(b=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return s}function fhe(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),s=[],a=0;a=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(s=(n*o+i)*4,a+=b[s+0],l+=b[s+1],u+=b[s+2],c+=b[s+3],g+=1);for(a=a/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(s=(n*o+i)*4,b[s+0]=a,b[s+1]=l,b[s+2]=u,b[s+3]=c)}};zv.Pixelate=_he;P6.Factory.addGetterSetter(vhe.Node,"pixelSize",8,(0,bhe.getNumberValidator)(),P6.Factory.afterSetFilter);var Uv={};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.Posterize=void 0;const A6=Te,She=St,whe=de,xhe=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});ty.Factory.addGetterSetter(DC.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});ty.Factory.addGetterSetter(DC.Node,"blue",0,Che.RGBComponent,ty.Factory.afterSetFilter);var Hv={};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.RGBA=void 0;const jf=Te,qv=St,Ehe=de,Phe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),s=this.alpha(),a,l;for(a=0;a255?255:e<0?0:Math.round(e)});jf.Factory.addGetterSetter(qv.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});jf.Factory.addGetterSetter(qv.Node,"blue",0,Ehe.RGBComponent,jf.Factory.afterSetFilter);jf.Factory.addGetterSetter(qv.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Wv={};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.Sepia=void 0;const Ahe=function(e){var t=e.data,n=t.length,r,i,o,s;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--a)}while(--o)};Kv.Solarize=khe;var Xv={};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.Threshold=void 0;const k6=Te,Ohe=St,Rhe=de,Mhe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),s=new rd.Stage({container:o,width:r,height:i}),a=new rd.Layer,l=new rd.Layer;return a.add(new rd.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new rd.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),s.add(a),s.add(l),o.remove(),s},vpe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d"),a=new Image;if(!s){o.remove(),i("Unable to get context");return}a.onload=function(){s.drawImage(a,0,0),o.remove(),r(s.getImageData(0,0,t,n))},a.src=e}),M6=async(e,t)=>{const n=e.toDataURL(t);return await vpe(n,t.width,t.height)},bpe=async(e,t,n,r,i)=>{const o=fe("canvas"),s=rv(),a=Ole();if(!s||!a){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=s.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await Ym(u,d),h=await M6(u,d),p=await ype(r?e.objects.filter(DR):[],l,i),m=await Ym(p,l),_=await M6(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},_pe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=_pe(e.data),i=Spe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},xpe=e=>aR(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Yv=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=xpe(i),s=t.nodes[lt];if(r&&o.length&&o.length){const a={id:Mp,type:"collect",is_intermediate:!0};t.nodes[Mp]=a,t.edges.push({source:{node_id:Mp,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:_,processorType:y,weight:v}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:_,control_weight:v};if(d&&y!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,s){const b=x0(g,["id","type"]);s.controlnets.push(b)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:Mp,field:"item"}})})}},Tc=(e,t)=>{const{positivePrompt:n,iterations:r,seed:i,shouldRandomizeSeed:o}=e.generation,{combinatorial:s,isEnabled:a,maxPrompts:l}=e.dynamicPrompts,u=t.nodes[lt];if(a){oY(t.nodes[Be],"prompt");const c={id:Gb,type:"dynamic_prompt",is_intermediate:!0,max_prompts:s?l:r,combinatorial:s,prompt:n},d={id:ar,type:"iterate",is_intermediate:!0};if(t.nodes[Gb]=c,t.nodes[ar]=d,t.edges.push({source:{node_id:Gb,field:"prompt_collection"},destination:{node_id:ar,field:"collection"}},{source:{node_id:ar,field:"item"},destination:{node_id:Be,field:"prompt"}}),u&&t.edges.push({source:{node_id:ar,field:"item"},destination:{node_id:lt,field:"positive_prompt"}}),o){const f={id:$i,type:"rand_int",is_intermediate:!0};t.nodes[$i]=f,t.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:$e,field:"seed"}}),u&&t.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:lt,field:"seed"}})}else t.nodes[$e].seed=i,u&&(u.seed=i)}else{u&&(u.positive_prompt=n);const c={id:xo,type:"range_of_size",is_intermediate:!0,size:r,step:1},d={id:ar,type:"iterate",is_intermediate:!0};if(t.nodes[ar]=d,t.nodes[xo]=c,t.edges.push({source:{node_id:xo,field:"collection"},destination:{node_id:ar,field:"collection"}}),t.edges.push({source:{node_id:ar,field:"item"},destination:{node_id:$e,field:"seed"}}),u&&t.edges.push({source:{node_id:ar,field:"item"},destination:{node_id:lt,field:"seed"}}),o){const f={id:$i,type:"rand_int",is_intermediate:!0};t.nodes[$i]=f,t.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:xo,field:"start"}})}else c.start=i}},Nh=(e,t,n,r=qs)=>{const{loras:i}=e.lora,o=gR(i),s=t.nodes[lt];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===qs&&["unet"].includes(u.source.field))&&!(u.source.node_id===gl&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===rt&&["clip"].includes(u.source.field))));let a="",l=0;Za(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${fce}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};s&&s.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:rt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:qe,field:"clip"}})),a=h,l+=1})},zN=Zn(e=>e.ui,e=>OR[e.activeTab],{memoizeOptions:{equalityCheck:w0}}),s4e=Zn(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:w0}}),a4e=Zn(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:w0}}),Cl=(e,t,n=nt)=>{const i=zN(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[lt];if(!o)return;o.is_intermediate=!0;const a={id:pu,type:"img_nsfw",is_intermediate:i};t.nodes[pu]=a,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:pu,field:"image"}}),s&&t.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:pu,field:"metadata"}})},Dh=(e,t,n=qs)=>{const{vae:r}=e.generation,i=!r,o=t.nodes[lt];i||(t.nodes[Jc]={type:"vae_loader",id:Jc,is_intermediate:!0,vae_model:r});const s=n==gl;(t.id===_C||t.id===Qm)&&t.edges.push({source:{node_id:i?n:Jc,field:i&&s?"vae_decoder":"vae"},destination:{node_id:nt,field:"vae"}}),t.id===Qm&&t.edges.push({source:{node_id:i?n:Jc,field:i&&s?"vae_decoder":"vae"},destination:{node_id:vt,field:"vae"}}),t.id===sN&&t.edges.push({source:{node_id:i?n:Jc,field:i&&s?"vae_decoder":"vae"},destination:{node_id:Mi,field:"vae"}}),r&&o&&(o.vae=r)},Tl=(e,t,n=nt)=>{const i=zN(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[pu],a=t.nodes[lt];if(!o)return;const l={id:Zc,type:"img_watermark",is_intermediate:i};t.nodes[Zc]=l,o.is_intermediate=!0,s?(s.is_intermediate=!0,t.edges.push({source:{node_id:pu,field:"image"},destination:{node_id:Zc,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Zc,field:"image"}}),a&&t.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:Zc,field:"metadata"}})},Cpe=(e,t)=>{const n=fe("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,img2imgStrength:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{shouldAutoSave:m}=e.canvas;if(!o)throw n.error("No model found in state"),new Error("No model found in state");const _=f?d:qo.shouldUseCpuNoise,y=o.model_type.includes("onnx"),v=y?gl:qs,g={id:Qm,nodes:{[Be]:{type:y?"prompt_onnx":"compel",id:Be,is_intermediate:!0,prompt:r},[qe]:{type:y?"prompt_onnx":"compel",id:qe,is_intermediate:!0,prompt:i},[$e]:{type:"noise",id:$e,is_intermediate:!0,use_cpu:_},[v]:{type:v,id:v,is_intermediate:!0,model:o},[rt]:{type:"clip_skip",id:rt,is_intermediate:!0,skipped_layers:c},[Wt]:{type:y?"l2l_onnx":"l2l",id:Wt,is_intermediate:!0,cfg_scale:s,scheduler:a,steps:l,strength:u},[vt]:{type:y?"i2l_onnx":"i2l",id:vt,is_intermediate:!0},[nt]:{type:"l2i",id:nt,is_intermediate:!m}},edges:[{source:{node_id:v,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Wt,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:vt,field:"latents"},destination:{node_id:Wt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:Wt,field:"noise"}},{source:{node_id:v,field:"unet"},destination:{node_id:Wt,field:"unet"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Wt,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Wt,field:"positive_conditioning"}}]};if(t.width!==h||t.height!==p){const b={id:Yn,type:"img_resize",image:{image_name:t.image_name},is_intermediate:!0,width:h,height:p};g.nodes[Yn]=b,g.edges.push({source:{node_id:Yn,field:"image"},destination:{node_id:vt,field:"image"}}),g.edges.push({source:{node_id:Yn,field:"width"},destination:{node_id:$e,field:"width"}}),g.edges.push({source:{node_id:Yn,field:"height"},destination:{node_id:$e,field:"height"}})}else g.nodes[vt].image={image_name:t.image_name},g.edges.push({source:{node_id:vt,field:"width"},destination:{node_id:$e,field:"width"}}),g.edges.push({source:{node_id:vt,field:"height"},destination:{node_id:$e,field:"height"}});return g.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:s,height:p,width:h,positive_prompt:"",negative_prompt:i,model:o,seed:0,steps:l,rand_device:_?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],clip_skip:c,strength:u,init_image:t.image_name},Nh(e,g,Wt,v),Dh(e,g,v),Tc(e,g),Yv(e,g,Wt),e.system.shouldUseNSFWChecker&&Cl(e,g),e.system.shouldUseWatermarker&&Tl(e,g),g},Tpe=(e,t,n)=>{const r=fe("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,img2imgStrength:c,shouldFitToWidthHeight:d,iterations:f,seed:h,shouldRandomizeSeed:p,seamSize:m,seamBlur:_,seamSteps:y,seamStrength:v,tileSize:g,infillMethod:b,clipSkip:S}=e.generation;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:w,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:P,shouldAutoSave:E}=e.canvas,A=s.model_type.includes("onnx")?gl:qs,$={id:sN,nodes:{[Mi]:{is_intermediate:!E,type:"inpaint",id:Mi,steps:u,width:w,height:x,cfg_scale:a,scheduler:l,image:{image_name:t.image_name},strength:c,fit:d,mask:{image_name:n.image_name},seam_size:m,seam_blur:_,seam_strength:v,seam_steps:y,tile_size:b==="tile"?g:void 0,infill_method:b,inpaint_width:P!=="none"?T.width:void 0,inpaint_height:P!=="none"?T.height:void 0},[Be]:{type:"compel",id:Be,is_intermediate:!0,prompt:i},[qe]:{type:"compel",id:qe,is_intermediate:!0,prompt:o},[A]:{type:A,id:A,is_intermediate:!0,model:s},[rt]:{type:"clip_skip",id:rt,is_intermediate:!0,skipped_layers:S},[xo]:{type:"range_of_size",id:xo,is_intermediate:!0,size:f,step:1},[ar]:{type:"iterate",id:ar,is_intermediate:!0}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Mi,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Mi,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Mi,field:"positive_conditioning"}},{source:{node_id:xo,field:"collection"},destination:{node_id:ar,field:"collection"}},{source:{node_id:ar,field:"item"},destination:{node_id:Mi,field:"seed"}}]};if(Nh(e,$,Mi),Dh(e,$),p){const M={id:$i,type:"rand_int"};$.nodes[$i]=M,$.edges.push({source:{node_id:$i,field:"a"},destination:{node_id:xo,field:"start"}})}else $.nodes[xo].start=h;return e.system.shouldUseNSFWChecker&&Cl(e,$,Mi),e.system.shouldUseWatermarker&&Tl(e,$,Mi),$},Epe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,clipSkip:l,shouldUseCpuNoise:u,shouldUseNoiseSettings:c}=e.generation,{width:d,height:f}=e.canvas.boundingBoxDimensions,{shouldAutoSave:h}=e.canvas;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const p=c?u:qo.shouldUseCpuNoise,m=i.model_type.includes("onnx"),_=m?gl:qs,y={id:_C,nodes:{[Be]:{type:m?"prompt_onnx":"compel",id:Be,is_intermediate:!0,prompt:n},[qe]:{type:m?"prompt_onnx":"compel",id:qe,is_intermediate:!0,prompt:r},[$e]:{type:"noise",id:$e,is_intermediate:!0,width:d,height:f,use_cpu:p},[cn]:{type:m?"t2l_onnx":"t2l",id:cn,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a},[_]:{type:_,id:_,is_intermediate:!0,model:i},[rt]:{type:"clip_skip",id:rt,is_intermediate:!0,skipped_layers:l},[nt]:{type:m?"l2i_onnx":"l2i",id:nt,is_intermediate:!h}},edges:[{source:{node_id:qe,field:"conditioning"},destination:{node_id:cn,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:cn,field:"positive_conditioning"}},{source:{node_id:_,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:_,field:"unet"},destination:{node_id:cn,field:"unet"}},{source:{node_id:cn,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:cn,field:"noise"}}]};return y.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:f,width:d,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:p?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:l},Nh(e,y,cn,_),Dh(e,y,_),Tc(e,y),Yv(e,y,cn),e.system.shouldUseNSFWChecker&&Cl(e,y),e.system.shouldUseWatermarker&&Tl(e,y),y},Ppe=(e,t,n,r)=>{let i;if(t==="txt2img")i=Epe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");i=Cpe(e,n)}else{if(!n||!r)throw new Error("Missing canvas init and mask images");i=Tpe(e,n,r)}return i},Ape=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),{layerState:s,boundingBoxCoordinates:a,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await bpe(s,a,l,u,c);if(!d){i.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=wpe(h,m);if(o.system.enableImageDebugging){const x=await QE(f),T=await QE(p);vce([{base64:T,caption:"mask b64"},{base64:x,caption:"image b64"}])}i.debug(`Generation mode: ${_}`);let y,v;["img2img","inpaint","outpaint"].includes(_)&&(y=await n(he.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(v=await n(he.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=Ppe(o,_,y,v);i.debug({graph:ia(g)},"Canvas graph built"),n(YI(g));const{requestId:b}=n(kn({graph:g})),[S]=await r(x=>kn.fulfilled.match(x)&&x.meta.requestId===b),w=S.payload.id;["img2img","inpaint"].includes(_)&&y&&n(he.endpoints.changeImageSessionId.initiate({imageDTO:y,session_id:w})),["inpaint"].includes(_)&&v&&n(he.endpoints.changeImageSessionId.initiate({imageDTO:v,session_id:w})),o.canvas.layerState.stagingArea.boundingBox||n(UQ({sessionId:w,boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(GQ(w)),n(pl())}})},kpe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,img2imgStrength:u,shouldFitToWidthHeight:c,width:d,height:f,clipSkip:h,shouldUseCpuNoise:p,shouldUseNoiseSettings:m,vaePrecision:_}=e.generation;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const y=m?p:qo.shouldUseCpuNoise,v=i.model_type.includes("onnx"),g=v?gl:qs,b={id:Qm,nodes:{[g]:{type:g,id:g,model:i},[rt]:{type:"clip_skip",id:rt,skipped_layers:h},[Be]:{type:v?"prompt_onnx":"compel",id:Be,prompt:n},[qe]:{type:v?"prompt_onnx":"compel",id:qe,prompt:r},[$e]:{type:"noise",id:$e,use_cpu:y},[nt]:{type:v?"l2i_onnx":"l2i",id:nt,fp32:_==="fp32"},[Wt]:{type:v?"l2l_onnx":"l2l",id:Wt,cfg_scale:o,scheduler:s,steps:a,strength:u},[vt]:{type:v?"i2l_onnx":"i2l",id:vt,fp32:_==="fp32"}},edges:[{source:{node_id:g,field:"unet"},destination:{node_id:Wt,field:"unet"}},{source:{node_id:g,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Wt,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:vt,field:"latents"},destination:{node_id:Wt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:Wt,field:"noise"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Wt,field:"negative_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Wt,field:"positive_conditioning"}}]};if(c&&(l.width!==d||l.height!==f)){const S={id:Yn,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:d,height:f};b.nodes[Yn]=S,b.edges.push({source:{node_id:Yn,field:"image"},destination:{node_id:vt,field:"image"}}),b.edges.push({source:{node_id:Yn,field:"width"},destination:{node_id:$e,field:"width"}}),b.edges.push({source:{node_id:Yn,field:"height"},destination:{node_id:$e,field:"height"}})}else b.nodes[vt].image={image_name:l.imageName},b.edges.push({source:{node_id:vt,field:"width"},destination:{node_id:$e,field:"width"}}),b.edges.push({source:{node_id:vt,field:"height"},destination:{node_id:$e,field:"height"}});return b.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:f,width:d,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:y?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:h,strength:u,init_image:l.imageName},Nh(e,b,Wt,g),Dh(e,b,g),Tc(e,b),Yv(e,b,Wt),e.system.shouldUseNSFWChecker&&Cl(e,b),e.system.shouldUseWatermarker&&Tl(e,b),b},UN=(e,t,n)=>{const{positivePrompt:r,negativePrompt:i}=e.generation,{refinerModel:o,refinerAestheticScore:s,positiveStylePrompt:a,negativeStylePrompt:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl;if(!o)return;const h=t.nodes[lt];h&&(h.refiner_model=o,h.refiner_aesthetic_store=s,h.refiner_cfg_scale=d,h.refiner_scheduler=c,h.refiner_start=f,h.refiner_steps=u),t.edges=t.edges.filter(p=>!(p.source.node_id===n&&["latents"].includes(p.source.field))),t.edges=t.edges.filter(p=>!(p.source.node_id===Jt&&["vae"].includes(p.source.field))),n===Ii&&t.edges.push({source:{node_id:Jt,field:"vae"},destination:{node_id:vt,field:"vae"}}),t.nodes[Gl]={type:"sdxl_refiner_model_loader",id:Gl,model:o},t.nodes[Ip]={type:"sdxl_refiner_compel_prompt",id:Ip,style:`${r} ${a}`,aesthetic_score:s},t.nodes[Np]={type:"sdxl_refiner_compel_prompt",id:Np,style:`${i} ${l}`,aesthetic_score:s},t.nodes[ya]={type:"l2l_sdxl",id:ya,cfg_scale:d,steps:u/(1-Math.min(f,.99)),scheduler:c,denoising_start:f,denoising_end:1},t.edges.push({source:{node_id:Gl,field:"unet"},destination:{node_id:ya,field:"unet"}},{source:{node_id:Gl,field:"vae"},destination:{node_id:nt,field:"vae"}},{source:{node_id:Gl,field:"clip2"},destination:{node_id:Ip,field:"clip2"}},{source:{node_id:Gl,field:"clip2"},destination:{node_id:Np,field:"clip2"}},{source:{node_id:Ip,field:"conditioning"},destination:{node_id:ya,field:"positive_conditioning"}},{source:{node_id:Np,field:"conditioning"},destination:{node_id:ya,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:ya,field:"latents"}},{source:{node_id:ya,field:"latents"},destination:{node_id:nt,field:"latents"}})},Ope=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,shouldFitToWidthHeight:u,width:c,height:d,clipSkip:f,shouldUseCpuNoise:h,shouldUseNoiseSettings:p,vaePrecision:m}=e.generation,{positiveStylePrompt:_,negativeStylePrompt:y,shouldUseSDXLRefiner:v,refinerStart:g,sdxlImg2ImgDenoisingStrength:b}=e.sdxl;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=p?h:qo.shouldUseCpuNoise,w={id:pce,nodes:{[Jt]:{type:"sdxl_model_loader",id:Jt,model:i},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:_},[qe]:{type:"sdxl_compel_prompt",id:qe,prompt:r,style:y},[$e]:{type:"noise",id:$e,use_cpu:S},[nt]:{type:"l2i",id:nt,fp32:m==="fp32"},[Ii]:{type:"l2l_sdxl",id:Ii,cfg_scale:o,scheduler:s,steps:a,denoising_start:v?Math.min(g,1-b):1-b,denoising_end:v?g:1},[vt]:{type:"i2l",id:vt,fp32:m==="fp32"}},edges:[{source:{node_id:Jt,field:"unet"},destination:{node_id:Ii,field:"unet"}},{source:{node_id:Jt,field:"vae"},destination:{node_id:nt,field:"vae"}},{source:{node_id:Jt,field:"vae"},destination:{node_id:vt,field:"vae"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:qe,field:"clip2"}},{source:{node_id:Ii,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:vt,field:"latents"},destination:{node_id:Ii,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:Ii,field:"noise"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Ii,field:"positive_conditioning"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:Ii,field:"negative_conditioning"}}]};if(u&&(l.width!==c||l.height!==d)){const x={id:Yn,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:c,height:d};w.nodes[Yn]=x,w.edges.push({source:{node_id:Yn,field:"image"},destination:{node_id:vt,field:"image"}}),w.edges.push({source:{node_id:Yn,field:"width"},destination:{node_id:$e,field:"width"}}),w.edges.push({source:{node_id:Yn,field:"height"},destination:{node_id:$e,field:"height"}})}else w.nodes[vt].image={image_name:l.imageName},w.edges.push({source:{node_id:vt,field:"width"},destination:{node_id:$e,field:"width"}}),w.edges.push({source:{node_id:vt,field:"height"},destination:{node_id:$e,field:"height"}});return w.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:d,width:c,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:S?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:f,strength:b,init_image:l.imageName,positive_style_prompt:_,negative_style_prompt:y},w.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:nt,field:"metadata"}}),v&&UN(e,w,Ii),Tc(e,w),e.system.shouldUseNSFWChecker&&Cl(e,w),e.system.shouldUseWatermarker&&Tl(e,w),w},Rpe=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="img2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=Ope(o):a=kpe(o),n(XI(a)),i.debug({graph:ia(a)},"Image to Image graph built"),n(kn({graph:a})),await r(kn.fulfilled.match),n(pl())}})};let Vp;const Mpe=new Uint8Array(16);function Ipe(){if(!Vp&&(Vp=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vp))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vp(Mpe)}const xn=[];for(let e=0;e<256;++e)xn.push((e+256).toString(16).slice(1));function Npe(e,t=0){return(xn[e[t+0]]+xn[e[t+1]]+xn[e[t+2]]+xn[e[t+3]]+"-"+xn[e[t+4]]+xn[e[t+5]]+"-"+xn[e[t+6]]+xn[e[t+7]]+"-"+xn[e[t+8]]+xn[e[t+9]]+"-"+xn[e[t+10]]+xn[e[t+11]]+xn[e[t+12]]+xn[e[t+13]]+xn[e[t+14]]+xn[e[t+15]]).toLowerCase()}const Dpe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),I6={randomUUID:Dpe};function Lpe(e,t,n){if(I6.randomUUID&&!t&&!e)return I6.randomUUID();e=e||{};const r=e.random||(e.rng||Ipe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Npe(r)}const $pe=e=>{if(e.type==="color"&&e.value){const t=Dn(e.value),{r:n,g:r,b:i,a:o}=e.value,s=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a:s}),t}return e.value},Fpe=e=>{const{nodes:t,edges:n}=e.nodes,i=t.filter(a=>a.type!=="progress_image").reduce((a,l)=>{const{id:u,data:c}=l,{type:d,inputs:f}=c,h=$x(f,(m,_,y)=>{const v=$pe(_);return m[y]=v,m},{}),p={type:d,id:u,...h};return Object.assign(a,{[u]:p}),a},{}),o=n.reduce((a,l)=>{const{source:u,target:c,sourceHandle:d,targetHandle:f}=l;return a.push({source:{node_id:u,field:d},destination:{node_id:c,field:f}}),a},[]);return o.forEach(a=>{const l=i[a.destination.node_id],u=a.destination.field;i[a.destination.node_id]=x0(l,u)}),{id:Lpe(),nodes:i,edges:o}},Bpe=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="nodes",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),s=Fpe(o);n(QI(s)),i.debug({graph:ia(s)},"Nodes graph built"),n(kn({graph:s})),await r(kn.fulfilled.match),n(pl())}})},jpe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,vaePrecision:h}=e.generation,{positiveStylePrompt:p,negativeStylePrompt:m,shouldUseSDXLRefiner:_,refinerStart:y}=e.sdxl,v=f?d:qo.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g={id:hce,nodes:{[Jt]:{type:"sdxl_model_loader",id:Jt,model:i},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:p},[qe]:{type:"sdxl_compel_prompt",id:qe,prompt:r,style:m},[$e]:{type:"noise",id:$e,width:l,height:u,use_cpu:v},[rs]:{type:"t2l_sdxl",id:rs,cfg_scale:o,scheduler:s,steps:a,denoising_end:_?y:1},[nt]:{type:"l2i",id:nt,fp32:h==="fp32"}},edges:[{source:{node_id:Jt,field:"unet"},destination:{node_id:rs,field:"unet"}},{source:{node_id:Jt,field:"vae"},destination:{node_id:nt,field:"vae"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Jt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Jt,field:"clip2"},destination:{node_id:qe,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:rs,field:"positive_conditioning"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:rs,field:"negative_conditioning"}},{source:{node_id:$e,field:"noise"},destination:{node_id:rs,field:"noise"}},{source:{node_id:rs,field:"latents"},destination:{node_id:nt,field:"latents"}}]};return g.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:v?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:c,positive_style_prompt:p,negative_style_prompt:m},g.edges.push({source:{node_id:lt,field:"metadata"},destination:{node_id:nt,field:"metadata"}}),_&&UN(e,g,rs),Tc(e,g),e.system.shouldUseNSFWChecker&&Cl(e,g),e.system.shouldUseWatermarker&&Tl(e,g),g},Vpe=e=>{const t=fe("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,vaePrecision:h}=e.generation,p=f?d:qo.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const m=i.model_type.includes("onnx"),_=m?gl:qs,y={id:_C,nodes:{[_]:{type:_,id:_,model:i},[rt]:{type:"clip_skip",id:rt,skipped_layers:c},[Be]:{type:m?"prompt_onnx":"compel",id:Be,prompt:n},[qe]:{type:m?"prompt_onnx":"compel",id:qe,prompt:r},[$e]:{type:"noise",id:$e,width:l,height:u,use_cpu:p},[cn]:{type:m?"t2l_onnx":"t2l",id:cn,cfg_scale:o,scheduler:s,steps:a},[nt]:{type:m?"l2i_onnx":"l2i",id:nt,fp32:h==="fp32"}},edges:[{source:{node_id:_,field:"clip"},destination:{node_id:rt,field:"clip"}},{source:{node_id:_,field:"unet"},destination:{node_id:cn,field:"unet"}},{source:{node_id:rt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:rt,field:"clip"},destination:{node_id:qe,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:cn,field:"positive_conditioning"}},{source:{node_id:qe,field:"conditioning"},destination:{node_id:cn,field:"negative_conditioning"}},{source:{node_id:cn,field:"latents"},destination:{node_id:nt,field:"latents"}},{source:{node_id:$e,field:"noise"},destination:{node_id:cn,field:"noise"}}]};return y.nodes[lt]={id:lt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:p?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:c},Nh(e,y,cn,_),Dh(e,y,_),Tc(e,y),Yv(e,y,cn),e.system.shouldUseNSFWChecker&&Cl(e,y),e.system.shouldUseWatermarker&&Tl(e,y),y},zpe=()=>{le({predicate:e=>Ah.match(e)&&e.payload==="txt2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=fe("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=jpe(o):a=Vpe(o),n(KI(a)),i.debug({graph:ia(a)},"Text to Image graph built"),n(kn({graph:a})),await r(kn.fulfilled.match),n(pl())}})},GN=Xk(),le=GN.startListening;Jle();eue();rue();Hle();qle();Wle();Kle();xle();Zle();Ape();Bpe();zpe();Rpe();Xue();Fle();Dle();Ile();$le();uce();yle();Zue();Jue();tce();nce();ice();Yue();Que();ace();lce();oce();sce();rce();Uue();Gue();Hue();que();Wue();Kue();jue();Vue();zue();Vle();jle();zle();Ule();Yle();Qle();Cle();Nue();Xle();iue();Sle();sue();ble();vle();yce();dce();const Upe={canvas:HQ,gallery:dJ,generation:xQ,nodes:Xse,postprocessing:Yse,system:xae,config:aY,ui:TQ,hotkeys:Pae,controlNet:sJ,boards:cJ,dynamicPrompts:lJ,imageDeletion:gJ,lora:yJ,modelmanager:Eae,sdxl:Jse,[Gs.reducerPath]:Gs.reducer},Gpe=mc(Upe),Hpe=Zae(Gpe),qpe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],Wpe=kk({reducer:Hpe,enhancers:e=>e.concat(Jae(window.localStorage,qpe,{persistDebounce:300,serialize:cle,unserialize:fle,prefix:ele})).concat(Qk()),middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(Gs.middleware).concat(Rae).prepend(GN.middleware),devTools:{actionSanitizer:ple,stateSanitizer:mle,trace:!0,predicate:(e,t)=>!gle.includes(t.type)}}),l4e=e=>e;function Kpe(e){if(e.sheet)return e.sheet;for(var t=0;t0?En(Ec,--br):0,cc--,Kt===10&&(cc=1,Zv--),Kt}function Pr(){return Kt=br2||zf(Kt)>3?"":" "}function age(e,t){for(;--t&&Pr()&&!(Kt<48||Kt>102||Kt>57&&Kt<65||Kt>70&&Kt<97););return Lh(e,xg()+(t<6&&Qi()==32&&Pr()==32))}function E2(e){for(;Pr();)switch(Kt){case e:return br;case 34:case 39:e!==34&&e!==39&&E2(Kt);break;case 40:e===41&&E2(e);break;case 92:Pr();break}return br}function lge(e,t){for(;Pr()&&e+Kt!==47+10;)if(e+Kt===42+42&&Qi()===47)break;return"/*"+Lh(t,br-1)+"*"+Qv(e===47?e:Pr())}function uge(e){for(;!zf(Qi());)Pr();return Lh(e,br)}function cge(e){return YN(Tg("",null,null,null,[""],e=XN(e),0,[0],e))}function Tg(e,t,n,r,i,o,s,a,l){for(var u=0,c=0,d=s,f=0,h=0,p=0,m=1,_=1,y=1,v=0,g="",b=i,S=o,w=r,x=g;_;)switch(p=v,v=Pr()){case 40:if(p!=108&&En(x,d-1)==58){T2(x+=He(Cg(v),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:x+=Cg(v);break;case 9:case 10:case 13:case 32:x+=sge(p);break;case 92:x+=age(xg()-1,7);continue;case 47:switch(Qi()){case 42:case 47:zp(dge(lge(Pr(),xg()),t,n),l);break;default:x+="/"}break;case 123*m:a[u++]=Fi(x)*y;case 125*m:case 59:case 0:switch(v){case 0:case 125:_=0;case 59+c:y==-1&&(x=He(x,/\f/g,"")),h>0&&Fi(x)-d&&zp(h>32?D6(x+";",r,n,d-1):D6(He(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(zp(w=N6(x,t,n,u,c,i,a,g,b=[],S=[],d),o),v===123)if(c===0)Tg(x,t,w,w,b,o,d,a,S);else switch(f===99&&En(x,3)===110?100:f){case 100:case 108:case 109:case 115:Tg(e,w,w,r&&zp(N6(e,w,w,0,0,i,a,g,i,b=[],d),S),i,S,d,a,r?b:S);break;default:Tg(x,w,w,w,[""],S,0,a,S)}}u=c=h=0,m=y=1,g=x="",d=s;break;case 58:d=1+Fi(x),h=p;default:if(m<1){if(v==123)--m;else if(v==125&&m++==0&&oge()==125)continue}switch(x+=Qv(v),v*m){case 38:y=c>0?1:(x+="\f",-1);break;case 44:a[u++]=(Fi(x)-1)*y,y=1;break;case 64:Qi()===45&&(x+=Cg(Pr())),f=Qi(),c=d=Fi(g=x+=uge(xg())),v++;break;case 45:p===45&&Fi(x)==2&&(m=0)}}return o}function N6(e,t,n,r,i,o,s,a,l,u,c){for(var d=i-1,f=i===0?o:[""],h=FC(f),p=0,m=0,_=0;p0?f[y]+" "+v:He(v,/&\f/g,f[y])))&&(l[_++]=g);return Jv(e,t,n,i===0?LC:a,l,u,c)}function dge(e,t,n){return Jv(e,t,n,HN,Qv(ige()),Vf(e,2,-2),0)}function D6(e,t,n,r){return Jv(e,t,n,$C,Vf(e,0,r),Vf(e,r+1,-1),r)}function Fu(e,t){for(var n="",r=FC(e),i=0;i6)switch(En(e,t+1)){case 109:if(En(e,t+4)!==45)break;case 102:return He(e,/(.+:)(.+)-([^]+)/,"$1"+Ge+"$2-$3$1"+ny+(En(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~T2(e,"stretch")?ZN(He(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(En(e,t+1)!==115)break;case 6444:switch(En(e,Fi(e)-3-(~T2(e,"!important")&&10))){case 107:return He(e,":",":"+Ge)+e;case 101:return He(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ge+(En(e,14)===45?"inline-":"")+"box$3$1"+Ge+"$2$3$1"+Nn+"$2box$3")+e}break;case 5936:switch(En(e,t+11)){case 114:return Ge+e+Nn+He(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ge+e+Nn+He(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ge+e+Nn+He(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ge+e+Nn+e+e}return e}var _ge=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case $C:t.return=ZN(t.value,t.length);break;case qN:return Fu([id(t,{value:He(t.value,"@","@"+Ge)})],i);case LC:if(t.length)return rge(t.props,function(o){switch(nge(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fu([id(t,{props:[He(o,/:(read-\w+)/,":"+ny+"$1")]})],i);case"::placeholder":return Fu([id(t,{props:[He(o,/:(plac\w+)/,":"+Ge+"input-$1")]}),id(t,{props:[He(o,/:(plac\w+)/,":"+ny+"$1")]}),id(t,{props:[He(o,/:(plac\w+)/,Nn+"input-$1")]})],i)}return""})}},Sge=[_ge],wge=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||Sge,o={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),y=1;y<_.length;y++)o[_[y]]=!0;a.push(m)});var l,u=[vge,bge];{var c,d=[fge,pge(function(m){c.insert(m)})],f=hge(u.concat(i,d)),h=function(_){return Fu(cge(_),f)};l=function(_,y,v,g){c=v,h(_?_+"{"+y.styles+"}":y.styles),g&&(p.inserted[y.name]=!0)}}var p={key:n,sheet:new Ype({key:n,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(a),p},xge=!0;function Cge(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var JN=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||xge===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},eD=function(t,n,r){JN(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function Tge(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Ege={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Pge=/[A-Z]|^ms/g,Age=/_EMO_([^_]+?)_([^]*?)_EMO_/g,tD=function(t){return t.charCodeAt(1)===45},F6=function(t){return t!=null&&typeof t!="boolean"},t_=QN(function(e){return tD(e)?e:e.replace(Pge,"-$&").toLowerCase()}),B6=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Age,function(r,i,o){return Bi={name:i,styles:o,next:Bi},i})}return Ege[t]!==1&&!tD(t)&&typeof n=="number"&&n!==0?n+"px":n};function Uf(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return Bi={name:n.name,styles:n.styles,next:Bi},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Bi={name:r.name,styles:r.styles,next:Bi},r=r.next;var i=n.styles+";";return i}return kge(e,t,n)}case"function":{if(e!==void 0){var o=Bi,s=n(e);return Bi=o,Uf(e,t,s)}break}}if(t==null)return n;var a=t[n];return a!==void 0?a:n}function kge(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return e}var sD=k.createContext({});sD.displayName="ColorModeContext";function jC(){const e=k.useContext(sD);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function d4e(e,t){const{colorMode:n}=jC();return n==="dark"?t:e}function $ge(){const e=jC(),t=oD();return{...e,theme:t}}function Fge(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__breakpoints)==null?void 0:a.asArray)==null?void 0:l[s]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function Bge(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__cssMap)==null?void 0:a[s])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function f4e(e,t,n){const r=oD();return jge(e,t,n)(r)}function jge(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const s=i.filter(Boolean),a=r.map((l,u)=>{var c,d;if(e==="breakpoints")return Fge(o,l,(c=s[u])!=null?c:l);const f=`${e}.${l}`;return Bge(o,f,(d=s[u])!=null?d:l)});return Array.isArray(t)?a:a[0]}}var aD=(...e)=>e.filter(Boolean).join(" ");function Vge(){return!1}function Ro(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var h4e=e=>{const{condition:t,message:n}=e;t&&Vge()&&console.warn(n)};function Da(e,...t){return zge(e)?e(...t):e}var zge=e=>typeof e=="function",p4e=e=>e?"":void 0,g4e=e=>e?!0:void 0;function m4e(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function y4e(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var ry={exports:{}};ry.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",y="[object Null]",v="[object Object]",g="[object Proxy]",b="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",T="[object WeakMap]",P="[object ArrayBuffer]",E="[object DataView]",A="[object Float32Array]",$="[object Float64Array]",M="[object Int8Array]",C="[object Int16Array]",O="[object Int32Array]",I="[object Uint8Array]",N="[object Uint8ClampedArray]",R="[object Uint16Array]",D="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[A]=G[$]=G[M]=G[C]=G[O]=G[I]=G[N]=G[R]=G[D]=!0,G[a]=G[l]=G[P]=G[c]=G[E]=G[d]=G[f]=G[h]=G[m]=G[_]=G[v]=G[b]=G[S]=G[w]=G[T]=!1;var W=typeof Ee=="object"&&Ee&&Ee.Object===Object&&Ee,X=typeof self=="object"&&self&&self.Object===Object&&self,Y=W||X||Function("return this")(),B=t&&!t.nodeType&&t,H=B&&!0&&e&&!e.nodeType&&e,Q=H&&H.exports===B,J=Q&&W.process,ne=function(){try{var F=H&&H.require&&H.require("util").types;return F||J&&J.binding&&J.binding("util")}catch{}}(),te=ne&&ne.isTypedArray;function xe(F,V,q){switch(q.length){case 0:return F.call(V);case 1:return F.call(V,q[0]);case 2:return F.call(V,q[0],q[1]);case 3:return F.call(V,q[0],q[1],q[2])}return F.apply(V,q)}function ve(F,V){for(var q=-1,ie=Array(F);++q-1}function co(F,V){var q=this.__data__,ie=Ol(q,F);return ie<0?(++this.size,q.push([F,V])):q[ie][1]=V,this}Sn.prototype.clear=uo,Sn.prototype.delete=Qo,Sn.prototype.get=Zo,Sn.prototype.has=kl,Sn.prototype.set=co;function Hn(F){var V=-1,q=F==null?0:F.length;for(this.clear();++V1?q[De-1]:void 0,gt=De>2?q[2]:void 0;for(tt=F.length>3&&typeof tt=="function"?(De--,tt):void 0,gt&&U$(q[0],q[1],gt)&&(tt=De<3?void 0:tt,De=1),V=Object(V);++ie-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function Q$(F){if(F!=null){try{return Je.call(F)}catch{}try{return F+""}catch{}}return""}function Xh(F,V){return F===V||F!==F&&V!==V}var k1=Wh(function(){return arguments}())?Wh:function(F){return Mc(F)&&Ut.call(F,"callee")&&!ni.call(F,"callee")},O1=Array.isArray;function R1(F){return F!=null&&O3(F.length)&&!M1(F)}function Z$(F){return Mc(F)&&R1(F)}var k3=da||rF;function M1(F){if(!pa(F))return!1;var V=Ml(F);return V==h||V==p||V==u||V==g}function O3(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=s}function pa(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Mc(F){return F!=null&&typeof F=="object"}function J$(F){if(!Mc(F)||Ml(F)!=v)return!1;var V=Sr(F);if(V===null)return!0;var q=Ut.call(V,"constructor")&&V.constructor;return typeof q=="function"&&q instanceof q&&Je.call(q)==Dr}var R3=te?ce(te):Rc;function eF(F){return F$(F,M3(F))}function M3(F){return R1(F)?x1(F,!0):O$(F)}var tF=B$(function(F,V,q,ie){E3(F,V,q,ie)});function nF(F){return function(){return F}}function I3(F){return F}function rF(){return!1}e.exports=tF})(ry,ry.exports);var Uge=ry.exports;const qi=ll(Uge);var Gge=e=>/!(important)?$/.test(e),z6=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,Hge=(e,t)=>n=>{const r=String(t),i=Gge(r),o=z6(r),s=e?`${e}.${o}`:o;let a=Ro(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:t;return a=z6(a),i?`${a} !important`:a};function VC(e){const{scale:t,transform:n,compose:r}=e;return(o,s)=>{var a;const l=Hge(t,o)(s);let u=(a=n==null?void 0:n(l,s))!=null?a:l;return r&&(u=r(u,s)),u}}var Up=(...e)=>t=>e.reduce((n,r)=>r(n),t);function Br(e,t){return n=>{const r={property:n,scale:e};return r.transform=VC({scale:e,transform:t}),r}}var qge=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function Wge(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:qge(t),transform:n?VC({scale:n,compose:r}):r}}var lD=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function Kge(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...lD].join(" ")}function Xge(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...lD].join(" ")}var Yge={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},Qge={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function Zge(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Jge={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},P2={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},eme=new Set(Object.values(P2)),A2=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),tme=e=>e.trim();function nme(e,t){if(e==null||A2.has(e))return e;if(!(k2(e)||A2.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],s=i==null?void 0:i[2];if(!o||!s)return e;const a=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=s.split(",").map(tme).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in P2?P2[l]:l;u.unshift(c);const d=u.map(f=>{if(eme.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=k2(m)?m:m&&m.split(" "),y=`colors.${p}`,v=y in t.__cssMap?t.__cssMap[y].varRef:p;return _?[v,...Array.isArray(_)?_:[_]].join(" "):v});return`${a}(${d.join(", ")})`}var k2=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),rme=(e,t)=>nme(e,t??{});function ime(e){return/^var\(--.+\)$/.test(e)}var ome=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},Ri=e=>t=>`${e}(${t})`,je={filter(e){return e!=="auto"?e:Yge},backdropFilter(e){return e!=="auto"?e:Qge},ring(e){return Zge(je.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?Kge():e==="auto-gpu"?Xge():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=ome(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(ime(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:rme,blur:Ri("blur"),opacity:Ri("opacity"),brightness:Ri("brightness"),contrast:Ri("contrast"),dropShadow:Ri("drop-shadow"),grayscale:Ri("grayscale"),hueRotate:Ri("hue-rotate"),invert:Ri("invert"),saturate:Ri("saturate"),sepia:Ri("sepia"),bgImage(e){return e==null||k2(e)||A2.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=Jge[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},z={borderWidths:Br("borderWidths"),borderStyles:Br("borderStyles"),colors:Br("colors"),borders:Br("borders"),gradients:Br("gradients",je.gradient),radii:Br("radii",je.px),space:Br("space",Up(je.vh,je.px)),spaceT:Br("space",Up(je.vh,je.px)),degreeT(e){return{property:e,transform:je.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:VC({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:Br("sizes",Up(je.vh,je.px)),sizesT:Br("sizes",Up(je.vh,je.fraction)),shadows:Br("shadows"),logical:Wge,blur:Br("blur",je.blur)},Eg={background:z.colors("background"),backgroundColor:z.colors("backgroundColor"),backgroundImage:z.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:je.bgClip},bgSize:z.prop("backgroundSize"),bgPosition:z.prop("backgroundPosition"),bg:z.colors("background"),bgColor:z.colors("backgroundColor"),bgPos:z.prop("backgroundPosition"),bgRepeat:z.prop("backgroundRepeat"),bgAttachment:z.prop("backgroundAttachment"),bgGradient:z.gradients("backgroundImage"),bgClip:{transform:je.bgClip}};Object.assign(Eg,{bgImage:Eg.backgroundImage,bgImg:Eg.backgroundImage});var Ue={border:z.borders("border"),borderWidth:z.borderWidths("borderWidth"),borderStyle:z.borderStyles("borderStyle"),borderColor:z.colors("borderColor"),borderRadius:z.radii("borderRadius"),borderTop:z.borders("borderTop"),borderBlockStart:z.borders("borderBlockStart"),borderTopLeftRadius:z.radii("borderTopLeftRadius"),borderStartStartRadius:z.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:z.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:z.radii("borderTopRightRadius"),borderStartEndRadius:z.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:z.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:z.borders("borderRight"),borderInlineEnd:z.borders("borderInlineEnd"),borderBottom:z.borders("borderBottom"),borderBlockEnd:z.borders("borderBlockEnd"),borderBottomLeftRadius:z.radii("borderBottomLeftRadius"),borderBottomRightRadius:z.radii("borderBottomRightRadius"),borderLeft:z.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:z.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:z.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:z.borders(["borderLeft","borderRight"]),borderInline:z.borders("borderInline"),borderY:z.borders(["borderTop","borderBottom"]),borderBlock:z.borders("borderBlock"),borderTopWidth:z.borderWidths("borderTopWidth"),borderBlockStartWidth:z.borderWidths("borderBlockStartWidth"),borderTopColor:z.colors("borderTopColor"),borderBlockStartColor:z.colors("borderBlockStartColor"),borderTopStyle:z.borderStyles("borderTopStyle"),borderBlockStartStyle:z.borderStyles("borderBlockStartStyle"),borderBottomWidth:z.borderWidths("borderBottomWidth"),borderBlockEndWidth:z.borderWidths("borderBlockEndWidth"),borderBottomColor:z.colors("borderBottomColor"),borderBlockEndColor:z.colors("borderBlockEndColor"),borderBottomStyle:z.borderStyles("borderBottomStyle"),borderBlockEndStyle:z.borderStyles("borderBlockEndStyle"),borderLeftWidth:z.borderWidths("borderLeftWidth"),borderInlineStartWidth:z.borderWidths("borderInlineStartWidth"),borderLeftColor:z.colors("borderLeftColor"),borderInlineStartColor:z.colors("borderInlineStartColor"),borderLeftStyle:z.borderStyles("borderLeftStyle"),borderInlineStartStyle:z.borderStyles("borderInlineStartStyle"),borderRightWidth:z.borderWidths("borderRightWidth"),borderInlineEndWidth:z.borderWidths("borderInlineEndWidth"),borderRightColor:z.colors("borderRightColor"),borderInlineEndColor:z.colors("borderInlineEndColor"),borderRightStyle:z.borderStyles("borderRightStyle"),borderInlineEndStyle:z.borderStyles("borderInlineEndStyle"),borderTopRadius:z.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:z.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:z.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:z.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(Ue,{rounded:Ue.borderRadius,roundedTop:Ue.borderTopRadius,roundedTopLeft:Ue.borderTopLeftRadius,roundedTopRight:Ue.borderTopRightRadius,roundedTopStart:Ue.borderStartStartRadius,roundedTopEnd:Ue.borderStartEndRadius,roundedBottom:Ue.borderBottomRadius,roundedBottomLeft:Ue.borderBottomLeftRadius,roundedBottomRight:Ue.borderBottomRightRadius,roundedBottomStart:Ue.borderEndStartRadius,roundedBottomEnd:Ue.borderEndEndRadius,roundedLeft:Ue.borderLeftRadius,roundedRight:Ue.borderRightRadius,roundedStart:Ue.borderInlineStartRadius,roundedEnd:Ue.borderInlineEndRadius,borderStart:Ue.borderInlineStart,borderEnd:Ue.borderInlineEnd,borderTopStartRadius:Ue.borderStartStartRadius,borderTopEndRadius:Ue.borderStartEndRadius,borderBottomStartRadius:Ue.borderEndStartRadius,borderBottomEndRadius:Ue.borderEndEndRadius,borderStartRadius:Ue.borderInlineStartRadius,borderEndRadius:Ue.borderInlineEndRadius,borderStartWidth:Ue.borderInlineStartWidth,borderEndWidth:Ue.borderInlineEndWidth,borderStartColor:Ue.borderInlineStartColor,borderEndColor:Ue.borderInlineEndColor,borderStartStyle:Ue.borderInlineStartStyle,borderEndStyle:Ue.borderInlineEndStyle});var sme={color:z.colors("color"),textColor:z.colors("color"),fill:z.colors("fill"),stroke:z.colors("stroke")},O2={boxShadow:z.shadows("boxShadow"),mixBlendMode:!0,blendMode:z.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:z.prop("backgroundBlendMode"),opacity:!0};Object.assign(O2,{shadow:O2.boxShadow});var ame={filter:{transform:je.filter},blur:z.blur("--chakra-blur"),brightness:z.propT("--chakra-brightness",je.brightness),contrast:z.propT("--chakra-contrast",je.contrast),hueRotate:z.degreeT("--chakra-hue-rotate"),invert:z.propT("--chakra-invert",je.invert),saturate:z.propT("--chakra-saturate",je.saturate),dropShadow:z.propT("--chakra-drop-shadow",je.dropShadow),backdropFilter:{transform:je.backdropFilter},backdropBlur:z.blur("--chakra-backdrop-blur"),backdropBrightness:z.propT("--chakra-backdrop-brightness",je.brightness),backdropContrast:z.propT("--chakra-backdrop-contrast",je.contrast),backdropHueRotate:z.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:z.propT("--chakra-backdrop-invert",je.invert),backdropSaturate:z.propT("--chakra-backdrop-saturate",je.saturate)},iy={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:je.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:z.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:z.space("gap"),rowGap:z.space("rowGap"),columnGap:z.space("columnGap")};Object.assign(iy,{flexDir:iy.flexDirection});var uD={gridGap:z.space("gridGap"),gridColumnGap:z.space("gridColumnGap"),gridRowGap:z.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},lme={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:je.outline},outlineOffset:!0,outlineColor:z.colors("outlineColor")},Vr={width:z.sizesT("width"),inlineSize:z.sizesT("inlineSize"),height:z.sizes("height"),blockSize:z.sizes("blockSize"),boxSize:z.sizes(["width","height"]),minWidth:z.sizes("minWidth"),minInlineSize:z.sizes("minInlineSize"),minHeight:z.sizes("minHeight"),minBlockSize:z.sizes("minBlockSize"),maxWidth:z.sizes("maxWidth"),maxInlineSize:z.sizes("maxInlineSize"),maxHeight:z.sizes("maxHeight"),maxBlockSize:z.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:z.propT("float",je.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(Vr,{w:Vr.width,h:Vr.height,minW:Vr.minWidth,maxW:Vr.maxWidth,minH:Vr.minHeight,maxH:Vr.maxHeight,overscroll:Vr.overscrollBehavior,overscrollX:Vr.overscrollBehaviorX,overscrollY:Vr.overscrollBehaviorY});var ume={listStyleType:!0,listStylePosition:!0,listStylePos:z.prop("listStylePosition"),listStyleImage:!0,listStyleImg:z.prop("listStyleImage")};function cme(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},fme=dme(cme),hme={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},pme={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},n_=(e,t,n)=>{const r={},i=fme(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},gme={srOnly:{transform(e){return e===!0?hme:e==="focusable"?pme:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>n_(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>n_(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>n_(t,e,n)}},Rd={position:!0,pos:z.prop("position"),zIndex:z.prop("zIndex","zIndices"),inset:z.spaceT("inset"),insetX:z.spaceT(["left","right"]),insetInline:z.spaceT("insetInline"),insetY:z.spaceT(["top","bottom"]),insetBlock:z.spaceT("insetBlock"),top:z.spaceT("top"),insetBlockStart:z.spaceT("insetBlockStart"),bottom:z.spaceT("bottom"),insetBlockEnd:z.spaceT("insetBlockEnd"),left:z.spaceT("left"),insetInlineStart:z.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:z.spaceT("right"),insetInlineEnd:z.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Rd,{insetStart:Rd.insetInlineStart,insetEnd:Rd.insetInlineEnd});var mme={ring:{transform:je.ring},ringColor:z.colors("--chakra-ring-color"),ringOffset:z.prop("--chakra-ring-offset-width"),ringOffsetColor:z.colors("--chakra-ring-offset-color"),ringInset:z.prop("--chakra-ring-inset")},dt={margin:z.spaceT("margin"),marginTop:z.spaceT("marginTop"),marginBlockStart:z.spaceT("marginBlockStart"),marginRight:z.spaceT("marginRight"),marginInlineEnd:z.spaceT("marginInlineEnd"),marginBottom:z.spaceT("marginBottom"),marginBlockEnd:z.spaceT("marginBlockEnd"),marginLeft:z.spaceT("marginLeft"),marginInlineStart:z.spaceT("marginInlineStart"),marginX:z.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:z.spaceT("marginInline"),marginY:z.spaceT(["marginTop","marginBottom"]),marginBlock:z.spaceT("marginBlock"),padding:z.space("padding"),paddingTop:z.space("paddingTop"),paddingBlockStart:z.space("paddingBlockStart"),paddingRight:z.space("paddingRight"),paddingBottom:z.space("paddingBottom"),paddingBlockEnd:z.space("paddingBlockEnd"),paddingLeft:z.space("paddingLeft"),paddingInlineStart:z.space("paddingInlineStart"),paddingInlineEnd:z.space("paddingInlineEnd"),paddingX:z.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:z.space("paddingInline"),paddingY:z.space(["paddingTop","paddingBottom"]),paddingBlock:z.space("paddingBlock")};Object.assign(dt,{m:dt.margin,mt:dt.marginTop,mr:dt.marginRight,me:dt.marginInlineEnd,marginEnd:dt.marginInlineEnd,mb:dt.marginBottom,ml:dt.marginLeft,ms:dt.marginInlineStart,marginStart:dt.marginInlineStart,mx:dt.marginX,my:dt.marginY,p:dt.padding,pt:dt.paddingTop,py:dt.paddingY,px:dt.paddingX,pb:dt.paddingBottom,pl:dt.paddingLeft,ps:dt.paddingInlineStart,paddingStart:dt.paddingInlineStart,pr:dt.paddingRight,pe:dt.paddingInlineEnd,paddingEnd:dt.paddingInlineEnd});var yme={textDecorationColor:z.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:z.shadows("textShadow")},vme={clipPath:!0,transform:z.propT("transform",je.transform),transformOrigin:!0,translateX:z.spaceT("--chakra-translate-x"),translateY:z.spaceT("--chakra-translate-y"),skewX:z.degreeT("--chakra-skew-x"),skewY:z.degreeT("--chakra-skew-y"),scaleX:z.prop("--chakra-scale-x"),scaleY:z.prop("--chakra-scale-y"),scale:z.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:z.degreeT("--chakra-rotate")},bme={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:z.prop("transitionDuration","transition.duration"),transitionProperty:z.prop("transitionProperty","transition.property"),transitionTimingFunction:z.prop("transitionTimingFunction","transition.easing")},_me={fontFamily:z.prop("fontFamily","fonts"),fontSize:z.prop("fontSize","fontSizes",je.px),fontWeight:z.prop("fontWeight","fontWeights"),lineHeight:z.prop("lineHeight","lineHeights"),letterSpacing:z.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},Sme={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:z.spaceT("scrollMargin"),scrollMarginTop:z.spaceT("scrollMarginTop"),scrollMarginBottom:z.spaceT("scrollMarginBottom"),scrollMarginLeft:z.spaceT("scrollMarginLeft"),scrollMarginRight:z.spaceT("scrollMarginRight"),scrollMarginX:z.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:z.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:z.spaceT("scrollPadding"),scrollPaddingTop:z.spaceT("scrollPaddingTop"),scrollPaddingBottom:z.spaceT("scrollPaddingBottom"),scrollPaddingLeft:z.spaceT("scrollPaddingLeft"),scrollPaddingRight:z.spaceT("scrollPaddingRight"),scrollPaddingX:z.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:z.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function cD(e){return Ro(e)&&e.reference?e.reference:String(e)}var e1=(e,...t)=>t.map(cD).join(` ${e} `).replace(/calc/g,""),U6=(...e)=>`calc(${e1("+",...e)})`,G6=(...e)=>`calc(${e1("-",...e)})`,R2=(...e)=>`calc(${e1("*",...e)})`,H6=(...e)=>`calc(${e1("/",...e)})`,q6=e=>{const t=cD(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:R2(t,-1)},Aa=Object.assign(e=>({add:(...t)=>Aa(U6(e,...t)),subtract:(...t)=>Aa(G6(e,...t)),multiply:(...t)=>Aa(R2(e,...t)),divide:(...t)=>Aa(H6(e,...t)),negate:()=>Aa(q6(e)),toString:()=>e.toString()}),{add:U6,subtract:G6,multiply:R2,divide:H6,negate:q6});function wme(e,t="-"){return e.replace(/\s+/g,t)}function xme(e){const t=wme(e.toString());return Tme(Cme(t))}function Cme(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function Tme(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function Eme(e,t=""){return[t,e].filter(Boolean).join("-")}function Pme(e,t){return`var(${e}${t?`, ${t}`:""})`}function Ame(e,t=""){return xme(`--${Eme(e,t)}`)}function M2(e,t,n){const r=Ame(e,n);return{variable:r,reference:Pme(r,t)}}function v4e(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=M2(`${e}-${i}`,o);continue}n[r]=M2(`${e}-${r}`)}return n}function kme(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function Ome(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function I2(e){if(e==null)return e;const{unitless:t}=Ome(e);return t||typeof e=="number"?`${e}px`:e}var dD=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,zC=e=>Object.fromEntries(Object.entries(e).sort(dD));function W6(e){const t=zC(e);return Object.assign(Object.values(t),t)}function Rme(e){const t=Object.keys(zC(e));return new Set(t)}function K6(e){var t;if(!e)return e;e=(t=I2(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function gd(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${I2(e)})`),t&&n.push("and",`(max-width: ${I2(t)})`),n.join(" ")}function Mme(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=W6(e),r=Object.entries(e).sort(dD).map(([s,a],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?K6(d):void 0,{_minW:K6(a),breakpoint:s,minW:a,maxW:d,maxWQuery:gd(null,d),minWQuery:gd(a),minMaxQuery:gd(a,d)}}),i=Rme(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const a=Object.keys(s);return a.length>0&&a.every(l=>i.has(l))},asObject:zC(e),asArray:W6(e),details:r,get(s){return r.find(a=>a.breakpoint===s)},media:[null,...n.map(s=>gd(s)).slice(1)],toArrayValue(s){if(!Ro(s))throw new Error("toArrayValue: value must be an object");const a=o.map(l=>{var u;return(u=s[l])!=null?u:null});for(;kme(a)===null;)a.pop();return a},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((a,l,u)=>{const c=o[u];return c!=null&&l!=null&&(a[c]=l),a},{})}}}var wn={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},is=e=>fD(t=>e(t,"&"),"[role=group]","[data-group]",".group"),go=e=>fD(t=>e(t,"~ &"),"[data-peer]",".peer"),fD=(e,...t)=>t.map(e).join(", "),t1={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:is(wn.hover),_peerHover:go(wn.hover),_groupFocus:is(wn.focus),_peerFocus:go(wn.focus),_groupFocusVisible:is(wn.focusVisible),_peerFocusVisible:go(wn.focusVisible),_groupActive:is(wn.active),_peerActive:go(wn.active),_groupDisabled:is(wn.disabled),_peerDisabled:go(wn.disabled),_groupInvalid:is(wn.invalid),_peerInvalid:go(wn.invalid),_groupChecked:is(wn.checked),_peerChecked:go(wn.checked),_groupFocusWithin:is(wn.focusWithin),_peerFocusWithin:go(wn.focusWithin),_peerPlaceholderShown:go(wn.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},hD=Object.keys(t1);function X6(e,t){return M2(String(e).replace(/\./g,"-"),void 0,t)}function Ime(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:s,value:a}=o,{variable:l,reference:u}=X6(i,t==null?void 0:t.cssVarPrefix);if(!s){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Aa.negate(a),y=Aa.negate(u);r[m]={value:_,var:l,varRef:y}}n[l]=a,r[i]={value:a,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=X6(p,t==null?void 0:t.cssVarPrefix);return _},d=Ro(a)?a:{default:a};n=qi(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const y=c(`${p}`);if(h==="default")return f[l]=y,f;const v=(_=(m=t1)==null?void 0:m[h])!=null?_:h;return f[v]={[l]:y},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function Nme(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function Dme(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Lme(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Y6(e,t,n={}){const{stop:r,getKey:i}=n;function o(s,a=[]){var l;if(Lme(s)||Array.isArray(s)){const u={};for(const[c,d]of Object.entries(s)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...a,f];if(r!=null&&r(s,h))return t(s,a);u[f]=o(d,h)}return u}return t(s,a)}return o(e)}var $me=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function Fme(e){return Dme(e,$me)}function Bme(e){return e.semanticTokens}function jme(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var Vme=e=>hD.includes(e)||e==="default";function zme({tokens:e,semanticTokens:t}){const n={};return Y6(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),Y6(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(Vme)}),n}function b4e(e){var t;const n=jme(e),r=Fme(n),i=Bme(n),o=zme({tokens:r,semanticTokens:i}),s=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:a,cssVars:l}=Ime(o,{cssVarPrefix:s});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:a,__breakpoints:Mme(n.breakpoints)}),n}var UC=qi({},Eg,Ue,sme,iy,Vr,ame,mme,lme,uD,gme,Rd,O2,dt,Sme,_me,yme,vme,ume,bme),Ume=Object.assign({},dt,Vr,iy,uD,Rd),_4e=Object.keys(Ume),Gme=[...Object.keys(UC),...hD],Hme={...UC,...t1},qme=e=>e in Hme,Wme=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const s in e){let a=Da(e[s],t);if(a==null)continue;if(a=Ro(a)&&n(a)?r(a):a,!Array.isArray(a)){o[s]=a;continue}const l=a.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!Xme(t),Qme=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[s,a]=Kme(t);return t=(r=(n=i(s))!=null?n:o(a))!=null?r:o(t),t};function Zme(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,s=!1)=>{var a,l,u;const c=Da(o,r),d=Wme(c)(r);let f={};for(let h in d){const p=d[h];let m=Da(p,r);h in n&&(h=n[h]),Yme(h,m)&&(m=Qme(r,m));let _=t[h];if(_===!0&&(_={property:h}),Ro(m)){f[h]=(a=f[h])!=null?a:{},f[h]=qi({},f[h],i(m,!0));continue}let y=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;y=_!=null&&_.processResult?i(y,!0):y;const v=Da(_==null?void 0:_.property,r);if(!s&&(_!=null&&_.static)){const g=Da(_.static,r);f=qi({},f,g)}if(v&&Array.isArray(v)){for(const g of v)f[g]=y;continue}if(v){v==="&"&&Ro(y)?f=qi({},f,y):f[v]=y;continue}if(Ro(y)){f=qi({},f,y);continue}f[h]=y}return f};return i}var Jme=e=>t=>Zme({theme:t,pseudos:t1,configs:UC})(e);function S4e(e){return e}function w4e(e){return e}function x4e(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function eye(e,t){if(Array.isArray(e))return e;if(Ro(e))return t(e);if(e!=null)return[e]}function tye(e,t){for(let n=t+1;n{qi(u,{[g]:f?v[g]:{[y]:v[g]}})});continue}if(!h){f?qi(u,v):u[y]=v;continue}u[y]=v}}return u}}function rye(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,s=nye(o);return qi({},Da((n=e.baseStyle)!=null?n:{},t),s(e,"sizes",i,t),s(e,"variants",r,t))}}function C4e(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function pD(e){return Nme(e,["styleConfig","size","variant","colorScheme"])}function iye(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function T4e(e){var t;return iye(e)&&(t=e.ownerDocument)!=null?t:document}function oye(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var sye=oye();function aye(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function lye(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},cye=uye(lye);function gD(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var mD=e=>gD(e,t=>t!=null);function dye(e){return typeof e=="function"}function fye(e,...t){return dye(e)?e(...t):e}function hye(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var pye=typeof Element<"u",gye=typeof Map=="function",mye=typeof Set=="function",yye=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Pg(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Pg(e[r],t[r]))return!1;return!0}var o;if(gye&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!Pg(r.value[1],t.get(r.value[0])))return!1;return!0}if(mye&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(yye&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(pye&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!Pg(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var vye=function(t,n){try{return Pg(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const bye=ll(vye);function yD(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:s}=$ge(),a=e?cye(o,`components.${e}`):void 0,l=r||a,u=qi({theme:o,colorMode:s},(n=l==null?void 0:l.defaultProps)!=null?n:{},mD(aye(i,["children"]))),c=k.useRef({});if(l){const f=rye(l)(u);bye(c.current,f)||(c.current=f)}return c.current}function vD(e,t={}){return yD(e,t)}function E4e(e,t={}){return yD(e,t)}var _ye=new Set([...Gme,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Sye=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function wye(e){return Sye.has(e)||!_ye.has(e)}function xye(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var Cye=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Tye=QN(function(e){return Cye.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),Eye=Tye,Pye=function(t){return t!=="theme"},Q6=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?Eye:Pye},Z6=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(s){return t.__emotion_forwardProp(s)&&o(s)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},Aye=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return JN(n,r,i),Rge(function(){return eD(n,r,i)}),null},kye=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,s;n!==void 0&&(o=n.label,s=n.target);var a=Z6(t,n,r),l=a||Q6(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...s}=t,a=gD(s,(d,f)=>qme(f)),l=fye(e,t),u=xye({},i,l,mD(a),o),c=Jme(u)(t.theme);return r?[c,r]:c};function r_(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=wye);const i=Mye({baseStyle:n}),o=Rye(e,r)(i);return We.forwardRef(function(l,u){const{colorMode:c,forced:d}=jC();return We.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function Iye(){const e=new Map;return new Proxy(r_,{apply(t,n,r){return r_(...r)},get(t,n){return e.has(n)||e.set(n,r_(n)),e.get(n)}})}var al=Iye();function El(e){return k.forwardRef(e)}const bD=k.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),n1=k.createContext({}),$h=k.createContext(null),r1=typeof document<"u",sy=r1?k.useLayoutEffect:k.useEffect,_D=k.createContext({strict:!1});function Nye(e,t,n,r){const{visualElement:i}=k.useContext(n1),o=k.useContext(_D),s=k.useContext($h),a=k.useContext(bD).reducedMotion,l=k.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;return k.useInsertionEffect(()=>{u&&u.update(n,s)}),sy(()=>{u&&u.render()}),k.useEffect(()=>{u&&u.updateFeatures()}),(window.HandoffAppearAnimations?sy:k.useEffect)(()=>{u&&u.animationState&&u.animationState.animateChanges()}),u}function gu(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Dye(e,t,n){return k.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gu(n)&&(n.current=r))},[t])}function Hf(e){return typeof e=="string"||Array.isArray(e)}function i1(e){return typeof e=="object"&&typeof e.start=="function"}const GC=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],HC=["initial",...GC];function o1(e){return i1(e.animate)||HC.some(t=>Hf(e[t]))}function SD(e){return!!(o1(e)||e.variants)}function Lye(e,t){if(o1(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Hf(n)?n:void 0,animate:Hf(r)?r:void 0}}return e.inherit!==!1?t:{}}function $ye(e){const{initial:t,animate:n}=Lye(e,k.useContext(n1));return k.useMemo(()=>({initial:t,animate:n}),[e8(t),e8(n)])}function e8(e){return Array.isArray(e)?e.join(" "):e}const t8={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},qf={};for(const e in t8)qf[e]={isEnabled:t=>t8[e].some(n=>!!t[n])};function Fye(e){for(const t in e)qf[t]={...qf[t],...e[t]}}const qC=k.createContext({}),wD=k.createContext({}),Bye=Symbol.for("motionComponentSymbol");function jye({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&Fye(e);function o(a,l){let u;const c={...k.useContext(bD),...a,layoutId:Vye(a)},{isStatic:d}=c,f=$ye(a),h=r(a,d);if(!d&&r1){f.visualElement=Nye(i,h,c,t);const p=k.useContext(wD),m=k.useContext(_D).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return k.createElement(n1.Provider,{value:f},u&&f.visualElement?k.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,a,Dye(h,f.visualElement,l),h,d,f.visualElement))}const s=k.forwardRef(o);return s[Bye]=i,s}function Vye({layoutId:e}){const t=k.useContext(qC).id;return t&&e!==void 0?t+"-"+e:e}function zye(e){function t(r,i={}){return jye(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const Uye=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function WC(e){return typeof e!="string"||e.includes("-")?!1:!!(Uye.indexOf(e)>-1||/[A-Z]/.test(e))}const ay={};function Gye(e){Object.assign(ay,e)}const Fh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Pl=new Set(Fh);function xD(e,{layout:t,layoutId:n}){return Pl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ay[e]||e==="opacity")}const _r=e=>!!(e&&e.getVelocity),Hye={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qye=Fh.length;function Wye(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let s=0;st=>typeof t=="string"&&t.startsWith(e),TD=CD("--"),N2=CD("var(--"),Kye=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,Xye=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ks=(e,t,n)=>Math.min(Math.max(n,e),t),Al={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Md={...Al,transform:e=>Ks(0,1,e)},Gp={...Al,default:1},Id=e=>Math.round(e*1e5)/1e5,s1=/(-)?([\d]*\.?[\d])+/g,ED=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Yye=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Bh(e){return typeof e=="string"}const jh=e=>({test:t=>Bh(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ss=jh("deg"),Zi=jh("%"),me=jh("px"),Qye=jh("vh"),Zye=jh("vw"),n8={...Zi,parse:e=>Zi.parse(e)/100,transform:e=>Zi.transform(e*100)},r8={...Al,transform:Math.round},PD={borderWidth:me,borderTopWidth:me,borderRightWidth:me,borderBottomWidth:me,borderLeftWidth:me,borderRadius:me,radius:me,borderTopLeftRadius:me,borderTopRightRadius:me,borderBottomRightRadius:me,borderBottomLeftRadius:me,width:me,maxWidth:me,height:me,maxHeight:me,size:me,top:me,right:me,bottom:me,left:me,padding:me,paddingTop:me,paddingRight:me,paddingBottom:me,paddingLeft:me,margin:me,marginTop:me,marginRight:me,marginBottom:me,marginLeft:me,rotate:ss,rotateX:ss,rotateY:ss,rotateZ:ss,scale:Gp,scaleX:Gp,scaleY:Gp,scaleZ:Gp,skew:ss,skewX:ss,skewY:ss,distance:me,translateX:me,translateY:me,translateZ:me,x:me,y:me,z:me,perspective:me,transformPerspective:me,opacity:Md,originX:n8,originY:n8,originZ:me,zIndex:r8,fillOpacity:Md,strokeOpacity:Md,numOctaves:r8};function KC(e,t,n,r){const{style:i,vars:o,transform:s,transformOrigin:a}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(TD(d)){o[d]=f;continue}const h=PD[d],p=Xye(f,h);if(Pl.has(d)){if(l=!0,s[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,a[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=Wye(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=a;i.transformOrigin=`${d} ${f} ${h}`}}const XC=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function AD(e,t,n){for(const r in t)!_r(t[r])&&!xD(r,n)&&(e[r]=t[r])}function Jye({transformTemplate:e},t,n){return k.useMemo(()=>{const r=XC();return KC(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function e0e(e,t,n){const r=e.style||{},i={};return AD(i,r,e),Object.assign(i,Jye(e,t,n)),e.transformValues?e.transformValues(i):i}function t0e(e,t,n){const r={},i=e0e(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const n0e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function ly(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||n0e.has(e)}let kD=e=>!ly(e);function r0e(e){e&&(kD=t=>t.startsWith("on")?!ly(t):e(t))}try{r0e(require("@emotion/is-prop-valid").default)}catch{}function i0e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(kD(i)||n===!0&&ly(i)||!t&&!ly(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function i8(e,t,n){return typeof e=="string"?e:me.transform(t+n*e)}function o0e(e,t,n){const r=i8(t,e.x,e.width),i=i8(n,e.y,e.height);return`${r} ${i}`}const s0e={offset:"stroke-dashoffset",array:"stroke-dasharray"},a0e={offset:"strokeDashoffset",array:"strokeDasharray"};function l0e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?s0e:a0e;e[o.offset]=me.transform(-r);const s=me.transform(t),a=me.transform(n);e[o.array]=`${s} ${a}`}function YC(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...u},c,d,f){if(KC(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=o0e(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&l0e(h,s,a,l,!1)}const OD=()=>({...XC(),attrs:{}}),QC=e=>typeof e=="string"&&e.toLowerCase()==="svg";function u0e(e,t,n,r){const i=k.useMemo(()=>{const o=OD();return YC(o,t,{enableHardwareAcceleration:!1},QC(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};AD(o,e.style,e),i.style={...o,...i.style}}return i}function c0e(e=!1){return(n,r,i,{latestValues:o},s)=>{const l=(WC(n)?u0e:t0e)(r,o,s,n),c={...i0e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=k.useMemo(()=>_r(d)?d.get():d,[d]);return k.createElement(n,{...c,children:f})}}const ZC=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function RD(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const MD=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ID(e,t,n,r){RD(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(MD.has(i)?i:ZC(i),t.attrs[i])}function JC(e,t){const{style:n}=e,r={};for(const i in n)(_r(n[i])||t.style&&_r(t.style[i])||xD(i,e))&&(r[i]=n[i]);return r}function ND(e,t){const n=JC(e,t);for(const r in e)if(_r(e[r])||_r(t[r])){const i=Fh.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function e3(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function DD(e){const t=k.useRef(null);return t.current===null&&(t.current=e()),t.current}const uy=e=>Array.isArray(e),d0e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),f0e=e=>uy(e)?e[e.length-1]||0:e;function Ag(e){const t=_r(e)?e.get():e;return d0e(t)?t.toValue():t}function h0e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const s={latestValues:p0e(r,i,o,e),renderState:t()};return n&&(s.mount=a=>n(r,a,s)),s}const LD=e=>(t,n)=>{const r=k.useContext(n1),i=k.useContext($h),o=()=>h0e(e,t,r,i);return n?o():DD(o)};function p0e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=Ag(o[f]);let{initial:s,animate:a}=e;const l=o1(e),u=SD(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||s===!1;const d=c?a:s;return d&&typeof d!="boolean"&&!i1(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=e3(e,h);if(!p)return;const{transitionEnd:m,transition:_,...y}=p;for(const v in y){let g=y[v];if(Array.isArray(g)){const b=c?g.length-1:0;g=g[b]}g!==null&&(i[v]=g)}for(const v in m)i[v]=m[v]}),i}const g0e={useVisualState:LD({scrapeMotionValuesFromProps:ND,createRenderState:OD,onMount:(e,t,{renderState:n,latestValues:r})=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}YC(n,r,{enableHardwareAcceleration:!1},QC(t.tagName),e.transformTemplate),ID(t,n)}})},m0e={useVisualState:LD({scrapeMotionValuesFromProps:JC,createRenderState:XC})};function y0e(e,{forwardMotionProps:t=!1},n,r){return{...WC(e)?g0e:m0e,preloadedFeatures:n,useRender:c0e(t),createVisualElement:r,Component:e}}function Po(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const $D=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function a1(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const v0e=e=>t=>$D(t)&&e(t,a1(t));function Mo(e,t,n,r){return Po(e,t,v0e(n),r)}const b0e=(e,t)=>n=>t(e(n)),Is=(...e)=>e.reduce(b0e);function FD(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const o8=FD("dragHorizontal"),s8=FD("dragVertical");function BD(e){let t=!1;if(e==="y")t=s8();else if(e==="x")t=o8();else{const n=o8(),r=s8();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function jD(){const e=BD(!0);return e?(e(),!1):!0}class ca{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Yt=e=>e;function _0e(e){let t=[],n=[],r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&s.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),s.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=_0e(()=>n=!0),d),{}),s=d=>o[d].process(i),a=d=>{n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,S0e),1),i.timestamp=d,i.isProcessing=!0,Hp.forEach(s),i.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,i.isProcessing||e(a)};return{schedule:Hp.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>Hp.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:_t,cancel:zo,state:Ln,steps:i_}=w0e(typeof requestAnimationFrame<"u"?requestAnimationFrame:Yt,!0);function a8(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,s)=>{if(o.type==="touch"||jD())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&_t.update(()=>a[r](o,s))};return Mo(e.current,n,i,{passive:!e.getProps()[r]})}class x0e extends ca{mount(){this.unmount=Is(a8(this.node,!0),a8(this.node,!1))}unmount(){}}class C0e extends ca{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Is(Po(this.node.current,"focus",()=>this.onFocus()),Po(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const VD=(e,t)=>t?e===t?!0:VD(e,t.parentElement):!1;function o_(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,a1(n))}class T0e extends ca{constructor(){super(...arguments),this.removeStartListeners=Yt,this.removeEndListeners=Yt,this.removeAccessibleListeners=Yt,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Mo(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();_t.update(()=>{VD(this.node.current,a.target)?u&&u(a,l):c&&c(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),s=Mo(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Is(o,s),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const s=a=>{a.key!=="Enter"||!this.checkPressEnd()||o_("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&_t.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Po(this.node.current,"keyup",s),o_("down",(a,l)=>{this.startPress(a,l)})},n=Po(this.node.current,"keydown",t),r=()=>{this.isPressing&&o_("cancel",(o,s)=>this.cancelPress(o,s))},i=Po(this.node.current,"blur",r);this.removeAccessibleListeners=Is(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&_t.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!jD()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&_t.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Mo(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Po(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Is(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const D2=new WeakMap,s_=new WeakMap,E0e=e=>{const t=D2.get(e.target);t&&t(e)},P0e=e=>{e.forEach(E0e)};function A0e({root:e,...t}){const n=e||document;s_.has(n)||s_.set(n,{});const r=s_.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(P0e,{root:e,...t})),r[i]}function k0e(e,t,n){const r=A0e(t);return D2.set(e,n),r.observe(e),()=>{D2.delete(e),r.unobserve(e)}}const O0e={some:0,all:1};class R0e extends ca{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:O0e[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return k0e(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(M0e(t,n))&&this.startObserver()}unmount(){}}function M0e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const I0e={inView:{Feature:R0e},tap:{Feature:T0e},focus:{Feature:C0e},hover:{Feature:x0e}};function zD(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function D0e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function l1(e,t,n){const r=e.getProps();return e3(r,t,n!==void 0?n:r.custom,N0e(e),D0e(e))}const L0e="framerAppearId",$0e="data-"+ZC(L0e);let F0e=Yt,t3=Yt;const Ns=e=>e*1e3,Io=e=>e/1e3,B0e={current:!1},UD=e=>Array.isArray(e)&&typeof e[0]=="number";function GD(e){return!!(!e||typeof e=="string"&&HD[e]||UD(e)||Array.isArray(e)&&e.every(GD))}const md=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,HD={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:md([0,.65,.55,1]),circOut:md([.55,0,1,.45]),backIn:md([.31,.01,.66,-.59]),backOut:md([.33,1.53,.69,.99])};function qD(e){if(e)return UD(e)?md(e):Array.isArray(e)?e.map(qD):HD[e]}function j0e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:s="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=qD(a);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"})}const l8={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},a_={},WD={};for(const e in l8)WD[e]=()=>(a_[e]===void 0&&(a_[e]=l8[e]()),a_[e]);function V0e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const KD=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,z0e=1e-7,U0e=12;function G0e(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=KD(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>z0e&&++aG0e(o,0,1,e,n);return o=>o===0||o===1?o:KD(i(o),t,r)}const H0e=Vh(.42,0,1,1),q0e=Vh(0,0,.58,1),XD=Vh(.42,0,.58,1),W0e=e=>Array.isArray(e)&&typeof e[0]!="number",YD=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,QD=e=>t=>1-e(1-t),ZD=e=>1-Math.sin(Math.acos(e)),n3=QD(ZD),K0e=YD(n3),JD=Vh(.33,1.53,.69,.99),r3=QD(JD),X0e=YD(r3),Y0e=e=>(e*=2)<1?.5*r3(e):.5*(2-Math.pow(2,-10*(e-1))),Q0e={linear:Yt,easeIn:H0e,easeInOut:XD,easeOut:q0e,circIn:ZD,circInOut:K0e,circOut:n3,backIn:r3,backInOut:X0e,backOut:JD,anticipate:Y0e},u8=e=>{if(Array.isArray(e)){t3(e.length===4);const[t,n,r,i]=e;return Vh(t,n,r,i)}else if(typeof e=="string")return Q0e[e];return e},i3=(e,t)=>n=>!!(Bh(n)&&Yye.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),eL=(e,t,n)=>r=>{if(!Bh(r))return r;const[i,o,s,a]=r.match(s1);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},Z0e=e=>Ks(0,255,e),l_={...Al,transform:e=>Math.round(Z0e(e))},La={test:i3("rgb","red"),parse:eL("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+l_.transform(e)+", "+l_.transform(t)+", "+l_.transform(n)+", "+Id(Md.transform(r))+")"};function J0e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const L2={test:i3("#"),parse:J0e,transform:La.transform},mu={test:i3("hsl","hue"),parse:eL("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Zi.transform(Id(t))+", "+Zi.transform(Id(n))+", "+Id(Md.transform(r))+")"},Kn={test:e=>La.test(e)||L2.test(e)||mu.test(e),parse:e=>La.test(e)?La.parse(e):mu.test(e)?mu.parse(e):L2.parse(e),transform:e=>Bh(e)?e:e.hasOwnProperty("red")?La.transform(e):mu.transform(e)},Pt=(e,t,n)=>-n*e+n*t+e;function u_(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function eve({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=u_(l,a,e+1/3),o=u_(l,a,e),s=u_(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}const c_=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},tve=[L2,La,mu],nve=e=>tve.find(t=>t.test(e));function c8(e){const t=nve(e);let n=t.parse(e);return t===mu&&(n=eve(n)),n}const tL=(e,t)=>{const n=c8(e),r=c8(t),i={...n};return o=>(i.red=c_(n.red,r.red,o),i.green=c_(n.green,r.green,o),i.blue=c_(n.blue,r.blue,o),i.alpha=Pt(n.alpha,r.alpha,o),La.transform(i))};function rve(e){var t,n;return isNaN(e)&&Bh(e)&&(((t=e.match(s1))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(ED))===null||n===void 0?void 0:n.length)||0)>0}const nL={regex:Kye,countKey:"Vars",token:"${v}",parse:Yt},rL={regex:ED,countKey:"Colors",token:"${c}",parse:Kn.parse},iL={regex:s1,countKey:"Numbers",token:"${n}",parse:Al.parse};function d_(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function cy(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&d_(n,nL),d_(n,rL),d_(n,iL),n}function oL(e){return cy(e).values}function sL(e){const{values:t,numColors:n,numVars:r,tokenised:i}=cy(e),o=t.length;return s=>{let a=i;for(let l=0;ltypeof e=="number"?0:e;function ove(e){const t=oL(e);return sL(e)(t.map(ive))}const Xs={test:rve,parse:oL,createTransformer:sL,getAnimatableNone:ove},aL=(e,t)=>n=>`${n>0?t:e}`;function lL(e,t){return typeof e=="number"?n=>Pt(e,t,n):Kn.test(e)?tL(e,t):e.startsWith("var(")?aL(e,t):cL(e,t)}const uL=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,s)=>lL(o,t[s]));return o=>{for(let s=0;s{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=lL(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},cL=(e,t)=>{const n=Xs.createTransformer(t),r=cy(e),i=cy(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Is(uL(r.values,i.values),n):aL(e,t)},Wf=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},d8=(e,t)=>n=>Pt(e,t,n);function ave(e){return typeof e=="number"?d8:typeof e=="string"?Kn.test(e)?tL:cL:Array.isArray(e)?uL:typeof e=="object"?sve:d8}function lve(e,t,n){const r=[],i=n||ave(e[0]),o=e.length-1;for(let s=0;st[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=lve(t,r,i),a=s.length,l=u=>{let c=0;if(a>1)for(;cl(Ks(e[0],e[o-1],u)):l}function uve(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Wf(0,t,r);e.push(Pt(n,1,i))}}function cve(e){const t=[0];return uve(t,e.length-1),t}function dve(e,t){return e.map(n=>n*t)}function fve(e,t){return e.map(()=>t||XD).splice(0,e.length-1)}function dy({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=W0e(r)?r.map(u8):u8(r),o={done:!1,value:t[0]},s=dve(n&&n.length===t.length?n:cve(t),e),a=dL(s,t,{ease:Array.isArray(i)?i:fve(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function fL(e,t){return t?e*(1e3/t):0}const hve=5;function hL(e,t,n){const r=Math.max(t-hve,0);return fL(n-e(r),t-r)}const f_=.001,pve=.01,f8=10,gve=.05,mve=1;function yve({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;F0e(e<=Ns(f8));let s=1-t;s=Ks(gve,mve,s),e=Ks(pve,f8,Io(e)),s<1?(i=u=>{const c=u*s,d=c*e,f=c-n,h=$2(u,s),p=Math.exp(-d);return f_-f/h*p},o=u=>{const d=u*s*e,f=d*n+n,h=Math.pow(s,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=$2(Math.pow(u,2),s);return(-i(u)+f_>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-f_+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const a=5/e,l=bve(i,o,a);if(e=Ns(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const vve=12;function bve(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function wve(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!h8(e,Sve)&&h8(e,_ve)){const n=yve(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function pL({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],s={done:!1,value:i},{stiffness:a,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=wve(r),h=c?-Io(c):0,p=l/(2*Math.sqrt(a*u)),m=o-i,_=Io(Math.sqrt(a/u)),y=Math.abs(m)<5;n||(n=y?.01:2),t||(t=y?.005:.5);let v;if(p<1){const g=$2(_,p);v=b=>{const S=Math.exp(-p*_*b);return o-S*((h+p*_*m)/g*Math.sin(g*b)+m*Math.cos(g*b))}}else if(p===1)v=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);v=b=>{const S=Math.exp(-p*_*b),w=Math.min(g*b,300);return o-S*((h+p*_*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const b=v(g);if(f)s.done=g>=d;else{let S=h;g!==0&&(p<1?S=hL(v,g,b):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-b)<=t;s.done=w&&x}return s.value=s.done?o:b,s}}}function p8({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=T=>a!==void 0&&Tl,p=T=>a===void 0?l:l===void 0||Math.abs(a-T)-m*Math.exp(-T/r),g=T=>y+v(T),b=T=>{const P=v(T),E=g(T);f.done=Math.abs(P)<=u,f.value=f.done?y:E};let S,w;const x=T=>{h(f.value)&&(S=T,w=pL({keyframes:[f.value,p(f.value)],velocity:hL(g,T,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:T=>{let P=!1;return!w&&S===void 0&&(P=!0,b(T),x(T)),S!==void 0&&T>S?w.next(T-S):(!P&&b(T),f)}}}const xve=e=>{const t=({timestamp:n})=>e(n);return{start:()=>_t.update(t,!0),stop:()=>zo(t),now:()=>Ln.isProcessing?Ln.timestamp:performance.now()}},g8=2e4;function m8(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=g8?1/0:t}const Cve={decay:p8,inertia:p8,tween:dy,keyframes:dy,spring:pL};function fy({autoplay:e=!0,delay:t=0,driver:n=xve,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:s=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const y=()=>{_=new Promise(j=>{m=j})};y();let v;const g=Cve[i]||dy;let b;g!==dy&&typeof r[0]!="number"&&(b=dL([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;a==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",T=null,P=null,E=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=m8(S));const{calculatedDuration:A}=S;let $=1/0,M=1/0;A!==null&&($=A+s,M=$*(o+1)-s);let C=0;const O=j=>{if(P===null)return;h>0&&(P=Math.min(P,j)),h<0&&(P=Math.min(j-M/h,P)),T!==null?C=T:C=Math.round(j-P)*h;const U=C-t*(h>=0?1:-1),G=h>=0?U<0:U>M;C=Math.max(U,0),x==="finished"&&T===null&&(C=M);let W=C,X=S;if(o){const Q=C/$;let J=Math.floor(Q),ne=Q%1;!ne&&Q>=1&&(ne=1),ne===1&&J--,J=Math.min(J,o+1);const te=!!(J%2);te&&(a==="reverse"?(ne=1-ne,s&&(ne-=s/$)):a==="mirror"&&(X=w));let xe=Ks(0,1,ne);C>M&&(xe=a==="reverse"&&te?1:0),W=xe*$}const Y=G?{done:!1,value:r[0]}:X.next(W);b&&(Y.value=b(Y.value));let{done:B}=Y;!G&&A!==null&&(B=h>=0?C>=M:C<=0);const H=T===null&&(x==="finished"||x==="running"&&B);return d&&d(Y.value),H&&R(),Y},I=()=>{v&&v.stop(),v=void 0},N=()=>{x="idle",I(),m(),y(),P=E=null},R=()=>{x="finished",c&&c(),I(),m()},D=()=>{if(p)return;v||(v=n(O));const j=v.now();l&&l(),T!==null?P=j-T:(!P||x==="finished")&&(P=j),x==="finished"&&y(),E=P,T=null,x="running",v.start()};e&&D();const L={then(j,U){return _.then(j,U)},get time(){return Io(C)},set time(j){j=Ns(j),C=j,T!==null||!v||h===0?T=j:P=v.now()-j/h},get duration(){const j=S.calculatedDuration===null?m8(S):S.calculatedDuration;return Io(j)},get speed(){return h},set speed(j){j===h||!v||(h=j,L.time=Io(C))},get state(){return x},play:D,pause:()=>{x="paused",T=C},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),N())},cancel:()=>{E!==null&&O(E),N()},complete:()=>{x="finished"},sample:j=>(P=0,O(j))};return L}const Tve=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),qp=10,Eve=2e4,Pve=(e,t)=>t.type==="spring"||e==="backgroundColor"||!GD(t.ease);function Ave(e,t,{onUpdate:n,onComplete:r,...i}){if(!(WD.waapi()&&Tve.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let s=!1,a,l;const u=()=>{l=new Promise(y=>{a=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(Pve(t,i)){const y=fy({...i,repeat:0,delay:0});let v={done:!1,value:c[0]};const g=[];let b=0;for(;!v.done&&bp.cancel(),_=()=>{_t.update(m),a(),u()};return p.onfinish=()=>{e.set(V0e(c,i)),r&&r(),_()},{then(y,v){return l.then(y,v)},get time(){return Io(p.currentTime||0)},set time(y){p.currentTime=Ns(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return Io(d)},play:()=>{s||(p.play(),zo(m))},pause:()=>p.pause(),stop:()=>{if(s=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const v=fy({...i,autoplay:!1});e.setWithVelocity(v.sample(y-qp).value,v.sample(y).value,qp)}_()},complete:()=>p.finish(),cancel:_}}function kve({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:Yt,pause:Yt,stop:Yt,then:o=>(o(),Promise.resolve()),cancel:Yt,complete:Yt});return t?fy({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const Ove={type:"spring",stiffness:500,damping:25,restSpeed:10},Rve=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Mve={type:"keyframes",duration:.8},Ive={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Nve=(e,{keyframes:t})=>t.length>2?Mve:Pl.has(e)?e.startsWith("scale")?Rve(t[1]):Ove:Ive,F2=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Xs.test(t)||t==="0")&&!t.startsWith("url(")),Dve=new Set(["brightness","contrast","saturate","opacity"]);function Lve(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(s1)||[];if(!r)return e;const i=n.replace(r,"");let o=Dve.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const $ve=/([a-z-]*)\(.*?\)/g,B2={...Xs,getAnimatableNone:e=>{const t=e.match($ve);return t?t.map(Lve).join(" "):e}},Fve={...PD,color:Kn,backgroundColor:Kn,outlineColor:Kn,fill:Kn,stroke:Kn,borderColor:Kn,borderTopColor:Kn,borderRightColor:Kn,borderBottomColor:Kn,borderLeftColor:Kn,filter:B2,WebkitFilter:B2},o3=e=>Fve[e];function gL(e,t){let n=o3(e);return n!==B2&&(n=Xs),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const mL=e=>/^0[^.\s]+$/.test(e);function Bve(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||mL(e)}function jve(e,t,n,r){const i=F2(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const s=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;ui=>{const o=yL(r,e)||{},s=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-Ns(s);const l=jve(t,e,n,o),u=l[0],c=l[l.length-1],d=F2(e,u),f=F2(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(Vve(o)||(h={...h,...Nve(e,h)}),h.duration&&(h.duration=Ns(h.duration)),h.repeatDelay&&(h.repeatDelay=Ns(h.repeatDelay)),!d||!f||B0e.current||o.type===!1)return kve(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=Ave(t,e,h);if(p)return p}return fy(h)};function hy(e){return!!(_r(e)&&e.add)}const zve=e=>/^\-?\d*\.?\d+$/.test(e);function a3(e,t){e.indexOf(t)===-1&&e.push(t)}function l3(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class u3{constructor(){this.subscriptions=[]}add(t){return a3(this.subscriptions,t),()=>l3(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class Gve{constructor(t,n={}){this.version="10.12.22",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:s}=Ln;this.lastUpdated!==s&&(this.timeDelta=o,this.lastUpdated=s,_t.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>_t.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=Uve(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new u3);const r=this.events[t].add(n);return t==="change"?()=>{r(),_t.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?fL(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dc(e,t){return new Gve(e,t)}const vL=e=>t=>t.test(e),Hve={test:e=>e==="auto",parse:e=>e},bL=[Al,me,Zi,ss,Zye,Qye,Hve],od=e=>bL.find(vL(e)),qve=[...bL,Kn,Xs],Wve=e=>qve.find(vL(e));function Kve(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,dc(n))}function Xve(e,t){const n=l1(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const s in o){const a=f0e(o[s]);Kve(e,s,a)}}function Yve(e,t,n){var r,i;const o=Object.keys(t).filter(a=>!e.hasValue(a)),s=o.length;if(s)for(let a=0;al.remove(d))),u.push(m)}return s&&Promise.all(u).then(()=>{s&&Xve(e,s)}),u}function j2(e,t,n={}){const r=l1(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(_L(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return e1e(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,u]=a==="beforeChildren"?[o,s]:[s,o];return l().then(()=>u())}else return Promise.all([o(),s(n.delay)])}function e1e(e,t,n=0,r=0,i=1,o){const s=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(t1e).forEach((u,c)=>{u.notify("AnimationStart",t),s.push(j2(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function t1e(e,t){return e.sortNodePosition(t)}function n1e(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>j2(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=j2(e,t,n);else{const i=typeof t=="function"?l1(e,t,n.custom):t;r=Promise.all(_L(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const r1e=[...GC].reverse(),i1e=GC.length;function o1e(e){return t=>Promise.all(t.map(({animation:n,options:r})=>n1e(e,n,r)))}function s1e(e){let t=o1e(e);const n=l1e();let r=!0;const i=(l,u)=>{const c=l1(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function s(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let y=0;ym&&S;const E=Array.isArray(b)?b:[b];let A=E.reduce(i,{});w===!1&&(A={});const{prevResolvedValues:$={}}=g,M={...$,...A},C=O=>{P=!0,h.delete(O),g.needsAnimating[O]=!0};for(const O in M){const I=A[O],N=$[O];p.hasOwnProperty(O)||(I!==N?uy(I)&&uy(N)?!zD(I,N)||T?C(O):g.protectedKeys[O]=!0:I!==void 0?C(O):h.add(O):I!==void 0&&h.has(O)?C(O):g.protectedKeys[O]=!0)}g.prevProp=b,g.prevResolvedValues=A,g.isActive&&(p={...p,...A}),r&&e.blockInitialAnimation&&(P=!1),P&&!x&&f.push(...E.map(O=>({animation:O,options:{type:v,...l}})))}if(h.size){const y={};h.forEach(v=>{const g=e.getBaseTarget(v);g!==void 0&&(y[v]=g)}),f.push({animation:y})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function a(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=s(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:s,setActive:a,setAnimateFunction:o,getState:()=>n}}function a1e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!zD(t,e):!1}function _a(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function l1e(){return{animate:_a(!0),whileInView:_a(),whileHover:_a(),whileTap:_a(),whileDrag:_a(),whileFocus:_a(),exit:_a()}}class u1e extends ca{constructor(t){super(t),t.animationState||(t.animationState=s1e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),i1(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let c1e=0;class d1e extends ca{constructor(){super(...arguments),this.id=c1e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const f1e={animation:{Feature:u1e},exit:{Feature:d1e}},y8=(e,t)=>Math.abs(e-t);function h1e(e,t){const n=y8(e.x,t.x),r=y8(e.y,t.y);return Math.sqrt(n**2+r**2)}class SL{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=p_(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=h1e(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=Ln;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=h_(c,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=p_(u.type==="pointercancel"?this.lastMoveEventInfo:h_(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!$D(t))return;this.handlers=n,this.transformPagePoint=r;const i=a1(t),o=h_(i,this.transformPagePoint),{point:s}=o,{timestamp:a}=Ln;this.history=[{...s,timestamp:a}];const{onSessionStart:l}=n;l&&l(t,p_(o,this.history)),this.removeListeners=Is(Mo(window,"pointermove",this.handlePointerMove),Mo(window,"pointerup",this.handlePointerUp),Mo(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),zo(this.updatePoint)}}function h_(e,t){return t?{point:t(e.point)}:e}function v8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function p_({point:e},t){return{point:e,delta:v8(e,wL(t)),offset:v8(e,p1e(t)),velocity:g1e(t,.1)}}function p1e(e){return e[0]}function wL(e){return e[e.length-1]}function g1e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=wL(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ns(t)));)n--;if(!r)return{x:0,y:0};const o=Io(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Rr(e){return e.max-e.min}function V2(e,t=0,n=.01){return Math.abs(e-t)<=n}function b8(e,t,n,r=.5){e.origin=r,e.originPoint=Pt(t.min,t.max,e.origin),e.scale=Rr(n)/Rr(t),(V2(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Pt(n.min,n.max,e.origin)-e.originPoint,(V2(e.translate)||isNaN(e.translate))&&(e.translate=0)}function Nd(e,t,n,r){b8(e.x,t.x,n.x,r?r.originX:void 0),b8(e.y,t.y,n.y,r?r.originY:void 0)}function _8(e,t,n){e.min=n.min+t.min,e.max=e.min+Rr(t)}function m1e(e,t,n){_8(e.x,t.x,n.x),_8(e.y,t.y,n.y)}function S8(e,t,n){e.min=t.min-n.min,e.max=e.min+Rr(t)}function Dd(e,t,n){S8(e.x,t.x,n.x),S8(e.y,t.y,n.y)}function y1e(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Pt(n,e,r.max):Math.min(e,n)),e}function w8(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function v1e(e,{top:t,left:n,bottom:r,right:i}){return{x:w8(e.x,n,i),y:w8(e.y,t,r)}}function x8(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Wf(t.min,t.max-r,e.min):r>i&&(n=Wf(e.min,e.max-i,t.min)),Ks(0,1,n)}function S1e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const z2=.35;function w1e(e=z2){return e===!1?e=0:e===!0&&(e=z2),{x:C8(e,"left","right"),y:C8(e,"top","bottom")}}function C8(e,t,n){return{min:T8(e,t),max:T8(e,n)}}function T8(e,t){return typeof e=="number"?e:e[t]||0}const E8=()=>({translate:0,scale:1,origin:0,originPoint:0}),yu=()=>({x:E8(),y:E8()}),P8=()=>({min:0,max:0}),qt=()=>({x:P8(),y:P8()});function Di(e){return[e("x"),e("y")]}function xL({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function x1e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function C1e(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function g_(e){return e===void 0||e===1}function U2({scale:e,scaleX:t,scaleY:n}){return!g_(e)||!g_(t)||!g_(n)}function Ta(e){return U2(e)||CL(e)||e.z||e.rotate||e.rotateX||e.rotateY}function CL(e){return A8(e.x)||A8(e.y)}function A8(e){return e&&e!=="0%"}function py(e,t,n){const r=e-n,i=t*r;return n+i}function k8(e,t,n,r,i){return i!==void 0&&(e=py(e,i,r)),py(e,n,r)+t}function G2(e,t=0,n=1,r,i){e.min=k8(e.min,t,n,r,i),e.max=k8(e.max,t,n,r,i)}function TL(e,{x:t,y:n}){G2(e.x,t.translate,t.scale,t.originPoint),G2(e.y,n.translate,n.scale,n.originPoint)}function T1e(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function ds(e,t){e.min=e.min+t,e.max=e.max+t}function R8(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,s=Pt(e.min,e.max,o);G2(e,t[n],t[r],s,t.scale)}const E1e=["x","scaleX","originX"],P1e=["y","scaleY","originY"];function vu(e,t){R8(e.x,t,E1e),R8(e.y,t,P1e)}function EL(e,t){return xL(C1e(e.getBoundingClientRect(),t))}function A1e(e,t,n){const r=EL(e,n),{scroll:i}=t;return i&&(ds(r.x,i.offset.x),ds(r.y,i.offset.y)),r}const k1e=new WeakMap;class O1e{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=qt(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(a1(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=BD(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Di(p=>{let m=this.getAxisMotionValue(p).get()||0;if(Zi.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const y=_.layout.layoutBox[p];y&&(m=Rr(y)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&_t.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},s=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=R1e(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},a=(l,u)=>this.stop(l,u);this.panSession=new SL(t,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&_t.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Wp(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=y1e(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&gu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=v1e(r.layoutBox,t):this.constraints=!1,this.elastic=w1e(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Di(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=S1e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gu(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=A1e(r,i.root,this.visualElement.getTransformPagePoint());let s=b1e(i.layout.layoutBox,o);if(n){const a=n(x1e(s));this.hasMutatedConstraints=!!a,a&&(s=xL(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Di(c=>{if(!Wp(c,n,this.currentDirection))return;let d=l&&l[c]||{};s&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(s3(t,r,0,n))}stopAnimation(){Di(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Di(n=>{const{drag:r}=this.getProps();if(!Wp(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n];o.set(t[n]-Pt(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gu(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Di(s=>{const a=this.getAxisMotionValue(s);if(a){const l=a.get();i[s]=_1e({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Di(s=>{if(!Wp(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(Pt(l,u,i[s]))})}addListeners(){if(!this.visualElement.current)return;k1e.set(this.visualElement,this);const t=this.visualElement.current,n=Mo(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();gu(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const s=Po(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Di(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=z2,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function Wp(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function R1e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class M1e extends ca{constructor(t){super(t),this.removeGroupControls=Yt,this.removeListeners=Yt,this.controls=new O1e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Yt}unmount(){this.removeGroupControls(),this.removeListeners()}}const M8=e=>(t,n)=>{e&&_t.update(()=>e(t,n))};class I1e extends ca{constructor(){super(...arguments),this.removePointerDownListener=Yt}onPointerDown(t){this.session=new SL(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:M8(t),onStart:M8(n),onMove:r,onEnd:(o,s)=>{delete this.session,i&&_t.update(()=>i(o,s))}}}mount(){this.removePointerDownListener=Mo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function N1e(){const e=k.useContext($h);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=k.useId();return k.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function P4e(){return D1e(k.useContext($h))}function D1e(e){return e===null?!0:e.isPresent}const kg={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function I8(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const sd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(me.test(e))e=parseFloat(e);else return e;const n=I8(e,t.target.x),r=I8(e,t.target.y);return`${n}% ${r}%`}},L1e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Xs.parse(e);if(i.length>5)return r;const o=Xs.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=Pt(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}};class $1e extends We.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;Gye(F1e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),kg.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,s=r.projection;return s&&(s.isPresent=o,i||t.layoutDependency!==n||n===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||_t.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function PL(e){const[t,n]=N1e(),r=k.useContext(qC);return We.createElement($1e,{...e,layoutGroup:r,switchLayoutGroup:k.useContext(wD),isPresent:t,safeToRemove:n})}const F1e={borderRadius:{...sd,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:sd,borderTopRightRadius:sd,borderBottomLeftRadius:sd,borderBottomRightRadius:sd,boxShadow:L1e},AL=["TopLeft","TopRight","BottomLeft","BottomRight"],B1e=AL.length,N8=e=>typeof e=="string"?parseFloat(e):e,D8=e=>typeof e=="number"||me.test(e);function j1e(e,t,n,r,i,o){i?(e.opacity=Pt(0,n.opacity!==void 0?n.opacity:1,V1e(r)),e.opacityExit=Pt(t.opacity!==void 0?t.opacity:1,0,z1e(r))):o&&(e.opacity=Pt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let s=0;srt?1:n(Wf(e,t,r))}function $8(e,t){e.min=t.min,e.max=t.max}function jr(e,t){$8(e.x,t.x),$8(e.y,t.y)}function F8(e,t,n,r,i){return e-=t,e=py(e,1/n,r),i!==void 0&&(e=py(e,1/i,r)),e}function U1e(e,t=0,n=1,r=.5,i,o=e,s=e){if(Zi.test(t)&&(t=parseFloat(t),t=Pt(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=Pt(o.min,o.max,r);e===o&&(a-=t),e.min=F8(e.min,t,n,a,i),e.max=F8(e.max,t,n,a,i)}function B8(e,t,[n,r,i],o,s){U1e(e,t[n],t[r],t[i],t.scale,o,s)}const G1e=["x","scaleX","originX"],H1e=["y","scaleY","originY"];function j8(e,t,n,r){B8(e.x,t,G1e,n?n.x:void 0,r?r.x:void 0),B8(e.y,t,H1e,n?n.y:void 0,r?r.y:void 0)}function V8(e){return e.translate===0&&e.scale===1}function OL(e){return V8(e.x)&&V8(e.y)}function H2(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function z8(e){return Rr(e.x)/Rr(e.y)}class q1e{constructor(){this.members=[]}add(t){a3(this.members,t),t.scheduleRender()}remove(t){if(l3(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function U8(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const s=e.x.scale*t.x,a=e.y.scale*t.y;return(s!==1||a!==1)&&(r+=`scale(${s}, ${a})`),r||"none"}const W1e=(e,t)=>e.depth-t.depth;class K1e{constructor(){this.children=[],this.isDirty=!1}add(t){a3(this.children,t),this.isDirty=!0}remove(t){l3(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(W1e),this.isDirty=!1,this.children.forEach(t)}}function X1e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(zo(r),e(o-t))};return _t.read(r,!0),()=>zo(r)}function Y1e(e){window.MotionDebug&&window.MotionDebug.record(e)}function Q1e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function Z1e(e,t,n){const r=_r(e)?e:dc(e);return r.start(s3("",r,t,n)),r.animation}const G8=["","X","Y","Z"],H8=1e3;let J1e=0;const Ea={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function RL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=J1e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Ea.totalNodes=Ea.resolvedTargetDeltas=Ea.recalculatedProjection=0,this.nodes.forEach(nbe),this.nodes.forEach(abe),this.nodes.forEach(lbe),this.nodes.forEach(rbe),Y1e(Ea)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=X1e(f,250),kg.hasAnimatedSinceResize&&(kg.hasAnimatedSinceResize=!1,this.nodes.forEach(W8))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||hbe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:y}=c.getProps(),v=!this.targetLayout||!H2(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const b={...yL(m,"layout"),onPlay:_,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else f||W8(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,zo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ube),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(ibe),this.sharedNodes.forEach(cbe)}scheduleUpdateProjection(){_t.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){_t.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=b/1e3;K8(d.x,s.x,S),K8(d.y,s.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dd(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),dbe(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&H2(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=qt()),jr(g,this.relativeTarget)),m&&(this.animationValues=c,j1e(c,u,this.latestValues,S,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(zo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_t.update(()=>{kg.hasAnimatedSinceResize=!0,this.currentAnimation=Z1e(0,H8,{...s,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(H8),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&ML(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||qt();const d=Rr(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+d;const f=Rr(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}jr(a,l),vu(a,c),Nd(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new q1e),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let c=0;c{var a;return(a=s.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(q8),this.root.sharedNodes.clear()}}}function ebe(e){e.updateLayout()}function tbe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=n.source!==e.layout.source;o==="size"?Di(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Rr(f);f.min=r[d].min,f.max=f.min+h}):ML(o,n.layoutBox,r)&&Di(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Rr(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const a=yu();Nd(a,r,n.layoutBox);const l=yu();s?Nd(l,e.applyTransform(i,!0),n.measuredBox):Nd(l,r,n.layoutBox);const u=!OL(a);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=qt();Dd(p,n.layoutBox,f.layoutBox);const m=qt();Dd(m,r,h.layoutBox),H2(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function nbe(e){Ea.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function rbe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ibe(e){e.clearSnapshot()}function q8(e){e.clearMeasurements()}function obe(e){e.isLayoutDirty=!1}function sbe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function W8(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function abe(e){e.resolveTargetDelta()}function lbe(e){e.calcProjection()}function ube(e){e.resetRotation()}function cbe(e){e.removeLeadSnapshot()}function K8(e,t,n){e.translate=Pt(t.translate,0,n),e.scale=Pt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function X8(e,t,n,r){e.min=Pt(t.min,n.min,r),e.max=Pt(t.max,n.max,r)}function dbe(e,t,n,r){X8(e.x,t.x,n.x,r),X8(e.y,t.y,n.y,r)}function fbe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const hbe={duration:.45,ease:[.4,0,.1,1]};function Y8(e){e.min=Math.round(e.min*2)/2,e.max=Math.round(e.max*2)/2}function pbe(e){Y8(e.x),Y8(e.y)}function ML(e,t,n){return e==="position"||e==="preserve-aspect"&&!V2(z8(t),z8(n),.2)}const gbe=RL({attachResizeListener:(e,t)=>Po(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),m_={current:void 0},IL=RL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!m_.current){const e=new gbe({});e.mount(window),e.setOptions({layoutScroll:!0}),m_.current=e}return m_.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),mbe={pan:{Feature:I1e},drag:{Feature:M1e,ProjectionNode:IL,MeasureLayout:PL}},ybe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function vbe(e){const t=ybe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function q2(e,t,n=1){const[r,i]=vbe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);return o?o.trim():N2(i)?q2(i,t,n+1):i}function bbe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!N2(o))return;const s=q2(o,r);s&&i.set(s)});for(const i in t){const o=t[i];if(!N2(o))continue;const s=q2(o,r);s&&(t[i]=s,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const _be=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),NL=e=>_be.has(e),Sbe=e=>Object.keys(e).some(NL),Q8=e=>e===Al||e===me,Z8=(e,t)=>parseFloat(e.split(", ")[t]),J8=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return Z8(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Z8(o[1],e):0}},wbe=new Set(["x","y","z"]),xbe=Fh.filter(e=>!wbe.has(e));function Cbe(e){const t=[];return xbe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const fc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:J8(4,13),y:J8(5,14)};fc.translateX=fc.x;fc.translateY=fc.y;const Tbe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:s}=o,a={};s==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=fc[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(a[u]),e[u]=fc[u](l,o)}),e},Ebe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(NL);let o=[],s=!1;const a=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=od(c);const f=t[l];let h;if(uy(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=od(c);for(let _=m;_=0?window.pageYOffset:null,u=Tbe(t,e,a);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),r1&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function Pbe(e,t,n,r){return Sbe(t)?Ebe(e,t,n,r):{target:t,transitionEnd:r}}const Abe=(e,t,n,r)=>{const i=bbe(e,t,r);return t=i.target,r=i.transitionEnd,Pbe(e,t,n,r)},W2={current:null},DL={current:!1};function kbe(){if(DL.current=!0,!!r1)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>W2.current=e.matches;e.addListener(t),t()}else W2.current=!1}function Obe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],s=n[i];if(_r(o))e.addValue(i,o),hy(r)&&r.add(i);else if(_r(s))e.addValue(i,dc(o,{owner:e})),hy(r)&&r.remove(i);else if(s!==o)if(e.hasValue(i)){const a=e.getValue(i);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(i);e.addValue(i,dc(a!==void 0?a:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const eP=new WeakMap,LL=Object.keys(qf),Rbe=LL.length,tP=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Mbe=HC.length;class Ibe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>_t.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=s,this.isControllingVariants=o1(n),this.isVariantNode=SD(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];a[d]!==void 0&&_r(f)&&(f.set(a[d],!1),hy(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,eP.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),DL.current||kbe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:W2.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){eP.delete(this.current),this.projection&&this.projection.unmount(),zo(this.notifyUpdate),zo(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Pl.has(t),i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&_t.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let s,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):qt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=dc(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=e3(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!_r(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new u3),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class $L extends Ibe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let s=Zve(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),s&&(s=i(s))),o){Yve(this,r,s);const a=Abe(this,r,s,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function Nbe(e){return window.getComputedStyle(e)}class Dbe extends $L{readValueFromInstance(t,n){if(Pl.has(n)){const r=o3(n);return r&&r.default||0}else{const r=Nbe(t),i=(TD(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return EL(t,n)}build(t,n,r,i){KC(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return JC(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;_r(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){RD(t,n,r,i)}}class Lbe extends $L{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Pl.has(n)){const r=o3(n);return r&&r.default||0}return n=MD.has(n)?n:ZC(n),t.getAttribute(n)}measureInstanceViewportBox(){return qt()}scrapeMotionValuesFromProps(t,n){return ND(t,n)}build(t,n,r,i){YC(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){ID(t,n,r,i)}mount(t){this.isSVGTag=QC(t.tagName),super.mount(t)}}const $be=(e,t)=>WC(e)?new Lbe(t,{enableHardwareAcceleration:!1}):new Dbe(t,{enableHardwareAcceleration:!0}),Fbe={layout:{ProjectionNode:IL,MeasureLayout:PL}},Bbe={...f1e,...I0e,...mbe,...Fbe},jbe=zye((e,t)=>y0e(e,t,Bbe,$be));function FL(){const e=k.useRef(!1);return sy(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Vbe(){const e=FL(),[t,n]=k.useState(0),r=k.useCallback(()=>{e.current&&n(t+1)},[t]);return[k.useCallback(()=>_t.postRender(r),[r]),t]}class zbe extends k.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Ube({children:e,isPresent:t}){const n=k.useId(),r=k.useRef(null),i=k.useRef({width:0,height:0,top:0,left:0});return k.useInsertionEffect(()=>{const{width:o,height:s,top:a,left:l}=i.current;if(t||!r.current||!o||!s)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; @@ -122,4 +122,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},MSe={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ISe(e){let{announcements:t=MSe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=RSe}=e;const{announce:o,announcement:s}=ASe(),a=f1("DndLiveRegion"),[l,u]=k.useState(!1);if(k.useEffect(()=>{u(!0)},[]),kSe(k.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=We.createElement(We.Fragment,null,We.createElement(TSe,{id:r,value:i.draggable}),We.createElement(PSe,{id:a,announcement:s}));return n?Vi.createPortal(c,n):c}var tn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(tn||(tn={}));function _y(){}function _P(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function NSe(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Ti=Object.freeze({x:0,y:0});function DSe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function LSe(e,t){const n=Qf(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function $Se(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function FSe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function BSe(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function jSe(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function VSe(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=VSe(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(FSe)};function USe(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const GSe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&USe(r,a)){const u=BSe(a).reduce((d,f)=>d+DSe(r,f),0),c=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:c}})}}return i.sort($Se)};function HSe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function c$(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ti}function qSe(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const WSe=qSe(1);function d$(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function KSe(e,t,n){const r=d$(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const XSe={ignoreTransform:!1};function Gh(e,t){t===void 0&&(t=XSe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=ir(e).getComputedStyle(e);u&&(n=KSe(n,u,c))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function SP(e){return Gh(e,{ignoreTransform:!0})}function YSe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function QSe(e,t){return t===void 0&&(t=ir(e).getComputedStyle(e)),t.position==="fixed"}function ZSe(e,t){t===void 0&&(t=ir(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function w3(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(_3(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!zh(i)||bSe(i)||n.includes(i))return n;const o=ir(e).getComputedStyle(i);return i!==e&&ZSe(i,o)&&n.push(i),QSe(i,o)?n:r(i.parentNode)}return e?r(e):n}function f$(e){const[t]=w3(e,1);return t??null}function S_(e){return!c1||!e?null:Ac(e)?e:b3(e)?_3(e)||e===kc(e).scrollingElement?window:zh(e)?e:null:null}function h$(e){return Ac(e)?e.scrollX:e.scrollLeft}function p$(e){return Ac(e)?e.scrollY:e.scrollTop}function sw(e){return{x:h$(e),y:p$(e)}}var fn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(fn||(fn={}));function g$(e){return!c1||!e?!1:e===document.scrollingElement}function m$(e){const t={x:0,y:0},n=g$(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const JSe={x:.2,y:.2};function e2e(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=JSe);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=m$(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=fn.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=fn.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&a>=t.right-m.width?(h.x=fn.Forward,p.x=r*Math.abs((t.right-m.width-a)/m.width)):!d&&s<=t.left+m.width&&(h.x=fn.Backward,p.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:p}}function t2e(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function y$(e){return e.reduce((t,n)=>ju(t,sw(n)),Ti)}function n2e(e){return e.reduce((t,n)=>t+h$(n),0)}function r2e(e){return e.reduce((t,n)=>t+p$(n),0)}function v$(e,t){if(t===void 0&&(t=Gh),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);f$(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const i2e=[["x",["left","right"],n2e],["y",["top","bottom"],r2e]];class x3{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=w3(n),i=y$(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of i2e)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ld{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function o2e(e){const{EventTarget:t}=ir(e);return e instanceof t?e:kc(e)}function w_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var zr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zr||(zr={}));function wP(e){e.preventDefault()}function s2e(e){e.stopPropagation()}var st;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(st||(st={}));const b$={start:[st.Space,st.Enter],cancel:[st.Esc],end:[st.Space,st.Enter]},a2e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case st.Right:return{...n,x:n.x+25};case st.Left:return{...n,x:n.x-25};case st.Down:return{...n,y:n.y+25};case st.Up:return{...n,y:n.y-25}}};class _${constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ld(kc(n)),this.windowListeners=new Ld(ir(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zr.Resize,this.handleCancel),this.windowListeners.add(zr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&v$(r),n(Ti)}handleKeyDown(t){if(S3(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=b$,coordinateGetter:s=a2e,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Ti;this.referenceCoordinates||(this.referenceCoordinates=c);const d=s(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=by(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:y,isRight:v,isLeft:g,isBottom:b,maxScroll:S,minScroll:w}=m$(m),x=t2e(m),T={x:Math.min(_===st.Right?x.right-x.width/2:x.right,Math.max(_===st.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===st.Down?x.bottom-x.height/2:x.bottom,Math.max(_===st.Down?x.top:x.top+x.height/2,d.y))},P=_===st.Right&&!v||_===st.Left&&!g,E=_===st.Down&&!b||_===st.Up&&!y;if(P&&T.x!==d.x){const A=m.scrollLeft+f.x,$=_===st.Right&&A<=S.x||_===st.Left&&A>=w.x;if($&&!f.y){m.scrollTo({left:A,behavior:a});return}$?h.x=m.scrollLeft-A:h.x=_===st.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:a});break}else if(E&&T.y!==d.y){const A=m.scrollTop+f.y,$=_===st.Down&&A<=S.y||_===st.Up&&A>=w.y;if($&&!f.x){m.scrollTo({top:A,behavior:a});return}$?h.y=m.scrollTop-A:h.y=_===st.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,ju(by(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_$.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=b$,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function xP(e){return!!(e&&"distance"in e)}function CP(e){return!!(e&&"delay"in e)}class C3{constructor(t,n,r){var i;r===void 0&&(r=o2e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=kc(s),this.documentListeners=new Ld(this.document),this.listeners=new Ld(r),this.windowListeners=new Ld(ir(s)),this.initialCoordinates=(i=Qf(o))!=null?i:Ti,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(zr.Resize,this.handleCancel),this.windowListeners.add(zr.DragStart,wP),this.windowListeners.add(zr.VisibilityChange,this.handleCancel),this.windowListeners.add(zr.ContextMenu,wP),this.documentListeners.add(zr.Keydown,this.handleKeydown),n){if(xP(n))return;if(CP(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(zr.Click,s2e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=Qf(t))!=null?n:Ti,u=by(i,l);if(!r&&a){if(CP(a))return w_(u,a.tolerance)?this.handleCancel():void 0;if(xP(a))return a.tolerance!=null&&w_(u,a.tolerance)?this.handleCancel():w_(u,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===st.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const l2e={move:{name:"pointermove"},end:{name:"pointerup"}};class S$ extends C3{constructor(t){const{event:n}=t,r=kc(n.target);super(t,l2e,r)}}S$.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const u2e={move:{name:"mousemove"},end:{name:"mouseup"}};var aw;(function(e){e[e.RightClick=2]="RightClick"})(aw||(aw={}));class w$ extends C3{constructor(t){super(t,u2e,kc(t.event.target))}}w$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===aw.RightClick?!1:(r==null||r({event:n}),!0)}}];const x_={move:{name:"touchmove"},end:{name:"touchend"}};class x$ extends C3{constructor(t){super(t,x_)}static setup(){return window.addEventListener(x_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(x_.move.name,t)};function t(){}}}x$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var $d;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})($d||($d={}));var Sy;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Sy||(Sy={}));function c2e(e){let{acceleration:t,activator:n=$d.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=Sy.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=f2e({delta:d,disabled:!o}),[p,m]=_Se(),_=k.useRef({x:0,y:0}),y=k.useRef({x:0,y:0}),v=k.useMemo(()=>{switch(n){case $d.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case $d.DraggableRect:return i}},[n,i,l]),g=k.useRef(null),b=k.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*y.current.x,T=_.current.y*y.current.y;w.scrollBy(x,T)},[]),S=k.useMemo(()=>a===Sy.TreeOrder?[...u].reverse():u,[a,u]);k.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),T=c[x];if(!T)continue;const{direction:P,speed:E}=e2e(w,T,v,t,f);for(const A of["x","y"])h[A][P[A]]||(E[A]=0,P[A]=0);if(E.x>0||E.y>0){m(),g.current=w,p(b,s),_.current=E,y.current=P;return}}_.current={x:0,y:0},y.current={x:0,y:0},m()},[t,b,r,m,o,s,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const d2e={x:{[fn.Backward]:!1,[fn.Forward]:!1},y:{[fn.Backward]:!1,[fn.Forward]:!1}};function f2e(e){let{delta:t,disabled:n}=e;const r=vy(t);return Uh(i=>{if(n||!r||!i)return d2e;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[fn.Backward]:i.x[fn.Backward]||o.x===-1,[fn.Forward]:i.x[fn.Forward]||o.x===1},y:{[fn.Backward]:i.y[fn.Backward]||o.y===-1,[fn.Forward]:i.y[fn.Forward]||o.y===1}}},[n,t,r])}function h2e(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Uh(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function p2e(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Jf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Jf||(Jf={}));var lw;(function(e){e.Optimized="optimized"})(lw||(lw={}));const TP=new Map;function g2e(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=k.useState(null),{frequency:a,measure:l,strategy:u}=i,c=k.useRef(e),d=_(),f=Yf(d),h=k.useCallback(function(y){y===void 0&&(y=[]),!f.current&&s(v=>v===null?y:v.concat(y.filter(g=>!v.includes(g))))},[f]),p=k.useRef(null),m=Uh(y=>{if(d&&!n)return TP;if(!y||y===TP||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const b=g.node.current,S=b?new x3(l(b),b):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return y},[e,o,n,d,l]);return k.useEffect(()=>{c.current=e},[e]),k.useEffect(()=>{d||h()},[n,d]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},a))},[a,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Jf.Always:return!1;case Jf.BeforeDragging:return n;default:return!n}}}function T3(e,t){return Uh(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function m2e(e,t){return T3(e,t)}function y2e(e){let{callback:t,disabled:n}=e;const r=d1(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function h1(e){let{callback:t,disabled:n}=e;const r=d1(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function v2e(e){return new x3(Gh(e),e)}function EP(e,t,n){t===void 0&&(t=v2e);const[r,i]=k.useReducer(a,null),o=y2e({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=h1({callback:i});return ro(()=>{i(),e?(s==null||s.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),o==null||o.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function b2e(e){const t=T3(e);return c$(e,t)}const PP=[];function _2e(e){const t=k.useRef(e),n=Uh(r=>e?r&&r!==PP&&e&&t.current&&e.parentNode===t.current.parentNode?r:w3(e):PP,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function S2e(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=S_(o.target);s&&n(a=>a?(a.set(s,sw(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=S_(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,sw(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const u=S_(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>ju(o,s),Ti):y$(e):Ti,[e,t])}function AP(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==Ti;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?by(e,n.current):Ti}function w2e(e){k.useEffect(()=>{if(!c1)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function x2e(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function C$(e){return k.useMemo(()=>e?YSe(e):null,[e])}const C_=[];function C2e(e,t){t===void 0&&(t=Gh);const[n]=e,r=C$(n?ir(n):null),[i,o]=k.useReducer(a,C_),s=h1({callback:o});return e.length>0&&i===C_&&o(),ro(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),o())},[e]),i;function a(){return e.length?e.map(l=>g$(l)?r:new x3(t(l),l)):C_}}function T$(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return zh(t)?t:e}function T2e(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(u=>{for(const{target:c}of u)if(zh(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=h1({callback:i}),s=k.useCallback(u=>{const c=T$(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[a,l]=yy(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const E2e=[{sensor:S$,options:{}},{sensor:_$,options:{}}],P2e={current:{}},Ng={draggable:{measure:SP},droppable:{measure:SP,strategy:Jf.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:Gh}};class Fd extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const A2e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_y},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ng,measureDroppableContainers:_y,windowRect:null,measuringScheduled:!1},E$={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_y,draggableNodes:new Map,over:null,measureDroppableContainers:_y},Hh=k.createContext(E$),P$=k.createContext(A2e);function k2e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fd}}}function O2e(e,t){switch(t.type){case tn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case tn.DragEnd:case tn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Fd(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case tn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Fd(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case tn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Fd(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function R2e(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(Hh),o=vy(r),s=vy(n==null?void 0:n.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!S3(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=xSe(c);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function A$(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function M2e(e){return k.useMemo(()=>({draggable:{...Ng.draggable,...e==null?void 0:e.draggable},droppable:{...Ng.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ng.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function I2e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ro(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=c$(c,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=f$(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const p1=k.createContext({...Ti,scaleX:1,scaleY:1});var fs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fs||(fs={}));const N2e=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=E2e,collisionDetection:d=zSe,measuring:f,modifiers:h,...p}=t;const m=k.useReducer(O2e,void 0,k2e),[_,y]=m,[v,g]=OSe(),[b,S]=k.useState(fs.Uninitialized),w=b===fs.Initialized,{draggable:{active:x,nodes:T,translate:P},droppable:{containers:E}}=_,A=x?T.get(x):null,$=k.useRef({initial:null,translated:null}),M=k.useMemo(()=>{var xt;return x!=null?{id:x,data:(xt=A==null?void 0:A.data)!=null?xt:P2e,rect:$}:null},[x,A]),C=k.useRef(null),[O,I]=k.useState(null),[N,R]=k.useState(null),D=Yf(p,Object.values(p)),L=f1("DndDescribedBy",s),j=k.useMemo(()=>E.getEnabled(),[E]),U=M2e(f),{droppableRects:G,measureDroppableContainers:W,measuringScheduled:X}=g2e(j,{dragging:w,dependencies:[P.x,P.y],config:U.droppable}),Y=h2e(T,x),B=k.useMemo(()=>N?Qf(N):null,[N]),H=fa(),Q=m2e(Y,U.draggable.measure);I2e({activeNode:x?T.get(x):null,config:H.layoutShiftCompensation,initialRect:Q,measure:U.draggable.measure});const J=EP(Y,U.draggable.measure,Q),ne=EP(Y?Y.parentElement:null),te=k.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),xe=E.getNodeFor((n=te.current.over)==null?void 0:n.id),ve=T2e({measure:U.dragOverlay.measure}),ce=(r=ve.nodeRef.current)!=null?r:Y,Ne=w?(i=ve.rect)!=null?i:J:null,se=!!(ve.nodeRef.current&&ve.rect),pt=b2e(se?null:J),yn=C$(ce?ir(ce):null),Rt=_2e(w?xe??Y:null),ut=C2e(Rt),Je=A$(h,{transform:{x:P.x-pt.x,y:P.y-pt.y,scaleX:1,scaleY:1},activatorEvent:N,active:M,activeNodeRect:J,containerNodeRect:ne,draggingNodeRect:Ne,over:te.current.over,overlayNodeRect:ve.rect,scrollableAncestors:Rt,scrollableAncestorRects:ut,windowRect:yn}),Ut=B?ju(B,P):null,or=S2e(Rt),ti=AP(or),Dr=AP(or,[J]),On=ju(Je,ti),vn=Ne?WSe(Ne,Je):null,zn=M&&vn?d({active:M,collisionRect:vn,droppableRects:G,droppableContainers:j,pointerCoordinates:Ut}):null,Gt=jSe(zn,"id"),[wt,Sr]=k.useState(null),Lr=se?Je:ju(Je,Dr),ni=HSe(Lr,(o=wt==null?void 0:wt.rect)!=null?o:null,J),lo=k.useCallback((xt,et)=>{let{sensor:_n,options:an}=et;if(C.current==null)return;const Rn=T.get(C.current);if(!Rn)return;const Un=xt.nativeEvent,sr=new _n({active:C.current,activeNode:Rn,event:Un,options:an,context:te,onStart(Gn){const Sn=C.current;if(Sn==null)return;const uo=T.get(Sn);if(!uo)return;const{onDragStart:Qo}=D.current,Zo={active:{id:Sn,data:uo.data,rect:$}};Vi.unstable_batchedUpdates(()=>{Qo==null||Qo(Zo),S(fs.Initializing),y({type:tn.DragStart,initialCoordinates:Gn,active:Sn}),v({type:"onDragStart",event:Zo})})},onMove(Gn){y({type:tn.DragMove,coordinates:Gn})},onEnd:ki(tn.DragEnd),onCancel:ki(tn.DragCancel)});Vi.unstable_batchedUpdates(()=>{I(sr),R(xt.nativeEvent)});function ki(Gn){return async function(){const{active:uo,collisions:Qo,over:Zo,scrollAdjustedTranslate:kl}=te.current;let co=null;if(uo&&kl){const{cancelDrop:Hn}=D.current;co={activatorEvent:Un,active:uo,collisions:Qo,delta:kl,over:Zo},Gn===tn.DragEnd&&typeof Hn=="function"&&await Promise.resolve(Hn(co))&&(Gn=tn.DragCancel)}C.current=null,Vi.unstable_batchedUpdates(()=>{y({type:Gn}),S(fs.Uninitialized),Sr(null),I(null),R(null);const Hn=Gn===tn.DragEnd?"onDragEnd":"onDragCancel";if(co){const ha=D.current[Hn];ha==null||ha(co),v({type:Hn,event:co})}})}}},[T]),bn=k.useCallback((xt,et)=>(_n,an)=>{const Rn=_n.nativeEvent,Un=T.get(an);if(C.current!==null||!Un||Rn.dndKit||Rn.defaultPrevented)return;const sr={active:Un};xt(_n,et.options,sr)===!0&&(Rn.dndKit={capturedBy:et.sensor},C.current=an,lo(_n,et))},[T,lo]),ri=p2e(c,bn);w2e(c),ro(()=>{J&&b===fs.Initializing&&S(fs.Initialized)},[J,b]),k.useEffect(()=>{const{onDragMove:xt}=D.current,{active:et,activatorEvent:_n,collisions:an,over:Rn}=te.current;if(!et||!_n)return;const Un={active:et,activatorEvent:_n,collisions:an,delta:{x:On.x,y:On.y},over:Rn};Vi.unstable_batchedUpdates(()=>{xt==null||xt(Un),v({type:"onDragMove",event:Un})})},[On.x,On.y]),k.useEffect(()=>{const{active:xt,activatorEvent:et,collisions:_n,droppableContainers:an,scrollAdjustedTranslate:Rn}=te.current;if(!xt||C.current==null||!et||!Rn)return;const{onDragOver:Un}=D.current,sr=an.get(Gt),ki=sr&&sr.rect.current?{id:sr.id,rect:sr.rect.current,data:sr.data,disabled:sr.disabled}:null,Gn={active:xt,activatorEvent:et,collisions:_n,delta:{x:Rn.x,y:Rn.y},over:ki};Vi.unstable_batchedUpdates(()=>{Sr(ki),Un==null||Un(Gn),v({type:"onDragOver",event:Gn})})},[Gt]),ro(()=>{te.current={activatorEvent:N,active:M,activeNode:Y,collisionRect:vn,collisions:zn,droppableRects:G,draggableNodes:T,draggingNode:ce,draggingNodeRect:Ne,droppableContainers:E,over:wt,scrollableAncestors:Rt,scrollAdjustedTranslate:On},$.current={initial:Ne,translated:vn}},[M,Y,zn,vn,T,ce,Ne,G,E,wt,Rt,On]),c2e({...H,delta:P,draggingRect:vn,pointerCoordinates:Ut,scrollableAncestors:Rt,scrollableAncestorRects:ut});const da=k.useMemo(()=>({active:M,activeNode:Y,activeNodeRect:J,activatorEvent:N,collisions:zn,containerNodeRect:ne,dragOverlay:ve,draggableNodes:T,droppableContainers:E,droppableRects:G,over:wt,measureDroppableContainers:W,scrollableAncestors:Rt,scrollableAncestorRects:ut,measuringConfiguration:U,measuringScheduled:X,windowRect:yn}),[M,Y,J,N,zn,ne,ve,T,E,G,wt,W,Rt,ut,U,X,yn]),Ai=k.useMemo(()=>({activatorEvent:N,activators:ri,active:M,activeNodeRect:J,ariaDescribedById:{draggable:L},dispatch:y,draggableNodes:T,over:wt,measureDroppableContainers:W}),[N,ri,M,J,y,L,T,wt,W]);return We.createElement(u$.Provider,{value:g},We.createElement(Hh.Provider,{value:Ai},We.createElement(P$.Provider,{value:da},We.createElement(p1.Provider,{value:ni},u)),We.createElement(R2e,{disabled:(a==null?void 0:a.restoreFocus)===!1})),We.createElement(ISe,{...a,hiddenTextDescribedById:L}));function fa(){const xt=(O==null?void 0:O.autoScrollEnabled)===!1,et=typeof l=="object"?l.enabled===!1:l===!1,_n=w&&!xt&&!et;return typeof l=="object"?{...l,enabled:_n}:{enabled:_n}}}),D2e=k.createContext(null),kP="button",L2e="Droppable";function $2e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=f1(L2e),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=k.useContext(Hh),{role:h=kP,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,y=k.useContext(_?p1:D2e),[v,g]=yy(),[b,S]=yy(),w=x2e(s,t),x=Yf(n);ro(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:b,data:x}),()=>{const P=d.get(t);P&&P.key===o&&d.delete(t)}),[d,t]);const T=k.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===kP?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:y}}function F2e(){return k.useContext(P$)}const B2e="Droppable",j2e={timeout:25};function V2e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=f1(B2e),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=k.useContext(Hh),c=k.useRef({disabled:n}),d=k.useRef(!1),f=k.useRef(null),h=k.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...j2e,...i},y=Yf(m??r),v=k.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),h.current=null},_)},[_]),g=h1({callback:v,disabled:p||!s}),b=k.useCallback((T,P)=>{g&&(P&&(g.unobserve(P),d.current=!1),T&&g.observe(T))},[g]),[S,w]=yy(b),x=Yf(t);return k.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),ro(()=>(a({type:tn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>a({type:tn.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==c.current.disabled&&(a({type:tn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function z2e(e){let{animation:t,children:n}=e;const[r,i]=k.useState(null),[o,s]=k.useState(null),a=vy(n);return!n&&!r&&a&&i(a),ro(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),We.createElement(We.Fragment,null,n,r?k.cloneElement(r,{ref:s}):null)}const U2e={x:0,y:0,scaleX:1,scaleY:1};function G2e(e){let{children:t}=e;return We.createElement(Hh.Provider,{value:E$},We.createElement(p1.Provider,{value:U2e},t))}const H2e={position:"fixed",touchAction:"none"},q2e=e=>S3(e)?"transform 250ms ease":void 0,W2e=k.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:u,transition:c=q2e}=e;if(!a)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...H2e,width:a.width,height:a.height,top:a.top,left:a.left,transform:Zf.Transform.toString(d),transformOrigin:i&&r?LSe(r,a):void 0,transition:typeof c=="function"?c(r):c,...l};return We.createElement(n,{className:s,style:f,ref:t},o)}),K2e=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},X2e=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Zf.Transform.toString(t)},{transform:Zf.Transform.toString(n)}]},Y2e={duration:250,easing:"ease",keyframes:X2e,sideEffects:K2e({styles:{active:{opacity:"0"}}})};function Q2e(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return d1((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=T$(s);if(!u)return;const{transform:c}=ir(s).getComputedStyle(s),d=d$(c);if(!d)return;const f=typeof t=="function"?t:Z2e(t);return v$(l,i.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function Z2e(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...Y2e,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...u}=o;if(!t)return;const c={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},d={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:s,dragOverlay:a,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:s,dragOverlay:a,...u}),y=a.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{y.onfinish=()=>{_==null||_(),v()}})}}let OP=0;function J2e(e){return k.useMemo(()=>{if(e!=null)return OP++,OP},[e])}const ewe=We.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:y,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:b,windowRect:S}=F2e(),w=k.useContext(p1),x=J2e(d==null?void 0:d.id),T=A$(s,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:y,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:b,transform:w,windowRect:S}),P=T3(f),E=Q2e({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),A=P?_.setRef:void 0;return We.createElement(G2e,null,We.createElement(z2e,{animation:E},d&&x?We.createElement(W2e,{key:x,id:d.id,ref:A,as:a,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:P,style:{zIndex:u,...i},transform:T},n):null))}),twe=e=>{let{activatorEvent:t,draggingNodeRect:n,transform:r}=e;if(n&&t){const i=Qf(t);if(!i)return r;const o=i.x-n.left,s=i.y-n.top;return{...r,x:r.x+o-n.width/2,y:r.y+s-n.height/2}}return r},k$=()=>uk(),R4e=tk,Qp=28,RP={w:Qp,h:Qp,maxW:Qp,maxH:Qp,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},nwe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return K.jsx(d3,{sx:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",cursor:"none"},children:K.jsx(c3,{sx:{...RP},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_NAMES"?K.jsxs(f3,{sx:{cursor:"none",userSelect:"none",position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...RP},children:[K.jsx(X2,{children:e.dragData.payload.image_names.length}),K.jsx(X2,{size:"sm",children:"Images"})]}):null},rwe=k.memo(nwe);function M4e(e){return V2e(e)}function I4e(e){return $2e(e)}const N4e=(e,t)=>{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"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_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_NAMES";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_NAMES";case"MOVE_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_NAMES"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:o}=t.data.current.payload,s=o.board_id,a=e.context.boardId;return!(s===a)&&(s?!0:a)}return r!=="IMAGE_NAMES"}default:return!1}};function iwe(e){return K.jsx(N2e,{...e})}const owe=e=>{const[t,n]=k.useState(null),r=k$(),i=k.useCallback(u=>{console.log("dragStart",u.active.data.current);const c=u.active.data.current;c&&n(c)},[]),o=k.useCallback(u=>{var d;console.log("dragEnd",u.active.data.current);const c=(d=u.over)==null?void 0:d.data.current;!t||!c||(r(rN({overData:c,activeData:t})),n(null))},[t,r]),s=_P(w$,{activationConstraint:{distance:10}}),a=_P(x$,{activationConstraint:{distance:10}}),l=NSe(s,a);return K.jsxs(iwe,{onDragStart:i,onDragEnd:o,sensors:l,collisionDetection:GSe,children:[e.children,K.jsx(ewe,{dropAnimation:null,modifiers:[twe],children:K.jsx(Kbe,{children:t&&K.jsx(jbe.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:K.jsx(rwe,{dragData:t})},"overlay-drag-image")})})]})},swe=k.memo(owe),awe=k.createContext({isOpen:!1,onClose:()=>{},onClickAddToBoard:()=>{},handleAddToBoard:()=>{}}),lwe=e=>{const[t,n]=k.useState(),{isOpen:r,onOpen:i,onClose:o}=n_e(),s=k$(),a=k.useCallback(()=>{n(void 0),o()},[o]),l=k.useCallback(c=>{c&&(n(c),i())},[n,i]),u=k.useCallback(c=>{t&&(s(he.endpoints.addImageToBoard.initiate({imageDTO:t,board_id:c})),a())},[s,a,t]);return K.jsx(awe.Provider,{value:{isOpen:r,image:t,onClose:a,onClickAddToBoard:l,handleAddToBoard:u},children:e.children})},uwe=k.lazy(()=>q9(()=>import("./App-31be1ab7.js"),["./App-31be1ab7.js","./MantineProvider-26d2feb2.js","./App-6125620a.css"],import.meta.url)),cwe=k.lazy(()=>q9(()=>import("./ThemeLocaleProvider-38a3ad93.js"),["./ThemeLocaleProvider-38a3ad93.js","./MantineProvider-26d2feb2.js","./ThemeLocaleProvider-5b992bc7.css"],import.meta.url)),dwe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i})=>(k.useEffect(()=>(t&&Tf.set(t),e&&Ef.set(e),GI(),i&&i.length>0?d2(vP(),...i):d2(vP()),()=>{Ef.set(void 0),Tf.set(void 0)}),[e,t,i]),K.jsx(We.StrictMode,{children:K.jsx(vV,{store:Wpe,children:K.jsx(We.Suspense,{fallback:K.jsx(s_e,{}),children:K.jsx(cwe,{children:K.jsx(swe,{children:K.jsx(lwe,{children:K.jsx(uwe,{config:n,headerComponent:r})})})})})})})),fwe=k.memo(dwe);T_.createRoot(document.getElementById("root")).render(K.jsx(fwe,{}));export{pD as $,K as A,ei as B,jt as C,Du as D,jn as E,di as F,Zne as G,vr as H,Rs as I,Li as J,j3e as K,xM as L,hre as M,Ure as N,lte as O,tre as P,oc as Q,$ge as R,ff as S,El as T,al as U,aD as V,m4e as W,h4e as X,Kbe as Y,jbe as Z,E4e as _,eO as a,GS as a$,BL as a0,vD as a1,p4e as a2,g4e as a3,Lge as a4,Dge as a5,y4e as a6,Da as a7,ll as a8,om as a9,f3 as aA,X2 as aB,l4e as aC,zN as aD,t3e as aE,Q4 as aF,dCe as aG,Vi as aH,jC as aI,iF as aJ,mwe as aK,pwe as aL,gwe as aM,Ee as aN,Pa as aO,P3e as aP,ZI as aQ,T3e as aR,E3e as aS,x3e as aT,b3e as aU,Lpe as aV,M4e as aW,N4e as aX,w3e as aY,N3e as aZ,YCe as a_,NV as aa,We as ab,nP as ac,fye as ad,T4e as ae,Ro as af,oD as ag,N1e as ah,_4e as ai,M2 as aj,f4e as ak,C4e as al,Zn as am,yC as an,w0 as ao,R4e as ap,z3e as aq,Eh as ar,iI as as,OI as at,ev as au,k$ as av,y5e as aw,Ft as ax,Ha as ay,d3 as az,Ex as b,N7 as b$,C3e as b0,c3 as b1,i_e as b2,Sxe as b3,bs as b4,O5e as b5,pp as b6,wge as b7,BC as b8,eD as b9,ue as bA,awe as bB,QCe as bC,pJ as bD,r3e as bE,BR as bF,Jxe as bG,IR as bH,HS as bI,I4e as bJ,d4e as bK,I3e as bL,JCe as bM,e3e as bN,Os as bO,Gle as bP,KCe as bQ,XCe as bR,qCe as bS,n_e as bT,Om as bU,a4e as bV,L5e as bW,bxe as bX,wle as bY,h5e as bZ,D3e as b_,Cge as ba,F3 as bb,R3e as bc,O3e as bd,hwe as be,bwe as bf,_we as bg,zwe as bh,Uwe as bi,Twe as bj,Xwe as bk,wwe as bl,Dwe as bm,Awe as bn,nue as bo,xwe as bp,Gwe as bq,Swe as br,exe as bs,Ewe as bt,Lwe as bu,Pwe as bv,$we as bw,Rwe as bx,Bwe as by,tue as bz,OU as c,fxe as c$,nN as c0,M5e as c1,WCe as c2,i3e as c3,P7 as c4,FR as c5,Cwe as c6,Exe as c7,Vn as c8,x5e as c9,Ah as cA,dxe as cB,txe as cC,axe as cD,Vwe as cE,v5e as cF,hl as cG,_5e as cH,o5e as cI,i5e as cJ,F5e as cK,r4e as cL,c5e as cM,l5e as cN,fe as cO,Cf as cP,Y5e as cQ,xE as cR,u5e as cS,d5e as cT,a5e as cU,Zse as cV,jwe as cW,B5e as cX,yQ as cY,U5e as cZ,kR as c_,I5e as ca,R5e as cb,ele as cc,w5e as cd,E5e as ce,P5e as cf,SQ as cg,Sae as ch,wae as ci,yxe as cj,Txe as ck,T5e as cl,CQ as cm,V3e as cn,m5e as co,AR as cp,v3e as cq,g3e as cr,m3e as cs,y3e as ct,z5e as cu,Za as cv,ywe as cw,wo as cx,cce as cy,Mwe as cz,vX as d,pe as d$,wQ as d0,zi as d1,Fwe as d2,Qwe as d3,vwe as d4,uY as d5,Jwe as d6,s5e as d7,hxe as d8,r5e as d9,p3e as dA,E7 as dB,a3e as dC,u3e as dD,o3e as dE,xpe as dF,s3e as dG,lxe as dH,uxe as dI,oxe as dJ,sxe as dK,ixe as dL,Z5e as dM,W5e as dN,k5e as dO,q5e as dP,n4e as dQ,Q5e as dR,A5e as dS,X5e as dT,K5e as dU,G5e as dV,H5e as dW,qM as dX,$x as dY,J5e as dZ,jm as d_,mce as da,gxe as db,he as dc,Wn as dd,$5e as de,$3e as df,F3e as dg,L7 as dh,V5e as di,L3e as dj,gR as dk,cxe as dl,lY as dm,Owe as dn,j5e as dp,_T as dq,c3e as dr,qx as ds,iJ as dt,Ql as du,ST as dv,d3e as dw,f3e as dx,h3e as dy,oJ as dz,eR as e,wpe as e$,e4e as e0,c2 as e1,kwe as e2,t4e as e3,tk as e4,uk as e5,n5e as e6,X3e as e7,Y3e as e8,Q3e as e9,hCe as eA,rd as eB,uCe as eC,Gxe as eD,rv as eE,fCe as eF,jxe as eG,cCe as eH,Vxe as eI,Wxe as eJ,Oxe as eK,kxe as eL,Axe as eM,FCe as eN,DR as eO,Tf as eP,Dxe as eQ,Lxe as eR,$xe as eS,DCe as eT,Xxe as eU,Kxe as eV,VQ as eW,NCe as eX,kle as eY,Hxe as eZ,bpe as e_,II as ea,e5e as eb,t5e as ec,Lf as ed,x0 as ee,H3e as ef,Fpe as eg,U3e as eh,G3e as ei,W3e as ej,q3e as ek,K3e as el,J3e as em,jie as en,nI as eo,aN as ep,EF as eq,Pe as er,vCe as es,$Ce as et,LCe as eu,Qxe as ev,PCe as ew,BCe as ex,Ole as ey,Uxe as ez,lO as f,cye as f$,tCe as f0,nCe as f1,bCe as f2,yCe as f3,pCe as f4,Rxe as f5,Mxe as f6,N5e as f7,D5e as f8,lCe as f9,_Q as fA,nxe as fB,Nxe as fC,iCe as fD,UCe as fE,Hwe as fF,qwe as fG,Wwe as fH,Kwe as fI,oCe as fJ,s4e as fK,_xe as fL,OR as fM,xxe as fN,wxe as fO,Cxe as fP,sY as fQ,_le as fR,c4e as fS,sD as fT,x4e as fU,S4e as fV,v4e as fW,w4e as fX,qi as fY,b4e as fZ,u4e as f_,eCe as fa,_Ce as fb,ECe as fc,SCe as fd,Yxe as fe,zxe as ff,ICe as fg,MCe as fh,CCe as fi,wCe as fj,xCe as fk,GCe as fl,OCe as fm,HCe as fn,aCe as fo,sCe as fp,Bxe as fq,Fxe as fr,zCe as fs,Zxe as ft,Ale as fu,Tle as fv,Ele as fw,Ple as fx,Ixe as fy,pxe as fz,dX as g,Jme as g0,P4e as g1,k4e as g2,O4e as g3,yO as h,yr as i,vc as j,_0 as k,gn as l,b0 as m,ph as n,xi as o,na as p,y0 as q,io as r,mh as s,gb as t,wx as u,sO as v,Ox as w,WO as x,uO as y,k as z}; + `},MSe={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ISe(e){let{announcements:t=MSe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=RSe}=e;const{announce:o,announcement:s}=ASe(),a=f1("DndLiveRegion"),[l,u]=k.useState(!1);if(k.useEffect(()=>{u(!0)},[]),kSe(k.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=We.createElement(We.Fragment,null,We.createElement(TSe,{id:r,value:i.draggable}),We.createElement(PSe,{id:a,announcement:s}));return n?Vi.createPortal(c,n):c}var tn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(tn||(tn={}));function _y(){}function _P(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function NSe(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Ti=Object.freeze({x:0,y:0});function DSe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function LSe(e,t){const n=Qf(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function $Se(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function FSe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function BSe(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function jSe(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function VSe(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=VSe(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(FSe)};function USe(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const GSe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&USe(r,a)){const u=BSe(a).reduce((d,f)=>d+DSe(r,f),0),c=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:c}})}}return i.sort($Se)};function HSe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function c$(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ti}function qSe(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const WSe=qSe(1);function d$(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function KSe(e,t,n){const r=d$(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const XSe={ignoreTransform:!1};function Gh(e,t){t===void 0&&(t=XSe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=ir(e).getComputedStyle(e);u&&(n=KSe(n,u,c))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function SP(e){return Gh(e,{ignoreTransform:!0})}function YSe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function QSe(e,t){return t===void 0&&(t=ir(e).getComputedStyle(e)),t.position==="fixed"}function ZSe(e,t){t===void 0&&(t=ir(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function w3(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(_3(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!zh(i)||bSe(i)||n.includes(i))return n;const o=ir(e).getComputedStyle(i);return i!==e&&ZSe(i,o)&&n.push(i),QSe(i,o)?n:r(i.parentNode)}return e?r(e):n}function f$(e){const[t]=w3(e,1);return t??null}function S_(e){return!c1||!e?null:Ac(e)?e:b3(e)?_3(e)||e===kc(e).scrollingElement?window:zh(e)?e:null:null}function h$(e){return Ac(e)?e.scrollX:e.scrollLeft}function p$(e){return Ac(e)?e.scrollY:e.scrollTop}function sw(e){return{x:h$(e),y:p$(e)}}var fn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(fn||(fn={}));function g$(e){return!c1||!e?!1:e===document.scrollingElement}function m$(e){const t={x:0,y:0},n=g$(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const JSe={x:.2,y:.2};function e2e(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=JSe);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=m$(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=fn.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=fn.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&a>=t.right-m.width?(h.x=fn.Forward,p.x=r*Math.abs((t.right-m.width-a)/m.width)):!d&&s<=t.left+m.width&&(h.x=fn.Backward,p.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:p}}function t2e(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function y$(e){return e.reduce((t,n)=>ju(t,sw(n)),Ti)}function n2e(e){return e.reduce((t,n)=>t+h$(n),0)}function r2e(e){return e.reduce((t,n)=>t+p$(n),0)}function v$(e,t){if(t===void 0&&(t=Gh),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);f$(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const i2e=[["x",["left","right"],n2e],["y",["top","bottom"],r2e]];class x3{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=w3(n),i=y$(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of i2e)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ld{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function o2e(e){const{EventTarget:t}=ir(e);return e instanceof t?e:kc(e)}function w_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var zr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zr||(zr={}));function wP(e){e.preventDefault()}function s2e(e){e.stopPropagation()}var st;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(st||(st={}));const b$={start:[st.Space,st.Enter],cancel:[st.Esc],end:[st.Space,st.Enter]},a2e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case st.Right:return{...n,x:n.x+25};case st.Left:return{...n,x:n.x-25};case st.Down:return{...n,y:n.y+25};case st.Up:return{...n,y:n.y-25}}};class _${constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ld(kc(n)),this.windowListeners=new Ld(ir(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zr.Resize,this.handleCancel),this.windowListeners.add(zr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&v$(r),n(Ti)}handleKeyDown(t){if(S3(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=b$,coordinateGetter:s=a2e,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Ti;this.referenceCoordinates||(this.referenceCoordinates=c);const d=s(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=by(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:y,isRight:v,isLeft:g,isBottom:b,maxScroll:S,minScroll:w}=m$(m),x=t2e(m),T={x:Math.min(_===st.Right?x.right-x.width/2:x.right,Math.max(_===st.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===st.Down?x.bottom-x.height/2:x.bottom,Math.max(_===st.Down?x.top:x.top+x.height/2,d.y))},P=_===st.Right&&!v||_===st.Left&&!g,E=_===st.Down&&!b||_===st.Up&&!y;if(P&&T.x!==d.x){const A=m.scrollLeft+f.x,$=_===st.Right&&A<=S.x||_===st.Left&&A>=w.x;if($&&!f.y){m.scrollTo({left:A,behavior:a});return}$?h.x=m.scrollLeft-A:h.x=_===st.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:a});break}else if(E&&T.y!==d.y){const A=m.scrollTop+f.y,$=_===st.Down&&A<=S.y||_===st.Up&&A>=w.y;if($&&!f.x){m.scrollTo({top:A,behavior:a});return}$?h.y=m.scrollTop-A:h.y=_===st.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,ju(by(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_$.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=b$,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function xP(e){return!!(e&&"distance"in e)}function CP(e){return!!(e&&"delay"in e)}class C3{constructor(t,n,r){var i;r===void 0&&(r=o2e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=kc(s),this.documentListeners=new Ld(this.document),this.listeners=new Ld(r),this.windowListeners=new Ld(ir(s)),this.initialCoordinates=(i=Qf(o))!=null?i:Ti,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(zr.Resize,this.handleCancel),this.windowListeners.add(zr.DragStart,wP),this.windowListeners.add(zr.VisibilityChange,this.handleCancel),this.windowListeners.add(zr.ContextMenu,wP),this.documentListeners.add(zr.Keydown,this.handleKeydown),n){if(xP(n))return;if(CP(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(zr.Click,s2e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=Qf(t))!=null?n:Ti,u=by(i,l);if(!r&&a){if(CP(a))return w_(u,a.tolerance)?this.handleCancel():void 0;if(xP(a))return a.tolerance!=null&&w_(u,a.tolerance)?this.handleCancel():w_(u,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===st.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const l2e={move:{name:"pointermove"},end:{name:"pointerup"}};class S$ extends C3{constructor(t){const{event:n}=t,r=kc(n.target);super(t,l2e,r)}}S$.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const u2e={move:{name:"mousemove"},end:{name:"mouseup"}};var aw;(function(e){e[e.RightClick=2]="RightClick"})(aw||(aw={}));class w$ extends C3{constructor(t){super(t,u2e,kc(t.event.target))}}w$.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===aw.RightClick?!1:(r==null||r({event:n}),!0)}}];const x_={move:{name:"touchmove"},end:{name:"touchend"}};class x$ extends C3{constructor(t){super(t,x_)}static setup(){return window.addEventListener(x_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(x_.move.name,t)};function t(){}}}x$.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var $d;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})($d||($d={}));var Sy;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Sy||(Sy={}));function c2e(e){let{acceleration:t,activator:n=$d.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=Sy.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=f2e({delta:d,disabled:!o}),[p,m]=_Se(),_=k.useRef({x:0,y:0}),y=k.useRef({x:0,y:0}),v=k.useMemo(()=>{switch(n){case $d.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case $d.DraggableRect:return i}},[n,i,l]),g=k.useRef(null),b=k.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*y.current.x,T=_.current.y*y.current.y;w.scrollBy(x,T)},[]),S=k.useMemo(()=>a===Sy.TreeOrder?[...u].reverse():u,[a,u]);k.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),T=c[x];if(!T)continue;const{direction:P,speed:E}=e2e(w,T,v,t,f);for(const A of["x","y"])h[A][P[A]]||(E[A]=0,P[A]=0);if(E.x>0||E.y>0){m(),g.current=w,p(b,s),_.current=E,y.current=P;return}}_.current={x:0,y:0},y.current={x:0,y:0},m()},[t,b,r,m,o,s,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const d2e={x:{[fn.Backward]:!1,[fn.Forward]:!1},y:{[fn.Backward]:!1,[fn.Forward]:!1}};function f2e(e){let{delta:t,disabled:n}=e;const r=vy(t);return Uh(i=>{if(n||!r||!i)return d2e;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[fn.Backward]:i.x[fn.Backward]||o.x===-1,[fn.Forward]:i.x[fn.Forward]||o.x===1},y:{[fn.Backward]:i.y[fn.Backward]||o.y===-1,[fn.Forward]:i.y[fn.Forward]||o.y===1}}},[n,t,r])}function h2e(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Uh(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function p2e(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Jf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Jf||(Jf={}));var lw;(function(e){e.Optimized="optimized"})(lw||(lw={}));const TP=new Map;function g2e(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=k.useState(null),{frequency:a,measure:l,strategy:u}=i,c=k.useRef(e),d=_(),f=Yf(d),h=k.useCallback(function(y){y===void 0&&(y=[]),!f.current&&s(v=>v===null?y:v.concat(y.filter(g=>!v.includes(g))))},[f]),p=k.useRef(null),m=Uh(y=>{if(d&&!n)return TP;if(!y||y===TP||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const b=g.node.current,S=b?new x3(l(b),b):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return y},[e,o,n,d,l]);return k.useEffect(()=>{c.current=e},[e]),k.useEffect(()=>{d||h()},[n,d]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},a))},[a,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Jf.Always:return!1;case Jf.BeforeDragging:return n;default:return!n}}}function T3(e,t){return Uh(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function m2e(e,t){return T3(e,t)}function y2e(e){let{callback:t,disabled:n}=e;const r=d1(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function h1(e){let{callback:t,disabled:n}=e;const r=d1(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function v2e(e){return new x3(Gh(e),e)}function EP(e,t,n){t===void 0&&(t=v2e);const[r,i]=k.useReducer(a,null),o=y2e({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=h1({callback:i});return ro(()=>{i(),e?(s==null||s.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),o==null||o.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function b2e(e){const t=T3(e);return c$(e,t)}const PP=[];function _2e(e){const t=k.useRef(e),n=Uh(r=>e?r&&r!==PP&&e&&t.current&&e.parentNode===t.current.parentNode?r:w3(e):PP,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function S2e(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=S_(o.target);s&&n(a=>a?(a.set(s,sw(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=S_(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,sw(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const u=S_(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>ju(o,s),Ti):y$(e):Ti,[e,t])}function AP(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==Ti;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?by(e,n.current):Ti}function w2e(e){k.useEffect(()=>{if(!c1)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function x2e(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function C$(e){return k.useMemo(()=>e?YSe(e):null,[e])}const C_=[];function C2e(e,t){t===void 0&&(t=Gh);const[n]=e,r=C$(n?ir(n):null),[i,o]=k.useReducer(a,C_),s=h1({callback:o});return e.length>0&&i===C_&&o(),ro(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),o())},[e]),i;function a(){return e.length?e.map(l=>g$(l)?r:new x3(t(l),l)):C_}}function T$(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return zh(t)?t:e}function T2e(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(u=>{for(const{target:c}of u)if(zh(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=h1({callback:i}),s=k.useCallback(u=>{const c=T$(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[a,l]=yy(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const E2e=[{sensor:S$,options:{}},{sensor:_$,options:{}}],P2e={current:{}},Ng={draggable:{measure:SP},droppable:{measure:SP,strategy:Jf.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:Gh}};class Fd extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const A2e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_y},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ng,measureDroppableContainers:_y,windowRect:null,measuringScheduled:!1},E$={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_y,draggableNodes:new Map,over:null,measureDroppableContainers:_y},Hh=k.createContext(E$),P$=k.createContext(A2e);function k2e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fd}}}function O2e(e,t){switch(t.type){case tn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case tn.DragEnd:case tn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Fd(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case tn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Fd(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case tn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Fd(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function R2e(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(Hh),o=vy(r),s=vy(n==null?void 0:n.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!S3(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=xSe(c);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function A$(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function M2e(e){return k.useMemo(()=>({draggable:{...Ng.draggable,...e==null?void 0:e.draggable},droppable:{...Ng.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ng.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function I2e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ro(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=c$(c,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=f$(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const p1=k.createContext({...Ti,scaleX:1,scaleY:1});var fs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fs||(fs={}));const N2e=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=E2e,collisionDetection:d=zSe,measuring:f,modifiers:h,...p}=t;const m=k.useReducer(O2e,void 0,k2e),[_,y]=m,[v,g]=OSe(),[b,S]=k.useState(fs.Uninitialized),w=b===fs.Initialized,{draggable:{active:x,nodes:T,translate:P},droppable:{containers:E}}=_,A=x?T.get(x):null,$=k.useRef({initial:null,translated:null}),M=k.useMemo(()=>{var xt;return x!=null?{id:x,data:(xt=A==null?void 0:A.data)!=null?xt:P2e,rect:$}:null},[x,A]),C=k.useRef(null),[O,I]=k.useState(null),[N,R]=k.useState(null),D=Yf(p,Object.values(p)),L=f1("DndDescribedBy",s),j=k.useMemo(()=>E.getEnabled(),[E]),U=M2e(f),{droppableRects:G,measureDroppableContainers:W,measuringScheduled:X}=g2e(j,{dragging:w,dependencies:[P.x,P.y],config:U.droppable}),Y=h2e(T,x),B=k.useMemo(()=>N?Qf(N):null,[N]),H=fa(),Q=m2e(Y,U.draggable.measure);I2e({activeNode:x?T.get(x):null,config:H.layoutShiftCompensation,initialRect:Q,measure:U.draggable.measure});const J=EP(Y,U.draggable.measure,Q),ne=EP(Y?Y.parentElement:null),te=k.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),xe=E.getNodeFor((n=te.current.over)==null?void 0:n.id),ve=T2e({measure:U.dragOverlay.measure}),ce=(r=ve.nodeRef.current)!=null?r:Y,Ne=w?(i=ve.rect)!=null?i:J:null,se=!!(ve.nodeRef.current&&ve.rect),pt=b2e(se?null:J),yn=C$(ce?ir(ce):null),Rt=_2e(w?xe??Y:null),ut=C2e(Rt),Je=A$(h,{transform:{x:P.x-pt.x,y:P.y-pt.y,scaleX:1,scaleY:1},activatorEvent:N,active:M,activeNodeRect:J,containerNodeRect:ne,draggingNodeRect:Ne,over:te.current.over,overlayNodeRect:ve.rect,scrollableAncestors:Rt,scrollableAncestorRects:ut,windowRect:yn}),Ut=B?ju(B,P):null,or=S2e(Rt),ti=AP(or),Dr=AP(or,[J]),On=ju(Je,ti),vn=Ne?WSe(Ne,Je):null,zn=M&&vn?d({active:M,collisionRect:vn,droppableRects:G,droppableContainers:j,pointerCoordinates:Ut}):null,Gt=jSe(zn,"id"),[wt,Sr]=k.useState(null),Lr=se?Je:ju(Je,Dr),ni=HSe(Lr,(o=wt==null?void 0:wt.rect)!=null?o:null,J),lo=k.useCallback((xt,et)=>{let{sensor:_n,options:an}=et;if(C.current==null)return;const Rn=T.get(C.current);if(!Rn)return;const Un=xt.nativeEvent,sr=new _n({active:C.current,activeNode:Rn,event:Un,options:an,context:te,onStart(Gn){const Sn=C.current;if(Sn==null)return;const uo=T.get(Sn);if(!uo)return;const{onDragStart:Qo}=D.current,Zo={active:{id:Sn,data:uo.data,rect:$}};Vi.unstable_batchedUpdates(()=>{Qo==null||Qo(Zo),S(fs.Initializing),y({type:tn.DragStart,initialCoordinates:Gn,active:Sn}),v({type:"onDragStart",event:Zo})})},onMove(Gn){y({type:tn.DragMove,coordinates:Gn})},onEnd:ki(tn.DragEnd),onCancel:ki(tn.DragCancel)});Vi.unstable_batchedUpdates(()=>{I(sr),R(xt.nativeEvent)});function ki(Gn){return async function(){const{active:uo,collisions:Qo,over:Zo,scrollAdjustedTranslate:kl}=te.current;let co=null;if(uo&&kl){const{cancelDrop:Hn}=D.current;co={activatorEvent:Un,active:uo,collisions:Qo,delta:kl,over:Zo},Gn===tn.DragEnd&&typeof Hn=="function"&&await Promise.resolve(Hn(co))&&(Gn=tn.DragCancel)}C.current=null,Vi.unstable_batchedUpdates(()=>{y({type:Gn}),S(fs.Uninitialized),Sr(null),I(null),R(null);const Hn=Gn===tn.DragEnd?"onDragEnd":"onDragCancel";if(co){const ha=D.current[Hn];ha==null||ha(co),v({type:Hn,event:co})}})}}},[T]),bn=k.useCallback((xt,et)=>(_n,an)=>{const Rn=_n.nativeEvent,Un=T.get(an);if(C.current!==null||!Un||Rn.dndKit||Rn.defaultPrevented)return;const sr={active:Un};xt(_n,et.options,sr)===!0&&(Rn.dndKit={capturedBy:et.sensor},C.current=an,lo(_n,et))},[T,lo]),ri=p2e(c,bn);w2e(c),ro(()=>{J&&b===fs.Initializing&&S(fs.Initialized)},[J,b]),k.useEffect(()=>{const{onDragMove:xt}=D.current,{active:et,activatorEvent:_n,collisions:an,over:Rn}=te.current;if(!et||!_n)return;const Un={active:et,activatorEvent:_n,collisions:an,delta:{x:On.x,y:On.y},over:Rn};Vi.unstable_batchedUpdates(()=>{xt==null||xt(Un),v({type:"onDragMove",event:Un})})},[On.x,On.y]),k.useEffect(()=>{const{active:xt,activatorEvent:et,collisions:_n,droppableContainers:an,scrollAdjustedTranslate:Rn}=te.current;if(!xt||C.current==null||!et||!Rn)return;const{onDragOver:Un}=D.current,sr=an.get(Gt),ki=sr&&sr.rect.current?{id:sr.id,rect:sr.rect.current,data:sr.data,disabled:sr.disabled}:null,Gn={active:xt,activatorEvent:et,collisions:_n,delta:{x:Rn.x,y:Rn.y},over:ki};Vi.unstable_batchedUpdates(()=>{Sr(ki),Un==null||Un(Gn),v({type:"onDragOver",event:Gn})})},[Gt]),ro(()=>{te.current={activatorEvent:N,active:M,activeNode:Y,collisionRect:vn,collisions:zn,droppableRects:G,draggableNodes:T,draggingNode:ce,draggingNodeRect:Ne,droppableContainers:E,over:wt,scrollableAncestors:Rt,scrollAdjustedTranslate:On},$.current={initial:Ne,translated:vn}},[M,Y,zn,vn,T,ce,Ne,G,E,wt,Rt,On]),c2e({...H,delta:P,draggingRect:vn,pointerCoordinates:Ut,scrollableAncestors:Rt,scrollableAncestorRects:ut});const da=k.useMemo(()=>({active:M,activeNode:Y,activeNodeRect:J,activatorEvent:N,collisions:zn,containerNodeRect:ne,dragOverlay:ve,draggableNodes:T,droppableContainers:E,droppableRects:G,over:wt,measureDroppableContainers:W,scrollableAncestors:Rt,scrollableAncestorRects:ut,measuringConfiguration:U,measuringScheduled:X,windowRect:yn}),[M,Y,J,N,zn,ne,ve,T,E,G,wt,W,Rt,ut,U,X,yn]),Ai=k.useMemo(()=>({activatorEvent:N,activators:ri,active:M,activeNodeRect:J,ariaDescribedById:{draggable:L},dispatch:y,draggableNodes:T,over:wt,measureDroppableContainers:W}),[N,ri,M,J,y,L,T,wt,W]);return We.createElement(u$.Provider,{value:g},We.createElement(Hh.Provider,{value:Ai},We.createElement(P$.Provider,{value:da},We.createElement(p1.Provider,{value:ni},u)),We.createElement(R2e,{disabled:(a==null?void 0:a.restoreFocus)===!1})),We.createElement(ISe,{...a,hiddenTextDescribedById:L}));function fa(){const xt=(O==null?void 0:O.autoScrollEnabled)===!1,et=typeof l=="object"?l.enabled===!1:l===!1,_n=w&&!xt&&!et;return typeof l=="object"?{...l,enabled:_n}:{enabled:_n}}}),D2e=k.createContext(null),kP="button",L2e="Droppable";function $2e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=f1(L2e),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=k.useContext(Hh),{role:h=kP,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,y=k.useContext(_?p1:D2e),[v,g]=yy(),[b,S]=yy(),w=x2e(s,t),x=Yf(n);ro(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:b,data:x}),()=>{const P=d.get(t);P&&P.key===o&&d.delete(t)}),[d,t]);const T=k.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===kP?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:y}}function F2e(){return k.useContext(P$)}const B2e="Droppable",j2e={timeout:25};function V2e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=f1(B2e),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=k.useContext(Hh),c=k.useRef({disabled:n}),d=k.useRef(!1),f=k.useRef(null),h=k.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...j2e,...i},y=Yf(m??r),v=k.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),h.current=null},_)},[_]),g=h1({callback:v,disabled:p||!s}),b=k.useCallback((T,P)=>{g&&(P&&(g.unobserve(P),d.current=!1),T&&g.observe(T))},[g]),[S,w]=yy(b),x=Yf(t);return k.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),ro(()=>(a({type:tn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>a({type:tn.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==c.current.disabled&&(a({type:tn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function z2e(e){let{animation:t,children:n}=e;const[r,i]=k.useState(null),[o,s]=k.useState(null),a=vy(n);return!n&&!r&&a&&i(a),ro(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),We.createElement(We.Fragment,null,n,r?k.cloneElement(r,{ref:s}):null)}const U2e={x:0,y:0,scaleX:1,scaleY:1};function G2e(e){let{children:t}=e;return We.createElement(Hh.Provider,{value:E$},We.createElement(p1.Provider,{value:U2e},t))}const H2e={position:"fixed",touchAction:"none"},q2e=e=>S3(e)?"transform 250ms ease":void 0,W2e=k.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:u,transition:c=q2e}=e;if(!a)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...H2e,width:a.width,height:a.height,top:a.top,left:a.left,transform:Zf.Transform.toString(d),transformOrigin:i&&r?LSe(r,a):void 0,transition:typeof c=="function"?c(r):c,...l};return We.createElement(n,{className:s,style:f,ref:t},o)}),K2e=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},X2e=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Zf.Transform.toString(t)},{transform:Zf.Transform.toString(n)}]},Y2e={duration:250,easing:"ease",keyframes:X2e,sideEffects:K2e({styles:{active:{opacity:"0"}}})};function Q2e(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return d1((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=T$(s);if(!u)return;const{transform:c}=ir(s).getComputedStyle(s),d=d$(c);if(!d)return;const f=typeof t=="function"?t:Z2e(t);return v$(l,i.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function Z2e(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...Y2e,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...u}=o;if(!t)return;const c={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},d={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:s,dragOverlay:a,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:s,dragOverlay:a,...u}),y=a.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{y.onfinish=()=>{_==null||_(),v()}})}}let OP=0;function J2e(e){return k.useMemo(()=>{if(e!=null)return OP++,OP},[e])}const ewe=We.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:y,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:b,windowRect:S}=F2e(),w=k.useContext(p1),x=J2e(d==null?void 0:d.id),T=A$(s,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:y,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:b,transform:w,windowRect:S}),P=T3(f),E=Q2e({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),A=P?_.setRef:void 0;return We.createElement(G2e,null,We.createElement(z2e,{animation:E},d&&x?We.createElement(W2e,{key:x,id:d.id,ref:A,as:a,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:P,style:{zIndex:u,...i},transform:T},n):null))}),twe=e=>{let{activatorEvent:t,draggingNodeRect:n,transform:r}=e;if(n&&t){const i=Qf(t);if(!i)return r;const o=i.x-n.left,s=i.y-n.top;return{...r,x:r.x+o-n.width/2,y:r.y+s-n.height/2}}return r},k$=()=>uk(),R4e=tk,Qp=28,RP={w:Qp,h:Qp,maxW:Qp,maxH:Qp,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},nwe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return K.jsx(d3,{sx:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",cursor:"none"},children:K.jsx(c3,{sx:{...RP},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_NAMES"?K.jsxs(f3,{sx:{cursor:"none",userSelect:"none",position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...RP},children:[K.jsx(X2,{children:e.dragData.payload.image_names.length}),K.jsx(X2,{size:"sm",children:"Images"})]}):null},rwe=k.memo(nwe);function M4e(e){return V2e(e)}function I4e(e){return $2e(e)}const N4e=(e,t)=>{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"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_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_NAMES";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_NAMES";case"MOVE_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_NAMES"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:o}=t.data.current.payload,s=o.board_id,a=e.context.boardId;return!(s===a)&&(s?!0:a)}return r!=="IMAGE_NAMES"}default:return!1}};function iwe(e){return K.jsx(N2e,{...e})}const owe=e=>{const[t,n]=k.useState(null),r=k$(),i=k.useCallback(u=>{console.log("dragStart",u.active.data.current);const c=u.active.data.current;c&&n(c)},[]),o=k.useCallback(u=>{var d;console.log("dragEnd",u.active.data.current);const c=(d=u.over)==null?void 0:d.data.current;!t||!c||(r(rN({overData:c,activeData:t})),n(null))},[t,r]),s=_P(w$,{activationConstraint:{distance:10}}),a=_P(x$,{activationConstraint:{distance:10}}),l=NSe(s,a);return K.jsxs(iwe,{onDragStart:i,onDragEnd:o,sensors:l,collisionDetection:GSe,children:[e.children,K.jsx(ewe,{dropAnimation:null,modifiers:[twe],children:K.jsx(Kbe,{children:t&&K.jsx(jbe.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:K.jsx(rwe,{dragData:t})},"overlay-drag-image")})})]})},swe=k.memo(owe),awe=k.createContext({isOpen:!1,onClose:()=>{},onClickAddToBoard:()=>{},handleAddToBoard:()=>{}}),lwe=e=>{const[t,n]=k.useState(),{isOpen:r,onOpen:i,onClose:o}=n_e(),s=k$(),a=k.useCallback(()=>{n(void 0),o()},[o]),l=k.useCallback(c=>{c&&(n(c),i())},[n,i]),u=k.useCallback(c=>{t&&(s(he.endpoints.addImageToBoard.initiate({imageDTO:t,board_id:c})),a())},[s,a,t]);return K.jsx(awe.Provider,{value:{isOpen:r,image:t,onClose:a,onClickAddToBoard:l,handleAddToBoard:u},children:e.children})},uwe=k.lazy(()=>q9(()=>import("./App-2d0c33e3.js"),["./App-2d0c33e3.js","./MantineProvider-149dbf3d.js","./App-6125620a.css"],import.meta.url)),cwe=k.lazy(()=>q9(()=>import("./ThemeLocaleProvider-36ea6c56.js"),["./ThemeLocaleProvider-36ea6c56.js","./MantineProvider-149dbf3d.js","./ThemeLocaleProvider-5b992bc7.css"],import.meta.url)),dwe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i})=>(k.useEffect(()=>(t&&Tf.set(t),e&&Ef.set(e),GI(),i&&i.length>0?d2(vP(),...i):d2(vP()),()=>{Ef.set(void 0),Tf.set(void 0)}),[e,t,i]),K.jsx(We.StrictMode,{children:K.jsx(vV,{store:Wpe,children:K.jsx(We.Suspense,{fallback:K.jsx(s_e,{}),children:K.jsx(cwe,{children:K.jsx(swe,{children:K.jsx(lwe,{children:K.jsx(uwe,{config:n,headerComponent:r})})})})})})})),fwe=k.memo(dwe);T_.createRoot(document.getElementById("root")).render(K.jsx(fwe,{}));export{pD as $,K as A,ei as B,jt as C,Du as D,jn as E,di as F,Zne as G,vr as H,Rs as I,Li as J,j3e as K,xM as L,hre as M,Ure as N,lte as O,tre as P,oc as Q,$ge as R,ff as S,El as T,al as U,aD as V,m4e as W,h4e as X,Kbe as Y,jbe as Z,E4e as _,eO as a,GS as a$,BL as a0,vD as a1,p4e as a2,g4e as a3,Lge as a4,Dge as a5,y4e as a6,Da as a7,ll as a8,om as a9,f3 as aA,X2 as aB,l4e as aC,zN as aD,t3e as aE,Q4 as aF,dCe as aG,Vi as aH,jC as aI,iF as aJ,mwe as aK,pwe as aL,gwe as aM,Ee as aN,Pa as aO,P3e as aP,ZI as aQ,T3e as aR,E3e as aS,x3e as aT,b3e as aU,Lpe as aV,M4e as aW,N4e as aX,w3e as aY,N3e as aZ,YCe as a_,NV as aa,We as ab,nP as ac,fye as ad,T4e as ae,Ro as af,oD as ag,N1e as ah,_4e as ai,M2 as aj,f4e as ak,C4e as al,Zn as am,yC as an,w0 as ao,R4e as ap,z3e as aq,Eh as ar,iI as as,OI as at,ev as au,k$ as av,y5e as aw,Ft as ax,Ha as ay,d3 as az,Ex as b,N7 as b$,C3e as b0,c3 as b1,i_e as b2,Sxe as b3,bs as b4,O5e as b5,pp as b6,wge as b7,BC as b8,eD as b9,ue as bA,awe as bB,QCe as bC,pJ as bD,r3e as bE,BR as bF,Jxe as bG,IR as bH,HS as bI,I4e as bJ,d4e as bK,I3e as bL,JCe as bM,e3e as bN,Os as bO,Gle as bP,KCe as bQ,XCe as bR,qCe as bS,n_e as bT,Om as bU,a4e as bV,L5e as bW,bxe as bX,wle as bY,h5e as bZ,D3e as b_,Cge as ba,F3 as bb,R3e as bc,O3e as bd,hwe as be,bwe as bf,_we as bg,zwe as bh,Uwe as bi,Twe as bj,Xwe as bk,wwe as bl,Dwe as bm,Awe as bn,nue as bo,xwe as bp,Gwe as bq,Swe as br,exe as bs,Ewe as bt,Lwe as bu,Pwe as bv,$we as bw,Rwe as bx,Bwe as by,tue as bz,OU as c,fxe as c$,nN as c0,M5e as c1,WCe as c2,i3e as c3,P7 as c4,FR as c5,Cwe as c6,Exe as c7,Vn as c8,x5e as c9,Ah as cA,dxe as cB,txe as cC,axe as cD,Vwe as cE,v5e as cF,hl as cG,_5e as cH,o5e as cI,i5e as cJ,F5e as cK,r4e as cL,c5e as cM,l5e as cN,fe as cO,Cf as cP,Y5e as cQ,xE as cR,u5e as cS,d5e as cT,a5e as cU,Zse as cV,jwe as cW,B5e as cX,yQ as cY,U5e as cZ,kR as c_,I5e as ca,R5e as cb,ele as cc,w5e as cd,E5e as ce,P5e as cf,SQ as cg,Sae as ch,wae as ci,yxe as cj,Txe as ck,T5e as cl,CQ as cm,V3e as cn,m5e as co,AR as cp,v3e as cq,g3e as cr,m3e as cs,y3e as ct,z5e as cu,Za as cv,ywe as cw,wo as cx,cce as cy,Mwe as cz,vX as d,pe as d$,wQ as d0,zi as d1,Fwe as d2,Qwe as d3,vwe as d4,uY as d5,Jwe as d6,s5e as d7,hxe as d8,r5e as d9,p3e as dA,E7 as dB,a3e as dC,u3e as dD,o3e as dE,xpe as dF,s3e as dG,lxe as dH,uxe as dI,oxe as dJ,sxe as dK,ixe as dL,Z5e as dM,W5e as dN,k5e as dO,q5e as dP,n4e as dQ,Q5e as dR,A5e as dS,X5e as dT,K5e as dU,G5e as dV,H5e as dW,qM as dX,$x as dY,J5e as dZ,jm as d_,mce as da,gxe as db,he as dc,Wn as dd,$5e as de,$3e as df,F3e as dg,L7 as dh,V5e as di,L3e as dj,gR as dk,cxe as dl,lY as dm,Owe as dn,j5e as dp,_T as dq,c3e as dr,qx as ds,iJ as dt,Ql as du,ST as dv,d3e as dw,f3e as dx,h3e as dy,oJ as dz,eR as e,wpe as e$,e4e as e0,c2 as e1,kwe as e2,t4e as e3,tk as e4,uk as e5,n5e as e6,X3e as e7,Y3e as e8,Q3e as e9,hCe as eA,rd as eB,uCe as eC,Gxe as eD,rv as eE,fCe as eF,jxe as eG,cCe as eH,Vxe as eI,Wxe as eJ,Oxe as eK,kxe as eL,Axe as eM,FCe as eN,DR as eO,Tf as eP,Dxe as eQ,Lxe as eR,$xe as eS,DCe as eT,Xxe as eU,Kxe as eV,VQ as eW,NCe as eX,kle as eY,Hxe as eZ,bpe as e_,II as ea,e5e as eb,t5e as ec,Lf as ed,x0 as ee,H3e as ef,Fpe as eg,U3e as eh,G3e as ei,W3e as ej,q3e as ek,K3e as el,J3e as em,jie as en,nI as eo,aN as ep,EF as eq,Pe as er,vCe as es,$Ce as et,LCe as eu,Qxe as ev,PCe as ew,BCe as ex,Ole as ey,Uxe as ez,lO as f,cye as f$,tCe as f0,nCe as f1,bCe as f2,yCe as f3,pCe as f4,Rxe as f5,Mxe as f6,N5e as f7,D5e as f8,lCe as f9,_Q as fA,nxe as fB,Nxe as fC,iCe as fD,UCe as fE,Hwe as fF,qwe as fG,Wwe as fH,Kwe as fI,oCe as fJ,s4e as fK,_xe as fL,OR as fM,xxe as fN,wxe as fO,Cxe as fP,sY as fQ,_le as fR,c4e as fS,sD as fT,x4e as fU,S4e as fV,v4e as fW,w4e as fX,qi as fY,b4e as fZ,u4e as f_,eCe as fa,_Ce as fb,ECe as fc,SCe as fd,Yxe as fe,zxe as ff,ICe as fg,MCe as fh,CCe as fi,wCe as fj,xCe as fk,GCe as fl,OCe as fm,HCe as fn,aCe as fo,sCe as fp,Bxe as fq,Fxe as fr,zCe as fs,Zxe as ft,Ale as fu,Tle as fv,Ele as fw,Ple as fx,Ixe as fy,pxe as fz,dX as g,Jme as g0,P4e as g1,k4e as g2,O4e as g3,yO as h,yr as i,vc as j,_0 as k,gn as l,b0 as m,ph as n,xi as o,na as p,y0 as q,io as r,mh as s,gb as t,wx as u,sO as v,Ox as w,WO as x,uO as y,k as z}; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index 854c38f0a9..897ea432c1 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -12,7 +12,7 @@ margin: 0; } - + diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index f45b33e826..a90f36d03e 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -14,6 +14,7 @@ import { MergeModelConfig, TextualInversionModelConfig, VaeModelConfig, + ModelType, } from 'services/api/types'; import queryString from 'query-string'; @@ -62,6 +63,7 @@ type UpdateMainModelResponse = type DeleteMainModelArg = { base_model: BaseModelType; model_name: string; + model_type: ModelType; }; type DeleteMainModelResponse = void; @@ -287,9 +289,9 @@ export const modelsApi = api.injectEndpoints({ DeleteMainModelResponse, DeleteMainModelArg >({ - query: ({ base_model, model_name }) => { + query: ({ base_model, model_name, model_type }) => { return { - url: `models/${base_model}/main/${model_name}`, + url: `models/${base_model}/${model_type}/${model_name}`, method: 'DELETE', }; },