@shumai-one/shumai 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chunk-02b5bcmc.js +1 -0
- package/bin/{chunk-m0q2cgfg.js → chunk-09mj32d7.js} +1 -1
- package/bin/{chunk-b7bnp021.js → chunk-09mpcg9x.js} +2 -2
- package/bin/{chunk-257dcd2f.js → chunk-0a298n62.js} +2 -2
- package/bin/{chunk-cz13a82m.js → chunk-0rgbxp24.js} +2 -2
- package/bin/{chunk-mwktrwtx.js → chunk-19zbh4fr.js} +1 -1
- package/bin/{chunk-v05rrxp5.js → chunk-1e1q1hyg.js} +2 -2
- package/bin/{chunk-fatmqnp1.js → chunk-1ja2zw4w.js} +1 -1
- package/bin/chunk-1tar0x8s.js +7 -0
- package/bin/{chunk-1nvd90g2.js → chunk-1y6h4vge.js} +1 -1
- package/bin/{chunk-tekwpkjf.js → chunk-20bamhwa.js} +2 -2
- package/bin/{chunk-8mqbztj8.js → chunk-20w1w9x7.js} +2 -2
- package/bin/{chunk-qwpkcp8d.js → chunk-25npafhz.js} +2 -2
- package/bin/{chunk-km4gn6b6.js → chunk-2qgagdb7.js} +1 -1
- package/bin/chunk-2t6g3pny.js +3 -0
- package/bin/{chunk-ns33grgx.js → chunk-34f64q0q.js} +1 -1
- package/bin/{chunk-1wfg56z3.js → chunk-3hgrw1m0.js} +4 -4
- package/bin/{chunk-p3f5aevs.js → chunk-3s2ga6mt.js} +1 -1
- package/bin/{chunk-hzkjgcre.js → chunk-3vpz5nat.js} +1 -1
- package/bin/{chunk-2jj4j8cn.js → chunk-4p31kxjh.js} +2 -2
- package/bin/{chunk-9t3p4xp6.js → chunk-4vjgdj0h.js} +1 -1
- package/bin/{chunk-96qpjght.js → chunk-50pfmxt1.js} +2 -2
- package/bin/{chunk-2cdxm1cp.js → chunk-5ddg5ezb.js} +9 -9
- package/bin/chunk-5ngftxjb.js +218 -0
- package/bin/{chunk-r1xer8gn.js → chunk-6f3zhq64.js} +3 -3
- package/bin/chunk-6nqqe7w9.js +1 -0
- package/bin/{chunk-h1n7jqnw.js → chunk-6t525bmg.js} +1 -1
- package/bin/{chunk-01052ssf.js → chunk-7546ptwg.js} +11 -11
- package/bin/{chunk-82tps5n1.js → chunk-7jz3cmq6.js} +1 -1
- package/bin/{chunk-v5cn90cf.js → chunk-7kah3zb5.js} +2 -2
- package/bin/{chunk-73yncv54.js → chunk-7mawxsk3.js} +2 -2
- package/bin/chunk-8ww98y1m.js +2 -0
- package/bin/{chunk-55h9ze53.js → chunk-9405hzv2.js} +2 -2
- package/bin/{chunk-cgmebxx6.js → chunk-95b4mwyq.js} +1 -1
- package/bin/chunk-9vxmgvc8.js +2 -0
- package/bin/{chunk-knj2s8mg.js → chunk-9x42vgeq.js} +5 -5
- package/bin/{chunk-7sgrtxbt.js → chunk-a859y4e1.js} +2 -2
- package/bin/{chunk-y241cxff.js → chunk-addssm8d.js} +1 -1
- package/bin/{chunk-f6avg5qe.js → chunk-ajq9sxg0.js} +33 -33
- package/bin/chunk-amp9h878.js +2 -0
- package/bin/{chunk-yk12hydf.js → chunk-atdfqdkj.js} +4 -4
- package/bin/{chunk-5wapd171.js → chunk-atpt99h4.js} +10 -10
- package/bin/chunk-awshe30f.js +1 -0
- package/bin/chunk-b3t7gbhm.js +2 -0
- package/bin/{chunk-e4f56spj.js → chunk-bbxwyhz3.js} +3 -3
- package/bin/{chunk-a411xhmm.js → chunk-bd3v8mp1.js} +4 -4
- package/bin/{chunk-167z646e.js → chunk-brgns7hv.js} +1 -1
- package/bin/{chunk-576nj64j.js → chunk-c02727j9.js} +2 -2
- package/bin/{chunk-8yjsmr7g.js → chunk-c1wvs81k.js} +1 -1
- package/bin/chunk-c8frmqsk.js +2 -0
- package/bin/{chunk-xc54vhfz.js → chunk-cagzye3j.js} +1 -1
- package/bin/{chunk-s9ksftq2.js → chunk-cp96e9pq.js} +1 -1
- package/bin/{chunk-q5vkxee3.js → chunk-d55138xx.js} +2 -2
- package/bin/{chunk-7v7mypc6.js → chunk-ddmf9gqv.js} +2 -2
- package/bin/chunk-djb65frk.js +1 -0
- package/bin/{chunk-q83h0hkx.js → chunk-dkhdn92k.js} +2 -2
- package/bin/chunk-dx9f5wab.js +1 -0
- package/bin/{chunk-f25fe9th.js → chunk-dygj751y.js} +11 -11
- package/bin/{chunk-m9adtgzk.js → chunk-e55sgg8t.js} +1 -1
- package/bin/{chunk-q8w4mbw4.js → chunk-enax4303.js} +2 -2
- package/bin/{chunk-vcrmjtcz.js → chunk-erfkd3z9.js} +2 -2
- package/bin/{chunk-8cjet7pp.js → chunk-esj0kwe5.js} +5 -5
- package/bin/{chunk-atfz7g7e.js → chunk-etrm28sy.js} +1 -1
- package/bin/chunk-ex3174e3.js +2 -0
- package/bin/{chunk-9n1w5dw1.js → chunk-ezjxx44x.js} +3 -3
- package/bin/{chunk-cf5axr8c.js → chunk-f4xnx4n6.js} +1 -1
- package/bin/{chunk-7naa7tpn.js → chunk-f8hgy69t.js} +2 -2
- package/bin/chunk-fakph5jp.js +1 -0
- package/bin/{chunk-kvhf12b4.js → chunk-femnbfkj.js} +1 -1
- package/bin/{chunk-ah8fjb6f.js → chunk-ffjdkdcv.js} +2 -2
- package/bin/{chunk-vkzasgxw.js → chunk-gd016e9p.js} +2 -2
- package/bin/{chunk-ympbfzz4.js → chunk-gyv3yrhj.js} +1 -1
- package/bin/{chunk-jzgbxqdg.js → chunk-h2bphev9.js} +2 -2
- package/bin/chunk-h3atwgx2.js +1 -0
- package/bin/chunk-h7xny3de.js +2 -0
- package/bin/{chunk-m82tkhaa.js → chunk-hg3rkp41.js} +5 -5
- package/bin/{chunk-3z85zxkn.js → chunk-hpzk9k55.js} +1 -1
- package/bin/{chunk-9zsv6d2f.js → chunk-hsyfrzdd.js} +1 -1
- package/bin/chunk-hvyy8vct.js +3 -0
- package/bin/{chunk-b5rhvzv9.js → chunk-j2txsbxz.js} +2 -2
- package/bin/chunk-j6x53e33.js +1 -0
- package/bin/chunk-jacanzp7.js +1 -0
- package/bin/{chunk-g6sdezec.js → chunk-jc7dycy6.js} +1 -1
- package/bin/{chunk-cwat1jwx.js → chunk-k7vbk8v4.js} +1 -1
- package/bin/{chunk-zrszykjf.js → chunk-mn0kt3p6.js} +1 -1
- package/bin/chunk-mn71dffh.js +4 -0
- package/bin/{chunk-vp3czaeh.js → chunk-npeapp7e.js} +2 -2
- package/bin/{chunk-2nhgdqdg.js → chunk-p2vsdnd1.js} +2 -2
- package/bin/chunk-pdw77q09.js +2 -0
- package/bin/{chunk-zezje74z.js → chunk-pq6kdp83.js} +3 -3
- package/bin/chunk-ptcz4ed3.js +2 -0
- package/bin/{chunk-z1p13dnc.js → chunk-q1fzgqsv.js} +2 -2
- package/bin/chunk-q4ny4hpt.js +2 -0
- package/bin/{chunk-mzsw9var.js → chunk-q5x0yywj.js} +2 -2
- package/bin/{chunk-g22wmpk1.js → chunk-q8xr1a8j.js} +2 -2
- package/bin/chunk-q8ysc5ex.js +1 -0
- package/bin/{chunk-1ktk6764.js → chunk-qm50g4n5.js} +4 -4
- package/bin/{chunk-q2bew2vc.js → chunk-qvp24w0q.js} +2 -2
- package/bin/{chunk-9xhjy897.js → chunk-r6t0j0jx.js} +3 -3
- package/bin/chunk-s1j4v33x.js +2 -0
- package/bin/{chunk-yq32evnn.js → chunk-s6pk2zyg.js} +5 -5
- package/bin/{chunk-hnkcgvcj.js → chunk-s74g9vsk.js} +1 -1
- package/bin/{chunk-gxepkvt2.js → chunk-sz19nn1x.js} +1 -1
- package/bin/{chunk-hpbn0k9n.js → chunk-sz5zawfw.js} +1 -1
- package/bin/chunk-t68y25gf.js +1 -0
- package/bin/{chunk-mcw198kg.js → chunk-te484xtb.js} +8 -8
- package/bin/{chunk-jt0ykktx.js → chunk-tfrevef9.js} +1 -1
- package/bin/chunk-thpw6tcj.js +2 -0
- package/bin/{chunk-02fvcrej.js → chunk-v0yevesp.js} +7 -7
- package/bin/chunk-vj4gamdn.js +2 -0
- package/bin/{chunk-p4s95471.js → chunk-vmwys2ch.js} +1 -1
- package/bin/{chunk-e4yscwen.js → chunk-vnmggrd6.js} +7 -7
- package/bin/{chunk-hpwv4am3.js → chunk-vv0m0m2f.js} +4 -4
- package/bin/{chunk-x03jwaga.js → chunk-w6g84d59.js} +4 -4
- package/bin/{chunk-3ckkwdjx.js → chunk-wgvgtttc.js} +3 -3
- package/bin/chunk-xy9qpn6b.js +1 -0
- package/bin/{chunk-mcj1xpcc.js → chunk-y3haqtr8.js} +2 -2
- package/bin/chunk-y5dv67mg.js +2 -0
- package/bin/{chunk-4mws03es.js → chunk-yb4mzqrd.js} +2 -2
- package/bin/{chunk-x8mjh387.js → chunk-z0de127n.js} +4 -4
- package/bin/chunk-z8t6e0ee.js +1 -0
- package/bin/chunk-zfg4yy3c.js +2 -0
- package/bin/{chunk-hw6czrya.js → chunk-zkvezz89.js} +1 -1
- package/bin/chunk-zrrnvdxq.js +3 -0
- package/bin/{chunk-srxp5jav.js → chunk-zx1c4vm5.js} +30 -30
- package/bin/chunk-zzqse5qc.js +2 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +328 -328
- package/package.json +7 -7
- package/bin/chunk-0bj887zm.js +0 -2
- package/bin/chunk-26qn7fek.js +0 -2
- package/bin/chunk-2ne2b54t.js +0 -2
- package/bin/chunk-2vbeqczj.js +0 -1
- package/bin/chunk-37p6bcx2.js +0 -1
- package/bin/chunk-3knfx6dm.js +0 -1
- package/bin/chunk-54tbfvya.js +0 -2
- package/bin/chunk-56kh5fxc.js +0 -1
- package/bin/chunk-6cnqjngz.js +0 -1
- package/bin/chunk-7g46e1wy.js +0 -3
- package/bin/chunk-84x8p7v5.js +0 -1
- package/bin/chunk-8fyg9dy4.js +0 -2
- package/bin/chunk-8gtfgkrn.js +0 -2
- package/bin/chunk-8xb6yz11.js +0 -2
- package/bin/chunk-91rb0jpb.js +0 -2
- package/bin/chunk-9f1xk1nt.js +0 -1
- package/bin/chunk-9mk9cvbk.js +0 -1
- package/bin/chunk-9nw5w8vh.js +0 -1
- package/bin/chunk-dk42gf7v.js +0 -2
- package/bin/chunk-eb7mzbfm.js +0 -1
- package/bin/chunk-er14d498.js +0 -3
- package/bin/chunk-fvx9k1dc.js +0 -2
- package/bin/chunk-gtf19jc1.js +0 -2
- package/bin/chunk-hfm82066.js +0 -2
- package/bin/chunk-kj6h5j5a.js +0 -4
- package/bin/chunk-ny1kbmxt.js +0 -2
- package/bin/chunk-p3j6ydk1.js +0 -1
- package/bin/chunk-pk406dgy.js +0 -2
- package/bin/chunk-s1e4qy3q.js +0 -14
- package/bin/chunk-swtwaaqe.js +0 -1
- package/bin/chunk-tagdrg7p.js +0 -1
- package/bin/chunk-twtxnzbv.js +0 -2
- package/bin/chunk-v5mcjwxy.js +0 -2
- package/bin/chunk-x342vzdx.js +0 -2
- package/bin/chunk-xvkwbczx.js +0 -3
- package/bin/chunk-zarz3sqn.js +0 -211
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{ne,Y,G,S,nt,Q,Rn,M,w,L,W,a,g,ie,X,ee,Tt,We,Mn,R,z,er,_o,Vr,_r,K,ao,En,rn,Po,$t,qe,Be,jt,Ml,ur,Bt,Pn,Er,Ti,xr,ki,Dn,Re,nr,Ue,Ge,B,Ut,pe,aa,tr,we,Uc,Gf,Vf,Kf,Wf,Jf,Yf,Xf,ep,tp,F,Nn,Fn,Ln,Zn,$e,He,Qe,De,Ne,Fe,de,dr,ri,Xy,rv,op,SA,yb,$b,Gm,lp,gd,Ad,_d,Ve,Fl,Zw,Gw,eE,Ym,i_,oE,sE,dE,u_,_E,vE,wE,EE,xE,CE,SE,IE,TE,kE,f_,Mt,DE,nh,zc,dp,Dr,_x,wx,Tx,kx,ah,Dx,Ms,zx,P_,eC,qc,ch,ma,uh,lC,cC,uC,dh,dC,fC,fh,pC,mC,_C,EC,xC,eS,LS,yh,vh,$S,n0,Ih,Th,o0,s0,kh,Rh,i0,a0,Hc,XI,xp,uT,Ph,Dh,_T,LT,ZT,BT,UT,zT,jT,Qc,qT,$T,HT,Gc,QT,GT,Sp,Vc,VT,KT,WT,Nh,Ip,Fh,v1,I0,x1,k1,$1,wk,Kh,Ek,Wh,ms,Nk,Jh,wo,$k,Xh,Qk,Gk,Vk,Kk,Wk,ey,eR,sR,iR,dR,fR,rg,yR,vR,bR,wR,my,Sd,Yc,sg,ig,nM,ag,Xc,Id,Td,lg,cg,kd,sM,FM,fg,oO,sO,fO,hO,TO,kO,Yn,eu,Oy,Dy,gg,Ag,tu,Ny,Rd,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,Ot,re,Ie,Xt,Os,an,Xn,Eo,si,ln,Vt,j,$r,nn,Wr,on,Gp,Vp,Kp,ve,Lo,Vl,Wp,bt,wt,Et,fe,Ke,Xe,et,tt,rt,be,Bo,Sr,Fr,An,Lr,_n,Zd,xg}from"./chunk-5ngftxjb.js";import{Ps,Ca,$d,rc,cn,As,Ns,ci,Gd,yu,ul,Sa,ui,Ia,dl,Fg,di}from"./chunk-ajq9sxg0.js";import{os,Zr}from"./chunk-qvp24w0q.js";import{fi,fl}from"./chunk-9405hzv2.js";import{wu}from"./chunk-20w1w9x7.js";import{nc}from"./chunk-0a298n62.js";import{$n}from"./chunk-25npafhz.js";import{jo}from"./chunk-88jg9dq5.js";import{Br}from"./chunk-7kah3zb5.js";L();var Js=Object.defineProperty,Rt=(e,t)=>Js(e,"name",{value:t,configurable:!0}),oo="ContextMenu",[Ys,cl]=Ut(oo,[Uc]),Pt=Uc(),[Zs,fr]=Ys(oo),ei=Rt((e)=>{let{__scopeContextMenu:t,children:n,onOpenChange:o,open:r,dir:s,modal:i=!0}=e,l=M(!1);if(aa){let h=M(!1);S(()=>{if(r===!0&&!l.current&&!h.current)h.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport.")},[r])}let[d,f]=tr({prop:r,defaultProp:!1,onChange:o,caller:oo}),u=Pt(t);return a(Zs,{scope:t,open:d,onOpenChange:f,modal:i,hasInteractedRef:l,children:a(Gf,{...u,dir:s,open:d,onOpenChange:f,modal:i,children:n})})},"ContextMenu"),ti="ContextMenuTrigger",ni=Y(Rt(function(t,n){let{__scopeContextMenu:o,disabled:r=!1,...s}=t,i=fr(ti,o),l=Pt(o),[d,f]=w({x:0,y:0}),u=Q(()=>({current:{getBoundingClientRect:Rt(()=>DOMRect.fromRect({width:0,height:0,...d}),"getBoundingClientRect")}}),[d]),h=M(0),c=G(()=>window.clearTimeout(h.current),[]),p=Rt((m)=>{i.hasInteractedRef.current=!0,f({x:m.clientX,y:m.clientY}),i.onOpenChange(!0)},"handleOpen");return S(()=>c,[c]),S(()=>void(r&&c()),[r,c]),g(W,{children:[a(Vf,{...l,virtualRef:u}),a(we.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:n,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:pe(t.onContextMenu,(m)=>{c(),p(m),m.preventDefault()}),onPointerDown:r?t.onPointerDown:pe(t.onPointerDown,mn((m)=>{if(c(),i.open)i.onOpenChange(!1);h.current=window.setTimeout(()=>p(m),700)})),onPointerMove:r?t.onPointerMove:pe(t.onPointerMove,mn(c)),onPointerCancel:r?t.onPointerCancel:pe(t.onPointerCancel,mn(c)),onPointerUp:r?t.onPointerUp:pe(t.onPointerUp,mn(c))})]})},"ContextMenuTrigger")),oi=Rt((e)=>{let{__scopeContextMenu:t,...n}=e,o=Pt(t);return a(Kf,{...o,...n})},"ContextMenuPortal"),ii="ContextMenuContent",ai=Y(Rt(function(t,n){let{__scopeContextMenu:o,...r}=t,s=fr(ii,o),i=Pt(o),l=M(!1);return a(Wf,{...i,...r,ref:n,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:(d)=>{if(t.onCloseAutoFocus?.(d),!d.defaultPrevented&&l.current)d.preventDefault();l.current=!1},onInteractOutside:(d)=>{if(t.onInteractOutside?.(d),!d.defaultPrevented&&!s.modal)l.current=!0},style:{...t.style,...{"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})},"ContextMenuContent"));var li=Y(Rt(function(t,n){let{__scopeContextMenu:o,...r}=t,s=Pt(o);return a(Jf,{...s,...r,ref:n})},"ContextMenuItem"));var pi=Y(Rt(function(t,n){let{__scopeContextMenu:o,...r}=t,s=Pt(o);return a(Yf,{...s,...r,ref:n})},"ContextMenuSeparator"));var mi="ContextMenuSub",gi=Rt((e)=>{let{__scopeContextMenu:t,children:n,onOpenChange:o,open:r,defaultOpen:s}=e,i=Pt(t),[l,d]=tr({prop:r,defaultProp:s??!1,onChange:o,caller:mi});return a(Xf,{...i,open:l,onOpenChange:d,children:n})},"ContextMenuSub"),hi=Y(Rt(function(t,n){let{__scopeContextMenu:o,...r}=t,s=Pt(o);return a(ep,{...s,...r,ref:n})},"ContextMenuSubTrigger")),vi=Y(Rt(function(t,n){let{__scopeContextMenu:o,...r}=t,s=Pt(o);return a(tp,{...s,...r,ref:n,style:{...t.style,...{"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})},"ContextMenuSubContent"));function mn(e){return(t)=>t.pointerType!=="mouse"?e(t):void 0}Rt(mn,"whenTouchOrPen");var wi=ei,xi=ni,pr=oi,yi=ai;var Ci=li;var Si=pi;var bi=gi,_i=hi,Ii=vi;var Fi=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],bn=z("layers",Fi);var Mi=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]],Bd=z("arrow-down-up",Mi);var Ni=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ud=z("folder-plus",Ni);var Ei=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],mr=z("message-circle-more",Ei);L();L();function gr({isOpen:e,onClose:t,onConfirm:n,mode:o,teamId:r,currentProjectId:s}){let[i,l]=w(s),[d,f]=w(null),[u,h]=w(!1),{data:c,isLoading:p}=X({queryKey:["projects",r],queryFn:async()=>{let k=await R.api.teams[":teamId"].projects.$get({param:{teamId:r},query:{first:"100"}});if(!k.ok)throw Error("Failed to fetch projects");return await k.json()},enabled:!!r&&e}),m=c?.data??[],v=m.find((k)=>k.id===i),C=()=>{if(d)n(d.id,u);else if(v?.rootFolder)n(v.rootFolder,u)};return a(Se,{open:e,onOpenChange:t,children:g(xe,{className:"sm:max-w-[425px] flex flex-col h-[600px]",children:[a(ke,{children:a(Ce,{children:o==="move"?"Move to":"Copy to"})}),g("div",{className:"flex flex-col gap-4 flex-1 overflow-hidden",children:[g("div",{className:"flex flex-col gap-2",children:[a("label",{className:"text-sm font-medium",children:"Select Project"}),g(Xe,{value:i,onValueChange:(k)=>{l(k),f(null)},children:[a(tt,{children:a(et,{placeholder:"Select a project"})}),a(rt,{children:m.map((k)=>a(be,{value:k.id,children:k.name},k.id))})]})]}),g("div",{className:"flex flex-col gap-2 flex-1 overflow-hidden",children:[a("label",{className:"text-sm font-medium",children:"Select Folder"}),a("div",{className:"border rounded-md flex-1 overflow-hidden",children:a(Ie,{className:"h-full",children:v&&v.rootFolder?a($r,{teamId:r,projectId:v.id,projectName:v.name,rootFolderId:v.rootFolder,onSelect:f,selectedFolderId:d?.id||v.rootFolder}):a("div",{className:"flex items-center justify-center h-full p-4",children:p?a(K,{className:"animate-spin h-6 w-6"}):"Select a project first"})})})]}),o==="copy"&&g("div",{className:"flex items-center space-x-2",children:[a(Sr,{id:"copy-comments",checked:u,onCheckedChange:(k)=>h(!!k)}),a("label",{htmlFor:"copy-comments",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Copy comments"})]})]}),g(ot,{children:[a(F,{variant:"outline",onClick:t,children:"Cancel"}),a(F,{onClick:C,disabled:!v,children:"Confirm"})]})]})})}L();function hr({item:e,isOpen:t,onClose:n,allowDownload:o=!0,shareId:r,sharePassword:s}){S(()=>{if(!t)return;let c=(p)=>{if(p.key===" "||p.code==="Space")p.preventDefault(),p.stopPropagation(),n()};return window.addEventListener("keydown",c,!0),()=>{window.removeEventListener("keydown",c,!0)}},[t,n]);let i=e?.type==="folder"||e?.targetType==="folder",l=e?.versionStack?e.versionStack.id:e?.id,d=s??(r&&typeof window<"u"?localStorage.getItem(`share_pwd_${r}`)||"":""),{data:f}=X({queryKey:r?["shares",r,"files",l,d]:["files",l],queryFn:async()=>{if(!l)throw Error("No target file ID");let c=r?await R.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:l}},d?{headers:{"x-share-password":d}}:void 0):await R.api.files[":fileId"].$get({param:{fileId:l}});if(!c.ok)throw Error("Failed to fetch file detail");return await c.json()},enabled:t&&!i&&!!l});if(!e)return null;let u=Boolean(e.media?.videoTranscodes?.some((c)=>!!c.url)||e.media?.imageTranscodes?.some((c)=>!!c.url)||e.media?.pdfTranscode?.url),h=f||(u?e:null);return a(Se,{open:t,onOpenChange:(c)=>{if(!c)n()},children:g(xe,{"data-testid":"file-preview-dialog-content",showCloseButton:!1,className:B("p-0 overflow-hidden flex flex-col gap-0 border bg-background rounded-lg shadow-2xl outline-none focus:outline-none focus-visible:outline-none",i?"w-full max-w-md max-h-[min(1080px,70vh)]":"w-[min(1920px,70vw)] h-[min(1080px,70vh)] max-w-[min(1920px,70vw)] max-h-[min(1080px,70vh)]"),style:{maxWidth:"min(1920px, 70vw)",maxHeight:"min(1080px, 70vh)"},children:[g("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border bg-card select-none shrink-0",children:[a("div",{className:"flex items-center gap-2 min-w-0 mr-4",children:a(Ce,{className:"text-sm font-medium text-foreground truncate",title:e.name,children:e.name})}),a("button",{"data-testid":"quick-preview-close-button",onClick:n,className:"p-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-muted transition-colors cursor-pointer","aria-label":"Close",children:a(Ge,{size:16})})]}),i?g("div",{className:"flex flex-col items-center justify-center p-8 text-center select-none gap-4",children:[a("div",{className:"p-4 rounded-2xl bg-primary/10 text-primary",children:a(xr,{className:"w-16 h-16 stroke-[1.5]","data-testid":"folder-preview-icon"})}),g("div",{className:"flex flex-col items-center gap-1 max-w-full px-2",children:[a("h3",{className:"text-lg font-semibold text-foreground truncate max-w-full",title:e.name,children:e.name}),a("p",{className:"text-sm text-muted-foreground","data-testid":"folder-preview-count",children:(e.fileCount||0)===1?a0({count:e.fileCount||0}):i0({count:e.fileCount||0})})]})]}):!h?a("div",{"data-testid":"preview-loading-spinner",className:"flex-1 flex items-center justify-center bg-background min-h-[300px]",children:a(K,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a("div",{className:"flex-1 relative min-h-0 overflow-hidden bg-background",children:a(Ns,{file:h,allowDownload:o,shareId:r,autoPlay:!0})})]})})}function vr({...e}){return a(wi,{"data-slot":"context-menu",...e})}function wr({...e}){return a(xi,{"data-slot":"context-menu-trigger",...e})}function ro({...e}){return a(pr,{"data-slot":"context-menu-portal",...e})}function so({...e}){return a(bi,{"data-slot":"context-menu-sub",...e})}function io({className:e,inset:t,children:n,...o}){return g(_i,{"data-slot":"context-menu-sub-trigger","data-inset":t,className:B("flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...o,children:[n,a(jt,{className:"ml-auto"})]})}function lo({className:e,...t}){return a(Ii,{"data-slot":"context-menu-sub-content",className:B("z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",e),...t})}function un({className:e,...t}){return a(pr,{children:a(yi,{"data-slot":"context-menu-content",className:B("z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",e),...t})})}function st({className:e,inset:t,variant:n="default",...o}){return a(Ci,{"data-slot":"context-menu-item","data-inset":t,"data-variant":n,className:B("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",e),...o})}function In({className:e,...t}){return a(Si,{"data-slot":"context-menu-separator",className:B("-mx-1 my-1 h-px bg-border",e),...t})}function yr({item:e,selectedIds:t,onRename:n,onDelete:o,onDownload:r,onCopyNameAndDownloadLink:s,onRestore:i,onNewFolder:l,onUploadFile:d,onUploadFolder:f,onNewVersion:u,onManageVersions:h,onMoveTo:c,onCopyTo:p,folders:m,files:v,isRecentlyDeleted:C,isRecents:b,onOpenAgentsMd:k,isShareView:D,onRemoveFromShare:P,shareLinks:le=[],onCreateShareLink:te,onAddToShareLink:ue,canEdit:V=!0}){let Ee=[...m,...v].filter((ge)=>t.has(ge.id)),Me=e&&t.has(e.id),ce=Me?Ee:e?[e]:[],se=ce,O=ce,ae=()=>{if(e)n(e)},ze=()=>{o(se)},Te=()=>{if(Me)r(Ee);else if(e)r([e])},_=()=>{if(Me)s?.(Ee);else if(e)s?.([e])},Pe=()=>{i(O)};if(b)return null;if(D){if(!e)return null;return g(un,{children:[g(st,{onSelect:Te,children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),g(st,{onSelect:_,children:[a(Br,{className:"mr-2 h-4 w-4"}),a("span",{children:Ym()})]}),V&&g(st,{onSelect:()=>P?.(ce),className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Wh()})]})]})}if(C){if(!e)return null;return a(un,{children:g(st,{onSelect:Pe,children:[a(ao,{className:"mr-2 h-4 w-4"}),a("span",{children:Jh()})]})})}if(!e){if(!V||b)return null;return g(un,{onCloseAutoFocus:(ge)=>{ge.preventDefault()},children:[g(st,{onSelect:d,children:[a(_o,{className:"mr-2 h-4 w-4"}),a("span",{children:gg()})]}),g(st,{onSelect:f,children:[a(_o,{className:"mr-2 h-4 w-4"}),a("span",{children:Ag()})]}),g(st,{onSelect:()=>{l(Hc())},children:[a(Ud,{className:"mr-2 h-4 w-4"}),a("span",{children:Hc()})]})]})}let Ze=Me&&t.size>1?g(un,{onCloseAutoFocus:(ge)=>{ge.preventDefault()},children:[g(st,{onSelect:Te,children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),g(st,{onSelect:_,children:[a(Br,{className:"mr-2 h-4 w-4"}),a("span",{children:Ym()})]}),V&&g(st,{onSelect:()=>c(ce),children:[a(Po,{className:"mr-2 h-4 w-4"}),a("span",{children:n0()})]}),V&&g(st,{onSelect:()=>p(ce),children:[a(Br,{className:"mr-2 h-4 w-4"}),a("span",{children:i_()})]}),V&&g(st,{onSelect:ze,className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Mt()})]}),V&&g(W,{children:[a(In,{}),g(st,{onSelect:()=>te?.(ce),children:[a(Re,{className:"mr-2 h-4 w-4"}),a("span",{children:u_()})]}),le.length>0&&g(so,{children:[g(io,{children:[a(nc,{className:"mr-2 h-4 w-4"}),a("span",{children:SA()})]}),a(ro,{children:a(lo,{className:"w-48",children:le.map((ge)=>a(st,{onSelect:()=>ue?.(ge.id,ce),children:a("span",{className:"truncate",children:ge.name})},ge.id))})})]})]})]}):g(un,{onCloseAutoFocus:(ge)=>{ge.preventDefault()},children:[V&&g(st,{onSelect:()=>{ae()},children:[a(En,{className:"mr-2 h-4 w-4"}),a("span",{children:ms()})]}),g(st,{onSelect:Te,children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),g(st,{onSelect:_,children:[a(Br,{className:"mr-2 h-4 w-4"}),a("span",{children:Ym()})]}),V&&g(st,{onSelect:()=>c(ce),children:[a(Po,{className:"mr-2 h-4 w-4"}),a("span",{children:n0()})]}),V&&g(st,{onSelect:()=>p(ce),children:[a(Br,{className:"mr-2 h-4 w-4"}),a("span",{children:i_()})]}),V&&(e.type==="file"||e.type==="version_stack")&&g(st,{onSelect:()=>u(e),children:[a(_o,{className:"mr-2 h-4 w-4"}),a("span",{children:dE()})]}),V&&e.type==="version_stack"&&g(st,{onSelect:()=>h?.(e),children:[a(bn,{className:"mr-2 h-4 w-4"}),a("span",{children:vh()})]}),e.type==="folder"&&k&&g(st,{onSelect:()=>k(e),children:[a(Pn,{className:"mr-2 h-4 w-4"}),a("span",{children:"AGENTS.md"})]}),V&&g(W,{children:[a(In,{}),g(st,{onSelect:ze,className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Mt()})]}),a(In,{}),g(st,{onSelect:()=>te?.(ce),children:[a(Re,{className:"mr-2 h-4 w-4"}),a("span",{children:u_()})]}),le.length>0&&g(so,{children:[g(io,{children:[a(nc,{className:"mr-2 h-4 w-4"}),a("span",{children:SA()})]}),a(ro,{children:a(lo,{className:"w-48",children:le.map((ge)=>a(st,{onSelect:()=>ue?.(ge.id,ce),children:a("span",{className:"truncate",children:ge.name})},ge.id))})})]})]})]});return a(W,{children:Ze})}L();var Yt=Y(({className:e,onClick:t,onMouseDown:n,disabled:o,value:r,title:s,tooltipSide:i="top",tooltipDelayDuration:l=100,...d},f)=>{let[u,h]=w(!1),c=M(null),p=typeof r==="string"?r:r?.toString()??"";if(o)return a(Nn,{delayDuration:l,children:g(Fn,{open:u,onOpenChange:(m)=>{if(m)if(c.current&&c.current.scrollWidth>c.current.clientWidth)h(!0);else h(!1);else h(!1)},children:[a(Ln,{asChild:!0,children:a("span",{ref:c,className:B("box-border block min-w-0 w-full rounded-sm border border-transparent px-1 py-0.5 text-base shadow-none transition-all outline-none cursor-default opacity-100 select-none truncate",e),onClick:t,onMouseDown:n,children:p})}),u&&a(Zn,{side:i,className:"max-w-md break-all text-wrap [text-wrap:normal] text-left",children:p})]})});return a(re,{ref:f,value:r,tabIndex:0,className:B("box-border block min-w-0 h-auto w-full rounded-sm border border-blue-500 !bg-muted/10 ring-1 ring-blue-500 px-1 py-0.5 text-base shadow-none transition-all outline-none focus-visible:ring-0",e),onClick:(m)=>{m.stopPropagation(),t?.(m)},onMouseDown:(m)=>{m.stopPropagation(),n?.(m)},...d})});Yt.displayName="EditableText";L();var gn=({item:e,showDuration:t=!1,matchDuration:n})=>{let o=e.preview?.proxyType||e.proxyType,r=o==="video",s=o==="audio",i=o==="pdf",l=o==="3d",d=r||s,f=e.preview?.duration,u=e.preview?.pageCount,c=n!=null&&n.startTime!=null&&n.endTime!=null?g("span",{"data-testid":"file-preview-matched-duration",className:"pointer-events-none absolute bottom-1 right-1 rounded bg-black/60 px-1 py-0.5 text-xs font-medium tabular-nums text-white",children:[fi(n.startTime)," - ",fi(n.endTime)]}):t&&d&&typeof f==="number"&&f>0?a("span",{className:"pointer-events-none absolute bottom-1 right-1 rounded bg-black/60 px-1 py-0.5 text-xs font-medium tabular-nums text-white",children:fi(f)}):t&&i&&typeof u==="number"&&u>0?g("span",{className:"pointer-events-none absolute bottom-1 right-1 rounded bg-black/60 px-1 py-0.5 text-xs font-medium tabular-nums text-white",children:[u," P"]}):null;if((r||i||l)&&e.preview?.spriteUrl&&e.preview.thumbnailUrl&&e.preview.originalWidth&&e.preview.originalHeight&&e.preview)return g(W,{children:[a(Kp,{spriteUrl:e.preview.spriteUrl,thumbnailUrl:e.preview.thumbnailUrl,videoWidth:e.preview.originalWidth,videoHeight:e.preview.originalHeight,reverse:l}),c]});if(e.preview?.thumbnailUrl)return g(W,{children:[a("img",{src:e.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-contain bg-black"}),c]});if(s)return g(W,{children:[a("div",{className:"w-full h-full flex items-center justify-center bg-zinc-950",children:a(Ps,{className:"w-8 h-8 text-zinc-500"})}),c]});if(!e.type)return a("div",{className:"w-full h-full flex items-center justify-center bg-linear-to-t from-black/5 to-black/0",children:a(xr,{className:"w-8 h-8 fill-primary/60 stroke-0"})});return a("div",{className:"w-full h-full flex items-center justify-center",children:a(Er,{className:"w-8 h-8 fill-primary/60 stroke-0"})})};function Yl({teamId:e,item:t,isSelected:n=!1,isChecked:o=!1,isEditing:r=!1,onSelect:s=()=>{},onDoubleClick:i=()=>{},onContextMenu:l=()=>{},onDragStart:d,onDrop:f,onRename:u=()=>{},onFinishEditing:h=()=>{},onSaveField:c=()=>{},dragState:p,disabled:m,onAction:v,isRecentlyDeleted:C,isRecents:b,selectedCount:k,fields:D=[],isShareView:P,canEdit:le=!0,allowDownload:te=!0,hideCheckbox:ue=!1,hideActions:V=!1}){let[A,Ee]=w(t.name),Me=M(null),[ce,se]=w(!1),O=M(null),ae=_n((Z)=>Z.fileProgress[t.id||""]),ze=ae?ae.total>0?ae.loaded/ae.total*100:0:0,{data:Te}=X({queryKey:["file",e,t.id],queryFn:async()=>{let Z=await R.api.files[":fileId"].$get({param:{fileId:t.id||""}});if(!Z.ok)throw Error("failed to fetch file");return await Z.json()},enabled:!1}),_=Q(()=>{if(t.status==="processed"||t.status==="error"||t.status==="failed")return t;if(Te?.status==="processed"||Te?.status==="error"||Te?.status==="failed")return Te;return Te||t},[t,Te]),{ref:Pe,isDragging:Ze}=si({id:`browser:${_.id}`,data:{type:_.type,id:_.id,item:_},disabled:m}),{ref:ge,isDropTarget:_e}=ln({id:`browser:${_.id}`,data:{type:_.type,id:_.id,item:_},disabled:m}),H=(Z)=>{if(m)return;Pe(Z),ge(Z)},E=Ze||(p?.draggedIds.has(_.id)??!1),me=Q(()=>{if(!p?.isActive)return!1;if(p.draggedIds.has(_.id))return!1;return p.isSingleFile},[p,_.id]),at=_e&&me,T=E?0.5:1,Oe=Q(()=>(_.fieldValues||[]).reduce((Z,Kt)=>(Z[Kt.fieldId]=Kt,Z),{}),[_.fieldValues]);S(()=>{if(r){let Z=setTimeout(()=>{if(Me.current)ci(Me.current)},150);return()=>clearTimeout(Z)}},[r]),S(()=>{Ee(_.name)},[_.name]);let Je=(Z)=>{s(_,Z)},lt=()=>{if(A!==_.name)u(A||"");h()},J=(Z)=>{if(Z.key==="Enter")lt();if(Z.key==="Escape")Ee(_.name||""),h()},q=Q(()=>{if(!_.createdAt)return"";return _E({time:on(_.createdAt),author:_.agent?Rd({user:_.creator?.name||eu(),agent:_.agent.name}):_.creator?.name||eu()})},[_.createdAt,_.agent,_.creator?.name]),N=C?Vp(_.deletedAt):null,x=N===null?"":N===1?s0({count:N}):o0({count:N}),I=Boolean(_.preview?.thumbnailUrl||_.preview?.spriteUrl),oe=_.status==="failed",Ae=Boolean(ae),ut=ae?.status==="failed",en=ae?.status==="completed"||ze>=100,tn=_.status==="uploading"&&!en&&!ut,Lt=_.status==="processing"||_.status==="uploaded"||_.status==="uploading"&&en,Ft=null;if(ut||_.status==="error")Ft=P_();else if(tn)if(Ae)if(ae?.speed&&ae?.eta!=null)Ft=Dy({eta:Gp(ae.eta),speed:`${Fr(ae.speed)}/s`});else Ft=tu();else Ft=Ny({user:_.creator?.name||my()});else if(Lt)Ft=v1();let qt=_.media?.error||I0(),sn=N!==null||typeof _.commentsCount==="number"&&_.commentsCount>0?g("div",{"data-testid":"file-card-preview-badges",className:"pointer-events-none absolute bottom-1 left-1 z-10 flex items-center gap-1",children:[N!==null&&g("span",{"data-testid":"file-card-days-left",title:x,className:"flex items-center gap-1 rounded bg-black/60 px-1 py-0.5 text-xs font-medium tabular-nums text-white",children:[a(ur,{className:"h-3.5 w-3.5"}),a("span",{children:f_({count:N})})]}),typeof _.commentsCount==="number"&&_.commentsCount>0&&g("span",{"data-testid":"file-card-comments-count",className:"flex items-center gap-1 rounded bg-black/60 px-1 py-0.5 text-xs font-medium tabular-nums text-white",children:[a(mr,{className:"h-3.5 w-3.5"}),a("span",{children:_.commentsCount})]})]}):null;return g("div",{ref:H,style:{opacity:T},onClick:Je,onDoubleClick:()=>i(_),onContextMenu:(Z)=>l(Z,_),onMouseDown:(Z)=>{if(Z.shiftKey)Z.preventDefault()},"data-testid":"file-card",className:B("group relative flex cursor-pointer select-none flex-col overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary h-full m-1 outline-none focus:outline-none focus-visible:outline-none",(n||o)&&"outline-1 outline-primary border-primary",at&&"border-primary outline-1 outline-primary"),children:[!ue&&a("div",{className:"absolute left-2 top-2 z-10 flex items-center gap-1.5",children:a(Sr,{checked:o,onCheckedChange:()=>{},onClick:(Z)=>{Z.stopPropagation(),s(_,Z)},className:"h-4 w-4 bg-white/20 dark:bg-white/20 border-2 data-[state=checked]:bg-primary data-[state=checked]:border-primary border-foreground/15"})}),g("div",{className:"absolute right-2 top-2 z-10 flex items-center gap-1.5",children:[_.agent&&a("span",{className:"select-none rounded bg-black/60 px-1 py-0.5 text-xs font-medium text-white",title:_.agent.name,"data-testid":"agent-badge",children:"AI"}),_.versionStack&&g(ve,{children:["v",_.versionStack.versions.find((Z)=>Z.id===_.id)?.version??_.versionStack.versions.length]}),oe&&a(Nn,{delayDuration:100,children:g(Fn,{children:[a(Ln,{asChild:!0,children:a("span",{"data-testid":"file-card-failed-badge",className:"select-none rounded bg-destructive/90 px-1.5 py-0.5 text-xs font-medium text-destructive-foreground shadow-sm cursor-help",children:fO()})}),a(Zn,{side:"bottom","data-testid":"file-card-failed-tooltip",className:"max-w-xs break-words text-xs",children:qt})]})})]}),a("div",{className:"relative aspect-square overflow-hidden bg-muted/30",children:tn?a("div",{className:"flex h-full w-full items-center justify-center bg-background/50",children:Ae?a(fl,{progress:ze,className:"w-16 h-16 z-10"}):a("svg",{viewBox:"0 0 50 50","data-testid":"file-card-remote-uploading-circle",className:"h-16 w-16 opacity-60 animate-preparing-breathe z-10",children:a("circle",{cx:"25",cy:"25",r:"20",className:"stroke-muted-foreground",strokeWidth:"4",fill:"transparent"})})}):I?g(W,{children:[a("div",{"data-testid":"file-card-preview-media",className:B("h-full w-full",Lt&&"animate-pulse"),children:a(gn,{item:_,showDuration:!Lt&&!oe,matchDuration:_.startTime!=null&&_.endTime!=null?{startTime:_.startTime,endTime:_.endTime}:null})}),sn]}):_.status==="error"||ut?a("div",{className:"flex h-full w-full items-center justify-center bg-background/50",children:a("span",{className:"z-10 font-medium px-2 text-center text-sm text-destructive font-semibold",children:P_()})}):oe?g("div",{"data-testid":"file-card-failed-state",className:"flex flex-col h-full w-full items-center justify-center gap-2 p-3 text-center bg-muted/40",children:[a(er,{className:"h-10 w-10 text-destructive/80 shrink-0"}),a("span",{className:"z-10 text-xs font-semibold text-destructive px-2",children:I0()})]}):Lt?a("div",{className:"flex h-full w-full items-center justify-center",children:a("svg",{viewBox:"0 0 50 50","data-testid":"file-card-preparing-circle",className:"h-16 w-16 opacity-60 animate-preparing-breathe",children:a("circle",{cx:"25",cy:"25",r:"20",className:"stroke-muted-foreground",strokeWidth:"4",fill:"transparent"})})}):g(W,{children:[a(gn,{item:_,showDuration:!0,matchDuration:_.startTime!=null&&_.endTime!=null?{startTime:_.startTime,endTime:_.endTime}:null}),sn]})}),g("div",{className:"flex items-center justify-between gap-2 p-3",children:[g("div",{className:"min-w-0 flex-1",children:[a(Yt,{ref:Me,value:A,onChange:(Z)=>Ee(Z.target.value),onBlur:lt,onKeyDown:J,disabled:!r,className:"h-auto p-0 text-sm font-medium text-foreground truncate !bg-transparent"}),a(Nn,{delayDuration:100,children:g(Fn,{open:ce,onOpenChange:(Z)=>{if(Z)if(O.current&&(O.current.scrollHeight>O.current.clientHeight||O.current.scrollWidth>O.current.clientWidth))se(!0);else se(!1);else se(!1)},children:[a(Ln,{asChild:!0,children:a("p",{ref:O,className:"text-sm line-clamp-2 h-[2lh] text-muted-foreground",children:Ft??q})}),ce&&a(Zn,{side:"bottom",className:"max-w-md break-all text-wrap [text-wrap:normal] text-left",children:q})]})})]}),!V&&!b&&g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a(F,{size:"icon-sm",variant:"ghost",className:"cursor-pointer",onClick:(Z)=>Z.stopPropagation(),children:a(_r,{className:"h-4 w-4 text-foreground"})})}),a(Fe,{align:"end",children:P?g(W,{children:[te&&g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("download",t)},children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),le&&g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("remove-from-share",t)},className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Wh()})]})]}):C?g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("restore",t)},children:[a(ao,{className:"mr-2 h-4 w-4"}),a("span",{children:Jh()})]}):g(W,{children:[le&&(!o||(k||0)<=1)&&g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("rename",t)},children:[a(En,{className:"mr-2 h-4 w-4"}),a("span",{children:ms()})]}),le&&t.type==="version_stack"&&g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("manage-versions",t)},children:[a(bn,{className:"mr-2 h-4 w-4"}),a("span",{children:vh()})]}),te&&g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("download",t)},children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),le&&g(W,{children:[a(dr,{}),g(de,{onClick:(Z)=>{Z.stopPropagation(),v?.("delete",t)},className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Mt()})]})]})]})})]})]}),D&&D.length>0&&a("div",{className:"space-y-2 border-t p-1 pt-3 mx-2",onClick:(Z)=>Z.stopPropagation(),onDoubleClick:(Z)=>Z.stopPropagation(),children:D.map((Z)=>{let Kt=Z.config?.type?dl[Z.config.type]:null;return g("div",{className:"space-y-1 bg-muted/50 p-1 rounded border",children:[g("label",{className:"text-xs text-muted-foreground tracking-wide flex items-center gap-1",children:[Kt&&a(Kt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a("span",{children:Z.config?.name})]}),a("div",{className:"min-h-[28px]",children:a(di,{fieldId:Z.id,config:Z.config,value:Oe[Z.id]?.value,onSave:le&&!b?(Bn)=>c(Z.id,Bn):void 0,readOnly:Z.readOnly||!le||!!b})})]},Z.id)})})]})}L();function Cr({teamId:e,item:t,isSelected:n,isChecked:o,isEditing:r,onSelect:s,onDoubleClick:i,onContextMenu:l,onDragStart:d,onDrop:f,onRename:u,onFinishEditing:h,onSaveField:c,dragState:p,disabled:m,fields:v,columnSizing:C,canEdit:b=!0,isRecents:k}){let[D,P]=w(t.name),le=M(null),te=_n((E)=>E.fileProgress[t.id||""]),ue=te?te.total>0?te.loaded/te.total*100:0:0,{data:V}=X({queryKey:["file",e,t.id],queryFn:async()=>{let E=await R.api.files[":fileId"].$get({param:{fileId:t.id||""}});if(!E.ok)throw Error("failed to fetch file");return await E.json()},enabled:!1}),A=Q(()=>{if(t.status==="processed"||t.status==="error"||t.status==="failed")return t;if(V?.status==="processed"||V?.status==="error"||V?.status==="failed")return V;return V||t},[t,V]),Ee=Boolean(te),Me=te?.status==="failed",ce=te?.status==="completed"||ue>=100,se=A.status==="uploading"&&!ce&&!Me,O=null;if(se)if(Ee)if(te?.speed&&te?.eta!=null)O=Dy({eta:Gp(te.eta),speed:`${Fr(te.speed)}/s`});else O=tu();else O=Ny({user:A.creator?.name||my()});let{ref:ae,isDragging:ze}=si({id:`browser:${A.id}`,data:{type:A.type,id:A.id,item:A},disabled:m}),_=ze||(p?.draggedIds.has(A.id)??!1)?0.5:1,Pe=Q(()=>(A.fieldValues||[]).reduce((E,me)=>(E[me.fieldId]=me,E),{}),[A.fieldValues]);S(()=>{if(r){let E=setTimeout(()=>{if(le.current)ci(le.current)},150);return()=>clearTimeout(E)}},[r]),S(()=>{P(A.name)},[A.name]);let Ze=(E)=>{if(!E)return"-";return new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},ge=(E)=>{s(A,E)},_e=()=>{if(D!==A.name)u(D||"");h()},H=(E)=>{if(E.key==="Enter")_e();if(E.key==="Escape")P(A.name||""),h()};return g("div",{ref:ae,style:{opacity:_},onClick:ge,onDoubleClick:()=>i(A),onContextMenu:(E)=>l(E,A),onMouseDown:(E)=>{if(E.shiftKey)E.preventDefault()},"data-testid":"file-card",className:"group cursor-pointer select-none transition-colors whitespace-nowrap flex w-full outline-none focus:outline-none focus-visible:outline-none",children:[a("div",{className:B("px-4 py-2 sticky left-0 z-10 transition-colors border-r shrink-0",n||o?"bg-muted":"bg-card group-hover:bg-muted"),style:{width:C?.name||300,minWidth:C?.name||300},children:g("div",{className:"flex items-center gap-2 overflow-hidden",children:[a(Sr,{checked:o,onCheckedChange:()=>{},onClick:(E)=>{E.stopPropagation(),s(A,E)},className:"h-4 w-4 shrink-0 data-[state=checked]:bg-primary data-[state=checked]:border-primary"}),a("div",{className:"w-8 h-8 shrink-0 flex items-center justify-center bg-muted rounded overflow-hidden",children:se?Ee?a(fl,{progress:ue,className:"w-7 h-7"}):a("svg",{viewBox:"0 0 50 50","data-testid":"file-list-item-remote-uploading-circle",className:"w-7 h-7 opacity-60 animate-preparing-breathe",children:a("circle",{cx:"25",cy:"25",r:"20",className:"stroke-muted-foreground",strokeWidth:"4",fill:"transparent"})}):A.status==="failed"&&!A.preview?.thumbnailUrl?a(er,{className:"h-4 w-4 text-destructive"}):A.preview?.thumbnailUrl?a("img",{src:A.preview.thumbnailUrl,alt:"",className:"w-full h-full object-cover"}):A.preview?.proxyType==="audio"||A.proxyType==="audio"?a(Ps,{className:"h-4 w-4 text-muted-foreground"}):A.type==="folder"?a(xr,{className:"h-4 w-4 text-primary"}):a(Er,{className:"h-4 w-4 text-muted-foreground"})}),a(Yt,{ref:le,value:D,onChange:(E)=>P(E.target.value),onBlur:_e,onKeyDown:H,disabled:!r,className:"h-auto p-0 text-sm font-medium text-foreground truncate min-w-0 flex-1"}),O&&a("span",{"data-testid":"file-list-item-uploading-status",className:"text-xs text-muted-foreground font-medium shrink-0",children:O}),(A.status==="error"||Me)&&a("span",{className:"text-xs text-destructive font-semibold shrink-0",children:eC()}),A.status==="failed"&&a("span",{"data-testid":"file-list-item-failed",className:"text-xs text-destructive font-semibold shrink-0",children:x1()}),A.agent&&a("span",{className:"select-none rounded bg-black/60 px-1 py-0.5 text-xs font-medium text-white shrink-0",title:A.agent.name,"data-testid":"agent-badge",children:"AI"}),A.versionStack&&g(ve,{variant:"outline",className:"px-1 py-0 text-xs shrink-0",children:["v",A.versionStack.versions.find((E)=>E.id===A.id)?.version??A.versionStack.versions.length]})]})}),a("div",{className:"px-4 py-2 text-sm text-muted-foreground truncate border-r shrink-0 flex items-center",style:{width:C?.size||100,minWidth:C?.size||100},children:A.type==="folder"?"-":A.sizeByte?Fr(A.sizeByte):"-"}),a("div",{className:"px-4 py-2 border-r shrink-0 flex items-center",style:{width:C?.modified||200,minWidth:C?.modified||200},children:g("div",{className:"flex items-center justify-between overflow-hidden w-full",children:[a("span",{className:"text-sm text-muted-foreground truncate",children:Ze(A.updatedAt)}),!k&&a("button",{onClick:(E)=>{E.stopPropagation();let me=E.target.getBoundingClientRect(),at=new MouseEvent(E.nativeEvent.type,{bubbles:!0,cancelable:!0,clientX:me.left,clientY:me.bottom});l(at,A)},className:"opacity-0 shrink-0 transition-opacity group-hover:opacity-100 ml-2",children:a(Vr,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})]})}),A.type==="file"&&v.map((E)=>a("div",{onClick:(me)=>me.stopPropagation(),onDoubleClick:(me)=>me.stopPropagation(),className:"px-4 py-2 truncate border-r shrink-0 flex items-center",style:{width:C?.[E.id]||150,minWidth:C?.[E.id]||150},children:a(di,{fieldId:E.id,config:E.config,value:Pe[E.id]?.value,onSave:b&&!k?(me)=>c(E.id,me):void 0,readOnly:E.readOnly||!b||!!k})},E.id))]})}L();var Di=({items:e})=>{let t=e,n=t?t.slice(0,3):[],o=n.length,r=(s)=>{if(!s)return null;return a(gn,{item:s})};if(o===0)return a("div",{});if(o===1)return a("div",{className:"w-full h-full bg-foreground/6 rounded-sm",children:r(n[0])});if(o===2)return g("div",{className:"grid grid-cols-2 gap-0.5 h-full w-full",children:[a("div",{className:"overflow-hidden h-full bg-foreground/6 rounded-sm",children:r(n[0])}),a("div",{className:"overflow-hidden h-full bg-foreground/6 rounded-sm",children:r(n[1])})]});return g("div",{className:"grid grid-cols-3 gap-0.5 h-full w-full",children:[a("div",{className:"col-span-1 overflow-hidden h-full relative bg-foreground/6 rounded-sm col-span-2",children:a("div",{className:"absolute inset-0 w-full h-full",children:r(n[0])})}),g("div",{className:"col-span-1 grid grid-rows-2 gap-0.5 h-full col-span-1",children:[a("div",{className:"overflow-hidden h-full relative bg-foreground/6 rounded-sm",children:a("div",{className:"absolute inset-0 w-full h-full",children:r(n[1])})}),a("div",{className:"overflow-hidden h-full relative bg-foreground/6 rounded-sm",children:a("div",{className:"absolute inset-0 w-full h-full",children:r(n[2])})})]})]})};function Xl({item:e,isSelected:t=!1,isChecked:n=!1,isEditing:o=!1,onSelect:r=()=>{},onDoubleClick:s=()=>{},onContextMenu:i=()=>{},onDragStart:l,onDrop:d,onRename:f=()=>{},onFinishEditing:u=()=>{},dragState:h,disabled:c,onAction:p,isRecentlyDeleted:m,isRecents:v,selectedCount:C,canEdit:b=!0,isShareView:k,isExternalDragging:D,externalOverFolderId:P,setExternalOverFolderId:le,resetExternalDragState:te,onExternalDrop:ue,allowDownload:V=!0,hideCheckbox:A=!1,hideActions:Ee=!1}){let[Me,ce]=w(e.name||""),se=M(null),{ref:O,isDragging:ae}=si({id:`browser:${e.id}`,data:{type:"folder",id:e.id,item:e},disabled:c}),{ref:ze,isDropTarget:Te}=ln({id:`browser:${e.id}`,data:{type:"folder",id:e.id,item:e},disabled:c}),_=(x)=>{if(c)return;O(x),ze(x)},Pe=ae||(h?.draggedIds.has(e.id)??!1),Ze=Q(()=>{if(!h?.isActive)return!1;if(h.draggedIds.has(e.id))return!1;return!0},[h,e.id]),ge=D&&P===e.id,_e=Te&&Ze||ge,H=Pe?0.5:1;S(()=>{if(o){let x=setTimeout(()=>{se.current?.focus(),se.current?.select()},150);return()=>clearTimeout(x)}},[o]),S(()=>{ce(e.name||"")},[e.name]);let E=(x)=>{r(e,x)},me=()=>{if(Me!==e.name)f(Me||"");u()},at=(x)=>{if(x.key==="Enter")me();if(x.key==="Escape")ce(e.name||""),u()},T=300,Oe=220,Je=8,lt={cornerRadius:4,tabRadius:5,tabSlope:15,tabBaseWidth:120},J=Q(()=>{let{cornerRadius:x,tabRadius:I,tabSlope:oe,tabBaseWidth:Ae}=lt,ut=1;return`M 1, ${Je+1} L 1, ${1+I} A ${I} ${I} 0 0 1 ${1+I} 1 L ${Ae-oe+1-I} 1 Q ${Ae-oe+1} 1 ${Ae-oe+1} 1 L ${Ae+1} ${Je+1} L ${T-x-1} ${Je+1} A ${x} ${x} 0 0 1 ${T-1} ${Je+x+1} L ${T-1} ${Oe-x-1} A ${x} ${x} 0 0 1 ${T-x-1} ${Oe-1} L ${x+1} ${Oe-1} A ${x} ${x} 0 0 1 1 ${Oe-x-1} Z`.replace(/\s+/g," ").trim()},[]),q=m?Vp(e.deletedAt):null,N=q===null?"":q===1?s0({count:q}):o0({count:q});return g("div",{ref:_,style:{opacity:H},onClick:E,onDoubleClick:()=>s(e),onContextMenu:(x)=>i(x,e),onMouseDown:(x)=>{if(x.shiftKey)x.preventDefault()},onDragEnter:D?()=>{le?.(e.id)}:void 0,onDragLeave:D?(x)=>{if(!x.currentTarget.contains(x.relatedTarget))le?.(null)}:void 0,onDragOver:D?(x)=>{x.preventDefault()}:void 0,onDrop:D?async(x)=>{x.preventDefault(),x.stopPropagation(),te?.();let I=await rc(x.dataTransfer);ue?.(I,e.id)}:void 0,"data-testid":"file-card",className:B("group relative w-full md:max-w-[340px] select-none cursor-pointer isolate flex flex-col items-center h-full outline-none focus:outline-none focus-visible:outline-none"),children:[a("div",{className:"absolute inset-0 z-10 pointer-events-none",children:a("svg",{width:"100%",height:"100%",viewBox:`0 0 ${T} ${Oe}`,preserveAspectRatio:"none",className:"overflow-visible",children:a("path",{d:J,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeWidth:_e||t?2:1,className:B("transition-colors duration-200 fill-none group-hover:stroke-primary stroke-foreground/10",(t||n||_e)&&"stroke-primary")})})}),a("div",{className:"absolute inset-0 -z-10 pointer-events-none",children:a("svg",{width:"100%",height:"100%",viewBox:`0 0 ${T} ${Oe}`,preserveAspectRatio:"none",className:"overflow-visible",children:a("path",{d:J,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeWidth:_e?3:1,className:B("transition-colors duration-200 fill-foreground/6 dark:fill-foreground/4")})})}),g("div",{className:"shadow-[0_-4px_6px_rgba(0,0,0,0.08)] relative w-full flex flex-1 flex-col p-2 mt-5 bg-muted dark:bg-muted/50 rounded-sm",children:[g("div",{className:"relative w-full aspect-video shrink-0 overflow-hidden",children:[!A&&a("div",{className:"absolute top-1 left-1 z-30 transition-all duration-200",children:a(Sr,{checked:n,onClick:(x)=>x.stopPropagation(),className:"w-5 h-5 border-1 border-foreground/20 bg-background/50 data-[state=checked]:bg-primary data-[state=checked]:border-primary"})}),e.latestChildren&&e.latestChildren.length>0&&a("div",{"data-testid":"folder-preview-grid",className:"h-full w-full",children:a(Di,{items:e.latestChildren})}),q!==null&&g("span",{"data-testid":"folder-card-days-left",title:N,className:"pointer-events-none absolute bottom-1 left-1 z-10 flex items-center gap-1 rounded bg-black/60 px-1 py-0.5 text-xs font-medium tabular-nums text-white",children:[a(ur,{className:"h-3.5 w-3.5"}),a("span",{children:f_({count:q})})]})]}),g("div",{className:"flex flex-col gap-1 mt-2 px-1",children:[a(Yt,{ref:se,value:Me||"",onChange:(x)=>ce(x.target.value),onBlur:me,onKeyDown:at,disabled:!o,className:"h-auto p-0 text-sm font-medium text-foreground truncate !bg-transparent"}),g("div",{className:"flex items-center justify-between text-muted-foreground",children:[a("span",{className:"text-xs tracking-wide opacity-80",children:(e.fileCount||0)===1?a0({count:e.fileCount||0}):i0({count:e.fileCount||0})}),!Ee&&!v&&g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a("button",{onClick:(x)=>x.stopPropagation(),className:"p-1.5 -mr-2 rounded-full hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:a(_r,{size:18})})}),a(Fe,{align:"end",children:k?g(W,{children:[V&&g(de,{onClick:(x)=>{x.stopPropagation(),p?.("download",e)},children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),b&&g(de,{onClick:(x)=>{x.stopPropagation(),p?.("remove-from-share",e)},className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Wh()})]})]}):m?g(de,{onClick:(x)=>{x.stopPropagation(),p?.("restore",e)},children:[a(ao,{className:"mr-2 h-4 w-4"}),a("span",{children:Jh()})]}):g(W,{children:[b&&(!n||(C||0)<=1)&&g(de,{onClick:(x)=>{x.stopPropagation(),p?.("rename",e)},children:[a(En,{className:"mr-2 h-4 w-4"}),a("span",{children:ms()})]}),V&&g(de,{onClick:(x)=>{x.stopPropagation(),p?.("download",e)},children:[a(Bt,{className:"mr-2 h-4 w-4"}),a("span",{children:Dr()})]}),b&&g(W,{children:[a(dr,{}),g(de,{onClick:(x)=>{x.stopPropagation(),p?.("delete",e)},className:"text-destructive",children:[a(Ue,{className:"mr-2 h-4 w-4"}),a("span",{children:Mt()})]})]})]})})]})]})]})]})]})}L();function br(e,t,n){let o=Array(e);return new Proxy(o,{get(r,s,i){if(typeof s==="string"){let l=s.charCodeAt(0);if(l>=48&&l<=57){let d=+s;if(Number.isInteger(d)&&d>=0&&d<e){let f=r[d];if(!f){let u=t[d*2];f=r[d]={index:d,key:n(d),start:u,size:t[d*2+1],end:u+t[d*2+1],lane:0}}return f}}if(s==="length")return e}return Reflect.get(r,s,i)}})}function Zt(e,t,n){let o=n.initialDeps??[],r,s=!0;function i(){var l;let d=!1,f=0,u=e();if(!(u.length!==o.length||u.some((p,m)=>o[m]!==p)))return r;o=u;let c=0;if(r=t(...u),(n==null?void 0:n.onChange)&&!(s&&n.skipInitialOnChange))n.onChange(r);return s=!1,r}return i.updateDeps=(l)=>{o=l},i}function uo(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:""}`);else return e}var Ir=(e,t)=>Math.abs(e-t)<1.01,Rr=(e,t,n)=>{let o;return Object.assign(function(...r){e.clearTimeout(o),o=e.setTimeout(()=>t.apply(this,r),n)},{cancel:()=>{e.clearTimeout(o)}})};var hn,co=()=>{if(hn!==void 0)return hn;if(typeof navigator>"u")return hn=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return hn=!0;let e=navigator.maxTouchPoints;return hn=navigator.platform==="MacIntel"&&e!==void 0&&e>0};var Mr=(e)=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Pi=(e)=>e,Ai=(e)=>{let t=Math.max(e.startIndex-e.overscan,0),o=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(o);for(let s=0;s<o;s++)r[s]=t+s;return r},Nr=(e,t)=>{let n=e.scrollElement;if(!n)return;let o=e.targetWindow;if(!o)return;let r=(i)=>{let{width:l,height:d}=i;t({width:Math.round(l),height:Math.round(d)})};if(r(Mr(n)),!o.ResizeObserver)return()=>{};let s=new o.ResizeObserver((i)=>{let l=()=>{let d=i[0];if(d==null?void 0:d.borderBoxSize){let f=d.borderBoxSize[0];if(f){r({width:f.inlineSize,height:f.blockSize});return}}r(Mr(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},kn={passive:!0};var $i=typeof window>"u"?!0:("onscrollend"in window),Oi=(e,t,n)=>{let o=e.scrollElement;if(!o)return;let r=e.targetWindow;if(!r)return;let s=e.options.useScrollendEvent&&$i,i=0,l=s?null:Rr(r,()=>t(i,!1),e.options.isScrollingResetDelay),d=(h)=>()=>{i=n(o),l==null||l(),t(i,h)},f=d(!0),u=d(!1);if(o.addEventListener("scroll",f,kn),s)o.addEventListener("scrollend",u,kn);return()=>{if(o.removeEventListener("scroll",f),s)o.removeEventListener("scrollend",u);l==null||l.cancel()}},kr=(e,t)=>Oi(e,t,(n)=>{let{horizontal:o,isRtl:r}=e.options;return o?n.scrollLeft*(r&&-1||1):n.scrollTop});var zi=(e,t,n)=>{if(n.options.useCachedMeasurements){let o=n.indexFromElement(e),r=n.options.getItemKey(o);return n.itemSizeCache.get(r)??n.options.estimateSize(o)}if(t==null?void 0:t.borderBoxSize){let o=t.borderBoxSize[0];if(o)return Math.round(o[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){let o=n.indexFromElement(e),r=n.options.getItemKey(o),s=n.itemSizeCache.get(r);if(s!==void 0)return s}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Vi=(e,{adjustments:t=0,behavior:n},o)=>{var r,s;(s=(r=o.scrollElement)==null?void 0:r.scrollTo)==null||s.call(r,{[o.options.horizontal?"left":"top"]:e+t,behavior:n})};var Tr=Vi;class fo{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,n,o;return((o=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:o.call(n))??Date.now()},this.observer=(()=>{let t=null,n=()=>{if(t)return t;if(!this.targetWindow||!this.targetWindow.ResizeObserver)return null;return t=new this.targetWindow.ResizeObserver((o)=>{o.forEach((r)=>{let s=()=>{let i=r.target,l=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);for(let[d,f]of this.elementsCache)if(f===i){this.elementsCache.delete(d);break}return}if(!this.isIndexInRange(l))return;if(this.shouldMeasureDuringScroll(l))this.resizeItem(l,this.options.measureElement(i,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})})};return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),t=null},observe:(o)=>{var r;return(r=n())==null?void 0:r.observe(o,{box:"border-box"})},unobserve:(o)=>{var r;return(r=n())==null?void 0:r.unobserve(o)}}})(),this.range=null,this.setOptions=(t)=>{var n,o;let r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Pi,rangeExtractor:Ai,onChange:()=>{},measureElement:zi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let h in t){let c=t[h];if(c!==void 0)r[h]=c}let s=this.options,i=null,l=null,d=!1;if(s!==void 0&&s.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){let h=s.count,c=r.count,p=this.getMeasurements(),m=h>0?((n=p[0])==null?void 0:n.key)??s.getItemKey(0):null,v=h>0?((o=p[h-1])==null?void 0:o.key)??s.getItemKey(h-1):null;if(c!==h||h>0&&c>0&&(r.getItemKey(0)!==m||r.getItemKey(c-1)!==v)){d=!0;let k=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;if(k)i=[k.key,this.getScrollOffset()-k.start];let D=r.followOnAppend===!0?"auto":r.followOnAppend||null;if(D&&c>h&&this.isAtEnd(s.scrollEndThreshold)&&(h===0||r.getItemKey(c-1)!==v))l=D}}if(this.options=r,d)this.pendingMin=0,this.itemSizeCacheVersion++;let f=!1,u=0;if(i&&this.scrollOffset!==null){let[h,c]=i,p=this.getMeasurements(),{count:m,getItemKey:v}=this.options,C=0;while(C<m&&v(C)!==h)C++;if(C<m){let b=p[C];if(b){let k=Math.max(0,b.start+c);if(k!==this.scrollOffset)u=k-this.scrollOffset,this.scrollOffset=k,f=!0}}}if(f||l)this.pendingScrollAnchor=[f?i[0]:null,f?i[1]:0,l,u]},this.notify=(t)=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,t)},this.maybeNotify=Zt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),(t)=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{if(this.unsubs.filter(Boolean).forEach((t)=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow)this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null;this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;let n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}if(this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement)this.targetWindow=this.scrollElement.ownerDocument.defaultView;else this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null;if(this.elementsCache.forEach((r)=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,(r)=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,s)=>{if(s&&this._intendedScrollOffset===null&&r===this.scrollOffset)return;if(this._intendedScrollOffset!==null&&Math.abs(r-this._intendedScrollOffset)<1.5)r=this._intendedScrollOffset;this._intendedScrollOffset=null,this.scrollAdjustments=0;let i=this.getScrollOffset();if(this.scrollDirection=s?i===r?this.scrollDirection:i<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=s,this._flushIosDeferredIfReady(),this.scrollState)this.scheduleScrollReconcile();this.maybeNotify()})),"addEventListener"in this.scrollElement){let r=this.scrollElement,s=()=>{if(this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null)this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null},i=()=>{if(this._iosTouching=!1,!co()||this.targetWindow==null)return;this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150)};r.addEventListener("touchstart",s,kn),r.addEventListener("touchend",i,kn),this.unsubs.push(()=>{if(r.removeEventListener("touchstart",s),r.removeEventListener("touchend",i),this._iosTouchEndTimerId!==null&&this.targetWindow!=null)this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){let[r,s,i,l]=o;if(r!==null&&!i)if(co()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)){if(l!==0)this._iosDeferredAdjustment+=l}else this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0});if(i)this.scrollToEnd({behavior:i})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;let t=this.getScrollOffset(),n=this.getMaxScrollOffset();if(t<0||t>n)return;if(this._iosDeferredAdjustment<0&&t>=n-1){this._iosDeferredAdjustment=0;return}let o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>{if(!this.options.enabled)return this.scrollRect=null,0;return this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]},this.getScrollOffset=()=>{if(!this.options.enabled)return this.scrollOffset=null,0;return this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset},this.getMeasurementOptions=Zt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,n,o,r,s,i,l,d)=>{if(this.prevLanes!==void 0&&this.prevLanes!==i)this.lanesChangedFlag=!0;return this.prevLanes=i,this.pendingMin=null,{count:t,paddingStart:n,scrollMargin:o,getItemKey:r,enabled:s,lanes:i,laneAssignmentMode:l,gap:d}},{key:!1}),this.isIndexInRange=(t)=>t>=0&&t<this.options.count,this.getMeasurements=Zt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:n,scrollMargin:o,getItemKey:r,enabled:s,lanes:i,laneAssignmentMode:l,gap:d},f)=>{let u=this.itemSizeCache;if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t){for(let C of this.laneAssignments.keys())if(C>=t)this.laneAssignments.delete(C)}if(this.lanesChangedFlag)this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null;if(this.measurementsCache.length===0&&!this.lanesSettling)this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((C)=>{this.itemSizeCache.set(C.key,C.size)});let h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t)this.lanesSettling=!1;if(i===1){let C=t*2,b=this._flatMeasurements;if(!b||b.length<C){let P=new Float64Array(C);if(b&&h>0)P.set(b.subarray(0,h*2));b=P,this._flatMeasurements=b}let k;if(h===0)k=n+o;else{let P=h-1;k=b[P*2]+b[P*2+1]+d}for(let P=h;P<t;P++){let le=r(P),te=u.get(le),ue=typeof te==="number"?te:this.options.estimateSize(P);b[P*2]=k,b[P*2+1]=ue,k+=ue+d}let D=br(t,b,r);return this.measurementsCache=D,D}let c=this.measurementsCache.slice(0,h),p=Array(i).fill(void 0),m=new Float64Array(i),v=0;for(let C=0;C<h;C++){let b=c[C];if(b){if(p[b.lane]===void 0)v++;p[b.lane]=C,m[b.lane]=b.end}}for(let C=h;C<t;C++){let b=r(C),k=this.laneAssignments.get(C),D,P,le=l==="estimate"||u.has(b);if(k!==void 0&&this.options.lanes>1){D=k;let A=p[D],Ee=A!==void 0?c[A]:void 0;P=Ee?Ee.end+d:n+o}else if(v===i){let A=0,Ee=m[0],Me=p[0];for(let ce=1;ce<i;ce++){let se=m[ce];if(se<Ee||se===Ee&&p[ce]<Me)A=ce,Ee=se,Me=p[ce]}if(D=A,P=Ee+d,le)this.laneAssignments.set(C,D)}else if(D=C%this.options.lanes,P=n+o,le)this.laneAssignments.set(C,D);let te=u.get(b),ue=typeof te==="number"?te:this.options.estimateSize(C),V=P+ue;if(c[C]={index:C,start:P,size:ue,end:V,key:b,lane:D},p[D]===void 0)v++;p[D]=C,m[D]=V}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Zt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,o,r)=>{if(t.length===0||n===0)return this.range=null,null;return this.range=ji(t,n,o,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range},{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Zt(()=>{let t=null,n=null,o=this.calculateRange();if(o)t=o.startIndex,n=o.endIndex;return this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,o,r,s)=>r===null||s===null?[]:t({startIndex:r,endIndex:s,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=(t)=>{let n=this.options.indexAttribute,o=t.getAttribute(n);if(!o)return console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1;return parseInt(o,10)},this.shouldMeasureDuringScroll=(t)=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let o=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(o!==void 0&&this.range){let r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,o-r),i=Math.min(this.options.count-1,o+r);return t>=s&&t<=i}return!0},this.measureElement=(t)=>{if(!t){this.elementsCache.forEach((s,i)=>{if(!s.isConnected)this.observer.unobserve(s),this.elementsCache.delete(i)});return}let n=this.indexFromElement(t);if(!this.isIndexInRange(n))return;let o=this.options.getItemKey(n),r=this.elementsCache.get(o);if(r!==t){if(r)this.observer.unobserve(r);this.observer.observe(t),this.elementsCache.set(o,t)}if((!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n))this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var o,r;if(!this.isIndexInRange(t))return;let s,i,l,d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)l=this.options.getItemKey(t),i=d[t*2],s=d[t*2+1];else{let h=this.measurementsCache[t];if(!h)return;l=h.key,i=h.start,s=h.size}let f=this.itemSizeCache.get(l)??s,u=n-f;if(u!==0){let h=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=h?this.getTotalSize():0,p=this.getScrollOffset()+this.scrollAdjustments,v=!this.itemSizeCache.has(l)?i<p:i+f<=p&&this.scrollDirection!=="backward",C=((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:l,start:i,size:s,end:i+s,lane:0},u,this):v);if(this.pendingMin===null||t<this.pendingMin)this.pendingMin=t;this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++;let b=!1;if(h)b=this.applyScrollAdjustment(this.getTotalSize()-c);else if(C)b=this.applyScrollAdjustment(u);this.notify(b)}},this.getVirtualItems=Zt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{let o=[];for(let r=0,s=t.length;r<s;r++){let i=t[r],l=n[i];o.push(l)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=(t)=>{let n=this.getMeasurements();if(n.length===0)return;let o=this._flatMeasurements,r=this.options.lanes===1&&o!=null,s=Pr(0,n.length-1,r?(i)=>o[i*2]:(i)=>uo(n[i]).start,t);return uo(n[s])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;else{let t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,n,o=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),s=this.getScrollOffset();if(n==="auto")n=t>=s+r?"end":"start";if(n==="center")t+=(o-r)/2;else if(n==="end")t-=r;let i=this.getMaxScrollOffset();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let o=this.getSize(),r=this.getScrollOffset(),s=this.measurementsCache[t];if(!s)return;if(n==="auto")if(s.end>=r+o-this.options.scrollPaddingEnd)n="end";else if(s.start<=r+this.options.scrollPaddingStart)n="start";else return[r,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];let i=n==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,n,s.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:o="auto"}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(t,n),s=this.now();this.scrollState={index:null,align:n,behavior:o,startedAt:s,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:o="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));let r=this.getOffsetForIndex(t,n);if(!r)return;let[s,i]=r,l=this.now();this.scrollState={index:t,align:i,behavior:o,startedAt:l,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{let o=this.getScrollOffset()+t,r=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;let n=this.getMeasurements(),o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){let r=n.length-1,s=this._flatMeasurements;if(s!=null)o=s[r*2]+s[r*2+1];else o=((t=n[r])==null?void 0:t.end)??0}else{let r=Array(this.options.lanes).fill(null),s=n.length-1;while(s>=0&&r.some((i)=>i===null)){let i=n[s];if(r[i.lane]===null)r[i.lane]=i.end;s--}o=Math.max(...r.filter((i)=>i!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let t=[];if(this.itemSizeCache.size===0)return t;let n=this.getMeasurements();for(let o of n)if(o&&this.itemSizeCache.has(o.key))t.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return t},this._scrollToOffset=(t,{adjustments:n,behavior:o})=>{this._intendedScrollOffset=t+(n??0),this.options.scrollToFn(t,{behavior:o,adjustments:n},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){if(e===0)return!1;if(co()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=e,!1;else{if(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null){if(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0)this.scrollOffset=0;this.scrollAdjustments=0}return!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}if(this.rafId!=null)return;this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;let t=5000;if(this.now()-this.scrollState.startedAt>t){this.scrollState=null;return}let n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=n?n[0]:this.scrollState.lastTargetOffset,r=1,s=o!==this.scrollState.lastTargetOffset;if(!s&&Ir(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){if(this.getScrollOffset()!==o)this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"});this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let i=this.getSize()||600,l=Math.abs(o-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&l>i;if(this.scrollState.lastTargetOffset=o,!d)this.scrollState.behavior="auto";this._scrollToOffset(o,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}var Pr=(e,t,n,o)=>{while(e<=t){let r=(e+t)/2|0,s=n(r);if(s<o)e=r+1;else if(s>o)t=r-1;else return r}if(e>0)return e-1;else return 0};function Li(e,t,n){let o=0;while(o<=t){let r=(o+t)/2|0,s=e[r*2];if(s<n)o=r+1;else if(s>n)t=r-1;else return r}return o>0?o-1:0}function ji(e,t,n,o,r){let s=e.length-1;if(e.length<=o)return{startIndex:0,endIndex:s};if(o===1&&r!==null){let f=Li(r,s,n),u=f,h=n+t;while(u<s&&r[u*2]+r[u*2+1]<h)u++;return{startIndex:f,endIndex:u}}let l=Pr(0,s,(f)=>e[f].start,n),d=l;if(o===1)while(d<s&&e[d].end<n+t)d++;else if(o>1){let f=Array(o).fill(0);while(d<s&&f.some((h)=>h<n+t)){let h=e[d];f[h.lane]=h.end,d++}let u=Array(o).fill(n+t);while(l>=0&&u.some((h)=>h>=n)){let h=e[l];u[h.lane]=h.start,l--}l=Math.max(0,l-l%o),d=Math.min(s,d+(o-1-d%o))}return{startIndex:l,endIndex:d}}var po=typeof document<"u"?nt:S;function Hi({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...o}){let r=Rn((u)=>u+1,0)[1],s=M({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=t,s.current.mode=n;let i=(u)=>{let h=s.current;if(!h.enabled||!h.container)return;let c=u.getTotalSize();if(c!==h.lastSize){h.lastSize=c;let p=u.options.horizontal?"width":"height";h.container.style[p]=`${c}px`}},l=(u)=>{let h=s.current;if(!h.enabled||!h.container)return;i(u);let c=!!u.options.horizontal,p=h.mode==="transform",m=c?"left":"top",v=u.options.scrollMargin,C=u.getVirtualItems();for(let b of C){let k=b.start-v,D=u.elementsCache.get(b.key);if(!D)continue;if(h.lastPositions.get(D)===k)continue;if(h.lastPositions.set(D,k),p)D.style.transform=c?`translate3d(${k}px, 0, 0)`:`translate3d(0, ${k}px, 0)`;else D.style[m]=`${k}px`}},d={...o,onChange:(u,h)=>{var c;let p=s.current,m=!0;if(p.enabled){l(u);let v=u.range,C=p.prevRange;if(m=!C||C.isScrolling!==u.isScrolling||C.startIndex!==(v==null?void 0:v.startIndex)||C.endIndex!==(v==null?void 0:v.endIndex),m)p.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:u.isScrolling}:null}if(m)if(e&&h)Mn(r);else r();(c=o.onChange)==null||c.call(o,u,h)}},[f]=w(()=>{let u=new fo(d);return Object.assign(u,{containerRef:(h)=>{let c=s.current;if(c.container=h,c.lastSize=null,h&&c.enabled){let p=u.getTotalSize();c.lastSize=p;let m=u.options.horizontal?"width":"height";h.style[m]=`${p}px`}}})});return f.setOptions(d),po(()=>f._didMount(),[]),po(()=>(i(f),f._willUpdate())),po(()=>{l(f)}),f}function Tn(e){return Hi({observeElementRect:Nr,observeElementOffset:kr,scrollToFn:Tr,...e})}L();function Ar({id:e,item:t,position:n,active:o,className:r,dragState:s,isNextItemDragging:i}){let l=s?.draggedIds.has(t.id),d=s?.isActive,{ref:f,isDropTarget:u}=ln({id:e,data:{type:"reorder",item:t,position:n},disabled:!o||l||!d});if(l||i)return null;return a("div",{ref:f,className:B("absolute top-0 bottom-0 w-4 flex-shrink-0 flex items-center justify-center pointer-events-auto z-50",n==="before"?"-left-2 -translate-x-1/2":"-right-2 translate-x-1/2",r),children:a("div",{className:B("h-full w-[3px] rounded-full transition-colors",u&&o&&!l&&d?"bg-primary":"bg-transparent")})})}function Or({folders:e,files:t,totalFolders:n,totalFiles:o,renderItem:r,foldersExpanded:s,setFoldersExpanded:i,filesExpanded:l,setFilesExpanded:d,hasNextFoldersPage:f,hasNextFilesPage:u,isFetchingNextFoldersPage:h,isFetchingNextFilesPage:c,fetchNextFoldersPage:p,fetchNextFilesPage:m,formatCount:v,formatSize:C,totalFoldersSize:b,totalFilesSize:k,handleEmptyAreaClick:D,dragState:P,sort:le,scrollContainerRef:te}){let ue=M(null),[V,A]=w(5);S(()=>{let se=()=>{if(!ue.current)return;let ae=ue.current.offsetWidth;if(ae<640)A(2);else if(ae<768)A(2);else if(ae<1024)A(3);else if(ae<1280)A(4);else A(5)};se();let O=new ResizeObserver(se);if(ue.current)O.observe(ue.current);return()=>O.disconnect()},[]);let Ee=Q(()=>{let se=[],O=n??e.length;if(O>0){if(se.push({type:"header",kind:"folder"}),s){let ze=Math.ceil(O/V);for(let Te=0;Te<ze;Te++)se.push({type:"row",kind:"folder",rowIndex:Te})}}let ae=o??t.length;if(ae>0){if(se.push({type:"header",kind:"file"}),l){let ze=Math.ceil(ae/V);for(let Te=0;Te<ze;Te++)se.push({type:"row",kind:"file",rowIndex:Te})}}return se},[s,l,e.length,t.length,n,o,V]),Me=Tn({count:Ee.length,getScrollElement:()=>te.current,estimateSize:(se)=>Ee[se]?.type==="header"?40:350,getItemKey:G((se)=>{let O=Ee[se];if(!O)return se;if(O.type==="header")return`header-${O.kind}`;return`row-${O.kind}-${O.rowIndex}`},[Ee]),overscan:5,paddingEnd:240}),ce=Me.getVirtualItems();return S(()=>{if(ce.length===0)return;for(let se of ce){let O=Ee[se.index];if(O?.type==="row"){let ae=O.kind==="folder",ze=ae?e:t,Te=O.rowIndex*V,_=!ze[Te],Pe=Te>=ze.length-V*3;if(ae&&f&&!h){if(_||Pe){p();break}}else if(!ae&&u&&!c){if(_||Pe){m();break}}}}},[ce,Ee,e.length,t.length,f,u,h,c,p,m,V]),a("div",{ref:ue,className:"flex-1 p-4 relative",onClick:D,children:a("div",{className:"relative w-full",style:{height:`${Me.getTotalSize()}px`},children:ce.map((se)=>{let O=Ee[se.index];if(O.type==="header"){let Pe=O.kind==="folder",Ze=Pe?n??e.length:o??t.length,ge=Pe?b??-1:k??-1,_e=ge>-1,H=Pe?s:l,E=Pe?i:d;return a("div",{ref:Me.measureElement,"data-index":se.index,className:"absolute top-0 left-0 w-full z-10 bg-background",style:{transform:`translateY(${se.start}px)`},children:g("button",{onClick:(me)=>{me.stopPropagation(),E(!H)},className:"mb-3 flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[H?a(Be,{className:"h-4 w-4"}):a(jt,{className:"h-4 w-4"}),g("span",{children:[v(Ze,!Pe),_e?` • ${C(ge)}`:""]})]})},`header-${O.kind}`)}let ae=O.kind==="folder",ze=ae?e:t,Te=O.rowIndex*V,_=[];for(let Pe=0;Pe<V;Pe++)_.push(ze[Te+Pe]);return a("div",{ref:Me.measureElement,"data-index":se.index,className:"absolute top-0 left-0 w-full grid gap-4",style:{transform:`translateY(${se.start}px)`,gridTemplateColumns:`repeat(${V}, minmax(0, 1fr))`},children:_.map((Pe,Ze)=>{let ge=Te+Ze;if(!Pe){let _e=ae?n??e.length:o??t.length;if(ge<_e)return a("div",{className:"aspect-square bg-muted animate-pulse rounded-lg"},`skeleton-${ge}`);return a("div",{},`empty-${ge}`)}return g("div",{className:"group-reorder relative flex pb-10",children:[a(Ar,{id:`reorder-before-${O.kind}-${Pe.id}`,item:Pe,position:"before",active:le?.field==="custom",dragState:P}),a("div",{className:"flex-1 min-w-0",children:r(Pe)}),a(Ar,{id:`reorder-after-${O.kind}-${Pe.id}`,item:Pe,position:"after",active:le?.field==="custom",dragState:P,isNextItemDragging:ze[ge+1]&&P?.draggedIds.has(ze[ge+1].id)})]},Pe.id)})},`row-${O.kind}-${O.rowIndex}`)})})})}L();function Ht(e,t){return typeof e==="function"?e(t):e}function yt(e,t){return(n)=>{t.setState((o)=>({...o,[e]:Ht(n,o[e])}))}}function jn(e){return e instanceof Function}function Bi(e){return Array.isArray(e)&&e.every((t)=>typeof t==="number")}function Gi(e,t){let n=[],o=(r)=>{r.forEach((s)=>{n.push(s);let i=t(s);if(i!=null&&i.length)o(i)})};return o(e),n}function he(e,t,n){let o=[],r;return(s)=>{let i;if(n.key&&n.debug)i=Date.now();let l=e(s);if(!(l.length!==o.length||l.some((u,h)=>o[h]!==u)))return r;o=l;let f;if(n.key&&n.debug)f=Date.now();if(r=t(...l),n==null||n.onChange==null||n.onChange(r),n.key&&n.debug){if(n!=null&&n.debug()){let u=Math.round((Date.now()-i)*100)/100,h=Math.round((Date.now()-f)*100)/100,c=h/16,p=(m,v)=>{m=String(m);while(m.length<v)m=" "+m;return m};console.info(`%c⏱ ${p(h,5)} /${p(u,5)} ms`,`
|
|
2
|
+
font-size: .6rem;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*c,120))}deg 100% 31%);`,n==null?void 0:n.key)}}return r}}function ye(e,t,n,o){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[t]},key:!1,onChange:o}}function qi(e,t,n,o){let r=()=>{var i;return(i=s.getValue())!=null?i:e.options.renderFallbackValue},s={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(o),renderValue:r,getContext:he(()=>[e,n,t,s],(i,l,d,f)=>({table:i,column:l,row:d,cell:f,getValue:f.getValue,renderValue:f.renderValue}),ye(e.options,"debugCells","cell.getContext"))};return e._features.forEach((i)=>{i.createCell==null||i.createCell(s,n,t,e)},{}),s}function Ui(e,t,n,o){var r,s;let l={...e._getDefaultColumnDef(),...t},d=l.accessorKey,f=(r=(s=l.id)!=null?s:d?typeof String.prototype.replaceAll==="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?r:typeof l.header==="string"?l.header:void 0,u;if(l.accessorFn)u=l.accessorFn;else if(d)if(d.includes("."))u=(c)=>{let p=c;for(let v of d.split(".")){var m;p=(m=p)==null?void 0:m[v]}return p};else u=(c)=>c[l.accessorKey];if(!f)throw Error();let h={id:`${String(f)}`,accessorFn:u,parent:o,depth:n,columnDef:l,columns:[],getFlatColumns:he(()=>[!0],()=>{var c;return[h,...(c=h.columns)==null?void 0:c.flatMap((p)=>p.getFlatColumns())]},ye(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:he(()=>[e._getOrderColumnsFn()],(c)=>{var p;if((p=h.columns)!=null&&p.length){let m=h.columns.flatMap((v)=>v.getLeafColumns());return c(m)}return[h]},ye(e.options,"debugColumns","column.getLeafColumns"))};for(let c of e._features)c.createColumn==null||c.createColumn(h,e);return h}var vt="debugHeaders";function zr(e,t,n){var o;let s={id:(o=n.id)!=null?o:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let i=[],l=(d)=>{if(d.subHeaders&&d.subHeaders.length)d.subHeaders.map(l);i.push(d)};return l(s),i},getContext:()=>({table:e,header:s,column:t})};return e._features.forEach((i)=>{i.createHeader==null||i.createHeader(s,e)}),s}var Ki={createTable:(e)=>{e.getHeaderGroups=he(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o,r)=>{var s,i;let l=(s=o==null?void 0:o.map((h)=>n.find((c)=>c.id===h)).filter(Boolean))!=null?s:[],d=(i=r==null?void 0:r.map((h)=>n.find((c)=>c.id===h)).filter(Boolean))!=null?i:[],f=n.filter((h)=>!(o!=null&&o.includes(h.id))&&!(r!=null&&r.includes(h.id)));return On(t,[...l,...f,...d],e)},ye(e.options,vt,"getHeaderGroups")),e.getCenterHeaderGroups=he(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o,r)=>(n=n.filter((s)=>!(o!=null&&o.includes(s.id))&&!(r!=null&&r.includes(s.id))),On(t,n,e,"center")),ye(e.options,vt,"getCenterHeaderGroups")),e.getLeftHeaderGroups=he(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,o)=>{var r;let s=(r=o==null?void 0:o.map((i)=>n.find((l)=>l.id===i)).filter(Boolean))!=null?r:[];return On(t,s,e,"left")},ye(e.options,vt,"getLeftHeaderGroups")),e.getRightHeaderGroups=he(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,o)=>{var r;let s=(r=o==null?void 0:o.map((i)=>n.find((l)=>l.id===i)).filter(Boolean))!=null?r:[];return On(t,s,e,"right")},ye(e.options,vt,"getRightHeaderGroups")),e.getFooterGroups=he(()=>[e.getHeaderGroups()],(t)=>[...t].reverse(),ye(e.options,vt,"getFooterGroups")),e.getLeftFooterGroups=he(()=>[e.getLeftHeaderGroups()],(t)=>[...t].reverse(),ye(e.options,vt,"getLeftFooterGroups")),e.getCenterFooterGroups=he(()=>[e.getCenterHeaderGroups()],(t)=>[...t].reverse(),ye(e.options,vt,"getCenterFooterGroups")),e.getRightFooterGroups=he(()=>[e.getRightHeaderGroups()],(t)=>[...t].reverse(),ye(e.options,vt,"getRightFooterGroups")),e.getFlatHeaders=he(()=>[e.getHeaderGroups()],(t)=>t.map((n)=>n.headers).flat(),ye(e.options,vt,"getFlatHeaders")),e.getLeftFlatHeaders=he(()=>[e.getLeftHeaderGroups()],(t)=>t.map((n)=>n.headers).flat(),ye(e.options,vt,"getLeftFlatHeaders")),e.getCenterFlatHeaders=he(()=>[e.getCenterHeaderGroups()],(t)=>t.map((n)=>n.headers).flat(),ye(e.options,vt,"getCenterFlatHeaders")),e.getRightFlatHeaders=he(()=>[e.getRightHeaderGroups()],(t)=>t.map((n)=>n.headers).flat(),ye(e.options,vt,"getRightFlatHeaders")),e.getCenterLeafHeaders=he(()=>[e.getCenterFlatHeaders()],(t)=>t.filter((n)=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),ye(e.options,vt,"getCenterLeafHeaders")),e.getLeftLeafHeaders=he(()=>[e.getLeftFlatHeaders()],(t)=>t.filter((n)=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),ye(e.options,vt,"getLeftLeafHeaders")),e.getRightLeafHeaders=he(()=>[e.getRightFlatHeaders()],(t)=>t.filter((n)=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),ye(e.options,vt,"getRightLeafHeaders")),e.getLeafHeaders=he(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,o)=>{var r,s,i,l,d,f;return[...(r=(s=t[0])==null?void 0:s.headers)!=null?r:[],...(i=(l=n[0])==null?void 0:l.headers)!=null?i:[],...(d=(f=o[0])==null?void 0:f.headers)!=null?d:[]].map((u)=>u.getLeafHeaders()).flat()},ye(e.options,vt,"getLeafHeaders"))}};function On(e,t,n,o){var r,s;let i=0,l=function(c,p){if(p===void 0)p=1;i=Math.max(i,p),c.filter((m)=>m.getIsVisible()).forEach((m)=>{var v;if((v=m.columns)!=null&&v.length)l(m.columns,p+1)},0)};l(e);let d=[],f=(c,p)=>{let m={depth:p,id:[o,`${p}`].filter(Boolean).join("_"),headers:[]},v=[];if(c.forEach((C)=>{let b=[...v].reverse()[0],k=C.column.depth===m.depth,D,P=!1;if(k&&C.column.parent)D=C.column.parent;else D=C.column,P=!0;if(b&&(b==null?void 0:b.column)===D)b.subHeaders.push(C);else{let le=zr(n,D,{id:[o,p,D.id,C==null?void 0:C.id].filter(Boolean).join("_"),isPlaceholder:P,placeholderId:P?`${v.filter((te)=>te.column===D).length}`:void 0,depth:p,index:v.length});le.subHeaders.push(C),v.push(le)}m.headers.push(C),C.headerGroup=m}),d.push(m),p>0)f(v,p-1)},u=t.map((c,p)=>zr(n,c,{depth:i,index:p}));f(u,i-1),d.reverse();let h=(c)=>c.filter((m)=>m.column.getIsVisible()).map((m)=>{let v=0,C=0,b=[0];if(m.subHeaders&&m.subHeaders.length)b=[],h(m.subHeaders).forEach((D)=>{let{colSpan:P,rowSpan:le}=D;v+=P,b.push(le)});else v=1;let k=Math.min(...b);return C=C+k,m.colSpan=v,m.rowSpan=C,{colSpan:v,rowSpan:C}});return h((r=(s=d[0])==null?void 0:s.headers)!=null?r:[]),d}var Wi=(e,t,n,o,r,s,i)=>{let l={id:t,index:o,original:n,depth:r,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:(d)=>{if(l._valuesCache.hasOwnProperty(d))return l._valuesCache[d];let f=e.getColumn(d);if(!(f!=null&&f.accessorFn))return;return l._valuesCache[d]=f.accessorFn(l.original,o),l._valuesCache[d]},getUniqueValues:(d)=>{if(l._uniqueValuesCache.hasOwnProperty(d))return l._uniqueValuesCache[d];let f=e.getColumn(d);if(!(f!=null&&f.accessorFn))return;if(!f.columnDef.getUniqueValues)return l._uniqueValuesCache[d]=[l.getValue(d)],l._uniqueValuesCache[d];return l._uniqueValuesCache[d]=f.columnDef.getUniqueValues(l.original,o),l._uniqueValuesCache[d]},renderValue:(d)=>{var f;return(f=l.getValue(d))!=null?f:e.options.renderFallbackValue},subRows:s!=null?s:[],getLeafRows:()=>Gi(l.subRows,(d)=>d.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let d=[],f=l;while(!0){let u=f.getParentRow();if(!u)break;d.push(u),f=u}return d.reverse()},getAllCells:he(()=>[e.getAllLeafColumns()],(d)=>d.map((f)=>qi(e,l,f,f.id)),ye(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:he(()=>[l.getAllCells()],(d)=>d.reduce((f,u)=>(f[u.column.id]=u,f),{}),ye(e.options,"debugRows","getAllCellsByColumnId"))};for(let d=0;d<e._features.length;d++){let f=e._features[d];f==null||f.createRow==null||f.createRow(l,e)}return l},Qi={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>{if(!e._getFacetedRowModel)return t.getPreFilteredRowModel();return e._getFacetedRowModel()},e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>{if(!e._getFacetedUniqueValues)return new Map;return e._getFacetedUniqueValues()},e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(!e._getFacetedMinMaxValues)return;return e._getFacetedMinMaxValues()}}},Hr=(e,t,n)=>{var o,r;let s=n==null||(o=n.toString())==null?void 0:o.toLowerCase();return Boolean((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null?void 0:r.includes(s))};Hr.autoRemove=(e)=>kt(e);var Gr=(e,t,n)=>{var o;return Boolean((o=e.getValue(t))==null||(o=o.toString())==null?void 0:o.includes(n))};Gr.autoRemove=(e)=>kt(e);var qr=(e,t,n)=>{var o;return((o=e.getValue(t))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(n==null?void 0:n.toLowerCase())};qr.autoRemove=(e)=>kt(e);var Ur=(e,t,n)=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(n)};Ur.autoRemove=(e)=>kt(e);var Kr=(e,t,n)=>!n.some((o)=>{var r;return!((r=e.getValue(t))!=null&&r.includes(o))});Kr.autoRemove=(e)=>kt(e)||!(e!=null&&e.length);var Qr=(e,t,n)=>n.some((o)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(o)});Qr.autoRemove=(e)=>kt(e)||!(e!=null&&e.length);var Xr=(e,t,n)=>e.getValue(t)===n;Xr.autoRemove=(e)=>kt(e);var Jr=(e,t,n)=>e.getValue(t)==n;Jr.autoRemove=(e)=>kt(e);var Mo=(e,t,n)=>{let[o,r]=n,s=e.getValue(t);return s>=o&&s<=r};Mo.resolveFilterValue=(e)=>{let[t,n]=e,o=typeof t!=="number"?parseFloat(t):t,r=typeof n!=="number"?parseFloat(n):n,s=t===null||Number.isNaN(o)?-1/0:o,i=n===null||Number.isNaN(r)?1/0:r;if(s>i){let l=s;s=i,i=l}return[s,i]};Mo.autoRemove=(e)=>kt(e)||kt(e[0])&&kt(e[1]);var zt={includesString:Hr,includesStringSensitive:Gr,equalsString:qr,arrIncludes:Ur,arrIncludesAll:Kr,arrIncludesSome:Qr,equals:Xr,weakEquals:Jr,inNumberRange:Mo};function kt(e){return e===void 0||e===null||e===""}var Xi={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:(e)=>({columnFilters:[],...e}),getDefaultOptions:(e)=>({onColumnFiltersChange:yt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0],o=n==null?void 0:n.getValue(e.id);if(typeof o==="string")return zt.includesString;if(typeof o==="number")return zt.inNumberRange;if(typeof o==="boolean")return zt.equals;if(o!==null&&typeof o==="object")return zt.equals;if(Array.isArray(o))return zt.arrIncludes;return zt.weakEquals},e.getFilterFn=()=>{var n,o;return jn(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(o=t.options.filterFns)==null?void 0:o[e.columnDef.filterFn])!=null?n:zt[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,o,r;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((o=t.options.enableColumnFilters)!=null?o:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find((o)=>o.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,o;return(n=(o=t.getState().columnFilters)==null?void 0:o.findIndex((r)=>r.id===e.id))!=null?n:-1},e.setFilterValue=(n)=>{t.setColumnFilters((o)=>{let r=e.getFilterFn(),s=o==null?void 0:o.find((u)=>u.id===e.id),i=Ht(n,s?s.value:void 0);if(jr(r,i,e)){var l;return(l=o==null?void 0:o.filter((u)=>u.id!==e.id))!=null?l:[]}let d={id:e.id,value:i};if(s){var f;return(f=o==null?void 0:o.map((u)=>{if(u.id===e.id)return d;return u}))!=null?f:[]}if(o!=null&&o.length)return[...o,d];return[d]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:(e)=>{e.setColumnFilters=(t)=>{let n=e.getAllLeafColumns(),o=(r)=>{var s;return(s=Ht(t,r))==null?void 0:s.filter((i)=>{let l=n.find((d)=>d.id===i.id);if(l){let d=l.getFilterFn();if(jr(d,i.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},e.resetColumnFilters=(t)=>{var n,o;e.setColumnFilters(t?[]:(n=(o=e.initialState)==null?void 0:o.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>{if(!e._getFilteredRowModel&&e.options.getFilteredRowModel)e._getFilteredRowModel=e.options.getFilteredRowModel(e);if(e.options.manualFiltering||!e._getFilteredRowModel)return e.getPreFilteredRowModel();return e._getFilteredRowModel()}}};function jr(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t==="string"&&!t}var Ji=(e,t,n)=>n.reduce((o,r)=>{let s=r.getValue(e);return o+(typeof s==="number"?s:0)},0),Yi=(e,t,n)=>{let o;return n.forEach((r)=>{let s=r.getValue(e);if(s!=null&&(o>s||o===void 0&&s>=s))o=s}),o},Zi=(e,t,n)=>{let o;return n.forEach((r)=>{let s=r.getValue(e);if(s!=null&&(o<s||o===void 0&&s>=s))o=s}),o},ea=(e,t,n)=>{let o,r;return n.forEach((s)=>{let i=s.getValue(e);if(i!=null)if(o===void 0){if(i>=i)o=r=i}else{if(o>i)o=i;if(r<i)r=i}}),[o,r]},ta=(e,t)=>{let n=0,o=0;if(t.forEach((r)=>{let s=r.getValue(e);if(s!=null&&(s=+s)>=s)++n,o+=s}),n)return o/n;return},na=(e,t)=>{if(!t.length)return;let n=t.map((s)=>s.getValue(e));if(!Bi(n))return;if(n.length===1)return n[0];let o=Math.floor(n.length/2),r=n.sort((s,i)=>s-i);return n.length%2!==0?r[o]:(r[o-1]+r[o])/2},oa=(e,t)=>Array.from(new Set(t.map((n)=>n.getValue(e))).values()),ra=(e,t)=>new Set(t.map((n)=>n.getValue(e))).size,sa=(e,t)=>t.length,mo={sum:Ji,min:Yi,max:Zi,extent:ea,mean:ta,median:na,unique:oa,uniqueCount:ra,count:sa},ia={getDefaultColumnDef:()=>({aggregatedCell:(e)=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:(e)=>({grouping:[],...e}),getDefaultOptions:(e)=>({onGroupingChange:yt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((n)=>{if(n!=null&&n.includes(e.id))return n.filter((o)=>o!==e.id);return[...n!=null?n:[],e.id]})},e.getCanGroup=()=>{var n,o;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((o=t.options.enableGrouping)!=null?o:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let n=e.getCanGroup();return()=>{if(!n)return;e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0],o=n==null?void 0:n.getValue(e.id);if(typeof o==="number")return mo.sum;if(Object.prototype.toString.call(o)==="[object Date]")return mo.extent},e.getAggregationFn=()=>{var n,o;if(!e)throw Error();return jn(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(o=t.options.aggregationFns)==null?void 0:o[e.columnDef.aggregationFn])!=null?n:mo[e.columnDef.aggregationFn]}},createTable:(e)=>{e.setGrouping=(t)=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=(t)=>{var n,o;e.setGrouping(t?[]:(n=(o=e.initialState)==null?void 0:o.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>{if(!e._getGroupedRowModel&&e.options.getGroupedRowModel)e._getGroupedRowModel=e.options.getGroupedRowModel(e);if(e.options.manualGrouping||!e._getGroupedRowModel)return e.getPreGroupedRowModel();return e._getGroupedRowModel()}},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=(n)=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let o=t.getColumn(n);if(!(o!=null&&o.columnDef.getGroupingValue))return e.getValue(n);return e._groupingValuesCache[n]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]},e._groupingValuesCache={}},createCell:(e,t,n,o)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=n.subRows)!=null&&r.length)}}};function la(e,t,n){if(!(t!=null&&t.length)||!n)return e;let o=e.filter((s)=>!t.includes(s.id));if(n==="remove")return o;return[...t.map((s)=>e.find((i)=>i.id===s)).filter(Boolean),...o]}var da={getInitialState:(e)=>({columnOrder:[],...e}),getDefaultOptions:(e)=>({onColumnOrderChange:yt("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=he((n)=>[wn(t,n)],(n)=>n.findIndex((o)=>o.id===e.id),ye(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=(n)=>{var o;return((o=wn(t,n)[0])==null?void 0:o.id)===e.id},e.getIsLastColumn=(n)=>{var o;let r=wn(t,n);return((o=r[r.length-1])==null?void 0:o.id)===e.id}},createTable:(e)=>{e.setColumnOrder=(t)=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=(t)=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=he(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,o)=>(r)=>{let s=[];if(!(t!=null&&t.length))s=r;else{let i=[...t],l=[...r];while(l.length&&i.length){let d=i.shift(),f=l.findIndex((u)=>u.id===d);if(f>-1)s.push(l.splice(f,1)[0])}s=[...s,...l]}return la(s,n,o)},ye(e.options,"debugTable","_getOrderColumnsFn"))}},go=()=>({left:[],right:[]}),ua={getInitialState:(e)=>({columnPinning:go(),...e}),getDefaultOptions:(e)=>({onColumnPinningChange:yt("columnPinning",e)}),createColumn:(e,t)=>{e.pin=(n)=>{let o=e.getLeafColumns().map((r)=>r.id).filter(Boolean);t.setColumnPinning((r)=>{var s,i;if(n==="right"){var l,d;return{left:((l=r==null?void 0:r.left)!=null?l:[]).filter((h)=>!(o!=null&&o.includes(h))),right:[...((d=r==null?void 0:r.right)!=null?d:[]).filter((h)=>!(o!=null&&o.includes(h))),...o]}}if(n==="left"){var f,u;return{left:[...((f=r==null?void 0:r.left)!=null?f:[]).filter((h)=>!(o!=null&&o.includes(h))),...o],right:((u=r==null?void 0:r.right)!=null?u:[]).filter((h)=>!(o!=null&&o.includes(h)))}}return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter((h)=>!(o!=null&&o.includes(h))),right:((i=r==null?void 0:r.right)!=null?i:[]).filter((h)=>!(o!=null&&o.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some((o)=>{var r,s,i;return((r=o.columnDef.enablePinning)!=null?r:!0)&&((s=(i=t.options.enableColumnPinning)!=null?i:t.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{let n=e.getLeafColumns().map((l)=>l.id),{left:o,right:r}=t.getState().columnPinning,s=n.some((l)=>o==null?void 0:o.includes(l)),i=n.some((l)=>r==null?void 0:r.includes(l));return s?"left":i?"right":!1},e.getPinnedIndex=()=>{var n,o;let r=e.getIsPinned();return r?(n=(o=t.getState().columnPinning)==null||(o=o[r])==null?void 0:o.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=he(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,o,r)=>{let s=[...o!=null?o:[],...r!=null?r:[]];return n.filter((i)=>!s.includes(i.column.id))},ye(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=he(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,o)=>(o!=null?o:[]).map((s)=>n.find((i)=>i.column.id===s)).filter(Boolean).map((s)=>({...s,position:"left"})),ye(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=he(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,o)=>(o!=null?o:[]).map((s)=>n.find((i)=>i.column.id===s)).filter(Boolean).map((s)=>({...s,position:"right"})),ye(t.options,"debugRows","getRightVisibleCells"))},createTable:(e)=>{e.setColumnPinning=(t)=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=(t)=>{var n,o;return e.setColumnPinning(t?go():(n=(o=e.initialState)==null?void 0:o.columnPinning)!=null?n:go())},e.getIsSomeColumnsPinned=(t)=>{var n;let o=e.getState().columnPinning;if(!t){var r,s;return Boolean(((r=o.left)==null?void 0:r.length)||((s=o.right)==null?void 0:s.length))}return Boolean((n=o[t])==null?void 0:n.length)},e.getLeftLeafColumns=he(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n!=null?n:[]).map((o)=>t.find((r)=>r.id===o)).filter(Boolean),ye(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=he(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n!=null?n:[]).map((o)=>t.find((r)=>r.id===o)).filter(Boolean),ye(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=he(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o)=>{let r=[...n!=null?n:[],...o!=null?o:[]];return t.filter((s)=>!r.includes(s.id))},ye(e.options,"debugColumns","getCenterLeafColumns"))}};function ca(e){return e||(typeof document<"u"?document:null)}var zn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ho=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),fa={getDefaultColumnDef:()=>zn,getInitialState:(e)=>({columnSizing:{},columnSizingInfo:ho(),...e}),getDefaultOptions:(e)=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:yt("columnSizing",e),onColumnSizingInfoChange:yt("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,o,r;let s=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:zn.minSize,(o=s!=null?s:e.columnDef.size)!=null?o:zn.size),(r=e.columnDef.maxSize)!=null?r:zn.maxSize)},e.getStart=he((n)=>[n,wn(t,n),t.getState().columnSizing],(n,o)=>o.slice(0,e.getIndex(n)).reduce((r,s)=>r+s.getSize(),0),ye(t.options,"debugColumns","getStart")),e.getAfter=he((n)=>[n,wn(t,n),t.getState().columnSizing],(n,o)=>o.slice(e.getIndex(n)+1).reduce((r,s)=>r+s.getSize(),0),ye(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing((n)=>{let{[e.id]:o,...r}=n;return r})},e.getCanResize=()=>{var n,o;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((o=t.options.enableColumnResizing)!=null?o:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0,o=(r)=>{if(r.subHeaders.length)r.subHeaders.forEach(o);else{var s;n+=(s=r.column.getSize())!=null?s:0}};return o(e),n},e.getStart=()=>{if(e.index>0){let n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=(n)=>{let o=t.getColumn(e.column.id),r=o==null?void 0:o.getCanResize();return(s)=>{if(!o||!r)return;if(s.persist==null||s.persist(),vo(s)){if(s.touches&&s.touches.length>1)return}let i=e.getSize(),l=e?e.getLeafHeaders().map((b)=>[b.column.id,b.column.getSize()]):[[o.id,o.getSize()]],d=vo(s)?Math.round(s.touches[0].clientX):s.clientX,f={},u=(b,k)=>{if(typeof k!=="number")return;if(t.setColumnSizingInfo((D)=>{var P,le;let te=t.options.columnResizeDirection==="rtl"?-1:1,ue=(k-((P=D==null?void 0:D.startOffset)!=null?P:0))*te,V=Math.max(ue/((le=D==null?void 0:D.startSize)!=null?le:0),-0.999999);return D.columnSizingStart.forEach((A)=>{let[Ee,Me]=A;f[Ee]=Math.round(Math.max(Me+Me*V,0)*100)/100}),{...D,deltaOffset:ue,deltaPercentage:V}}),t.options.columnResizeMode==="onChange"||b==="end")t.setColumnSizing((D)=>({...D,...f}))},h=(b)=>u("move",b),c=(b)=>{u("end",b),t.setColumnSizingInfo((k)=>({...k,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=ca(n),m={moveHandler:(b)=>h(b.clientX),upHandler:(b)=>{p==null||p.removeEventListener("mousemove",m.moveHandler),p==null||p.removeEventListener("mouseup",m.upHandler),c(b.clientX)}},v={moveHandler:(b)=>{if(b.cancelable)b.preventDefault(),b.stopPropagation();return h(b.touches[0].clientX),!1},upHandler:(b)=>{var k;if(p==null||p.removeEventListener("touchmove",v.moveHandler),p==null||p.removeEventListener("touchend",v.upHandler),b.cancelable)b.preventDefault(),b.stopPropagation();c((k=b.touches[0])==null?void 0:k.clientX)}},C=pa()?{passive:!1}:!1;if(vo(s))p==null||p.addEventListener("touchmove",v.moveHandler,C),p==null||p.addEventListener("touchend",v.upHandler,C);else p==null||p.addEventListener("mousemove",m.moveHandler,C),p==null||p.addEventListener("mouseup",m.upHandler,C);t.setColumnSizingInfo((b)=>({...b,startOffset:d,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:o.id}))}}},createTable:(e)=>{e.setColumnSizing=(t)=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=(t)=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=(t)=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=(t)=>{var n;e.setColumnSizingInfo(t?ho():(n=e.initialState.columnSizingInfo)!=null?n:ho())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((o,r)=>o+r.getSize(),0))!=null?t:0}}},Vn=null;function pa(){if(typeof Vn==="boolean")return Vn;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return Vn=e,Vn}function vo(e){return e.type==="touchstart"}var ga={getInitialState:(e)=>({columnVisibility:{},...e}),getDefaultOptions:(e)=>({onColumnVisibilityChange:yt("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=(n)=>{if(e.getCanHide())t.setColumnVisibility((o)=>({...o,[e.id]:n!=null?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,o;let r=e.columns;return(n=r.length?r.some((s)=>s.getIsVisible()):(o=t.getState().columnVisibility)==null?void 0:o[e.id])!=null?n:!0},e.getCanHide=()=>{var n,o;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((o=t.options.enableHiding)!=null?o:!0)},e.getToggleVisibilityHandler=()=>(n)=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=he(()=>[e.getAllCells(),t.getState().columnVisibility],(n)=>n.filter((o)=>o.column.getIsVisible()),ye(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=he(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,o,r)=>[...n,...o,...r],ye(t.options,"debugRows","getVisibleCells"))},createTable:(e)=>{let t=(n,o)=>he(()=>[o(),o().filter((r)=>r.getIsVisible()).map((r)=>r.id).join("_")],(r)=>r.filter((s)=>s.getIsVisible==null?void 0:s.getIsVisible()),ye(e.options,"debugColumns",n));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=(n)=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=(n)=>{var o;e.setColumnVisibility(n?{}:(o=e.initialState.columnVisibility)!=null?o:{})},e.toggleAllColumnsVisible=(n)=>{var o;n=(o=n)!=null?o:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,s)=>({...r,[s.id]:!n?!(s.getCanHide!=null&&s.getCanHide()):n}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((n)=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((n)=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>(n)=>{var o;e.toggleAllColumnsVisible((o=n.target)==null?void 0:o.checked)}}};function wn(e,t){return!t?e.getVisibleLeafColumns():t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns()}var ha={createTable:(e)=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>{if(e.options.manualFiltering||!e._getGlobalFacetedRowModel)return e.getPreFilteredRowModel();return e._getGlobalFacetedRowModel()},e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>{if(!e._getGlobalFacetedUniqueValues)return new Map;return e._getGlobalFacetedUniqueValues()},e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(!e._getGlobalFacetedMinMaxValues)return;return e._getGlobalFacetedMinMaxValues()}}},va={getInitialState:(e)=>({globalFilter:void 0,...e}),getDefaultOptions:(e)=>({onGlobalFilterChange:yt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:(t)=>{var n;let o=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof o==="string"||typeof o==="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,o,r,s;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((o=t.options.enableGlobalFilter)!=null?o:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&((s=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?s:!0)&&!!e.accessorFn}},createTable:(e)=>{e.getGlobalAutoFilterFn=()=>zt.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:o}=e.options;return jn(o)?o:o==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[o])!=null?t:zt[o]},e.setGlobalFilter=(t)=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=(t)=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},wa={getInitialState:(e)=>({expanded:{},...e}),getDefaultOptions:(e)=>({onExpandedChange:yt("expanded",e),paginateExpandedRows:!0}),createTable:(e)=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var o,r;if(!t){e._queue(()=>{t=!0});return}if((o=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?o:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=(o)=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),e.toggleAllRowsExpanded=(o)=>{if(o!=null?o:!e.getIsAllRowsExpanded())e.setExpanded(!0);else e.setExpanded({})},e.resetExpanded=(o)=>{var r,s;e.setExpanded(o?{}:(r=(s=e.initialState)==null?void 0:s.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((o)=>o.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>(o)=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},e.getIsAllRowsExpanded=()=>{let o=e.getState().expanded;if(typeof o==="boolean")return o===!0;if(!Object.keys(o).length)return!1;if(e.getRowModel().flatRows.some((r)=>!r.getIsExpanded()))return!1;return!0},e.getExpandedDepth=()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((s)=>{let i=s.split(".");o=Math.max(o,i.length)}),o},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>{if(!e._getExpandedRowModel&&e.options.getExpandedRowModel)e._getExpandedRowModel=e.options.getExpandedRowModel(e);if(e.options.manualExpanding||!e._getExpandedRowModel)return e.getPreExpandedRowModel();return e._getExpandedRowModel()}},createRow:(e,t)=>{e.toggleExpanded=(n)=>{t.setExpanded((o)=>{var r;let s=o===!0?!0:!!(o!=null&&o[e.id]),i={};if(o===!0)Object.keys(t.getRowModel().rowsById).forEach((l)=>{i[l]=!0});else i=o;if(n=(r=n)!=null?r:!s,!s&&n)return{...i,[e.id]:!0};if(s&&!n){let{[e.id]:l,...d}=i;return d}return o})},e.getIsExpanded=()=>{var n;let o=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:o===!0||(o==null?void 0:o[e.id]))},e.getCanExpand=()=>{var n,o,r;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((o=t.options.enableExpanding)!=null?o:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let n=!0,o=e;while(n&&o.parentId)o=t.getRow(o.parentId,!0),n=o.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let n=e.getCanExpand();return()=>{if(!n)return;e.toggleExpanded()}}}},So=0,bo=10,xo=()=>({pageIndex:So,pageSize:bo}),xa={getInitialState:(e)=>({...e,pagination:{...xo(),...e==null?void 0:e.pagination}}),getDefaultOptions:(e)=>({onPaginationChange:yt("pagination",e)}),createTable:(e)=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var o,r;if(!t){e._queue(()=>{t=!0});return}if((o=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?o:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=(o)=>{let r=(s)=>Ht(o,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=(o)=>{var r;e.setPagination(o?xo():(r=e.initialState.pagination)!=null?r:xo())},e.setPageIndex=(o)=>{e.setPagination((r)=>{let s=Ht(o,r.pageIndex),i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return s=Math.max(0,Math.min(s,i)),{...r,pageIndex:s}})},e.resetPageIndex=(o)=>{var r,s;e.setPageIndex(o?So:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:So)},e.resetPageSize=(o)=>{var r,s;e.setPageSize(o?bo:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:bo)},e.setPageSize=(o)=>{e.setPagination((r)=>{let s=Math.max(1,Ht(o,r.pageSize)),i=r.pageSize*r.pageIndex,l=Math.floor(i/s);return{...r,pageIndex:l,pageSize:s}})},e.setPageCount=(o)=>e.setPagination((r)=>{var s;let i=Ht(o,(s=e.options.pageCount)!=null?s:-1);if(typeof i==="number")i=Math.max(-1,i);return{...r,pageCount:i}}),e.getPageOptions=he(()=>[e.getPageCount()],(o)=>{let r=[];if(o&&o>0)r=[...Array(o)].fill(null).map((s,i)=>i);return r},ye(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:o}=e.getState().pagination,r=e.getPageCount();if(r===-1)return!0;if(r===0)return!1;return o<r-1},e.previousPage=()=>e.setPageIndex((o)=>o-1),e.nextPage=()=>e.setPageIndex((o)=>o+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>{if(!e._getPaginationRowModel&&e.options.getPaginationRowModel)e._getPaginationRowModel=e.options.getPaginationRowModel(e);if(e.options.manualPagination||!e._getPaginationRowModel)return e.getPrePaginationRowModel();return e._getPaginationRowModel()},e.getPageCount=()=>{var o;return(o=e.options.pageCount)!=null?o:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var o;return(o=e.options.rowCount)!=null?o:e.getPrePaginationRowModel().rows.length}}},yo=()=>({top:[],bottom:[]}),ya={getInitialState:(e)=>({rowPinning:yo(),...e}),getDefaultOptions:(e)=>({onRowPinningChange:yt("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,o,r)=>{let s=o?e.getLeafRows().map((d)=>{let{id:f}=d;return f}):[],i=r?e.getParentRows().map((d)=>{let{id:f}=d;return f}):[],l=new Set([...i,e.id,...s]);t.setRowPinning((d)=>{var f,u;if(n==="bottom"){var h,c;return{top:((h=d==null?void 0:d.top)!=null?h:[]).filter((v)=>!(l!=null&&l.has(v))),bottom:[...((c=d==null?void 0:d.bottom)!=null?c:[]).filter((v)=>!(l!=null&&l.has(v))),...Array.from(l)]}}if(n==="top"){var p,m;return{top:[...((p=d==null?void 0:d.top)!=null?p:[]).filter((v)=>!(l!=null&&l.has(v))),...Array.from(l)],bottom:((m=d==null?void 0:d.bottom)!=null?m:[]).filter((v)=>!(l!=null&&l.has(v)))}}return{top:((f=d==null?void 0:d.top)!=null?f:[]).filter((v)=>!(l!=null&&l.has(v))),bottom:((u=d==null?void 0:d.bottom)!=null?u:[]).filter((v)=>!(l!=null&&l.has(v)))}})},e.getCanPin=()=>{var n;let{enableRowPinning:o,enablePinning:r}=t.options;if(typeof o==="function")return o(e);return(n=o!=null?o:r)!=null?n:!0},e.getIsPinned=()=>{let n=[e.id],{top:o,bottom:r}=t.getState().rowPinning,s=n.some((l)=>o==null?void 0:o.includes(l)),i=n.some((l)=>r==null?void 0:r.includes(l));return s?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var n,o;let r=e.getIsPinned();if(!r)return-1;let s=(n=r==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map((i)=>{let{id:l}=i;return l});return(o=s==null?void 0:s.indexOf(e.id))!=null?o:-1}},createTable:(e)=>{e.setRowPinning=(t)=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=(t)=>{var n,o;return e.setRowPinning(t?yo():(n=(o=e.initialState)==null?void 0:o.rowPinning)!=null?n:yo())},e.getIsSomeRowsPinned=(t)=>{var n;let o=e.getState().rowPinning;if(!t){var r,s;return Boolean(((r=o.top)==null?void 0:r.length)||((s=o.bottom)==null?void 0:s.length))}return Boolean((n=o[t])==null?void 0:n.length)},e._getPinnedRows=(t,n,o)=>{var r;return(((r=e.options.keepPinnedRows)!=null?r:!0)?(n!=null?n:[]).map((i)=>{let l=e.getRow(i,!0);return l.getIsAllParentsExpanded()?l:null}):(n!=null?n:[]).map((i)=>t.find((l)=>l.id===i))).filter(Boolean).map((i)=>({...i,position:o}))},e.getTopRows=he(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),ye(e.options,"debugRows","getTopRows")),e.getBottomRows=he(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),ye(e.options,"debugRows","getBottomRows")),e.getCenterRows=he(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,o)=>{let r=new Set([...n!=null?n:[],...o!=null?o:[]]);return t.filter((s)=>!r.has(s.id))},ye(e.options,"debugRows","getCenterRows"))}},ba={getInitialState:(e)=>({rowSelection:{},...e}),getDefaultOptions:(e)=>({onRowSelectionChange:yt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:(e)=>{e.setRowSelection=(t)=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=(t)=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=(t)=>{e.setRowSelection((n)=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();let o={...n},r=e.getPreGroupedRowModel().flatRows;if(t)r.forEach((s)=>{if(!s.getCanSelect())return;o[s.id]=!0});else r.forEach((s)=>{delete o[s.id]});return o})},e.toggleAllPageRowsSelected=(t)=>e.setRowSelection((n)=>{let o=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),r={...n};return e.getRowModel().rows.forEach((s)=>{Io(r,s.id,o,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=he(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>{if(!Object.keys(t).length)return{rows:[],flatRows:[],rowsById:{}};return Co(e,n)},ye(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=he(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>{if(!Object.keys(t).length)return{rows:[],flatRows:[],rowsById:{}};return Co(e,n)},ye(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=he(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>{if(!Object.keys(t).length)return{rows:[],flatRows:[],rowsById:{}};return Co(e,n)},ye(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),o=Boolean(t.length&&Object.keys(n).length);if(o){if(t.some((r)=>r.getCanSelect()&&!n[r.id]))o=!1}return o},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter((r)=>r.getCanSelect()),{rowSelection:n}=e.getState(),o=!!t.length;if(o&&t.some((r)=>!n[r.id]))o=!1;return o},e.getIsSomeRowsSelected=()=>{var t;let n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter((n)=>n.getCanSelect()).some((n)=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>(t)=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>(t)=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,o)=>{let r=e.getIsSelected();t.setRowSelection((s)=>{var i;if(n=typeof n<"u"?n:!r,e.getCanSelect()&&r===n)return s;let l={...s};return Io(l,e.id,n,(i=o==null?void 0:o.selectChildren)!=null?i:!0,t),l})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return No(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return Ro(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return Ro(e,n)==="all"},e.getCanSelect=()=>{var n;if(typeof t.options.enableRowSelection==="function")return t.options.enableRowSelection(e);return(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;if(typeof t.options.enableSubRowSelection==="function")return t.options.enableSubRowSelection(e);return(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;if(typeof t.options.enableMultiRowSelection==="function")return t.options.enableMultiRowSelection(e);return(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{let n=e.getCanSelect();return(o)=>{var r;if(!n)return;e.toggleSelected((r=o.target)==null?void 0:r.checked)}}}},Io=(e,t,n,o,r)=>{var s;let i=r.getRow(t,!0);if(n){if(!i.getCanMultiSelect())Object.keys(e).forEach((l)=>delete e[l]);if(i.getCanSelect())e[t]=!0}else delete e[t];if(o&&(s=i.subRows)!=null&&s.length&&i.getCanSelectSubRows())i.subRows.forEach((l)=>Io(e,l.id,n,o,r))};function Co(e,t){let n=e.getState().rowSelection,o=[],r={},s=function(i,l){return i.map((d)=>{var f;let u=No(d,n);if(u)o.push(d),r[d.id]=d;if((f=d.subRows)!=null&&f.length)d={...d,subRows:s(d.subRows)};if(u)return d}).filter(Boolean)};return{rows:s(t.rows),flatRows:o,rowsById:r}}function No(e,t){var n;return(n=t[e.id])!=null?n:!1}function Ro(e,t,n){var o;if(!((o=e.subRows)!=null&&o.length))return!1;let r=!0,s=!1;return e.subRows.forEach((i)=>{if(s&&!r)return;if(i.getCanSelect())if(No(i,t))s=!0;else r=!1;if(i.subRows&&i.subRows.length){let l=Ro(i,t);if(l==="all")s=!0;else if(l==="some")s=!0,r=!1;else r=!1}}),r?"all":s?"some":!1}var Fo=/([0-9]+)/gm,_a=(e,t,n)=>Yr(Gt(e.getValue(n)).toLowerCase(),Gt(t.getValue(n)).toLowerCase()),Ra=(e,t,n)=>Yr(Gt(e.getValue(n)),Gt(t.getValue(n))),Fa=(e,t,n)=>ko(Gt(e.getValue(n)).toLowerCase(),Gt(t.getValue(n)).toLowerCase()),Ma=(e,t,n)=>ko(Gt(e.getValue(n)),Gt(t.getValue(n))),Na=(e,t,n)=>{let o=e.getValue(n),r=t.getValue(n);return o>r?1:o<r?-1:0},ka=(e,t,n)=>ko(e.getValue(n),t.getValue(n));function ko(e,t){return e===t?0:e>t?1:-1}function Gt(e){if(typeof e==="number"){if(isNaN(e)||e===1/0||e===-1/0)return"";return String(e)}if(typeof e==="string")return e;return""}function Yr(e,t){let n=e.split(Fo).filter(Boolean),o=t.split(Fo).filter(Boolean);while(n.length&&o.length){let r=n.shift(),s=o.shift(),i=parseInt(r,10),l=parseInt(s,10),d=[i,l].sort();if(isNaN(d[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(d[1]))return isNaN(i)?-1:1;if(i>l)return 1;if(l>i)return-1}return n.length-o.length}var vn={alphanumeric:_a,alphanumericCaseSensitive:Ra,text:Fa,textCaseSensitive:Ma,datetime:Na,basic:ka},Da={getInitialState:(e)=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:(e)=>({onSortingChange:yt("sorting",e),isMultiSortEvent:(t)=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),o=!1;for(let r of n){let s=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]")return vn.datetime;if(typeof s==="string"){if(o=!0,s.split(Fo).length>1)return vn.alphanumeric}}if(o)return vn.text;return vn.basic},e.getAutoSortDir=()=>{let n=t.getFilteredRowModel().flatRows[0];if(typeof(n==null?void 0:n.getValue(e.id))==="string")return"asc";return"desc"},e.getSortingFn=()=>{var n,o;if(!e)throw Error();return jn(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(o=t.options.sortingFns)==null?void 0:o[e.columnDef.sortingFn])!=null?n:vn[e.columnDef.sortingFn]},e.toggleSorting=(n,o)=>{let r=e.getNextSortingOrder(),s=typeof n<"u"&&n!==null;t.setSorting((i)=>{let l=i==null?void 0:i.find((p)=>p.id===e.id),d=i==null?void 0:i.findIndex((p)=>p.id===e.id),f=[],u,h=s?n:r==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&o)if(l)u="toggle";else u="add";else if(i!=null&&i.length&&d!==i.length-1)u="replace";else if(l)u="toggle";else u="replace";if(u==="toggle"){if(!s){if(!r)u="remove"}}if(u==="add"){var c;f=[...i,{id:e.id,desc:h}],f.splice(0,f.length-((c=t.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else if(u==="toggle")f=i.map((p)=>{if(p.id===e.id)return{...p,desc:h};return p});else if(u==="remove")f=i.filter((p)=>p.id!==e.id);else f=[{id:e.id,desc:h}];return f})},e.getFirstSortDir=()=>{var n,o;return((n=(o=e.columnDef.sortDescFirst)!=null?o:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=(n)=>{var o,r;let s=e.getFirstSortDir(),i=e.getIsSorted();if(!i)return s;if(i!==s&&((o=t.options.enableSortingRemoval)!=null?o:!0)&&(n?(r=t.options.enableMultiRemove)!=null?r:!0:!0))return!1;return i==="desc"?"asc":"desc"},e.getCanSort=()=>{var n,o;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((o=t.options.enableSorting)!=null?o:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,o;return(n=(o=e.columnDef.enableMultiSort)!=null?o:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;let o=(n=t.getState().sorting)==null?void 0:n.find((r)=>r.id===e.id);return!o?!1:o.desc?"desc":"asc"},e.getSortIndex=()=>{var n,o;return(n=(o=t.getState().sorting)==null?void 0:o.findIndex((r)=>r.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting((n)=>n!=null&&n.length?n.filter((o)=>o.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return(o)=>{if(!n)return;o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(o):!1)}}},createTable:(e)=>{e.setSorting=(t)=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=(t)=>{var n,o;e.setSorting(t?[]:(n=(o=e.initialState)==null?void 0:o.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>{if(!e._getSortedRowModel&&e.options.getSortedRowModel)e._getSortedRowModel=e.options.getSortedRowModel(e);if(e.options.manualSorting||!e._getSortedRowModel)return e.getPreSortedRowModel();return e._getSortedRowModel()}}},Ta=[Ki,ga,da,ua,Qi,Xi,ha,va,Da,ia,wa,xa,ya,ba,fa];function es(e){var t,n;let o=[...Ta,...(t=e._features)!=null?t:[]],r={_features:o},s=r._features.reduce((c,p)=>Object.assign(c,p.getDefaultOptions==null?void 0:p.getDefaultOptions(r)),{}),i=(c)=>{if(r.options.mergeOptions)return r.options.mergeOptions(s,c);return{...s,...c}},d={...{},...(n=e.initialState)!=null?n:{}};r._features.forEach((c)=>{var p;d=(p=c.getInitialState==null?void 0:c.getInitialState(d))!=null?p:d});let f=[],u=!1,h={_features:o,options:{...s,...e},initialState:d,_queue:(c)=>{if(f.push(c),!u)u=!0,Promise.resolve().then(()=>{while(f.length)f.shift()();u=!1}).catch((p)=>setTimeout(()=>{throw p}))},reset:()=>{r.setState(r.initialState)},setOptions:(c)=>{let p=Ht(c,r.options);r.options=i(p)},getState:()=>r.options.state,setState:(c)=>{r.options.onStateChange==null||r.options.onStateChange(c)},_getRowId:(c,p,m)=>{var v;return(v=r.options.getRowId==null?void 0:r.options.getRowId(c,p,m))!=null?v:`${m?[m.id,p].join("."):p}`},getCoreRowModel:()=>{if(!r._getCoreRowModel)r._getCoreRowModel=r.options.getCoreRowModel(r);return r._getCoreRowModel()},getRowModel:()=>r.getPaginationRowModel(),getRow:(c,p)=>{let m=(p?r.getPrePaginationRowModel():r.getRowModel()).rowsById[c];if(!m){if(m=r.getCoreRowModel().rowsById[c],!m)throw Error()}return m},_getDefaultColumnDef:he(()=>[r.options.defaultColumn],(c)=>{var p;return c=(p=c)!=null?p:{},{header:(m)=>{let v=m.header.column.columnDef;if(v.accessorKey)return v.accessorKey;if(v.accessorFn)return v.id;return null},cell:(m)=>{var v,C;return(v=(C=m.renderValue())==null||C.toString==null?void 0:C.toString())!=null?v:null},...r._features.reduce((m,v)=>Object.assign(m,v.getDefaultColumnDef==null?void 0:v.getDefaultColumnDef()),{}),...c}},ye(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>r.options.columns,getAllColumns:he(()=>[r._getColumnDefs()],(c)=>{let p=function(m,v,C){if(C===void 0)C=0;return m.map((b)=>{let k=Ui(r,b,C,v),D=b;return k.columns=D.columns?p(D.columns,k,C+1):[],k})};return p(c)},ye(e,"debugColumns","getAllColumns")),getAllFlatColumns:he(()=>[r.getAllColumns()],(c)=>c.flatMap((p)=>p.getFlatColumns()),ye(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:he(()=>[r.getAllFlatColumns()],(c)=>c.reduce((p,m)=>(p[m.id]=m,p),{}),ye(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:he(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(c,p)=>{let m=c.flatMap((v)=>v.getLeafColumns());return p(m)},ye(e,"debugColumns","getAllLeafColumns")),getColumn:(c)=>r._getAllFlatColumnsById()[c]};Object.assign(r,h);for(let c=0;c<r._features.length;c++){let p=r._features[c];p==null||p.createTable==null||p.createTable(r)}return r}function ts(){return(e)=>he(()=>[e.options.data],(t)=>{let n={rows:[],flatRows:[],rowsById:{}},o=function(r,s,i){if(s===void 0)s=0;let l=[];for(let f=0;f<r.length;f++){let u=Wi(e,e._getRowId(r[f],f,i),r[f],f,s,void 0,i==null?void 0:i.id);if(n.flatRows.push(u),n.rowsById[u.id]=u,l.push(u),e.options.getSubRows){var d;if(u.originalSubRows=e.options.getSubRows(r[f],f),(d=u.originalSubRows)!=null&&d.length)u.subRows=o(u.originalSubRows,s+1,u)}}return l};return n.rows=o(t),n},ye(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function ns(e,t){return!e?null:Pa(e)?ne(e,t):e}function Pa(e){return Aa(e)||typeof e==="function"||$a(e)}function Aa(e){return typeof e==="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function $a(e){return typeof e==="object"&&typeof e.$$typeof==="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function rs(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=w(()=>({current:es(t)})),[o,r]=w(()=>n.current.initialState);return n.current.setOptions((s)=>({...s,...e,state:{...o,...e.state},onStateChange:(i)=>{r(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}L();function Oa({item:e,renderItem:t,active:n,dragState:o,isSelected:r,columnSizing:s,virtualRow:i,measureElement:l,isExternalDragging:d,externalOverFolderId:f,setExternalOverFolderId:u,resetExternalDragState:h,onExternalDrop:c}){let p=o?.draggedIds.has(e.id),m=o?.isActive,{ref:v,isDropTarget:C}=ln({id:`reorder-before-${e.id}`,data:{type:"reorder",item:e,position:"before"},disabled:!n||p||!m}),{ref:b,isDropTarget:k}=ln({id:`reorder-after-${e.id}`,data:{type:"reorder",item:e,position:"after"},disabled:!n||p||!m}),{ref:D,isDropTarget:P}=ln({id:`browser:${e.id}`,data:{type:e.type,id:e.id,item:e},disabled:!m}),le=Q(()=>{if(!o?.isActive)return!1;if(o.draggedIds.has(e.id))return!1;if(e.type==="folder")return!0;if(e.type==="file"||e.type==="version_stack")return o.isSingleFile;return!1},[o,e.id,e.type]),te=d&&f===e.id,ue=P&&le||te;return g("div",{ref:(V)=>{D(V),l(V)},"data-index":i.index,onDragEnter:d&&e.type==="folder"?()=>{u?.(e.id)}:void 0,onDragLeave:d&&e.type==="folder"?(V)=>{if(!V.currentTarget.contains(V.relatedTarget))u?.(null)}:void 0,onDragOver:d&&e.type==="folder"?(V)=>{V.preventDefault()}:void 0,onDrop:d&&e.type==="folder"?async(V)=>{V.preventDefault(),V.stopPropagation(),h?.();let A=await rc(V.dataTransfer);c?.(A,e.id)}:void 0,className:B("group border-b border-border transition-colors hover:bg-primary/20 absolute top-0 left-0 w-full flex flex-col outline-none focus:outline-none focus-visible:outline-none",r&&"bg-primary/10",ue&&"bg-primary/10",C&&"border-t-2 border-t-primary",k&&"border-b-2 border-b-primary"),style:{transform:`translateY(${i.start}px)`},children:[a("div",{ref:v,className:"p-0 m-0 leading-none bg-transparent pointer-events-auto h-[2px] w-full"}),t(e,s),a("div",{ref:b,className:"p-0 m-0 leading-none bg-transparent pointer-events-auto h-[2px] w-full"})]})}function ss({folders:e,files:t,totalFolders:n,totalFiles:o,selectedItem:r,selectedIds:s,displayedFields:i,renderItem:l,foldersExpanded:d,setFoldersExpanded:f,filesExpanded:u,setFilesExpanded:h,hasNextFoldersPage:c,hasNextFilesPage:p,isFetchingNextFoldersPage:m,isFetchingNextFilesPage:v,fetchNextFoldersPage:C,fetchNextFilesPage:b,formatCount:k,formatSize:D,totalFoldersSize:P,totalFilesSize:le,handleEmptyAreaClick:te,dragState:ue,sort:V,isExternalDragging:A,externalOverFolderId:Ee,setExternalOverFolderId:Me,resetExternalDragState:ce,onExternalDrop:se}){let[O,ae]=w({}),ze=Q(()=>{let _e=[{id:"name",header:"Name",size:300,minSize:150},{id:"size",header:"Size",size:100,minSize:80},{id:"modified",header:"Modified",size:200,minSize:150}];return i.forEach((H)=>{let E=H.config?.type?dl[H.config.type]:null;_e.push({id:H.id,header:()=>g("div",{className:"flex items-center gap-1.5 truncate",children:[E&&a(E,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a("span",{className:"truncate",children:H.config?.name||H.id})]}),size:150,minSize:100})}),_e},[i]),Te=rs({data:[],columns:ze,columnResizeMode:"onChange",getCoreRowModel:ts(),state:{columnSizing:O},onColumnSizingChange:ae}),_=Q(()=>{let _e=[],H=n??e.length;if(H>0){if(_e.push({type:"header",kind:"folder"}),d)for(let me=0;me<H;me++)_e.push({type:"item",kind:"folder",index:me})}let E=o??t.length;if(E>0){if(_e.push({type:"header",kind:"file"}),u)for(let me=0;me<E;me++)_e.push({type:"item",kind:"file",index:me})}return _e},[d,u,e.length,t.length,n,o]),Pe=M(null),Ze=Tn({count:_.length,getScrollElement:()=>Pe.current,estimateSize:()=>40,getItemKey:G((_e)=>{let H=_[_e];if(!H)return _e;if(H.type==="header")return`header-${H.kind}`;return(H.kind==="folder"?e[H.index]:t[H.index])?.id||`item-${H.kind}-${H.index}`},[_,e,t]),overscan:10,paddingEnd:240}),ge=Ze.getVirtualItems();return S(()=>{if(ge.length===0)return;for(let _e of ge){let H=_[_e.index];if(H?.type==="item"){let E=H.kind==="folder"?!e[H.index]:!t[H.index],me=H.kind==="folder"?H.index>=e.length-15:H.index>=t.length-15;if(H.kind==="folder"&&c&&!m){if(E||me){C();break}}else if(H.kind==="file"&&p&&!v){if(E||me){b();break}}}}},[ge,_,e.length,t.length,c,p,m,v,C,b]),a("div",{ref:Pe,className:"flex-1 overflow-auto",onClick:te,children:g("div",{className:"w-full relative",style:{width:Te.getTotalSize(),minWidth:"100%"},children:[a("div",{className:"sticky top-0 z-30 bg-background border-b border-border flex flex-col",children:Te.getHeaderGroups().map((_e)=>a("div",{className:"bg-muted/50 whitespace-nowrap flex",children:_e.headers.map((H)=>g("div",{className:B("px-4 py-2 text-left text-xs font-medium text-muted-foreground relative border-r flex items-center",H.id==="name"&&"sticky left-0 z-40 bg-muted"),style:{width:H.getSize()},children:[H.isPlaceholder?null:ns(H.column.columnDef.header,H.getContext()),a("div",{onMouseDown:H.getResizeHandler(),onTouchStart:H.getResizeHandler(),className:B("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize user-select-none touch-none z-50 hover:bg-primary/50 transition-colors",H.column.getIsResizing()&&"bg-primary w-1")})]},H.id))},_e.id))}),a("div",{className:"relative",style:{height:`${Ze.getTotalSize()}px`},children:ge.map((_e)=>{let H=_[_e.index];if(H.type==="header"){let me=H.kind==="folder",at=me?n??e.length:o??t.length,T=me?P??-1:le??-1,Oe=T>-1,Je=me?d:u,lt=me?f:h,J=me?e.length>0:t.length>0;return g("div",{ref:Ze.measureElement,"data-index":_e.index,className:"absolute top-0 left-0 w-full border-b border-border hover:bg-muted/50 transition-colors cursor-pointer group flex bg-card z-20",style:{transform:`translateY(${_e.start}px)`},onClick:(q)=>{q.stopPropagation(),lt(!Je)},children:[g("div",{className:"px-4 py-2 sticky left-0 z-10 bg-card border-r flex items-center gap-2",style:{width:O?.name||300,minWidth:O?.name||300},children:[a(Sr,{checked:J&&(me?e.every((q)=>s.has(q.id)):t.every((q)=>s.has(q.id))),onCheckedChange:()=>{},onClick:(q)=>q.stopPropagation(),className:"h-4 w-4"}),a("div",{className:"p-1 rounded hover:bg-muted",children:Je?a(Be,{className:"h-4 w-4 text-muted-foreground"}):a(jt,{className:"h-4 w-4 text-muted-foreground"})}),g("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:[k(at,!me),Oe?` • ${D(T)}`:""]})]}),a("div",{className:"flex-1 bg-card"})]},`header-${H.kind}`)}let E=H.kind==="folder"?e[H.index]:t[H.index];if(!E)return a("div",{ref:Ze.measureElement,className:"absolute top-0 left-0 w-full border-b border-border px-4 py-3 flex items-center animate-pulse",style:{transform:`translateY(${_e.start}px)`},children:a("div",{className:"h-4 bg-muted rounded w-1/4"})},`skeleton-${H.kind}-${H.index}`);return a(Oa,{item:E,renderItem:l,active:V?.field==="custom",dragState:ue,isSelected:r?.id===E.id,columnSizing:O,virtualRow:_e,measureElement:Ze.measureElement,isExternalDragging:A,externalOverFolderId:Ee,setExternalOverFolderId:Me,resetExternalDragState:ce,onExternalDrop:se},E.id)})})]})})}L();L();var Ct={SYSTEM:"system",TEAM:"team",PROJECT:"project"},za={[Ct.SYSTEM]:Pn,[Ct.TEAM]:Pn,[Ct.PROJECT]:Ca};function Va({field:e,index:t,isSelected:n,onSelect:o,isSortable:r}){let{ref:s,handleRef:i}=Vl({id:e.id,index:t,disabled:!r}),l=e.config?.type?dl[e.config.type]:null;return g("div",{ref:s,className:B("flex items-center gap-2 p-2 rounded-md cursor-pointer hover:bg-muted/50",n&&"bg-muted"),onClick:()=>o(e),children:[r&&a("div",{ref:i,className:"cursor-grab",children:a(ki,{className:"h-4 w-4 text-muted-foreground"})}),!r&&a("div",{className:"w-4"})," ",l&&a(l,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.config?.autofillSource===Wr.CONTENT&&a($n,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.config?.autofillSource===Wr.CREATION_CONTEXT&&a($t,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a("div",{className:"flex-1 text-sm font-medium truncate",children:e.config?.name})]})}function is({projectId:e,open:t,onOpenChange:n}){let{fields:o,updateFields:r}=cn(),[s,i]=w(Ct.PROJECT),[l,d]=w(null),[f,u]=w(!1),h=ie();S(()=>{if(t)h.invalidateQueries({queryKey:["fields",e]})},[t,e,h]);let[c,p]=w(""),[m,v]=w({}),[C,b]=w(Wr.NONE),[k,D]=w(""),[P,le]=w(""),[te,ue]=w(""),[V,A]=w(Wr.NONE),[Ee,Me]=w(""),[ce,se]=w([]),O=R.api.projects[":projectId"].fields.order.$patch,{mutate:ae}=ee({mutationFn:async(N)=>{if(!(await O(N)).ok)throw Error(ch());return null}}),ze=R.api.projects[":projectId"].fields.$post,{mutate:Te}=ee({mutationFn:async(N)=>{let x=await ze(N);if(!x.ok)throw Error(ah());return await x.json()},onSuccess:(N)=>{let x={...N,visible:!0};r([...o,x]),u(!1),d(N.id),me(N),j.success(cC())}}),_=R.api.fields[":fieldId"].$put,{mutate:Pe}=ee({mutationFn:async(N)=>{let x=await _(N);if(!x.ok)throw Error(qc());return await x.json()},onSuccess:(N)=>{let x=o.map((I)=>I.id===N.id?{...I,...N}:I);r(x),j.success(mC())}}),Ze=R.api.fields[":fieldId"].$delete,{mutate:ge}=ee({mutationFn:async(N)=>{if(!(await Ze(N)).ok)throw Error(Dx());return null},onSuccess:(N,x)=>{let I=o.filter((oe)=>oe.id!==x.param.fieldId);r(I),d(null),j.success(uC())}}),_e=Q(()=>{let N=Array.from(new Set(o.map((x)=>(x.scope||Ct.PROJECT).toLowerCase())));if(!N.includes(Ct.PROJECT))N.push(Ct.PROJECT);return N.map((x)=>({id:x,label:x===Ct.SYSTEM?Tx():x===Ct.TEAM?FM():x===Ct.PROJECT?vE():x.charAt(0).toUpperCase()+x.slice(1),icon:za[x]||Pn}))},[o]),H=Q(()=>o.filter((N)=>(N.scope||Ct.PROJECT).toLowerCase()===s),[o,s]),E=Q(()=>o.find((N)=>N.id===l),[o,l]),me=(N)=>{if(N)p(N.config?.name||""),v(N.config||{}),b(N.config?.autofillSource??Wr.NONE),D(N.description||"");else p(""),v({}),b(Wr.NONE),D("")},at=(N)=>{u(!1),d(N.id),me(N)},T=()=>{u(!0),d(null),le(""),ue(""),A(Wr.NONE),Me(""),se([])},Oe=(N)=>{if(N.canceled)return;let{source:x}=N.operation;if(!Lo(x))return;let{initialIndex:I,index:oe}=x;if(I===oe)return;let Ae=$d(o,H,I,oe);r(Ae),ae({param:{projectId:e},json:Ae.map((ut)=>({fieldId:ut.id,visible:ut.visible||!1}))})},Je=()=>{if(!P||!te)return;let N=te===nn.select?{select:{options:ce}}:te===nn.selectMulti?{selectMulti:{options:ce}}:{};Te({param:{projectId:e},json:{config:{name:P,type:te,autofillSource:V,...N},label:P,scope:s===Ct.PROJECT?void 0:s,description:Ee}})},lt=()=>{if(!E)return;Pe({param:{fieldId:E.id},json:{config:{...E.config,...m,name:c,autofillSource:C},description:k}})},J=()=>{if(!E)return;if(confirm(Gw()))ge({param:{fieldId:E.id}})},q=()=>{if(f)return g("div",{className:"space-y-4",children:[g("div",{className:"space-y-2",children:[a(fe,{children:dh()}),a(re,{value:P,onChange:(x)=>le(x.target.value),placeholder:dC()})]}),g("div",{className:"space-y-2",children:[a(fe,{children:fh()}),g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",className:"w-full justify-between",children:[te?a("span",{className:"capitalize",children:te.replace(/_/g," ")}):a("span",{className:"text-muted-foreground",children:rg()}),a(Be,{className:"h-4 w-4 opacity-50"})]})}),a(Fe,{className:"max-h-60 overflow-y-auto",children:Object.values(nn).map((x)=>a(de,{onClick:()=>{ue(x),se([])},className:"capitalize",children:x.replace(/_/g," ")},x))})]})]}),g("div",{className:"space-y-2",children:[a(fe,{children:zc()}),a(re,{value:Ee,onChange:(x)=>Me(x.target.value),placeholder:dp()})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center gap-1",children:[a(fe,{children:lp()}),a(yu,{})]}),g(os,{type:"single",value:V,onValueChange:(x)=>{if(x)A(x)},className:"w-full grid grid-cols-3 border rounded-md p-1 gap-1",children:[a(Zr,{value:Wr.NONE,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:_d()}),a(Zr,{value:Wr.CONTENT,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:gd()}),a(Zr,{value:Wr.CREATION_CONTEXT,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:Ad()})]})]}),(te===nn.select||te===nn.selectMulti)&&g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a(fe,{className:"text-sm font-medium",children:Ip()}),g(F,{variant:"ghost",size:"sm",onClick:()=>{let x={id:As(),displayName:xp(),color:Ia(ce)};se([...ce,x])},children:[a(Re,{className:"h-4 w-4 mr-2"})," ",op()]})]}),a("div",{className:"space-y-2 max-h-40 overflow-y-auto pr-1",children:ce.map((x,I)=>g("div",{className:"flex items-center gap-2",children:[a(re,{value:x.displayName,onChange:(oe)=>{let Ae=[...ce];Ae[I]={...x,displayName:oe.target.value},se(Ae)},placeholder:Nh()}),g(bt,{children:[a(wt,{asChild:!0,children:a("button",{type:"button",className:"w-6 h-6 rounded-full border shrink-0 cursor-pointer focus:outline-none hover:scale-105 transition-transform",style:{backgroundColor:Sa[x.color||""]?.hex||x.color||"#808080"}})}),a(Et,{className:"p-2 w-auto",align:"end",children:a("div",{className:"flex gap-1",children:ul.map((oe)=>a("button",{type:"button",className:"w-5 h-5 rounded-full border cursor-pointer hover:scale-110 transition-transform",style:{backgroundColor:Sa[oe]?.hex||oe},onClick:()=>{let Ae=[...ce];Ae[I]={...x,color:oe},se(Ae)}},oe))})})]}),a(F,{variant:"ghost",size:"icon",onClick:()=>{se(ce.filter((oe,Ae)=>Ae!==I))},children:a(Ge,{className:"h-4 w-4"})})]},x.id||I))})]})]});if(!E)return a("div",{className:"text-muted-foreground text-sm",children:iR()});let N=E.readOnly;return g("div",{className:"space-y-6",children:[g("div",{className:"flex items-center justify-between",children:[a(re,{value:c,onChange:(x)=>p(x.target.value),disabled:N,className:"font-medium"}),N&&a(Dn,{className:"h-4 w-4 text-muted-foreground ml-2"})]}),g("div",{className:"text-sm text-muted-foreground",children:[TO()," ",a("span",{className:"capitalize",children:E.config?.type?.replace(/_/g," ")})]}),g("div",{className:"space-y-2",children:[a(fe,{children:zc()}),a(re,{value:k,onChange:(x)=>D(x.target.value),placeholder:dp(),disabled:N})]}),g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center gap-1",children:[a(fe,{children:lp()}),a(yu,{})]}),g(os,{type:"single",value:f?V:C,onValueChange:(x)=>{if(x)if(f)A(x);else b(x)},disabled:N,className:"w-full grid grid-cols-3 border rounded-md p-1 gap-1",children:[a(Zr,{value:Wr.NONE,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:_d()}),a(Zr,{value:Wr.CONTENT,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:gd()}),a(Zr,{value:Wr.CREATION_CONTEXT,className:"text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium",children:Ad()})]})]}),(E.config?.type==="select"||E.config?.type==="selectMulti")&&g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center justify-between",children:[a("label",{className:"text-sm font-medium",children:Ip()}),g(F,{variant:"ghost",size:"sm",onClick:()=>{let x=(E.config?.type==="select"?m.select?.options:m.selectMulti?.options)||[],I={id:As(),displayName:xp(),color:Ia(x)},oe=[...x,I];v({...m,[E.config?.type==="select"?"select":"selectMulti"]:{options:oe}})},children:[a(Re,{className:"h-4 w-4 mr-2"})," ",op()]})]}),a("div",{className:"space-y-2",children:((E.config?.type==="select"?m.select?.options:m.selectMulti?.options)||[]).map((x,I)=>g("div",{className:"flex items-center gap-2",children:[a(re,{value:x.displayName,onChange:(oe)=>{let Ae=[...(E.config?.type==="select"?m.select?.options:m.selectMulti?.options)||[]];Ae[I]={...x,displayName:oe.target.value},v({...m,[E.config?.type==="select"?"select":"selectMulti"]:{options:Ae}})}}),g(bt,{children:[a(wt,{asChild:!0,children:a("button",{type:"button",className:"w-6 h-6 rounded-full border shrink-0 cursor-pointer focus:outline-none hover:scale-105 transition-transform",style:{backgroundColor:Sa[x.color||""]?.hex||x.color||"#808080"},disabled:N})}),!N&&a(Et,{className:"p-2 w-auto",align:"end",children:a("div",{className:"flex gap-1",children:ul.map((oe)=>a("button",{type:"button",className:"w-5 h-5 rounded-full border cursor-pointer hover:scale-110 transition-transform",style:{backgroundColor:Sa[oe]?.hex||oe},onClick:()=>{let Ae=[...(E.config?.type==="select"?m.select?.options:m.selectMulti?.options)||[]];Ae[I]={...x,color:oe},v({...m,[E.config?.type==="select"?"select":"selectMulti"]:{options:Ae}})}},oe))})})]}),a(F,{variant:"ghost",size:"icon",onClick:()=>{let oe=((E.config?.type==="select"?m.select?.options:m.selectMulti?.options)||[]).filter((Ae,ut)=>ut!==I);v({...m,[E.config?.type==="select"?"select":"selectMulti"]:{options:oe}})},children:a(Ge,{className:"h-4 w-4"})})]},I))})]}),!N&&E.scope?.toLowerCase()!=="system"&&a("div",{className:"pt-4 flex justify-between",children:a(F,{variant:"outline",onClick:J,className:"text-destructive hover:bg-destructive/10",children:DE()})})]})};return a(Se,{open:t,onOpenChange:n,children:g(xe,{className:"!max-w-[50rem] h-[70vh] flex flex-col p-0 gap-0",children:[a("div",{className:"p-4 border-b flex items-center justify-between",children:a(Ce,{children:yh()})}),g("div",{className:"flex overflow-hidden h-full",children:[g("div",{className:"w-60 border-r bg-muted/30 p-4 space-y-1",children:[a("div",{className:"font-semibold mb-4 px-2",children:eS()}),_e.map((N)=>g("button",{onClick:()=>{i(N.id),u(!1),d(null)},className:B("w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors hover:bg-muted text-left",s===N.id&&"bg-muted text-foreground"),children:[a(N.icon,{className:"h-4 w-4"}),N.label]},N.id))]}),g("div",{className:"w-64 border-r flex flex-col",children:[g("div",{className:"p-4 border-b flex items-center justify-between bg-background h-[57px]",children:[a("span",{className:"font-medium text-sm",children:_e.find((N)=>N.id===s)?.label}),s===Ct.PROJECT&&g(F,{size:"sm",variant:"outline",className:"h-8",onClick:T,children:[XI()," ",a(Re,{className:"ml-1 h-3 w-3"})]})]}),g("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[a(Eo,{sensors:[Xn.configure({activationConstraints:[new an.Distance({value:8})]}),Os],onDragEnd:Oe,children:H.map((N,x)=>a(Va,{field:N,index:x,isSelected:l===N.id,onSelect:at,isSortable:!0},N.id))}),H.length===0&&a("div",{className:"text-center text-muted-foreground text-sm py-8",children:uT()})]})]}),g("div",{className:"flex-1 bg-background flex flex-col",children:[a("div",{className:"flex-1 overflow-y-auto p-6",children:q()}),(f||E&&!E.readOnly)&&g("div",{className:"p-4 border-t flex justify-end gap-2 bg-muted/10",children:[a(F,{variant:"ghost",onClick:()=>{if(u(!1),l&&E)me(E)},children:Ve()}),a(F,{onClick:f?Je:lt,children:wo()})]})]})]})]})})}L();function Do({value:e,onChange:t,debounce:n=500,...o}){let[r,s]=w(e);return S(()=>{s(e)},[e]),S(()=>{let i=setTimeout(()=>{if(r!==e)t(r)},n);return()=>clearTimeout(i)},[r,n,t,e]),a(re,{...o,value:r,onChange:(i)=>s(i.target.value)})}L();function Hn({fields:e,conditions:t,onChange:n,className:o,excludeFields:r,hidePrefix:s}){let i=ri(),{members:l,fetchMembers:d}=An();S(()=>{if(i)d(i)},[i,d]);let f=Q(()=>l.map((m)=>({id:m.id,displayName:m.name,color:"system"})),[l]),u=Q(()=>{let m=[{id:"name",label:Xc(),type:"text"},{id:"createdAt",label:lC(),type:"date"},{id:"updatedAt",label:pC(),type:"date"},{id:"sizeByte",label:fC(),type:"number"}],v=e.map((C)=>({id:C.id,label:C.config?.name||C.description||Yn(),type:La(C),options:C.config?.type==="user"||C.config?.type==="userMulti"?f:C.config?.select?.options||C.config?.selectMulti?.options,config:C.config}));return[...m,...v].filter((C)=>!r?.includes(C.id))},[e,f,r]),h=()=>{n([...t,{field:u[0]?.id||"name",operator:"eq",value:""}])},c=(m)=>{let v=[...t];v.splice(m,1),n(v)},p=(m,v,C)=>{let b=[...t];if(b[m]={...b[m],[v]:C},v==="field"){let k=u.find((D)=>D.id===C);if(k)b[m].operator=ja(k.type),b[m].value=""}if(v==="operator"){let k=u.find((D)=>D.id===b[m].field);if(k&&(k.type==="select"||k.type==="selectMulti")){let D=t[m].operator,P=C,le=To(k.type,D),te=To(k.type,P);if(le&&!te){let ue=Array.isArray(b[m].value)?b[m].value:[];b[m].value=ue[0]||""}else if(!le&&te){let ue=b[m].value;b[m].value=ue?[ue]:[]}}}n(b)};return g("div",{className:B("p-2 space-y-4 min-w-[100px]",o),children:[t.map((m,v)=>g("div",{className:"flex items-center gap-2",children:[!s&&a("div",{className:"w-16 text-sm text-muted-foreground font-medium text-right",children:v===0?EC():_C()}),g("div",{className:"flex-1 flex items-center gap-2",children:[g(Xe,{value:m.field,onValueChange:(C)=>p(v,"field",C),children:[a(tt,{className:"w-[180px]",children:a(et,{placeholder:sR()})}),a(rt,{children:u.map((C)=>a(be,{value:C.id,children:C.label},C.id))})]}),g(Xe,{value:m.operator,onValueChange:(C)=>p(v,"operator",C),children:[a(tt,{className:"w-[140px]",children:a(et,{placeholder:LT()})}),a(rt,{children:Ha(u.find((C)=>C.id===m.field)||{id:"",label:"",type:"text"}).map((C)=>a(be,{value:C.value,children:C.label},C.value))})]}),a("div",{className:"flex-1",children:m.operator!=="isEmpty"&&m.operator!=="isNotEmpty"&&a(Ga,{field:u.find((C)=>C.id===m.field),operator:m.operator,value:m.value,onChange:(C)=>p(v,"value",C)})}),a(F,{variant:"ghost",size:"icon",onClick:()=>c(v),children:a(Ue,{className:"h-4 w-4"})})]})]},v)),a("div",{className:"flex items-center gap-2",children:a(F,{variant:"ghost",className:"text-muted-foreground hover:text-foreground",onClick:h,children:rv()})})]})}function La(e){if(e.config?.type==="select"||e.config?.type==="user")return"select";if(e.config?.type==="selectMulti"||e.config?.type==="userMulti")return"selectMulti";if(e.config?.type==="number")return"number";if(e.config?.type==="date")return"date";if(e.config?.type==="rating")return"rating";if(e.config?.type==="toggle")return"toggle";return"text"}function ja(e){switch(e){case"selectMulti":return"hasAny";case"number":case"rating":case"date":return"eq";default:return"eq"}}function Ha(e){let t=e.type;if(e.id==="name")return[{value:"eq",label:Qc()},{value:"neq",label:Sp()},{value:"contains",label:ZT()},{value:"notContains",label:BT()},{value:"isEmpty",label:Gc()},{value:"isNotEmpty",label:Vc()}];switch(t){case"text":return[{value:"eq",label:Qc()},{value:"neq",label:Sp()},{value:"isEmpty",label:Gc()},{value:"isNotEmpty",label:Vc()}];case"number":case"rating":return[{value:"eq",label:"="},{value:"neq",label:"≠"},{value:"gt",label:">"},{value:"lt",label:"<"},{value:"lte",label:"≤"},{value:"gte",label:"≥"},{value:"isEmpty",label:Gc()},{value:"isNotEmpty",label:Vc()}];case"select":return[{value:"eq",label:Qc()},{value:"neq",label:Sp()},{value:"in",label:$T()},{value:"notIn",label:GT()},{value:"isEmpty",label:Gc()},{value:"isNotEmpty",label:Vc()}];case"selectMulti":return[{value:"hasAny",label:zT()},{value:"hasAll",label:UT()},{value:"eq",label:QT()},{value:"hasNone",label:jT()},{value:"isEmpty",label:Gc()},{value:"isNotEmpty",label:Vc()}];case"date":return[{value:"eq",label:Qc()},{value:"isWithin",label:WT()},{value:"lt",label:HT()},{value:"gt",label:qT()},{value:"lte",label:KT()},{value:"gte",label:VT()},{value:"neq",label:Sp()},{value:"isEmpty",label:Gc()},{value:"isNotEmpty",label:Vc()}];case"toggle":return[{value:"eq",label:Qc()}];default:return[{value:"eq",label:Qc()}]}}function To(e,t){if(e==="select")return t==="in"||t==="notIn";if(e==="selectMulti")return t!=="eq";return!1}function Ba({options:e,selected:t,onChange:n}){let o=e.filter((s)=>t.includes(s.id)),r=(s)=>{let i;if(t.includes(s))i=t.filter((l)=>l!==s);else i=[...t,s];n(i)};return g(bt,{children:[a(wt,{asChild:!0,children:g("button",{type:"button",className:"flex min-h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1.5 text-sm shadow-xs hover:bg-accent/50 focus:outline-hidden focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 text-left",children:[a("div",{className:"flex flex-wrap gap-1 items-center max-w-[90%]",children:o.length===0?a("span",{className:"text-muted-foreground",children:fR()}):o.map((s)=>a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border border-transparent whitespace-nowrap h-[20px]",style:ui(s.color),children:s.displayName},s.id))}),a(Be,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),a(Et,{className:"w-64 p-1 bg-popover border border-border rounded-lg shadow-xl max-h-60 overflow-auto",align:"start",children:e.map((s)=>{let i=t.includes(s.id);return g("div",{onClick:()=>r(s.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between rounded-sm",children:[a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:ui(s.color),children:s.displayName}),i&&a(qe,{className:"w-4 h-4 text-primary"})]},s.id)})})]})}function Ga({field:e,operator:t,value:n,onChange:o}){if(!e)return a(re,{disabled:!0});if((e.type==="select"||e.type==="selectMulti")&&e.options){if(To(e.type,t)){let r=Array.isArray(n)?n:[];return a(Ba,{options:e.options,selected:r,onChange:(s)=>o(s)})}return g(Xe,{value:n,onValueChange:o,children:[a(tt,{children:a(et,{placeholder:dR()})}),a(rt,{children:e.options.map((r)=>a(be,{value:r.id,children:a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:ui(r.color),children:r.displayName})},r.id))})]})}if(e.type==="date"){let r=[{value:"today",label:SE()},{value:"yesterday",label:kE()},{value:"tomorrow",label:IE()},{value:"one week ago",label:xE()},{value:"one week from now",label:CE()},{value:"one month ago",label:wE()},{value:"one month from now",label:EE()}],s=r.some((i)=>i.value===n);return g("div",{className:"flex gap-2",children:[g(Xe,{value:s?n:"exact",onValueChange:(i)=>{if(i==="exact")o("");else o(i)},children:[a(tt,{className:"w-[140px]",children:a(et,{placeholder:TE()})}),g(rt,{children:[r.map((i)=>a(be,{value:i.value,children:i.label},i.value)),a(be,{value:"exact",children:kx()})]})]}),!s&&a(re,{type:"date",className:"flex-1",value:n,onChange:(i)=>o(i.target.value)})]})}if(e.type==="number")return a(Do,{type:"number",value:n,onChange:(r)=>o(Number(r))});if(e.type==="rating")return a(Gd,{value:Number(n)||0,config:e.config||{name:e.label,type:"rating"},onSave:o});if(e.type==="toggle")return g(Xe,{value:n===!0?"true":"false",onValueChange:(r)=>o(r==="true"),children:[a(tt,{children:a(et,{})}),g(rt,{children:[a(be,{value:"true",children:oO()}),a(be,{value:"false",children:sO()})]})]});return a(Do,{type:"text",placeholder:wx(),value:n,onChange:o})}L();function as({open:e,onOpenChange:t,teamId:n,projectId:o,assetId:r,fields:s,initialConditions:i,onApply:l}){let d=We(),f=ie(),u=Q(()=>{let T=i.find((Oe)=>Oe.field==="name"&&Oe.operator==="contains");return T?String(T.value):""},[i]),h=Q(()=>i.filter((T)=>!(T.field==="name"&&T.operator==="contains")),[i]),[c,p]=w(h),[m,v]=w(!0),[C,b]=w(u),[k,D]=w(u),[P,le]=w(!1),{data:te}=X({queryKey:["team-settings",n],queryFn:async()=>{let T=await R.api.teams[":teamId"].settings.$get({param:{teamId:n}});if(!T.ok)throw Error(Ms());return await T.json()},enabled:e}),ue=te?.semanticSearchEnabled??!1;S(()=>{if(e)b(u),D(u),p(h),le(!1);else b(""),D(""),p([]),le(!1)},[e,u,h]);let V=Q(()=>{let T=[...c],Oe=k;if(Oe.trim()&&!P)T.push({field:"name",operator:"contains",value:Oe.trim()});return T},[P,k,c]),A=Q(()=>k.trim()!==""||c.some((Oe)=>String(Oe.value||"").trim()!==""),[k,c]),{mutate:Ee,isPending:Me}=ee({mutationFn:async()=>{let T=k,Oe=T.trim();if(!Oe&&c.length>0){let lt=c[0];Oe=`${s.find((N)=>N.id===lt.field)?.config?.name||lt.field} ${lt.operator} ${lt.value}`}if(!Oe)Oe=Oy();let Je=await R.api.projects[":projectId"].collections.$post({param:{projectId:o},json:{name:Oe,filter:{sourceFolderId:r,searchFilter:{conditions:V,recursively:!0,query:T.trim(),isSemantic:P}}}});if(!Je.ok)throw Error(zx());return await Je.json()},onSuccess:(T)=>{f.invalidateQueries({queryKey:["collections",o]}),j.success(Zw()),t(!1),d({to:"/projects/$projectId/collections/$collectionId",params:{projectId:o,collectionId:T.id}})},onError:(T)=>{j.error(`Error: ${T.message}`)}}),{ref:ce,inView:se}=Vt(),{data:O,isLoading:ae,isFetchingNextPage:ze,fetchNextPage:Te,hasNextPage:_,error:Pe}=Tt({queryKey:["search-preview",n,r,V,P,k],queryFn:async({pageParam:T})=>{let Oe=k,Je=await R.api.folders[":folderId"].search.$post({param:{folderId:r},json:{assetType:void 0,conditions:V,recursively:!0,query:Oe.trim(),isSemantic:P,first:20,after:T}});if(!Je.ok){let lt=await Je.json().catch(()=>({}));throw Error(lt.message||ey())}return await Je.json()},enabled:e&&A,staleTime:500,retry:!1,initialPageParam:"",getNextPageParam:(T)=>T.pageInfo?.cursor||void 0});S(()=>{if(se&&_&&!ze)Te()},[se,_,ze,Te]);let Ze=Q(()=>O?.pages.flatMap((T)=>T.data)||[],[O]),ge=O?.pages[0]?.pageInfo?.total||0,_e=(T)=>{if(T===10001)return"10000+";return T.toString()},H=()=>{l(V),t(!1)},E=()=>{p([])},me=(T)=>{if(T.type==="folder")window.open(`/projects/${o}/folders/${T.id}`,"_blank","noopener,noreferrer");else{let Oe=T.versionStack?T.versionStack.id:T.id,Je=new URLSearchParams;if(T.startTime!==void 0&&T.startTime!==null&&T.startTime>0)Je.set("start",String(T.startTime));let lt=Je.toString()?`?${Je.toString()}`:"";window.open(`/projects/${o}/files/${Oe}${lt}`,"_blank","noopener,noreferrer")}},at=c.filter((T)=>T.value!=="").length;return a(Se,{open:e,onOpenChange:t,children:g(xe,{className:"sm:max-w-4xl lg:max-w-5xl p-0 gap-0 overflow-hidden bg-background border-border rounded-2xl shadow-2xl flex flex-col h-[85vh]",children:[a(ke,{className:"px-6 pt-3 pb-0 text-left",children:a(Ce,{className:"text-lg font-bold",children:Wk()})}),g("div",{className:"px-6 pb-6 pt-4 border-b border-border bg-muted/30 flex flex-col gap-3",children:[g("form",{onSubmit:(T)=>{T.preventDefault(),D(C.trim())},className:"flex flex-col gap-3 mt-2",children:[g("div",{className:"relative",children:[a(re,{value:C,onChange:(T)=>b(T.target.value),placeholder:P?Vk():Kk(),className:"w-full pl-4 pr-24 py-3 bg-background border-border rounded-xl text-sm h-12 focus-visible:ring-2 focus-visible:ring-primary/20 shadow-sm"}),C&&a("button",{type:"button",onClick:()=>{b(""),D("")},className:"absolute right-20 top-1/2 -translate-y-1/2 p-1 rounded-md text-muted-foreground hover:text-foreground transition-colors",children:a(Ge,{className:"w-4 h-4"})}),a("button",{type:"submit",className:"absolute right-1.5 top-1.5 bottom-1.5 px-4 bg-primary hover:bg-primary/90 text-primary-foreground text-xs font-semibold rounded-lg flex items-center justify-center transition-colors shadow-sm",children:Gk()})]}),g("div",{className:"flex items-center gap-3 py-1",children:[g("div",{className:"flex items-center gap-2 bg-background border border-border px-3 py-1.5 rounded-lg shadow-sm",children:[a(Ke,{id:"semantic-search-switch",checked:P,onCheckedChange:(T)=>{le(T),b(""),D(""),p([])},disabled:!ue}),a(fe,{htmlFor:"semantic-search-switch",className:B("text-xs font-semibold select-none cursor-pointer",!ue&&"opacity-50 cursor-not-allowed"),children:yR()})]}),!ue&&a("span",{className:"text-[10px] text-muted-foreground italic",children:bR()})]})]}),g("div",{className:"flex items-center justify-between py-1.5 px-1 mt-1 select-none",children:[g("div",{className:"flex items-center gap-2",children:[g("button",{type:"button",onClick:()=>v(!m),className:"flex items-center gap-2 py-1 px-1.5 rounded-lg hover:bg-accent/50 cursor-pointer transition-colors group text-left",children:[m?a(Ml,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground"}):a(Be,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground"}),a("span",{className:"text-xs font-semibold text-foreground/80",children:xC()})]}),at>0&&g("span",{className:"px-1.5 py-0.5 rounded-full text-[10px] font-mono font-bold bg-primary/10 text-primary border border-primary/20",children:[at," ",Xy()]})]}),at>0&&a("button",{type:"button",onClick:(T)=>{T.stopPropagation(),E()},className:"text-[11px] font-medium text-destructive hover:text-destructive/80 underline underline-offset-2 transition-colors",children:Nk()})]}),m&&a(Ie,{className:"mt-1 max-h-[28vh] rounded-xl border border-border bg-muted/40",children:a("div",{className:"p-4 flex flex-col gap-3 animate-in slide-in-from-top-1 duration-200",children:a(Hn,{fields:s,conditions:c,onChange:p,excludeFields:["name"],hidePrefix:!0,className:"p-0 bg-transparent space-y-2"})})})]}),a(Ie,{className:"flex-1 min-h-0 bg-background [&>div>div]:block!",children:g("div",{className:"p-4 md:p-5 min-w-0",children:[g("div",{className:"flex items-center justify-between mb-3 px-1",children:[a("span",{className:"text-[11px] font-bold uppercase tracking-wider text-muted-foreground/60 font-mono",children:eR()}),ae&&g("span",{className:"inline-flex items-center gap-1.5 text-xs text-primary",children:[a(K,{className:"h-3 w-3 animate-spin"}),P?wR():$1()]})]}),!A?g("div",{className:"border border-border rounded-xl py-20 text-center flex flex-col items-center justify-center bg-muted/20 px-4",children:[a(nr,{className:"w-10 h-10 text-muted-foreground/30 mb-2"}),a("h3",{className:"text-sm font-semibold text-foreground/80",children:wk()}),a("p",{className:"text-xs text-muted-foreground max-w-sm mt-1 mx-auto",children:kO()}),P&&a("p",{className:"text-xs text-muted-foreground/80 max-w-md mt-4 mx-auto border-t border-border/60 pt-3",children:vR()})]}):Pe?g("div",{className:"border border-border rounded-xl py-12 px-4 text-center flex flex-col items-center justify-center bg-muted/20",children:[a(er,{className:"w-10 h-10 text-destructive/50 mb-2"}),a("h3",{className:"text-sm font-semibold text-foreground/80",children:ey()}),a("p",{className:"text-xs text-muted-foreground max-w-sm mt-1 mx-auto",children:Pe.message.includes("Embedding agent not configured")?_x():Pe.message})]}):ae?a("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:Array.from({length:8}).map((T,Oe)=>g("div",{className:"flex flex-col rounded-xl border border-border bg-card p-2 space-y-2 animate-pulse",children:[a("div",{className:"aspect-square w-full rounded-lg bg-muted/60"}),g("div",{className:"p-1 space-y-1.5",children:[a("div",{className:"h-4 bg-muted/60 rounded w-3/4"}),a("div",{className:"h-3 bg-muted/40 rounded w-1/2"})]})]},Oe))}):Ze.length===0?g("div",{className:"border border-border rounded-xl py-12 px-4 text-center flex flex-col items-center justify-center bg-muted/20",children:[a(er,{className:"w-10 h-10 text-muted-foreground/30 mb-2"}),a("h3",{className:"text-sm font-semibold text-foreground/80",children:_T()}),a("p",{className:"text-xs text-muted-foreground max-w-sm mt-1 mx-auto",children:hO()})]}):g(W,{children:[a("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:Ze.map((T)=>{let Oe=T.startTime!=null&&T.endTime!=null?`${T.id}-${T.startTime}-${T.endTime}`:T.id;if(T.type==="folder")return a(Xl,{item:T,hideCheckbox:!0,hideActions:!0,disabled:!0,onSelect:()=>me(T)},Oe);return a(Yl,{teamId:n,item:T,hideCheckbox:!0,hideActions:!0,disabled:!0,onSelect:()=>me(T)},Oe)})}),(_||ze)&&a("div",{ref:ce,className:"p-4 flex justify-center items-center",children:a(K,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})}),g("div",{className:"p-4 border-t border-border bg-muted/30 flex items-center justify-between shrink-0",children:[a("div",{className:"text-xs text-muted-foreground flex items-center gap-2",children:a("span",{children:$S({count:_e(ge)})})}),g("div",{className:"flex items-center gap-2",children:[a(F,{variant:"outline",size:"xs",className:"h-8 text-[10px] font-semibold uppercase tracking-wider mr-1",disabled:!A||Me||P,onClick:()=>Ee(),children:Me?g(W,{children:[a(K,{className:"mr-2 h-3 w-3 animate-spin"}),Xh()]}):$k()}),a(F,{size:"xs",className:"h-8 text-[10px] font-semibold uppercase tracking-wider",onClick:P?()=>t(!1):H,children:P?Fl():$b()})]})]})]})})}L();function ls({fields:e,sort:t,onSortChange:n,disabled:o}){let r=Q(()=>{let c=[{id:"custom",label:sg()},{id:"name",label:Xc()},{id:"createdAt",label:ig()},{id:"updatedAt",label:nM()},{id:"sizeByte",label:lg()}],p=e.map((m)=>({id:m.id,label:m.config?.name||m.description||Yn()}));return[...c,...p]},[e]),s=t?.field||"custom",i=r.find((c)=>c.id===s)||r[0],l=t?.order==="asc",f=((c)=>{if(c==="name")return{asc:Sd(),desc:kd()};if(["createdAt","updatedAt"].includes(c))return{asc:Td(),desc:Id()};if(c==="sizeByte")return{asc:cg(),desc:ag()};return{asc:Gm(),desc:nh()}})(s),u=(c)=>{n({field:c,order:t?.order||"desc"})},h=(c)=>{n({field:s,order:c==="asc"?"asc":"desc"})};return g(bt,{children:[a(wt,{asChild:!0,children:a(F,{variant:t?"secondary":"ghost",size:"sm",disabled:o,children:t?sM({field:i.label}):Yc()})}),a(Et,{className:"w-[280px] p-3",align:"end",children:g("div",{className:"grid gap-4",children:[g("div",{className:"grid gap-2",children:[a("span",{className:"text-sm text-muted-foreground",children:Yc()}),g(Xe,{value:s,onValueChange:u,children:[a(tt,{className:"w-full",children:a(et,{})}),a(rt,{position:"popper",children:r.map((c)=>a(be,{value:c.id,children:c.label},c.id))})]})]}),s!=="custom"&&g("div",{className:"grid gap-2",children:[a("span",{className:"text-sm text-muted-foreground",children:Fh()}),g(F,{variant:"outline",className:"w-full justify-between font-normal",onClick:()=>h(l?"desc":"asc"),children:[a("span",{children:l?f.asc:f.desc}),a(Bd,{className:"size-4 opacity-50"})]})]})]})})]})}function ds({teamId:e,projectId:t,assetId:n,fields:o,filterConditions:r,onFilterChange:s,sort:i,onSortChange:l,isRecentlyDeleted:d,isRecents:f,collection:u,onUpdateCollection:h,rootFolderId:c}){let{canEdit:p}=Xt(t),[m,v]=w(!1),[C,b]=w(!1),[k,D]=w(!1),[P,le]=w(!1),[te,ue]=w(!1),V=We(),A=r.length,Ee=!!u,Me=ie(),ce=Lr((I)=>Boolean(I.metadata["appearance.hideAgent"])),{data:se}=X({queryKey:["folders",n],queryFn:async()=>{let I=await R.api.folders[":folderId"].$get({param:{folderId:n}});if(!I.ok)throw Error("failed to fetch folder");return await I.json()},enabled:!!n&&!d}),O=()=>{if(n===c)V({to:"/projects/$projectId/agentsmd",params:{projectId:t}});else V({to:"/projects/$projectId/folders/$folderId/agentsmd",params:{projectId:t,folderId:n}})},{data:ae,refetch:ze}=X({queryKey:["projects",t,"members"],queryFn:async()=>{let I=await R.api.projects[":projectId"].members.$get({param:{projectId:t},query:{}});if(!I.ok)throw Error("Failed to fetch members");return await I.json()}}),{data:Te}=X({queryKey:["projects",t,"team"],queryFn:async()=>{let I=await R.api.projects[":projectId"].team.$get({param:{projectId:t}});if(!I.ok)throw Error("Failed to fetch team info");return await I.json()}}),{data:_}=X({queryKey:["teams",Te?.teamId,"members"],queryFn:async()=>{let I=await R.api.teams[":teamId"].members.$get({param:{teamId:Te?.teamId||""},query:{}});if(!I.ok)throw Error("Failed to fetch team members");return await I.json()},enabled:!!Te?.teamId&&P}),{data:Pe,refetch:Ze}=X({queryKey:["projects",t,"me"],queryFn:async()=>{let I=await R.api.projects[":projectId"].me.$get({param:{projectId:t}});if(!I.ok)throw Error("Failed to fetch project me");return await I.json()},enabled:!!t}),ge=R.api.projects[":projectId"].invite.$post,_e=ee({mutationFn:async(I)=>{let oe=await ge(I);if(!oe.ok)throw Error("Failed to invite");return await oe.json()}}),H=R.api.projects[":projectId"].members.$post,E=ee({mutationFn:async(I)=>{let oe=await H(I);if(!oe.ok)throw Error("Failed to add project member");return await oe.json()},onSuccess:()=>{Me.invalidateQueries({queryKey:["projects",t,"members"]}),Me.invalidateQueries({queryKey:["projects",t,"me"]})}}),me=()=>{v(!1),D(!0)},at=async(I)=>(await _e.mutateAsync({param:{projectId:t},json:{role:I}})).code,T=(I)=>{if(le(I),I)ze(),Ze()},Oe=Array.isArray(ae)?ae:[],lt=(Array.isArray(_)?_:[]).filter((I)=>!Oe.some((oe)=>oe.id===I.id)),J=async(I,oe)=>{await E.mutateAsync({param:{projectId:t},json:{userId:I,role:oe}})},q=ee({mutationFn:async({userId:I,role:oe})=>{if(!(await R.api.projects[":projectId"].members[":userId"].$patch({param:{projectId:t,userId:I},json:{role:oe}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{Me.invalidateQueries({queryKey:["projects",t,"members"]})}}),N=ee({mutationFn:async(I)=>{if(!(await R.api.projects[":projectId"].members[":userId"].$delete({param:{projectId:t,userId:I}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{Me.invalidateQueries({queryKey:["projects",t,"members"]})}}),x=(I)=>{if(!I)return"??";return I.split(" ").map((oe)=>oe[0]).slice(0,2).join("").toUpperCase()};if(f)return a("div",{className:"flex items-center px-4 py-2.5 border-b sticky top-0 bg-background z-10 text-sm text-muted-foreground",children:a("span",{children:Ek()})});return g("div",{className:"flex items-center justify-between p-2 border-b sticky top-0 bg-background z-10",children:[g("div",{className:"flex items-center gap-2 h-full",children:[g(bt,{open:m,onOpenChange:v,children:[a(wt,{asChild:!0,children:a(F,{variant:"ghost",size:"sm",children:uh()})}),a(Et,{className:"w-auto p-0",align:"start",children:a(Fg,{projectId:t,onManageFields:p?me:void 0,onSave:()=>v(!1)})})]}),a(Bo,{orientation:"vertical"}),a(ls,{fields:o,sort:i,onSortChange:l,disabled:d||f}),a(Bo,{orientation:"vertical"}),Ee?g(W,{children:[g(bt,{open:te,onOpenChange:ue,children:[a(wt,{asChild:!0,children:a(F,{variant:"ghost",size:"sm",className:"text-muted-foreground",children:a("span",{className:"truncate max-w-[150px]",children:se?.name||"Loading..."})})}),a(Et,{className:"w-[300px] p-0",align:"start",children:g("div",{className:"h-[400px] flex flex-col",children:[a("div",{className:"p-2 border-b text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Select Source Folder"}),a("div",{className:"flex-1 overflow-y-auto",children:a($r,{teamId:e,projectId:t,projectName:"Assets",rootFolderId:c,onSelect:(I)=>{h?.({filter:{...u.filter,sourceFolderId:I.id}}),ue(!1)},selectedFolderId:u.filter.sourceFolderId,hideCollections:!0,hideShares:!0})})]})})]}),a(Bo,{orientation:"vertical"}),g(bt,{children:[a(wt,{asChild:!0,children:g(F,{variant:A>0?"secondary":"ghost",size:"sm",children:[a("span",{children:"Filter"}),A>0&&a("span",{className:"ml-1 px-1.5 py-0.5 rounded-full text-[10px] font-mono font-bold bg-primary/50 border border-primary-foreground/20",children:A})]})}),a(Et,{className:"w-[500px] p-0 overflow-hidden",align:"start",children:a("div",{className:"max-h-[80vh] overflow-y-auto",children:a(Hn,{fields:o,conditions:r,onChange:(I)=>{s(I),h?.({filter:{...u.filter,searchFilter:{...u.filter.searchFilter,conditions:I}}})},excludeFields:[],hidePrefix:!0})})})]})]}):g(W,{children:[g(F,{onClick:()=>b(!0),disabled:d||f,variant:A>0?"secondary":"ghost",size:"sm",children:[a("span",{children:Qk()}),A>0&&a("span",{className:"ml-1 px-1.5 py-0.5 rounded-full text-[10px] font-mono font-bold bg-primary/50 border border-primary-foreground/20",children:A})]}),!d&&!f&&!ce&&g(W,{children:[a(Bo,{orientation:"vertical"}),g(F,{onClick:O,variant:"ghost",size:"sm",title:"AGENTS.md",className:B(se?.hasAgentsMd?"text-foreground":"text-muted-foreground"),children:[a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",className:B("size-4",se?.hasAgentsMd?"text-primary":"text-muted-foreground"),fill:"currentColor",children:a("path",{d:"m176-120-56-56 301-302-181-45 198-123-17-234 179 151 216-88-87 217 151 178-234-16-124 198-45-181-301 301Zm24-520-80-80 80-80 80 80-80 80Zm520 520-80-80 80-80 80 80-80 80Z"})}),a("span",{children:yb()})]})]})]})]}),a("div",{className:"flex items-center gap-2",children:!d&&!f&&g("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90","data-testid":"project-members-trigger",onClick:()=>T(!0),children:[ae?.slice(0,3).map((I)=>g($e,{className:"border-2 border-background w-8 h-8",children:[I.image&&a(He,{src:I.image,alt:I.name,className:"object-cover"}),a(Qe,{className:"text-[10px]",children:x(I.name)})]},I.id)),ae&&ae.length>3&&g("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",ae.length-3]})]})}),a(is,{projectId:t,open:k,onOpenChange:D}),a(wu,{open:P,onOpenChange:T,title:k1(),type:"project",members:ae||[],isOwner:Pe?.role==="owner",onInvite:at,onUpdateRole:async(I,oe)=>{await q.mutateAsync({userId:I,role:oe})},onRemoveMember:async(I)=>{await N.mutateAsync(I)},currentUserId:Pe?.id,availableMembersToAdd:lt,onAddMember:J}),a(as,{open:C,onOpenChange:b,teamId:e,projectId:t,assetId:n,fields:o,initialConditions:r,onApply:s})]})}L();function zd({teamId:e,projectId:t,assetId:n,folders:o,files:r,selectedIds:s,isPublic:i,shareId:l}){let[d,f]=w(null),[u,h]=w(!1),[c,p]=w([]),[m,v]=w(!1),[C,b]=w(!1),[k,D]=w([]),P=ie(),le=R.api.folders.$post,{mutate:te}=ee({mutationFn:async(J)=>{let q=await le(J);if(!q.ok)throw Error("Failed to create");return await q.json()}}),ue=R.api.folders[":folderId"].$put,{mutate:V}=ee({mutationFn:async(J)=>{let q=await ue(J);if(!q.ok)throw Error("Failed to rename");return await q.json()}}),A=R.api.files[":fileId"].$put,{mutate:Ee}=ee({mutationFn:async(J)=>{let q=await A(J);if(!q.ok)throw Error("Failed to rename");return await q.json()}}),Me=R.api.files.$delete,{mutate:ce}=ee({mutationFn:async(J)=>{if(!(await Me(J)).ok)throw Error("Failed to delete")}}),se=R.api.folders.$delete,{mutate:O}=ee({mutationFn:async(J)=>{if(!(await se(J)).ok)throw Error("Failed to delete");return null}}),ae=R.api.files.restore.$post,{mutate:ze}=ee({mutationFn:async(J)=>{if(!(await ae(J)).ok)throw Error("Failed to restore")}}),Te=R.api.folders.restore.$post,{mutate:_}=ee({mutationFn:async(J)=>{if(!(await Te(J)).ok)throw Error("Failed to restore");return null}}),Pe=R.api.files["download-links"].$post,{mutateAsync:Ze}=ee({mutationFn:async(J)=>{let q=await Pe(J);if(!q.ok)throw Error("Failed to get download links");return await q.json()}}),ge=(J)=>{f(J.id)},_e=()=>{let J=c.filter((N)=>N.type==="file"||N.type==="version_stack").map((N)=>N.id),q=c.filter((N)=>N.type==="folder").map((N)=>N.id);if(J.length>0)ce({json:{ids:J}},{onSuccess:()=>{P.invalidateQueries({queryKey:["search",e,n]})}});if(q.length>0)O({json:{ids:q}},{onSuccess:()=>{P.invalidateQueries({queryKey:["search",e,n]}),P.invalidateQueries({queryKey:["folders"]})}});h(!1),p([])},H=(J)=>{p(J),h(!0)},E=(J)=>{let q=J.filter((x)=>x.type==="file"||x.type==="version_stack").map((x)=>x.id),N=J.filter((x)=>x.type==="folder").map((x)=>x.id);if(q.length>0)ze({json:{ids:q}},{onSuccess:()=>{P.invalidateQueries({queryKey:["projects",t,"recently-deleted","file"]})}});if(N.length>0)_({json:{ids:N}},{onSuccess:()=>{P.invalidateQueries({queryKey:["projects",t,"recently-deleted","folder"]})}})},me=async(J)=>{if(J.length===0)return;v(!0),b(!0),D([]);try{if(i&&l){let q=localStorage.getItem(`share_pwd_${l}`)||"",N=[];for(let x of J){let I=x.media?.original?.key;if(!I||!x.id)continue;let oe=await R.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:l,fileId:x.id},json:{key:I}},{headers:{"x-share-password":q}});if(oe.ok){let{url:Ae}=await oe.json();N.push({id:x.id,name:x.name||"download",url:Ae})}}D(N)}else{let q=await Ze({json:{ids:J.map((N)=>N.id)}});D(q.files)}}catch(q){j.error("Failed to prepare download links"),v(!1),console.error(q)}finally{b(!1)}},at=async(J)=>{if(J.length===0)return;try{let N=(await Ze({json:{ids:J.map((oe)=>oe.id)}})).files;if(N.length===0)return;let x="";if(N.length===1)x=`Name: ${N[0].name}
|
|
5
|
+
Path: ${N[0].url}`;else x=N.map((oe)=>`${oe.name} ${oe.url}`).join(`
|
|
6
|
+
`);if(await jo(x))j.success(eE())}catch(q){j.error("Failed to copy name and download link"),console.error(q)}};return{editingItemId:d,setEditingItemId:f,handleRename:ge,handleDelete:H,handleRestore:E,handleDownload:me,handleCopyNameAndDownloadLink:at,handleNewFolder:(J)=>{te({json:{name:J,parentId:n}},{onSuccess:(q)=>{if(P.invalidateQueries({queryKey:["search",e]}),P.invalidateQueries({queryKey:["folders"]}),q?.id)f(q.id)}})},handleAction:(J,q)=>{let x=s.has(q.id)?[...o,...r].filter((I)=>s.has(I.id)):[q];switch(J){case"rename":ge(q);break;case"delete":H(x);break;case"download":me(x);break;case"restore":E(x);break;case"copy-name-and-download-link":at(x);break}},onRenameSubmit:(J,q)=>{if(J.type==="folder")V({param:{folderId:J.id},json:{name:q}},{onSuccess:()=>{P.invalidateQueries({queryKey:["search",e]}),P.invalidateQueries({queryKey:["folders"]})}});else Ee({param:{fileId:J.id},json:{name:q}},{onSuccess:()=>{P.invalidateQueries({queryKey:["search",e]}),P.invalidateQueries({queryKey:["folders"]})}})},isDeleteDialogOpen:u,setIsDeleteDialogOpen:h,itemsToDelete:c,confirmDelete:_e,isDownloadDialogOpen:m,setIsDownloadDialogOpen:v,isLoadingLinks:C,resolvedFiles:k,startDownload:()=>{let J=[...k];if(v(!1),J.length===0)return;j.info(`Starting download of ${J.length} files. Please allow multiple downloads if prompted by your browser.`,{duration:5000});let q=(x)=>new Promise((I)=>setTimeout(I,x));(async()=>{for(let I=0;I<J.length;I+=5){let oe=J.slice(I,I+5);for(let Ae of oe){let ut=document.createElement("iframe");ut.style.display="none",ut.src=Ae.url,document.body.appendChild(ut),window.setTimeout(()=>ut.remove(),60000)}if(I+5<J.length)await q(600)}j.success("All downloads initiated successfully")})().catch((x)=>{console.error("Background downloads failed:",x),j.error("Some downloads could not be started")})}}}L();var us=100,qa=2000,Ua=5000;function jd({teamId:e,items:t}){let n=ie(),o=_n((d)=>d.fileProgress),r=M(0),s=Q(()=>{if(!e)return[];return t.filter((d)=>{if(!d.id||d.type!=="file"&&d.type!=="version_stack")return!1;let f=d.status==="uploaded"||d.status==="processing",u=o[d.id],h=d.status==="uploading"&&(u?.status==="completed"||u?.total!=null&&u.total>0&&u.loaded>=u.total);return f||h}).map((d)=>d.id)},[t,e,o]),i=M(s);i.current=s;let l=Q(()=>["files","batch",e],[e]);X({queryKey:l,queryFn:async()=>{let d=i.current;if(d.length===0)return[];let f=[];for(let v=0;v<d.length;v+=us)f.push(d.slice(v,v+us));let h=(await Promise.all(f.map(async(v)=>{let C=await R.api.files.batch.$post({json:{ids:v}});if(!C.ok)throw Error("Failed to fetch batch file statuses");return await C.json()}))).flat();for(let v of h)if(v.id)n.setQueryData(["file",e,v.id],v);let c=h.some((v)=>v.status==="processed"||v.status==="failed"||v.status==="error"),p=h.length>0&&h.every((v)=>v.status==="processed"||v.status==="failed"||v.status==="error"),m=Date.now();if(p||c&&m-r.current>=Ua)r.current=m,n.invalidateQueries({queryKey:["search",e]});return h},enabled:!!e&&s.length>0,refetchInterval:qa})}var cs=[];function Ea({teamId:e,projectId:t,assetId:n,folders:o,files:r,totalFolders:s,totalFiles:i,totalFoldersSize:l,totalFilesSize:d,selectedItem:f,selectedIds:u,onItemSelect:h,onItemDoubleClick:c,onSaveField:p,displayStyle:m,onClearSelection:v,fetchNextFoldersPage:C,hasNextFoldersPage:b,isFetchingNextFoldersPage:k,fetchNextFilesPage:D,hasNextFilesPage:P,isFetchingNextFilesPage:le,isRecentlyDeleted:te,isRecents:ue,isLoading:V=!1,filterConditions:A,onFilterChange:Ee,sort:Me,onSortChange:ce,dragState:se,isShareView:O,isPublic:ae,onRemoveFromShare:ze,fieldVisibility:Te,collection:_,onUpdateCollection:Pe,rootFolderId:Ze,shareId:ge,sharePassword:_e,allowDownload:H=!0}){let[E,me]=w(null),[at,T]=w(null),[Oe,Je]=w(null),[lt,J]=w([]),[q,N]=w(!1),[x,I]=w(null);S(()=>{if(f)I(f)},[f]),S(()=>{if(u.size===0)I(null)},[u.size]);let oe=G((y,U)=>{I(y),h(y,U)},[h]),Ae=ie(),ut=We(),[en,tn]=w(!1),[Lt,Ft]=w(null),qt=M(0),sn=G(()=>{tn(!1),Ft(null),qt.current=0},[]);S(()=>{let y=(U)=>{U.preventDefault()};return window.addEventListener("dragover",y),window.addEventListener("drop",y),()=>{window.removeEventListener("dragover",y),window.removeEventListener("drop",y)}},[]);let Z=(y)=>{if(!St||te||ue||O||ae||!!_)return;if(y.preventDefault(),y.dataTransfer.types.includes("Files"))qt.current++,tn(!0)},Kt=(y)=>{if(!St||te||ue||O||ae||!!_)return;if(y.preventDefault(),y.dataTransfer.types.includes("Files")){if(qt.current--,qt.current<=0)qt.current=0,tn(!1),Ft(null)}},Bn=(y)=>{if(!St||te||ue||O||ae||!!_)return;y.preventDefault()},fs=async(y)=>{if(!St||te||ue||O||ae||!!_)return;y.preventDefault(),y.stopPropagation();let U=await rc(y.dataTransfer);if(sn(),U.length>0)Wt(U)},xt=r;jd({teamId:e,items:xt});let Gn=Q(()=>{if(u.size===0)return null;if(x&&u.has(x.id))return x;if(f&&u.has(f.id))return f;return[...o,...xt].find((U)=>u.has(U.id))||null},[u,x,f,o,xt]);S(()=>{let y=(U)=>{if(U.key!==" "&&U.code!=="Space")return;if(q)return;let Le=document.activeElement;if(Le&&(Le.tagName==="INPUT"||Le.tagName==="TEXTAREA"||Le instanceof HTMLElement&&Le.isContentEditable))return;if(document.querySelector('[role="dialog"], [role="alertdialog"]'))return;if(u.size>0&&Gn)U.preventDefault(),N(!0)};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[q,u.size,Gn]);let{data:ps}=X({queryKey:["shares",t,"list"],queryFn:async()=>{let y=await R.api.projects[":projectId"].shares.$get({param:{projectId:t},query:{first:"100"}});if(!y.ok)throw Error("Failed to fetch share links");return await y.json()},enabled:!!t&&!ae}),gs=R.api.projects[":projectId"].reparent.$post,{mutate:hs}=ee({mutationFn:async(y)=>{if(!(await gs(y)).ok)throw Error("Failed to move assets");return null}}),vs=R.api.projects[":projectId"].copy.$post,{mutate:ws}=ee({mutationFn:async(y)=>{if(!(await vs(y)).ok)throw Error("Failed to copy assets");return null}}),xs=async(y,U)=>{let Le=lt.map((je)=>je.id);if(Oe==="move")hs({param:{projectId:t},json:{newParentId:y,assetIds:Le}},{onSuccess:()=>{j.success(`Successfully moved ${Le.length} item(s)`,{action:{label:"Go to folder",onClick:()=>{ut({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:y}})}}}),Ae.invalidateQueries({queryKey:["search",e]}),Ae.invalidateQueries({queryKey:["folders"]}),Je(null),J([]),v()},onError:(je)=>{j.error(`Error: ${je.message}`)}});else ws({param:{projectId:t},json:{newParentId:y,assetIds:Le,withComments:U}},{onSuccess:()=>{j.success(`Successfully copied ${Le.length} item(s)`,{action:{label:"Go to folder",onClick:()=>{ut({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:y}})}}}),Ae.invalidateQueries({queryKey:["search",e]}),Ae.invalidateQueries({queryKey:["folders"]}),Je(null),J([]),v()},onError:(je)=>{j.error(`Error: ${je.message}`)}})},{mutate:ys}=ee({mutationFn:async(y)=>{let U=y.length===1?y[0].name:new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),Le=await R.api.projects[":projectId"].shares.$post({param:{projectId:t},json:{name:U}});if(!Le.ok)throw Error("Failed to create share link");let je=await Le.json();if(!(await R.api.shares[":shareId"].assets.$post({param:{shareId:je.id},json:{assetIds:y.map((Ye)=>Ye.id)}})).ok)throw Error("Failed to add assets to share link");return je},onSuccess:(y)=>{Ae.invalidateQueries({queryKey:["shares",t]}),j.success("Share link created",{action:{label:"View",onClick:()=>ut({to:"/projects/$projectId/shares/$shareId",params:{projectId:t,shareId:y.id}})}})}}),{mutate:Cs}=ee({mutationFn:async({shareId:y,items:U})=>{if(!(await R.api.shares[":shareId"].assets.$post({param:{shareId:y},json:{assetIds:U.map((je)=>je.id)}})).ok)throw Error("Failed to add assets");return{shareId:y}},onSuccess:({shareId:y})=>{j.success("Added to share link",{action:{label:"View",onClick:()=>ut({to:"/projects/$projectId/shares/$shareId",params:{projectId:t,shareId:y}})}})}}),Ss=(y)=>{ys(y)},bs=(y,U)=>{Cs({shareId:y,items:U})},{editingItemId:_s,setEditingItemId:Ao,handleNewFolder:Is,handleDelete:Rs,handleRename:Fs,handleRestore:ks,handleDownload:$o,handleCopyNameAndDownloadLink:Es,handleAction:Oo,onRenameSubmit:Ds,isDeleteDialogOpen:Ts,setIsDeleteDialogOpen:$s,confirmDelete:zs,isDownloadDialogOpen:Vs,setIsDownloadDialogOpen:qn,isLoadingLinks:xn,resolvedFiles:zo,startDownload:Ls}=zd({teamId:e,projectId:t,assetId:n,folders:o,files:xt,selectedIds:u,isPublic:ae,shareId:ge}),[js,Un]=w(!1),{mutate:Hs,isPending:Kn}=ee({mutationFn:async()=>{let y=await R.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:t}});if(!y.ok)throw Error("Failed to empty trash");return await y.json()},onSuccess:()=>{j.success("Trash emptied successfully"),Ae.invalidateQueries({queryKey:["projects",t,"recently-deleted"]}),v(),Un(!1)},onError:(y)=>{j.error(`Error emptying trash: ${y.message}`)}}),Wn=Q(()=>{let y=null,U=0,Le=2500,je=()=>{let It=Date.now();if(It-U>=Le)U=It,Ae.invalidateQueries({queryKey:["search",e,n]});else if(!y)y=setTimeout(()=>{y=null,U=Date.now(),Ae.invalidateQueries({queryKey:["search",e,n]})},Le-(It-U))},it=()=>{if(y)clearTimeout(y),y=null};return Object.assign(je,{cancel:it,reset:()=>{it(),U=Date.now()}})},[Ae,e,n]),Bs=R.api.teams[":teamId"].upload.tasks.$post,{mutate:Vo}=ee({mutationFn:async(y)=>{let U=await Bs(y);if(!U.ok)throw Error("Failed to create upload task");return await U.json()},onMutate:()=>({files:[...cs]}),onError:()=>{j.error(ma())},onSuccess:async(y,U,Le)=>{let je=Le?.files||[],it=je.map((ct)=>{let Dt=y.createdAssets?.find((dn)=>dn.tempId===ct.id),Qt=y.presignedUrls?.find((dn)=>dn.id===ct.id);return{fileId:Dt?.assetId||Qt?.fileId||ct.id,name:ct.file.name,size:ct.file.size}}).filter((ct)=>!!ct.fileId),Ye=je.filter((ct)=>!ct.file.name.startsWith(".")),It=Ye.length===1?Ye[0].file.name:`${Ye.length} Items`;if(y.taskId)Gs(y.taskId,It,it);Ae.invalidateQueries({queryKey:["search",e,n]}),Ae.invalidateQueries({queryKey:["teams",e,"upload","tasks"]}),Wn.reset();try{await Zd({files:je,taskId:y.taskId,teamId:e,storageBackend:y.storageBackend||"local",createdAssets:y.createdAssets,presignedUrls:y.presignedUrls,onFileFinished:()=>{Wn()}})}finally{Wn.cancel(),Ae.invalidateQueries({queryKey:["search",e,n]}),Ae.invalidateQueries({queryKey:["teams",e,"upload","tasks"]})}}}),Gs=_n((y)=>y.startTask),{fields:yn}=cn(),Ho=Q(()=>{if(!O)return yn.filter((y)=>y.visible);return yn.filter((y)=>Te?.[y.id])},[yn,O,Te]),[Go,qo]=w(!0),[Uo,Ko]=w(!0),Wo=M(null),Qo=M(null),Xo=M(null),[Jo,Yo]=w(null),Qn=M(!1),{canEdit:St,canAdmin:qs}=Xt(t),Zo=M(null),or=o.reduce((y,U)=>y+(U.sizeByte||0),0),rr=xt.reduce((y,U)=>y+(U.sizeByte||0),0),sr=(y,U)=>{if(A?.some((je)=>je.field==="name"&&je.operator==="contains")&&y===10001)return U?oE():sE();if(U)return y===1?Th({count:y}):Ih({count:y});else return y===1?Rh({count:y}):kh({count:y})},Jn=(y)=>{let U=y.target;if(U.closest('[role="menuitem"]')||U.closest("[data-radix-menu-content]"))return;if(U===y.currentTarget||U.closest(".empty-area")||!U.closest(".group")&&!U.closest("button")&&!U.closest("a")&&!U.closest("input"))v(),Ao(null)},ir=(y,U)=>{if(U===void 0)if(Qn.current)Qn.current=!1;else me(null);else{Qn.current=!0,me(U??null);return}},ar=(y,U)=>{let Le=y.type==="symlink"?y.targetType||"file":y.type,je={teamId:e,item:y,isSelected:f?.id===y.id,isChecked:u.has(y.id),isEditing:_s===y.id,onSelect:oe,onDoubleClick:c,onContextMenu:ir,onDragStart:()=>{},onDrop:()=>{},onRename:(it)=>Ds(y,it),onFinishEditing:()=>Ao(null),onSaveField:(it,Ye)=>{p(y.id,it,Ye)},dragState:se,onAction:(it,Ye)=>{if(it==="manage-versions"){T(Ye.id||null);return}if(O){if(it==="remove-from-share"){let ct=u.has(Ye.id)?[...o,...r].filter((Dt)=>u.has(Dt.id)):[Ye];ze?.(ct)}else if(it==="download")Oo("download",Ye);return}Oo(it,Ye)},isRecentlyDeleted:te,isRecents:ue,selectedCount:u.size,isShareView:O,allowDownload:H,fields:Ho,canEdit:St,isExternalDragging:en,externalOverFolderId:Lt,setExternalOverFolderId:Ft,resetExternalDragState:sn,onExternalDrop:(it,Ye)=>{Wt(it,Ye)}};if(m==="card"){if(Le==="folder")return a(Xl,{...je},y.id);if(Le==="file"||Le==="version_stack")return a(Yl,{...je},y.id)}return a(Cr,{...je,columnSizing:U},y.id)},eo=u.size,fn=Array.from(u).filter((y)=>o.find((U)=>U.id===y)).length,pn=Array.from(u).filter((y)=>xt.find((U)=>U.id===y)).length,to=Array.from(u).reduce((y,U)=>{let Le=o.find((je)=>je.id===U)||xt.find((je)=>je.id===U);return y+(Le?.sizeByte||0)},0),Us=()=>{Wo.current?.click()},Ks=()=>{Qo.current?.click()},Wt=G((y,U)=>{if(!y||y.length===0)return;let Le=[],je=[],it=new Map;for(let Ye of y){let It=(Ye.webkitRelativePath||Ye.name).split("/");if(It.some((Sn)=>Sn.startsWith(".")))continue;let ct=It.pop(),Dt=je,Qt="";for(let Sn of It)if(Qt=`${Qt}/${Sn}`,!it.has(Qt)){let no=[],Xs={name:Sn,type:"folder",id:As(),children:no,size:0};Dt.push(Xs),it.set(Qt,no),Dt=no}else Dt=it.get(Qt);let dn={file:Ye,id:As()};Le.push(dn);let Cn=Ye.type;if(ct.toLowerCase().endsWith(".wma")&&Cn?.startsWith("video/"))Cn=Cn.replace(/^video\//,"audio/");Dt.push({name:ct,size:Ye.size,type:"file",id:dn.id,children:[],mediaType:Cn})}cs=Le,Vo({param:{teamId:e},json:{parentId:U||n,files:je}})},[n,Vo,e]),lr=(y)=>{Wt(y.target.files)},Ws=(y)=>{Yo(y.id),Xo.current?.click()},Qs=(y)=>{if(y.target.files&&Jo)Wt(y.target.files,Jo),Yo(null),y.target.value=""},cr=G((y)=>{if(!St||O||!!_)return;if(!y.clipboardData)return;let U=y.clipboardData.items,Le=[];for(let je=0;je<U.length;je++){let it=U[je];if(it.kind==="file"){let Ye=it.getAsFile();if(Ye)if(Ye.name==="image.png"&&Ye.type.startsWith("image/")){let It=new Date().toISOString().replace(/[:.]/g,"").replace("T","_").substring(0,15),ct=Ye.type.split("/")[1]||"png",Dt=new File([Ye],`pasted_image_${It}.${ct}`,{type:Ye.type});Le.push(Dt)}else Le.push(Ye)}}if(Le.length>0)Wt(Le)},[Wt,O,_,St]);return S(()=>{let y=(U)=>{if(!St||O||!!_)return;if(document.activeElement&&(document.activeElement.tagName==="INPUT"||document.activeElement.tagName==="TEXTAREA"||document.activeElement.isContentEditable))return;cr(U)};return window.addEventListener("paste",y),()=>{window.removeEventListener("paste",y)}},[cr,O,_,St]),g(W,{children:[St&&g(W,{children:[a("input",{type:"file",ref:Wo,multiple:!0,style:{display:"none"},onChange:lr}),a("input",{type:"file",ref:Qo,multiple:!0,webkitdirectory:"true",style:{display:"none"},onChange:lr}),a("input",{type:"file",ref:Xo,style:{display:"none"},onChange:Qs})]}),(()=>g(vr,{modal:!1,children:[a(wr,{asChild:!0,disabled:O||ae||!!_||ue,children:g("div",{className:"flex-1 bg-background relative flex flex-col min-h-0 overflow-hidden",onContextMenu:(y)=>{if(ue){y.preventDefault(),y.stopPropagation();return}ir(y)},onDragEnter:Z,onDragLeave:Kt,onDragOver:Bn,onDrop:fs,children:[!O&&!ae&&Ee&&ce&&a(ds,{teamId:e,projectId:t,assetId:n,fields:yn||[],filterConditions:A||[],onFilterChange:Ee,sort:Me,onSortChange:ce,isRecentlyDeleted:te,isRecents:ue,collection:_,onUpdateCollection:Pe,rootFolderId:Ze}),te&&g("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0 animate-in fade-in slide-in-from-top-2 duration-300",children:[g("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a(rn,{className:"h-4 w-4 text-amber-500 shrink-0"}),a("span",{children:Kh()})]}),qs&&a(F,{variant:"destructive",size:"sm",disabled:Kn||o.length===0&&xt.length===0,onClick:()=>Un(!0),className:"h-8 px-3 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground transition-all duration-200",children:"Delete Now"})]}),g("div",{ref:Zo,className:"flex-1 overflow-y-auto min-h-0 relative flex flex-col",style:{overflowAnchor:"none"},children:[V&&o.length===0&&xt.length===0?a(xg,{displayStyle:m}):!V&&o.length===0&&xt.length===0&&!k&&!le?a("div",{className:"empty-area flex-1 flex items-center justify-center text-sm text-muted-foreground",onClick:Jn,children:ue?g("div",{className:"flex flex-col items-center gap-2 p-8 text-center animate-in fade-in duration-300",children:[a(Ti,{className:"h-10 w-10 text-muted-foreground/50 mb-1"}),a("p",{className:"font-medium text-foreground",children:Ph()}),a("p",{className:"text-xs text-muted-foreground",children:Dh()})]}):a("span",{children:fg()})}):m==="list"?a(ss,{folders:o,files:xt,totalFolders:s,totalFiles:i,totalFoldersSize:l,totalFilesSize:d,selectedItem:f,selectedIds:u,displayedFields:Ho,onItemSelect:oe,onItemDoubleClick:c,renderItem:ar,foldersExpanded:Go,setFoldersExpanded:qo,filesExpanded:Uo,setFilesExpanded:Ko,hasNextFoldersPage:b,hasNextFilesPage:P,isFetchingNextFoldersPage:k,isFetchingNextFilesPage:le,fetchNextFoldersPage:C,fetchNextFilesPage:D,formatCount:sr,formatSize:Fr,foldersSize:or,filesSize:rr,handleEmptyAreaClick:Jn,dragState:se,sort:Me,isExternalDragging:en,externalOverFolderId:Lt,setExternalOverFolderId:Ft,resetExternalDragState:sn,onExternalDrop:(y,U)=>Wt(y,U)}):a(Or,{folders:o,files:xt,totalFolders:s,totalFiles:i,totalFoldersSize:l,totalFilesSize:d,renderItem:ar,foldersExpanded:Go,setFoldersExpanded:qo,filesExpanded:Uo,setFilesExpanded:Ko,hasNextFoldersPage:b,hasNextFilesPage:P,isFetchingNextFoldersPage:k,isFetchingNextFilesPage:le,fetchNextFoldersPage:C,fetchNextFilesPage:D,formatCount:sr,formatSize:Fr,foldersSize:or,filesSize:rr,handleEmptyAreaClick:Jn,dragState:se,sort:Me,scrollContainerRef:Zo}),(k||le)&&a("div",{className:"flex justify-center items-center p-4",children:a("p",{children:LS()})})]}),eo>0&&g("div",{className:"border-t border-border bg-card px-4 py-3 flex items-center justify-between shrink-0",children:[g("div",{className:"text-sm text-muted-foreground",children:[fn>0&&pn>0&&g("span",{children:[eo," Item",eo!==1?"s":""," selected •"," ",Fr(to)]}),fn>0&&pn===0&&g("span",{children:[fn," folder",fn!==1?"s":""," selected •"," ",Fr(to)]}),fn===0&&pn>0&&g("span",{children:[pn," file",pn!==1?"s":""," selected •"," ",Fr(to)]})]}),H&&g(F,{variant:"ghost",size:"sm",onClick:()=>$o([...o,...xt].filter((y)=>u.has(y.id))),className:"gap-2",children:[a(Bt,{className:"h-4 w-4"}),"Download"]})]}),en&&!Lt&&a("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 z-50 pointer-events-none animate-in fade-in slide-in-from-bottom-4 duration-300",children:a("div",{className:"flex items-center gap-3 px-6 py-3 rounded-full bg-primary/80 text-primary-foreground shadow-lg shadow-primary/20 border border-primary/20 backdrop-blur-md",children:a("span",{className:"font-medium text-sm",children:"Drop files here to upload"})})})]})}),a(yr,{item:E,selectedIds:u,folders:o,files:xt,onRename:Fs,onDelete:Rs,onDownload:$o,onCopyNameAndDownloadLink:Es,onNewFolder:Is,onUploadFile:Us,onUploadFolder:Ks,onNewVersion:Ws,onManageVersions:(y)=>T(y.id||null),onMoveTo:(y)=>{J(y),Je("move")},onCopyTo:(y)=>{J(y),Je("copy")},onRestore:ks,isRecentlyDeleted:te,isRecents:ue,shareLinks:ps?.data??[],onCreateShareLink:Ss,onAddToShareLink:bs,canEdit:St})]}))(),Oe&&a(gr,{isOpen:!!Oe,onClose:()=>Je(null),onConfirm:xs,mode:Oe,teamId:e,currentProjectId:t}),a(dt,{open:Ts,onOpenChange:$s,children:g(ft,{children:[g(pt,{children:[a(ht,{children:"Delete Asset?"}),a(gt,{children:"Deleted items can be recovered for 30 days before being permanently deleted."})]}),g(mt,{children:[a(_t,{children:"Cancel"}),a(At,{onClick:()=>{zs()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),a(dt,{open:js,onOpenChange:Un,children:g(ft,{children:[g(pt,{children:[a(ht,{children:"Empty Trash?"}),a(gt,{children:"All items in the recently deleted folder will be permanently removed both from the database and from storage. This action cannot be undone."})]}),g(mt,{children:[a(_t,{children:"Cancel"}),a(At,{onClick:(y)=>{y.preventDefault(),Hs()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:Kn,children:Kn?"Deleting...":"Delete Now"})]})]})}),a(Se,{open:Vs,onOpenChange:qn,children:g(xe,{className:"sm:max-w-md",children:[g(ke,{children:[a(Ce,{children:xn?"Preparing Download":"Confirm Download"}),a(Ot,{children:xn?"Resolving all files and folders. Please wait...":"Selected files and folders will be prepared for download."})]}),xn?g("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[a(K,{className:"h-8 w-8 animate-spin text-primary"}),a("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:"Preparing download links..."})]}):g("div",{className:"space-y-4 py-2",children:[g("div",{className:"text-sm text-muted-foreground",children:["This download will include"," ",a("span",{className:"font-semibold text-foreground",children:zo.length})," ","file(s)."]}),g("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[a(rn,{className:"h-5 w-5 shrink-0 mt-0.5"}),g("div",{children:[a("p",{className:"font-semibold",children:"No Folder Structure"}),a("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:"Folder hierarchy will be flattened. All nested files will be downloaded directly into your default download folder."})]})]})]}),a(ot,{children:!xn?g(W,{children:[a(F,{variant:"outline",onClick:()=>qn(!1),children:"Cancel"}),g(F,{onClick:Ls,className:"gap-2",disabled:zo.length===0,children:[a(Bt,{className:"h-4 w-4"}),"Start Download"]})]}):a(F,{variant:"outline",onClick:()=>qn(!1),children:"Cancel"})})]})}),at&&a(Wp,{open:!!at,onOpenChange:(y)=>{if(!y)T(null)},stackId:at,canEdit:St,onStackDissolved:()=>{T(null)}}),a(hr,{item:Gn,isOpen:q,onClose:()=>N(!1),allowDownload:H,shareId:ge,sharePassword:_e,isPublic:ae})]})}
|
|
7
|
+
export{Bd,Ud,Yl,Xl,zd,jd,Ea};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ei,Ss}from"./chunk-
|
|
2
|
+
import{Ei,Ss}from"./chunk-s6pk2zyg.js";import{Is}from"./chunk-yb4mzqrd.js";import{Ts,Ko,Yt}from"./chunk-r6t0j0jx.js";import{Wn,br,at,kn,gr,Jo,ir}from"./chunk-vnmggrd6.js";var{awsEndpointFunctions:B,emitWarningIfUnsupportedVersion:W,createDefaultUserAgentProvider:Q,NODE_APP_ID_CONFIG_OPTIONS:Y,getAwsRegionExtensionConfiguration:J,resolveAwsRegionExtensionConfiguration:X,resolveUserAgentConfig:Z,resolveHostHeaderConfig:ee,getUserAgentPlugin:te,getHostHeaderPlugin:se,getLoggerPlugin:oe,getRecursionDetectionPlugin:ne}=Yt(),{NoAuthSigner:re,getHttpAuthSchemeEndpointRuleSetPlugin:ie,DefaultIdentityProviderConfig:ae,getHttpSigningPlugin:ce}=Ko(),{normalizeProvider:b,getSmithyContext:ue,ServiceException:de,NoOpLogger:le,emitWarningIfUnsupportedVersion:pe,loadConfigsForDefaultMode:he,getDefaultExtensionConfiguration:ge,resolveDefaultRuntimeConfig:me,Client:_e,makeBuilder:Se,createAggregatedClient:fe}=br(),{Command:as}=br();var{resolveDefaultsModeConfig:Ee,loadConfig:a,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:Pe,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:ve,NODE_REGION_CONFIG_OPTIONS:Re,NODE_REGION_CONFIG_FILE_OPTIONS:Ce,resolveRegionConfig:xe}=at(),{BinaryDecisionDiagram:Ie,EndpointCache:Ae,decideEndpoint:ye,customEndpointFunctions:Oe,resolveEndpointConfig:Te,getEndpointPlugin:De}=kn(),{parseUrl:Ne,getHttpHandlerExtensionConfiguration:we,resolveHttpHandlerRuntimeConfig:ke,getContentLengthPlugin:be}=ir(),{DEFAULT_RETRY_MODE:Fe,NODE_RETRY_MODE_CONFIG_OPTIONS:$e,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:qe,resolveRetryConfig:He,getRetryPlugin:Ue}=Ts(),{TypeRegistry:F,getSchemaSerdePlugin:Ge}=Wn(),{resolveAwsSdkSigV4Config:Me,AwsSdkSigV4Signer:ze,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:je}=Ss(),{toUtf8:Le,fromUtf8:Ke,toBase64:Ve,fromBase64:Be,calculateBodyLength:We}=gr(),{streamCollector:Qe,NodeHttpHandler:Ye}=Is(),{AwsRestJsonProtocol:Je}=Ei(),{Sha256:Xe}=Jo(),Ze=async(e,t,s)=>({operation:ue(t).operation,region:await b(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function et(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function tt(e){return{schemeId:"smithy.api#noAuth"}}var st=(e)=>{let t=[];switch(e.operation){case"GetRoleCredentials":{t.push(tt());break}default:t.push(et(e))}return t},ot=(e)=>{let t=Me(e);return Object.assign(t,{authSchemePreference:b(e.authSchemePreference??[])})},nt=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}),rt={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},it="3.997.43",ct={version:it},l="ref",c=-1,g=!0,T="isSet",q="PartitionResult",m="booleanEquals",v="getAttr",D={[l]:"Endpoint"},R={[l]:q},d={},N=[{[l]:"Region"}],w={conditions:[[T,[D]],[T,N],["aws.partition",N,q],[m,[{[l]:"UseFIPS"},g]],[m,[{[l]:"UseDualStack"},g]],[m,[{fn:v,argv:[R,"supportsDualStack"]},g]],[m,[{fn:v,argv:[R,"supportsFIPS"]},g]],["stringEquals",[{fn:v,argv:[R,"name"]},"aws-us-gov"]]],results:[[c],[c,"Invalid Configuration: FIPS and custom endpoint are not supported"],[c,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[D,d],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",d],[c,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",d],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",d],[c,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",d],[c,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",d],[c,"Invalid Configuration: Missing Region"]]},ut=2,n=1e8,dt=new Int32Array([-1,1,-1,0,13,3,1,4,n+12,2,5,n+12,3,8,6,4,7,n+11,5,n+9,n+10,4,11,9,6,10,n+8,7,n+6,n+7,5,12,n+5,6,n+4,n+5,3,n+1,14,4,n+2,n+3]),lt=Ie.from(dt,ut,w.conditions,w.results),pt=new Ae({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),ht=(e,t={})=>pt.get(e,()=>ye(lt,{endpointParams:e,logger:t.logger}));Oe.aws=B;class u extends de{constructor(e){super(e);Object.setPrototypeOf(this,u.prototype)}}class C extends u{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,C.prototype)}}class x extends u{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,x.prototype)}}class I extends u{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e});Object.setPrototypeOf(this,I.prototype)}}class A extends u{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e});Object.setPrototypeOf(this,A.prototype)}}var gt="AccessTokenType",mt="GetRoleCredentials",_t="GetRoleCredentialsRequest",St="GetRoleCredentialsResponse",ft="InvalidRequestException",Et="RoleCredentials",Pt="ResourceNotFoundException",vt="SecretAccessKeyType",Rt="SessionTokenType",Ct="TooManyRequestsException",xt="UnauthorizedException",It="accountId",At="accessKeyId",yt="accessToken",Ot="account_id",_="client",S="error",Tt="expiration",Dt="http",f="httpError",Nt="httpHeader",k="httpQuery",E="message",wt="roleCredentials",kt="roleName",bt="role_name",H="smithy.ts.sdk.synthetic.com.amazonaws.sso",Ft="secretAccessKey",$t="sessionToken",qt="x-amz-sso_bearer_token",r="com.amazonaws.sso",U=F.for(H),Ht=[-3,H,"SSOServiceException",0,[],[]];U.registerError(Ht,u);var p=F.for(r),Ut=[-3,r,ft,{[S]:_,[f]:400},[E],[0]];p.registerError(Ut,C);var Gt=[-3,r,Pt,{[S]:_,[f]:404},[E],[0]];p.registerError(Gt,x);var Mt=[-3,r,Ct,{[S]:_,[f]:429},[E],[0]];p.registerError(Mt,I);var zt=[-3,r,xt,{[S]:_,[f]:401},[E],[0]];p.registerError(zt,A);var jt=[U,p],Lt=[0,r,gt,8,0],Kt=[0,r,vt,8,0],Vt=[0,r,Rt,8,0],Bt=[3,r,_t,0,[kt,It,yt],[[0,{[k]:bt}],[0,{[k]:Ot}],[()=>Lt,{[Nt]:qt}]],3],Wt=[3,r,St,0,[wt],[[()=>Qt,0]]],Qt=[3,r,Et,0,[At,Ft,$t,Tt],[0,[()=>Kt,0],[()=>Vt,0],1]],Jt=[9,r,mt,{[Dt]:["GET","/federation/credentials",200]},()=>Bt,()=>Wt],Xt=(e)=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??Be,base64Encoder:e?.base64Encoder??Ve,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ht,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??st,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ze},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new re}],logger:e?.logger??new le,protocol:e?.protocol??Je,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:jt,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",sha256:e?.sha256??Xe,urlParser:e?.urlParser??Ne,utf8Decoder:e?.utf8Decoder??Ke,utf8Encoder:e?.utf8Encoder??Le}),Zt=(e)=>{pe(process.version);let t=Ee(e),s=()=>t().then(he),i=Xt(e);W(process.version);let o={profile:e?.profile,logger:i.logger};return{...i,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??a(je,o),bodyLengthChecker:e?.bodyLengthChecker??We,defaultUserAgentProvider:e?.defaultUserAgentProvider??Q({serviceId:i.serviceId,clientVersion:ct.version}),maxAttempts:e?.maxAttempts??a(qe,e),region:e?.region??a(Re,{...Ce,...o}),requestHandler:Ye.create(e?.requestHandler??s),retryMode:e?.retryMode??a({...$e,default:async()=>(await s()).retryMode||Fe},e),streamCollector:e?.streamCollector??Qe,useDualstackEndpoint:e?.useDualstackEndpoint??a(ve,o),useFipsEndpoint:e?.useFipsEndpoint??a(Pe,o),userAgentAppId:e?.userAgentAppId??a(Y,o)}},es=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:s,credentials:i}=e;return{setHttpAuthScheme(o){let h=t.findIndex((P)=>P.schemeId===o.schemeId);if(h===-1)t.push(o);else t.splice(h,1,o)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(o){s=o},httpAuthSchemeProvider(){return s},setCredentials(o){i=o},credentials(){return i}}},ts=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),ss=(e,t)=>{let s=Object.assign(J(e),ge(e),we(e),es(e));return t.forEach((i)=>i.configure(s)),Object.assign(e,X(s),me(s),ke(s),ts(s))};class y extends _e{config;constructor(...[e]){let t=Zt(e||{});super(t);this.initConfig=t;let s=nt(t),i=Z(s),o=He(i),h=xe(o),P=ee(h),j=Te(P),L=ot(j),K=ss(L,e?.extensions||[]);this.config=K,this.middlewareStack.use(Ge(this.config)),this.middlewareStack.use(te(this.config)),this.middlewareStack.use(Ue(this.config)),this.middlewareStack.use(be(this.config)),this.middlewareStack.use(se(this.config)),this.middlewareStack.use(oe(this.config)),this.middlewareStack.use(ne(this.config)),this.middlewareStack.use(ie(this.config,{httpAuthSchemeParametersProvider:Ze,identityProviderConfigProvider:async(V)=>new ae({"aws.auth#sigv4":V.credentials})})),this.middlewareStack.use(ce(this.config))}destroy(){super.destroy()}}var os=Se(rt,"SWBPortalService","SSOClient",De),ns={},rs=(e,t,s,i)=>[];class O extends os(ns,rs,"GetRoleCredentials",Jt){}var is={GetRoleCredentialsCommand:O};class G extends y{}fe(is,G);var M=O;var z=y;export{M as GetRoleCredentialsCommand,z as SSOClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{z}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{z}from"./chunk-5ngftxjb.js";var c=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],iu=z("palette",c);var e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],au=z("shield",e);
|
|
2
|
+
export{iu,au};
|